diff --git a/BioInf/ViennaRNA/Bindings.hs b/BioInf/ViennaRNA/Bindings.hs
--- a/BioInf/ViennaRNA/Bindings.hs
+++ b/BioInf/ViennaRNA/Bindings.hs
@@ -1,14 +1,20 @@
 
 -- | Bindings to important functions in the ViennaRNA library.
+--
+-- TODO Anything here that is not thread-safe should internally use
+-- a mutex!
 
 module BioInf.ViennaRNA.Bindings
   ( module BioInf.ViennaRNA.Bindings
   , CofoldF (..)
+  , Duplex (..)
   ) where
 
 import qualified Data.Array.IArray as A
 
+import BioInf.ViennaRNA.Bindings.FFI.Centroid as FFI
 import BioInf.ViennaRNA.Bindings.FFI.CoFold   as FFI
+import BioInf.ViennaRNA.Bindings.FFI.Duplex   as FFI
 import BioInf.ViennaRNA.Bindings.FFI.Fold     as FFI
 import BioInf.ViennaRNA.Bindings.FFI.PartFunc as FFI
 
@@ -18,12 +24,26 @@
 mfe :: String -> IO (Double,String)
 mfe = ffiFold
 
+mfeTemp :: Double -> String -> IO (Double,String)
+mfeTemp = ffiFoldTemp
+
+circmfe :: String -> IO (Double,String)
+circmfe = ffiCircFold
+
 -- | Given a sequence and a structure, returns the energy of the
 -- sequence/structure pair.
 
 eos :: String -> String -> IO Double
 eos i s = ffiEnergyOfStructure i s 0
 
+eosTemp :: Double -> String -> String -> IO Double
+eosTemp t i s = ffiEnergyOfStructureTemp t i s 0
+
+-- | Energy of a circular structure
+
+eosCirc :: String -> String -> IO Double
+eosCirc i s = ffiEnergyOfCircStructure i s 0
+
 -- | Given a string, calculates the partition function for said string. Returns
 -- the ensemble energy, a string with where each nucleotide position is
 -- annotated with the strength of the potential pairing, and the whole base
@@ -35,8 +55,17 @@
 partConstrained :: String -> String -> IO (Double, String, A.Array (Int,Int) Double)
 partConstrained = ffi_pf_fold_constrained
 
+circPart :: String -> IO (Double,String,A.Array (Int,Int) Double)
+circPart = ffi_pf_circ_fold
 
+circPartConstrained :: String -> String -> IO (Double, String, A.Array (Int,Int) Double)
+circPartConstrained = ffi_pf_circ_fold_constrained
 
+-- | Centroid structure
+
+centroidTemp :: Double -> String -> IO (Double,String)
+centroidTemp t i = ffiCentroidTemp t i
+
 -- * RNAcofold
 
 -- | Energy of struct for cofolded structures.
@@ -58,4 +87,8 @@
 copartConstrained :: String -> String -> Int -> IO (CofoldF,String,A.Array (Int,Int) Double)
 copartConstrained sq str c = ffiCoPartitionConstrained c sq str
 
+-- | Fold a duplex structure
+
+duplexFold :: String -> String -> IO Duplex
+duplexFold = ffiDuplexFold
 
diff --git a/BioInf/ViennaRNA/Bindings/FFI/Centroid.chs b/BioInf/ViennaRNA/Bindings/FFI/Centroid.chs
new file mode 100644
--- /dev/null
+++ b/BioInf/ViennaRNA/Bindings/FFI/Centroid.chs
@@ -0,0 +1,30 @@
+
+module BioInf.ViennaRNA.Bindings.FFI.Centroid where
+
+import Foreign.C.String
+import Foreign.C.Types
+import Foreign.Marshal.Alloc
+import Foreign.Ptr
+import GHC.Float
+import Unsafe.Coerce
+
+import BioInf.ViennaRNA.Bindings.FFI.Utils
+
+
+
+#include "ViennaRNA/fold.h"
+
+
+
+ffiCentroidTemp :: Double -> String -> IO (Double,String)
+ffiCentroidTemp t inp =
+  withCAString inp $ \cinp ->
+  withCAString inp $ \struc -> do
+  e <- fold_centroid_p (realToFrac t) cinp struc
+  s <- peekCAString struc
+  return (cd2d e, s)
+
+
+
+foreign import ccall "ffiwrap_centroid_temp" fold_centroid_p :: CDouble -> CString -> CString -> IO CDouble
+
diff --git a/BioInf/ViennaRNA/Bindings/FFI/CoFold.chs b/BioInf/ViennaRNA/Bindings/FFI/CoFold.chs
--- a/BioInf/ViennaRNA/Bindings/FFI/CoFold.chs
+++ b/BioInf/ViennaRNA/Bindings/FFI/CoFold.chs
@@ -1,5 +1,3 @@
-{-# LANGUAGE ScopedTypeVariables #-}
-{-# LANGUAGE ForeignFunctionInterface #-}
 
 module BioInf.ViennaRNA.Bindings.FFI.CoFold
   ( ffiCoFold
@@ -25,10 +23,10 @@
 
 
 
-#include "cofold.h"
-#include "data_structures.h"
-#include "fold.h"
-#include "part_func_co.h"
+#include "ViennaRNA/cofold.h"
+#include "ViennaRNA/data_structures.h"
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/part_func_co.h"
 
 {#pointer *cofoldF as CofoldFPtr -> CofoldF #}
 
diff --git a/BioInf/ViennaRNA/Bindings/FFI/Duplex.chs b/BioInf/ViennaRNA/Bindings/FFI/Duplex.chs
new file mode 100644
--- /dev/null
+++ b/BioInf/ViennaRNA/Bindings/FFI/Duplex.chs
@@ -0,0 +1,78 @@
+
+module BioInf.ViennaRNA.Bindings.FFI.Duplex
+  ( Duplex (..)
+  , ffiDuplexFold
+  ) where
+
+import           Control.Applicative
+import           Control.Monad
+import           Foreign.C.String
+import           Foreign.C.Types
+import           Foreign.Marshal.Alloc
+import           Foreign.Marshal.Array
+import           Foreign.Ptr
+import           Foreign.Storable
+import           GHC.Float
+import qualified Data.Array.IArray as A
+import           Unsafe.Coerce
+
+import           BioInf.ViennaRNA.Bindings.FFI.Utils
+
+
+
+#include "ViennaRNA/duplex.h"
+#include "ViennaRNA/data_structures.h"
+
+{#pointer *duplexT as DuplexPtr -> Duplex #}
+
+data Duplex = Duplex
+  { i                 :: {-# UNPACK #-} !Int
+  , j                 :: {-# UNPACK #-} !Int
+  , end               :: {-# UNPACK #-} !Int
+  , structure         ::                !String
+  , energy            :: {-# UNPACK #-} !Double
+  , energyBacktrack   :: {-# UNPACK #-} !Double
+  , openingBacktrackX :: {-# UNPACK #-} !Double
+  , openingBacktrackY :: {-# UNPACK #-} !Double
+  , offset            :: {-# UNPACK #-} !Int
+  , dG1               :: {-# UNPACK #-} !Double
+  , dG2               :: {-# UNPACK #-} !Double
+  , ddG               :: {-# UNPACK #-} !Double
+  , tb                :: {-# UNPACK #-} !Int
+  , te                :: {-# UNPACK #-} !Int
+  , qb                :: {-# UNPACK #-} !Int
+  , qe                :: {-# UNPACK #-} !Int
+  }
+  deriving (Show)
+
+instance Storable Duplex where
+  sizeOf _ = {# sizeof duplexT #}
+  alignment _ = sizeOf (undefined :: CDouble)
+  peek p = Duplex
+    <$> liftM fromIntegral ({# get duplexT->i #} p)
+    <*> liftM fromIntegral ({# get duplexT->j #} p)
+    <*> liftM fromIntegral ({# get duplexT->end #} p)
+    <*> (peekCAString =<<  ({# get duplexT->structure #} p))
+    <*> liftM realToFrac   ({# get duplexT->energy #} p)
+    <*> liftM realToFrac   ({# get duplexT->energy_backtrack #} p)
+    <*> liftM realToFrac   ({# get duplexT->opening_backtrack_x #} p)
+    <*> liftM realToFrac   ({# get duplexT->opening_backtrack_y #} p)
+    <*> liftM fromIntegral ({# get duplexT->offset #} p)
+    <*> liftM realToFrac   ({# get duplexT->dG1 #} p)
+    <*> liftM realToFrac   ({# get duplexT->dG2 #} p)
+    <*> liftM realToFrac   ({# get duplexT->ddG #} p)
+    <*> liftM fromIntegral ({# get duplexT->tb #} p)
+    <*> liftM fromIntegral ({# get duplexT->te #} p)
+    <*> liftM fromIntegral ({# get duplexT->qb #} p)
+    <*> liftM fromIntegral ({# get duplexT->qe #} p)
+
+ffiDuplexFold :: String -> String -> IO Duplex
+ffiDuplexFold l r =
+  withCAString l $ \cl  ->
+  withCAString r $ \cr  ->
+  alloca         $ \ptr -> do
+  d <- duplexfold_p ptr cl cr >> peek ptr
+  return d
+
+foreign import ccall "ffiwrap_duplexfold" duplexfold_p :: DuplexPtr -> CString -> CString -> IO ()
+
diff --git a/BioInf/ViennaRNA/Bindings/FFI/Fold.chs b/BioInf/ViennaRNA/Bindings/FFI/Fold.chs
--- a/BioInf/ViennaRNA/Bindings/FFI/Fold.chs
+++ b/BioInf/ViennaRNA/Bindings/FFI/Fold.chs
@@ -1,10 +1,5 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
-{-# LANGUAGE CPP #-}
 
-module BioInf.ViennaRNA.Bindings.FFI.Fold
-  ( ffiFold
-  , ffiEnergyOfStructure
-  ) where
+module BioInf.ViennaRNA.Bindings.FFI.Fold where
 
 import Foreign.C.String
 import Foreign.C.Types
@@ -17,7 +12,7 @@
 
 
 
-#include "fold.h"
+#include "ViennaRNA/fold.h"
 
 ffiFold :: String -> IO (Double,String)
 ffiFold inp = withCAString inp $ \cinp ->
@@ -33,4 +28,42 @@
     setCutPoint (-1)
     >>  {#call energy_of_structure #} i s (fromIntegral verb :: CInt)
     >>= (return . cf2d)
+
+ffiEnergyOfCircStructure :: String -> String -> Int -> IO Double
+ffiEnergyOfCircStructure inp struc verb =
+  withCAString inp   $ \i ->
+  withCAString struc $ \s ->
+    setCutPoint (-1)
+    >>  {#call energy_of_circ_structure #} i s (fromIntegral verb :: CInt)
+    >>= (return . cf2d)
+
+ffiCircFold :: String -> IO (Double,String)
+ffiCircFold inp = withCAString inp $ \cinp ->
+                  withCAString inp $ \struc -> do
+  e <- {#call circfold #} cinp struc
+  s <- peekCAString struc
+  return (cf2d e, s)
+
+
+
+ffiFoldTemp :: Double -> String -> IO (Double,String)
+ffiFoldTemp t inp =
+  withCAString inp $ \cinp ->
+  withCAString inp $ \struc -> do
+  e <- fold_temp_p (realToFrac t) cinp struc
+  s <- peekCAString struc
+  return (cf2d e, s)
+
+ffiEnergyOfStructureTemp :: Double -> String -> String -> Int -> IO Double
+ffiEnergyOfStructureTemp t inp struc verb =
+  withCAString inp   $ \i ->
+  withCAString struc $ \s ->
+    setCutPoint (-1)
+    >>  eos_temp_p (realToFrac t) i s (fromIntegral verb :: CInt)
+    >>= (return . cf2d)
+
+
+foreign import ccall "ffiwrap_fold_temp" fold_temp_p :: CFloat -> CString -> CString -> IO CFloat
+
+foreign import ccall "ffiwrap_eos_temp" eos_temp_p :: CFloat -> CString -> CString -> CInt -> IO CFloat
 
diff --git a/BioInf/ViennaRNA/Bindings/FFI/PartFunc.chs b/BioInf/ViennaRNA/Bindings/FFI/PartFunc.chs
--- a/BioInf/ViennaRNA/Bindings/FFI/PartFunc.chs
+++ b/BioInf/ViennaRNA/Bindings/FFI/PartFunc.chs
@@ -1,8 +1,9 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
 
 module BioInf.ViennaRNA.Bindings.FFI.PartFunc
   ( ffi_pf_fold
+  , ffi_pf_circ_fold
   , ffi_pf_fold_constrained
+  , ffi_pf_circ_fold_constrained
   ) where
 
 import           Foreign.C.String
@@ -18,7 +19,7 @@
 
 
 
-#include "part_func.h"
+#include "ViennaRNA/part_func.h"
 
 ffi_pf_fold :: String -> IO (Double,String,A.Array (Int,Int) Double)
 ffi_pf_fold i =
@@ -33,6 +34,19 @@
   let ar = A.accumArray (const id) 0 ((1,1),(n,n)) $ zip [ (ii,jj) | ii <- [n,n-1..1], jj <- [n,n-1..ii]] (drop 1 $ map unsafeCoerce xs)
   return (cf2d e, s, ar)
 
+ffi_pf_circ_fold :: String -> IO (Double,String,A.Array (Int,Int) Double)
+ffi_pf_circ_fold i =
+  withCAString i $ \ci -> do
+  withCAString i $ \cs -> do
+  let n = length i
+  let z = n * (n+1) `div` 2 +1
+  e  <- {#call pf_circ_fold #} ci cs
+  s  <- peekCAString cs
+  bp <- {#call export_bppm #}
+  xs <- peekArray z (bp :: Ptr CDouble)
+  let ar = A.accumArray (const id) 0 ((1,1),(n,n)) $ zip [ (ii,jj) | ii <- [n,n-1..1], jj <- [n,n-1..ii]] (drop 1 $ map unsafeCoerce xs)
+  return (cf2d e, s, ar)
+
 ffi_pf_fold_constrained :: String -> String -> IO (Double,String,A.Array (Int,Int) Double)
 ffi_pf_fold_constrained i s =
   withCAString i $ \ci ->
@@ -46,7 +60,21 @@
   let ar = A.accumArray (const id) 0 ((1,1),(n,n)) $ zip [ (ii,jj) | ii <- [n,n-1..1], jj <- [n,n-1..ii]] (drop 1 $ map unsafeCoerce xs)
   return (cf2d e, s, ar)
 
+ffi_pf_circ_fold_constrained :: String -> String -> IO (Double,String,A.Array (Int,Int) Double)
+ffi_pf_circ_fold_constrained i s =
+  withCAString i $ \ci -> do
+  withCAString i $ \cs -> do
+  let n = length i
+  let z = n * (n+1) `div` 2 +1
+  e  <- {#call ffiwrap_pf_circ_fold_constrained #} ci cs 1
+  s  <- peekCAString cs
+  bp <- {#call export_bppm #}
+  xs <- peekArray z (bp :: Ptr CDouble)
+  let ar = A.accumArray (const id) 0 ((1,1),(n,n)) $ zip [ (ii,jj) | ii <- [n,n-1..1], jj <- [n,n-1..ii]] (drop 1 $ map unsafeCoerce xs)
+  return (cf2d e, s, ar)
+
 #c
 float ffiwrap_pf_fold_constrained (const char *sequence, char *structure, int constrained);
+float ffiwrap_pf_circ_fold_constrained (const char *sequence, char *structure, int constrained);
 #endc
 
diff --git a/BioInf/ViennaRNA/Bindings/FFI/Utils.hs b/BioInf/ViennaRNA/Bindings/FFI/Utils.hs
--- a/BioInf/ViennaRNA/Bindings/FFI/Utils.hs
+++ b/BioInf/ViennaRNA/Bindings/FFI/Utils.hs
@@ -1,4 +1,3 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
 
 module BioInf.ViennaRNA.Bindings.FFI.Utils where
 
@@ -12,6 +11,9 @@
 
 cf2d :: CFloat -> Double
 cf2d = float2Double . unsafeCoerce
+
+cd2d :: CDouble -> Double
+cd2d = unsafeCoerce
 
 foreign import ccall "fold.h &cut_point" cut_point :: Ptr CInt
 
diff --git a/C/ViennaRNA/2Dfold.c b/C/ViennaRNA/2Dfold.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/2Dfold.c
@@ -0,0 +1,3750 @@
+/*
+      minimum free energy
+      RNA secondary structure with
+      basepair distance d_1 to reference structure 1 and distance d_2 to reference structure 2
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/params.h"
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+#include "ViennaRNA/2Dfold.h"
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+int compute_2Dfold_F3 = 0;
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE void  mfe_linear(vrna_fold_compound_t *vc);
+PRIVATE void  mfe_circ(vrna_fold_compound_t *vc);
+
+PUBLIC  void  update_TwoDfold_params(TwoDfold_vars *vars);
+
+PRIVATE void  backtrack_f5(unsigned int j, int k, int l, char *structure, vrna_fold_compound_t *vc);
+PRIVATE void  backtrack_c(unsigned int i, unsigned int j, int k, int l, char *structure, vrna_fold_compound_t *vc);
+PRIVATE void  backtrack_m(unsigned int i, unsigned int j, int k, int l, char *structure, vrna_fold_compound_t *vc);
+PRIVATE void  backtrack_m1(unsigned int i, unsigned int j, int k, int l, char *structure, vrna_fold_compound_t *vc);
+PRIVATE void  backtrack_fc(int k, int l, char *structure, vrna_fold_compound_t *vc);
+PRIVATE void  backtrack_m2(unsigned int i, int k, int l, char *structure, vrna_fold_compound_t *vc);
+
+PRIVATE void  adjustArrayBoundaries(int ***array, int *k_min, int *k_max, int **l_min, int **l_max, int k_min_real, int k_max_real, int *l_min_real, int *l_max_real);
+INLINE  PRIVATE void  preparePosteriorBoundaries(int size, int shift, int *min_k, int *max_k, int **min_l, int **max_l);
+INLINE  PRIVATE void  updatePosteriorBoundaries(int d1, int d2, int *min_k, int *max_k, int **min_l, int **max_l);
+INLINE  PRIVATE void  prepareBoundaries(int min_k_pre, int max_k_pre, int min_l_pre, int max_l_pre, int bpdist, int *min_k, int *max_k, int **min_l, int **max_l);
+INLINE  PRIVATE void  prepareArray(int ***array, int min_k, int max_k, int *min_l, int *max_l);
+INLINE  PRIVATE void  prepareArray2(unsigned long ***array, int min_k, int max_k, int *min_l, int *max_l);
+
+
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+#if 0
+
+PRIVATE void initialize_TwoDfold_vars(TwoDfold_vars *vars){
+  update_TwoDfold_params(vars);
+  /* this call updates the params in the ViennaRNA fold.o which is a global, so be careful
+  *  whith calling it parallel... need a workarround or fix of ViennaRNA fold stuff
+  */
+  update_fold_params();
+}
+
+PUBLIC TwoDfold_solution **TwoDfold(TwoDfold_vars *vars, int distance1, int distance2){
+  unsigned int i, d1, d2;
+  unsigned int maxD1;
+  unsigned int maxD2;
+  unsigned int length;
+  TwoDfold_solution **output;
+
+  initialize_TwoDfold_vars(vars);
+  if(fabs(vars->P->temperature - temperature)>1e-6) update_TwoDfold_params(vars);
+  vars->S   = encode_sequence(vars->sequence, 0);
+  vars->S1  = encode_sequence(vars->sequence, 1);
+
+  make_ptypes(vars);
+
+  maxD1 = vars->maxD1;
+  maxD2 = vars->maxD2;
+
+  if(distance1 >= 0){
+    if((unsigned int)distance1 > maxD1)
+      fprintf(stderr,
+              "limiting maximum basepair distance 1 to %u\n",
+              maxD1);
+    else
+      maxD1 = (unsigned int)distance1;
+  }
+
+  if(distance2 >= 0){
+    if((unsigned int)distance2 > maxD2)
+      fprintf(stderr,
+              "limiting maximum basepair distance 2 to %u\n",
+              maxD2);
+    else
+      maxD2 = (unsigned int)distance2;
+  }
+
+  vars->maxD1 = maxD1;
+  vars->maxD2 = maxD2;
+  output = (TwoDfold_solution **)vrna_alloc((vars->maxD1+1) * sizeof(TwoDfold_solution *));
+
+  mfe_linear(vars);
+  if(vars->circ) mfe_circ(vars);
+
+  length = vars->seq_length;
+
+  for(d1=0; d1<=maxD1;d1++){
+    output[d1] = (TwoDfold_solution *)vrna_alloc((vars->maxD2+1)*sizeof(TwoDfold_solution));
+#ifdef _OPENMP
+  #pragma omp parallel for private(d2)
+#endif
+    for(d2=0; d2<=maxD2;d2++){
+      output[d1][d2].en = (float)INF/(float)100.;
+      output[d1][d2].s  = NULL;
+    }
+    if(     (d1 >= ((vars->circ) ? vars->k_min_values_fc : vars->k_min_values_f[length]))
+        &&  (d1 <= ((vars->circ) ? vars->k_max_values_fc : vars->k_max_values_f[length]))){
+#ifdef _OPENMP
+  #pragma omp parallel for private(d2, i)
+#endif
+      for(  d2  = ((vars->circ) ? vars->l_min_values_fc[d1] : vars->l_min_values_f[length][d1]);
+            d2 <= ((vars->circ) ? vars->l_max_values_fc[d1] : vars->l_max_values_f[length][d1]);
+            d2 += 2){
+        output[d1][d2].en = (float)((vars->circ) ? vars->E_Fc[d1][d2/2] : vars->E_F5[length][d1][d2/2])/(float)100.;
+        if(vars->do_backtrack && (output[d1][d2].en != (float)INF/(float)100.)){
+          char *mfe_structure = (char *)vrna_alloc(length+1);
+          for(i=0;i<length;i++) mfe_structure[i] = '.';
+          mfe_structure[i] = '\0';
+          (vars->circ) ? backtrack_fc(d1, d2, mfe_structure, vars) : backtrack_f5(length, d1, d2, mfe_structure, vars);
+          output[d1][d2].s = mfe_structure;
+        }
+      }
+    }
+
+  }
+  return output;
+}
+
+#endif
+
+PUBLIC vrna_sol_TwoD_t *
+vrna_mfe_TwoD(vrna_fold_compound_t *vars,
+              int distance1,
+              int distance2){
+
+  unsigned int  i, d1, d2;
+  unsigned int  maxD1;
+  unsigned int  maxD2;
+  unsigned int  length;
+  unsigned int  counter = 0;
+  int           en = 0;
+  vrna_sol_TwoD_t *output;
+  vrna_md_t     *md;
+  vrna_mx_mfe_t *matrices;
+
+  maxD1 = vars->maxD1;
+  maxD2 = vars->maxD2;
+  matrices  = vars->matrices;
+  md        = &(vars->params->model_details);
+
+  if(distance1 >= 0){
+    if((unsigned int)distance1 > maxD1)
+      vrna_message_warning("vrna_mfe_TwoD@2Dfold.c: limiting maximum basepair distance 1 to %u\n",
+                                  maxD1);
+    else
+      maxD1 = (unsigned int)distance1;
+  }
+
+  if(distance2 >= 0){
+    if((unsigned int)distance2 > maxD2)
+      vrna_message_warning("vrna_mfe_TwoD@2Dfold.c: limiting maximum basepair distance 2 to %u\n",
+                                  maxD2);
+    else
+      maxD2 = (unsigned int)distance2;
+  }
+
+  vars->maxD1 = maxD1;
+  vars->maxD2 = maxD2;
+  output = (vrna_sol_TwoD_t *)vrna_alloc((((vars->maxD1+1)*(vars->maxD2+2))/2 + 2) * sizeof(vrna_sol_TwoD_t));
+
+  mfe_linear(vars);
+  if(md->circ) mfe_circ(vars);
+
+  length = vars->length;
+
+  for(d1=0; d1<=maxD1;d1++){
+    if((d1 >= ((md->circ) ? matrices->k_min_Fc : matrices->k_min_F5[length]))
+        &&  (d1 <= ((md->circ) ? matrices->k_max_Fc : matrices->k_max_F5[length]))){
+      for(d2  = ((md->circ) ? matrices->l_min_Fc[d1] : matrices->l_min_F5[length][d1]);
+          d2 <= ((md->circ) ? matrices->l_max_Fc[d1] : matrices->l_max_F5[length][d1]);
+          d2 += 2){
+        en = ((md->circ) ? matrices->E_Fc[d1][d2/2] : matrices->E_F5[length][d1][d2/2]);
+        if(en == INF) continue;
+        output[counter].k   = d1;
+        output[counter].l   = d2;
+        output[counter].en  = (float)en/(float)100.;
+        if(md->backtrack){
+          char *mfe_structure = (char *)vrna_alloc(length+1);
+          for(i=0;i<length;i++) mfe_structure[i] = '.';
+          mfe_structure[i] = '\0';
+          (md->circ) ? backtrack_fc((int)d1, (int)d2, mfe_structure, vars) : backtrack_f5(length, (int)d1, (int)d2, mfe_structure, vars);
+          output[counter].s = mfe_structure;
+        }
+        else output[counter].s = NULL;
+        counter++;
+      }
+    }
+  }
+
+  /* store entry for remaining partition if it exists */
+  en = ((md->circ) ? matrices->E_Fc_rem : matrices->E_F5_rem[length]);
+  if(en != INF){
+    output[counter].k   = -1;
+    output[counter].l   = -1;
+    output[counter].en  =  (float)en/(float)100.;
+    if(md->backtrack){
+      char *mfe_structure = (char *)vrna_alloc(length+1);
+      for(i=0;i<length;i++) mfe_structure[i] = '.';
+      mfe_structure[i] = '\0';
+      (md->circ) ? backtrack_fc(-1, -1, mfe_structure, vars) : backtrack_f5(length, -1, -1, mfe_structure, vars);
+      output[counter].s = mfe_structure;
+    }
+    else output[counter].s = NULL;
+    counter++;
+  }
+
+  /* insert end-marker entry */
+  output[counter].k = output[counter].l = INF;
+  counter++;
+
+  /* resize to actual dataset amount */
+  output = (vrna_sol_TwoD_t *)vrna_realloc(output, sizeof(vrna_sol_TwoD_t) * counter);
+  return output;
+}
+
+
+PUBLIC char *
+vrna_backtrack5_TwoD( vrna_fold_compound_t *vc,
+                      int k,
+                      int l,
+                      unsigned int j){
+
+  unsigned int i;
+  char *mfe_structure = (char *)vrna_alloc(j+1);
+  if(j < TURN + 2) return NULL;
+
+  for(i=0; i < j; i++) mfe_structure[i] = '.';
+  mfe_structure[i] = '\0';
+
+  backtrack_f5(j, k, l, mfe_structure, vc);
+  return mfe_structure;
+}
+
+PRIVATE void
+mfe_linear(vrna_fold_compound_t *vc){
+
+  unsigned int  d, i, j, ij, maxD1, maxD2, seq_length, dia, dib, dja, djb, *referenceBPs1, *referenceBPs2, *mm1, *mm2, *bpdist;
+  int           cnt1, cnt2, cnt3, cnt4, d1, d2, energy, dangles, temp2, type, additional_en, *my_iindx, *jindx, circ, *rtype;
+  short         *S1, *reference_pt1, *reference_pt2;
+  char          *sequence, *ptype;
+  vrna_param_t  *P;
+  vrna_mx_mfe_t *matrices;
+  vrna_md_t     *md;
+
+  /* dereferenciate things we often need */
+  P               = vc->params;
+  md              = &(P->model_details);
+  matrices        = vc->matrices;
+  sequence        = vc->sequence;
+  seq_length      = vc->length;
+  maxD1           = vc->maxD1;
+  maxD2           = vc->maxD2;
+  S1              = vc->sequence_encoding;
+  ptype           = vc->ptype;
+  rtype           = &(md->rtype[0]);
+  reference_pt1   = vc->reference_pt1;
+  reference_pt2   = vc->reference_pt2;
+  my_iindx        = vc->iindx;
+  jindx           = vc->jindx;
+  referenceBPs1   = vc->referenceBPs1;
+  referenceBPs2   = vc->referenceBPs2;
+  mm1             = vc->mm1;
+  mm2             = vc->mm2;
+  bpdist          = vc->bpdist;
+  dangles         = md->dangles;
+  circ            = md->circ;
+
+  for (d = TURN+2; d <= seq_length; d++) { /* i,j in [1..length] */
+#ifdef _OPENMP
+  #pragma omp parallel for private(additional_en, j, energy, temp2, i, ij, dia,dib,dja,djb,cnt1,cnt2,cnt3,cnt4, d1, d2)
+#endif
+    for (j = d; j <= seq_length; j++) {
+      unsigned int p, q, pq, u, maxp, dij;
+      int type_2, type, tt, no_close, base_d1, base_d2;
+
+      i = j-d+1;
+      dij = j - i - 1;
+      ij = my_iindx[i]-j;
+      type = ptype[jindx[j] + i];
+
+      no_close = (((type==3)||(type==4))&&no_closingGU);
+
+      if (type) {   /* we have a pair */
+        /* increase or decrease distance-to-reference value depending whether (i,j) is included in
+        *  reference or has to be introduced
+        */
+        base_d1 = ((unsigned int)reference_pt1[i] != j) ? 1 : -1;
+        base_d2 = ((unsigned int)reference_pt2[i] != j) ? 1 : -1;
+
+        /* HAIRPIN STRUCTURES */
+
+        /* get distance to reference if closing the hairpin
+        *  d = dbp(T_{i,j}, {i,j})
+        */
+        d1 = base_d1 + referenceBPs1[ij];
+        d2 = base_d2 + referenceBPs2[ij];
+
+        int min_k, max_k, min_l, max_l;
+        int real_min_k, real_max_k, *min_l_real, *max_l_real;
+
+        min_l = min_k = 0;
+        max_k = mm1[ij] + referenceBPs1[ij];
+        max_l = mm2[ij] + referenceBPs2[ij];
+
+        prepareBoundaries(min_k,
+                          max_k,
+                          min_l,
+                          max_l,
+                          bpdist[ij],
+                          &matrices->k_min_C[ij],
+                          &matrices->k_max_C[ij],
+                          &matrices->l_min_C[ij],
+                          &matrices->l_max_C[ij]
+                          );
+
+        preparePosteriorBoundaries( matrices->k_max_C[ij] - matrices->k_min_C[ij] + 1,
+                                    matrices->k_min_C[ij],
+                                    &real_min_k,
+                                    &real_max_k,
+                                    &min_l_real,
+                                    &max_l_real
+                                  );
+
+        prepareArray( &matrices->E_C[ij],
+                      matrices->k_min_C[ij],
+                      matrices->k_max_C[ij],
+                      matrices->l_min_C[ij],
+                      matrices->l_max_C[ij]
+                    );
+
+#ifdef COUNT_STATES
+        prepareArray2( &matrices->N_C[ij],
+                      matrices->k_min_C[ij],
+                      matrices->k_max_C[ij],
+                      matrices->l_min_C[ij],
+                      matrices->l_max_C[ij]
+                    );
+#endif
+
+        /* d1 and d2 are the distancies to both references introduced by closing a hairpin structure at (i,j) */
+        if((d1 >= 0) && (d2 >= 0)){
+          if(((unsigned int)d1<=maxD1) && ((unsigned int)d2 <= maxD2)){
+            matrices->E_C[ij][d1][d2/2] = (no_close) ? FORBIDDEN : E_Hairpin(dij, type, S1[i+1], S1[j-1], sequence+i-1, P);
+            updatePosteriorBoundaries(d1,
+                                      d2,
+                                      &real_min_k,
+                                      &real_max_k,
+                                      &min_l_real,
+                                      &max_l_real
+                                      );
+#ifdef COUNT_STATES
+            matrices->N_C[ij][d1][d2/2] = 1;
+#endif
+          }
+          else{
+            matrices->E_C_rem[ij] = (no_close) ? FORBIDDEN : E_Hairpin(dij, type, S1[i+1], S1[j-1], sequence+i-1, P);
+          }
+        }
+        /* INTERIOR LOOP STRUCTURES */
+        maxp = MIN2(j-2-TURN,i+MAXLOOP+1);
+        for(p = i+1; p <= maxp; p++){
+          unsigned int minq = p + TURN + 1;
+          unsigned int ln_pre = dij + p;
+          if(ln_pre > minq + MAXLOOP) minq = ln_pre - MAXLOOP - 1;
+          for(q = minq; q < j; q++){
+            pq = my_iindx[p]-q;
+            /* set distance to reference structure... */
+            type_2 = ptype[jindx[q] + p];
+
+            if (type_2==0) continue;
+            type_2 = rtype[type_2];
+
+            /* get distance to reference if closing the interior loop
+            *  d2 = dbp(S_{i,j}, S_{p.q} + {i,j})
+            */
+            d1 = base_d1 + referenceBPs1[ij] - referenceBPs1[pq];
+            d2 = base_d2 + referenceBPs2[ij] - referenceBPs2[pq];
+
+            if(no_closingGU)
+              if(no_close||(type_2==3)||(type_2==4))
+                if((p>i+1)||(q<j-1)) continue;  /* continue unless stack */
+
+            energy = E_IntLoop(p-i-1, j-q-1, type, type_2, S1[i+1], S1[j-1], S1[p-1], S1[q+1], P);
+
+            if(matrices->E_C[pq] != NULL){
+              for(cnt1 = matrices->k_min_C[pq]; cnt1 <= matrices->k_max_C[pq]; cnt1++){
+                for(cnt2 = matrices->l_min_C[pq][cnt1]; cnt2 <= matrices->l_max_C[pq][cnt1]; cnt2+=2){
+                  if(matrices->E_C[pq][cnt1][cnt2/2] != INF){
+                    if(((cnt1 + d1) <= maxD1) && ((cnt2+d2) <= maxD2)){
+                        matrices->E_C[ij][cnt1 + d1][(cnt2 + d2)/2] = MIN2( matrices->E_C[ij][cnt1 + d1][(cnt2 + d2)/2],
+                                                                        matrices->E_C[pq][cnt1][cnt2/2] + energy
+                                                                      );
+                        updatePosteriorBoundaries(cnt1 + d1,
+                                                  cnt2 + d2,
+                                                  &real_min_k,
+                                                  &real_max_k,
+                                                  &min_l_real,
+                                                  &max_l_real
+                                                  );
+#ifdef COUNT_STATES
+                       matrices->N_C[ij][cnt1 + d1][(cnt2 + d2)/2] += matrices->N_C[pq][cnt1][cnt2/2];
+#endif
+                    }
+                    /* collect all cases where d1+cnt1 or d2+cnt2 exceeds maxD1, maxD2, respectively */
+                    else{
+                      matrices->E_C_rem[ij] = MIN2(matrices->E_C_rem[ij], matrices->E_C[pq][cnt1][cnt2/2] + energy);
+                    }
+                  }
+                }
+              }
+            }
+            /* collect all contributions where C[pq] already lies outside k_max, l_max boundary */
+            if(matrices->E_C_rem[pq] != INF){
+              matrices->E_C_rem[ij] = MIN2(matrices->E_C_rem[ij], matrices->E_C_rem[pq] + energy);
+            }
+          } /* end q-loop */
+        } /* end p-loop */
+
+
+
+        /* MULTI LOOP STRUCTURES */
+        if(!no_close){
+
+          /* dangle energies for multiloop closing stem */
+          tt = rtype[type];
+          temp2 = P->MLclosing;
+          if(dangles == 2)
+            temp2 += E_MLstem(tt, S1[j-1], S1[i+1], P);
+          else
+            temp2 += E_MLstem(tt, -1, -1, P);
+
+          for(u=i+TURN+2; u<j-TURN-2;u++){
+            int i1u   = my_iindx[i+1]-u;
+            int u1j1  = my_iindx[u+1]-j+1;
+            /* check all cases where either M or M1 are already out of scope of maxD1 and/or maxD2 */
+            if(matrices->E_M_rem[i1u] != INF){
+              for(cnt3 = matrices->k_min_M1[u1j1];
+                  cnt3 <= matrices->k_max_M1[u1j1];
+                  cnt3++)
+                for(cnt4 = matrices->l_min_M1[u1j1][cnt3];
+                    cnt4 <= matrices->l_max_M1[u1j1][cnt3];
+                    cnt4+=2){
+                  if(matrices->E_M1[u1j1][cnt3][cnt4/2]!= INF){
+                    matrices->E_C_rem[ij] = MIN2(matrices->E_C_rem[ij],
+                                              matrices->E_M_rem[i1u]
+                                            + matrices->E_M1[u1j1][cnt3][cnt4/2]
+                                            + temp2
+                                              );
+                  }
+                }
+              if(matrices->E_M1_rem[u1j1] != INF){
+                matrices->E_C_rem[ij] = MIN2(matrices->E_C_rem[ij],
+                                          matrices->E_M_rem[i1u]
+                                        + matrices->E_M1_rem[u1j1]
+                                        + temp2
+                                          );
+              }
+            }
+            if(matrices->E_M1_rem[u1j1] != INF){
+              for(cnt1 = matrices->k_min_M[i1u];
+                  cnt1 <= matrices->k_max_M[i1u];
+                  cnt1++)
+                for(cnt2 = matrices->l_min_M[i1u][cnt1];
+                    cnt2 <= matrices->l_max_M[i1u][cnt1];
+                    cnt2+=2)
+                  if(matrices->E_M[i1u][cnt1][cnt2/2] != INF){
+                    matrices->E_C_rem[ij] = MIN2(matrices->E_C_rem[ij],
+                                              matrices->E_M[i1u][cnt1][cnt2/2]
+                                            + matrices->E_M1_rem[u1j1]
+                                            + temp2
+                                              );
+                  }
+            }
+            /* get distance to reference if closing the multiloop
+            *  d = dbp(S_{i,j}, {i,j} + S_{i+1,u} + S_{u+1,j-1})
+            */
+            if(!matrices->E_M[i1u]) continue;
+            if(!matrices->E_M1[u1j1]) continue;
+
+            d1 = base_d1 + referenceBPs1[ij] - referenceBPs1[i1u] - referenceBPs1[u1j1];
+            d2 = base_d2 + referenceBPs2[ij] - referenceBPs2[i1u] - referenceBPs2[u1j1];
+
+            for(cnt1 = matrices->k_min_M[i1u];
+                cnt1 <= matrices->k_max_M[i1u];
+                cnt1++)
+              for(cnt2 = matrices->l_min_M[i1u][cnt1];
+                  cnt2 <= matrices->l_max_M[i1u][cnt1];
+                  cnt2+=2)
+                for(cnt3 = matrices->k_min_M1[u1j1];
+                    cnt3 <= matrices->k_max_M1[u1j1];
+                    cnt3++)
+                  for(cnt4 = matrices->l_min_M1[u1j1][cnt3];
+                      cnt4 <= matrices->l_max_M1[u1j1][cnt3];
+                      cnt4+=2){
+                    if((matrices->E_M[i1u][cnt1][cnt2/2] != INF) && (matrices->E_M1[u1j1][cnt3][cnt4/2]!= INF)){
+                      if(((cnt1+cnt3+d1) <= maxD1) && ((cnt2+cnt4+d2) <= maxD2)){
+                        matrices->E_C[ij][cnt1+cnt3+d1][(cnt2+cnt4+d2)/2] = MIN2( matrices->E_C[ij][cnt1+cnt3+d1][(cnt2+cnt4+d2)/2],
+                                                                              matrices->E_M[i1u][cnt1][cnt2/2]
+                                                                            + matrices->E_M1[u1j1][cnt3][cnt4/2]
+                                                                            + temp2
+                                                                            );
+                        updatePosteriorBoundaries(cnt1 + cnt3 + d1,
+                                                  cnt2 + cnt4 + d2,
+                                                  &real_min_k,
+                                                  &real_max_k,
+                                                  &min_l_real,
+                                                  &max_l_real
+                                                );
+#ifdef COUNT_STATES
+                        matrices->N_C[ij][cnt1+cnt3+d1][(cnt2+cnt4+d2)/2] += matrices->N_M[i1u][cnt1][cnt2/2] * matrices->N_M1[u1j1][cnt3][cnt4/2];
+#endif
+                      }
+                      /* collect all cases where d1+cnt1+cnt3 or d2+cnt2+cnt4 exceeds maxD1, maxD2, respectively */
+                      else{
+                        matrices->E_C_rem[ij] = MIN2(  matrices->E_C_rem[ij],
+                                                    matrices->E_M[i1u][cnt1][cnt2/2]
+                                                  + matrices->E_M1[u1j1][cnt3][cnt4/2]
+                                                  + temp2
+                                                  );
+                      }
+                    }
+                  }
+          }
+        }
+
+        /* resize and move memory portions of energy matrix E_C */
+        adjustArrayBoundaries(&matrices->E_C[ij],
+                              &matrices->k_min_C[ij],
+                              &matrices->k_max_C[ij],
+                              &matrices->l_min_C[ij],
+                              &matrices->l_max_C[ij],
+                              real_min_k,
+                              real_max_k,
+                              min_l_real,
+                              max_l_real
+                              );
+#ifdef COUNT_STATES
+        /* actually we should adjust the array boundaries here but we might never use the count states option more than once so what....*/
+#endif
+      } /* end >> if (pair) << */
+
+
+
+      /* done with c[i,j], now compute fML[i,j] */
+      /* free ends ? -----------------------------------------*/
+
+
+      dia = referenceBPs1[ij] - referenceBPs1[my_iindx[i+1]-j];
+      dib = referenceBPs2[ij] - referenceBPs2[my_iindx[i+1]-j];
+      dja = referenceBPs1[ij] - referenceBPs1[ij+1];
+      djb = referenceBPs2[ij] - referenceBPs2[ij+1];
+
+      if(dangles==2)
+        temp2 = E_MLstem(type, ((i > 1) || circ) ? S1[i-1] : -1, ((j < seq_length) || circ) ? S1[j+1] : -1, P);
+      else
+        temp2 = E_MLstem(type, -1, -1, P);
+
+      int min_k_guess, max_k_guess, min_l_guess, max_l_guess;
+      int min_k_real_m, max_k_real_m, *min_l_real_m, *max_l_real_m;
+      int min_k_real_m1, max_k_real_m1, *min_l_real_m1, *max_l_real_m1;
+
+      min_k_guess = min_l_guess = 0;
+      max_k_guess = mm1[ij] + referenceBPs1[ij];
+      max_l_guess = mm2[ij] + referenceBPs2[ij];
+
+      prepareBoundaries(min_k_guess,
+                        max_k_guess,
+                        min_l_guess,
+                        max_l_guess,
+                        bpdist[ij],
+                        &matrices->k_min_M[ij],
+                        &matrices->k_max_M[ij],
+                        &matrices->l_min_M[ij],
+                        &matrices->l_max_M[ij]
+                        );
+
+      prepareBoundaries(min_k_guess,
+                        max_k_guess,
+                        min_l_guess,
+                        max_l_guess,
+                        bpdist[ij],
+                        &matrices->k_min_M1[ij],
+                        &matrices->k_max_M1[ij],
+                        &matrices->l_min_M1[ij],
+                        &matrices->l_max_M1[ij]
+                        );
+
+      preparePosteriorBoundaries( matrices->k_max_M[ij] - matrices->k_min_M[ij] + 1,
+                                  matrices->k_min_M[ij],
+                                  &min_k_real_m,
+                                  &max_k_real_m,
+                                  &min_l_real_m,
+                                  &max_l_real_m
+                                );
+      preparePosteriorBoundaries( matrices->k_max_M1[ij] - matrices->k_min_M1[ij] + 1,
+                                  matrices->k_min_M1[ij],
+                                  &min_k_real_m1,
+                                  &max_k_real_m1,
+                                  &min_l_real_m1,
+                                  &max_l_real_m1
+                                );
+
+      prepareArray( &matrices->E_M[ij],
+                    matrices->k_min_M[ij],
+                    matrices->k_max_M[ij],
+                    matrices->l_min_M[ij],
+                    matrices->l_max_M[ij]
+                  );
+
+      prepareArray( &matrices->E_M1[ij],
+                    matrices->k_min_M1[ij],
+                    matrices->k_max_M1[ij],
+                    matrices->l_min_M1[ij],
+                    matrices->l_max_M1[ij]
+                  );
+#ifdef COUNT_STATES
+      prepareArray2( &matrices->N_M[ij],
+                    matrices->k_min_M[ij],
+                    matrices->k_max_M[ij],
+                    matrices->l_min_M[ij],
+                    matrices->l_max_M[ij]
+                  );
+      prepareArray2( &matrices->N_M1[ij],
+                    matrices->k_min_M1[ij],
+                    matrices->k_max_M1[ij],
+                    matrices->l_min_M1[ij],
+                    matrices->l_max_M1[ij]
+                  );
+#endif
+
+      /* now to the actual computations... */
+      /* 1st E_M[ij] = E_M1[ij] = E_C[ij] + b */
+      if(matrices->E_C_rem[ij] != INF){
+        matrices->E_M_rem[ij] = matrices->E_M1_rem[ij] = temp2 + matrices->E_C_rem[ij];
+      }
+      if(matrices->E_C[ij])
+        for(cnt1 = matrices->k_min_C[ij]; cnt1 <= matrices->k_max_C[ij]; cnt1++){
+          for(cnt2 = matrices->l_min_C[ij][cnt1]; cnt2 <= matrices->l_max_C[ij][cnt1]; cnt2+=2){
+            if(matrices->E_C[ij][cnt1][cnt2/2] != INF){
+              matrices->E_M[ij][cnt1][cnt2/2] = matrices->E_M1[ij][cnt1][cnt2/2] = temp2 + matrices->E_C[ij][cnt1][cnt2/2];
+              updatePosteriorBoundaries(cnt1,
+                                        cnt2,
+                                        &min_k_real_m,
+                                        &max_k_real_m,
+                                        &min_l_real_m,
+                                        &max_l_real_m
+                                        );
+              updatePosteriorBoundaries(cnt1,
+                                        cnt2,
+                                        &min_k_real_m1,
+                                        &max_k_real_m1,
+                                        &min_l_real_m1,
+                                        &max_l_real_m1
+                                        );
+#ifdef COUNT_STATES
+             matrices->N_M[ij][cnt1][cnt2/2] = matrices->N_M1[ij][cnt1][cnt2/2] = matrices->N_C[ij][cnt1][cnt2/2];
+#endif
+            }
+          }
+        }
+
+      /* 2nd E_M[ij] = MIN(E_M[ij], E_M[i+1,j] + c) */
+      if(matrices->E_M_rem[my_iindx[i+1]-j] != INF){
+        matrices->E_M_rem[ij] = MIN2(matrices->E_M_rem[ij],
+                                  matrices->E_M_rem[my_iindx[i+1]-j] + P->MLbase
+                                  );
+      }
+      if(matrices->E_M[my_iindx[i+1]-j])
+        for(cnt1 = matrices->k_min_M[my_iindx[i+1]-j];
+            cnt1 <= matrices->k_max_M[my_iindx[i+1]-j];
+            cnt1++){
+          for(cnt2 = matrices->l_min_M[my_iindx[i+1]-j][cnt1];
+              cnt2 <= matrices->l_max_M[my_iindx[i+1]-j][cnt1];
+              cnt2+=2){
+            if(matrices->E_M[my_iindx[i+1]-j][cnt1][cnt2/2] != INF){
+              if(((cnt1 + dia) <= maxD1) && ((cnt2 + dib) <= maxD2)){
+                matrices->E_M[ij][cnt1+dia][(cnt2+dib)/2] = MIN2( matrices->E_M[ij][cnt1+dia][(cnt2+dib)/2],
+                                                              matrices->E_M[my_iindx[i+1]-j][cnt1][cnt2/2] + P->MLbase
+                                                            );
+                updatePosteriorBoundaries(cnt1 + dia,
+                                          cnt2 + dib,
+                                          &min_k_real_m,
+                                          &max_k_real_m,
+                                          &min_l_real_m,
+                                          &max_l_real_m
+                                          );
+#ifdef COUNT_STATES
+                matrices->N_M[ij][cnt1+dia][(cnt2+dib)/2] += matrices->N_M[my_iindx[i+1]-j][cnt1][cnt2/2];
+#endif
+              }
+              /* collect all cases where dia+cnt1 or dib+cnt2 exceeds maxD1, maxD2, respectively */
+              else{
+                matrices->E_M_rem[ij] = MIN2(matrices->E_M_rem[ij],
+                                          matrices->E_M[my_iindx[i+1]-j][cnt1][cnt2/2] + P->MLbase
+                                          );
+              }
+            }
+          }
+        }
+
+      /* 3rd E_M[ij] = MIN(E_M[ij], E_M[i,j-1] + c) */
+      if(matrices->E_M_rem[ij+1] != INF){
+        matrices->E_M_rem[ij] = MIN2(matrices->E_M_rem[ij],
+                                  matrices->E_M_rem[ij+1] + P->MLbase
+                                  );
+      }
+      if(matrices->E_M[ij+1])
+        for(cnt1 = matrices->k_min_M[ij+1];
+            cnt1 <= matrices->k_max_M[ij+1];
+            cnt1++){
+          for(cnt2 = matrices->l_min_M[ij+1][cnt1];
+              cnt2 <= matrices->l_max_M[ij+1][cnt1];
+              cnt2+=2){
+            if(matrices->E_M[ij+1][cnt1][cnt2/2] != INF){
+              if(((cnt1 + dja) <= maxD1) && ((cnt2 + djb) <= maxD2)){
+                matrices->E_M[ij][cnt1+dja][(cnt2+djb)/2] = MIN2( matrices->E_M[ij][cnt1+dja][(cnt2+djb)/2],
+                                                              matrices->E_M[ij+1][cnt1][cnt2/2] + P->MLbase
+                                                            );
+                updatePosteriorBoundaries(cnt1 + dja,
+                                          cnt2 + djb,
+                                          &min_k_real_m,
+                                          &max_k_real_m,
+                                          &min_l_real_m,
+                                          &max_l_real_m
+                                          );
+#ifdef COUNT_STATES
+                matrices->N_M[ij][cnt1+dja][(cnt2+djb)/2] += matrices->N_M[ij+1][cnt1][cnt2/2];
+#endif
+              }
+              /* collect all cases where dja+cnt1 or djb+cnt2 exceeds maxD1, maxD2, respectively */
+              else{
+                matrices->E_M_rem[ij] = MIN2(matrices->E_M_rem[ij],
+                                          matrices->E_M[ij+1][cnt1][cnt2/2] + P->MLbase
+                                          );
+              }
+            }
+          }
+        }
+
+      /* 4th E_M1[ij] = MIN(E_M1[ij], E_M1[i,j-1] + c) */
+      if(matrices->E_M1_rem[ij+1] != INF){
+        matrices->E_M1_rem[ij] = MIN2( matrices->E_M1_rem[ij],
+                                    matrices->E_M1_rem[ij+1] + P->MLbase
+                                  );
+      }
+      if(matrices->E_M1[ij+1])
+        for(cnt1 = matrices->k_min_M1[ij+1];
+            cnt1 <= matrices->k_max_M1[ij+1];
+            cnt1++){
+          for(cnt2 = matrices->l_min_M1[ij+1][cnt1];
+              cnt2 <= matrices->l_max_M1[ij+1][cnt1];
+              cnt2+=2){
+            if(matrices->E_M1[ij+1][cnt1][cnt2/2] != INF){
+              if(((cnt1 + dja) <= maxD1) && ((cnt2 + djb) <= maxD2)){
+                matrices->E_M1[ij][cnt1+dja][(cnt2+djb)/2]  = MIN2( matrices->E_M1[ij][cnt1+dja][(cnt2+djb)/2],
+                                                                matrices->E_M1[ij+1][cnt1][cnt2/2] + P->MLbase
+                                                              );
+                updatePosteriorBoundaries(cnt1 + dja,
+                                          cnt2 + djb,
+                                          &min_k_real_m1,
+                                          &max_k_real_m1,
+                                          &min_l_real_m1,
+                                          &max_l_real_m1
+                                          );
+#ifdef COUNT_STATES
+                matrices->N_M1[ij][cnt1+dja][(cnt2+djb)/2]  += matrices->N_M1[ij+1][cnt1][cnt2/2];
+#endif
+              }
+              /* collect all cases where dja+cnt1 or djb+cnt2 exceeds maxD1, maxD2, respectively */
+              else{
+                matrices->E_M1_rem[ij] = MIN2( matrices->E_M1_rem[ij],
+                                            matrices->E_M1[ij+1][cnt1][cnt2/2] + P->MLbase
+                                          );
+              }
+            }
+          }
+        }
+
+
+      /* 5th E_M[ij] = MIN(E_M[ij], min(E_M[i,k] + E_M[k+1,j])) */
+      if(j > TURN + 2)
+      for (u = i+1+TURN; u <= j-2-TURN; u++){
+        /* check all cases where M(i,u) and/or M(u+1,j) are already out of scope of maxD1 and/or maxD2 */
+        if(matrices->E_M_rem[my_iindx[i]-u] != INF){
+          for(cnt3 = matrices->k_min_M[my_iindx[u+1]-j];
+              cnt3 <= matrices->k_max_M[my_iindx[u+1]-j];
+              cnt3++){
+            for(cnt4 = matrices->l_min_M[my_iindx[u+1]-j][cnt3];
+                cnt4 <= matrices->l_max_M[my_iindx[u+1]-j][cnt3];
+                cnt4+=2){
+              if(matrices->E_M[my_iindx[u+1]-j][cnt3][cnt4/2] != INF){
+                  matrices->E_M_rem[ij] = MIN2(matrices->E_M_rem[ij],
+                                            matrices->E_M_rem[my_iindx[i]-u] + matrices->E_M[my_iindx[u+1]-j][cnt3][cnt4/2]
+                                            );
+              }
+            }
+          }
+          if(matrices->E_M_rem[my_iindx[u+1]-j] != INF){
+            matrices->E_M_rem[ij] = MIN2(matrices->E_M_rem[ij],
+                                      matrices->E_M_rem[my_iindx[i]-u] + matrices->E_M_rem[my_iindx[u+1]-j]
+                                      );
+          }
+        }
+        if(matrices->E_M_rem[my_iindx[u+1]-j] != INF){
+          for(cnt1 = matrices->k_min_M[my_iindx[i]-u];
+              cnt1 <= matrices->k_max_M[my_iindx[i]-u];
+              cnt1++){
+            for(cnt2 = matrices->l_min_M[my_iindx[i]-u][cnt1];
+                cnt2 <= matrices->l_max_M[my_iindx[i]-u][cnt1];
+                cnt2+=2){
+              if(matrices->E_M[my_iindx[i]-u][cnt1][cnt2/2] != INF){
+                matrices->E_M_rem[ij] = MIN2(matrices->E_M_rem[ij],
+                                          matrices->E_M[my_iindx[i]-u][cnt1][cnt2/2] + matrices->E_M_rem[my_iindx[u+1]-j]
+                                          );
+              }
+            }
+          }
+        }
+        if(!matrices->E_M[my_iindx[i]-u]) continue;
+        if(!matrices->E_M[my_iindx[u+1]-j]) continue;
+
+        dia = referenceBPs1[ij] - referenceBPs1[my_iindx[i]-u] - referenceBPs1[my_iindx[u+1]-j];
+        dib = referenceBPs2[ij] - referenceBPs2[my_iindx[i]-u] - referenceBPs2[my_iindx[u+1]-j];
+
+        for(cnt1 = matrices->k_min_M[my_iindx[i]-u];
+            cnt1 <= matrices->k_max_M[my_iindx[i]-u];
+            cnt1++){
+          for(cnt2 = matrices->l_min_M[my_iindx[i]-u][cnt1];
+              cnt2 <= matrices->l_max_M[my_iindx[i]-u][cnt1];
+              cnt2+=2){
+            for(cnt3 = matrices->k_min_M[my_iindx[u+1]-j];
+                cnt3 <= matrices->k_max_M[my_iindx[u+1]-j];
+                cnt3++){
+              for(cnt4 = matrices->l_min_M[my_iindx[u+1]-j][cnt3];
+                  cnt4 <= matrices->l_max_M[my_iindx[u+1]-j][cnt3];
+                  cnt4+=2){
+                if((matrices->E_M[my_iindx[i]-u][cnt1][cnt2/2] != INF) && (matrices->E_M[my_iindx[u+1]-j][cnt3][cnt4/2] != INF)){
+                  if(((cnt1 + cnt3 + dia) <= maxD1) && ((cnt2 + cnt4 + dib) <= maxD2)){
+                    matrices->E_M[ij][cnt1+cnt3+dia][(cnt2+cnt4+dib)/2] = MIN2( matrices->E_M[ij][cnt1+cnt3+dia][(cnt2+cnt4+dib)/2],
+                                                                            matrices->E_M[my_iindx[i]-u][cnt1][cnt2/2]
+                                                                          + matrices->E_M[my_iindx[u+1]-j][cnt3][cnt4/2]
+                                                                          );
+                    updatePosteriorBoundaries(cnt1 + cnt3 + dia,
+                                              cnt2 + cnt4 + dib,
+                                              &min_k_real_m,
+                                              &max_k_real_m,
+                                              &min_l_real_m,
+                                              &max_l_real_m
+                                              );
+#ifdef COUNT_STATES
+                    matrices->N_M[ij][cnt1+cnt3+dia][(cnt2+cnt4+dib)/2] += matrices->N_M[my_iindx[i]-u][cnt1][cnt2/2] * matrices->N_M1[my_iindx[u+1]-j][cnt3][cnt4/2];
+#endif
+                  }
+                  /* collect all cases where dia+cnt1+cnt3 or dib+cnt2+cnt4 exceeds maxD1, maxD2, respectively */
+                  else{
+                    matrices->E_M_rem[ij] = MIN2(matrices->E_M_rem[ij],
+                                              matrices->E_M[my_iindx[i]-u][cnt1][cnt2/2] + matrices->E_M[my_iindx[u+1]-j][cnt3][cnt4/2]
+                                              );
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+
+      /* thats all folks for the multiloop decomposition... */
+
+      adjustArrayBoundaries(&matrices->E_M[ij],
+                            &matrices->k_min_M[ij],
+                            &matrices->k_max_M[ij],
+                            &matrices->l_min_M[ij],
+                            &matrices->l_max_M[ij],
+                            min_k_real_m,
+                            max_k_real_m,
+                            min_l_real_m,
+                            max_l_real_m
+                            );
+
+      adjustArrayBoundaries(&matrices->E_M1[ij],
+                            &matrices->k_min_M1[ij],
+                            &matrices->k_max_M1[ij],
+                            &matrices->l_min_M1[ij],
+                            &matrices->l_max_M1[ij],
+                            min_k_real_m1,
+                            max_k_real_m1,
+                            min_l_real_m1,
+                            max_l_real_m1
+                            );
+
+#ifdef COUNT_STATES
+        /* actually we should adjust the array boundaries here but we might never use the count states option more than once so what....*/
+#endif
+    } /* end of j-loop */
+  }
+
+  /* calculate energies of 5' and 3' fragments */
+
+  /* prepare first entries in E_F5 */
+  for(cnt1 = 1; cnt1 <= TURN+1; cnt1++){
+    matrices->E_F5[cnt1] = (int **)vrna_alloc(sizeof(int *));
+    matrices->E_F5[cnt1][0] = (int *)vrna_alloc(sizeof(int));
+    matrices->E_F5[cnt1][0][0] = 0;
+    matrices->E_F5_rem[cnt1] = INF;
+    matrices->k_min_F5[cnt1] = matrices->k_max_F5[cnt1] = 0;
+    matrices->l_min_F5[cnt1] = (int *)vrna_alloc(sizeof(int));
+    matrices->l_max_F5[cnt1] = (int *)vrna_alloc(sizeof(int));
+    matrices->l_min_F5[cnt1][0] = matrices->l_max_F5[cnt1][0] = 0;
+#ifdef COUNT_STATES
+    matrices->N_F5[cnt1] = (unsigned long **)vrna_alloc(sizeof(unsigned long *));
+    matrices->N_F5[cnt1][0] = (unsigned long *)vrna_alloc(sizeof(unsigned long));
+    matrices->N_F5[cnt1][0][0] = 1;
+#endif
+
+  }
+
+
+
+  for (j=TURN+2; j <= seq_length; j++) {
+
+    unsigned int da = referenceBPs1[my_iindx[1]-j] - referenceBPs1[my_iindx[1]-j+1];
+    unsigned int db = referenceBPs2[my_iindx[1]-j] - referenceBPs2[my_iindx[1]-j+1];
+
+    type=ptype[jindx[j] + 1];
+    additional_en = 0;
+    if(type){
+      if(dangles == 2)
+        additional_en += E_ExtLoop(type, -1, j < seq_length ? S1[j+1] : -1, P);
+      else
+        additional_en += E_ExtLoop(type, -1, -1, P);
+    }
+
+    /* make min and max k guess for memory allocation */
+    int min_k_guess, max_k_guess, min_l_guess, max_l_guess;
+    int *min_l_real, *max_l_real, min_k_real, max_k_real;
+
+    min_k_guess = min_l_guess = 0;
+    max_k_guess = referenceBPs1[my_iindx[1]-j] + mm1[my_iindx[1]-j];
+    max_l_guess = referenceBPs2[my_iindx[1]-j] + mm2[my_iindx[1]-j];
+
+    prepareBoundaries(min_k_guess,
+                      max_k_guess,
+                      min_l_guess,
+                      max_l_guess,
+                      bpdist[my_iindx[1]-j],
+                      &matrices->k_min_F5[j],
+                      &matrices->k_max_F5[j],
+                      &matrices->l_min_F5[j],
+                      &matrices->l_max_F5[j]
+                      );
+
+    preparePosteriorBoundaries( matrices->k_max_F5[j] - matrices->k_min_F5[j] + 1,
+                                matrices->k_min_F5[j],
+                                &min_k_real,
+                                &max_k_real,
+                                &min_l_real,
+                                &max_l_real
+                              );
+
+    prepareArray( &matrices->E_F5[j],
+                  matrices->k_min_F5[j],
+                  matrices->k_max_F5[j],
+                  matrices->l_min_F5[j],
+                  matrices->l_max_F5[j]
+                );
+#ifdef COUNT_STATES
+    prepareArray2( &matrices->N_F5[j],
+                  matrices->k_min_F5[j],
+                  matrices->k_max_F5[j],
+                  matrices->l_min_F5[j],
+                  matrices->l_max_F5[j]
+                );
+#endif
+
+    /* begin the actual computation of 5' end energies */
+
+    /* j-1 is unpaired ... */
+    matrices->E_F5_rem[j] = matrices->E_F5_rem[j-1];
+    for(cnt1 = matrices->k_min_F5[j-1]; cnt1 <= matrices->k_max_F5[j-1]; cnt1++){
+      for(cnt2 = matrices->l_min_F5[j-1][cnt1]; cnt2 <= matrices->l_max_F5[j-1][cnt1]; cnt2+=2){
+        if(((cnt1 + da) <= maxD1) && ((cnt2 + db) <= maxD2)){
+          matrices->E_F5[j][cnt1+da][(cnt2+db)/2] = MIN2( matrices->E_F5[j][cnt1+da][(cnt2+db)/2],
+                                                      matrices->E_F5[j-1][cnt1][cnt2/2]
+                                                    );
+          updatePosteriorBoundaries(cnt1 + da,
+                                    cnt2 + db,
+                                    &min_k_real,
+                                    &max_k_real,
+                                    &min_l_real,
+                                    &max_l_real
+                                    );
+#ifdef COUNT_STATES
+          matrices->N_F5[j][cnt1+da][(cnt2+db)/2] += matrices->N_F5[j-1][cnt1][cnt2/2];
+#endif
+        }
+        /* collect all cases where da+cnt1 or db+cnt2 exceeds maxD1, maxD2, respectively */
+        else{
+          matrices->E_F5_rem[j] = MIN2(matrices->E_F5_rem[j], matrices->E_F5[j-1][cnt1][cnt2/2]);
+        }
+      }
+    }
+    /* j pairs with 1 */
+    if(matrices->E_C_rem[my_iindx[1]-j] != INF){
+      matrices->E_F5_rem[j] = MIN2(matrices->E_F5_rem[j], matrices->E_C_rem[my_iindx[1]-j] + additional_en);
+    }
+    if(matrices->E_C[my_iindx[1]-j])
+      for(cnt1 = matrices->k_min_C[my_iindx[1]-j]; cnt1 <= matrices->k_max_C[my_iindx[1]-j]; cnt1++)
+        for(cnt2 = matrices->l_min_C[my_iindx[1]-j][cnt1]; cnt2 <= matrices->l_max_C[my_iindx[1]-j][cnt1]; cnt2+=2){
+          if(matrices->E_C[my_iindx[1]-j][cnt1][cnt2/2] != INF){
+            matrices->E_F5[j][cnt1][cnt2/2] = MIN2( matrices->E_F5[j][cnt1][cnt2/2],
+                                                matrices->E_C[my_iindx[1]-j][cnt1][cnt2/2]+ additional_en
+                                              );
+            updatePosteriorBoundaries(cnt1,
+                                      cnt2,
+                                      &min_k_real,
+                                      &max_k_real,
+                                      &min_l_real,
+                                      &max_l_real
+                                      );
+#ifdef COUNT_STATES
+            matrices->N_F5[j][cnt1][cnt2/2] += matrices->N_C[my_iindx[1]-j][cnt1][cnt2/2];
+#endif
+          }
+        }
+
+    /* j pairs with some other nucleotide -> see below */
+    for (i=j-TURN-1; i>1; i--) {
+      ij = my_iindx[i]-j;
+      type = ptype[jindx[j] + i];
+      if (type) {
+        if(dangles == 2)
+          additional_en = E_ExtLoop(type, S1[i-1], j < seq_length ? S1[j+1] : -1, P);
+        else
+          additional_en = E_ExtLoop(type, -1, -1, P);
+
+        if(matrices->E_C_rem[ij] != INF){
+          for(cnt3 = matrices->k_min_F5[i-1]; cnt3 <= matrices->k_max_F5[i-1]; cnt3++)
+            for(cnt4 = matrices->l_min_F5[i-1][cnt3]; cnt4 <= matrices->l_max_F5[i-1][cnt3]; cnt4+=2){
+              if(matrices->E_F5[i-1][cnt3][cnt4/2] != INF){
+                matrices->E_F5_rem[j] = MIN2(matrices->E_F5_rem[j],
+                                          matrices->E_F5[i-1][cnt3][cnt4/2] + matrices->E_C_rem[ij] + additional_en
+                                          );
+              }
+            }
+          if(matrices->E_F5_rem[i-1] != INF){
+            matrices->E_F5_rem[j] = MIN2(matrices->E_F5_rem[j],
+                                      matrices->E_F5_rem[i-1] + matrices->E_C_rem[ij] + additional_en
+                                      );
+          }
+        }
+        if((matrices->E_F5_rem[i-1] != INF) && (matrices->E_C[ij])){
+          for(cnt1 = matrices->k_min_C[ij]; cnt1 <= matrices->k_max_C[ij]; cnt1++)
+            for(cnt2 = matrices->l_min_C[ij][cnt1]; cnt2 <= matrices->l_max_C[ij][cnt1]; cnt2+=2)
+              if(matrices->E_C[ij][cnt1][cnt2/2]!= INF){
+                matrices->E_F5_rem[j] = MIN2(matrices->E_F5_rem[j],
+                                          matrices->E_F5_rem[i-1] + matrices->E_C[ij][cnt1][cnt2/2] + additional_en
+                                          );
+              }
+        }
+        if(!matrices->E_C[ij]) continue;
+
+        unsigned int d1a = referenceBPs1[my_iindx[1]-j] - referenceBPs1[ij] - referenceBPs1[my_iindx[1]-i+1];
+        unsigned int d1b = referenceBPs2[my_iindx[1]-j] - referenceBPs2[ij] - referenceBPs2[my_iindx[1]-i+1];
+
+        for(cnt1 = matrices->k_min_C[ij]; cnt1 <= matrices->k_max_C[ij]; cnt1++)
+          for(cnt2 = matrices->l_min_C[ij][cnt1]; cnt2 <= matrices->l_max_C[ij][cnt1]; cnt2+=2)
+            for(cnt3 = matrices->k_min_F5[i-1]; cnt3 <= matrices->k_max_F5[i-1]; cnt3++)
+              for(cnt4 = matrices->l_min_F5[i-1][cnt3]; cnt4 <= matrices->l_max_F5[i-1][cnt3]; cnt4+=2){
+                if(matrices->E_F5[i-1][cnt3][cnt4/2] != INF && matrices->E_C[ij][cnt1][cnt2/2]!= INF){
+                  if(((cnt1 + cnt3 + d1a) <= maxD1) && ((cnt2 + cnt4 + d1b) <= maxD2)){
+                    matrices->E_F5[j][cnt1+cnt3+d1a][(cnt2+cnt4+d1b)/2] = MIN2( matrices->E_F5[j][cnt1+cnt3+d1a][(cnt2+cnt4+d1b)/2],
+                                                                            matrices->E_F5[i-1][cnt3][cnt4/2] + matrices->E_C[ij][cnt1][cnt2/2] + additional_en
+                                                                          );
+                    updatePosteriorBoundaries(cnt1 + cnt3 + d1a,
+                                              cnt2 + cnt4 + d1b,
+                                              &min_k_real,
+                                              &max_k_real,
+                                              &min_l_real,
+                                              &max_l_real
+                                              );
+#ifdef COUNT_STATES
+                    matrices->N_F5[j][cnt1+cnt3+d1a][(cnt2+cnt4+d1b)/2] += matrices->N_F5[i-1][cnt3][cnt4/2] * matrices->N_C[ij][cnt1][cnt2/2];
+#endif
+                  }
+                  /* collect all cases where d1a+cnt1+cnt3 or d1b+cnt2+cnt4 exceeds maxD1, maxD2, respectively */
+                  else{
+                    matrices->E_F5_rem[j] = MIN2(matrices->E_F5_rem[j],
+                                              matrices->E_F5[i-1][cnt3][cnt4/2] + matrices->E_C[ij][cnt1][cnt2/2] + additional_en
+                                              );
+                  }
+                }
+              }
+      }
+    }
+
+    /* resize and move memory portions of energy matrix E_F5 */
+    adjustArrayBoundaries(&matrices->E_F5[j],
+                          &matrices->k_min_F5[j],
+                          &matrices->k_max_F5[j],
+                          &matrices->l_min_F5[j],
+                          &matrices->l_max_F5[j],
+                          min_k_real,
+                          max_k_real,
+                          min_l_real,
+                          max_l_real
+                          );
+
+  } /* end of j-loop */
+
+
+  if(compute_2Dfold_F3){
+
+    /* prepare first entries in E_F3 */
+    for(cnt1 = seq_length; cnt1 >= seq_length-TURN-1; cnt1--){
+      matrices->E_F3[cnt1]        = (int **)vrna_alloc(sizeof(int *));
+      matrices->E_F3[cnt1][0]     = (int *) vrna_alloc(sizeof(int));
+      matrices->E_F3[cnt1][0][0]  = 0;
+      matrices->k_min_F3[cnt1]     = matrices->k_max_F3[cnt1] = 0;
+      matrices->l_min_F3[cnt1]     = (int *)vrna_alloc(sizeof(int));
+      matrices->l_max_F3[cnt1]     = (int *)vrna_alloc(sizeof(int));
+      matrices->l_min_F3[cnt1][0]  = matrices->l_max_F3[cnt1][0] = 0;
+    }
+    /* begin calculations */
+    for (j=seq_length-TURN-2; j >= 1; j--){
+
+      unsigned int da = referenceBPs1[my_iindx[j]-seq_length] - referenceBPs1[my_iindx[j+1]-seq_length];
+      unsigned int db = referenceBPs2[my_iindx[j]-seq_length] - referenceBPs2[my_iindx[j+1]-seq_length];
+
+      type=ptype[jindx[seq_length] + j];
+      additional_en = 0;
+      if(type){
+        if(dangles == 2)
+          additional_en += E_ExtLoop(type, j > 1 ? S1[j-1] : -1, -1, P);
+        else
+          additional_en += E_ExtLoop(type, -1, -1, P);
+      }
+
+      /* make min and max k guess for memory allocation */
+      int min_k_guess, max_k_guess, min_l_guess, max_l_guess;
+      int *min_l_real, *max_l_real, min_k_real, max_k_real;
+
+      min_k_guess = min_l_guess = 0;
+      max_k_guess = referenceBPs1[my_iindx[j]-seq_length] + mm1[my_iindx[j]-seq_length];
+      max_l_guess = referenceBPs2[my_iindx[j]-seq_length] + mm2[my_iindx[j]-seq_length];
+
+      prepareBoundaries(min_k_guess,
+                        max_k_guess,
+                        min_l_guess,
+                        max_l_guess,
+                        bpdist[my_iindx[j]-seq_length],
+                        &matrices->k_min_F3[j],
+                        &matrices->k_max_F3[j],
+                        &matrices->l_min_F3[j],
+                        &matrices->l_max_F3[j]
+                        );
+
+      preparePosteriorBoundaries( matrices->k_max_F3[j] - matrices->k_min_F3[j] + 1,
+                                  matrices->k_min_F3[j],
+                                  &min_k_real,
+                                  &max_k_real,
+                                  &min_l_real,
+                                  &max_l_real
+                                );
+
+      prepareArray( &matrices->E_F3[j],
+                    matrices->k_min_F3[j],
+                    matrices->k_max_F3[j],
+                    matrices->l_min_F3[j],
+                    matrices->l_max_F3[j]
+                  );
+      /* begin the actual computation of 5' end energies */
+
+      /* j is unpaired ... */
+      for(cnt1 = matrices->k_min_F3[j+1]; cnt1 <= matrices->k_max_F3[j+1]; cnt1++){
+        for(cnt2 = matrices->l_min_F3[j+1][cnt1]; cnt2 <= matrices->l_max_F3[j+1][cnt1]; cnt2+=2){
+          matrices->E_F3[j][cnt1+da][(cnt2+db)/2] = MIN2( matrices->E_F3[j][cnt1+da][(cnt2+db)/2],
+                                                      matrices->E_F3[j+1][cnt1][cnt2/2]
+                                                    );
+          updatePosteriorBoundaries(cnt1 + da,
+                                    cnt2 + db,
+                                    &min_k_real,
+                                    &max_k_real,
+                                    &min_l_real,
+                                    &max_l_real
+                                    );
+        }
+      }
+      /* j pairs with n */
+      if(matrices->E_C[my_iindx[j]-seq_length])
+        for(cnt1 = matrices->k_min_C[my_iindx[j]-seq_length]; cnt1 <= matrices->k_max_C[my_iindx[j]-seq_length]; cnt1++)
+          for(cnt2 = matrices->l_min_C[my_iindx[j]-seq_length][cnt1]; cnt2 <= matrices->l_max_C[my_iindx[j]-seq_length][cnt1]; cnt2+=2){
+            if(matrices->E_C[my_iindx[j]-seq_length][cnt1][cnt2/2] != INF){
+              matrices->E_F3[j][cnt1][cnt2/2] = MIN2( matrices->E_F3[j][cnt1][cnt2/2],
+                                                  matrices->E_C[my_iindx[j]-seq_length][cnt1][cnt2/2]+ additional_en
+                                                );
+              updatePosteriorBoundaries(cnt1,
+                                        cnt2,
+                                        &min_k_real,
+                                        &max_k_real,
+                                        &min_l_real,
+                                        &max_l_real
+                                        );
+            }
+          }
+
+      /* j pairs with some other nucleotide -> see below */
+      for (i=j-TURN-1; i>1; i--) {
+        ij = my_iindx[i]-j;
+        if(!matrices->E_C[ij]) continue;
+        type = ptype[jindx[j] + i];
+        if (type) {
+          unsigned int d1a = referenceBPs1[my_iindx[1]-j] - referenceBPs1[ij] - referenceBPs1[my_iindx[1]-i+1];
+          unsigned int d1b = referenceBPs2[my_iindx[1]-j] - referenceBPs2[ij] - referenceBPs2[my_iindx[1]-i+1];
+
+          if(dangles == 2)
+            additional_en = E_ExtLoop(type, S1[i-1], j < seq_length ? S1[j+1] : -1, P);
+          else
+            additional_en = E_ExtLoop(type, -1, -1, P);
+
+          for(cnt1 = matrices->k_min_C[ij]; cnt1 <= matrices->k_max_C[ij]; cnt1++)
+            for(cnt2 = matrices->l_min_C[ij][cnt1]; cnt2 <= matrices->l_max_C[ij][cnt1]; cnt2+=2)
+              for(cnt3 = matrices->k_min_F5[i-1]; cnt3 <= matrices->k_max_F5[i-1]; cnt3++)
+                for(cnt4 = matrices->l_min_F5[i-1][cnt3]; cnt4 <= matrices->l_max_F5[i-1][cnt3]; cnt4+=2){
+                  if(matrices->E_F5[i-1][cnt3][cnt4/2] != INF && matrices->E_C[ij][cnt1][cnt2/2]!= INF){
+                    matrices->E_F5[j][cnt1+cnt3+d1a][(cnt2+cnt4+d1b)/2] = MIN2( matrices->E_F5[j][cnt1+cnt3+d1a][(cnt2+cnt4+d1b)/2],
+                                                                            matrices->E_F5[i-1][cnt3][cnt4/2] + matrices->E_C[ij][cnt1][cnt2/2] + additional_en
+                                                                          );
+                    updatePosteriorBoundaries(cnt1 + cnt3 + d1a,
+                                              cnt2 + cnt4 + d1b,
+                                              &min_k_real,
+                                              &max_k_real,
+                                              &min_l_real,
+                                              &max_l_real
+                                              );
+#ifdef COUNT_STATES
+                    matrices->N_F5[j][cnt1+cnt3+d1a][(cnt2+cnt4+d1b)/2] += matrices->N_F5[i-1][cnt3][cnt4/2] * matrices->N_C[ij][cnt1][cnt2/2];
+#endif
+                  }
+                }
+        }
+      }
+
+      /* resize and move memory portions of energy matrix E_F5 */
+      adjustArrayBoundaries(&matrices->E_F5[j],
+                            &matrices->k_min_F5[j],
+                            &matrices->k_max_F5[j],
+                            &matrices->l_min_F5[j],
+                            &matrices->l_max_F5[j],
+                            min_k_real,
+                            max_k_real,
+                            min_l_real,
+                            max_l_real
+                            );
+
+    } /* end of j-loop */
+
+
+
+
+  }
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void
+backtrack_f5( unsigned int j,
+              int k,
+              int l,
+              char *structure,
+              vrna_fold_compound_t *vc){
+
+  int           *my_iindx, *jindx, energy, type, dangles, cnt1, cnt2, cnt3, cnt4;
+  int           **l_min_C, **l_max_C,**l_min_F5, **l_max_F5;
+  int           *k_min_C, *k_max_C,*k_min_F5, *k_max_F5;
+  int           ***E_C, ***E_F5;
+  int           *E_C_rem, *E_F5_rem;
+  unsigned int   i, ij, seq_length, maxD1, maxD2;
+  short *S1;
+  unsigned int   *referenceBPs1, *referenceBPs2;
+  char  *ptype;
+  vrna_param_t    *P;
+  vrna_md_t       *md;
+  vrna_mx_mfe_t   *matrices;
+  unsigned int   da, db;
+
+  P               = vc->params;
+  md              = &(P->model_details);
+  matrices        = vc->matrices;
+  seq_length      = vc->length;
+  S1              = vc->sequence_encoding;
+  ptype           = vc->ptype;
+  my_iindx        = vc->iindx;
+  jindx           = vc->jindx;
+  referenceBPs1   = vc->referenceBPs1;
+  referenceBPs2   = vc->referenceBPs2;
+  dangles         = md->dangles;
+  E_F5            = matrices->E_F5;
+  l_min_F5  = matrices->l_min_F5;
+  l_max_F5  = matrices->l_max_F5;
+  k_min_F5  = matrices->k_min_F5;
+  k_max_F5  = matrices->k_max_F5;
+
+  E_C             = matrices->E_C;
+  l_min_C    = matrices->l_min_C;
+  l_max_C    = matrices->l_max_C;
+  k_min_C    = matrices->k_min_C;
+  k_max_C    = matrices->k_max_C;
+
+  E_F5_rem       = matrices->E_F5_rem;
+  E_C_rem        = matrices->E_C_rem;
+  maxD1           = vc->maxD1;
+  maxD2           = vc->maxD2;
+
+  da = referenceBPs1[my_iindx[1]-j] - referenceBPs1[my_iindx[1]-j+1];
+  db = referenceBPs2[my_iindx[1]-j] - referenceBPs2[my_iindx[1]-j+1];
+
+  if(j<TURN+2) return;
+
+  /* F5[j] == F5[j-1] ? */
+  if(k == -1){
+    if(E_F5_rem[j]==INF)
+      return;
+    else if(E_F5_rem[j] == E_F5_rem[j-1]){
+      backtrack_f5(j-1,k,l,structure, vc);
+      return;
+    }
+    else if(E_F5[j-1]){
+      for(cnt1 =  k_min_F5[j-1];
+        cnt1 <= k_max_F5[j-1];
+        cnt1++){
+        for(cnt2 = l_min_F5[j-1][cnt1];
+            cnt2 <= l_max_F5[j-1][cnt1];
+            cnt2+=2){
+          if(((cnt1 + da) > maxD1) || ((cnt2 + db) > maxD2)){
+            if(E_F5_rem[j] == E_F5[j-1][cnt1][cnt2/2]){
+              backtrack_f5(j-1, cnt1, cnt2, structure, vc);
+              return;
+            }
+          }
+        }
+      }
+    }
+  }
+  else if((k >= da) && (l >= db)){
+    if(E_F5[j-1]){
+      if((k - da >= k_min_F5[j-1]) && (k - da <= k_max_F5[j-1])){
+        if((l - db >= l_min_F5[j-1][k-da]) && (l - db <= l_max_F5[j-1][k-da]))
+          if(E_F5[j-1][k-da][(l-db)/2] == E_F5[j][k][l/2]){
+            backtrack_f5(j-1, k-da, l-db, structure, vc);
+            return;
+          }
+      }
+    }
+  }
+
+  type = ptype[jindx[j] + 1];
+  if(type){
+    if(dangles == 2)
+      energy = E_ExtLoop(type, -1, j < seq_length ? S1[j+1] : -1, P);
+    else
+      energy = E_ExtLoop(type, -1, -1, P);
+
+    if(k == -1){
+      if(E_C_rem[my_iindx[1]-j] + energy == E_F5_rem[j]){
+          backtrack_c(1, j, -1, -1, structure, vc);
+          return;
+      }
+    }
+    else if(k >= k_min_C[my_iindx[1]-j] && (k <= k_max_C[my_iindx[1]-j])){
+
+      if((l >= l_min_C[my_iindx[1]-j][k]) && (l <= l_max_C[my_iindx[1]-j][k]))
+        if(E_C[my_iindx[1]-j][k][l/2] + energy == E_F5[j][k][l/2]){
+          backtrack_c(1, j, k, l, structure, vc);
+          return;
+        }
+    }
+  }
+
+  for (i=j-TURN-1; i>1; i--) {
+    ij = my_iindx[i]-j;
+    type = ptype[jindx[j] + i];
+    if (type) {
+      unsigned int d1a = referenceBPs1[my_iindx[1]-j] - referenceBPs1[ij] - referenceBPs1[my_iindx[1]-i+1];
+      unsigned int d1b = referenceBPs2[my_iindx[1]-j] - referenceBPs2[ij] - referenceBPs2[my_iindx[1]-i+1];
+
+      if(dangles == 2)
+        energy = E_ExtLoop(type, S1[i-1], j < seq_length ? S1[j+1] : -1, P);
+      else
+        energy = E_ExtLoop(type, -1, -1, P);
+
+      if(k == -1){
+        if(E_C_rem[ij] != INF){
+          for(cnt1 = k_min_F5[i-1];
+              cnt1 <= k_max_F5[i-1];
+              cnt1++){
+            for(cnt2 = l_min_F5[i-1][cnt1];
+                cnt2 <= l_max_F5[i-1][cnt1];
+                cnt2+=2){
+              if(E_F5_rem[j] == (E_F5[i-1][cnt1][cnt2/2] + E_C_rem[ij] + energy)){
+                backtrack_f5(i-1, cnt1, cnt2, structure, vc);
+                backtrack_c(i,j,-1,-1,structure, vc);
+                return;
+              }
+            }
+          }
+          if(E_F5_rem[j] == (E_F5_rem[i-1] + E_C_rem[ij] + energy)){
+            backtrack_f5(i-1, -1, -1, structure, vc);
+            backtrack_c(i,j,-1,-1,structure,vc);
+            return;
+          }
+        }
+        if(E_F5_rem[i-1] != INF){
+          for(cnt1 = k_min_C[ij];
+              cnt1 <= k_max_C[ij];
+              cnt1++){
+            for(cnt2 = l_min_C[ij][cnt1];
+                cnt2 <= l_max_C[ij][cnt1];
+                cnt2 += 2){
+               if(E_F5_rem[j] == (E_F5_rem[i-1] + E_C[ij][cnt1][cnt2/2] + energy)){
+                backtrack_f5(i-1,-1,-1,structure,vc);
+                backtrack_c(i,j,cnt1,cnt2,structure,vc);
+                return;
+              }
+            }
+          }
+        }
+        for(cnt1 = k_min_F5[i-1];
+            cnt1 <= k_max_F5[i-1];
+            cnt1++)
+          for(cnt2 = l_min_F5[i-1][cnt1];
+              cnt2 <= l_max_F5[i-1][cnt1];
+              cnt2 += 2)
+            for(cnt3 = k_min_C[ij];
+                cnt3 <= k_max_C[ij];
+                cnt3++)
+              for(cnt4 = l_min_C[ij][cnt3];
+                  cnt4 <= l_max_C[ij][cnt3];
+                  cnt4 += 2){
+                if(((cnt1 + cnt3 + d1a)>maxD1) || ((cnt2+cnt4+d1b)>maxD2)){
+                  if(E_F5_rem[j] == (E_F5[i-1][cnt1][cnt2/2] + E_C[ij][cnt3][cnt4/2] + energy)){
+                    backtrack_f5(i-1,cnt1,cnt2,structure,vc);
+                    backtrack_c(i,j,cnt3,cnt4,structure,vc);
+                    return;
+                  }
+                }
+              }
+      }
+      else if((k >= d1a) && (l >= d1b)){
+        int k_f_max = MIN2(k-d1a, k_max_F5[i-1]);
+
+        for(cnt1 = k_min_F5[i-1]; cnt1 <= k_f_max; cnt1++){
+          int l_f_max = MIN2(l - d1b, l_max_F5[i-1][cnt1]);
+          for(cnt2 = l_min_F5[i-1][cnt1]; cnt2 <= l_f_max; cnt2+=2){
+            int k_c = k - d1a - cnt1;
+            if((k_c >= k_min_C[ij]) && (k_c <= k_max_C[ij])){
+              int l_c = l - d1b - cnt2;
+              if((l_c >= l_min_C[ij][k_c]) && (l_c <= l_max_C[ij][k_c])){
+                if(E_F5[j][k][l/2] == (E_F5[i-1][cnt1][cnt2/2] + E_C[ij][k_c][l_c/2] + energy)){
+                  backtrack_f5(i-1, cnt1, cnt2, structure, vc);
+                  backtrack_c(i, j, k_c, l_c, structure, vc);
+                  return;
+                }
+              }
+            }
+          }
+
+        }
+      }
+    }
+  }
+  vrna_message_error("backtracking failed in f5");
+}
+
+PRIVATE void
+backtrack_c(unsigned int i,
+            unsigned int j,
+            int k,
+            int l,
+            char *structure,
+            vrna_fold_compound_t *vc){
+
+  unsigned int p, q, pq, ij, maxp, maxD1, maxD2;
+  int *my_iindx, *jindx, type, type_2, energy, no_close, dangles, base_d1, base_d2, d1, d2, cnt1, cnt2, cnt3, cnt4, *rtype;
+  int           **l_min_C, **l_max_C,**l_min_M, **l_max_M,**l_min_M1, **l_max_M1;
+  int           *k_min_C, *k_max_C,*k_min_M, *k_max_M,*k_min_M1, *k_max_M1;
+  int           ***E_C, ***E_M, ***E_M1, *E_C_rem, *E_M_rem, *E_M1_rem;
+  short *S1;
+  unsigned int   *referenceBPs1, *referenceBPs2;
+  char  *ptype,  *sequence;
+  vrna_param_t   *P;
+  vrna_md_t       *md;
+  vrna_mx_mfe_t   *matrices;
+
+  P               = vc->params;
+  md              = &(P->model_details);
+  matrices        = vc->matrices;
+  sequence        = vc->sequence;
+  S1              = vc->sequence_encoding;
+  ptype           = vc->ptype;
+  rtype           = &(md->rtype[0]);
+  my_iindx        = vc->iindx;
+  jindx           = vc->jindx;
+  referenceBPs1   = vc->referenceBPs1;
+  referenceBPs2   = vc->referenceBPs2;
+  dangles         = md->dangles;
+
+  E_C             = matrices->E_C;
+  l_min_C    = matrices->l_min_C;
+  l_max_C    = matrices->l_max_C;
+  k_min_C    = matrices->k_min_C;
+  k_max_C    = matrices->k_max_C;
+
+  E_M             = matrices->E_M;
+  l_min_M  = matrices->l_min_M;
+  l_max_M  = matrices->l_max_M;
+  k_min_M  = matrices->k_min_M;
+  k_max_M  = matrices->k_max_M;
+
+  E_M1            = matrices->E_M1;
+  l_min_M1 = matrices->l_min_M1;
+  l_max_M1 = matrices->l_max_M1;
+  k_min_M1 = matrices->k_min_M1;
+  k_max_M1 = matrices->k_max_M1;
+
+  E_C_rem        = matrices->E_C_rem;
+  E_M_rem        = matrices->E_M_rem;
+  E_M1_rem       = matrices->E_M1_rem;
+  maxD1           = vc->maxD1;
+  maxD2           = vc->maxD2;
+
+
+  ij = my_iindx[i]-j;
+
+  int e = (k==-1) ? E_C_rem[ij] : E_C[ij][k][l/2];
+
+  type = ptype[jindx[j] + i];
+
+  no_close = (((type==3)||(type==4))&&no_closingGU);
+  structure[i-1] = '(';
+  structure[j-1] = ')';
+
+  base_d1 = ((unsigned int)vc->reference_pt1[i] != j) ? 1 : -1;
+  base_d2 = ((unsigned int)vc->reference_pt2[i] != j) ? 1 : -1;
+
+  base_d1 += referenceBPs1[ij];
+  base_d2 += referenceBPs2[ij];
+
+  if(k == -1){
+    if(((unsigned int)base_d1 > maxD1) || ((unsigned int)base_d2 > maxD2)){
+      if(e == E_Hairpin(j-i-1, type, S1[i+1], S1[j-1], sequence+i-1, P)) return;
+    }
+  }
+  else{
+    if((unsigned int)base_d1 == k)
+      if((unsigned int)base_d2 == l)
+        if(E_Hairpin(j-i-1, type, S1[i+1], S1[j-1], sequence+i-1, P) == e) return;
+  }
+  maxp = MIN2(j-2-TURN,i+MAXLOOP+1);
+  for(p = i+1; p <= maxp; p++){
+    unsigned int minq, ln_pre;
+    minq = p + TURN + 1;
+    ln_pre = j - i - 1;
+    if(ln_pre > minq + MAXLOOP) minq = ln_pre - MAXLOOP - 1;
+    for (q = minq; q < j; q++) {
+      pq = my_iindx[p]-q;
+      type_2 = ptype[jindx[q] + p];
+      if (type_2==0) continue;
+      type_2 = rtype[type_2];
+
+      /* d2 = dbp(S_{i,j}, S_{p.q} + {i,j}) */
+      d1 = base_d1 - referenceBPs1[pq];
+      d2 = base_d2 - referenceBPs2[pq];
+
+      energy = E_IntLoop(p-i-1, j-q-1, type, type_2, S1[i+1], S1[j-1], S1[p-1], S1[q+1], P);
+
+
+      if(k == -1){
+        if(E_C_rem[pq] != INF)
+          if(e == (E_C_rem[pq] + energy)){
+            backtrack_c(p,q,-1,-1,structure,vc);
+            return;
+          }
+        if(E_C[pq])
+        for(cnt1 = k_min_C[pq];
+            cnt1 <= k_max_C[pq];
+            cnt1++)
+          for(cnt2 = l_min_C[pq][cnt1];
+              cnt2 <= l_max_C[pq][cnt1];
+              cnt2 += 2){
+            if(((cnt1 + d1) > maxD1) || ((cnt2 + d2) > maxD2)){
+              if(e == (E_C[pq][cnt1][cnt2/2] + energy)){
+                backtrack_c(p,q,cnt1,cnt2,structure,vc);
+                return;
+              }
+            }
+          }
+      }
+      else{
+        if(!E_C[pq]) continue;
+        if(d1 <= k && d2 <= l){
+          if((k-d1 >= k_min_C[pq]) && (k-d1) <= k_max_C[pq])
+            if((l - d2 >= l_min_C[pq][k-d1]) && (l-d2 <= l_max_C[pq][k-d1]))
+              if(E_C[pq][k-d1][(l-d2)/2] + energy == e){
+                backtrack_c(p, q, k-d1, l-d2, structure, vc);
+                return;
+              }
+        }
+      }
+    } /* end q-loop */
+  } /* end p-loop */
+
+  /* multi-loop decomposition ------------------------*/
+  if(!no_close){
+    unsigned int u;
+    int tt;
+    if(k==-1){
+      for(u=i+TURN+2; u<j-TURN-2;u++){
+        int i1u, u1j1;
+        i1u   = my_iindx[i+1]-u;
+        u1j1  = my_iindx[u+1]-j+1;
+        tt = rtype[type];
+        energy = P->MLclosing;
+        if(dangles == 2)
+          energy += E_MLstem(tt, S1[j-1], S1[i+1], P);
+        else
+          energy += E_MLstem(tt, -1, -1, P);
+
+
+        if(E_M_rem[i1u] != INF){
+          if(E_M1[u1j1])
+          for(cnt1 = k_min_M1[u1j1];
+              cnt1 <= k_max_M1[u1j1];
+              cnt1++)
+            for(cnt2 = l_min_M1[u1j1][cnt1];
+                cnt2 <= l_max_M1[u1j1][cnt1];
+                cnt2 += 2){
+              if(e == (E_M_rem[i1u] + E_M1[u1j1][cnt1][cnt2/2] + energy)){
+                backtrack_m(i+1,u,-1,-1,structure,vc);
+                backtrack_m1(u+1,j-1,cnt1,cnt2,structure,vc);
+                return;
+              }
+            }
+          if(E_M1_rem[u1j1] != INF){
+            if(e == (E_M_rem[i1u] + E_M1_rem[u1j1] + energy)){
+              backtrack_m(i+1, u, -1, -1, structure, vc);
+              backtrack_m1(u+1, j-1, -1, -1, structure, vc);
+              return;
+            }
+          }
+        }
+        if(E_M1_rem[u1j1] != INF){
+          if(E_M[i1u])
+          for(cnt1 = k_min_M[i1u];
+              cnt1 <= k_max_M[i1u];
+              cnt1++)
+            for(cnt2 = l_min_M[i1u][cnt1];
+                cnt2 <= l_max_M[i1u][cnt1];
+                cnt2 += 2)
+              if(e == (E_M[i1u][cnt1][cnt2/2] + E_M1_rem[u1j1] + energy)){
+                backtrack_m(i+1,u,cnt1,cnt2,structure,vc);
+                backtrack_m1(u+1,j-1,-1,-1,structure,vc);
+                return;
+              }
+        }
+
+        /* now all cases where we exceed the maxD1/D2 scope by combination of E_M and E_M1 */
+        if(!E_M[i1u]) continue;
+        if(!E_M1[u1j1]) continue;
+        /* get distance to reference if closing this multiloop
+        *  dist3 = dbp(S_{i,j}, {i,j} + S_{i+1.u} + S_{u+1,j-1})
+        */
+        d1 = base_d1 - referenceBPs1[i1u] - referenceBPs1[u1j1];
+        d2 = base_d2 - referenceBPs2[i1u] - referenceBPs2[u1j1];
+        
+        for(cnt1 = matrices->k_min_M[i1u];
+            cnt1 <= matrices->k_max_M[i1u];
+            cnt1++)
+          for(cnt2 = matrices->l_min_M[i1u][cnt1];
+              cnt2 <= matrices->l_max_M[i1u][cnt1];
+              cnt2+=2)
+            for(cnt3 = matrices->k_min_M1[u1j1];
+                cnt3 <= matrices->k_max_M1[u1j1];
+                cnt3++)
+              for(cnt4 = matrices->l_min_M1[u1j1][cnt3];
+                  cnt4 <= matrices->l_max_M1[u1j1][cnt3];
+                  cnt4+=2){
+                if(((cnt1 + cnt3 + d1) > maxD1) || ((cnt2 + cnt4 + d2) > maxD2)){
+                  if(e == (E_M[i1u][cnt1][cnt2/2] + E_M1[u1j1][cnt3][cnt4/2] + energy)){
+                    backtrack_m(i+1,u,cnt1,cnt2,structure,vc);
+                    backtrack_m1(u+1,j-1,cnt3,cnt4,structure,vc);
+                    return;
+                  }
+                }
+              }
+      }
+    }
+    else{
+      for(u=i+TURN+2; u<j-TURN-2;u++){
+        int i1u, u1j1;
+        i1u   = my_iindx[i+1]-u;
+        u1j1  = my_iindx[u+1]-j+1;
+        if(!E_M[i1u]) continue;
+        if(!E_M1[u1j1]) continue;
+
+        /* get distance to reference if closing this multiloop
+        *  dist3 = dbp(S_{i,j}, {i,j} + S_{i+1.u} + S_{u+1,j-1})
+        */
+        d1 = base_d1 - referenceBPs1[i1u] - referenceBPs1[u1j1];
+        d2 = base_d2 - referenceBPs2[i1u] - referenceBPs2[u1j1];
+
+        tt = rtype[type];
+        energy = P->MLclosing;
+        if(dangles == 2)
+          energy += E_MLstem(tt, S1[j-1], S1[i+1], P);
+        else
+          energy += E_MLstem(tt, -1, -1, P);
+
+        if((d1 <= k) && (d2 <= l))
+          for(cnt1 = k_min_M[i1u];
+              cnt1 <= MIN2(k-d1, k_max_M[i1u]);
+              cnt1++)
+            for(cnt2 = l_min_M[i1u][cnt1];
+                cnt2 <= MIN2(l-d2, l_max_M[i1u][cnt1]);
+                cnt2+=2)
+              if(     ((k-d1-cnt1) >= k_min_M1[u1j1])
+                  &&  ((k-d1-cnt1) <= k_max_M1[u1j1]))
+                if(     ((l-d2-cnt2) >= l_min_M1[u1j1][k-d1-cnt1])
+                    &&  ((l-d2-cnt2) <= l_max_M1[u1j1][k-d1-cnt1]))
+                  if(e == (energy + E_M[i1u][cnt1][cnt2/2] + E_M1[u1j1][k-d1-cnt1][(l-d2-cnt2)/2])){
+                    backtrack_m(i+1, u, cnt1, cnt2, structure, vc);
+                    backtrack_m1(u+1, j-1, k-d1-cnt1, l-d2-cnt2, structure, vc);
+                    return;
+                  }
+      }
+    }
+  }
+  vrna_message_error("backtracking failed in c");
+}
+
+PRIVATE void
+backtrack_m(unsigned int i,
+            unsigned int j,
+            int k,
+            int l,
+            char *structure,
+            vrna_fold_compound_t *vc){
+
+  unsigned int u, ij, seq_length, base_d1, base_d2, d1, d2, maxD1, maxD2;
+  int *my_iindx, *jindx, type, energy, dangles,circ, cnt1, cnt2, cnt3, cnt4;
+  int           **l_min_C, **l_max_C,**l_min_M, **l_max_M;
+  int           *k_min_C, *k_max_C,*k_min_M, *k_max_M;
+  int           ***E_C, ***E_M, *E_C_rem, *E_M_rem;
+  short *S1;
+  unsigned int   *referenceBPs1, *referenceBPs2;
+  char  *ptype;
+  vrna_param_t    *P;
+  vrna_md_t       *md;
+  vrna_mx_mfe_t   *matrices;
+
+  P           = vc->params;
+  md          = &(P->model_details);
+  matrices    = vc->matrices;
+  seq_length  = vc->length;
+  S1          = vc->sequence_encoding;
+  circ        = md->circ;
+  ptype       = vc->ptype;
+  my_iindx    = vc->iindx;
+  jindx       = vc->jindx;
+  referenceBPs1  = vc->referenceBPs1;
+  referenceBPs2  = vc->referenceBPs2;
+  dangles     = md->dangles;
+
+  E_C             = matrices->E_C;
+  l_min_C    = matrices->l_min_C;
+  l_max_C    = matrices->l_max_C;
+  k_min_C    = matrices->k_min_C;
+  k_max_C    = matrices->k_max_C;
+
+  E_M             = matrices->E_M;
+  l_min_M  = matrices->l_min_M;
+  l_max_M  = matrices->l_max_M;
+  k_min_M  = matrices->k_min_M;
+  k_max_M  = matrices->k_max_M;
+
+  E_C_rem        = matrices->E_C_rem;
+  E_M_rem        = matrices->E_M_rem;
+  maxD1           = vc->maxD1;
+  maxD2           = vc->maxD2;
+
+  ij = my_iindx[i]-j;
+  int e = (k == -1) ? E_M_rem[ij] : E_M[ij][k][l/2];
+
+  base_d1 = referenceBPs1[ij];
+  base_d2 = referenceBPs2[ij];
+
+  if(k == -1){
+    /* new_fML = ML(i+1,j)+c */
+    d1 = base_d1 - referenceBPs1[my_iindx[i+1]-j];
+    d2 = base_d2 - referenceBPs2[my_iindx[i+1]-j];
+    if(E_M_rem[my_iindx[i+1]-j] != INF){
+      if(e == (E_M_rem[my_iindx[i+1]-j] + P->MLbase)){
+        backtrack_m(i+1,j,-1,-1,structure,vc);
+        return;
+      }
+    }
+    if(E_M[my_iindx[i+1]-j])
+    for(cnt1 = k_min_M[my_iindx[i+1]-j];
+        cnt1 <= k_max_M[my_iindx[i+1]-j];
+        cnt1++)
+      for(cnt2 = l_min_M[my_iindx[i+1]-j][cnt1];
+          cnt2 <= l_max_M[my_iindx[i+1]-j][cnt1];
+          cnt2 += 2)
+        if(((cnt1 + d1) > maxD1) || ((cnt2 + d2) > maxD2)){
+          if(e == (E_M[my_iindx[i+1]-j][cnt1][cnt2/2] + P->MLbase)){
+            backtrack_m(i+1,j,cnt1,cnt2,structure,vc);
+            return;
+          }
+        }
+
+    /* new_fML = min(ML(i,j-1) + c, new_fML) */
+    d1 = base_d1 - referenceBPs1[ij+1];
+    d2 = base_d2 - referenceBPs2[ij+1];
+    if(E_M_rem[ij+1] != INF){
+      if(e == (E_M_rem[ij+1] + P->MLbase)){
+        backtrack_m(i,j-1,-1,-1,structure,vc);
+        return;
+      }
+    }
+    if(E_M[ij+1])
+    for(cnt1 = k_min_M[ij+1];
+        cnt1 <= k_max_M[ij+1];
+        cnt1++)
+      for(cnt2 = l_min_M[ij+1][cnt1];
+          cnt2 <= l_max_M[ij+1][cnt1];
+          cnt2 += 2)
+        if(((cnt1 + d1) > maxD1) || ((cnt2 + d2) > maxD2)){
+          if(e == (E_M[ij+1][cnt1][cnt2/2] + P->MLbase)){
+            backtrack_m(i,j-1,cnt1,cnt2,structure,vc);
+            return;
+          }
+        }
+
+    /* new_fML = min(new_fML, C(i,j)+b) */
+    if(E_C_rem[ij] != INF){
+      type = ptype[jindx[j] + i];
+      if(dangles == 2)
+        energy = E_MLstem(type, ((i > 1) || circ) ? S1[i-1] : -1, ((j < seq_length) || circ) ? S1[j+1] : -1, P);
+      else
+        energy = E_MLstem(type, -1, -1, P);
+      if(e == (E_C_rem[ij] + energy)){
+        backtrack_c(i,j,-1,-1,structure,vc);
+        return;
+      }
+    }
+
+    /* modular decomposition -------------------------------*/
+    for(u = i+1+TURN; u <= j-2-TURN; u++){
+      int iu, uj;
+      iu = my_iindx[i]-u;
+      uj = my_iindx[u+1]-j;
+      type = ptype[jindx[j] + u + 1];
+
+      d1 = base_d1 - referenceBPs1[iu] - referenceBPs1[uj];
+      d2 = base_d2 - referenceBPs2[iu] - referenceBPs2[uj];
+
+      if(dangles == 2)
+        energy = E_MLstem(type, S1[u], (j < seq_length) || circ ? S1[j+1] : -1, P);
+      else
+        energy = E_MLstem(type, -1, -1, P);
+
+      if(E_M_rem[iu] != INF){
+        if(E_C[uj])
+        for(cnt1 = k_min_C[uj];
+            cnt1 <= k_max_C[uj];
+            cnt1++)
+          for(cnt2 = l_min_C[uj][cnt1];
+              cnt2 <= l_max_C[uj][cnt1];
+              cnt2 += 2)
+            if(e == (E_M_rem[iu] + E_C[uj][cnt1][cnt2/2] + energy)){
+              backtrack_m(i,u,-1,-1,structure,vc);
+              backtrack_c(u+1,j,cnt1,cnt2,structure, vc);
+              return;
+            }
+        if(E_C_rem[uj] != INF){
+          if(e == (E_M_rem[iu] + E_C_rem[uj] + energy)){
+            backtrack_m(i,u,-1,-1,structure,vc);
+            backtrack_c(u+1,j,-1,-1,structure,vc);
+            return;
+          }
+        }
+      }
+      if(E_C_rem[uj] != INF){
+        if(E_M[iu])
+        for(cnt1 = k_min_M[iu];
+            cnt1 <= k_max_M[iu];
+            cnt1++)
+          for(cnt2 = l_min_M[iu][cnt1];
+              cnt2 <= l_max_M[iu][cnt1];
+              cnt2 += 2)
+            if(e == (E_M[iu][cnt1][cnt2/2] + E_C_rem[uj] + energy)){
+              backtrack_m(i,u,cnt1,cnt2,structure,vc);
+              backtrack_c(u+1,j,-1,-1,structure,vc);
+              return;
+            }
+      }
+
+      if(!E_M[iu]) continue;
+      if(!E_C[uj]) continue;
+
+      for(cnt1 = k_min_M[iu];
+          cnt1 <= k_max_M[iu];
+          cnt1++)
+        for(cnt2 = l_min_M[iu][cnt1];
+            cnt2 <= l_max_M[iu][cnt1];
+            cnt2 += 2)
+          for(cnt3 = k_min_C[uj];
+              cnt3 <= k_max_C[uj];
+              cnt3++){
+            for(cnt4 = l_min_C[uj][cnt3];
+                cnt4 <= l_max_C[uj][cnt3];
+                cnt4 += 2)
+              if(((cnt1 + cnt3 + d1) > maxD1) || ((cnt2 + cnt4 + d2) > maxD2))
+                if(e == (E_M[iu][cnt1][cnt2/2] + E_C[uj][cnt3][cnt4/2] + energy)){
+                  backtrack_m(i, u, cnt1, cnt2, structure, vc);
+                  backtrack_c(u+1, j, cnt3, cnt4, structure, vc);
+                  return;
+                }
+          }
+    }
+
+  } /* end if (k == -1) */
+  else{
+    d1 = base_d1 - referenceBPs1[my_iindx[i+1]-j];
+    d2 = base_d2 - referenceBPs2[my_iindx[i+1]-j];
+    /* new_fML = ML(i+1,j)+c */
+    if(d1 <= k && d2 <= l)
+      if((k-d1 >= k_min_M[my_iindx[i+1]-j]) && (k-d1 <= k_max_M[my_iindx[i+1]-j]))
+        if((l-d2 >= l_min_M[my_iindx[i+1]-j][k-d1]) && (l-d2 <= l_max_M[my_iindx[i+1]-j][k-d1])){
+          if(E_M[my_iindx[i+1]-j][k-d1][(l-d2)/2] + P->MLbase == e){
+            backtrack_m(i+1, j, k-d1, l-d2, structure, vc);
+            return;
+          }
+        }
+
+    d1 = base_d1 - referenceBPs1[ij+1];
+    d2 = base_d2 - referenceBPs2[ij+1];
+
+    /* new_fML = min(ML(i,j-1) + c, new_fML) */
+    if(E_M[ij+1])
+      if(d1 <= k && d2 <= l)
+        if((k-d1 >= k_min_M[ij+1]) && (k-d1 <= k_max_M[ij+1]))
+          if((l-d2 >= l_min_M[ij+1][k-d1]) && (l-d2 <= l_max_M[ij+1][k-d1]))
+            if(E_M[ij+1][k-d1][(l-d2)/2] + P->MLbase == e){
+              backtrack_m(i, j-1, k-d1, l-d2, structure, vc);
+              return;
+            }
+
+    /* new_fML = min(new_fML, C(i,j)+b) */
+    if(E_C[ij]){
+      type = ptype[jindx[j] + i];
+
+      if(dangles == 2)
+        energy = E_MLstem(type, ((i > 1) || circ) ? S1[i-1] : -1, ((j < seq_length) || circ) ? S1[j+1] : -1, P);
+      else
+        energy = E_MLstem(type, -1, -1, P);
+
+      if((k >= k_min_C[ij]) && (k <= k_max_C[ij]))
+        if((l >= l_min_C[ij][k]) && (l <= l_max_C[ij][k])){
+          if(E_C[ij][k][l/2] + energy == e){
+            backtrack_c(i, j, k, l, structure, vc);
+            return;
+          }
+        }
+    }
+
+      /* modular decomposition -------------------------------*/
+
+    for(u = i+1+TURN; u <= j-2-TURN; u++){
+      if(!E_M[my_iindx[i]-u]) continue;
+      if(!E_C[my_iindx[u+1]-j]) continue;
+      type = ptype[jindx[j] + u + 1];
+
+      d1 = base_d1 - referenceBPs1[my_iindx[i]-u] - referenceBPs1[my_iindx[u+1]-j];
+      d2 = base_d2 - referenceBPs2[my_iindx[i]-u] - referenceBPs2[my_iindx[u+1]-j];
+
+      if(dangles == 2)
+        energy = E_MLstem(type, S1[u], ((j < seq_length) || circ) ? S1[j+1] : -1, P);
+      else
+        energy = E_MLstem(type, -1, -1, P);
+
+      if(d1 <= k && d2 <= l)
+        for(cnt1 = k_min_M[my_iindx[i]-u]; cnt1 <= MIN2(k-d1, k_max_M[my_iindx[i]-u]); cnt1++)
+          for(cnt2 = l_min_M[my_iindx[i]-u][cnt1]; cnt2 <= MIN2(l-d2, l_max_M[my_iindx[i]-u][cnt1]); cnt2+=2)
+            if((k-d1-cnt1 >= k_min_C[my_iindx[u+1]-j]) && (k-d1-cnt1 <= k_max_C[my_iindx[u+1]-j]))
+              if((l-d2-cnt2 >= l_min_C[my_iindx[u+1]-j][k-d1-cnt1]) && (l-d2-cnt2 <= l_max_C[my_iindx[u+1]-j][k-d1-cnt1]))
+                if(E_M[my_iindx[i]-u][cnt1][cnt2/2] + E_C[my_iindx[u+1]-j][k-d1-cnt1][(l-d2-cnt2)/2] + energy == e){
+                  backtrack_m(i, u, cnt1, cnt2, structure, vc);
+                  backtrack_c(u+1, j, k-d1-cnt1, l-d2-cnt2, structure, vc);
+                  return;
+                }
+    }
+  }
+  vrna_message_error("backtracking failed in fML\n");
+}
+
+PRIVATE void
+backtrack_m1( unsigned int i,
+              unsigned int j,
+              int k,
+              int l,
+              char *structure,
+              vrna_fold_compound_t *vc){
+
+  unsigned int  ij, seq_length, d1, d2, *referenceBPs1, *referenceBPs2, maxD1, maxD2;
+  int           *my_iindx, *jindx, **l_min_C, **l_max_C,**l_min_M1, **l_max_M1;
+  int           *k_min_C, *k_max_C,*k_min_M1, *k_max_M1, cnt1, cnt2;
+  int           ***E_C, ***E_M1, *E_C_rem, *E_M1_rem, type, dangles, circ, energy, e_m1;
+
+  short         *S1;
+  char          *ptype;
+  vrna_param_t  *P;
+  vrna_md_t     *md;
+  vrna_mx_mfe_t *matrices;
+
+  P               = vc->params;
+  md              = &(P->model_details);
+  matrices        = vc->matrices;
+  seq_length      = vc->length;
+  S1              = vc->sequence_encoding;
+  ptype           = vc->ptype;
+  circ            = md->circ;
+  my_iindx        = vc->iindx;
+  jindx           = vc->jindx;
+  referenceBPs1   = vc->referenceBPs1;
+  referenceBPs2   = vc->referenceBPs2;
+  dangles         = md->dangles;
+
+  E_C             = matrices->E_C;
+  l_min_C    = matrices->l_min_C;
+  l_max_C    = matrices->l_max_C;
+  k_min_C    = matrices->k_min_C;
+  k_max_C    = matrices->k_max_C;
+
+  E_M1            = matrices->E_M1;
+  l_min_M1 = matrices->l_min_M1;
+  l_max_M1 = matrices->l_max_M1;
+  k_min_M1 = matrices->k_min_M1;
+  k_max_M1 = matrices->k_max_M1;
+
+  E_C_rem        = matrices->E_C_rem;
+  E_M1_rem       = matrices->E_M1_rem;
+  maxD1           = vc->maxD1;
+  maxD2           = vc->maxD2;
+
+  ij    = my_iindx[i]-j;
+  e_m1  = (k == -1) ? E_M1_rem[ij] : E_M1[ij][k][l/2];
+
+  type = ptype[jindx[j] + i];
+  d1 = referenceBPs1[ij] - referenceBPs1[ij+1];
+  d2 = referenceBPs2[ij] - referenceBPs2[ij+1];
+
+  if(dangles == 2)
+    energy = E_MLstem(type, (i > 1) || circ ? S1[i-1] : -1, (j < seq_length) || circ ? S1[j+1] : -1, P);
+  else
+    energy = E_MLstem(type, -1, -1, P);
+
+  if(k == -1){
+    if(E_C_rem[ij] != INF){
+      if(e_m1 == (E_C_rem[ij] + energy)){
+        backtrack_c(i,j,-1,-1,structure,vc);
+        return;
+      }
+    }
+    if(E_M1_rem[ij+1] != INF){
+      if(e_m1 == (E_M1_rem[ij+1] + P->MLbase)){
+        backtrack_m1(i,j-1,-1,-1,structure,vc);
+        return;
+      }
+    }
+    for(cnt1 = k_min_M1[ij+1];
+        cnt1 <= k_max_M1[ij+1];
+        cnt1++)
+      for(cnt2 = l_min_M1[ij+1][cnt1];
+          cnt2 <= l_max_M1[ij+1][cnt1];
+          cnt2 += 2)
+        if(((cnt1 + d1) > maxD1) || ((cnt2 + d2) > maxD2)){
+          if(e_m1  == (E_M1[ij+1][cnt1][cnt2/2] + P->MLbase)){
+            backtrack_m1(i,j-1,cnt1,cnt2,structure,vc);
+            return;
+          }
+        }
+  }
+  else{
+    if(E_C[ij])
+      if((k >= k_min_C[ij]) && (k <= k_max_C[ij]))
+        if((l >= l_min_C[ij][k]) && (l <= l_max_C[ij][k]))
+          if(E_C[ij][k][l/2] + energy == e_m1){
+            backtrack_c(i, j, k, l, structure, vc);
+            return;
+          }
+
+    if(d1 <= k && d2 <= l)
+      if((k-d1 >= k_min_M1[ij+1]) && (k-d1 <= k_max_M1[ij+1]))
+        if((l-d2 >= l_min_M1[ij+1][k-d1]) && (l-d2 <= l_max_M1[ij+1][k-d1]))
+          if(E_M1[ij+1][k-d1][(l-d2)/2] + P->MLbase == e_m1){
+            backtrack_m1(i, j-1, k-d1, l-d2, structure, vc);
+            return;
+          }
+  }
+  vrna_message_error("backtack failed in m1\n");
+}
+
+PRIVATE void
+backtrack_fc( int k,
+              int l,
+              char *structure,
+              vrna_fold_compound_t *vc){
+
+  unsigned int   d, i, j, seq_length, base_d1, base_d2, d1, d2, maxD1, maxD2;
+  int   *my_iindx, *jindx, energy, cnt1, cnt2, cnt3, cnt4, *rtype;
+  short *S1;
+  unsigned int   *referenceBPs1, *referenceBPs2;
+  char  *sequence, *ptype;
+  int **E_Fc, **E_FcH, **E_FcI, **E_FcM, ***E_C, ***E_M, ***E_M2;
+  int *E_C_rem, *E_M_rem, *E_M2_rem, E_Fc_rem, E_FcH_rem, E_FcI_rem, E_FcM_rem;
+  int **l_min_C, **l_max_C, *k_min_C, *k_max_C;
+  int **l_min_M, **l_max_M, *k_min_M, *k_max_M;
+  int **l_min_M2, **l_max_M2, *k_min_M2, *k_max_M2;
+  int *l_min_FcH, *l_max_FcH, k_min_FcH, k_max_FcH;
+  int *l_min_FcI, *l_max_FcI, k_min_FcI, k_max_FcI;
+  int *l_min_FcM, *l_max_FcM, k_min_FcM, k_max_FcM;
+  vrna_param_t   *P;
+  vrna_md_t     *md;
+  vrna_mx_mfe_t *matrices;
+
+  P                 = vc->params;
+  md                = &(P->model_details);
+  matrices          = vc->matrices;
+  sequence          = vc->sequence;
+  seq_length        = vc->length;
+  S1                = vc->sequence_encoding;
+  ptype             = vc->ptype;
+  rtype             = &(md->rtype[0]);
+  my_iindx          = vc->iindx;
+  jindx             = vc->jindx;
+  referenceBPs1     = vc->referenceBPs1;
+  referenceBPs2     = vc->referenceBPs2;
+
+  base_d1           = referenceBPs1[my_iindx[1]-seq_length];
+  base_d2           = referenceBPs2[my_iindx[1]-seq_length];
+
+  E_C               = matrices->E_C;
+  l_min_C      = matrices->l_min_C;
+  l_max_C      = matrices->l_max_C;
+  k_min_C      = matrices->k_min_C;
+  k_max_C      = matrices->k_max_C;
+
+  E_M               = matrices->E_M;
+  l_min_M    = matrices->l_min_M;
+  l_max_M    = matrices->l_max_M;
+  k_min_M    = matrices->k_min_M;
+  k_max_M    = matrices->k_max_M;
+
+  E_M2              = matrices->E_M2;
+  l_min_M2   = matrices->l_min_M2;
+  l_max_M2   = matrices->l_max_M2;
+  k_min_M2   = matrices->k_min_M2;
+  k_max_M2   = matrices->k_max_M2;
+
+  E_Fc              = matrices->E_Fc;
+
+  E_FcI             = matrices->E_FcI;
+  l_min_FcI  = matrices->l_min_FcI;
+  l_max_FcI  = matrices->l_max_FcI;
+  k_min_FcI  = matrices->k_min_FcI;
+  k_max_FcI  = matrices->k_max_FcI;
+
+  E_FcH             = matrices->E_FcH;
+  l_min_FcH  = matrices->l_min_FcH;
+  l_max_FcH  = matrices->l_max_FcH;
+  k_min_FcH  = matrices->k_min_FcH;
+  k_max_FcH  = matrices->k_max_FcH;
+
+  E_FcM             = matrices->E_FcM;
+  l_min_FcM  = matrices->l_min_FcM;
+  l_max_FcM  = matrices->l_max_FcM;
+  k_min_FcM  = matrices->k_min_FcM;
+  k_max_FcM  = matrices->k_max_FcM;
+
+  E_C_rem          = matrices->E_C_rem;
+  E_M_rem          = matrices->E_M_rem;
+  E_M2_rem         = matrices->E_M2_rem;
+  E_Fc_rem         = matrices->E_Fc_rem;
+  E_FcH_rem        = matrices->E_FcH_rem;
+  E_FcI_rem        = matrices->E_FcI_rem;
+  E_FcM_rem        = matrices->E_FcM_rem;
+  maxD1             = vc->maxD1;
+  maxD2             = vc->maxD2;
+
+
+  if(k==-1){
+    /* check if mfe might be open chain */
+    if(E_Fc_rem == 0)
+      if((referenceBPs1[my_iindx[1]-seq_length] > maxD1) || (referenceBPs2[my_iindx[1]-seq_length] > maxD2))
+        return;
+
+    /* check for hairpin configurations */
+    if(E_Fc_rem == E_FcH_rem){
+      for (d = TURN+2; d <= seq_length; d++) /* i,j in [1..length] */
+        for (j = d; j <= seq_length; j++) {
+          unsigned int u, ij;
+          int type, no_close;
+          char loopseq[10];
+          i = j-d+1;
+          ij = my_iindx[i]-j;
+          u = seq_length-j + i-1;
+          if (u<TURN) continue;
+          type = ptype[jindx[j] + i];
+          no_close = (((type==3)||(type==4))&&no_closingGU);
+          type=rtype[type];
+          if (!type) continue;
+          if(no_close) continue;
+
+          d1 = base_d1 - referenceBPs1[ij];
+          d2 = base_d2 - referenceBPs2[ij];
+          if (u<7) {
+            strcpy(loopseq , sequence+j-1);
+            strncat(loopseq, sequence, i);
+          }
+          energy = E_Hairpin(u, type, S1[j+1], S1[i-1],  loopseq, P);
+
+          if(E_C_rem[ij] != INF){
+            if(E_Fc_rem == (E_C_rem[ij] + energy)){
+              backtrack_c(i,j,-1,-1,structure,vc);
+              return;
+            }
+          }
+          if(E_C[ij])
+            for(cnt1 = k_min_C[ij];
+                cnt1 <= k_max_C[ij];
+                cnt1++)
+              for(cnt2 = l_min_C[ij][cnt1];
+                  cnt2 <= l_max_C[ij][cnt1];
+                  cnt2 += 2)
+                if(((cnt1 + d1) > maxD1) || ((cnt2 + d2) > maxD2))
+                  if(E_Fc_rem == (E_C[ij][cnt1][cnt2/2] + energy)){
+                    backtrack_c(i,j,cnt1,cnt2,structure,vc);
+                    return;
+                  }
+        }
+    }
+
+    /* check for interior loop configurations */
+    if(E_Fc_rem == E_FcI_rem){
+      for (d = TURN+2; d <= seq_length; d++) /* i,j in [1..length] */
+        for (j = d; j <= seq_length; j++) {
+          unsigned int u, ij, p, q, pq;
+          int type, type_2;
+          i = j-d+1;
+          ij = my_iindx[i]-j;
+          u = seq_length-j + i-1;
+          if (u<TURN) continue;
+          type = rtype[(unsigned int)ptype[jindx[j] + i]];
+          if (!type) continue;
+
+          for(p = j+1; p < seq_length ; p++){
+            unsigned int u1, qmin, ln_pre;
+            u1 = p-j-1;
+            if (u1+i-1>MAXLOOP) break;
+            qmin = p + TURN + 1;
+            ln_pre = u1 + i + seq_length;
+            if(ln_pre > qmin + MAXLOOP) qmin = ln_pre - MAXLOOP - 1;
+            for(q = qmin; q <= seq_length; q++){
+              unsigned int u2;
+              pq = my_iindx[p]-q;
+              type_2 = rtype[(unsigned int)ptype[jindx[q] + p]];
+              if (type_2==0) continue;
+              u2 = i-1 + seq_length-q;
+              if (u1+u2>MAXLOOP) continue;
+              energy = E_IntLoop(u1, u2, type, type_2, S1[j+1], S1[i-1], S1[p-1], S1[q+1], P);
+              if(E_C_rem[ij] != INF){
+                if(E_C[pq])
+                  for(cnt1 = k_min_C[pq];
+                      cnt1 <= k_max_C[pq];
+                      cnt1++)
+                    for(cnt2 = l_min_C[pq][cnt1];
+                        cnt2 <= l_max_C[pq][cnt1];
+                        cnt2 += 2)
+                      if(E_Fc_rem == (E_C_rem[ij] + E_C[pq][cnt1][cnt2/2] + energy)){
+                        backtrack_c(i,j,-1,-1,structure,vc);
+                        backtrack_c(p,q,cnt1,cnt2,structure,vc);
+                        return;
+                      }
+                if(E_C_rem[pq] != INF){
+                  if(E_Fc_rem == (E_C_rem[ij] + E_C_rem[pq] + energy)){
+                    backtrack_c(i,j,-1,-1,structure,vc);
+                    backtrack_c(p,q,-1,-1,structure,vc);
+                    return;
+                  }
+                }
+              }
+              if(E_C_rem[pq] != INF){
+                if(E_C[ij])
+                  for(cnt1 = k_min_C[ij];
+                      cnt1 <= k_max_C[ij];
+                      cnt1++)
+                    for(cnt2 = l_min_C[ij][cnt1];
+                        cnt2 <= l_max_C[ij][cnt1];
+                        cnt2 += 2)
+                      if(E_Fc_rem == (E_C[ij][cnt1][cnt2/2] + E_C_rem[pq] + energy)){
+                        backtrack_c(i,j,cnt1,cnt2,structure,vc);
+                        backtrack_c(p,q,-1,-1,structure,vc);
+                        return;
+                      }
+              }
+
+              if(!(E_C[ij])) continue;
+              if(!(E_C[pq])) continue;
+
+              /* get distance to reference if closing the interior loop
+              *  d2a = dbp(T1_[1,n}, T1_{p,q} + T1_{i,j})
+              *  d2b = dbp(T2_[1,n}, T2_{p,q} + T2_{i,j})
+              */
+              d1 = base_d1 - referenceBPs1[ij] - referenceBPs1[pq];
+              d2 = base_d2 - referenceBPs2[ij] - referenceBPs2[pq];
+              for(cnt1 = k_min_C[ij];
+                  cnt1 <= k_max_C[ij];
+                  cnt1++)
+                for(cnt2 = l_min_C[ij][cnt1];
+                    cnt2 <= l_max_C[ij][cnt1];
+                    cnt2 += 2)
+                  for(cnt3 = k_min_C[pq];
+                      cnt3 <= k_max_C[pq];
+                      cnt3++)
+                    for(cnt4 = l_min_C[pq][cnt3];
+                        cnt4 <= l_max_C[pq][cnt3];
+                        cnt4 += 2)
+                      if(((cnt1 + cnt3 + d1) > maxD1) || ((cnt2 + cnt4 + d2) > maxD2))
+                        if(E_Fc_rem == (E_C[ij][cnt1][cnt2/2] + E_C[pq][cnt3][cnt4/2] + energy)){
+                          backtrack_c(i, j, cnt1, cnt2, structure, vc);
+                          backtrack_c(p, q, cnt3, cnt4, structure, vc);
+                          return;
+                        }
+            } /* end for p */
+          } /* end for q */
+        }
+
+    }
+
+    /* check for multi loop configurations */
+    if(E_Fc_rem == E_FcM_rem){
+      if(seq_length > 2*TURN)
+        for (i=TURN+1; i<seq_length-2*TURN; i++) {
+          /* get distancies to references
+          * d3a = dbp(T1_[1,n}, T1_{1,k} + T1_{k+1, n})
+          * d3b = dbp(T2_[1,n}, T2_{1,k} + T2_{k+1, n})
+          */
+          if(E_M_rem[my_iindx[1]-i] != INF){
+            if(E_M2[i+1])
+              for(cnt1 = k_min_M2[i+1];
+                  cnt1 <= k_max_M2[i+1];
+                  cnt1++)
+                for(cnt2 = l_min_M2[i+1][cnt1];
+                    cnt2 <= l_max_M2[i+1][cnt1];
+                    cnt2 += 2)
+                  if(E_Fc_rem == (E_M_rem[my_iindx[1]-i] + E_M2[i+1][cnt1][cnt2/2] + P->MLclosing)){
+                    backtrack_m(1,i,-1,-1,structure,vc);
+                    backtrack_m2(i+1,cnt1,cnt2,structure,vc);
+                    return;
+                  }
+            if(E_M2_rem[i+1] != INF){
+              if(E_Fc_rem == (E_M_rem[my_iindx[1]-i] + E_M2_rem[i+1] + P->MLclosing)){
+                backtrack_m(1,i,-1,-1,structure,vc);
+                backtrack_m2(i+1,-1,-1,structure,vc);
+                return;
+              }
+            }
+          }
+          if(E_M2_rem[i+1] != INF){
+            if(E_M[my_iindx[1]-i])
+              for(cnt1 = k_min_M[my_iindx[1]-i];
+                  cnt1 <= k_max_M[my_iindx[1]-i];
+                  cnt1++)
+                for(cnt2 = l_min_M[my_iindx[1]-i][cnt1];
+                    cnt2 <= l_max_M[my_iindx[1]-i][cnt1];
+                    cnt2 += 2)
+                  if(E_Fc_rem == (E_M[my_iindx[1]-i][cnt1][cnt2/2] + E_M2_rem[i+1] + P->MLclosing)){
+                    backtrack_m(1,i,cnt1,cnt2,structure,vc);
+                    backtrack_m2(i+1,-1,-1,structure,vc);
+                    return;
+                  }
+          }
+
+          if(!(E_M[my_iindx[1]-i])) continue;
+          if(!(E_M2[i+1])) continue;
+
+          d1 = base_d1 - referenceBPs1[my_iindx[1]-i] - referenceBPs1[my_iindx[i+1]-seq_length];
+          d2 = base_d2 - referenceBPs2[my_iindx[1]-i] - referenceBPs2[my_iindx[i+1]-seq_length];
+          for(cnt1 = k_min_M[my_iindx[1]-i];
+              cnt1 <= k_max_M[my_iindx[1]-i];
+              cnt1++)
+            for(cnt2 = l_min_M[my_iindx[1]-i][cnt1];
+                cnt2 <= l_max_M[my_iindx[1]-i][cnt1];
+                cnt2 += 2)
+              for(cnt3 = k_min_M2[i+1];
+                  cnt3 <= k_max_M2[i+1];
+                  cnt3++)
+                for(cnt4 = l_min_M2[i+1][cnt3];
+                    cnt4 <= l_max_M2[i+1][cnt3];
+                    cnt4 += 2)
+                  if(((cnt1 + cnt3 + d1) > maxD1) || ((cnt2 + cnt4 + d2) > maxD2)){
+                    if(E_Fc_rem == (E_M[my_iindx[1]-i][cnt1][cnt2/2] + E_M2[i+1][cnt3][cnt4/2] + P->MLclosing)){
+                      backtrack_m(1, i, cnt1, cnt2, structure, vc);
+                      backtrack_m2(i+1, cnt3, cnt4, structure, vc);
+                      return;
+                    }
+                  }
+        }
+    }
+  }
+  else{
+    /* open chain ? */
+    if(E_Fc[k][l/2] == 0)
+      if((k == referenceBPs1[my_iindx[1]-seq_length]) && (l == referenceBPs2[my_iindx[1]-seq_length])){
+        return;
+      }
+    if((k >= k_min_FcH) && (k <= k_max_FcH)){
+      if((l >= l_min_FcH[k]) && (l <= l_max_FcH[k]))
+        if(E_Fc[k][l/2] == E_FcH[k][l/2]){
+          for (d = TURN+2; d <= seq_length; d++) /* i,j in [1..length] */
+            for (j = d; j <= seq_length; j++) {
+              unsigned int u, ij;
+              int type, no_close;
+              char loopseq[10];
+              i = j-d+1;
+              ij = my_iindx[i]-j;
+              if (!E_C[ij]) continue;
+              u = seq_length-j + i-1;
+              if (u<TURN) continue;
+
+              type = ptype[jindx[j] + i];
+
+              no_close = (((type==3)||(type==4))&&no_closingGU);
+
+              type=rtype[type];
+
+              if (!type) continue;
+              if(no_close) continue;
+
+              d1 = base_d1 - referenceBPs1[ij];
+              d2 = base_d2 - referenceBPs2[ij];
+              if (u<7) {
+                strcpy(loopseq , sequence+j-1);
+                strncat(loopseq, sequence, i);
+              }
+              energy = E_Hairpin(u, type, S1[j+1], S1[i-1],  loopseq, P);
+              if((k >= d1) && (l >= d2))
+                if((k-d1 >= k_min_C[ij]) && (k-d1 <= k_max_C[ij]))
+                  if((l-d2 >= l_min_C[ij][k-d1]) && (l-d2 <= l_max_C[ij][k-d1])){
+                    if(E_Fc[k][l/2] == E_C[ij][k-d1][(l-d2)/2] + energy){
+                      backtrack_c(i, j, k-d1, l-d2, structure, vc);
+                      return;
+                    }
+                  }
+            }
+        }
+    }
+
+    if((k >= k_min_FcI) && (k <= k_max_FcI)){
+      if((l >= l_min_FcI[k]) && (l <= l_max_FcI[k]))
+        if(E_Fc[k][l/2] == E_FcI[k][l/2]){
+          for (d = TURN+2; d <= seq_length; d++) /* i,j in [1..length] */
+            for (j = d; j <= seq_length; j++) {
+              unsigned int u, ij, p, q, pq;
+              int type, type_2;
+              i = j-d+1;
+              ij = my_iindx[i]-j;
+              if(!E_C[ij]) continue;
+              u = seq_length-j + i-1;
+              if (u<TURN) continue;
+
+              type = ptype[jindx[j] + i];
+
+              type=rtype[type];
+
+              if (!type) continue;
+
+              for(p = j+1; p < seq_length ; p++){
+                unsigned int u1, qmin, ln_pre;
+                u1 = p-j-1;
+                if (u1+i-1>MAXLOOP) break;
+                qmin = p + TURN + 1;
+                ln_pre = u1 + i + seq_length;
+                if(ln_pre > qmin + MAXLOOP) qmin = ln_pre - MAXLOOP - 1;
+                for(q = qmin; q <= seq_length; q++){
+                  unsigned int u2;
+                  pq = my_iindx[p]-q;
+                  if(!E_C[pq]) continue;
+                  type_2 = rtype[(unsigned int)ptype[jindx[q] + p]];
+                  if (type_2==0) continue;
+                  u2 = i-1 + seq_length-q;
+                  if (u1+u2>MAXLOOP) continue;
+                  /* get distance to reference if closing the interior loop
+                  *  d2a = dbp(T1_[1,n}, T1_{p,q} + T1_{i,j})
+                  *  d2b = dbp(T2_[1,n}, T2_{p,q} + T2_{i,j})
+                  */
+                  d1 = base_d1 - referenceBPs1[ij] - referenceBPs1[pq];
+                  d2 = base_d2 - referenceBPs2[ij] - referenceBPs2[pq];
+                  energy = E_IntLoop(u1, u2, type, type_2, S1[j+1], S1[i-1], S1[p-1], S1[q+1], P);
+                  if((k >= d1) && (l >= d2))
+                    for(cnt1 = k_min_C[ij]; cnt1 <= MIN2(k_max_C[ij], k - d1); cnt1++)
+                      for(cnt2 = l_min_C[ij][cnt1]; cnt2 <= MIN2(l_max_C[ij][cnt1], l - d2); cnt2+=2)
+                        if((k - d1 - cnt1 >= k_min_C[pq]) && (k - d1 - cnt1 <= k_max_C[pq]))
+                          if((l - d2 - cnt2 >= l_min_C[pq][k-d1-cnt1]) && (l - d2 - cnt2 <= l_max_C[pq][k-d1-cnt1])){
+                            if((E_C[ij][cnt1][cnt2/2] + E_C[pq][k-d1-cnt1][(l-d2-cnt2)/2] + energy) == E_Fc[k][l/2]){
+                              backtrack_c(i, j, cnt1, cnt2, structure, vc);
+                              backtrack_c(p, q, k - d1 - cnt1, l - d2 - cnt2, structure, vc);
+                              return;
+                            }
+                          }
+                }
+              }
+            }
+        }
+    }
+
+    if((k >= k_min_FcM) && (k <= k_max_FcM)){
+      if((l >= l_min_FcM[k]) && (l <= l_max_FcM[k]))
+        if(E_Fc[k][l/2] == E_FcM[k][l/2]){
+          if(seq_length > 2*TURN)
+            for (i=TURN+1; i<seq_length-2*TURN; i++) {
+              /* get distancies to references
+              * d3a = dbp(T1_[1,n}, T1_{1,k} + T1_{k+1, n})
+              * d3b = dbp(T2_[1,n}, T2_{1,k} + T2_{k+1, n})
+              */
+              if(!E_M[my_iindx[1]-i]) continue;
+              if(!E_M2[i+1]) continue;
+              d1 = base_d1 - referenceBPs1[my_iindx[1]-i] - referenceBPs1[my_iindx[i+1]-seq_length];
+              d2 = base_d2 - referenceBPs2[my_iindx[1]-i] - referenceBPs2[my_iindx[i+1]-seq_length];
+              if((k >= d1) && (l >= d2))
+                for(cnt1 = k_min_M[my_iindx[1]-i]; cnt1 <= MIN2(k_max_M[my_iindx[1]-i], k-d1); cnt1++)
+                  for(cnt2 = l_min_M[my_iindx[1]-i][cnt1]; cnt2 <= MIN2(l_max_M[my_iindx[1]-i][cnt1], l-d2); cnt2+=2)
+                    if((k - d1 - cnt1 >= k_min_M2[i+1]) && (k - d1 - cnt1 <= k_max_M2[i+1]))
+                      if((l - d2 - cnt2 >= l_min_M2[i+1][k-d1-cnt1]) && (l - d2 - cnt2 <= l_max_M2[i+1][k-d1-cnt1]))
+                        if((E_M[my_iindx[1]-i][cnt1][cnt2/2] + E_M2[i+1][k-d1-cnt1][(l-d2-cnt2)/2] + P->MLclosing) == E_FcM[k][l/2]){
+                          backtrack_m(1, i, cnt1, cnt2, structure, vc);
+                          backtrack_m2(i+1, k - d1 - cnt1, l - d2 - cnt2, structure, vc);
+                          return;
+                        }
+            }
+        }
+    }
+  }
+  vrna_message_error("backtack failed in fc\n");
+}
+
+
+PRIVATE void
+backtrack_m2( unsigned int i,
+              int k,
+              int l,
+              char *structure,
+              vrna_fold_compound_t *vc){
+
+  unsigned int   j, ij, j3, n;
+  unsigned int   *referenceBPs1, *referenceBPs2;
+  unsigned int d1, d2, base_d1, base_d2, maxD1, maxD2;
+  int *my_iindx, cnt1, cnt2, cnt3, cnt4;
+  int ***E_M1, ***E_M2, *E_M2_rem, *E_M1_rem, e;
+  int **l_min_M1, **l_max_M1, *k_min_M1, *k_max_M1;
+  vrna_mx_mfe_t   *matrices;
+
+  matrices        = vc->matrices;
+  n               = vc->length;
+  my_iindx        = vc->iindx;
+  referenceBPs1   = vc->referenceBPs1;
+  referenceBPs2   = vc->referenceBPs2;
+
+  E_M1            = matrices->E_M1;
+  l_min_M1 = matrices->l_min_M1;
+  l_max_M1 = matrices->l_max_M1;
+  k_min_M1 = matrices->k_min_M1;
+  k_max_M1 = matrices->k_max_M1;
+
+  E_M1_rem        = matrices->E_M1_rem;
+
+  E_M2            = matrices->E_M2;
+
+  E_M2_rem        = matrices->E_M2_rem;
+
+  maxD1           = vc->maxD1;
+  maxD2           = vc->maxD2;
+
+  base_d1 = referenceBPs1[my_iindx[i]-n];
+  base_d2 = referenceBPs2[my_iindx[i]-n];
+
+  if(k == -1){
+    e = E_M2_rem[i];
+    for (j=i+TURN+1; j<n-TURN-1; j++){
+      if(E_M1_rem[my_iindx[i]-j] != INF){
+        if(E_M1[my_iindx[j+1]-n])
+          for(cnt1 = k_min_M1[my_iindx[j+1]-n];
+              cnt1 <= k_max_M1[my_iindx[j+1]-n];
+              cnt1++)
+            for(cnt2 = l_min_M1[my_iindx[j+1]-n][cnt1];
+                cnt2 <= l_max_M1[my_iindx[j+1]-n][cnt1];
+                cnt2++)
+              if(e == E_M1_rem[my_iindx[i]-j] + E_M1[my_iindx[j+1]-n][cnt1][cnt2/2]){
+                backtrack_m1(i, j, k, l, structure, vc);
+                backtrack_m1(j+1, n, cnt1, cnt2, structure, vc);
+                return;
+              }
+        if(E_M1_rem[my_iindx[j+1]-n] != INF){
+          if(e == E_M1_rem[my_iindx[i]-j] + E_M1_rem[my_iindx[j+1]-n]){
+            backtrack_m1(i, j, k, l, structure, vc);
+            backtrack_m1(j+1, n, k, l, structure, vc);
+            return;
+          }
+        }
+      }
+      if(E_M1_rem[my_iindx[j+1]-n] != INF){
+        if(E_M1[my_iindx[i]-j])
+          for(cnt1 = k_min_M1[my_iindx[i]-j];
+              cnt1 <= k_max_M1[my_iindx[i]-j];
+              cnt1++)
+            for(cnt2 = l_min_M1[my_iindx[i]-j][cnt1];
+                cnt2 <= l_max_M1[my_iindx[i]-j][cnt1];
+                cnt2 += 2)
+              if(e == E_M1[my_iindx[i]-j][cnt1][cnt2/2] + E_M1_rem[my_iindx[j+1]-n]){
+                backtrack_m1(i, j, cnt1, cnt2, structure, vc);
+                backtrack_m1(j+1, n, k, l, structure, vc);
+                return;
+              }
+      }
+
+
+      if(!E_M1[my_iindx[i]-j]) continue;
+      if(!E_M1[my_iindx[j+1]-n]) continue;
+
+      d1 = referenceBPs1[my_iindx[i]-n] - referenceBPs1[my_iindx[i]-j] - referenceBPs1[my_iindx[j+1]-n];
+      d2 = referenceBPs2[my_iindx[i]-n] - referenceBPs2[my_iindx[i]-j] - referenceBPs2[my_iindx[j+1]-n];
+
+      for(cnt1 = k_min_M1[my_iindx[i]-j]; cnt1 <= k_max_M1[my_iindx[i]-j]; cnt1++)
+        for(cnt2 = l_min_M1[my_iindx[i]-j][cnt1]; cnt2 <= l_max_M1[my_iindx[i]-j][cnt1]; cnt2+=2){
+          for(cnt3 = k_min_M1[my_iindx[j+1]-n]; cnt3 <= k_max_M1[my_iindx[j+1]-n]; cnt3++)
+            for(cnt4 = l_min_M1[my_iindx[j+1]-n][cnt3]; cnt4 <= l_max_M1[my_iindx[j+1]-n][cnt3]; cnt4+=2){
+              if(((cnt1 + cnt3 + d1) > maxD1) || ((cnt2 + cnt4 + d2) > maxD2)){
+                if(e == E_M1[my_iindx[i]-j][cnt1][cnt2/2] + E_M1[my_iindx[j+1]-n][cnt3][cnt4/2]){
+                  backtrack_m1(i, j, cnt1, cnt2, structure, vc);
+                  backtrack_m1(j+1, n, cnt3, cnt4, structure, vc);
+                  return;
+                }
+              }
+            }
+        }
+    }
+  }
+  else{
+    for(j=i+TURN+1; j<n-TURN-1; j++){
+      if(!E_M1[my_iindx[i]-j]) continue;
+      if(!E_M1[my_iindx[j+1]-n]) continue;
+
+      ij = my_iindx[i]-j;
+      j3 = my_iindx[j+1]-n;
+      d1 = base_d1 - referenceBPs1[ij] - referenceBPs1[j3];
+      d2 = base_d2 - referenceBPs2[ij] - referenceBPs2[j3];
+
+      for(cnt1 = k_min_M1[ij]; cnt1 <= MIN2(k_max_M1[ij], k - d1); cnt1++)
+        for(cnt2 = l_min_M1[ij][cnt1]; cnt2 <= MIN2(l_max_M1[ij][cnt1], l-d2); cnt2+=2)
+          if((k - d1 - cnt1 >= k_min_M1[j3]) && (k - d1 - cnt1 <= k_max_M1[j3]))
+            if((l - d2 - cnt2 >= l_min_M1[j3][k - d1 - cnt1]) && (l - d2 - cnt2 <= l_max_M1[j3][k-d1-cnt1]))
+              if(E_M1[ij][cnt1][cnt2/2] + E_M1[j3][k-d1-cnt1][(l-d2-cnt2)/2] == E_M2[i][k][l/2]){
+                backtrack_m1(i, j, cnt1, cnt2, structure, vc);
+                backtrack_m1(j+1, n, k-d1-cnt1, l-d2-cnt2, structure, vc);
+                return;
+              }
+    }
+  }
+  vrna_message_error("backtack failed in m2\n");
+}
+
+PRIVATE void
+mfe_circ(vrna_fold_compound_t *vc){
+
+  unsigned int  d, i, j, maxD1, maxD2, seq_length, *referenceBPs1, *referenceBPs2, d1, d2, base_d1, base_d2, *mm1, *mm2, *bpdist;
+  int           *my_iindx, *jindx, energy, cnt1, cnt2, cnt3, cnt4, *rtype;
+  short         *S1;
+  char          *sequence, *ptype;
+  int           ***E_C, ***E_M, ***E_M1;
+  int           *E_C_rem, *E_M_rem, *E_M1_rem;
+  int           **l_min_C, **l_max_C, **l_min_M, **l_max_M, **l_min_M1, **l_max_M1;
+  int           *k_min_C, *k_max_C,*k_min_M, *k_max_M,*k_min_M1, *k_max_M1;
+
+  vrna_param_t  *P;
+  vrna_md_t     *md;
+  vrna_mx_mfe_t *matrices;
+
+  P               = vc->params;
+  md              = &(P->model_details);
+  matrices        = vc->matrices;
+  sequence        = vc->sequence;
+  seq_length      = vc->length;
+  maxD1           = vc->maxD1;
+  maxD2           = vc->maxD2;
+  S1              = vc->sequence_encoding;
+  ptype           = vc->ptype;
+  rtype           = &(md->rtype[0]);
+  my_iindx        = vc->iindx;
+  jindx           = vc->jindx;
+  referenceBPs1   = vc->referenceBPs1;
+  referenceBPs2   = vc->referenceBPs2;
+  mm1             = vc->mm1;
+  mm2             = vc->mm2;
+  bpdist          = vc->bpdist;
+
+  E_C             = matrices->E_C;
+  l_min_C    = matrices->l_min_C;
+  l_max_C    = matrices->l_max_C;
+  k_min_C    = matrices->k_min_C;
+  k_max_C    = matrices->k_max_C;
+
+  E_M             = matrices->E_M;
+  l_min_M  = matrices->l_min_M;
+  l_max_M  = matrices->l_max_M;
+  k_min_M  = matrices->k_min_M;
+  k_max_M  = matrices->k_max_M;
+
+  E_M1            = matrices->E_M1;
+  l_min_M1 = matrices->l_min_M1;
+  l_max_M1 = matrices->l_max_M1;
+  k_min_M1 = matrices->k_min_M1;
+  k_max_M1 = matrices->k_max_M1;
+
+  E_C_rem        = matrices->E_C_rem;
+  E_M_rem        = matrices->E_M_rem;
+  E_M1_rem       = matrices->E_M1_rem;
+
+#ifdef _OPENMP
+  #pragma omp parallel for private(d1,d2,cnt1,cnt2,cnt3,cnt4,j, i)
+#endif
+  for(i=1; i<seq_length-TURN-1; i++){
+    /* guess memory requirements for M2 */
+
+    int min_k, max_k, max_l, min_l;
+    int min_k_real, max_k_real, *min_l_real, *max_l_real;
+
+    min_k = min_l = 0;
+    max_k = mm1[my_iindx[i]-seq_length] + referenceBPs1[my_iindx[i] - seq_length];
+    max_l = mm2[my_iindx[i]-seq_length] + referenceBPs2[my_iindx[i] - seq_length];
+
+    prepareBoundaries(min_k,
+                      max_k,
+                      min_l,
+                      max_l,
+                      bpdist[my_iindx[i] - seq_length],
+                      &matrices->k_min_M2[i],
+                      &matrices->k_max_M2[i],
+                      &matrices->l_min_M2[i],
+                      &matrices->l_max_M2[i]
+                      );
+
+    prepareArray( &matrices->E_M2[i],
+                  matrices->k_min_M2[i],
+                  matrices->k_max_M2[i],
+                  matrices->l_min_M2[i],
+                  matrices->l_max_M2[i]
+                 );
+
+    preparePosteriorBoundaries( matrices->k_max_M2[i] - matrices->k_min_M2[i] + 1,
+                                matrices->k_min_M2[i],
+                                &min_k_real,
+                                &max_k_real,
+                                &min_l_real,
+                                &max_l_real
+                              );
+
+    /* begin filling of M2 array */
+    for (j=i+TURN+1; j<seq_length-TURN-1; j++){
+      if(E_M1_rem[my_iindx[i]-j] != INF){
+        if(E_M1[my_iindx[j+1]-seq_length])
+          for(cnt1 = k_min_M1[my_iindx[j+1]-seq_length];
+              cnt1 <= k_max_M1[my_iindx[j+1]-seq_length];
+              cnt1++)
+            for(cnt2 = l_min_M1[my_iindx[j+1]-seq_length][cnt1];
+                cnt2 <= l_max_M1[my_iindx[j+1]-seq_length][cnt1];
+                cnt2++)
+              matrices->E_M2_rem[i] = MIN2(matrices->E_M2_rem[i],
+                                  E_M1_rem[my_iindx[i]-j] + E_M1[my_iindx[j+1]-seq_length][cnt1][cnt2/2]
+                                  );
+        if(E_M1_rem[my_iindx[j+1]-seq_length] != INF)
+          matrices->E_M2_rem[i] = MIN2(matrices->E_M2_rem[i], E_M1_rem[my_iindx[i]-j] + E_M1_rem[my_iindx[j+1]-seq_length]);
+      }
+      if(E_M1_rem[my_iindx[j+1]-seq_length] != INF){
+        if(E_M1[my_iindx[i]-j])
+          for(cnt1 = k_min_M1[my_iindx[i]-j];
+              cnt1 <= k_max_M1[my_iindx[i]-j];
+              cnt1++)
+            for(cnt2 = l_min_M1[my_iindx[i]-j][cnt1];
+                cnt2 <= l_max_M1[my_iindx[i]-j][cnt1];
+                cnt2 += 2)
+              matrices->E_M2_rem[i] = MIN2(matrices->E_M2_rem[i],
+                                  E_M1[my_iindx[i]-j][cnt1][cnt2/2] + E_M1_rem[my_iindx[j+1]-seq_length]
+                                  );
+      }
+
+
+      if(!E_M1[my_iindx[i]-j]) continue;
+      if(!E_M1[my_iindx[j+1]-seq_length]) continue;
+
+      d1 = referenceBPs1[my_iindx[i]-seq_length] - referenceBPs1[my_iindx[i]-j] - referenceBPs1[my_iindx[j+1]-seq_length];
+      d2 = referenceBPs2[my_iindx[i]-seq_length] - referenceBPs2[my_iindx[i]-j] - referenceBPs2[my_iindx[j+1]-seq_length];
+
+      for(cnt1 = k_min_M1[my_iindx[i]-j]; cnt1 <= k_max_M1[my_iindx[i]-j]; cnt1++)
+        for(cnt2 = l_min_M1[my_iindx[i]-j][cnt1]; cnt2 <= l_max_M1[my_iindx[i]-j][cnt1]; cnt2+=2){
+          for(cnt3 = k_min_M1[my_iindx[j+1]-seq_length]; cnt3 <= k_max_M1[my_iindx[j+1]-seq_length]; cnt3++)
+            for(cnt4 = l_min_M1[my_iindx[j+1]-seq_length][cnt3]; cnt4 <= l_max_M1[my_iindx[j+1]-seq_length][cnt3]; cnt4+=2){
+              if(((cnt1 + cnt3 + d1) <= maxD1) && ((cnt2 + cnt4 + d2) <= maxD2)){
+                matrices->E_M2[i][cnt1 + cnt3 + d1][(cnt2 + cnt4 + d2)/2] = MIN2( matrices->E_M2[i][cnt1 + cnt3 + d1][(cnt2 + cnt4 + d2)/2],
+                                                                        E_M1[my_iindx[i]-j][cnt1][cnt2/2] + E_M1[my_iindx[j+1]-seq_length][cnt3][cnt4/2]
+                                                                      );
+                updatePosteriorBoundaries(cnt1+cnt3+d1,
+                                          cnt2+cnt4+d2,
+                                          &min_k_real,
+                                          &max_k_real,
+                                          &min_l_real,
+                                          &max_l_real
+                                          );
+              }
+              else{
+                matrices->E_M2_rem[i] = MIN2(matrices->E_M2_rem[i],
+                                    E_M1[my_iindx[i]-j][cnt1][cnt2/2] + E_M1[my_iindx[j+1]-seq_length][cnt3][cnt4/2]
+                                    );
+              }
+            }
+        }
+    }
+
+    /* resize and move memory portions of energy matrix E_M2 */
+    adjustArrayBoundaries(&matrices->E_M2[i],
+                          &matrices->k_min_M2[i],
+                          &matrices->k_max_M2[i],
+                          &matrices->l_min_M2[i],
+                          &matrices->l_max_M2[i],
+                          min_k_real,
+                          max_k_real,
+                          min_l_real,
+                          max_l_real
+                          );
+  } /* end for i */
+
+  base_d1 = referenceBPs1[my_iindx[1]-seq_length];
+  base_d2 = referenceBPs2[my_iindx[1]-seq_length];
+
+  /* guess memory requirements for E_FcH, E_FcI and E_FcM */
+
+  int min_k, max_k, max_l, min_l;
+  int min_k_real, max_k_real, min_k_real_fcH, max_k_real_fcH, min_k_real_fcI, max_k_real_fcI, min_k_real_fcM, max_k_real_fcM;
+  int *min_l_real, *max_l_real, *min_l_real_fcH, *max_l_real_fcH, *min_l_real_fcI, *max_l_real_fcI,*min_l_real_fcM, *max_l_real_fcM;
+
+  min_k = min_l = 0;
+
+  max_k = mm1[my_iindx[1] - seq_length] + referenceBPs1[my_iindx[1] - seq_length];
+  max_l = mm2[my_iindx[1] - seq_length] + referenceBPs2[my_iindx[1] - seq_length];
+
+#ifdef _OPENMP
+  #pragma omp sections
+  {
+
+  #pragma omp section
+  {
+#endif
+  prepareBoundaries(min_k,
+                    max_k,
+                    min_l,
+                    max_l,
+                    bpdist[my_iindx[1] - seq_length],
+                    &matrices->k_min_Fc,
+                    &matrices->k_max_Fc,
+                    &matrices->l_min_Fc,
+                    &matrices->l_max_Fc
+                    );
+  prepareArray( &matrices->E_Fc,
+                matrices->k_min_Fc,
+                matrices->k_max_Fc,
+                matrices->l_min_Fc,
+                matrices->l_max_Fc
+              );
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  prepareBoundaries(min_k,
+                    max_k,
+                    min_l,
+                    max_l,
+                    bpdist[my_iindx[1] - seq_length],
+                    &matrices->k_min_FcH,
+                    &matrices->k_max_FcH,
+                    &matrices->l_min_FcH,
+                    &matrices->l_max_FcH
+                    );
+  prepareArray( &matrices->E_FcH,
+                matrices->k_min_FcH,
+                matrices->k_max_FcH,
+                matrices->l_min_FcH,
+                matrices->l_max_FcH
+              );
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  prepareBoundaries(min_k,
+                    max_k,
+                    min_l,
+                    max_l,
+                    bpdist[my_iindx[1] - seq_length],
+                    &matrices->k_min_FcI,
+                    &matrices->k_max_FcI,
+                    &matrices->l_min_FcI,
+                    &matrices->l_max_FcI
+                    );
+  prepareArray( &matrices->E_FcI,
+                matrices->k_min_FcI,
+                matrices->k_max_FcI,
+                matrices->l_min_FcI,
+                matrices->l_max_FcI
+              );
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  prepareBoundaries(min_k,
+                    max_k,
+                    min_l,
+                    max_l,
+                    bpdist[my_iindx[1] - seq_length],
+                    &matrices->k_min_FcM,
+                    &matrices->k_max_FcM,
+                    &matrices->l_min_FcM,
+                    &matrices->l_max_FcM
+                    );
+  prepareArray( &matrices->E_FcM,
+                matrices->k_min_FcM,
+                matrices->k_max_FcM,
+                matrices->l_min_FcM,
+                matrices->l_max_FcM
+              );
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  preparePosteriorBoundaries( max_k - min_k + 1,
+                              min_k,
+                              &min_k_real,
+                              &max_k_real,
+                              &min_l_real,
+                              &max_l_real
+                            );
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  preparePosteriorBoundaries( max_k - min_k + 1,
+                              min_k,
+                              &min_k_real_fcH,
+                              &max_k_real_fcH,
+                              &min_l_real_fcH,
+                              &max_l_real_fcH
+                            );
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  preparePosteriorBoundaries( max_k - min_k + 1,
+                              min_k,
+                              &min_k_real_fcI,
+                              &max_k_real_fcI,
+                              &min_l_real_fcI,
+                              &max_l_real_fcI
+                            );
+
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  preparePosteriorBoundaries( max_k - min_k + 1,
+                              min_k,
+                              &min_k_real_fcM,
+                              &max_k_real_fcM,
+                              &min_l_real_fcM,
+                              &max_l_real_fcM
+                            );
+#ifdef _OPENMP
+  }
+  }
+#endif
+
+  /* begin actual energy calculations */
+#ifdef _OPENMP
+  #pragma omp sections private(d, d1,d2,cnt1,cnt2,cnt3,cnt4,j, i, energy)
+  {
+
+  #pragma omp section
+  {
+#endif
+  for (d = TURN+2; d <= seq_length; d++) /* i,j in [1..length] */
+    for (j = d; j <= seq_length; j++) {
+      unsigned int  u, ij;
+      int           type, no_close;
+      char          loopseq[10];
+      i = j-d+1;
+      ij = my_iindx[i]-j;
+      u = seq_length-j + i-1;
+      if (u<TURN) continue;
+
+      type = ptype[jindx[j] + i];
+
+      no_close = (((type==3)||(type==4))&&no_closingGU);
+
+      type=rtype[type];
+
+      if (!type) continue;
+      if(no_close) continue;
+
+      d1 = base_d1 - referenceBPs1[ij];
+      d2 = base_d2 - referenceBPs2[ij];
+      if (u<7) {
+        strcpy(loopseq , sequence+j-1);
+        strncat(loopseq, sequence, i);
+      }
+      energy = E_Hairpin(u, type, S1[j+1], S1[i-1],  loopseq, P);
+
+      if(E_C_rem[ij] != INF)
+        matrices->E_FcH_rem = MIN2(matrices->E_FcH_rem, E_C_rem[ij] + energy);
+
+      if (!E_C[ij]) continue;
+      for(cnt1 = k_min_C[ij]; cnt1 <= k_max_C[ij]; cnt1++)
+        for(cnt2 = l_min_C[ij][cnt1]; cnt2 <= l_max_C[ij][cnt1]; cnt2 += 2){
+          if(((cnt1 + d1) <= maxD1) && ((cnt2 + d2) <= maxD2)){
+            matrices->E_FcH[cnt1 + d1][(cnt2+d2)/2] = MIN2( matrices->E_FcH[cnt1 + d1][(cnt2+d2)/2],
+                                                  energy + E_C[ij][cnt1][cnt2/2]
+                                                );
+            updatePosteriorBoundaries(cnt1 + d1,
+                                      cnt2 + d2,
+                                      &min_k_real_fcH,
+                                      &max_k_real_fcH,
+                                      &min_l_real_fcH,
+                                      &max_l_real_fcH
+                                    );
+          }
+          else
+            matrices->E_FcH_rem = MIN2(matrices->E_FcH_rem, energy + E_C[ij][cnt1][cnt2/2]);
+        }
+    }
+  /* end of i-j loop */
+
+  /* resize and move memory portions of energy matrix E_FcH */
+  adjustArrayBoundaries(&matrices->E_FcH,
+                        &matrices->k_min_FcH,
+                        &matrices->k_max_FcH,
+                        &matrices->l_min_FcH,
+                        &matrices->l_max_FcH,
+                        min_k_real_fcH,
+                        max_k_real_fcH,
+                        min_l_real_fcH,
+                        max_l_real_fcH
+                      );
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  for (d = TURN+2; d <= seq_length; d++) /* i,j in [1..length] */
+    for (j = d; j <= seq_length; j++) {
+      unsigned int  u, ij, p, q, pq;
+      int           type, type_2, no_close;
+      i = j-d+1;
+      ij = my_iindx[i]-j;
+      u = seq_length-j + i-1;
+      if (u<TURN) continue;
+
+      type = ptype[jindx[j] + i];
+
+      no_close = (((type==3)||(type==4))&&no_closingGU);
+
+      type=rtype[type];
+
+      if (!type) continue;
+      if(no_close) continue;
+
+      if(E_C_rem[ij] != INF){
+        for(p = j+1; p < seq_length ; p++){
+          unsigned int u1, qmin, ln_pre;
+          u1 = p-j-1;
+          if (u1+i-1>MAXLOOP) break;
+          qmin = p + TURN + 1;
+          ln_pre = u1 + i + seq_length;
+          if(ln_pre > qmin + MAXLOOP) qmin = ln_pre - MAXLOOP - 1;
+          for(q = qmin; q <= seq_length; q++){
+            unsigned int u2;
+            pq = my_iindx[p]-q;
+            type_2 = rtype[(unsigned int)ptype[jindx[q] + p]];
+            if (type_2==0) continue;
+            u2 = i-1 + seq_length-q;
+            if (u1+u2>MAXLOOP) continue;
+            /* get distance to reference if closing the interior loop
+            *  d2a = dbp(T1_[1,n}, T1_{p,q} + T1_{i,j})
+            *  d2b = dbp(T2_[1,n}, T2_{p,q} + T2_{i,j})
+            */
+            d1 = base_d1 - referenceBPs1[ij] - referenceBPs1[pq];
+            d2 = base_d2 - referenceBPs2[ij] - referenceBPs2[pq];
+            energy = E_IntLoop(u1, u2, type, type_2, S1[j+1], S1[i-1], S1[p-1], S1[q+1], P);
+
+            if(E_C_rem[pq] != INF)
+              matrices->E_FcI_rem = MIN2(matrices->E_FcI_rem, E_C_rem[ij] + E_C_rem[pq] + energy);
+
+            if(E_C[pq])
+              for(cnt1 = k_min_C[pq];
+                  cnt1 <= k_max_C[pq];
+                  cnt1++)
+                for(cnt2 = l_min_C[pq][cnt1];
+                    cnt2 <= l_max_C[pq][cnt1];
+                    cnt2 += 2)
+                  matrices->E_FcI_rem = MIN2(matrices->E_FcI_rem, E_C_rem[ij] + E_C[pq][cnt1][cnt2/2] + energy);
+          }
+        }
+      }
+
+      if(E_C[ij]){
+        for(p = j+1; p < seq_length ; p++){
+          unsigned int u1, qmin, ln_pre;
+          u1 = p-j-1;
+          if (u1+i-1>MAXLOOP) break;
+          qmin = p + TURN + 1;
+          ln_pre = u1 + i + seq_length;
+          if(ln_pre > qmin + MAXLOOP) qmin = ln_pre - MAXLOOP - 1;
+          for(q = qmin; q <= seq_length; q++){
+            unsigned int u2;
+            pq = my_iindx[p]-q;
+            type_2 = rtype[(unsigned int)ptype[jindx[q] + p]];
+            if (type_2==0) continue;
+            u2 = i-1 + seq_length-q;
+            if (u1+u2>MAXLOOP) continue;
+            /* get distance to reference if closing the interior loop
+            *  d2a = dbp(T1_[1,n}, T1_{p,q} + T1_{i,j})
+            *  d2b = dbp(T2_[1,n}, T2_{p,q} + T2_{i,j})
+            */
+            d1 = base_d1 - referenceBPs1[ij] - referenceBPs1[pq];
+            d2 = base_d2 - referenceBPs2[ij] - referenceBPs2[pq];
+            energy = E_IntLoop(u1, u2, type, type_2, S1[j+1], S1[i-1], S1[p-1], S1[q+1], P);
+            if(E_C_rem[pq] != INF){
+              for(cnt1 = k_min_C[ij];
+                  cnt1 <= k_max_C[ij];
+                  cnt1++)
+                for(cnt2 = l_min_C[ij][cnt1];
+                    cnt2 <= l_max_C[ij][cnt1];
+                    cnt2 += 2)
+                  matrices->E_FcI_rem = MIN2(matrices->E_FcI_rem, E_C[ij][cnt1][cnt2/2] + E_C_rem[pq] + energy);
+            }
+
+            if(E_C[pq])
+              for(cnt1 = k_min_C[ij];
+                  cnt1 <= k_max_C[ij];
+                  cnt1++)
+                for(cnt2 = l_min_C[ij][cnt1];
+                    cnt2 <= l_max_C[ij][cnt1];
+                    cnt2 += 2)
+                  for(cnt3 = k_min_C[pq];
+                      cnt3 <= k_max_C[pq];
+                      cnt3++)
+                    for(cnt4 = l_min_C[pq][cnt3];
+                        cnt4 <= l_max_C[pq][cnt3];
+                        cnt4 += 2){
+                      if(((cnt1 + cnt3 + d1) <= maxD1) && ((cnt2 + cnt4 + d2) <= maxD2)){
+                        matrices->E_FcI[cnt1 + cnt3 + d1][(cnt2 + cnt4 + d2)/2] = MIN2(
+                                                                          matrices->E_FcI[cnt1 + cnt3 + d1][(cnt2 + cnt4 + d2)/2],
+                                                                          E_C[ij][cnt1][cnt2/2]
+                                                                        + E_C[pq][cnt3][cnt4/2]
+                                                                        + energy
+                                                                            );
+                        updatePosteriorBoundaries(cnt1 + cnt3 + d1,
+                                                  cnt2 + cnt4 + d2,
+                                                  &min_k_real_fcI,
+                                                  &max_k_real_fcI,
+                                                  &min_l_real_fcI,
+                                                  &max_l_real_fcI
+                                                );
+                      }
+                      else{
+                        matrices->E_FcI_rem = MIN2(
+                                      matrices->E_FcI_rem,
+                                      E_C[ij][cnt1][cnt2/2]
+                                    + E_C[pq][cnt3][cnt4/2]
+                                    + energy
+                                          );
+                      }
+                    }
+          }
+        }
+      }
+    }
+  /* end of i-j loop */
+
+  /* resize and move memory portions of energy matrix E_FcI */
+  adjustArrayBoundaries(&matrices->E_FcI,
+                        &matrices->k_min_FcI,
+                        &matrices->k_max_FcI,
+                        &matrices->l_min_FcI,
+                        &matrices->l_max_FcI,
+                        min_k_real_fcI,
+                        max_k_real_fcI,
+                        min_l_real_fcI,
+                        max_l_real_fcI
+                      );
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  if(seq_length > 2*TURN){
+    for (i=TURN+1; i<seq_length-2*TURN; i++) {
+      /* get distancies to references
+      * d3a = dbp(T1_[1,n}, T1_{1,k} + T1_{k+1, n})
+      * d3b = dbp(T2_[1,n}, T2_{1,k} + T2_{k+1, n})
+      */
+      d1 = base_d1 - referenceBPs1[my_iindx[1]-i] - referenceBPs1[my_iindx[i+1]-seq_length];
+      d2 = base_d2 - referenceBPs2[my_iindx[1]-i] - referenceBPs2[my_iindx[i+1]-seq_length];
+
+      if(E_M_rem[my_iindx[1]-i] != INF){
+        if(matrices->E_M2[i+1])
+          for(cnt1 = matrices->k_min_M2[i+1];
+              cnt1 <= matrices->k_max_M2[i+1];
+              cnt1++)
+            for(cnt2 = matrices->l_min_M2[i+1][cnt1];
+                cnt2 <= matrices->l_max_M2[i+1][cnt1];
+                cnt2 += 2)
+              matrices->E_FcM_rem = MIN2(matrices->E_FcM_rem, E_M_rem[my_iindx[1]-i] + matrices->E_M2[i+1][cnt1][cnt2/2] + P->MLclosing);
+        if(matrices->E_M2_rem[i+1] != INF)
+          matrices->E_FcM_rem = MIN2(matrices->E_FcM_rem, E_M_rem[my_iindx[1]-i] + matrices->E_M2_rem[i+1] + P->MLclosing);
+      }
+      if(matrices->E_M2_rem[i+1] != INF){
+        if(E_M[my_iindx[1]-i])
+          for(cnt1 = k_min_M[my_iindx[1]-i];
+              cnt1 <= k_max_M[my_iindx[1]-i];
+              cnt1++)
+            for(cnt2 = l_min_M[my_iindx[1]-i][cnt1];
+                cnt2 <= l_max_M[my_iindx[1]-i][cnt1];
+                cnt2 += 2)
+              matrices->E_FcM_rem = MIN2(matrices->E_FcM_rem, E_M[my_iindx[1]-i][cnt1][cnt2/2] + matrices->E_M2_rem[i+1] + P->MLclosing);
+      }
+
+      if(!E_M[my_iindx[1]-i]) continue;
+      if(!matrices->E_M2[i+1]) continue;
+      for(cnt1 = k_min_M[my_iindx[1]-i]; cnt1 <= k_max_M[my_iindx[1]-i]; cnt1++)
+        for(cnt2 = l_min_M[my_iindx[1]-i][cnt1]; cnt2 <= l_max_M[my_iindx[1]-i][cnt1]; cnt2 += 2)
+          for(cnt3 = matrices->k_min_M2[i+1]; cnt3 <= matrices->k_max_M2[i+1]; cnt3++)
+            for(cnt4 = matrices->l_min_M2[i+1][cnt3]; cnt4 <= matrices->l_max_M2[i+1][cnt3]; cnt4 += 2){
+              if(((cnt1 + cnt3 + d1) <= maxD1) && ((cnt2 + cnt4 + d2) <= maxD2)){
+                matrices->E_FcM[cnt1 + cnt3 + d1][(cnt2 + cnt4 + d2)/2] = MIN2(
+                                                                  matrices->E_FcM[cnt1 + cnt3 + d1][(cnt2 + cnt4 + d2)/2],
+                                                                  E_M[my_iindx[1]-i][cnt1][cnt2/2]
+                                                                + matrices->E_M2[i+1][cnt3][cnt4/2]
+                                                                + P->MLclosing
+                                                                    );
+                updatePosteriorBoundaries(cnt1 + cnt3 + d1,
+                                          cnt2 + cnt4 + d2,
+                                          &min_k_real_fcM,
+                                          &max_k_real_fcM,
+                                          &min_l_real_fcM,
+                                          &max_l_real_fcM
+                                        );
+              }
+              else{
+                matrices->E_FcM_rem = MIN2(
+                              matrices->E_FcM_rem,
+                              E_M[my_iindx[1]-i][cnt1][cnt2/2]
+                            + matrices->E_M2[i+1][cnt3][cnt4/2]
+                            + P->MLclosing
+                                  );
+              }
+            }
+    }
+  }
+  /* resize and move memory portions of energy matrix E_FcM */
+  adjustArrayBoundaries(&matrices->E_FcM,
+                        &matrices->k_min_FcM,
+                        &matrices->k_max_FcM,
+                        &matrices->l_min_FcM,
+                        &matrices->l_max_FcM,
+                        min_k_real_fcM,
+                        max_k_real_fcM,
+                        min_l_real_fcM,
+                        max_l_real_fcM
+                      );
+#ifdef _OPENMP
+  }
+  }
+#endif
+
+
+
+  /* compute E_Fc_rem */
+  matrices->E_Fc_rem = MIN2(matrices->E_FcH_rem, matrices->E_FcI_rem);
+  matrices->E_Fc_rem = MIN2(matrices->E_Fc_rem, matrices->E_FcM_rem);
+  /* add the case were structure is unfolded chain */
+  if((referenceBPs1[my_iindx[1]-seq_length] > maxD1) || (referenceBPs2[my_iindx[1]-seq_length] > maxD2))
+    matrices->E_Fc_rem = MIN2(matrices->E_Fc_rem, 0);
+
+
+  /* compute all E_Fc */
+  for(cnt1 = matrices->k_min_FcH; cnt1 <= matrices->k_max_FcH; cnt1++)
+    for(cnt2 = matrices->l_min_FcH[cnt1]; cnt2 <= matrices->l_max_FcH[cnt1]; cnt2 += 2){
+      matrices->E_Fc[cnt1][cnt2/2] = MIN2(matrices->E_Fc[cnt1][cnt2/2],
+                                      matrices->E_FcH[cnt1][cnt2/2]
+                                      );
+      updatePosteriorBoundaries(cnt1,
+                                cnt2,
+                                &min_k_real,
+                                &max_k_real,
+                                &min_l_real,
+                                &max_l_real
+                                );
+    }
+  for(cnt1 = matrices->k_min_FcI; cnt1 <= matrices->k_max_FcI; cnt1++)
+    for(cnt2 = matrices->l_min_FcI[cnt1]; cnt2 <= matrices->l_max_FcI[cnt1]; cnt2 += 2){
+      matrices->E_Fc[cnt1][cnt2/2] = MIN2(matrices->E_Fc[cnt1][cnt2/2],
+                                      matrices->E_FcI[cnt1][cnt2/2]
+                                      );
+      updatePosteriorBoundaries(cnt1,
+                                cnt2,
+                                &min_k_real,
+                                &max_k_real,
+                                &min_l_real,
+                                &max_l_real
+                                );
+    }
+  for(cnt1 = matrices->k_min_FcM; cnt1 <= matrices->k_max_FcM; cnt1++)
+    for(cnt2 = matrices->l_min_FcM[cnt1]; cnt2 <= matrices->l_max_FcM[cnt1]; cnt2 += 2){
+      matrices->E_Fc[cnt1][cnt2/2] = MIN2(matrices->E_Fc[cnt1][cnt2/2],
+                                      matrices->E_FcM[cnt1][cnt2/2]
+                                      );
+      updatePosteriorBoundaries(cnt1,
+                                cnt2,
+                                &min_k_real,
+                                &max_k_real,
+                                &min_l_real,
+                                &max_l_real
+                                );
+    }
+  /* add the case were structure is unfolded chain */
+  matrices->E_Fc[referenceBPs1[my_iindx[1]-seq_length]][referenceBPs2[my_iindx[1]-seq_length]/2] = MIN2(matrices->E_Fc[referenceBPs1[my_iindx[1]-seq_length]][referenceBPs2[my_iindx[1]-seq_length]/2],
+                                                                                                    0);
+  updatePosteriorBoundaries(referenceBPs1[my_iindx[1]-seq_length],
+                            referenceBPs2[my_iindx[1]-seq_length],
+                            &min_k_real,
+                            &max_k_real,
+                            &min_l_real,
+                            &max_l_real
+                            );
+
+
+  adjustArrayBoundaries(&matrices->E_Fc,
+                        &matrices->k_min_Fc,
+                        &matrices->k_max_Fc,
+                        &matrices->l_min_Fc,
+                        &matrices->l_max_Fc,
+                        min_k_real,
+                        max_k_real,
+                        min_l_real,
+                        max_l_real
+                      );
+
+}
+
+
+
+
+PRIVATE void adjustArrayBoundaries(int ***array, int *k_min, int *k_max, int **l_min, int **l_max, int k_min_post, int k_max_post, int *l_min_post, int *l_max_post){
+  int cnt1;
+  int k_diff_pre  = k_min_post - *k_min;
+  int mem_size    = k_max_post - k_min_post + 1;
+
+  if(k_min_post < INF){
+    /* free all the unused memory behind actual data */
+    for(cnt1 = k_max_post + 1; cnt1 <= *k_max; cnt1++){
+      (*array)[cnt1] += (*l_min)[cnt1]/2;
+      free((*array)[cnt1]);
+    }
+
+    /* free unused memory before actual data */
+    for(cnt1 = *k_min; cnt1 < k_min_post; cnt1++){
+      (*array)[cnt1] += (*l_min)[cnt1]/2;
+      free((*array)[cnt1]);
+    }
+    /* move data to front and thereby eliminating unused memory in front of actual data */
+    if(k_diff_pre > 0){
+      memmove((int **)(*array),((int **)(*array)) + k_diff_pre, sizeof(int *) * mem_size);
+      memmove((int *) (*l_min),((int *) (*l_min)) + k_diff_pre, sizeof(int)   * mem_size);
+      memmove((int *) (*l_max),((int *) (*l_max)) + k_diff_pre, sizeof(int)   * mem_size);
+    }
+
+    /* reallocating memory to actual size used */
+    *array  += *k_min;
+    *array = (int **)realloc(*array, sizeof(int *) * mem_size);
+    *array -= k_min_post;
+
+    *l_min  += *k_min;
+    *l_min = (int *)realloc(*l_min, sizeof(int) * mem_size);
+    *l_min -= k_min_post;
+
+    *l_max  += *k_min;
+    *l_max = (int *)realloc(*l_max, sizeof(int) * mem_size);
+    *l_max -= k_min_post;
+
+    /* adjust l dimension of array */
+    for(cnt1 = k_min_post; cnt1 <= k_max_post; cnt1++){
+      if(l_min_post[cnt1] < INF){
+        /* new memsize */
+        mem_size        = (l_max_post[cnt1] - l_min_post[cnt1] + 1)/2 + 1;
+        /* reshift the pointer */
+        (*array)[cnt1]  += (*l_min)[cnt1]/2;
+
+        int shift       = (l_min_post[cnt1]%2 == (*l_min)[cnt1]%2) ? 0 : 1;
+        /* eliminate unused memory in front of actual data */
+        unsigned int    start = (l_min_post[cnt1] - (*l_min)[cnt1])/2 + shift;
+        if(start > 0)
+          memmove((int *)((*array)[cnt1]), (int *)((*array)[cnt1])+start, sizeof(int) * mem_size);
+        (*array)[cnt1]  = (int *) realloc((*array)[cnt1], sizeof(int) * mem_size);
+
+        (*array)[cnt1]  -= l_min_post[cnt1]/2;
+      }
+      else{
+        /* free according memory */
+        (*array)[cnt1] += (*l_min)[cnt1]/2;
+        free((*array)[cnt1]);
+      }
+
+      (*l_min)[cnt1] = l_min_post[cnt1];
+      (*l_max)[cnt1] = l_max_post[cnt1];
+    }
+  }
+  else{
+    /* we have to free all unused memory */
+    for(cnt1 = *k_min; cnt1 <= *k_max; cnt1++){
+      (*array)[cnt1] += (*l_min)[cnt1]/2;
+      free((*array)[cnt1]);
+    }
+    (*l_min) += *k_min;
+    (*l_max) += *k_min;
+    free(*l_min);
+    free(*l_max);
+    (*array) += *k_min;
+    free(*array);
+    *array = NULL;
+  }
+
+  l_min_post  += *k_min;
+  l_max_post  += *k_min;
+  free(l_min_post);
+  free(l_max_post);
+  *k_min      = k_min_post;
+  *k_max      = k_max_post;
+}
+
+PRIVATE INLINE void preparePosteriorBoundaries(int size, int shift, int *min_k, int *max_k, int **min_l, int **max_l){
+  int i;
+  *min_k  = INF;
+  *max_k  = 0;
+
+  *min_l  = (int *)vrna_alloc(sizeof(int) * size);
+  *max_l  = (int *)vrna_alloc(sizeof(int) * size);
+
+  for(i = 0; i < size; i++){
+    (*min_l)[i] = INF;
+    (*max_l)[i] = 0;
+  }
+
+  *min_l  -= shift;
+  *max_l  -= shift;
+}
+
+PRIVATE INLINE void updatePosteriorBoundaries(int d1, int d2, int *min_k, int *max_k, int **min_l, int **max_l){
+  (*min_l)[d1]  = MIN2((*min_l)[d1], d2);
+  (*max_l)[d1]  = MAX2((*max_l)[d1], d2);
+  *min_k        = MIN2(*min_k, d1);
+  *max_k        = MAX2(*max_k, d1);
+}
+
+INLINE  PRIVATE void  prepareBoundaries(int min_k_pre, int max_k_pre, int min_l_pre, int max_l_pre, int bpdist, int *min_k, int *max_k, int **min_l, int **max_l){
+  int cnt;
+  int mem = max_k_pre - min_k_pre + 1;
+
+  *min_k  = min_k_pre;
+  *max_k  = max_k_pre;
+  *min_l  = (int *) vrna_alloc(sizeof(int) * mem);
+  *max_l  = (int *) vrna_alloc(sizeof(int) * mem);
+
+  *min_l  -= min_k_pre;
+  *max_l  -= min_k_pre;
+
+  /* for each k guess the according minimum l*/
+  for(cnt = min_k_pre; cnt <= max_k_pre; cnt++){
+    (*min_l)[cnt] = min_l_pre;
+    (*max_l)[cnt] = max_l_pre;
+    while((*min_l)[cnt] + cnt < bpdist) (*min_l)[cnt]++;
+    if((bpdist % 2) != (((*min_l)[cnt] + cnt) % 2)) (*min_l)[cnt]++;
+  }
+}
+
+INLINE  PRIVATE void  prepareArray(int ***array, int min_k, int max_k, int *min_l, int *max_l){
+  int i, j, mem;
+  *array  = (int **)vrna_alloc(sizeof(int *) * (max_k - min_k + 1));
+  *array  -= min_k;
+
+  for(i = min_k; i <= max_k; i++){
+    mem = (max_l[i] - min_l[i] + 1)/2 + 1;
+    (*array)[i] = (int *)vrna_alloc(sizeof(int) * mem);
+    for(j = 0; j < mem; j++)
+      (*array)[i][j] = INF;
+    (*array)[i]  -= min_l[i]/2;
+  }
+}
+
+INLINE  PRIVATE void  prepareArray2(unsigned long ***array, int min_k, int max_k, int *min_l, int *max_l){
+  int i, mem;
+  *array  = (unsigned long **)vrna_alloc(sizeof(unsigned long *) * (max_k - min_k + 1));
+  *array  -= min_k;
+
+  for(i = min_k; i <= max_k; i++){
+    mem = (max_l[i] - min_l[i] + 1)/2 + 1;
+    (*array)[i] = (unsigned long *)vrna_alloc(sizeof(unsigned long) * mem);
+    (*array)[i] -= min_l[i]/2;
+  }
+}
+
+/*
+#################################
+# OLD API support               #
+#################################
+*/
+
+/* crosslink data from vars->compatibility to TwoDfold_vars structure */
+PRIVATE INLINE void
+crosslink(TwoDfold_vars *vars){
+
+  vrna_fold_compound_t  *c;
+  vrna_mx_mfe_t       *m;
+
+  c                     = vars->compatibility;
+  m                     = c->matrices;
+  vars->sequence        = c->sequence;
+  vars->seq_length      = c->length;
+  vars->reference_pt1   = c->reference_pt1;
+  vars->reference_pt2   = c->reference_pt2;
+  vars->referenceBPs1   = c->referenceBPs1;
+  vars->referenceBPs2   = c->referenceBPs2;
+  vars->bpdist          = c->bpdist;
+  vars->do_backtrack    = 1;
+  vars->dangles         = c->params->model_details.dangles;
+  vars->circ            = c->params->model_details.circ;
+  vars->temperature     = c->params->model_details.temperature;
+  vars->ptype           = c->ptype_pf_compat;
+  vars->P               = c->params;
+  vars->S               = c->sequence_encoding2;
+  vars->S1              = c->sequence_encoding;
+  vars->my_iindx        = c->iindx;
+  vars->mm1             = c->mm1;
+  vars->mm2             = c->mm2;
+  vars->maxD1           = c->maxD1;
+  vars->maxD2           = c->maxD2;
+
+  vars->E_C              = m->E_C;
+  vars->l_min_values     = m->l_min_C;
+  vars->l_max_values     = m->l_max_C;
+  vars->k_min_values     = m->k_min_C;
+  vars->k_max_values     = m->k_max_C;
+
+  vars->E_F5             = m->E_F5;
+  vars->l_min_values_f   = m->l_min_F5;
+  vars->l_max_values_f   = m->l_max_F5;
+  vars->k_min_values_f   = m->k_min_F5;
+  vars->k_max_values_f   = m->k_max_F5;
+
+  vars->E_F3             = m->E_F3;
+  vars->l_min_values_f3  = m->l_min_F3;
+  vars->l_max_values_f3  = m->l_max_F3;
+  vars->k_min_values_f3  = m->k_min_F3;
+  vars->k_max_values_f3  = m->k_max_F3;
+
+  vars->E_M              = m->E_M;
+  vars->l_min_values_m   = m->l_min_M;
+  vars->l_max_values_m   = m->l_max_M;
+  vars->k_min_values_m   = m->k_min_M;
+  vars->k_max_values_m   = m->k_max_M;
+
+  vars->E_M1             = m->E_M1;
+  vars->l_min_values_m1  = m->l_min_M1;
+  vars->l_max_values_m1  = m->l_max_M1;
+  vars->k_min_values_m1  = m->k_min_M1;
+  vars->k_max_values_m1  = m->k_max_M1;
+
+#ifdef COUNT_STATES
+  vars->N_C              = m->N_C;
+  vars->N_F5             = m->N_F5;
+  vars->N_M              = m->N_M;
+  vars->N_M1             = m->N_M1;
+#endif
+
+  vars->E_M2_rem        = m->E_M2_rem;
+  vars->E_M2            = m->E_M2;
+  vars->l_min_values_m2 = m->l_min_M2;
+  vars->l_max_values_m2 = m->l_max_M2;
+  vars->k_min_values_m2 = m->k_min_M2;
+  vars->k_max_values_m2 = m->k_max_M2;
+
+  vars->E_Fc              = m->E_Fc;
+  vars->E_FcH             = m->E_FcH;
+  vars->E_FcI             = m->E_FcI;
+  vars->E_FcM             = m->E_FcM;
+
+  vars->E_Fc_rem         = m->E_Fc_rem;
+  vars->E_FcH_rem        = m->E_FcH_rem;
+  vars->E_FcI_rem        = m->E_FcI_rem;
+  vars->E_FcM_rem        = m->E_FcM_rem;
+
+  vars->E_C_rem          = m->E_C_rem;
+  vars->E_M_rem          = m->E_M_rem;
+  vars->E_M1_rem         = m->E_M1_rem;
+  vars->E_F5_rem         = m->E_F5_rem;
+}
+
+
+PUBLIC TwoDfold_vars *
+get_TwoDfold_variables( const char *seq,
+                        const char *structure1,
+                        const char *structure2,
+                        int circ){
+
+  vrna_md_t           md;
+  TwoDfold_vars       *vars;
+  vrna_fold_compound_t  *c;
+  vrna_mx_mfe_t       *m;
+
+  set_model_details(&md);
+  md.circ = circ;
+
+  vars = (TwoDfold_vars *)vrna_alloc(sizeof(TwoDfold_vars));
+  vars->compatibility = vrna_fold_compound_TwoD(seq, structure1, structure2, &md, VRNA_OPTION_MFE);
+
+  crosslink(vars);
+
+  return vars;
+}
+
+PUBLIC char *
+TwoDfold_backtrack_f5(unsigned int j,
+                      int k,
+                      int l,
+                      TwoDfold_vars *vars){
+
+  return vrna_backtrack5_TwoD(vars->compatibility, k, l, j);
+}
+
+PUBLIC void
+destroy_TwoDfold_variables(TwoDfold_vars *vars){
+
+  if(vars == NULL) return;
+
+  vrna_fold_compound_free(vars->compatibility);
+
+  free(vars);
+}
+
+PUBLIC vrna_sol_TwoD_t *
+TwoDfoldList( TwoDfold_vars *vars,
+              int distance1,
+              int distance2){
+
+  vrna_sol_TwoD_t *sol;
+
+  sol = vrna_mfe_TwoD(vars->compatibility, distance1, distance2);
+
+  crosslink(vars);
+
+  return sol;
+}
+
+PUBLIC void
+update_TwoDfold_params(TwoDfold_vars *vars){
+
+  vrna_md_t md;
+
+  set_model_details(&md);
+
+  free(vars->compatibility->params);
+  vars->compatibility->params = vrna_params(&md);
+
+  crosslink(vars);
+}
+
diff --git a/C/ViennaRNA/2Dfold.h b/C/ViennaRNA/2Dfold.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/2Dfold.h
@@ -0,0 +1,347 @@
+#ifndef VIENNA_RNA_PACKAGE_TWO_D_FOLD_H
+#define VIENNA_RNA_PACKAGE_TWO_D_FOLD_H
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file 2Dfold.h
+ *  @ingroup kl_neighborhood
+ *  @brief MFE structures for base pair distance classes
+ *
+ */
+
+/**
+ *  @addtogroup kl_neighborhood_mfe
+ *  @brief Compute the minimum free energy (MFE) and secondary structures for a partitioning of
+ *  the secondary structure space according to the base pair distance to two fixed reference structures
+ *  basepair distance to two fixed reference structures
+ *  @see For further details, we refer to Lorenz et al. 2009 @cite lorenz:2009
+ *
+ *  @{
+ *  @ingroup  kl_neighborhood_mfe
+ *
+ */
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+
+/**
+ *  @brief Solution element returned from vrna_mfe_TwoD()
+ *
+ *  This element contains free energy and structure for the appropriate
+ *  kappa (k), lambda (l) neighborhood
+ *  The datastructure contains two integer attributes 'k' and 'l'
+ *  as well as an attribute 'en' of type float representing the free energy
+ *  in kcal/mol and an attribute 's' of type char* containg the secondary
+ *  structure representative,
+ *
+ *  A value of #INF in k denotes the end of a list
+ *
+ *  @see  vrna_mfe_TwoD()
+ */
+typedef struct vrna_sol_TwoD_t{
+  int k;          /**<  @brief  Distance to first reference */
+  int l;          /**<  @brief  Distance to second reference */
+  float en;       /**<  @brief  Free energy in kcal/mol */
+  char *s;        /**<  @brief  MFE representative structure in dot-bracket notation */
+} vrna_sol_TwoD_t;
+
+
+
+/**
+ * @brief Compute MFE's and representative for distance partitioning
+ *
+ * This function computes the minimum free energies and a representative
+ * secondary structure for each distance class according to the two references
+ * specified in the datastructure 'vars'.
+ * The maximum basepair distance to each of both references may be set
+ * by the arguments 'distance1' and 'distance2', respectively.
+ * If both distance arguments are set to '-1', no restriction is assumed and
+ * the calculation is performed for each distance class possible.
+ *
+ * The returned list contains an entry for each distance class. If a maximum
+ * basepair distance to either of the references was passed, an entry with
+ * k=l=-1 will be appended in the list, denoting the class where all structures
+ * exceeding the maximum will be thrown into.
+ * The end of the list is denoted by an attribute value of #INF in
+ * the k-attribute of the list entry.
+ *
+ *  @see  vrna_fold_compound_TwoD(), vrna_fold_compound_free(), vrna_pf_TwoD()
+ *        vrna_backtrack5_TwoD(), #vrna_sol_TwoD_t, #vrna_fold_compound_t
+ *
+ *  @param vc         The datastructure containing all precomputed folding attributes
+ *  @param distance1  maximum distance to reference1 (-1 means no restriction)
+ *  @param distance2  maximum distance to reference2 (-1 means no restriction)
+ *  @return           A list of minimum free energies (and corresponding structures)
+ *                    for each distance class
+ */
+vrna_sol_TwoD_t *
+vrna_mfe_TwoD(vrna_fold_compound_t *vc,
+              int distance1,
+              int distance2);
+
+/**
+ * @brief Backtrack a minimum free energy structure from a 5' section of specified length
+ *
+ * This function allows one to backtrack a secondary structure beginning at the 5' end, a specified
+ * length and residing in a specific distance class.
+ * If the argument 'k' gets a value of -1, the structure that is backtracked is assumed to
+ * reside in the distance class where all structures exceeding the maximum basepair distance
+ * specified in vrna_mfe_TwoD() belong to.
+ * @note The argument 'vars' must contain precalculated energy values in the energy matrices,
+ * i.e. a call to vrna_mfe_TwoD() preceding this function is mandatory!
+ *
+ * @see vrna_mfe_TwoD()
+ *
+ * @param vc    The datastructure containing all precomputed folding attributes
+ * @param j     The length in nucleotides beginning from the 5' end
+ * @param k     distance to reference1 (may be -1)
+ * @param l     distance to reference2
+ */
+char *
+vrna_backtrack5_TwoD( vrna_fold_compound_t *vc,
+                      int k,
+                      int l,
+                      unsigned int j);
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+#define TwoDfold_solution       vrna_sol_TwoD_t         /* restore compatibility of struct rename */
+
+/**
+ *  @brief Variables compound for 2Dfold MFE folding
+ *
+ *  @deprecated This data structure will be removed from the library soon!
+ *              Use #vrna_fold_compound_t and the corresponding functions vrna_fold_compound_TwoD(),
+ *              vrna_mfe_TwoD(), and vrna_fold_compound_free() instead!
+ */
+typedef struct TwoDfold_vars{
+  vrna_param_t    *P;             /**<  @brief  Precomputed energy parameters and model details */
+  int             do_backtrack;   /**<  @brief  Flag whether to do backtracing of the structure(s) or not */
+  char            *ptype;         /**<  @brief  Precomputed array of pair types */
+  char            *sequence;      /**<  @brief  The input sequence  */
+  short           *S, *S1;        /**<  @brief  The input sequences in numeric form */
+  unsigned int    maxD1;          /**<  @brief  Maximum allowed base pair distance to first reference */
+  unsigned int    maxD2;          /**<  @brief  Maximum allowed base pair distance to second reference */
+
+
+  unsigned int    *mm1;           /**<  @brief  Maximum matching matrix, reference struct 1 disallowed */
+  unsigned int    *mm2;           /**<  @brief  Maximum matching matrix, reference struct 2 disallowed */
+
+  int             *my_iindx;      /**<  @brief  Index for moving in quadratic distancy dimensions */
+
+  double          temperature;
+
+  unsigned int    *referenceBPs1; /**<  @brief  Matrix containing number of basepairs of reference structure1 in interval [i,j] */
+  unsigned int    *referenceBPs2; /**<  @brief  Matrix containing number of basepairs of reference structure2 in interval [i,j] */
+  unsigned int    *bpdist;        /**<  @brief  Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j] */
+
+  short           *reference_pt1;
+  short           *reference_pt2;
+  int             circ;
+  int             dangles;
+  unsigned int    seq_length;
+
+  int             ***E_F5;
+  int             ***E_F3;
+  int             ***E_C;
+  int             ***E_M;
+  int             ***E_M1;
+  int             ***E_M2;
+
+  int             **E_Fc;
+  int             **E_FcH;
+  int             **E_FcI;
+  int             **E_FcM;
+
+  int             **l_min_values;
+  int             **l_max_values;
+  int             *k_min_values;
+  int             *k_max_values;
+
+  int             **l_min_values_m;
+  int             **l_max_values_m;
+  int             *k_min_values_m;
+  int             *k_max_values_m;
+
+  int             **l_min_values_m1;
+  int             **l_max_values_m1;
+  int             *k_min_values_m1;
+  int             *k_max_values_m1;
+
+  int             **l_min_values_f;
+  int             **l_max_values_f;
+  int             *k_min_values_f;
+  int             *k_max_values_f;
+
+  int             **l_min_values_f3;
+  int             **l_max_values_f3;
+  int             *k_min_values_f3;
+  int             *k_max_values_f3;
+
+  int             **l_min_values_m2;
+  int             **l_max_values_m2;
+  int             *k_min_values_m2;
+  int             *k_max_values_m2;
+
+  int             *l_min_values_fc;
+  int             *l_max_values_fc;
+  int             k_min_values_fc;
+  int             k_max_values_fc;
+
+  int             *l_min_values_fcH;
+  int             *l_max_values_fcH;
+  int             k_min_values_fcH;
+  int             k_max_values_fcH;
+
+  int             *l_min_values_fcI;
+  int             *l_max_values_fcI;
+  int             k_min_values_fcI;
+  int             k_max_values_fcI;
+
+  int             *l_min_values_fcM;
+  int             *l_max_values_fcM;
+  int             k_min_values_fcM;
+  int             k_max_values_fcM;
+
+  /* auxilary arrays for remaining set of coarse graining (k,l) > (k_max, l_max) */
+  int             *E_F5_rem;
+  int             *E_F3_rem;
+  int             *E_C_rem;
+  int             *E_M_rem;
+  int             *E_M1_rem;
+  int             *E_M2_rem;
+
+  int             E_Fc_rem;
+  int             E_FcH_rem;
+  int             E_FcI_rem;
+  int             E_FcM_rem;
+
+#ifdef COUNT_STATES
+  unsigned long             ***N_F5;
+  unsigned long             ***N_C;
+  unsigned long             ***N_M;
+  unsigned long             ***N_M1;
+#endif
+
+  vrna_fold_compound_t *compatibility;
+} TwoDfold_vars;
+
+/**
+ *  @brief Get a structure of type TwoDfold_vars prefilled with current global settings
+ * 
+ *  This function returns a datastructure of type TwoDfold_vars.
+ *  The data fields inside the TwoDfold_vars are prefilled by global settings and all memory
+ *  allocations necessary to start a computation are already done for the convenience of the user
+ * 
+ *  @note Make sure that the reference structures are compatible with the sequence according to Watson-Crick- and Wobble-base pairing
+ * 
+ *  @deprecated Use the new API that relies on #vrna_fold_compound_t and the corresponding functions
+ *              vrna_fold_compound_TwoD(), vrna_mfe_TwoD(), and vrna_fold_compound_free() instead!
+ *
+ *  @param seq          The RNA sequence
+ *  @param structure1   The first reference structure in dot-bracket notation
+ *  @param structure2   The second reference structure in dot-bracket notation
+ *  @param circ         A switch to indicate the assumption to fold a circular instead of linear RNA (0=OFF, 1=ON)
+ *  @returns            A datastructure prefilled with folding options and allocated memory
+ */
+DEPRECATED(TwoDfold_vars *
+get_TwoDfold_variables( const char *seq,
+                        const char *structure1,
+                        const char *structure2,
+                        int circ));
+
+/**
+ *  @brief Destroy a TwoDfold_vars datastructure without memory loss
+ * 
+ *  This function free's all allocated memory that depends on the datastructure given.
+ * 
+ *  @deprecated Use the new API that relies on #vrna_fold_compound_t and the corresponding functions
+ *              vrna_fold_compound_TwoD(), vrna_mfe_TwoD(), and vrna_fold_compound_free() instead!
+ *
+ *  @param our_variables  A pointer to the datastructure to be destroyed
+ */
+DEPRECATED(void 
+destroy_TwoDfold_variables(TwoDfold_vars *our_variables));
+
+/**
+ * @brief Compute MFE's and representative for distance partitioning
+ *
+ * This function computes the minimum free energies and a representative
+ * secondary structure for each distance class according to the two references
+ * specified in the datastructure 'vars'.
+ * The maximum basepair distance to each of both references may be set
+ * by the arguments 'distance1' and 'distance2', respectively.
+ * If both distance arguments are set to '-1', no restriction is assumed and
+ * the calculation is performed for each distance class possible.
+ *
+ * The returned list contains an entry for each distance class. If a maximum
+ * basepair distance to either of the references was passed, an entry with
+ * k=l=-1 will be appended in the list, denoting the class where all structures
+ * exceeding the maximum will be thrown into.
+ * The end of the list is denoted by an attribute value of #INF in
+ * the k-attribute of the list entry.
+ *
+ *  @deprecated Use the new API that relies on #vrna_fold_compound_t and the corresponding functions
+ *              vrna_fold_compound_TwoD(), vrna_mfe_TwoD(), and vrna_fold_compound_free() instead!
+ *
+ * @param vars      the datastructure containing all predefined folding attributes
+ * @param distance1 maximum distance to reference1 (-1 means no restriction)
+ * @param distance2 maximum distance to reference2 (-1 means no restriction)
+ */
+DEPRECATED(TwoDfold_solution *
+TwoDfoldList( TwoDfold_vars *vars,
+              int distance1,
+              int distance2));
+
+/**
+ * @brief Backtrack a minimum free energy structure from a 5' section of specified length
+ *
+ * This function allows one to backtrack a secondary structure beginning at the 5' end, a specified
+ * length and residing in a specific distance class.
+ * If the argument 'k' gets a value of -1, the structure that is backtracked is assumed to
+ * reside in the distance class where all structures exceeding the maximum basepair distance
+ * specified in TwoDfold() belong to.
+ * @note The argument 'vars' must contain precalculated energy values in the energy matrices,
+ * i.e. a call to TwoDfold() preceding this function is mandatory!
+ *
+ *  @deprecated Use the new API that relies on #vrna_fold_compound_t and the corresponding functions
+ *              vrna_fold_compound_TwoD(), vrna_mfe_TwoD(), vrna_backtrack5_TwoD(), and
+ *              vrna_fold_compound_free() instead!
+ *
+ * @param j     The length in nucleotides beginning from the 5' end
+ * @param k     distance to reference1 (may be -1)
+ * @param l     distance to reference2
+ * @param vars  the datastructure containing all predefined folding attributes
+ */
+DEPRECATED(char *TwoDfold_backtrack_f5(unsigned int j,
+                            int k,
+                            int l,
+                            TwoDfold_vars *vars));
+
+/**
+ * 
+ */
+DEPRECATED(TwoDfold_solution **TwoDfold(TwoDfold_vars *our_variables,
+                                        int distance1,
+                                        int distance2));
+
+
+#endif
+
+/**
+ *  @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/2Dpfold.c b/C/ViennaRNA/2Dpfold.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/2Dpfold.c
@@ -0,0 +1,4029 @@
+/*
+      minimum free energy
+      RNA secondary structure with
+      basepair distance d_1 to reference structure 1 and distance d_2 to reference structure 2
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <float.h>    /* #defines FLT_MAX ... */
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/2Dpfold.h"
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE void  crosslink(TwoDpfold_vars *vars);
+
+PRIVATE         void  pf2D_linear(vrna_fold_compound_t *vc);
+PRIVATE         void  pf2D_circ(vrna_fold_compound_t *vc);
+PRIVATE         char  *pbacktrack_circ( vrna_fold_compound_t *vc,
+                                        int d1,
+                                        int d2);
+
+PRIVATE         void  backtrack(vrna_fold_compound_t *vc,
+                                char *pstruc,
+                                int d1,
+                                int d2,
+                                unsigned int i,
+                                unsigned int j);
+PRIVATE         void  backtrack_qm( vrna_fold_compound_t *vc,
+                                    char *pstruc,
+                                    int d1,
+                                    int d2,
+                                    unsigned int i,
+                                    unsigned int j);
+PRIVATE         void  backtrack_qm1(vrna_fold_compound_t *vc,
+                                    char *pstruc,
+                                    int d1,
+                                    int d2,
+                                    unsigned int i,
+                                    unsigned int j);
+PRIVATE         void  backtrack_qm2(vrna_fold_compound_t *vc,
+                                    char *pstruc,
+                                    int d1,
+                                    int d2,
+                                    unsigned int k);
+PRIVATE         void  backtrack_qcH(vrna_fold_compound_t *vc,
+                                    char *pstruc,
+                                    int d1,
+                                    int d2);
+PRIVATE         void  backtrack_qcI(vrna_fold_compound_t *vc,
+                                    char *pstruc,
+                                    int d1,
+                                    int d2);
+PRIVATE         void  backtrack_qcM(vrna_fold_compound_t *vc,
+                                    char *pstruc,
+                                    int d1,
+                                    int d2);
+
+PRIVATE         void  adjustArrayBoundaries(
+                        FLT_OR_DBL ***array,
+                        int *k_min, int *k_max,
+                        int **l_min, int **l_max,
+                        int k_min_real, int k_max_real,
+                        int *l_min_real, int *l_max_real);
+
+INLINE  PRIVATE void  preparePosteriorBoundaries(
+                        int size, int shift,
+                        int *min_k, int *max_k,
+                        int **min_l, int **max_l);
+INLINE  PRIVATE void  updatePosteriorBoundaries(
+                        int d1, int d2,
+                        int *min_k, int *max_k,
+                        int **min_l, int **max_l);
+INLINE  PRIVATE void  prepareBoundaries(
+                        int min_k_pre, int max_k_pre,
+                        int min_l_pre, int max_l_pre,
+                        int bpdist,
+                        int *min_k, int *max_k,
+                        int **min_l, int **max_l);
+INLINE  PRIVATE void  prepareArray(
+                        FLT_OR_DBL ***array,
+                        int min_k, int max_k,
+                        int *min_l, int *max_l);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC vrna_sol_TwoD_pf_t *
+vrna_pf_TwoD( vrna_fold_compound_t *vc,
+                int distance1,
+                int distance2){
+
+  unsigned int  maxD1 = 0, maxD2 = 0, counter = 0;
+  int           cnt1, cnt2, k_min, k_max, l_min, l_max, ndx;
+  FLT_OR_DBL    q = 0.;
+
+  vrna_sol_TwoD_pf_t  *output;
+  vrna_md_t           *md;
+  vrna_mx_pf_t        *matrices;
+
+  maxD1     = vc->maxD1;
+  maxD2     = vc->maxD2;
+  matrices  = vc->exp_matrices;
+  md        = &(vc->exp_params->model_details);
+
+  if(distance1 >= 0){
+    if((unsigned int)distance1 > maxD1)
+      vrna_message_warning("vrna_pf_TwoD@2Dpfold.c: limiting maximum basepair distance 1 to %u\n",
+                                  maxD1);
+    else
+      maxD1 = (unsigned int)distance1;
+  }
+
+  if(distance2 >= 0){
+    if((unsigned int)distance2 > maxD2)
+      vrna_message_warning("vrna_pf_TwoD@2Dpfold.c: limiting maximum basepair distance 2 to %u\n",
+                                  maxD2);
+    else
+      maxD2 = (unsigned int)distance2;
+  }
+
+  vc->maxD1 = maxD1;
+  vc->maxD2 = maxD2;
+
+  output = (vrna_sol_TwoD_pf_t *)vrna_alloc((((maxD1+1)*(maxD2+2))/2 + 2) * sizeof(vrna_sol_TwoD_pf_t));
+
+  pf2D_linear(vc);
+  if(md->circ) pf2D_circ(vc);
+
+  ndx   = vc->iindx[1] - vc->length;
+  k_min = (md->circ) ? matrices->k_min_Q_c: matrices->k_min_Q[ndx];
+  k_max = (md->circ) ? matrices->k_max_Q_c: matrices->k_max_Q[ndx];
+
+  for(cnt1 =  k_min;
+      cnt1 <= k_max;
+      cnt1++){
+    l_min = (md->circ) ? matrices->l_min_Q_c[cnt1] : matrices->l_min_Q[ndx][cnt1];
+    l_max = (md->circ) ? matrices->l_max_Q_c[cnt1] : matrices->l_max_Q[ndx][cnt1];
+    for(cnt2 =  l_min;
+        cnt2 <= l_max;
+        cnt2 += 2){
+      q = (md->circ) ? matrices->Q_c[cnt1][cnt2/2] : matrices->Q[ndx][cnt1][cnt2/2];
+      if(q == 0.) continue;
+      output[counter].k = cnt1;
+      output[counter].l = cnt2;
+      output[counter].q = q;
+      counter++;
+    }
+  }
+
+  /* store entry for remaining partition if it exists */
+  q = (md->circ) ? matrices->Q_c_rem : matrices->Q_rem[ndx];
+  if(q != 0.){
+    output[counter].k = -1;
+    output[counter].l = -1;
+    output[counter].q = q;
+    counter++;
+  }
+
+  /* insert end-marker entry */
+  output[counter].k = output[counter].l = INF;
+  counter++;
+
+  /* resize to actual dataset amount */
+  output = (vrna_sol_TwoD_pf_t *)vrna_realloc(output, sizeof(vrna_sol_TwoD_pf_t) * counter);
+  return output;
+}
+
+#if 0
+PUBLIC FLT_OR_DBL **TwoDpfold(TwoDpfold_vars *vars, int distance1, int distance2){
+  unsigned int  i;
+  unsigned int  maxD1 = 0;
+  unsigned int  maxD2 = 0;
+  unsigned int  mm;
+  int           cnt1, cnt2;
+
+  FLT_OR_DBL **output;
+
+  initialize_TwoDpfold_vars(vars);
+
+  vars->S   = encode_sequence(vars->sequence, 0);
+  vars->S1  = encode_sequence(vars->sequence, 1);
+  make_ptypes2(vars);
+
+  for(i=1; i<=(unsigned int)vars->reference_pt1[0]; i++)
+    if(i < (unsigned int)vars->reference_pt1[i]) maxD1++;
+  for(i=1; i<=(unsigned int)vars->reference_pt2[0]; i++)
+    if(i < (unsigned int)vars->reference_pt2[i]) maxD2++;
+  mm    = maximumMatching(vars->sequence);
+  maxD1 += mm;
+  maxD2 += mm;
+
+  if(distance1 >= 0){
+    if((unsigned int)distance1 > maxD1)
+      fprintf(stderr, "limiting maximum basepair distance 1 to %u\n", maxD1);
+    maxD1 = (unsigned int)distance1;
+  }
+
+  if(distance2 >= 0){
+    if((unsigned int)distance2 > maxD2)
+      fprintf(stderr, "limiting maximum basepair distance 2 to %u\n", maxD2);
+    maxD2 = (unsigned int)distance2;
+  }
+  vars->maxD1 = maxD1;
+  vars->maxD2 = maxD2;
+
+
+  output = (FLT_OR_DBL **) vrna_alloc(sizeof(FLT_OR_DBL*) * (maxD1+1));
+  pf2D_linear(vars);
+  int ndx = vars->my_iindx[1] - vars->seq_length;
+  for(cnt1 = vars->k_min_values[ndx]; cnt1 <= MIN2(vars->k_max_values[ndx], vars->maxD1); cnt1++){
+    output[cnt1] = (FLT_OR_DBL *)vrna_alloc((vars->maxD2+1)*sizeof(FLT_OR_DBL));
+    for(cnt2 = vars->l_min_values[ndx][cnt1]; cnt2 <= MIN2(vars->l_max_values[ndx][cnt1], vars->maxD2); cnt2+=2){
+      output[cnt1][cnt2] = vars->Q[ndx][cnt1][cnt2/2];
+    }
+  }
+  return output;
+}
+
+PUBLIC FLT_OR_DBL **TwoDpfold_circ(TwoDpfold_vars *vars, int distance1, int distance2){
+  unsigned int i;
+  unsigned int maxD1 = 0;
+  unsigned int maxD2 = 0;
+  unsigned int mm;
+  int           cnt1, cnt2;
+  FLT_OR_DBL **output;
+
+  initialize_TwoDpfold_vars(vars);
+
+  vars->S   = encode_sequence(vars->sequence, 0);
+  vars->S1  = encode_sequence(vars->sequence, 1);
+  make_ptypes2(vars);
+
+  for(i=1; i<=(unsigned int)vars->reference_pt1[0]; i++)
+    if(i < (unsigned int)vars->reference_pt1[i]) maxD1++;
+  for(i=1; i<=(unsigned int)vars->reference_pt2[0]; i++)
+    if(i < (unsigned int)vars->reference_pt2[i]) maxD2++;
+  mm = maximumMatching(vars->sequence);
+  maxD1 += mm;
+  maxD2 += mm;
+
+  if(distance1 >= 0){
+    if((unsigned int)distance1 > maxD1)
+      fprintf(stderr, "limiting maximum basepair distance 1 to %u\n", maxD1);
+    maxD1 = (unsigned int)distance1;
+  }
+
+  if(distance2 >= 0){
+    if((unsigned int)distance2 > maxD2)
+      fprintf(stderr, "limiting maximum basepair distance 2 to %u\n", maxD2);
+    maxD2 = (unsigned int)distance2;
+  }
+  vars->maxD1 = maxD1;
+  vars->maxD2 = maxD2;
+
+  output = (FLT_OR_DBL **) vrna_alloc(sizeof(FLT_OR_DBL*) * (maxD1+1));
+  pf2D_linear(vars);
+  pf2D_circ(vars);
+
+  for(cnt1 = vars->k_min_values_qc; cnt1 <= MIN2(vars->k_max_values_qc, vars->maxD1); cnt1++){
+    output[cnt1] = (FLT_OR_DBL *)vrna_alloc((vars->maxD2+1)*sizeof(FLT_OR_DBL));
+    for(cnt2 = vars->l_min_values_qc[cnt1]; cnt2 <= MIN2(vars->l_max_values_qc[cnt1], vars->maxD2); cnt2+=2){
+      output[cnt1][cnt2] = vars->Q_c[cnt1][cnt2/2];
+    }
+  }
+  return output;
+}
+
+#endif
+
+PRIVATE void
+pf2D_linear(vrna_fold_compound_t *vc){
+
+  char          *sequence, *ptype;
+  short         *S1, *reference_pt1, *reference_pt2;
+  unsigned int  *referenceBPs1, *referenceBPs2,
+                d, i, j, ij, seq_length, maxD1,
+                maxD2, *mm1, *mm2, *bpdist;
+  int           *my_iindx, *jindx, circ, cnt1, cnt2, cnt3, cnt4, *rtype;
+  double        max_real;
+  FLT_OR_DBL    *scale, Qmax;
+  vrna_exp_param_t  *pf_params;
+  vrna_mx_pf_t      *matrices;
+  vrna_md_t         *md;
+
+  max_real = (sizeof(FLT_OR_DBL) == sizeof(float)) ? FLT_MAX : DBL_MAX;
+
+  pf_params     = vc->exp_params;
+  md            = &(pf_params->model_details);
+  matrices      = vc->exp_matrices;
+  sequence      = vc->sequence;
+  seq_length    = vc->length;
+  maxD1         = vc->maxD1;
+  maxD2         = vc->maxD2;
+  S1            = vc->sequence_encoding;
+  ptype         = vc->ptype;
+  rtype         = &(md->rtype[0]);
+  scale         = matrices->scale;
+  reference_pt1 = vc->reference_pt1;
+  reference_pt2 = vc->reference_pt2;
+  my_iindx      = vc->iindx;
+  jindx         = vc->jindx;
+  referenceBPs1 = vc->referenceBPs1;
+  referenceBPs2 = vc->referenceBPs2;
+  dangles       = md->dangles;
+  circ          = md->circ;
+  mm1           = vc->mm1;
+  mm2           = vc->mm2;
+  bpdist        = vc->bpdist;
+  Qmax          = 0.;
+
+  /*array initialization ; qb,qm,q
+    qb,qm,q (i,j) are stored as ((n+1-i)*(n-i) div 2 + n+1-j */
+
+  for (j = 1; j<=seq_length; j++)
+    for (i=(j>TURN?(j-TURN):1); i<=j; i++){
+      ij                        = my_iindx[i]-j;
+      matrices->k_min_Q[ij]    = 0;
+      matrices->k_max_Q[ij]    = 0;
+      matrices->l_min_Q[ij]    = (int *)vrna_alloc(sizeof(int));
+      matrices->l_max_Q[ij]    = (int *)vrna_alloc(sizeof(int));
+      matrices->l_min_Q[ij][0] = 0;
+      matrices->l_max_Q[ij][0] = 0;
+      matrices->Q[ij]               = (FLT_OR_DBL **) vrna_alloc(sizeof(FLT_OR_DBL *));
+      matrices->Q[ij][0]            = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL));
+      matrices->Q[ij][0][0]         = 1.0 * scale[j-i+1];
+    }
+
+
+  for (d = TURN+2; d <= seq_length; d++) { /* i,j in [1..seq_length] */
+#ifdef _OPENMP
+  #pragma omp parallel for private(i, j, ij, cnt1, cnt2, cnt3, cnt4)
+#endif
+    for (j = d; j <= seq_length; j++) {
+      unsigned int k,l, kl, u, ii, dij;
+      int no_close, type, type_2, tt, da, db, base_da, base_db;
+      FLT_OR_DBL  temp2, aux_en;
+
+      i     = j-d+1;
+      ij    = my_iindx[i]-j;
+      dij   = j - i - 1;
+      type  = ptype[jindx[j] + i];
+
+
+      no_close = (((type==3)||(type==4))&&no_closingGU);
+
+      if (type) {   /* we have a pair */
+
+        int k_min_Q_B, k_max_Q_B, l_min_Q_B, l_max_Q_B;
+        int k_min_post_b, k_max_post_b, *l_min_post_b, *l_max_post_b;
+        int update_b = 0;
+
+        if(!matrices->Q_B[ij]){
+          update_b = 1;
+          k_min_Q_B = l_min_Q_B = 0;
+          k_max_Q_B = mm1[ij] + referenceBPs1[ij];
+          l_max_Q_B = mm2[ij] + referenceBPs2[ij];
+
+          prepareBoundaries(k_min_Q_B,
+                            k_max_Q_B,
+                            l_min_Q_B,
+                            l_max_Q_B,
+                            bpdist[ij],
+                            &matrices->k_min_Q_B[ij],
+                            &matrices->k_max_Q_B[ij],
+                            &matrices->l_min_Q_B[ij],
+                            &matrices->l_max_Q_B[ij]
+                            );
+          preparePosteriorBoundaries( matrices->k_max_Q_B[ij] - matrices->k_min_Q_B[ij] + 1,
+                                      matrices->k_min_Q_B[ij],
+                                      &k_min_post_b,
+                                      &k_max_post_b,
+                                      &l_min_post_b,
+                                      &l_max_post_b
+                                  );
+
+          prepareArray( &matrices->Q_B[ij],
+                        matrices->k_min_Q_B[ij],
+                        matrices->k_max_Q_B[ij],
+                        matrices->l_min_Q_B[ij],
+                        matrices->l_max_Q_B[ij]
+                    );
+        }
+
+
+        /* hairpin ----------------------------------------------*/
+
+        /* get distance to reference if closing the hairpin
+        *  d1a = dbp(T1_{i,j}, {i,j})
+        */
+        base_da = ((unsigned int)reference_pt1[i] != j) ? 1 : -1;
+        base_db = ((unsigned int)reference_pt2[i] != j) ? 1 : -1;
+
+        da = base_da + referenceBPs1[ij];
+        db = base_db + referenceBPs2[ij];
+
+        if(!no_close)
+          if((da >= 0) && (db >= 0)){
+            if(((unsigned int)da<=maxD1) && ((unsigned int)db <= maxD2)){
+              matrices->Q_B[ij][da][db/2] = exp_E_Hairpin(dij, type, S1[i+1], S1[j-1], sequence+i-1, pf_params) * scale[dij+2];
+              if(update_b){
+                updatePosteriorBoundaries( da,
+                                           db,
+                                           &k_min_post_b,
+                                           &k_max_post_b,
+                                           &l_min_post_b,
+                                           &l_max_post_b
+                                         );
+              }
+            }
+            else{
+              matrices->Q_B_rem[ij] = exp_E_Hairpin(dij, type, S1[i+1], S1[j-1], sequence+i-1, pf_params) * scale[dij+2];
+            }
+          }
+        /*--------------------------------------------------------
+          check for elementary structures involving more than one
+          closing pair.
+        --------------------------------------------------------*/
+        for (k = i+1; k <= MIN2(j-2-TURN,i+MAXLOOP+1) ; k++) {
+          unsigned int minl, ln_pre;
+          minl = k + TURN + 1;
+          ln_pre = dij + k;
+          if(ln_pre > minl + MAXLOOP) minl = ln_pre - MAXLOOP - 1;
+          for (l = minl; l < j; l++) {
+            kl = my_iindx[k] - l;
+            type_2 = ptype[jindx[l] + k];
+
+            if (type_2==0) continue;
+            type_2 = rtype[type_2];
+            aux_en = exp_E_IntLoop(k-i-1, j-l-1, type, type_2, S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params) * scale[k-i+j-l];
+
+            /* get distance to reference if closing the interior loop
+            *  d2 = dbp(S_{i,j}, S_{k,l} + {i,j})
+            */
+            da = base_da + referenceBPs1[ij] - referenceBPs1[kl];
+            db = base_db + referenceBPs2[ij] - referenceBPs2[kl];
+
+            if(matrices->Q_B_rem[kl]){
+              matrices->Q_B_rem[ij] += matrices->Q_B_rem[kl] * aux_en;
+            }
+            if(!matrices->Q_B[kl]) continue;
+            for(cnt1 = matrices->k_min_Q_B[kl];
+                cnt1 <= matrices->k_max_Q_B[kl];
+                cnt1++)
+              for(cnt2 = matrices->l_min_Q_B[kl][cnt1];
+                  cnt2 <= matrices->l_max_Q_B[kl][cnt1];
+                  cnt2 += 2){
+                if(((cnt1 + da) <= maxD1) && ((cnt2 + db) <= maxD2)){
+                  matrices->Q_B[ij][cnt1 + da][(cnt2 + db)/2] += matrices->Q_B[kl][cnt1][cnt2/2] * aux_en;
+                  if(update_b){
+                    updatePosteriorBoundaries( da + cnt1,
+                                               db + cnt2,
+                                               &k_min_post_b,
+                                               &k_max_post_b,
+                                               &l_min_post_b,
+                                               &l_max_post_b
+                                             );
+                  }
+                }
+                else{
+                  matrices->Q_B_rem[ij] += matrices->Q_B[kl][cnt1][cnt2/2] * aux_en;
+                }
+              }
+
+          } /* end l-loop */
+        } /* end k-loop */
+
+        /* multi-loop contribution ------------------------*/
+        if(!no_close){
+          for(u=i+TURN+2; u<j-TURN-2;u++){
+            tt = rtype[type];
+            temp2 = pf_params->expMLclosing * exp_E_MLstem(tt, S1[j-1], S1[i+1], pf_params) * scale[2];
+
+            if(matrices->Q_M_rem[my_iindx[i+1]-u]){
+              if(matrices->Q_M1[jindx[j-1]+u+1])
+                for(cnt1 = matrices->k_min_Q_M1[jindx[j-1]+u+1];
+                    cnt1 <= matrices->k_max_Q_M1[jindx[j-1]+u+1];
+                    cnt1++)
+                  for(cnt2 = matrices->l_min_Q_M1[jindx[j-1]+u+1][cnt1];
+                      cnt2 <= matrices->l_max_Q_M1[jindx[j-1]+u+1][cnt1];
+                      cnt2 += 2)
+                    matrices->Q_B_rem[ij] += matrices->Q_M_rem[my_iindx[i+1]-u] * matrices->Q_M1[jindx[j-1]+u+1][cnt1][cnt2/2] * temp2;
+
+              if(matrices->Q_M1_rem[jindx[j-1]+u+1])
+                matrices->Q_B_rem[ij] += matrices->Q_M_rem[my_iindx[i+1]-u] * matrices->Q_M1_rem[jindx[j-1]+u+1] * temp2;
+            }
+            if(matrices->Q_M1_rem[jindx[j-1]+u+1]){
+              if(matrices->Q_M[my_iindx[i+1]-u])
+                for(cnt1 = matrices->k_min_Q_M[my_iindx[i+1]-u];
+                    cnt1 <= matrices->k_max_Q_M[my_iindx[i+1]-u];
+                    cnt1++)
+                  for(cnt2 = matrices->l_min_Q_M[my_iindx[i+1]-u][cnt1];
+                      cnt2 <= matrices->l_max_Q_M[my_iindx[i+1]-u][cnt1];
+                      cnt2 += 2)
+                    matrices->Q_B_rem[ij] += matrices->Q_M[my_iindx[i+1]-u][cnt1][cnt2/2] * matrices->Q_M1_rem[jindx[j-1]+u+1] * temp2;
+            }
+
+            /* get distance to reference if closing the multiloop
+            *  dist3 = dbp(S_{i,j}, {i,j} + S_{i+1,u} + S_{u+1,j-1})
+            */
+            da = base_da + referenceBPs1[ij] - referenceBPs1[my_iindx[i+1]-u] - referenceBPs1[my_iindx[u+1]-j+1];
+            db = base_db + referenceBPs2[ij] - referenceBPs2[my_iindx[i+1]-u] - referenceBPs2[my_iindx[u+1]-j+1];
+
+            if(!matrices->Q_M[my_iindx[i+1]-u]) continue;
+            if(!matrices->Q_M1[jindx[j-1]+u+1]) continue;
+            for(cnt1 = matrices->k_min_Q_M[my_iindx[i+1]-u];
+                cnt1 <= matrices->k_max_Q_M[my_iindx[i+1]-u];
+                cnt1++)
+              for(cnt2 = matrices->l_min_Q_M[my_iindx[i+1]-u][cnt1];
+                  cnt2 <= matrices->l_max_Q_M[my_iindx[i+1]-u][cnt1];
+                  cnt2 += 2){
+                for(cnt3 = matrices->k_min_Q_M1[jindx[j-1]+u+1];
+                    cnt3 <= matrices->k_max_Q_M1[jindx[j-1]+u+1];
+                    cnt3++)
+                  for(cnt4 = matrices->l_min_Q_M1[jindx[j-1]+u+1][cnt3];
+                      cnt4 <= matrices->l_max_Q_M1[jindx[j-1]+u+1][cnt3];
+                      cnt4 += 2){
+                    if(((cnt1 + cnt3 + da) <= maxD1) && ((cnt2 + cnt4 + db) <= maxD2)){
+                      matrices->Q_B[ij][cnt1 + cnt3 + da][(cnt2 + cnt4 + db)/2] +=  matrices->Q_M[my_iindx[i+1]-u][cnt1][cnt2/2]
+                                                                              * matrices->Q_M1[jindx[j-1]+u+1][cnt3][cnt4/2]
+                                                                              * temp2;
+                      if(update_b){
+                        updatePosteriorBoundaries( cnt1 + cnt3 + da,
+                                                   cnt2 + cnt4 + db,
+                                                   &k_min_post_b,
+                                                   &k_max_post_b,
+                                                   &l_min_post_b,
+                                                   &l_max_post_b
+                                                 );
+                      }
+                    }
+                    else{
+                      matrices->Q_B_rem[ij] +=  matrices->Q_M[my_iindx[i+1]-u][cnt1][cnt2/2]
+                                    * matrices->Q_M1[jindx[j-1]+u+1][cnt3][cnt4/2]
+                                    * temp2;
+                    }
+                  }
+
+              }
+
+          }
+        }
+
+        if(update_b){
+          adjustArrayBoundaries(&matrices->Q_B[ij],
+                                &matrices->k_min_Q_B[ij],
+                                &matrices->k_max_Q_B[ij],
+                                &matrices->l_min_Q_B[ij],
+                                &matrices->l_max_Q_B[ij],
+                                k_min_post_b,
+                                k_max_post_b,
+                                l_min_post_b,
+                                l_max_post_b
+                                );
+        }
+      } /* end >> if (pair) << */
+
+      /* free ends ? -----------------------------------------*/
+
+      int k_min_Q_M, k_max_Q_M, l_min_Q_M, l_max_Q_M;
+      int k_min_post_m, k_max_post_m, *l_min_post_m, *l_max_post_m;
+      int update_m = 0;
+      int k_min_Q_M1, k_max_Q_M1, l_min_Q_M1, l_max_Q_M1;
+      int k_min_post_m1, k_max_post_m1, *l_min_post_m1, *l_max_post_m1;
+      int update_m1 = 0;
+
+      if(!matrices->Q_M[ij]){
+        update_m = 1;
+        k_min_Q_M = l_min_Q_M = 0;
+        k_max_Q_M = mm1[ij] + referenceBPs1[ij];
+        l_max_Q_M = mm2[ij] + referenceBPs2[ij];
+
+        prepareBoundaries(k_min_Q_M,
+                          k_max_Q_M,
+                          l_min_Q_M,
+                          l_max_Q_M,
+                          bpdist[ij],
+                          &matrices->k_min_Q_M[ij],
+                          &matrices->k_max_Q_M[ij],
+                          &matrices->l_min_Q_M[ij],
+                          &matrices->l_max_Q_M[ij]
+                          );
+        preparePosteriorBoundaries( matrices->k_max_Q_M[ij] - matrices->k_min_Q_M[ij] + 1,
+                                    matrices->k_min_Q_M[ij],
+                                    &k_min_post_m,
+                                    &k_max_post_m,
+                                    &l_min_post_m,
+                                    &l_max_post_m
+                                );
+
+        prepareArray( &matrices->Q_M[ij],
+                      matrices->k_min_Q_M[ij],
+                      matrices->k_max_Q_M[ij],
+                      matrices->l_min_Q_M[ij],
+                      matrices->l_max_Q_M[ij]
+                  );
+      }
+      if(!matrices->Q_M1[jindx[j]+i]){
+        update_m1 = 1;
+        k_min_Q_M1 = l_min_Q_M1 = 0;
+        k_max_Q_M1 = mm1[ij] + referenceBPs1[ij];
+        l_max_Q_M1 = mm2[ij] + referenceBPs2[ij];
+
+        prepareBoundaries(k_min_Q_M1,
+                          k_max_Q_M1,
+                          l_min_Q_M1,
+                          l_max_Q_M1,
+                          bpdist[ij],
+                          &matrices->k_min_Q_M1[jindx[j]+i],
+                          &matrices->k_max_Q_M1[jindx[j]+i],
+                          &matrices->l_min_Q_M1[jindx[j]+i],
+                          &matrices->l_max_Q_M1[jindx[j]+i]
+                          );
+        preparePosteriorBoundaries( matrices->k_max_Q_M1[jindx[j]+i] - matrices->k_min_Q_M1[jindx[j]+i] + 1,
+                                    matrices->k_min_Q_M1[jindx[j]+i],
+                                    &k_min_post_m1,
+                                    &k_max_post_m1,
+                                    &l_min_post_m1,
+                                    &l_max_post_m1
+                                );
+
+        prepareArray( &matrices->Q_M1[jindx[j]+i],
+                      matrices->k_min_Q_M1[jindx[j]+i],
+                      matrices->k_max_Q_M1[jindx[j]+i],
+                      matrices->l_min_Q_M1[jindx[j]+i],
+                      matrices->l_max_Q_M1[jindx[j]+i]
+                  );
+      }
+
+
+      /* j is unpaired */
+      da = referenceBPs1[ij] - referenceBPs1[ij+1];
+      db = referenceBPs2[ij] - referenceBPs2[ij+1];
+
+      if(matrices->Q_M_rem[ij+1])
+        matrices->Q_M_rem[ij] += matrices->Q_M_rem[ij+1] * pf_params->expMLbase * scale[1];
+
+      if(matrices->Q_M[ij+1])
+        for(cnt1 = matrices->k_min_Q_M[ij+1];
+            cnt1 <= matrices->k_max_Q_M[ij+1];
+            cnt1++){
+          for(cnt2 = matrices->l_min_Q_M[ij+1][cnt1];
+              cnt2 <= matrices->l_max_Q_M[ij+1][cnt1];
+              cnt2 += 2){
+            if(((cnt1 + da) <= maxD1) && ((cnt2 + db) <= maxD2)){
+              matrices->Q_M[ij][cnt1 + da][(cnt2 + db)/2] += matrices->Q_M[ij+1][cnt1][cnt2/2] * pf_params->expMLbase * scale[1];
+              if(update_m){
+                updatePosteriorBoundaries(cnt1 + da,
+                                          cnt2 + db,
+                                          &k_min_post_m,
+                                          &k_max_post_m,
+                                          &l_min_post_m,
+                                          &l_max_post_m
+                                          );
+              }
+            }
+            else{
+              matrices->Q_M_rem[ij] += matrices->Q_M[ij+1][cnt1][cnt2/2] * pf_params->expMLbase * scale[1];
+            }
+          }
+        }
+
+      if(matrices->Q_M1_rem[jindx[j-1]+i])
+        matrices->Q_M1_rem[jindx[j]+i] += matrices->Q_M1_rem[jindx[j-1]+i] * pf_params->expMLbase * scale[1];
+
+      if(matrices->Q_M1[jindx[j-1]+i])
+        for(cnt1 = matrices->k_min_Q_M1[jindx[j-1]+i];
+            cnt1 <= matrices->k_max_Q_M1[jindx[j-1]+i];
+            cnt1++)
+          for(cnt2 = matrices->l_min_Q_M1[jindx[j-1]+i][cnt1];
+              cnt2 <= matrices->l_max_Q_M1[jindx[j-1]+i][cnt1];
+              cnt2 += 2){
+            if(((cnt1 + da) <= maxD1) && ((cnt2 + db) <= maxD2)){
+              matrices->Q_M1[jindx[j]+i][cnt1 + da][(cnt2 + db)/2] += matrices->Q_M1[jindx[j-1]+i][cnt1][cnt2/2] * pf_params->expMLbase * scale[1];
+              if(update_m1){
+                updatePosteriorBoundaries(cnt1 + da,
+                                          cnt2 + db,
+                                          &k_min_post_m1,
+                                          &k_max_post_m1,
+                                          &l_min_post_m1,
+                                          &l_max_post_m1
+                                          );
+              }
+            }
+            else{
+              matrices->Q_M1_rem[jindx[j]+i] += matrices->Q_M1[jindx[j-1]+i][cnt1][cnt2/2] * pf_params->expMLbase * scale[1];
+            }
+          }
+
+
+      /* j pairs with i */
+      if((!no_close) && type){
+        FLT_OR_DBL aux_en = exp_E_MLstem(type, (i>1) || circ ? S1[i-1] : -1, (j<seq_length) || circ ? S1[j+1] : -1, pf_params);
+
+        if(matrices->Q_B_rem[ij]){
+          matrices->Q_M_rem[ij]           += matrices->Q_B_rem[ij] * aux_en;
+          matrices->Q_M1_rem[jindx[j]+i]  += matrices->Q_B_rem[ij] * aux_en;
+        }
+
+        if(matrices->Q_B[ij]){
+          for(cnt1 = matrices->k_min_Q_B[ij];
+              cnt1 <= matrices->k_max_Q_B[ij];
+              cnt1++)
+            for(cnt2 = matrices->l_min_Q_B[ij][cnt1];
+                cnt2 <= matrices->l_max_Q_B[ij][cnt1];
+                cnt2 += 2){
+              matrices->Q_M[ij][cnt1][cnt2/2] += matrices->Q_B[ij][cnt1][cnt2/2] * aux_en;
+              if(update_m){
+                updatePosteriorBoundaries(cnt1,
+                                          cnt2,
+                                          &k_min_post_m,
+                                          &k_max_post_m,
+                                          &l_min_post_m,
+                                          &l_max_post_m
+                                          );
+              }
+              matrices->Q_M1[jindx[j]+i][cnt1][cnt2/2] += matrices->Q_B[ij][cnt1][cnt2/2] * aux_en;
+              if(update_m1){
+                updatePosteriorBoundaries(cnt1,
+                                          cnt2,
+                                          &k_min_post_m1,
+                                          &k_max_post_m1,
+                                          &l_min_post_m1,
+                                          &l_max_post_m1
+                                          );
+              }
+            }
+        }
+      }
+
+      /* j pairs with k: i<k<j */
+      ii = my_iindx[i];
+      for (k=i+1; k<=j; k++){
+        tt = ptype[jindx[j] + k];
+        temp2 = exp_E_MLstem(tt, S1[k-1], (j<seq_length) || circ ? S1[j+1] : -1, pf_params);
+
+        if(matrices->Q_B_rem[my_iindx[k]-j]){
+          matrices->Q_M_rem[ij] += matrices->Q_B_rem[my_iindx[k]-j] * pow(pf_params->expMLbase, (double)(k-i)) * scale[k-i] * temp2;
+          if(matrices->Q_M[ii-k+1])
+            for(cnt1 = matrices->k_min_Q_M[ii-k+1];
+                cnt1 <= matrices->k_max_Q_M[ii-k+1];
+                cnt1++)
+              for(cnt2 = matrices->l_min_Q_M[ii-k+1][cnt1];
+                  cnt2 <= matrices->l_max_Q_M[ii-k+1][cnt1];
+                  cnt2 += 2)
+                matrices->Q_M_rem[ij] += matrices->Q_M[ii-k+1][cnt1][cnt2/2] * matrices->Q_B_rem[my_iindx[k]-j] * temp2;
+
+          if(matrices->Q_M_rem[ii-k+1])
+            matrices->Q_M_rem[ij] += matrices->Q_M_rem[ii-k+1] * matrices->Q_B_rem[my_iindx[k]-j] * temp2;
+        }
+        if(matrices->Q_M_rem[ii-k+1]){
+          if(matrices->Q_B[my_iindx[k]-j])
+            for(cnt1 = matrices->k_min_Q_B[my_iindx[k]-j];
+                cnt1 <= matrices->k_max_Q_B[my_iindx[k]-j];
+                cnt1++)
+              for(cnt2 = matrices->l_min_Q_B[my_iindx[k]-j][cnt1];
+                  cnt2 <= matrices->l_max_Q_B[my_iindx[k]-j][cnt1];
+                  cnt2 += 2)
+                matrices->Q_M_rem[ij] += matrices->Q_M_rem[my_iindx[k]-j] * matrices->Q_B[my_iindx[k]-j][cnt1][cnt2/2] * temp2;
+        }
+
+        /* add contributions of QM(i,k-1)*QB(k,j)*e^b and
+        *  e^((k-i) * c) * QB(k,j) * e^b
+        *  therefor we need d1a = dbp(T1_{i,j}, T1_{i,k-1} + T1_{k,j}),
+        *  d1b = dbp(T2_{i,j}, T2_{i,k-1} + T2_{k,j})
+        *  d1c = dbp(T1_{i,j}, T1_{k,j})circ = 0;
+        *  d1d = dbp(T2_{i,j}, T2_{k,j})
+        */
+        da = referenceBPs1[ij] - referenceBPs1[my_iindx[k]-j];
+        db = referenceBPs2[ij] - referenceBPs2[my_iindx[k]-j];
+
+        if(!matrices->Q_B[my_iindx[k]-j]) continue;
+        for(cnt1 = matrices->k_min_Q_B[my_iindx[k]-j];
+            cnt1 <= matrices->k_max_Q_B[my_iindx[k]-j];
+            cnt1++)
+          for(cnt2 = matrices->l_min_Q_B[my_iindx[k]-j][cnt1];
+              cnt2 <= matrices->l_max_Q_B[my_iindx[k]-j][cnt1];
+              cnt2 += 2){
+            if(((cnt1 + da) <= maxD1) && ((cnt2 + db) <= maxD2)){
+                matrices->Q_M[ij][cnt1 + da][(cnt2 + db)/2] += matrices->Q_B[my_iindx[k]-j][cnt1][cnt2/2] * pow(pf_params->expMLbase, (double)(k-i)) * scale[k-i] * temp2;
+              if(update_m){
+                updatePosteriorBoundaries(cnt1 + da,
+                                          cnt2 + db,
+                                          &k_min_post_m,
+                                          &k_max_post_m,
+                                          &l_min_post_m,
+                                          &l_max_post_m
+                                          );
+              }
+            }
+            else{
+              matrices->Q_M_rem[ij] += matrices->Q_B[my_iindx[k]-j][cnt1][cnt2/2] * pow(pf_params->expMLbase, (double)(k-i)) * scale[k-i] * temp2;
+            }
+          }
+
+        if(!matrices->Q_M[ii-k+1]) continue;
+        da -= referenceBPs1[ii-k+1];
+        db -= referenceBPs2[ii-k+1];
+
+        for(cnt1 = matrices->k_min_Q_M[ii-k+1];
+            cnt1 <= matrices->k_max_Q_M[ii-k+1];
+            cnt1++)
+          for(cnt2 = matrices->l_min_Q_M[ii-k+1][cnt1];
+              cnt2 <= matrices->l_max_Q_M[ii-k+1][cnt1];
+              cnt2 += 2)
+            for(cnt3 = matrices->k_min_Q_B[my_iindx[k]-j];
+                cnt3 <= matrices->k_max_Q_B[my_iindx[k]-j];
+                cnt3++)
+              for(cnt4 = matrices->l_min_Q_B[my_iindx[k]-j][cnt3];
+                  cnt4 <= matrices->l_max_Q_B[my_iindx[k]-j][cnt3];
+                  cnt4 += 2){
+                if(((cnt1 + cnt3 + da) <= maxD1) && ((cnt2 + cnt4 + db) <= maxD2)){
+                  matrices->Q_M[ij][cnt1 + cnt3 + da][(cnt2 + cnt4 + db)/2] += matrices->Q_M[ii-k+1][cnt1][cnt2/2] * matrices->Q_B[my_iindx[k]-j][cnt3][cnt4/2] * temp2;
+                  if(update_m){
+                    updatePosteriorBoundaries(cnt1 + cnt3 + da,
+                                              cnt2 + cnt4 + db,
+                                              &k_min_post_m,
+                                              &k_max_post_m,
+                                              &l_min_post_m,
+                                              &l_max_post_m
+                                              );
+                  }
+                }
+                else{
+                  matrices->Q_M_rem[ij] += matrices->Q_M[ii-k+1][cnt1][cnt2/2] * matrices->Q_B[my_iindx[k]-j][cnt3][cnt4/2] * temp2;
+                }
+              }
+      }
+
+      if(update_m){
+        adjustArrayBoundaries(&matrices->Q_M[ij],
+                              &matrices->k_min_Q_M[ij],
+                              &matrices->k_max_Q_M[ij],
+                              &matrices->l_min_Q_M[ij],
+                              &matrices->l_max_Q_M[ij],
+                              k_min_post_m,
+                              k_max_post_m,
+                              l_min_post_m,
+                              l_max_post_m
+                              );
+      }
+      if(update_m1){
+        adjustArrayBoundaries(&matrices->Q_M1[jindx[j]+i],
+                              &matrices->k_min_Q_M1[jindx[j]+i],
+                              &matrices->k_max_Q_M1[jindx[j]+i],
+                              &matrices->l_min_Q_M1[jindx[j]+i],
+                              &matrices->l_max_Q_M1[jindx[j]+i],
+                              k_min_post_m1,
+                              k_max_post_m1,
+                              l_min_post_m1,
+                              l_max_post_m1
+                              );
+      }
+
+      /* compute contributions for Q(i,j) */
+      int k_min, k_max, l_min, l_max;
+      int k_min_post, k_max_post, *l_min_post, *l_max_post;
+      int update_q = 0;
+      if(!matrices->Q[ij]){
+        update_q = 1;
+        k_min = l_min = 0;
+        k_max = mm1[ij] + referenceBPs1[ij];
+        l_max = mm2[ij] + referenceBPs2[ij];
+
+        prepareBoundaries(k_min,
+                          k_max,
+                          l_min,
+                          l_max,
+                          bpdist[ij],
+                          &matrices->k_min_Q[ij],
+                          &matrices->k_max_Q[ij],
+                          &matrices->l_min_Q[ij],
+                          &matrices->l_max_Q[ij]
+                          );
+        preparePosteriorBoundaries( matrices->k_max_Q[ij] - matrices->k_min_Q[ij] + 1,
+                                    matrices->k_min_Q[ij],
+                                    &k_min_post,
+                                    &k_max_post,
+                                    &l_min_post,
+                                    &l_max_post
+                                );
+
+        prepareArray( &matrices->Q[ij],
+                      matrices->k_min_Q[ij],
+                      matrices->k_max_Q[ij],
+                      matrices->l_min_Q[ij],
+                      matrices->l_max_Q[ij]
+                  );
+      }
+
+      if (type){
+        aux_en = exp_E_ExtLoop(type, (i>1) || circ ? S1[i-1] : -1, (j < seq_length) || circ ? S1[j+1] : -1, pf_params);
+
+        if(matrices->Q_B_rem[ij])
+          matrices->Q_rem[ij] += matrices->Q_B_rem[ij] * aux_en;
+
+        if(matrices->Q_B[ij])
+          for(cnt1 = matrices->k_min_Q_B[ij];
+              cnt1 <= matrices->k_max_Q_B[ij];
+              cnt1++)
+            for(cnt2 = matrices->l_min_Q_B[ij][cnt1];
+                cnt2 <= matrices->l_max_Q_B[ij][cnt1];
+                cnt2 += 2){
+              matrices->Q[ij][cnt1][cnt2/2] += matrices->Q_B[ij][cnt1][cnt2/2] * aux_en;
+              if(update_q){
+                updatePosteriorBoundaries(cnt1,
+                                          cnt2,
+                                          &k_min_post,
+                                          &k_max_post,
+                                          &l_min_post,
+                                          &l_max_post
+                                          );
+              }
+            }
+      }
+
+      /* j is unpaired */
+      if(matrices->Q_rem[ij+1])
+        matrices->Q_rem[ij] += matrices->Q_rem[ij+1] * scale[1];
+
+      /* da = dbp(T1_{i,j}, T1_{i,j-1})
+      *  db = dbp(T2_{i,j}, T2_{i,j-1})
+      */
+      da = referenceBPs1[ij] - referenceBPs1[ij+1];
+      db = referenceBPs2[ij] - referenceBPs2[ij+1];
+      if(matrices->Q[ij+1])
+        for(cnt1 = matrices->k_min_Q[ij+1];
+            cnt1 <= matrices->k_max_Q[ij+1];
+            cnt1++)
+          for(cnt2 = matrices->l_min_Q[ij+1][cnt1];
+              cnt2 <= matrices->l_max_Q[ij+1][cnt1];
+              cnt2 += 2){
+            if(((cnt1 + da) <= maxD1) && ((cnt2 + db) <= maxD2)){
+              matrices->Q[ij][cnt1 + da][(cnt2 + db)/2] += matrices->Q[ij+1][cnt1][cnt2/2] * scale[1];
+              if(update_q){
+                updatePosteriorBoundaries(cnt1 + da,
+                                          cnt2 + db,
+                                          &k_min_post,
+                                          &k_max_post,
+                                          &l_min_post,
+                                          &l_max_post
+                                          );
+              }
+            }
+            else{
+              matrices->Q_rem[ij] += matrices->Q[ij+1][cnt1][cnt2/2] * scale[1];
+            }
+          }
+
+      for(k=j-TURN-1; k>i; k--){
+        tt = ptype[jindx[j] + k];
+        temp2 = exp_E_ExtLoop(tt, S1[k-1], (j<seq_length) || circ ? S1[j+1] : -1, pf_params);
+
+        if(matrices->Q_rem[my_iindx[i]-k+1]){
+          if(matrices->Q_B[my_iindx[k]-j])
+            for(cnt1 = matrices->k_min_Q_B[my_iindx[k]-j];
+                cnt1 <=  matrices->k_max_Q_B[my_iindx[k]-j];
+                cnt1++)
+              for(cnt2 = matrices->l_min_Q_B[my_iindx[k]-j][cnt1];
+                  cnt2 <= matrices->l_max_Q_B[my_iindx[k]-j][cnt1];
+                  cnt2 += 2)
+                matrices->Q_rem[ij] += matrices->Q_rem[my_iindx[i]-k+1] * matrices->Q_B[my_iindx[k]-j][cnt1][cnt2/2] * temp2;
+          if(matrices->Q_B_rem[my_iindx[k]-j])
+            matrices->Q_rem[ij] += matrices->Q_rem[my_iindx[i]-k+1] * matrices->Q_B_rem[my_iindx[k]-j] * temp2;
+        }
+        if(matrices->Q_B_rem[my_iindx[k]-j]){
+          if(matrices->Q[my_iindx[i]-k+1])
+            for(cnt1 = matrices->k_min_Q[my_iindx[i]-k+1];
+                cnt1 <= matrices->k_max_Q[my_iindx[i]-k+1];
+                cnt1++)
+              for(cnt2 = matrices->l_min_Q[my_iindx[i]-k+1][cnt1];
+                  cnt2 <= matrices->l_max_Q[my_iindx[i]-k+1][cnt1];
+                  cnt2 += 2)
+                matrices->Q_rem[ij] += matrices->Q[my_iindx[i]-k+1][cnt1][cnt2/2] * matrices->Q_B_rem[my_iindx[k]-j] * temp2;
+        }
+
+        /* da = dbp{T1_{i,j}, T1_{k,j}
+        *  db = dbp{T2_{i,j}, T2_{k,j}}
+        */
+        da = referenceBPs1[ij] - referenceBPs1[my_iindx[k] - j] - referenceBPs1[my_iindx[i]-k+1];
+        db = referenceBPs2[ij] - referenceBPs2[my_iindx[k] - j] - referenceBPs2[my_iindx[i]-k+1];
+
+
+        if(!matrices->Q[my_iindx[i]-k+1]) continue;
+        if(!matrices->Q_B[my_iindx[k]-j]) continue;
+        for(cnt1 = matrices->k_min_Q[my_iindx[i]-k+1];
+            cnt1 <= matrices->k_max_Q[my_iindx[i]-k+1];
+            cnt1++)
+          for(cnt2 = matrices->l_min_Q[my_iindx[i]-k+1][cnt1];
+              cnt2 <= matrices->l_max_Q[my_iindx[i]-k+1][cnt1];
+              cnt2 += 2)
+            for(cnt3 = matrices->k_min_Q_B[my_iindx[k]-j];
+                cnt3 <= matrices->k_max_Q_B[my_iindx[k]-j];
+                cnt3++)
+              for(cnt4 = matrices->l_min_Q_B[my_iindx[k]-j][cnt3];
+                  cnt4 <= matrices->l_max_Q_B[my_iindx[k]-j][cnt3];
+                  cnt4 += 2){
+                if(((cnt1 + cnt3 + da) <= maxD1) && ((cnt2 + cnt4 + db) <= maxD2)){
+                    matrices->Q[ij][cnt1 + cnt3 + da][(cnt2 + cnt4 + db)/2] += matrices->Q[my_iindx[i]-k+1][cnt1][cnt2/2] * matrices->Q_B[my_iindx[k]-j][cnt3][cnt4/2] * temp2;
+                  if(update_q){
+                    updatePosteriorBoundaries(cnt1 + cnt3 + da,
+                                              cnt2 + cnt4 + db,
+                                              &k_min_post,
+                                              &k_max_post,
+                                              &l_min_post,
+                                              &l_max_post
+                                              );
+                  }
+                }
+                else{
+                  matrices->Q_rem[ij] += matrices->Q[my_iindx[i]-k+1][cnt1][cnt2/2] * matrices->Q_B[my_iindx[k]-j][cnt3][cnt4/2] * temp2;
+                }
+              }
+      }
+
+      if(update_q){
+        adjustArrayBoundaries(&matrices->Q[ij],
+                              &matrices->k_min_Q[ij],
+                              &matrices->k_max_Q[ij],
+                              &matrices->l_min_Q[ij],
+                              &matrices->l_max_Q[ij],
+                              k_min_post,
+                              k_max_post,
+                              l_min_post,
+                              l_max_post
+                              );
+      }
+#if 1
+      for(cnt1 = matrices->k_min_Q[ij];
+          cnt1 <= matrices->k_max_Q[ij];
+          cnt1++){
+        for(cnt2 = matrices->l_min_Q[ij][cnt1];
+            cnt2 <= matrices->l_max_Q[ij][cnt1];
+            cnt2 += 2){
+          if(matrices->Q[ij][cnt1][cnt2/2] > Qmax) {
+            Qmax = matrices->Q[ij][cnt1][cnt2/2];
+            if (Qmax > max_real/10.)
+              vrna_message_warning("Q close to overflow: %u %u %g\n", i,j,matrices->Q[ij][cnt1][cnt2/2]);
+          }
+          if(matrices->Q[ij][cnt1][cnt2/2] >= max_real) {
+            vrna_message_error("overflow in pf_fold while calculating q[%u,%u]\n"
+                                      "use larger pf_scale", i,j);
+          }
+        }
+
+      }
+#endif
+
+    } /* end of j-loop */
+  }
+}
+
+/* calculate partition function for circular case */
+/* NOTE: this is the postprocessing step ONLY     */
+/* You have to call pf2D_linear first to calculate  */
+/* complete circular case!!!                      */
+PRIVATE void
+pf2D_circ(vrna_fold_compound_t *vc){
+
+  unsigned int  d, p, q, pq, k, l, kl, u, da, db, seq_length, maxD1, maxD2, base_d1, base_d2, *mm1, *mm2, *bpdist;
+  int         *my_iindx, *jindx, type, cnt1, cnt2, cnt3, cnt4, *rtype;
+  short       *S1;
+  unsigned int  *referenceBPs1, *referenceBPs2;
+  char        *sequence, *ptype;
+  FLT_OR_DBL  *scale;
+  vrna_exp_param_t  *pf_params;     /* holds all [unscaled] pf parameters */
+  vrna_md_t         *md;
+  vrna_mx_pf_t     *matrices;
+
+  pf_params       = vc->exp_params;
+  md              = &(pf_params->model_details);
+  matrices        = vc->exp_matrices;
+  sequence        = vc->sequence;
+  seq_length      = vc->length;
+  maxD1           = vc->maxD1;
+  maxD2           = vc->maxD2;
+  S1              = vc->sequence_encoding;
+  ptype           = vc->ptype;
+  rtype           = &(md->rtype[0]);
+  scale           = matrices->scale;
+  my_iindx        = vc->iindx;
+  jindx           = vc->jindx;
+  referenceBPs1   = vc->referenceBPs1;
+  referenceBPs2   = vc->referenceBPs2;
+  dangles         = md->dangles;
+  mm1             = vc->mm1;
+  mm2             = vc->mm2;
+  bpdist          = vc->bpdist;
+
+  FLT_OR_DBL      ***Q_B, ***Q_M, ***Q_M1;
+  FLT_OR_DBL      *Q_B_rem, *Q_M_rem, *Q_M1_rem;
+  int             **l_min_Q_B, **l_max_Q_B, **l_min_Q_M, **l_max_Q_M, **l_min_Q_M1, **l_max_Q_M1;
+  int             *k_min_Q_B, *k_max_Q_B,*k_min_Q_M, *k_max_Q_M,*k_min_Q_M1, *k_max_Q_M1;
+
+  Q_B             = matrices->Q_B;
+  l_min_Q_B  = matrices->l_min_Q_B;
+  l_max_Q_B  = matrices->l_max_Q_B;
+  k_min_Q_B  = matrices->k_min_Q_B;
+  k_max_Q_B  = matrices->k_max_Q_B;
+
+  Q_M             = matrices->Q_M;
+  l_min_Q_M  = matrices->l_min_Q_M;
+  l_max_Q_M  = matrices->l_max_Q_M;
+  k_min_Q_M  = matrices->k_min_Q_M;
+  k_max_Q_M  = matrices->k_max_Q_M;
+
+  Q_M1            = matrices->Q_M1;
+  l_min_Q_M1 = matrices->l_min_Q_M1;
+  l_max_Q_M1 = matrices->l_max_Q_M1;
+  k_min_Q_M1 = matrices->k_min_Q_M1;
+  k_max_Q_M1 = matrices->k_max_Q_M1;
+
+
+  Q_B_rem        = matrices->Q_B_rem;
+  Q_M_rem        = matrices->Q_M_rem;
+  Q_M1_rem       = matrices->Q_M1_rem;
+
+  matrices->Q_c_rem   = 0.;
+  matrices->Q_cH_rem  = 0.;
+  matrices->Q_cI_rem  = 0.;
+  matrices->Q_cM_rem  = 0.;
+
+
+  /* construct qm2 matrix from qm1 entries  */
+#ifdef _OPENMP
+  #pragma omp parallel for private(d, k, l, da, db, cnt1, cnt2, cnt3, cnt4)
+#endif
+  for(k=1; k<seq_length-TURN-1; k++){
+    int k_min_Q_M2, k_max_Q_M2, l_min_Q_M2, l_max_Q_M2;
+    int k_min_post_m2, k_max_post_m2, *l_min_post_m2, *l_max_post_m2;
+    int update_m2 = 0;
+    if(!matrices->Q_M2[k]){
+      update_m2 = 1;
+      k_min_Q_M2 = l_min_Q_M2 = 0;
+      k_max_Q_M2 = mm1[my_iindx[k]-seq_length] + referenceBPs1[my_iindx[k] - seq_length];
+      l_max_Q_M2 = mm2[my_iindx[k]-seq_length] + referenceBPs2[my_iindx[k] - seq_length];
+
+      prepareBoundaries(k_min_Q_M2,
+                        k_max_Q_M2,
+                        l_min_Q_M2,
+                        l_max_Q_M2,
+                        bpdist[my_iindx[k]-seq_length],
+                        &matrices->k_min_Q_M2[k],
+                        &matrices->k_max_Q_M2[k],
+                        &matrices->l_min_Q_M2[k],
+                        &matrices->l_max_Q_M2[k]
+                        );
+      preparePosteriorBoundaries( matrices->k_max_Q_M2[k] - matrices->k_min_Q_M2[k] + 1,
+                                  matrices->k_min_Q_M2[k],
+                                  &k_min_post_m2,
+                                  &k_max_post_m2,
+                                  &l_min_post_m2,
+                                  &l_max_post_m2
+                              );
+
+      prepareArray( &matrices->Q_M2[k],
+                    matrices->k_min_Q_M2[k],
+                    matrices->k_max_Q_M2[k],
+                    matrices->l_min_Q_M2[k],
+                    matrices->l_max_Q_M2[k]
+                );
+    }
+
+    /* construct Q_M2 */
+    for (l=k+TURN+1; l<seq_length-TURN-1; l++){
+      if(Q_M1_rem[jindx[l]+k]){
+        if(Q_M1[jindx[seq_length]+l+1]){
+          for(cnt1 = k_min_Q_M1[jindx[seq_length]+l+1];
+              cnt1 <= k_max_Q_M1[jindx[seq_length]+l+1];
+              cnt1++)
+            for(cnt2 = l_min_Q_M1[jindx[seq_length]+l+1][cnt1];
+                cnt2 <= l_max_Q_M1[jindx[seq_length]+l+1][cnt1];
+                cnt2 += 2)
+              matrices->Q_M2_rem[k] += Q_M1_rem[jindx[l]+k] * Q_M1[jindx[seq_length]+l+1][cnt1][cnt2/2];
+        }
+        if(Q_M1_rem[jindx[seq_length]+l+1])
+          matrices->Q_M2_rem[k] += Q_M1_rem[jindx[l]+k] * Q_M1_rem[jindx[seq_length]+l+1];      
+      }
+      if(Q_M1_rem[jindx[seq_length]+l+1]){
+        if(Q_M1[jindx[l]+k])
+          for(cnt1 = k_min_Q_M1[jindx[l]+k];
+              cnt1 <= k_max_Q_M1[jindx[l]+k];
+              cnt1++)
+            for(cnt2 = l_min_Q_M1[jindx[l]+k][cnt1];
+                cnt2 <= l_max_Q_M1[jindx[l]+k][cnt1];
+                cnt2 += 2)
+              matrices->Q_M2_rem[k] += Q_M1[jindx[l]+k][cnt1][cnt2/2]*Q_M1_rem[jindx[seq_length]+l+1];
+      
+      }
+
+      if(matrices->Q_M1[jindx[l]+k] && matrices->Q_M1[jindx[seq_length] + l + 1]){
+        da = referenceBPs1[my_iindx[k]-seq_length] - referenceBPs1[my_iindx[k]-l] - referenceBPs1[my_iindx[l+1]-seq_length];
+        db = referenceBPs2[my_iindx[k]-seq_length] - referenceBPs2[my_iindx[k]-l] - referenceBPs2[my_iindx[l+1]-seq_length];
+        for(cnt1 = k_min_Q_M1[jindx[l]+k]; cnt1 <= k_max_Q_M1[jindx[l]+k]; cnt1++)
+          for(cnt2 = l_min_Q_M1[jindx[l]+k][cnt1]; cnt2 <= l_max_Q_M1[jindx[l]+k][cnt1]; cnt2+=2){
+            for(cnt3 = k_min_Q_M1[jindx[seq_length] + l + 1]; cnt3 <= k_max_Q_M1[jindx[seq_length] + l + 1]; cnt3++)
+              for(cnt4 = l_min_Q_M1[jindx[seq_length] + l + 1][cnt3]; cnt4 <= l_max_Q_M1[jindx[seq_length] + l + 1][cnt3]; cnt4+=2){
+                if(((cnt1 + cnt3 + da) <= maxD1) && ((cnt2 + cnt4 + db) <= maxD2)){
+                  matrices->Q_M2[k][cnt1 + cnt3 + da][(cnt2 + cnt4 + db)/2] += Q_M1[jindx[l]+k][cnt1][cnt2/2] * Q_M1[jindx[seq_length] + l + 1][cnt3][cnt4/2];
+                  if(update_m2){
+                      updatePosteriorBoundaries(cnt1 + cnt3 + da,
+                                                cnt2 + cnt4 + db,
+                                                &k_min_post_m2,
+                                                &k_max_post_m2,
+                                                &l_min_post_m2,
+                                                &l_max_post_m2
+                                                );
+                  }
+                }
+                else{
+                  matrices->Q_M2_rem[k] += Q_M1[jindx[l]+k][cnt1][cnt2/2] * Q_M1[jindx[seq_length] + l + 1][cnt3][cnt4/2];
+                }
+              }
+          }
+      }
+    }
+    if(update_m2){
+      adjustArrayBoundaries(&matrices->Q_M2[k],
+                            &matrices->k_min_Q_M2[k],
+                            &matrices->k_max_Q_M2[k],
+                            &matrices->l_min_Q_M2[k],
+                            &matrices->l_max_Q_M2[k],
+                            k_min_post_m2,
+                            k_max_post_m2,
+                            l_min_post_m2,
+                            l_max_post_m2
+                            );
+    }
+  }
+
+  base_d1 = referenceBPs1[my_iindx[1]-seq_length];
+  base_d2 = referenceBPs2[my_iindx[1]-seq_length];
+
+  int min_k, max_k, max_l, min_l;
+  int min_k_real, max_k_real, min_k_real_qcH, max_k_real_qcH, min_k_real_qcI, max_k_real_qcI, min_k_real_qcM, max_k_real_qcM;
+  int *min_l_real, *max_l_real, *min_l_real_qcH, *max_l_real_qcH, *min_l_real_qcI, *max_l_real_qcI,*min_l_real_qcM, *max_l_real_qcM;
+  int update_c, update_cH, update_cI, update_cM;
+
+  update_c = update_cH = update_cI = update_cM = 0;
+
+  min_k = min_l = 0;
+
+  max_k = mm1[my_iindx[1] - seq_length] + referenceBPs1[my_iindx[1] - seq_length];
+  max_l = mm2[my_iindx[1] - seq_length] + referenceBPs2[my_iindx[1] - seq_length];
+
+#ifdef _OPENMP
+  #pragma omp sections
+  {
+
+  #pragma omp section
+  {
+#endif
+  if(!matrices->Q_c){
+    update_c = 1;
+    prepareBoundaries(min_k,
+                      max_k,
+                      min_l,
+                      max_l,
+                      bpdist[my_iindx[1] - seq_length],
+                      &matrices->k_min_Q_c,
+                      &matrices->k_max_Q_c,
+                      &matrices->l_min_Q_c,
+                      &matrices->l_max_Q_c
+                      );
+    prepareArray( &matrices->Q_c,
+                  matrices->k_min_Q_c,
+                  matrices->k_max_Q_c,
+                  matrices->l_min_Q_c,
+                  matrices->l_max_Q_c
+                );
+    preparePosteriorBoundaries( max_k - min_k + 1,
+                                min_k,
+                                &min_k_real,
+                                &max_k_real,
+                                &min_l_real,
+                                &max_l_real
+                              );
+  }
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  if(!matrices->Q_cH){
+    update_cH = 1;
+    prepareBoundaries(min_k,
+                      max_k,
+                      min_l,
+                      max_l,
+                      bpdist[my_iindx[1] - seq_length],
+                      &matrices->k_min_Q_cH,
+                      &matrices->k_max_Q_cH,
+                      &matrices->l_min_Q_cH,
+                      &matrices->l_max_Q_cH
+                      );
+    prepareArray( &matrices->Q_cH,
+                  matrices->k_min_Q_cH,
+                  matrices->k_max_Q_cH,
+                  matrices->l_min_Q_cH,
+                  matrices->l_max_Q_cH
+                );
+    preparePosteriorBoundaries( max_k - min_k + 1,
+                                min_k,
+                                &min_k_real_qcH,
+                                &max_k_real_qcH,
+                                &min_l_real_qcH,
+                                &max_l_real_qcH
+                              );
+  }
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  if(!matrices->Q_cI){
+    update_cI = 1;
+    prepareBoundaries(min_k,
+                      max_k,
+                      min_l,
+                      max_l,
+                      bpdist[my_iindx[1] - seq_length],
+                      &matrices->k_min_Q_cI,
+                      &matrices->k_max_Q_cI,
+                      &matrices->l_min_Q_cI,
+                      &matrices->l_max_Q_cI
+                      );
+    prepareArray( &matrices->Q_cI,
+                  matrices->k_min_Q_cI,
+                  matrices->k_max_Q_cI,
+                  matrices->l_min_Q_cI,
+                  matrices->l_max_Q_cI
+                );
+    preparePosteriorBoundaries( max_k - min_k + 1,
+                                min_k,
+                                &min_k_real_qcI,
+                                &max_k_real_qcI,
+                                &min_l_real_qcI,
+                                &max_l_real_qcI
+                              );
+  }
+#ifdef _OPENMP
+  }
+  #pragma omp section
+  {
+#endif
+  if(!matrices->Q_cM){
+    update_cM = 1;
+    prepareBoundaries(min_k,
+                      max_k,
+                      min_l,
+                      max_l,
+                      bpdist[my_iindx[1] - seq_length],
+                      &matrices->k_min_Q_cM,
+                      &matrices->k_max_Q_cM,
+                      &matrices->l_min_Q_cM,
+                      &matrices->l_max_Q_cM
+                      );
+    prepareArray( &matrices->Q_cM,
+                  matrices->k_min_Q_cM,
+                  matrices->k_max_Q_cM,
+                  matrices->l_min_Q_cM,
+                  matrices->l_max_Q_cM
+                );
+    preparePosteriorBoundaries( max_k - min_k + 1,
+                                min_k,
+                                &min_k_real_qcM,
+                                &max_k_real_qcM,
+                                &min_l_real_qcM,
+                                &max_l_real_qcM
+                              );
+  }
+#ifdef _OPENMP
+  }
+  }
+#endif
+
+
+
+
+  for (d = TURN+2; d <= seq_length; d++) /* i,j in [1..length] */
+#ifdef _OPENMP
+    #pragma omp parallel for private(p, q, pq, k, l, kl, u, da, db, type, cnt1, cnt2, cnt3, cnt4)
+#endif
+    for (q = d; q <= seq_length; q++) {
+      FLT_OR_DBL qot;
+      char loopseq[10];
+      p = q - d + 1;
+      pq = my_iindx[p]-q;
+
+      /* 1. get exterior hairpin contribution  */
+      u = seq_length-q + p-1;
+      if (u<TURN) continue;
+      type = ptype[jindx[q] + p];
+      if (!type) continue;
+      if(((type==3)||(type==4))&&no_closingGU) continue;
+
+       /* cause we want to calc the exterior loops, we need the reversed pair type from now on  */
+      type=rtype[type];
+
+      if (u<7){
+        strcpy(loopseq , sequence+q-1);
+        strncat(loopseq, sequence, p);
+      }
+      /* get distance to reference if closing the hairpin
+      *  da = dbp(T1_[1,n}, T1_{p,q})
+      *  db = dbp(T2_{1,n}, T2_{p,q})
+      */
+      da = base_d1 - referenceBPs1[pq];
+      db = base_d2 - referenceBPs2[pq];
+      qot = exp_E_Hairpin(u, type, S1[q+1], S1[p-1],  loopseq, pf_params) * scale[u];
+      
+      if(Q_B_rem[pq])
+        matrices->Q_cH_rem += Q_B_rem[pq] * qot;
+      
+      if(Q_B[pq]){
+        for(cnt1 = k_min_Q_B[pq];
+            cnt1 <= k_max_Q_B[pq];
+            cnt1++)
+          for(cnt2 = l_min_Q_B[pq][cnt1];
+              cnt2 <= l_max_Q_B[pq][cnt1];
+              cnt2 += 2){
+            if(((cnt1 + da) <= maxD1) && ((cnt2 + db) <= maxD2)){
+              matrices->Q_cH[cnt1 + da][(cnt2 + db)/2] += Q_B[pq][cnt1][cnt2/2] * qot;
+              if(update_cH){
+                updatePosteriorBoundaries(cnt1 + da,
+                                      cnt2 + db,
+                                      &min_k_real_qcH,
+                                      &max_k_real_qcH,
+                                      &min_l_real_qcH,
+                                      &max_l_real_qcH
+                                      );
+              }
+            }
+            else{
+              matrices->Q_cH_rem += Q_B[pq][cnt1][cnt2/2] * qot;
+            }
+          }
+      }
+
+      /* 2. exterior interior loops, i "define" the (k,l) pair as "outer pair"  */
+      /* so "outer type" is rtype[type[k,l]] and inner type is type[p,q]        */
+      if(Q_B_rem[pq])
+        for(k=q+1; k < seq_length; k++){
+          unsigned int ln1, lstart, ln_pre;
+          ln1 = k - q - 1;
+          if(ln1+p-1>MAXLOOP) break;
+          lstart = k + TURN + 1;
+          ln_pre = ln1 + p + seq_length;
+          if(ln_pre > lstart + MAXLOOP) lstart = ln_pre - MAXLOOP - 1;
+          for(l=lstart;l <= seq_length; l++){
+            unsigned int ln2;
+            int type2;
+            kl = my_iindx[k]-l;
+            ln2 = (p - 1) + (seq_length - l);
+
+            if((ln1+ln2) > MAXLOOP) continue;
+
+            type2 = ptype[jindx[l] + k];
+            if(!type2) continue;
+
+            qot = exp_E_IntLoop(ln2, ln1, rtype[type2], type, S1[l+1], S1[k-1], S1[p-1], S1[q+1], pf_params) * scale[ln1+ln2];
+
+            if(Q_B_rem[kl])
+              matrices->Q_cI_rem += Q_B_rem[pq] * Q_B_rem[kl] * qot;
+
+            if(Q_B[kl])
+              for(cnt1 = k_min_Q_B[kl];
+                  cnt1 <= k_max_Q_B[kl];
+                  cnt1++)
+                for(cnt2 = l_min_Q_B[kl][cnt1];
+                    cnt2 <= l_max_Q_B[kl][cnt1];
+                    cnt2 += 2)
+                  matrices->Q_cI_rem += Q_B_rem[pq] * Q_B[kl][cnt1][cnt2/2] * qot;
+          }
+        }
+
+      if(Q_B[pq])
+        for(k=q+1; k < seq_length; k++){
+          unsigned int ln1, lstart, ln_pre;
+          ln1 = k - q - 1;
+          if(ln1+p-1>MAXLOOP) break;
+          lstart = k + TURN + 1;
+          ln_pre = ln1 + p + seq_length;
+          if(ln_pre > lstart + MAXLOOP) lstart = ln_pre - MAXLOOP - 1;
+          for(l=lstart;l <= seq_length; l++){
+            unsigned int ln2;
+            int type2;
+            kl = my_iindx[k]-l;
+            ln2 = (p - 1) + (seq_length - l);
+
+            if((ln1+ln2) > MAXLOOP) continue;
+
+            type2 = ptype[jindx[l] + k];
+            if(!type2) continue;
+
+            qot = exp_E_IntLoop(ln2, ln1, rtype[type2], type, S1[l+1], S1[k-1], S1[p-1], S1[q+1], pf_params) * scale[ln1+ln2];
+
+            if(Q_B_rem[kl]){
+              for(cnt1 = k_min_Q_B[pq];
+                  cnt1 <= k_max_Q_B[pq];
+                  cnt1++)
+                for(cnt2 = l_min_Q_B[pq][cnt1];
+                    cnt2 <= l_max_Q_B[pq][cnt1];
+                    cnt2 += 2)
+                  matrices->Q_cI_rem += Q_B[pq][cnt1][cnt2/2] * Q_B_rem[kl] * qot;
+            }
+
+            if(!Q_B[kl]) continue;
+
+            /* get distance to reference if closing the interior loop
+            *  d2a = dbp(T1_[1,n}, T1_{p,q} + T1_{k,l})
+            *  d2b = dbp(T2_[1,n}, T2_{p,q} + T2_{k,l})
+            */
+            da = base_d1 - referenceBPs1[pq] - referenceBPs1[kl];
+            db = base_d2 - referenceBPs2[pq] - referenceBPs2[kl];
+
+            for(cnt1 = k_min_Q_B[pq]; cnt1 <= k_max_Q_B[pq]; cnt1++)
+              for(cnt2 = l_min_Q_B[pq][cnt1]; cnt2 <= l_max_Q_B[pq][cnt1]; cnt2+=2)
+                for(cnt3 = k_min_Q_B[kl]; cnt3 <= k_max_Q_B[kl]; cnt3++)
+                  for(cnt4 = l_min_Q_B[kl][cnt3]; cnt4 <= l_max_Q_B[kl][cnt3]; cnt4+=2){
+                    if(((cnt1 + cnt3 + da) <= maxD1) && ((cnt2 + cnt4 + db) <= maxD2)){
+                      matrices->Q_cI[cnt1 + cnt3 + da][(cnt2 + cnt4 + db)/2] += Q_B[pq][cnt1][cnt2/2] * Q_B[kl][cnt3][cnt4/2] * qot;
+                      if(update_cI){
+                        updatePosteriorBoundaries(cnt1 + cnt3 + da,
+                                                cnt2 + cnt4 + db,
+                                                &min_k_real_qcI,
+                                                &max_k_real_qcI,
+                                                &min_l_real_qcI,
+                                                &max_l_real_qcI
+                                                );
+                      }
+                    }
+                    else{
+                      matrices->Q_cI_rem += Q_B[pq][cnt1][cnt2/2] * Q_B[kl][cnt3][cnt4/2] * qot;
+                    }
+                  }
+          }
+        }
+    }
+
+  if(update_cH){
+    adjustArrayBoundaries(&matrices->Q_cH,
+                          &matrices->k_min_Q_cH,
+                          &matrices->k_max_Q_cH,
+                          &matrices->l_min_Q_cH,
+                          &matrices->l_max_Q_cH,
+                          min_k_real_qcH,
+                          max_k_real_qcH,
+                          min_l_real_qcH,
+                          max_l_real_qcH
+                        );
+  }
+  if(update_cI){
+    adjustArrayBoundaries(&matrices->Q_cI,
+                          &matrices->k_min_Q_cI,
+                          &matrices->k_max_Q_cI,
+                          &matrices->l_min_Q_cI,
+                          &matrices->l_max_Q_cI,
+                          min_k_real_qcI,
+                          max_k_real_qcI,
+                          min_l_real_qcI,
+                          max_l_real_qcI
+                        );
+  }
+
+  /* 3. Multiloops  */
+  if(seq_length > 2*TURN-3)
+#ifdef _OPENMP
+  #pragma omp parallel for private(k, da, db, cnt1, cnt2, cnt3, cnt4)
+#endif
+    for(k=TURN+2; k<seq_length-2*TURN-3; k++){
+      if(Q_M_rem[my_iindx[1]-k]){
+        if(matrices->Q_M2[k+1])
+          for(cnt1 = matrices->k_min_Q_M2[k+1];
+              cnt1 <= matrices->k_max_Q_M2[k+1];
+              cnt1++)
+            for(cnt2 = matrices->l_min_Q_M2[k+1][cnt1];
+                cnt2 <= matrices->l_max_Q_M2[k+1][cnt1];
+                cnt2 += 2)
+              matrices->Q_cM_rem += Q_M_rem[my_iindx[1]-k] * matrices->Q_M2[k+1][cnt1][cnt2/2] * pf_params->expMLclosing;
+        if(matrices->Q_M2_rem[k+1])
+          matrices->Q_cM_rem += Q_M_rem[my_iindx[1]-k] * matrices->Q_M2_rem[k+1] * pf_params->expMLclosing;
+      }
+      if(matrices->Q_M2_rem[k+1]){
+        if(Q_M[my_iindx[1]-k])
+          for(cnt1 = k_min_Q_M[my_iindx[1]-k];
+              cnt1 <= k_max_Q_M[my_iindx[1]-k];
+              cnt1++)
+            for(cnt2 = l_min_Q_M[my_iindx[1]-k][cnt1];
+                cnt2 <= l_max_Q_M[my_iindx[1]-k][cnt1];
+                cnt2 += 2)
+              matrices->Q_cM_rem += Q_M[my_iindx[1]-k][cnt1][cnt2/2] * matrices->Q_M2_rem[k+1] * pf_params->expMLclosing;
+      }
+
+      /* get distancies to references
+      * d3a = dbp(T1_[1,n}, T1_{1,k} + T1_{k+1, n})
+      * d3b = dbp(T2_[1,n}, T2_{1,k} + T2_{k+1, n})
+      */
+      da = base_d1 - referenceBPs1[my_iindx[1]-k] - referenceBPs1[my_iindx[k+1]-seq_length];
+      db = base_d2 - referenceBPs2[my_iindx[1]-k] - referenceBPs2[my_iindx[k+1]-seq_length];
+      if(Q_M[my_iindx[1]-k] && matrices->Q_M2[k+1])
+        for(cnt1 = k_min_Q_M[my_iindx[1]-k]; cnt1 <= k_max_Q_M[my_iindx[1]-k]; cnt1++)
+          for(cnt2 = l_min_Q_M[my_iindx[1]-k][cnt1]; cnt2 <= l_max_Q_M[my_iindx[1]-k][cnt1]; cnt2+=2)
+            for(cnt3 = matrices->k_min_Q_M2[k+1]; cnt3 <= matrices->k_max_Q_M2[k+1]; cnt3++)
+              for(cnt4 = matrices->l_min_Q_M2[k+1][cnt3]; cnt4 <= matrices->l_max_Q_M2[k+1][cnt3]; cnt4+=2){
+                if(((cnt1 + cnt3 + da) <= maxD1) && ((cnt2 + cnt4 + db) <= maxD2)){
+                  matrices->Q_cM[cnt1 + cnt3 + da][(cnt2 + cnt4 + db)/2] += Q_M[my_iindx[1]-k][cnt1][cnt2/2] * matrices->Q_M2[k+1][cnt3][cnt4/2] * pf_params->expMLclosing;
+                  if(update_cM){
+                    updatePosteriorBoundaries(cnt1 + cnt3 + da,
+                                            cnt2 + cnt4 + db,
+                                            &min_k_real_qcM,
+                                            &max_k_real_qcM,
+                                            &min_l_real_qcM,
+                                            &max_l_real_qcM
+                                            );
+                  }
+                }
+                else{
+                  matrices->Q_cM_rem += Q_M[my_iindx[1]-k][cnt1][cnt2/2] * matrices->Q_M2[k+1][cnt3][cnt4/2] * pf_params->expMLclosing;
+                }
+              }
+    }
+  if(update_cM){
+    adjustArrayBoundaries(&matrices->Q_cM,
+                          &matrices->k_min_Q_cM,
+                          &matrices->k_max_Q_cM,
+                          &matrices->l_min_Q_cM,
+                          &matrices->l_max_Q_cM,
+                          min_k_real_qcM,
+                          max_k_real_qcM,
+                          min_l_real_qcM,
+                          max_l_real_qcM
+                        );
+  }
+
+  for(cnt1 = matrices->k_min_Q_cH;
+      cnt1 <= matrices->k_max_Q_cH;
+      cnt1++)
+    for(cnt2 = matrices->l_min_Q_cH[cnt1];
+        cnt2 <= matrices->l_max_Q_cH[cnt1];
+        cnt2 += 2){
+      matrices->Q_c[cnt1][cnt2/2] += matrices->Q_cH[cnt1][cnt2/2];
+      if(update_c){
+        updatePosteriorBoundaries(cnt1,
+                                  cnt2,
+                                  &min_k_real,
+                                  &max_k_real,
+                                  &min_l_real,
+                                  &max_l_real
+                                  );
+      }
+    }
+  for(cnt1 = matrices->k_min_Q_cI;
+      cnt1 <= matrices->k_max_Q_cI;
+      cnt1++)
+    for(cnt2 = matrices->l_min_Q_cI[cnt1];
+        cnt2 <= matrices->l_max_Q_cI[cnt1];
+        cnt2 += 2){
+      matrices->Q_c[cnt1][cnt2/2] += matrices->Q_cI[cnt1][cnt2/2];
+      if(update_c){
+        updatePosteriorBoundaries(cnt1,
+                                  cnt2,
+                                  &min_k_real,
+                                  &max_k_real,
+                                  &min_l_real,
+                                  &max_l_real
+                                  );
+      }
+    }
+  for(cnt1 = matrices->k_min_Q_cM;
+      cnt1 <= matrices->k_max_Q_cM;
+      cnt1++)
+    for(cnt2 = matrices->l_min_Q_cM[cnt1];
+        cnt2 <= matrices->l_max_Q_cM[cnt1];
+        cnt2 += 2){
+      matrices->Q_c[cnt1][cnt2/2] += matrices->Q_cM[cnt1][cnt2/2];
+      if(update_c){
+        updatePosteriorBoundaries(cnt1,
+                                  cnt2,
+                                  &min_k_real,
+                                  &max_k_real,
+                                  &min_l_real,
+                                  &max_l_real
+                                  );
+      }
+    }
+
+  matrices->Q_c_rem   = matrices->Q_cH_rem + matrices->Q_cI_rem + matrices->Q_cM_rem;
+
+  /* add the case were structure is unfolded chain */
+  if((referenceBPs1[my_iindx[1]-seq_length] <= maxD1) && (referenceBPs2[my_iindx[1]-seq_length] <= maxD2)){
+    matrices->Q_c[referenceBPs1[my_iindx[1]-seq_length]][referenceBPs2[my_iindx[1]-seq_length]/2] += 1.0 * scale[seq_length];
+    if(update_c){
+      updatePosteriorBoundaries(referenceBPs1[my_iindx[1]-seq_length],
+                              referenceBPs2[my_iindx[1]-seq_length],
+                              &min_k_real,
+                              &max_k_real,
+                              &min_l_real,
+                              &max_l_real
+                              );
+    }
+  }
+  else{
+    matrices->Q_c_rem += 1.0 * scale[seq_length];
+  }
+
+  adjustArrayBoundaries(&matrices->Q_c,
+                        &matrices->k_min_Q_c,
+                        &matrices->k_max_Q_c,
+                        &matrices->l_min_Q_c,
+                        &matrices->l_max_Q_c,
+                        min_k_real,
+                        max_k_real,
+                        min_l_real,
+                        max_l_real
+                      );
+}
+
+/*
+* ###################################################
+* stochastic backtracking
+* ###################################################
+*/
+
+PUBLIC char *
+vrna_pbacktrack_TwoD( vrna_fold_compound_t *vc,
+                      int d1,
+                      int d2){
+
+  return vrna_pbacktrack5_TwoD(vc, d1, d2, vc->length);
+}
+
+PUBLIC char *
+vrna_pbacktrack5_TwoD(vrna_fold_compound_t *vc,
+                      int d1,
+                      int d2,
+                      unsigned int length){
+
+  char            *pstruc, *ptype;
+  short           *S1;
+  unsigned int    i, j, n, start, maxD1, maxD2, da, db,
+                  *referenceBPs1, *referenceBPs2;
+  int             *my_iindx, *jindx, ij, cnt1, cnt2, cnt3, cnt4, type,
+                  **l_min_Q, **l_max_Q,
+                  **l_min_Q_B, **l_max_Q_B,
+                  *k_min_Q, *k_max_Q,
+                  *k_min_Q_B, *k_max_Q_B;
+  FLT_OR_DBL      r, qt, *scale, ***Q, ***Q_B, *Q_rem, *Q_B_rem;
+  vrna_exp_param_t  *pf_params;
+  vrna_md_t         *md;
+  vrna_mx_pf_t      *matrices;
+
+  n               = vc->length;
+  pf_params       = vc->exp_params;
+  md              = &(pf_params->model_details);
+  matrices        = vc->exp_matrices;
+  maxD1           = vc->maxD1;
+  maxD2           = vc->maxD2;
+  my_iindx        = vc->iindx;
+  jindx           = vc->jindx;
+  scale           = matrices->scale;
+  ptype           = vc->ptype;
+  S1              = vc->sequence_encoding;
+  referenceBPs1   = vc->referenceBPs1;
+  referenceBPs2   = vc->referenceBPs2;
+
+  Q               = matrices->Q;
+  l_min_Q    = matrices->l_min_Q;
+  l_max_Q    = matrices->l_max_Q;
+  k_min_Q    = matrices->k_min_Q;
+  k_max_Q    = matrices->k_max_Q;
+
+  Q_B             = matrices->Q_B;
+  l_min_Q_B  = matrices->l_min_Q_B;
+  l_max_Q_B  = matrices->l_max_Q_B;
+  k_min_Q_B  = matrices->k_min_Q_B;
+  k_max_Q_B  = matrices->k_max_Q_B;
+
+  Q_rem           = matrices->Q_rem;
+  Q_B_rem         = matrices->Q_B_rem;
+
+  if(md->circ){
+    if(n != length)
+      vrna_message_error("vrna_pbacktrack_TwoD@2Dfold.c: cotranscriptional backtracking for circular RNAs not supported!");
+    return pbacktrack_circ(vc, d1, d2);
+  }
+
+  if(length > n)
+    vrna_message_error("vrna_pbacktrack_TwoD@2Dpfold.c: requested transcript length exceeds sequence length!");
+
+#if 0
+  if(d1 > maxD1)
+    vrna_message_error("pbacktrack@2Dpfold.c: distance to 1st reference structure to high!");
+  if(d2 > maxD2)
+    vrna_message_error("pbacktrack@2Dpfold.c: distance to 2nd reference structure to high!");
+#endif
+
+  /* check whether the chosen neighborhood exists at all */
+  int dumb = 1;
+  ij = my_iindx[1]-length;
+  if((d1 == -1) && (Q_rem[ij] != 0.)) dumb = 0;
+  else{
+    if((k_min_Q[ij] <= d1) && (k_max_Q[ij] >= d1)){
+      int l_min = l_min_Q[ij][d1];
+      if((d2 % 2) == (l_min%2))
+        if((l_min <= d2) && (l_max_Q[ij][d1] >= d2))
+          dumb = 0;
+    }
+  }
+  if(dumb){
+    vrna_message_error("neighborhood %d:%d is not in scope of calculated partition function!\n"
+                              "pbacktrack@2Dpfold.c: exiting...",
+                              d1, d2);
+  }
+
+  pstruc = vrna_alloc((length+1)*sizeof(char));
+
+  for (i=0; i<length; i++) pstruc[i] = '.';
+  pstruc[i] = '\0';
+
+  start = 1;
+  while (start<length) {
+    int sn = my_iindx[start] - length;
+    /* find i position of first pair */
+    FLT_OR_DBL qln_i = 0, qln_i1 = 0;
+
+    if(d1 == -1){
+      qln_i = Q_rem[sn];
+
+      /* open chain ? */
+      if(   (maxD1 > referenceBPs1[sn])
+        &&  (maxD2 > referenceBPs2[sn])){
+        r = vrna_urn() * qln_i;
+        if(scale[length-start+1] > r)
+          return pstruc;
+      }
+
+      /* lets see if we find a base pair with i involved */
+      for (i=start; i<length; i++) {
+        r = vrna_urn() * qln_i;
+
+        qln_i1 = Q_rem[my_iindx[i+1] - length];
+
+        da = referenceBPs1[sn] - referenceBPs1[my_iindx[i+1] - length];
+        db = referenceBPs2[sn] - referenceBPs2[my_iindx[i+1] - length];
+
+        for(cnt1 = k_min_Q[my_iindx[i+1] - length];
+            cnt1 <= k_max_Q[my_iindx[i+1] - length];
+            cnt1++)
+          for(cnt2 = l_min_Q[my_iindx[i+1] - length][cnt1];
+              cnt2 <= l_max_Q[my_iindx[i+1] - length][cnt1];
+              cnt2 += 2)
+            if(((cnt1 + da) > maxD1) || ((cnt2 + db) > maxD2)){
+              qln_i1 += Q[my_iindx[i+1] - length][cnt1][cnt2/2];
+            }
+
+        if(r > qln_i1*scale[1]) break;
+
+        qln_i = qln_i1;
+      }
+      if (i>=length) break; /* no more pairs */
+
+      /* i is paired, find pairing partner j */
+      r = vrna_urn() * (qln_i - qln_i1*scale[1]);
+      for (qt=0, j=i+TURN+1; j<length; j++) {
+        ij = my_iindx[i]-j;
+        type = ptype[jindx[j] + i];
+        if (type) {
+          cnt1 = cnt2 = cnt3 = cnt4 = -1;
+          double qkl = exp_E_ExtLoop(type, (i>1) ? S1[i-1] : -1, S1[j+1], pf_params);
+
+          if(Q_B_rem[ij] != 0.){
+            if(Q_rem[my_iindx[j+1]-length] != 0.){
+              qt += qkl * Q_B_rem[ij] * Q_rem[my_iindx[j+1]-length];
+              if(qt >= r)
+                goto pbacktrack_ext_loop_early_escape_rem;
+            }
+            if(Q[my_iindx[j+1]-length])
+              for(cnt3 = k_min_Q[my_iindx[j+1]-length];
+                  cnt3 <= k_max_Q[my_iindx[j+1]-length];
+                  cnt3++)
+                for(cnt4 = l_min_Q[my_iindx[j+1]-length][cnt3];
+                    cnt4 <= l_max_Q[my_iindx[j+1]-length][cnt3];
+                    cnt4 += 2){
+                  qt += qkl * Q_B_rem[ij] * Q[my_iindx[j+1]-length][cnt3][cnt4/2];
+                  if(qt >= r)
+                    goto pbacktrack_ext_loop_early_escape_rem;
+                }
+          }
+          if(Q_rem[my_iindx[j+1]-length] != 0.){
+            cnt3 = cnt4 = -1;
+            if(Q_B[ij]){
+              for(cnt1 = k_min_Q_B[ij];
+                  cnt1 <= k_max_Q_B[ij];
+                  cnt1++)
+                for(cnt2 = l_min_Q_B[ij][cnt1];
+                    cnt2 <= l_max_Q_B[ij][cnt1];
+                    cnt2 += 2){
+                  qt += qkl * Q_B[ij][cnt1][cnt2/2] * Q_rem[my_iindx[j+1]-length];
+                  if(qt >= r)
+                    goto pbacktrack_ext_loop_early_escape_rem;
+                }
+            }
+          }
+          /* if we still search for pairing partner j, we go on here... */
+          if(Q_B[ij] && Q[my_iindx[j+1]-length]){
+            da = referenceBPs1[sn] - referenceBPs1[ij] - referenceBPs1[my_iindx[j+1]-length];
+            db = referenceBPs2[sn] - referenceBPs2[ij] - referenceBPs2[my_iindx[j+1]-length];
+            for(cnt1 = k_min_Q_B[ij];
+                cnt1 <= k_max_Q_B[ij];
+                cnt1++)
+              for(cnt2 = l_min_Q_B[ij][cnt1];
+                  cnt2 <= l_max_Q_B[ij][cnt1];
+                  cnt2 += 2)
+                for(cnt3 = k_min_Q[my_iindx[j+1]-length];
+                    cnt3 <= k_max_Q[my_iindx[j+1]-length];
+                    cnt3++)
+                  for(cnt4 = l_min_Q[my_iindx[j+1]-length][cnt3];
+                      cnt4 <= l_max_Q[my_iindx[j+1]-length][cnt3];
+                      cnt4 += 2)
+                    if(((cnt1 + cnt3 + da) > maxD1) || ((cnt2 + cnt4 + db) > maxD2)){
+                      qt += qkl * Q_B[ij][cnt1][cnt2/2] * Q[my_iindx[j+1]-length][cnt3][cnt4/2];
+                      if(qt >= r)
+                        goto pbacktrack_ext_loop_early_escape_rem;
+                    }
+          }
+        } /* end if(type) */
+      } /* end for(j) */
+      cnt1 = cnt2 = cnt3 = cnt4 = -1;
+      /* dont forget the case where i pairs with n */
+      j = length;
+      ij = my_iindx[i]-j;
+      type = ptype[jindx[j] + i];
+      if (type) {
+        double qkl = exp_E_ExtLoop(type, (i>1) ? S1[i-1] : -1, (j<n) ? S1[j+1] : -1, pf_params);
+        if(Q_B_rem[ij] != 0.){
+          qt += qkl * Q_B_rem[ij];
+          if(qt >= r)
+            goto pbacktrack_ext_loop_early_escape_rem;
+        }
+        /* if we still search for pairing partner j, we go on here... */
+        if(Q_B[ij]){
+          da = referenceBPs1[sn] - referenceBPs1[ij];
+          db = referenceBPs2[sn] - referenceBPs2[ij];
+          for(cnt1 = k_min_Q_B[ij];
+              cnt1 <= k_max_Q_B[ij];
+              cnt1++)
+            for(cnt2 = l_min_Q_B[ij][cnt1];
+                cnt2 <= l_max_Q_B[ij][cnt1];
+                cnt2 += 2)
+              if(((cnt1 + da) > maxD1) || ((cnt2 + db) > maxD2)){
+                qt += qkl * Q_B[ij][cnt1][cnt2/2];
+                if(qt >= r)
+                  goto pbacktrack_ext_loop_early_escape_rem;
+              }
+        }
+      } /* end if(type) */
+      j++;
+
+pbacktrack_ext_loop_early_escape_rem:
+
+      if (j==length+1){
+        vrna_message_error("pbacktrack@2Dpfold.c: backtracking failed in ext loop (rem)");
+      }
+
+      /* finally start backtracking the first exterior stem */
+      backtrack(vc, pstruc, cnt1, cnt2, i,j);
+      if(j==length) break;
+      start = j+1;
+      d1 = cnt3;
+      d2 = cnt4;
+
+    } /* end if d1 ==-1 */
+    else{
+      qln_i = Q[sn][d1][d2/2];
+
+      /* open chain ? */
+      if(   (d1 == referenceBPs1[sn])
+        &&  (d2 == referenceBPs2[sn])){
+        r = vrna_urn() * qln_i;
+        if(scale[length-start+1] > r)
+          return pstruc;
+      }
+
+      for (i=start; i<length; i++) {
+        r = vrna_urn() * qln_i;
+        da = referenceBPs1[sn] - referenceBPs1[my_iindx[i+1] - length];
+        db = referenceBPs2[sn] - referenceBPs2[my_iindx[i+1] - length];
+        qln_i1 = 0;
+        if(d1 >= da && d2 >= db)
+          if(
+              (d1-da >= k_min_Q[my_iindx[i+1] - length])
+           && (d1 - da <= k_max_Q[my_iindx[i+1] - length]))
+            if(
+                  (d2 - db >= l_min_Q[my_iindx[i+1] - length][d1 - da])
+              &&  (d2 - db <= l_max_Q[my_iindx[i+1] - length][d1 - da]))
+              qln_i1 += Q[my_iindx[i+1] - length][d1-da][(d2-db)/2];
+        if (r > qln_i1*scale[1])  break; /* i is paired */
+        qln_i = qln_i1;
+      }
+
+      if (i>=length) break; /* no more pairs */
+
+      /* now find the pairing partner j */
+      r = vrna_urn() * (qln_i - qln_i1*scale[1]);
+
+      for (qt=0, j=i+1; j<length; j++) {
+        int type;
+        ij = my_iindx[i]-j;
+        type = ptype[jindx[j] + i];
+        if (type) {
+          double qkl = 1.0;
+          qkl *= exp_E_ExtLoop(type, (i>1) ? S1[i-1] : -1, S1[j+1], pf_params);
+
+          da = referenceBPs1[sn] - referenceBPs1[ij] - referenceBPs1[my_iindx[j+1]-length];
+          db = referenceBPs2[sn] - referenceBPs2[ij] - referenceBPs2[my_iindx[j+1]-length];
+
+          if(   (d1 >= da)
+            &&  (d2 >= db)
+            &&  Q_B[ij]
+            &&  Q[my_iindx[j+1]-length])
+            for(cnt1 = k_min_Q_B[ij];
+                cnt1 <= MIN2(k_max_Q_B[ij], d1-da);
+                cnt1++)
+              for(cnt2 = l_min_Q_B[ij][cnt1];
+                  cnt2 <= MIN2(l_max_Q_B[ij][cnt1], d2-db);
+                  cnt2+=2)
+                if(   (d1-da-cnt1 >= k_min_Q[my_iindx[j+1]-length])
+                  &&  (d1-da-cnt1 <= k_max_Q[my_iindx[j+1]-length]))
+                  if(   (d2 - db - cnt2 >= l_min_Q[my_iindx[j+1]-length][d1-da-cnt1]) 
+                    &&  (d2 - db - cnt2 <= l_max_Q[my_iindx[j+1]-length][d1-da-cnt1])){
+                    qt += qkl * Q_B[ij][cnt1][cnt2/2] * Q[my_iindx[j+1]-length][d1-da-cnt1][(d2-db-cnt2)/2];
+                    if(qt >= r)
+                      goto pbacktrack_ext_loop_early_escape;
+                  }
+        }
+      }
+      /* now dont forget the case j==n */
+      j = length;
+      ij = my_iindx[i]-j;
+      int type = ptype[jindx[j] + i];
+      if (type) {
+        double qkl = 1.0;
+
+        qkl *= exp_E_ExtLoop(type, (i>1) ? S1[i-1] : -1, (j<n) ? S1[j+1] : -1, pf_params);
+
+        da = referenceBPs1[sn] - referenceBPs1[ij];
+        db = referenceBPs2[sn] - referenceBPs2[ij];
+        if(d1 >= da && d2 >= db){
+          cnt1 = d1 - da;
+          cnt2 = d2 - db;
+          if((cnt1 >= k_min_Q_B[ij]) && (cnt1 <= k_max_Q_B[ij]))
+            if((cnt2 >= l_min_Q_B[ij][cnt1]) && (cnt2 <= l_max_Q_B[ij][cnt1])){
+              qt += qkl * Q_B[ij][cnt1][cnt2/2];
+              if(qt >= r)
+                goto pbacktrack_ext_loop_early_escape; /* j is paired */
+            }
+        }
+      }
+      j++;
+
+pbacktrack_ext_loop_early_escape:
+
+      if (j==length+1){
+        vrna_message_error("pbacktrack@2Dpfold.c: backtracking failed in ext loop");
+      }
+
+      backtrack(vc, pstruc, cnt1, cnt2, i,j);
+
+      if(j==length) break;
+      start = j+1;
+      d1 -= cnt1 + da;
+      d2 -= cnt2 + db;
+    } /* end if d1!=-1 */
+  }
+  return pstruc;
+}
+
+
+PRIVATE char *
+pbacktrack_circ(vrna_fold_compound_t *vc,
+                int d1,
+                int d2){
+
+  char            *pstruc;
+  unsigned int    i, n, maxD1, maxD2,
+                  *referenceBPs1, *referenceBPs2;
+  int             *my_iindx,
+                  k_min_Q_c, k_max_Q_c,
+                  k_min_Q_cH, k_max_Q_cH,
+                  k_min_Q_cI, k_max_Q_cI,
+                  k_min_Q_cM, k_max_Q_cM,
+                  *l_min_Q_c, *l_max_Q_c,
+                  *l_min_Q_cH, *l_max_Q_cH,
+                  *l_min_Q_cI, *l_max_Q_cI,
+                  *l_min_Q_cM, *l_max_Q_cM;
+  FLT_OR_DBL      r, *scale, qot,
+                  **Q_c, **Q_cH, **Q_cI, **Q_cM,
+                  Q_c_rem, Q_cH_rem, Q_cI_rem, Q_cM_rem;
+  vrna_mx_pf_t      *matrices;
+  vrna_md_t         *md;
+  vrna_exp_param_t  *pf_params;
+
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  matrices          = vc->exp_matrices;
+  n                 = vc->length;
+  maxD1             = vc->maxD1;
+  maxD2             = vc->maxD2;
+  my_iindx          = vc->iindx;
+  scale             = matrices->scale;
+  referenceBPs1     = vc->referenceBPs1;
+  referenceBPs2     = vc->referenceBPs2;
+
+  Q_c               = matrices->Q_c;
+  l_min_Q_c   = matrices->l_min_Q_c;
+  l_max_Q_c   = matrices->l_max_Q_c;
+  k_min_Q_c   = matrices->k_min_Q_c;
+  k_max_Q_c   = matrices->k_max_Q_c;
+
+  Q_cH              = matrices->Q_cH;
+  l_min_Q_cH  = matrices->l_min_Q_cH;
+  l_max_Q_cH  = matrices->l_max_Q_cH;
+  k_min_Q_cH  = matrices->k_min_Q_cH;
+  k_max_Q_cH  = matrices->k_max_Q_cH;
+
+  Q_cI              = matrices->Q_cI;
+  l_min_Q_cI  = matrices->l_min_Q_cI;
+  l_max_Q_cI  = matrices->l_max_Q_cI;
+  k_min_Q_cI  = matrices->k_min_Q_cI;
+  k_max_Q_cI  = matrices->k_max_Q_cI;
+
+  Q_cM              = matrices->Q_cM;
+  l_min_Q_cM  = matrices->l_min_Q_cM;
+  l_max_Q_cM  = matrices->l_max_Q_cM;
+  k_min_Q_cM  = matrices->k_min_Q_cM;
+  k_max_Q_cM  = matrices->k_max_Q_cM;
+
+  Q_c_rem           = matrices->Q_c_rem;
+  Q_cH_rem          = matrices->Q_cH_rem;
+  Q_cI_rem          = matrices->Q_cI_rem;
+  Q_cM_rem          = matrices->Q_cM_rem;
+
+  /* check whether the chosen neighborhood exists at all */
+  int dumb = 1;
+  if((d1 == -1) && (Q_c_rem != 0.)) dumb = 0;
+  else{
+    if((k_min_Q_c <= d1) && (k_max_Q_c >= d1)){
+      int l_min = l_min_Q_c[d1];
+      if((d2 % 2) == (l_min%2))
+        if((l_min <= d2) && (l_max_Q_c[d1] >= d2))
+          dumb = 0;
+    }
+  }
+  if(dumb){
+    vrna_message_error("neighborhood %d:%d is not in scope of calculated partition function!\n"
+                              "pbacktrack_circ@2Dpfold.c: exiting cheerless...",
+                              d1, d2);
+  }
+
+  pstruc = vrna_alloc((n+1)*sizeof(char));
+
+  for (i=0; i<n; i++) pstruc[i] = '.';
+  pstruc[i] = '\0';
+
+  /* now we come to the actual backtracking process */
+
+  qot = 0.;
+  /* backtrack in rest-partition */
+  if(d1 == -1){
+    r = vrna_urn() * Q_c_rem;
+    /* open chain ? */
+    if((referenceBPs1[my_iindx[1]-n] > maxD1) || (referenceBPs2[my_iindx[1]-n] > maxD2)){
+      qot = 1.0 * scale[n];
+      if(qot >= r)
+        goto pbacktrack_circ_escape;
+    }
+    qot += Q_cH_rem;
+    if(qot >= r){
+      backtrack_qcH(vc, pstruc, d1, d2);
+      goto pbacktrack_circ_escape;
+    }
+    qot += Q_cI_rem;
+    if(qot >= r){
+      backtrack_qcI(vc, pstruc, d1, d2);
+      goto pbacktrack_circ_escape;
+    }
+    qot += Q_cM_rem;
+    if(qot >= r){
+      backtrack_qcM(vc, pstruc, d1, d2);
+      goto pbacktrack_circ_escape;
+    }
+    vrna_message_error("pbacktrack_circ@2Dpfold.c: backtracking failed in exterior loop! Exiting cheerless...");
+  }
+  /* normal backtracking */
+  else{
+    r = vrna_urn() * Q_c[d1][d2/2];
+
+    /* open chain ? */
+    if((referenceBPs1[my_iindx[1]-n] == d1) && (referenceBPs2[my_iindx[1]-n] == d2)){
+      qot += 1.0 * scale[n];
+      if(qot >= r)
+        goto pbacktrack_circ_escape;
+    }
+
+    /* exterior hairpin loop ? */
+    if((k_min_Q_cH <= d1) && (k_max_Q_cH >= d1)){
+      int l_min = l_min_Q_cH[d1];
+      if((d2 % 2) == (l_min%2))
+        if((l_min <= d2) && (l_max_Q_cH[d1] >= d2)){
+          qot += Q_cH[d1][d2/2];
+          if(qot >= r){
+            backtrack_qcH(vc, pstruc, d1, d2);
+            goto pbacktrack_circ_escape;
+          }
+        }
+    }
+
+    /* exterior interior loop ? */
+    if((k_min_Q_cI <= d1) && (k_max_Q_cI >= d1)){
+      int l_min = l_min_Q_cI[d1];
+      if((d2 % 2) == (l_min%2))
+        if((l_min <= d2) && (l_max_Q_cI[d1] >= d2)){
+          qot += Q_cI[d1][d2/2];
+          if(qot >= r){
+            backtrack_qcI(vc, pstruc, d1, d2);
+            goto pbacktrack_circ_escape;
+          }
+        }
+    }
+
+    /* exterior multibranch loop ? */
+    if((k_min_Q_cM <= d1) && (k_max_Q_cM >= d1)){
+      int l_min = l_min_Q_cM[d1];
+      if((d2 % 2) == (l_min%2))
+        if((l_min <= d2) && (l_max_Q_cM[d1] >= d2)){
+          qot += Q_cM[d1][d2/2];
+          if(qot >= r){
+            backtrack_qcM(vc, pstruc, d1, d2);
+            goto pbacktrack_circ_escape;
+          }
+        }
+    }
+  }
+
+pbacktrack_circ_escape:
+  return pstruc;
+}
+
+
+
+PRIVATE void
+backtrack_qcH(vrna_fold_compound_t *vc,
+              char *pstruc,
+              int d1,
+              int d2){
+
+  char            *ptype, *sequence;
+  short           *S1;
+  unsigned int    i, j, n, maxD1, maxD2,
+                  base_d1, base_d2, da, db,
+                  *referenceBPs1, *referenceBPs2;
+  int             u, *my_iindx, *jindx, ij, cnt1, cnt2,type,
+                  **l_min_Q_B, **l_max_Q_B,
+                  *k_min_Q_B, *k_max_Q_B, *rtype;
+  FLT_OR_DBL      r, qt, *scale, qot,
+                  ***Q_B, **Q_cH, *Q_B_rem,
+                  Q_cH_rem;
+
+  vrna_exp_param_t  *pf_params;
+  vrna_md_t         *md;
+  vrna_mx_pf_t      *matrices;
+
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  matrices          = vc->exp_matrices;
+  sequence          = vc->sequence;
+  n                 = vc->length;
+  my_iindx          = vc->iindx;
+  jindx             = vc->jindx;
+  scale             = matrices->scale;
+  ptype             = vc->ptype;
+  rtype           = &(md->rtype[0]);
+  S1                = vc->sequence_encoding;
+  referenceBPs1     = vc->referenceBPs1;
+  referenceBPs2     = vc->referenceBPs2;
+  maxD1             = vc->maxD1;
+  maxD2             = vc->maxD2;
+
+  Q_B_rem           = matrices->Q_B_rem;
+  Q_B               = matrices->Q_B;
+  l_min_Q_B    = matrices->l_min_Q_B;
+  l_max_Q_B    = matrices->l_max_Q_B;
+  k_min_Q_B    = matrices->k_min_Q_B;
+  k_max_Q_B    = matrices->k_max_Q_B;
+
+  Q_cH_rem          = matrices->Q_cH_rem;
+  Q_cH              = matrices->Q_cH;
+
+  qot = qt = 0.;
+
+  base_d1 = referenceBPs1[my_iindx[1]-n];
+  base_d2 = referenceBPs2[my_iindx[1]-n];
+
+  if(d1 == -1){
+    r = vrna_urn() * Q_cH_rem;
+    for(i=1;i<n;i++)
+      for(j=i+TURN+1;j<=n;j++){
+        char loopseq[10];
+        ij = my_iindx[i]-j;
+        u = n-j + i-1;
+        if (u<TURN) continue;
+        type = ptype[jindx[j] + i];
+        if (!type) continue;
+        if(((type==3)||(type==4))&&no_closingGU) continue;
+        type=rtype[type];
+        if (u<7){
+          strcpy(loopseq , sequence+j-1);
+          strncat(loopseq, sequence, i);
+        }
+        qt  = exp_E_Hairpin(u, type,
+                            S1[j+1], S1[i-1],
+                            loopseq, pf_params)
+              * scale[u];
+
+        if(Q_B_rem[ij]){
+          qot += Q_B_rem[ij] * qt;
+          if(qot >= r){
+            backtrack(vc, pstruc, d1, d2, i, j);
+            return;
+          }
+        }
+
+        da = base_d1 - referenceBPs1[ij];
+        db = base_d2 - referenceBPs2[ij];
+
+        if(Q_B[ij]){
+          for(cnt1 = k_min_Q_B[ij];
+              cnt1 <= k_max_Q_B[ij];
+              cnt1++)
+            for(cnt2 = l_min_Q_B[ij][cnt1];
+                cnt2 <= l_max_Q_B[ij][cnt1];
+                cnt2 += 2){
+              if(     ((cnt1 + da) > maxD1)
+                  ||  ((cnt2 + db) > maxD2)){
+                qot += Q_B[ij][cnt1][cnt2/2] * qt;
+                if(qot >= r){
+                  backtrack(vc, pstruc, cnt1, cnt2, i, j);
+                  return;
+                }
+              }
+            }
+        }
+    }
+  }
+  else{
+    r = vrna_urn() * Q_cH[d1][d2/2];
+    for(i=1;i<n;i++)
+      for(j=i+TURN+1;j<=n;j++){
+        char loopseq[10];
+        ij = my_iindx[i]-j;
+        if(!Q_B[ij]) continue;
+        u = n-j + i-1;
+        if (u<TURN) continue;
+        type = ptype[jindx[j] + i];
+        if (!type) continue;
+        if(((type==3)||(type==4))&&no_closingGU) continue;
+        type=rtype[type];
+        if (u<7){
+          strcpy(loopseq , sequence+j-1);
+          strncat(loopseq, sequence, i);
+        }
+        qt  = exp_E_Hairpin(u, type,
+                            S1[j+1], S1[i-1],
+                            loopseq, pf_params)
+              * scale[u];
+        da  = base_d1 - referenceBPs1[ij];
+        db  = base_d2 - referenceBPs2[ij];
+
+        for(cnt1 = k_min_Q_B[ij];
+            cnt1 <= k_max_Q_B[ij];
+            cnt1++)
+          for(cnt2 = l_min_Q_B[ij][cnt1];
+              cnt2 <= l_max_Q_B[ij][cnt1];
+              cnt2 += 2){
+            if( ((cnt1 + da) == d1)
+                && ((cnt2 + db) == d2)){
+              qot += Q_B[ij][cnt1][cnt2/2] * qt;
+              if(qot >= r){
+                backtrack(vc, pstruc, cnt1, cnt2, i, j);
+                return;
+              }
+            }
+          }
+      }
+  }
+  vrna_message_error("backtrack_qcH@2Dpfold.c: failed to find closing pair!");
+}
+
+PRIVATE void  backtrack_qcI(vrna_fold_compound_t *vc,
+                            char *pstruc,
+                            int d1, int d2){
+
+  char            *ptype;
+  short           *S1;
+  unsigned int    i, j, ij, p, q, pq, n, maxD1, maxD2,
+                  base_d1, base_d2, da, db,
+                  *referenceBPs1, *referenceBPs2;
+  int             *my_iindx, *jindx, cnt1, cnt2, cnt3, cnt4, type,
+                  **l_min_Q_B, **l_max_Q_B,
+                  *k_min_Q_B, *k_max_Q_B, *rtype;
+  FLT_OR_DBL      r, qt, *scale, qot,
+                  ***Q_B, *Q_B_rem,
+                  **Q_cI, Q_cI_rem;
+  vrna_exp_param_t       *pf_params;
+  vrna_md_t         *md;
+  vrna_mx_pf_t      *matrices;
+
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  matrices          = vc->exp_matrices;
+  n                 = vc->length;
+  my_iindx          = vc->iindx;
+  jindx             = vc->jindx;
+  scale             = matrices->scale;
+  ptype             = vc->ptype;
+  rtype           = &(md->rtype[0]);
+  S1                = vc->sequence_encoding;
+  referenceBPs1     = vc->referenceBPs1;
+  referenceBPs2     = vc->referenceBPs2;
+  maxD1             = vc->maxD1;
+  maxD2             = vc->maxD2;
+
+  Q_B               = matrices->Q_B;
+  l_min_Q_B    = matrices->l_min_Q_B;
+  l_max_Q_B    = matrices->l_max_Q_B;
+  k_min_Q_B    = matrices->k_min_Q_B;
+  k_max_Q_B    = matrices->k_max_Q_B;
+
+  Q_cI              = matrices->Q_cI;
+  Q_B_rem           = matrices->Q_B_rem;
+  Q_cI_rem          = matrices->Q_cI_rem;
+
+  qot = qt = 0.;
+
+  base_d1 = referenceBPs1[my_iindx[1]-n];
+  base_d2 = referenceBPs2[my_iindx[1]-n];
+
+  if(d1 == -1){
+    r = vrna_urn() * Q_cI_rem;
+    for(i=1;i<n;i++)
+      for(j=i+TURN+1;j<=n;j++){
+        ij = my_iindx[i]-j;
+        type = rtype[(unsigned int)ptype[jindx[j] + i]];
+        if(!type) continue;
+
+        if(Q_B_rem[ij])
+          for(p=j+1; p < n; p++){
+            unsigned int ln1, qstart, ln_pre;
+            ln1 = p - j - 1;
+            if(ln1+i-1>MAXLOOP) break;
+            qstart = p + TURN + 1;
+            ln_pre = ln1 + i + n;
+            if(ln_pre > qstart + MAXLOOP)
+              qstart = ln_pre - MAXLOOP - 1;
+            for(q=qstart;q <= n; q++){
+              unsigned int ln2;
+              int type2;
+              pq = my_iindx[p]-q;
+              ln2 = (i - 1) + (n - q);
+              if((ln1+ln2) > MAXLOOP) continue;
+              type2 = ptype[jindx[q] + p];
+              if(!type2) continue;
+              qt  = exp_E_IntLoop(ln2, ln1,
+                                  rtype[type2], type,
+                                  S1[q+1], S1[p-1],
+                                  S1[i-1], S1[j+1],
+                                  pf_params)
+                    * scale[ln1 + ln2];
+              if(Q_B_rem[pq]){
+                qot +=  Q_B_rem[ij] * Q_B_rem[pq] * qt;
+                if(qot > r){
+                  backtrack(vc, pstruc, d1, d2, i, j);
+                  backtrack(vc, pstruc, d1, d2, p, q);
+                  return;
+                }
+              }
+              if(Q_B[pq])
+                for(cnt1 = k_min_Q_B[pq];
+                    cnt1 <= k_max_Q_B[pq];
+                    cnt1++)
+                  for(cnt2 = l_min_Q_B[pq][cnt1];
+                      cnt2 <= l_max_Q_B[pq][cnt1];
+                      cnt2 += 2){
+                    qot +=  Q_B_rem[ij] * Q_B[pq][cnt1][cnt2/2] * qt;
+                    if(qot > r){
+                      backtrack(vc, pstruc, d1, d2, i, j);
+                      backtrack(vc, pstruc, cnt1, cnt2, p, q);
+                      return;
+                    }
+                  }
+            }
+          }
+
+        if(Q_B[ij]){
+          for(p=j+1; p < n; p++){
+            unsigned int ln1, qstart, ln_pre;
+            ln1 = p - j - 1;
+            if(ln1+i-1>MAXLOOP) break;
+            qstart = p + TURN + 1;
+            ln_pre = ln1 + i + n;
+            if(ln_pre > qstart + MAXLOOP)
+              qstart = ln_pre - MAXLOOP - 1;
+            for(q=qstart;q <= n; q++){
+              unsigned int ln2;
+              int type2;
+              pq = my_iindx[p]-q;
+              ln2 = (i - 1) + (n - q);
+              if((ln1+ln2) > MAXLOOP) continue;
+              type2 = ptype[jindx[q] + p];
+              if(!type2) continue;
+              qt  = exp_E_IntLoop(ln2, ln1,
+                                  rtype[type2], type,
+                                  S1[q+1], S1[p-1],
+                                  S1[i-1], S1[j+1],
+                                  pf_params)
+                    * scale[ln1 + ln2];
+              if(Q_B_rem[pq])
+                for(cnt1 = k_min_Q_B[ij];
+                    cnt1 <= k_max_Q_B[ij];
+                    cnt1++)
+                  for(cnt2 = l_min_Q_B[ij][cnt1];
+                      cnt2 <= l_max_Q_B[ij][cnt1];
+                      cnt2 += 2){
+                    qot +=  Q_B[ij][cnt1][cnt2/2] * Q_B_rem[pq] * qt;
+                    if(qot > r){
+                      backtrack(vc, pstruc, cnt1, cnt2, i, j);
+                      backtrack(vc, pstruc, d1, d2, p, q);
+                      return;
+                    }
+                  }
+              if(Q_B[pq]){
+                da  = base_d1
+                      - referenceBPs1[ij]
+                      - referenceBPs1[pq];
+                db  = base_d2
+                      - referenceBPs2[ij]
+                      - referenceBPs2[pq];
+                for(cnt1 = k_min_Q_B[ij];
+                    cnt1 <= k_max_Q_B[ij];
+                    cnt1++)
+                  for(cnt2 = l_min_Q_B[ij][cnt1];
+                      cnt2 <= l_max_Q_B[ij][cnt1];
+                      cnt2 += 2)
+                    for(cnt3 = k_min_Q_B[pq];
+                        cnt3 <= k_max_Q_B[pq];
+                        cnt3++)
+                      for(cnt4 = l_min_Q_B[pq][cnt3];
+                          cnt4 <= l_max_Q_B[pq][cnt3];
+                          cnt4 += 2){
+                        if(     ((cnt1 + cnt3 + da) > maxD1)
+                            ||  ((cnt2 + cnt4 + db) > maxD2)){
+                          qot +=  Q_B[ij][cnt1][cnt2/2]
+                                  * Q_B[pq][cnt3][cnt4/2]
+                                  * qt;
+                          if(qot > r){
+                            backtrack(vc, pstruc, cnt1, cnt2, i, j);
+                            backtrack(vc, pstruc, cnt3, cnt4, p, q);
+                            return;
+                          }
+                        }
+                      }
+              }
+            }
+          }
+        }
+
+      }
+  }
+  else{
+    r = vrna_urn() * Q_cI[d1][d2/2];
+    for(i=1;i<n;i++)
+      for(j=i+TURN+1;j<=n;j++){
+        ij = my_iindx[i]-j;
+        type = rtype[(unsigned int)ptype[jindx[j] + i]];
+        if(!type) continue;
+        if(!Q_B[ij]) continue;
+        for(p=j+1; p < n; p++){
+          unsigned int ln1, qstart, ln_pre;
+          ln1 = p - j - 1;
+          if(ln1+i-1>MAXLOOP) break;
+          qstart = p + TURN + 1;
+          ln_pre = ln1 + i + n;
+          if(ln_pre > qstart + MAXLOOP)
+            qstart = ln_pre - MAXLOOP - 1;
+          for(q=qstart;q <= n; q++){
+            unsigned int ln2;
+            int type2;
+            pq    = my_iindx[p]-q;
+            if(!Q_B[pq]) continue;
+            ln2   = (i - 1) + (n - q);
+            if((ln1+ln2) > MAXLOOP) continue;
+            type2 = ptype[jindx[q] + p];
+            if(!type2) continue;
+            qt  = exp_E_IntLoop( ln2, ln1,
+                                rtype[type2], type,
+                                S1[q+1], S1[p-1],
+                                S1[i-1], S1[j+1],
+                                pf_params)
+                  * scale[ln1 + ln2];
+            da  = base_d1
+                  - referenceBPs1[ij]
+                  - referenceBPs1[pq];
+            db  = base_d2
+                  - referenceBPs2[ij]
+                  - referenceBPs2[pq];
+            for(cnt1 = k_min_Q_B[ij];
+                cnt1 <= k_max_Q_B[ij];
+                cnt1++)
+              for(cnt2 = l_min_Q_B[ij][cnt1];
+                  cnt2 <= l_max_Q_B[ij][cnt1];
+                  cnt2 += 2)
+                for(cnt3 = k_min_Q_B[pq];
+                    cnt3 <= k_max_Q_B[pq];
+                    cnt3++)
+                  for(cnt4 = l_min_Q_B[pq][cnt3];
+                      cnt4 <= l_max_Q_B[pq][cnt3];
+                      cnt4 += 2){
+                    if(     ((cnt1 + cnt3 + da) == d1)
+                        &&  ((cnt2 + cnt4 + db) == d2)){
+                      qot +=  Q_B[ij][cnt1][cnt2/2]
+                              * Q_B[pq][cnt3][cnt4/2]
+                              * qt;
+                      if(qot > r){
+                        backtrack(vc, pstruc, cnt1, cnt2, i, j);
+                        backtrack(vc, pstruc, cnt3, cnt4, p, q);
+                        return;
+                      }
+                    }
+                  }
+          }
+        }
+      }
+  }
+}
+
+PRIVATE void  backtrack_qcM(vrna_fold_compound_t *vc,
+                            char *pstruc,
+                            int d1, int d2){
+
+  unsigned int  k, n, maxD1, maxD2, base_d1, base_d2,
+                da, db, *referenceBPs1, *referenceBPs2;
+  int           *my_iindx, cnt1, cnt2, cnt3, cnt4,
+                **l_min_Q_M, **l_max_Q_M,
+                **l_min_Q_M2, **l_max_Q_M2,
+                *k_min_Q_M, *k_max_Q_M,
+                *k_min_Q_M2, *k_max_Q_M2;
+  FLT_OR_DBL    r, qt, qot,
+                ***Q_M, ***Q_M2, **Q_cM,
+                *Q_M_rem, *Q_M2_rem, Q_cM_rem;
+  vrna_exp_param_t  *pf_params;
+  vrna_md_t         *md;
+  vrna_mx_pf_t      *matrices;
+
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  matrices          = vc->exp_matrices;
+  n                 = vc->length;
+  my_iindx          = vc->iindx;
+  referenceBPs1     = vc->referenceBPs1;
+  referenceBPs2     = vc->referenceBPs2;
+  maxD1             = vc->maxD1;
+  maxD2             = vc->maxD2;
+
+  Q_cM              = matrices->Q_cM;
+
+  Q_M               = matrices->Q_M;
+  l_min_Q_M    = matrices->l_min_Q_M;
+  l_max_Q_M    = matrices->l_max_Q_M;
+  k_min_Q_M    = matrices->k_min_Q_M;
+  k_max_Q_M    = matrices->k_max_Q_M;
+
+  Q_M2              = matrices->Q_M2;
+  l_min_Q_M2   = matrices->l_min_Q_M2;
+  l_max_Q_M2   = matrices->l_max_Q_M2;
+  k_min_Q_M2   = matrices->k_min_Q_M2;
+  k_max_Q_M2   = matrices->k_max_Q_M2;
+
+  Q_cM_rem          = matrices->Q_cM_rem;
+  Q_M_rem           = matrices->Q_M_rem;
+  Q_M2_rem          = matrices->Q_M2_rem;
+
+  base_d1 = referenceBPs1[my_iindx[1]-n];
+  base_d2 = referenceBPs2[my_iindx[1]-n];
+  qot     = qt = 0.;
+
+  if(d1 == -1){
+    r = vrna_urn() * Q_cM_rem;
+    for(k = TURN + 2;
+        k < n - 2 * TURN - 3;
+        k++){
+
+      if(Q_M_rem[my_iindx[1]-k]){
+
+        if(Q_M2[k+1])
+          for(cnt1 = k_min_Q_M2[k+1];
+              cnt1 <= k_max_Q_M2[k+1];
+              cnt1++)
+            for(cnt2 = l_min_Q_M2[k+1][cnt1];
+                cnt2 <= l_max_Q_M2[k+1][cnt1];
+                cnt2 += 2){
+              qot +=  Q_M_rem[my_iindx[1]-k]
+                      * Q_M2[k+1][cnt1][cnt2/2]
+                      * pf_params->expMLclosing;
+              if(qot > r){
+                backtrack_qm(vc, pstruc, d1, d2, 1, k);
+                backtrack_qm2(vc, pstruc, cnt1, cnt2, k+1);
+                return;
+              }
+            }
+
+        if(Q_M2_rem[k+1]){
+          qot +=  Q_M_rem[my_iindx[1]-k]
+                  * Q_M2_rem[k+1]
+                  * pf_params->expMLclosing;
+          if(qot > r){
+            backtrack_qm(vc, pstruc, d1, d2, 1, k);
+            backtrack_qm2(vc, pstruc, d1, d2, k+1);
+            return;
+          }
+        }
+
+      }
+
+      if(Q_M2_rem[k+1]){
+
+        if(Q_M[my_iindx[1]-k])
+          for(cnt1 = k_min_Q_M[my_iindx[1]-k];
+              cnt1 <= k_max_Q_M[my_iindx[1]-k];
+              cnt1++)
+            for(cnt2 = l_min_Q_M[my_iindx[1]-k][cnt1];
+                cnt2 <= l_max_Q_M[my_iindx[1]-k][cnt1];
+                cnt2 += 2){
+              qot +=  Q_M[my_iindx[1]-k][cnt1][cnt2/2]
+                      * Q_M2_rem[k+1]
+                      * pf_params->expMLclosing;
+              if(qot > r){
+                backtrack_qm(vc, pstruc, cnt1, cnt2, 1, k);
+                backtrack_qm2(vc, pstruc, d1, d2, k+1);
+                return;
+              }
+            }
+
+      }
+
+      da  = base_d1
+            - referenceBPs1[my_iindx[1]-k]
+            - referenceBPs1[my_iindx[k+1]-n];
+      db  = base_d2
+            - referenceBPs2[my_iindx[1]-k]
+            - referenceBPs2[my_iindx[k+1]-n];
+
+      if(     Q_M[my_iindx[1]-k]
+          &&  Q_M2[k+1])
+        for(cnt1 = k_min_Q_M[my_iindx[1]-k];
+            cnt1 <= k_max_Q_M[my_iindx[1]-k];
+            cnt1++)
+          for(cnt2 = l_min_Q_M[my_iindx[1]-k][cnt1];
+              cnt2 <= l_max_Q_M[my_iindx[1]-k][cnt1];
+              cnt2 += 2)
+            for(cnt3 = k_min_Q_M2[k+1];
+                cnt3 <= k_max_Q_M2[k+1];
+                cnt3++)
+              for(cnt4 = l_min_Q_M2[k+1][cnt3];
+                  cnt4 <= l_max_Q_M2[k+1][cnt3];
+                  cnt4 += 2){
+                if(     ((cnt1 + cnt3 + da) > maxD1)
+                    ||  ((cnt2 + cnt4 + db) > maxD2)){
+                  qot   +=  Q_M[my_iindx[1]-k][cnt1][cnt2/2]
+                            * Q_M2[k+1][cnt3][cnt4/2]
+                            * pf_params->expMLclosing;
+                  if(qot > r){
+                    backtrack_qm(vc, pstruc, cnt1, cnt2, 1, k);
+                    backtrack_qm2(vc, pstruc, cnt3, cnt4, k+1);
+                    return;
+                  }
+                }
+              }
+
+    }
+  }
+  else{
+    r = vrna_urn() * Q_cM[d1][d2/2];
+    for(k = TURN + 2;
+        k < n - 2 * TURN - 3;
+        k++){
+      da  = base_d1
+            - referenceBPs1[my_iindx[1]-k]
+            - referenceBPs1[my_iindx[k+1]-n];
+      db  = base_d2
+            - referenceBPs2[my_iindx[1]-k]
+            - referenceBPs2[my_iindx[k+1]-n];
+        if(     Q_M[my_iindx[1]-k]
+            &&  Q_M2[k+1])
+          for(cnt1 = k_min_Q_M[my_iindx[1]-k];
+              cnt1 <= k_max_Q_M[my_iindx[1]-k];
+              cnt1++)
+            for(cnt2 = l_min_Q_M[my_iindx[1]-k][cnt1];
+                cnt2 <= l_max_Q_M[my_iindx[1]-k][cnt1];
+                cnt2 += 2)
+              for(cnt3 = k_min_Q_M2[k+1];
+                  cnt3 <= k_max_Q_M2[k+1];
+                  cnt3++)
+                for(cnt4 = l_min_Q_M2[k+1][cnt3];
+                    cnt4 <= l_max_Q_M2[k+1][cnt3];
+                    cnt4 += 2)
+                  if(     ((cnt1 + cnt3 + da) == d1)
+                      &&  ((cnt2 + cnt4 + db) == d2)){
+                    qot +=  Q_M[my_iindx[1]-k][cnt1][cnt2/2]
+                            * Q_M2[k+1][cnt3][cnt4/2]
+                            * pf_params->expMLclosing;
+                    if(qot > r){
+                      backtrack_qm(vc, pstruc, cnt1, cnt2, 1, k);
+                      backtrack_qm2(vc, pstruc, cnt3, cnt4, k+1);
+                      return;
+                    }
+                  }
+    }
+  }
+  vrna_message_error("backtrack_qcM@2Dpfold.c: backtracking failed");
+}
+
+PRIVATE void
+backtrack_qm2(vrna_fold_compound_t *vc,
+              char *pstruc,
+              int d1,
+              int d2,
+              unsigned int k){
+
+  unsigned int  l, n, maxD1, maxD2, da, db,
+                *referenceBPs1, *referenceBPs2;
+  int           *my_iindx, *jindx, cnt1, cnt2, cnt3, cnt4,
+                *k_min_Q_M1, *k_max_Q_M1,
+                **l_min_Q_M1, **l_max_Q_M1;
+  FLT_OR_DBL    r, qt, qot,
+                ***Q_M2, ***Q_M1,
+                *Q_M2_rem, *Q_M1_rem;
+
+  vrna_exp_param_t  *pf_params;     /* holds all [unscaled] pf parameters */
+  vrna_md_t         *md;
+  vrna_mx_pf_t      *matrices;
+
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  matrices          = vc->exp_matrices;
+
+  n               = vc->length;
+  my_iindx        = vc->iindx;
+  jindx           = vc->jindx;
+  referenceBPs1   = vc->referenceBPs1;
+  referenceBPs2   = vc->referenceBPs2;
+  maxD1           = vc->maxD1;
+  maxD2           = vc->maxD2;
+
+  Q_M1_rem        = matrices->Q_M1_rem;
+  Q_M1            = matrices->Q_M1;
+  l_min_Q_M1 = matrices->l_min_Q_M1;
+  l_max_Q_M1 = matrices->l_max_Q_M1;
+  k_min_Q_M1 = matrices->k_min_Q_M1;
+  k_max_Q_M1 = matrices->k_max_Q_M1;
+
+  Q_M2_rem        = matrices->Q_M2_rem;
+  Q_M2            = matrices->Q_M2;
+
+  qot = qt = 0.;
+
+  if(d1 == -1){
+    r = vrna_urn() * Q_M2_rem[k];
+    for (l=k+TURN+1; l<n-TURN-1; l++){
+      if(Q_M1_rem[jindx[l]+k]){
+        if(Q_M1[jindx[n]+l+1]){
+          for(cnt1 = k_min_Q_M1[jindx[n]+l+1];
+              cnt1 <= k_max_Q_M1[jindx[n]+l+1];
+              cnt1++)
+            for(cnt2 = l_min_Q_M1[jindx[n]+l+1][cnt1];
+                cnt2 <= l_max_Q_M1[jindx[n]+l+1][cnt1];
+                cnt2 += 2){
+              qot += Q_M1_rem[jindx[l]+k] * Q_M1[jindx[n]+l+1][cnt1][cnt2/2];
+              if(qot > r){
+                backtrack_qm1(vc, pstruc, d1, d2, k, l);
+                backtrack_qm1(vc, pstruc, cnt1, cnt2, l+1, n);
+                return;
+              }
+            }
+        }
+        if(Q_M1_rem[jindx[n]+l+1]){
+          qot +=  Q_M1_rem[jindx[l]+k]
+                  * Q_M1_rem[jindx[n]+l+1];
+          if(qot > r){
+            backtrack_qm1(vc, pstruc, d1, d2, k, l);
+            backtrack_qm1(vc, pstruc, d1, d2, l+1, n);
+            return;
+          }
+        }
+      }
+      if(Q_M1_rem[jindx[n]+l+1]){
+        if(Q_M1[jindx[l]+k])
+          for(cnt1 = k_min_Q_M1[jindx[l]+k];
+              cnt1 <= k_max_Q_M1[jindx[l]+k];
+              cnt1++)
+            for(cnt2 = l_min_Q_M1[jindx[l]+k][cnt1];
+                cnt2 <= l_max_Q_M1[jindx[l]+k][cnt1];
+                cnt2 += 2){
+              qot +=  Q_M1[jindx[l]+k][cnt1][cnt2/2]
+                      * Q_M1_rem[jindx[n]+l+1];
+              if(qot > r){
+                backtrack_qm1(vc, pstruc, cnt1, cnt2, k, l);
+                backtrack_qm1(vc, pstruc, d1, d2, l+1, n);
+                return;
+              }
+            }
+      }
+
+      if(!Q_M1[jindx[l]+k]) continue;
+      if(!Q_M1[jindx[n] + l + 1]) continue;
+
+      da  = referenceBPs1[my_iindx[k]-n]
+            - referenceBPs1[my_iindx[k]-l]
+            - referenceBPs1[my_iindx[l+1]-n];
+      db  = referenceBPs2[my_iindx[k]-n]
+            - referenceBPs2[my_iindx[k]-l]
+            - referenceBPs2[my_iindx[l+1]-n];
+      for(cnt1 = k_min_Q_M1[jindx[l]+k];
+          cnt1 <= k_max_Q_M1[jindx[l]+k];
+          cnt1++)
+        for(cnt2 = l_min_Q_M1[jindx[l]+k][cnt1];
+            cnt2 <= l_max_Q_M1[jindx[l]+k][cnt1];
+            cnt2 += 2){
+          for(cnt3 = k_min_Q_M1[jindx[n] + l + 1];
+              cnt3 <= k_max_Q_M1[jindx[n] + l + 1];
+              cnt3++)
+            for(cnt4 = l_min_Q_M1[jindx[n] + l + 1][cnt3];
+                cnt4 <= l_max_Q_M1[jindx[n] + l + 1][cnt3];
+                cnt4 += 2){
+              if(    ((cnt1 + cnt3 + da) > maxD1)
+                  || ((cnt2 + cnt4 + db) > maxD2)){
+                qot +=  Q_M1[jindx[l]+k][cnt1][cnt2/2]
+                        * Q_M1[jindx[n] + l + 1][cnt3][cnt4/2];
+                if(qot > r){
+                  backtrack_qm1(vc, pstruc, cnt1, cnt2, k, l);
+                  backtrack_qm1(vc, pstruc, cnt3, cnt4, l+1, n);
+                  return;
+                }
+              }
+            }
+        }
+    }
+
+  }
+  else{
+    r = vrna_urn() * Q_M2[k][d1][d2/2];
+    for (l=k+TURN+1; l<n-TURN-1; l++){
+      if(!Q_M1[jindx[l]+k]) continue;
+      if(!Q_M1[jindx[n] + l + 1]) continue;
+
+      da  = referenceBPs1[my_iindx[k]-n]
+            - referenceBPs1[my_iindx[k]-l]
+            - referenceBPs1[my_iindx[l+1]-n];
+      db  = referenceBPs2[my_iindx[k]-n]
+            - referenceBPs2[my_iindx[k]-l]
+            - referenceBPs2[my_iindx[l+1]-n];
+      for(cnt1 = k_min_Q_M1[jindx[l]+k];
+          cnt1 <= k_max_Q_M1[jindx[l]+k];
+          cnt1++)
+        for(cnt2 = l_min_Q_M1[jindx[l]+k][cnt1];
+            cnt2 <= l_max_Q_M1[jindx[l]+k][cnt1];
+            cnt2 += 2){
+          for(cnt3 = k_min_Q_M1[jindx[n] + l + 1];
+              cnt3 <= k_max_Q_M1[jindx[n] + l + 1];
+              cnt3++)
+            for(cnt4 = l_min_Q_M1[jindx[n] + l + 1][cnt3];
+                cnt4 <= l_max_Q_M1[jindx[n] + l + 1][cnt3];
+                cnt4 += 2){
+              if(     ((cnt1 + cnt3 + da) == d1)
+                  &&  ((cnt2 + cnt4 + db) == d2)){
+                qot +=  Q_M1[jindx[l]+k][cnt1][cnt2/2]
+                        * Q_M1[jindx[n] + l + 1][cnt3][cnt4/2];
+                if(qot > r){
+                  backtrack_qm1(vc, pstruc, cnt1, cnt2, k, l);
+                  backtrack_qm1(vc, pstruc, cnt3, cnt4, l+1, n);
+                  return;
+                }
+              }
+            }
+        }
+    }
+  }
+  vrna_message_error("backtrack_qm2@2Dpfold.c: backtracking failed");
+}
+
+
+PRIVATE void
+backtrack(vrna_fold_compound_t *vc,
+          char *pstruc,
+          int d1,
+          int d2,
+          unsigned int i,
+          unsigned int j) {
+
+  FLT_OR_DBL      *scale;
+  unsigned int    maxD1, maxD2, base_d1, base_d2, da, db;
+  unsigned int    *referenceBPs1, *referenceBPs2;
+  char            *ptype, *sequence;
+  short           *S1, *reference_pt1, *reference_pt2;
+  int             *my_iindx, *jindx, ij, cnt1, cnt2, cnt3, cnt4, *rtype;
+  vrna_exp_param_t  *pf_params;     /* holds all [unscaled] pf parameters */
+  vrna_md_t         *md;
+  vrna_mx_pf_t      *matrices;
+
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  matrices          = vc->exp_matrices;
+  sequence    = vc->sequence;
+  maxD1       = vc->maxD1;
+  maxD2       = vc->maxD2;
+  my_iindx    = vc->iindx;
+  jindx       = vc->jindx;
+  scale       = matrices->scale;
+  ptype       = vc->ptype;
+  rtype           = &(md->rtype[0]);
+  S1              = vc->sequence_encoding;
+  reference_pt1   = vc->reference_pt1;
+  reference_pt2   = vc->reference_pt2;
+  referenceBPs1   = vc->referenceBPs1;
+  referenceBPs2   = vc->referenceBPs2;
+
+  FLT_OR_DBL  ***Q_B, ***Q_M, ***Q_M1, *Q_B_rem, *Q_M_rem, *Q_M1_rem;
+  int         *k_min_Q_M, *k_max_Q_M,*k_min_Q_M1, *k_max_Q_M1,*k_min_Q_B, *k_max_Q_B;
+  int         **l_min_Q_M, **l_max_Q_M,**l_min_Q_M1, **l_max_Q_M1,**l_min_Q_B, **l_max_Q_B;
+
+  Q_B = matrices->Q_B;
+  k_min_Q_B = matrices->k_min_Q_B;
+  k_max_Q_B = matrices->k_max_Q_B;
+  l_min_Q_B = matrices->l_min_Q_B;
+  l_max_Q_B = matrices->l_max_Q_B;
+
+  Q_M = matrices->Q_M;
+  k_min_Q_M = matrices->k_min_Q_M;
+  k_max_Q_M = matrices->k_max_Q_M;
+  l_min_Q_M = matrices->l_min_Q_M;
+  l_max_Q_M = matrices->l_max_Q_M;
+
+  Q_M1 = matrices->Q_M1;
+  k_min_Q_M1 = matrices->k_min_Q_M1;
+  k_max_Q_M1 = matrices->k_max_Q_M1;
+  l_min_Q_M1 = matrices->l_min_Q_M1;
+  l_max_Q_M1 = matrices->l_max_Q_M1;
+
+  Q_B_rem   = matrices->Q_B_rem;
+  Q_M_rem   = matrices->Q_M_rem;
+  Q_M1_rem  = matrices->Q_M1_rem;
+
+  do {
+    double r, qbt1 = 0.;
+    unsigned int k, l, u, u1;
+    int type;
+
+    pstruc[i-1] = '('; pstruc[j-1] = ')';
+
+    r = 0.;
+    ij = my_iindx[i]-j;
+
+    if(d1 == -1){
+      r= vrna_urn() * Q_B_rem[ij];
+      if(r == 0.) vrna_message_error("backtrack@2Dpfold.c: backtracking failed\n");
+      
+      type = ptype[jindx[j] + i];
+      u = j-i-1;
+      base_d1 = ((unsigned int)reference_pt1[i] != j) ? 1 : -1;
+      base_d2 = ((unsigned int)reference_pt2[i] != j) ? 1 : -1;
+
+      da = base_d1 + referenceBPs1[ij];
+      db = base_d2 + referenceBPs2[ij];
+
+      /* hairpin ? */
+      if((da > maxD1) || (db > maxD2))
+        if(!(((type==3)||(type==4))&&no_closingGU))
+          qbt1 = exp_E_Hairpin(u, type, S1[i+1], S1[j-1], sequence+i-1, pf_params) * scale[u+2];
+
+      if (qbt1>=r) return; /* found the hairpin we're done */
+
+      /* lets see if we form an interior loop */
+      for (k=i+1; k<=MIN2(i+MAXLOOP+1,j-TURN-2); k++) {
+        unsigned int u_pre, lmin;
+        u1 = k-i-1;
+        lmin = k + TURN + 1;
+        u_pre = u1 + j;
+        /* lmin = MAX2(k + TURN + 1, u1 + j - 1 - MAXLOOP) */
+        if(u_pre > lmin + MAXLOOP) lmin = u_pre - 1 - MAXLOOP;
+        for (l=lmin; l<j; l++) {
+          int type_2;
+          type_2 = ptype[jindx[l]+k];
+          if (type_2) {
+            cnt1 = cnt2 = -1;
+            da = base_d1 + referenceBPs1[my_iindx[i]-j] - referenceBPs1[my_iindx[k]-l];
+            db = base_d2 + referenceBPs2[my_iindx[i]-j] - referenceBPs2[my_iindx[k]-l];
+            type_2 = rtype[type_2];
+            FLT_OR_DBL tmp_en = exp_E_IntLoop(u1, j-l-1, type, type_2, S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params) * scale[u1+j-l+1];
+
+            if(Q_B_rem[my_iindx[k]-l] != 0.){
+              qbt1 += Q_B_rem[my_iindx[k]-l] * tmp_en;
+              if(qbt1 > r) goto backtrack_int_early_escape_rem;
+            }
+
+            if(Q_B[my_iindx[k]-l])
+              for(cnt1 = k_min_Q_B[my_iindx[k]-l];
+                  cnt1 <= k_max_Q_B[my_iindx[k]-l];
+                  cnt1++)
+                for(cnt2 = l_min_Q_B[my_iindx[k]-l][cnt1];
+                    cnt2 <= l_max_Q_B[my_iindx[k]-l][cnt1];
+                    cnt2 += 2)
+                  if(((cnt1 + da) > maxD1) || ((cnt2 + db) > maxD2)){
+                    qbt1 += Q_B[my_iindx[k]-l][cnt1][cnt2/2] * tmp_en;
+                    if(qbt1 > r) goto backtrack_int_early_escape_rem;
+                  }
+          }
+        }
+      }
+backtrack_int_early_escape_rem:
+      if (l<j) {
+        i=k; j=l;
+        d1 = cnt1;
+        d2 = cnt2;
+      }
+      else break;
+    }
+    else{
+
+      if((d1 >= k_min_Q_B[ij]) && (d1 <= k_max_Q_B[ij]))
+        if((d2 >= l_min_Q_B[ij][d1]) && (d2 <= l_max_Q_B[ij][d1]))
+          r = vrna_urn() * Q_B[ij][d1][d2/2];
+
+      if(r == 0.) vrna_message_error("backtrack@2Dpfold.c: backtracking failed\n");
+
+      type = ptype[jindx[j] + i];
+      u = j-i-1;
+      base_d1 = ((unsigned int)reference_pt1[i] != j) ? 1 : -1;
+      base_d2 = ((unsigned int)reference_pt2[i] != j) ? 1 : -1;
+
+      da = base_d1 + referenceBPs1[ij];
+      db = base_d2 + referenceBPs2[ij];
+
+      /*hairpin contribution*/
+      if((da == d1) && (db == d2))
+        if(!(((type==3)||(type==4))&&no_closingGU))
+          qbt1 = exp_E_Hairpin(u, type, S1[i+1], S1[j-1], sequence+i-1, pf_params) * scale[u+2];
+
+      if (qbt1>=r) return; /* found the hairpin we're done */
+
+      for (k=i+1; k<=MIN2(i+MAXLOOP+1,j-TURN-2); k++) {
+        unsigned int u_pre, lmin;
+        u1 = k-i-1;
+        lmin = k + TURN + 1;
+        u_pre = u1 + j;
+        /* lmin = MAX2(k + TURN + 1, u1 + j - 1 - MAXLOOP) */
+        if(u_pre > lmin + MAXLOOP) lmin = u_pre - 1 - MAXLOOP;
+        for (l=lmin; l<j; l++) {
+          int type_2;
+          type_2 = ptype[jindx[l]+k];
+          if (type_2) {
+            da = base_d1 + referenceBPs1[my_iindx[i]-j] - referenceBPs1[my_iindx[k]-l];
+            db = base_d2 + referenceBPs2[my_iindx[i]-j] - referenceBPs2[my_iindx[k]-l];
+            type_2 = rtype[type_2];
+            FLT_OR_DBL tmp_en = exp_E_IntLoop(u1, j-l-1, type, type_2, S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params) * scale[u1+j-l+1];
+            if(d1 >= da && d2 >= db)
+              if((d1 - da >= k_min_Q_B[my_iindx[k]-l]) && (d1 - da <= k_max_Q_B[my_iindx[k]-l]))
+                if((d2 - db >= l_min_Q_B[my_iindx[k]-l][d1 - da]) && (d2 - db <= l_max_Q_B[my_iindx[k]-l][d1 - da])){
+                  cnt1 = d1 - da;
+                  cnt2 = d2 - db;
+                  qbt1 += Q_B[my_iindx[k]-l][cnt1][cnt2/2] * tmp_en;
+                  if(qbt1 > r) goto backtrack_int_early_escape;
+                }
+          }
+        }
+      }
+
+backtrack_int_early_escape:
+      if (l<j) {
+        i=k; j=l;
+        d1 = cnt1;
+        d2 = cnt2;
+      }
+      else break;
+    }
+  } while (1);
+
+  /* backtrack in multi-loop */
+  {
+    double r, qt;
+    unsigned int k, ii, jj;
+
+    base_d1 = ((unsigned int)reference_pt1[i] != j) ? 1 : -1;
+    base_d2 = ((unsigned int)reference_pt2[i] != j) ? 1 : -1;
+
+    base_d1 += referenceBPs1[my_iindx[i]-j];
+    base_d2 += referenceBPs2[my_iindx[i]-j];
+
+    i++; j--;
+    /* find the first split index */
+    ii = my_iindx[i]; /* ii-j=[i,j] */
+    jj = jindx[j]; /* jj+i=[j,i] */
+    if(d1 == -1){
+      /* get total contribution for current part */
+      for (qt=0., k=i+1; k<j; k++){
+        if(Q_M_rem[ii-k+1] != 0.){
+          if(Q_M1[jj+k])
+            for(cnt1 = k_min_Q_M1[jj+k];
+                cnt1 <= k_max_Q_M1[jj+k];
+                cnt1++)
+              for(cnt2 = l_min_Q_M1[jj+k][cnt1];
+                  cnt2 <= l_max_Q_M1[jj+k][cnt1];
+                  cnt2 += 2)
+                qt += Q_M_rem[ii-k+1] * Q_M1[jj+k][cnt1][cnt2/2];
+          if(Q_M1_rem[jj+k] != 0.)
+            qt += Q_M_rem[ii-k+1] * Q_M1_rem[jj+k];
+        }
+        if(Q_M1_rem[jj+k] != 0.){
+          if(Q_M[ii-k+1])
+            for(cnt1 = k_min_Q_M[ii-k+1];
+                cnt1 <= k_max_Q_M[ii-k+1];
+                cnt1++)
+              for(cnt2 = l_min_Q_M[ii-k+1][cnt1];
+                  cnt2 <= l_max_Q_M[ii-k+1][cnt1];
+                  cnt2 += 2)
+                qt += Q_M[ii-k+1][cnt1][cnt2/2] * Q_M1_rem[jj+k];
+        }
+        /* calculate introduced distance to reference structures */
+        if(!Q_M[ii-k+1]) continue;
+        if(!Q_M1[jj+k]) continue;
+        da = base_d1 - referenceBPs1[my_iindx[i]-k+1] - referenceBPs1[my_iindx[k]-j];
+        db = base_d2 - referenceBPs2[my_iindx[i]-k+1] - referenceBPs2[my_iindx[k]-j];
+        /* collect all contributing energies */
+        for(cnt1 = k_min_Q_M[ii-k+1];
+            cnt1 <= k_max_Q_M[ii-k+1];
+            cnt1++)
+          for(cnt2 = l_min_Q_M[ii-k+1][cnt1];
+              cnt2 <= l_max_Q_M[ii-k+1][cnt1];
+              cnt2 += 2)
+            for(cnt3 = k_min_Q_M1[jj+k];
+                cnt3 <= k_max_Q_M1[jj+k];
+                cnt3++)
+              for(cnt4 = l_min_Q_M1[jj+k][cnt3];
+                  cnt4 <= l_max_Q_M1[jj+k][cnt3];
+                  cnt4 += 2)
+                if(((cnt1 + cnt3 + da) > maxD1) || ((cnt2 + cnt4 + db) > maxD2))
+                  qt += Q_M[ii-k+1][cnt1][cnt2/2] * Q_M1[jj+k][cnt3][cnt4/2];
+      }
+      /* throw the dice */
+      r = vrna_urn() * qt;
+      for (qt=0., k=i+1; k<j; k++) {
+        cnt1 = cnt2 = cnt3 = cnt4 = -1;
+        if(Q_M_rem[ii-k+1] != 0.){
+          if(Q_M1_rem[jj+k] != 0){
+            qt += Q_M_rem[ii-k+1] * Q_M1_rem[jj+k];
+            if(qt >= r) goto backtrack_ml_early_escape;
+          }
+          if(Q_M1[jj+k])
+            for(cnt3 = k_min_Q_M1[jj+k];
+                cnt3 <= k_max_Q_M1[jj+k];
+                cnt3++)
+              for(cnt4 = l_min_Q_M1[jj+k][cnt3];
+                  cnt4 <= l_max_Q_M1[jj+k][cnt3];
+                  cnt4 += 2){
+                qt += Q_M_rem[ii-k+1] * Q_M1[jj+k][cnt3][cnt4/2];
+                if(qt >= r) goto backtrack_ml_early_escape;
+              }
+        }
+        if(Q_M1_rem[jj+k] != 0.){
+          cnt3 = cnt4 = -1;
+          if(Q_M[ii-k+1])
+            for(cnt1 = k_min_Q_M[ii-k+1];
+                cnt1 <= k_max_Q_M[ii-k+1];
+                cnt1++)
+              for(cnt2 = l_min_Q_M[ii-k+1][cnt1];
+                  cnt2 <= l_max_Q_M[ii-k+1][cnt1];
+                  cnt2 += 2){
+                qt += Q_M[ii-k+1][cnt1][cnt2/2] * Q_M1_rem[jj+k];
+                if(qt >= r) goto backtrack_ml_early_escape;
+              }
+        }
+        /* calculate introduced distance to reference structures */
+        da = base_d1 - referenceBPs1[my_iindx[i]-k+1] - referenceBPs1[my_iindx[k]-j];
+        db = base_d2 - referenceBPs2[my_iindx[i]-k+1] - referenceBPs2[my_iindx[k]-j];
+        /* collect all contributing energies */
+        if(!Q_M[ii-k+1]) continue;
+        if(!Q_M1[jj+k]) continue;
+        for(cnt1 = k_min_Q_M[ii-k+1];
+            cnt1 <= k_max_Q_M[ii-k+1];
+            cnt1++)
+          for(cnt2 = l_min_Q_M[ii-k+1][cnt1];
+              cnt2 <= l_max_Q_M[ii-k+1][cnt1];
+              cnt2 += 2)
+            for(cnt3 = k_min_Q_M1[jj+k];
+                cnt3 <= k_max_Q_M1[jj+k];
+                cnt3++)
+              for(cnt4 = l_min_Q_M1[jj+k][cnt3];
+                  cnt4 <= l_max_Q_M1[jj+k][cnt3];
+                  cnt4 += 2)
+                if(((cnt1 + cnt3 + da) > maxD1) || ((cnt2 + cnt4 + db) > maxD2)){
+                  qt += Q_M[ii-k+1][cnt1][cnt2/2] * Q_M1[jj+k][cnt3][cnt4/2];
+                  if (qt>=r) goto backtrack_ml_early_escape;
+                }
+      }
+    }
+    else{
+      /* get total contribution */
+      for (qt=0., k=i+1; k<j; k++){
+        /* calculate introduced distance to reference structures */
+        da = base_d1 - referenceBPs1[my_iindx[i]-k+1] - referenceBPs1[my_iindx[k]-j];
+        db = base_d2 - referenceBPs2[my_iindx[i]-k+1] - referenceBPs2[my_iindx[k]-j];
+        /* collect all contributing energies */
+        if(d1 >= da && d2 >= db && Q_M[ii-k+1] && Q_M1[jj+k])
+          for(cnt1 = k_min_Q_M[ii-k+1]; cnt1 <= MIN2(k_max_Q_M[ii-k+1], d1-da); cnt1++)
+            for(cnt2 = l_min_Q_M[ii-k+1][cnt1]; cnt2 <= MIN2(l_max_Q_M[ii-k+1][cnt1], d2 - db); cnt2+=2)
+              if((d1-cnt1-da >= k_min_Q_M1[jj+k]) && (d1-cnt1-da <= k_max_Q_M1[jj+k]))
+                if((d2 - cnt2 - db >= l_min_Q_M1[jj+k][d1-da-cnt1]) && (d2 - cnt2 - db <= l_max_Q_M1[jj+k][d1-cnt1-da]))
+                  qt += Q_M[ii-k+1][cnt1][cnt2/2] * Q_M1[jj+k][d1-da-cnt1][(d2-db-cnt2)/2];
+      }
+      r = vrna_urn() * qt;
+      for (qt=0., k=i+1; k<j; k++) {
+        /* calculate introduced distance to reference structures */
+        da = base_d1 - referenceBPs1[my_iindx[i]-k+1] - referenceBPs1[my_iindx[k]-j];
+        db = base_d2 - referenceBPs2[my_iindx[i]-k+1] - referenceBPs2[my_iindx[k]-j];
+        /* collect all contributing energies */
+        if(d1 >= da && d2 >= db && Q_M[ii-k+1] && Q_M1[jj+k])
+          for(cnt1 = k_min_Q_M[ii-k+1]; cnt1 <= MIN2(k_max_Q_M[ii-k+1], d1-da); cnt1++)
+            for(cnt2 = l_min_Q_M[ii-k+1][cnt1]; cnt2 <= MIN2(l_max_Q_M[ii-k+1][cnt1], d2 - db); cnt2+=2)
+              if((d1-cnt1-da >= k_min_Q_M1[jj+k]) && (d1-cnt1-da <= k_max_Q_M1[jj+k]))
+                if((d2 - cnt2 - db >= l_min_Q_M1[jj+k][d1-da-cnt1]) && (d2 - cnt2 - db <= l_max_Q_M1[jj+k][d1-cnt1-da])){
+                  cnt3 = d1-da-cnt1;
+                  cnt4 = d2-db-cnt2;
+                  qt += Q_M[ii-k+1][cnt1][cnt2/2] * Q_M1[jj+k][cnt3][cnt4/2];
+                  if (qt>=r) goto backtrack_ml_early_escape;
+                }
+      }
+    }
+    if (k>=j) vrna_message_error("backtrack failed, can't find split index ");
+
+backtrack_ml_early_escape:
+
+    backtrack_qm1(vc, pstruc, cnt3, cnt4, k, j);
+
+    j = k-1;
+    backtrack_qm(vc, pstruc, cnt1, cnt2, i, j);
+  }
+}
+
+PRIVATE void
+backtrack_qm1(vrna_fold_compound_t *vc,
+              char *pstruc,
+              int d1,
+              int d2,
+              unsigned int i,
+              unsigned int j){
+
+  /* i is paired to l, i<l<j; backtrack in qm1 to find l */
+  FLT_OR_DBL      r, qt, *scale;
+  unsigned int    maxD1, maxD2, da, db;
+  unsigned int    *referenceBPs1, *referenceBPs2;
+  char            *ptype;
+  short           *S1;
+  int             *my_iindx, *jindx, cnt1, cnt2;
+
+  vrna_exp_param_t  *pf_params;     /* holds all [unscaled] pf parameters */
+  vrna_md_t         *md;
+  vrna_mx_pf_t      *matrices;
+
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  matrices          = vc->exp_matrices;
+  maxD1           = vc->maxD1;
+  maxD2           = vc->maxD2;
+  my_iindx        = vc->iindx;
+  jindx           = vc->jindx;
+  scale           = matrices->scale;
+  ptype           = vc->ptype;
+  S1              = vc->sequence_encoding;
+  referenceBPs1   = vc->referenceBPs1;
+  referenceBPs2   = vc->referenceBPs2;
+
+  FLT_OR_DBL  ***Q_B, ***Q_M1, *Q_B_rem, *Q_M1_rem;
+  int         *k_min_Q_M1, *k_max_Q_M1,*k_min_Q_B, *k_max_Q_B;
+  int         **l_min_Q_M1, **l_max_Q_M1,**l_min_Q_B, **l_max_Q_B;
+
+  Q_B = matrices->Q_B;
+  k_min_Q_B = matrices->k_min_Q_B;
+  k_max_Q_B = matrices->k_max_Q_B;
+  l_min_Q_B = matrices->l_min_Q_B;
+  l_max_Q_B = matrices->l_max_Q_B;
+
+  Q_M1 = matrices->Q_M1;
+  k_min_Q_M1 = matrices->k_min_Q_M1;
+  k_max_Q_M1 = matrices->k_max_Q_M1;
+  l_min_Q_M1 = matrices->l_min_Q_M1;
+  l_max_Q_M1 = matrices->l_max_Q_M1;
+
+  Q_B_rem   = matrices->Q_B_rem;
+  Q_M1_rem  = matrices->Q_M1_rem;
+
+  unsigned int ii, l;
+  int type;
+
+  r = 0.;
+
+  /* find qm1 contribution */
+  if(d1 == -1)
+    r = vrna_urn() * Q_M1_rem[jindx[j]+i];
+  else{
+    if((d1 >= k_min_Q_M1[jindx[j]+i]) && (d1 <= k_max_Q_M1[jindx[j]+i]))
+      if((d2 >= l_min_Q_M1[jindx[j]+i][d1]) && (d2 <= l_max_Q_M1[jindx[j]+i][d1]))
+        r = vrna_urn() * Q_M1[jindx[j]+i][d1][d2/2];
+  }
+  if(r == 0.) vrna_message_error("backtrack_qm1@2Dpfold.c: backtracking failed\n");
+
+  ii = my_iindx[i];
+  for (qt=0., l=i+TURN+1; l<=j; l++) {
+    type = ptype[jindx[l] + i];
+    if (type){
+      FLT_OR_DBL tmp = exp_E_MLstem(type, S1[i-1], S1[l+1], pf_params) * pow(pf_params->expMLbase, j-l) * scale[j-l];
+      /* compute the introduced distance to reference structures */
+      da = referenceBPs1[my_iindx[i]-j] - referenceBPs1[my_iindx[i]-l];
+      db = referenceBPs2[my_iindx[i]-j] - referenceBPs2[my_iindx[i]-l];
+      cnt1 = cnt2 = -1;
+      if(d1 == -1){
+        if(Q_B_rem[ii-l] != 0.){
+          qt += Q_B_rem[ii-l] * tmp;
+          if(qt >= r) goto backtrack_qm1_early_escape;
+        }
+        if(Q_B[ii-l])
+          for(cnt1 = k_min_Q_B[ii-l];
+              cnt1 <= k_max_Q_B[ii-l];
+              cnt1++)
+            for(cnt2 = l_min_Q_B[ii-l][cnt1];
+                cnt2 <= l_max_Q_B[ii-l][cnt1];
+                cnt2 += 2)
+              if(((cnt1 + da) > maxD1) || ((cnt2 + db) > maxD2)){
+                qt += Q_B[ii-l][cnt1][cnt2/2] * tmp;
+                if(qt >= r) goto backtrack_qm1_early_escape;
+              }
+      }
+      else{
+        /* get energy contributions */
+        if(d1 >= da && d2 >= db)
+          if((d1 - da >= k_min_Q_B[ii-l]) && (d1 - da <= k_max_Q_B[ii-l]))
+            if((d2 - db >= l_min_Q_B[ii-l][d1-da]) && (d2 - db <= l_max_Q_B[ii-l][d1-da])){
+              cnt1 = d1 - da;
+              cnt2 = d2 - db;
+              qt += Q_B[ii-l][cnt1][cnt2/2] * tmp;
+              if (qt>=r) goto backtrack_qm1_early_escape;
+            }
+      }
+    }
+  }
+  if (l>j) vrna_message_error("backtrack failed in qm1");
+backtrack_qm1_early_escape:
+
+  backtrack(vc, pstruc, cnt1, cnt2, i,l);
+}
+
+PRIVATE void
+backtrack_qm( vrna_fold_compound_t *vc,
+              char *pstruc,
+              int d1,
+              int d2,
+              unsigned int i,
+              unsigned int j){
+
+  /* divide multiloop into qm and qm1  */
+  FLT_OR_DBL      r, *scale;
+  unsigned int    maxD1, maxD2, da, db, da2, db2;
+  unsigned int    *referenceBPs1, *referenceBPs2;
+  int             *my_iindx, *jindx, cnt1, cnt2, cnt3, cnt4;
+
+  vrna_exp_param_t  *pf_params;     /* holds all [unscaled] pf parameters */
+  vrna_md_t         *md;
+  vrna_mx_pf_t      *matrices;
+
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  matrices          = vc->exp_matrices;
+  maxD1       = vc->maxD1;
+  maxD2       = vc->maxD2;
+  my_iindx    = vc->iindx;
+  jindx       = vc->jindx;
+  scale       = matrices->scale;
+  referenceBPs1  = vc->referenceBPs1;
+  referenceBPs2  = vc->referenceBPs2;
+
+  FLT_OR_DBL  ***Q_M, ***Q_M1, *Q_M_rem, *Q_M1_rem;
+  int         *k_min_Q_M, *k_max_Q_M,*k_min_Q_M1, *k_max_Q_M1;
+  int         **l_min_Q_M, **l_max_Q_M,**l_min_Q_M1, **l_max_Q_M1;
+
+  Q_M = matrices->Q_M;
+  k_min_Q_M = matrices->k_min_Q_M;
+  k_max_Q_M = matrices->k_max_Q_M;
+  l_min_Q_M = matrices->l_min_Q_M;
+  l_max_Q_M = matrices->l_max_Q_M;
+
+  Q_M1 = matrices->Q_M1;
+  k_min_Q_M1 = matrices->k_min_Q_M1;
+  k_max_Q_M1 = matrices->k_max_Q_M1;
+  l_min_Q_M1 = matrices->l_min_Q_M1;
+  l_max_Q_M1 = matrices->l_max_Q_M1;
+  Q_M_rem   = matrices->Q_M_rem;
+  Q_M1_rem  = matrices->Q_M1_rem;
+
+  double qmt = 0;
+  unsigned int k;
+  while(j>i){
+    /* now backtrack  [i ... j] in qm[] */
+
+    /* find qm contribution */
+    if(d1 == -1)
+      r = vrna_urn() * Q_M_rem[my_iindx[i]-j];
+    else{
+      if(Q_M[my_iindx[i]-j])
+        if((d1 >= k_min_Q_M[my_iindx[i]-j]) && (d1 <= k_max_Q_M[my_iindx[i]-j]))
+          if((d2 >= l_min_Q_M[my_iindx[i]-j][d1]) && (d2 <= l_max_Q_M[my_iindx[i]-j][d1]))
+            r = vrna_urn() * Q_M[my_iindx[i]-j][d1][d2/2];
+    }
+    if(r == 0.) vrna_message_error("backtrack_qm@2Dpfold.c: backtracking failed in finding qm contribution\n");
+
+    qmt = 0.;
+    if(d1 == -1){
+      if(Q_M1_rem[jindx[j]+i] != 0.){
+        qmt += Q_M1_rem[jindx[j]+i];
+        if(qmt >= r){
+          backtrack_qm1(vc, pstruc, d1, d2, i, j);
+          return;
+        }
+      }
+
+      for(k=i+1; k<=j; k++){
+        FLT_OR_DBL tmp = pow(pf_params->expMLbase, k-i) * scale[k-i];
+        if(Q_M1_rem[jindx[j]+k] != 0.){
+          qmt += Q_M1_rem[jindx[j]+k] * tmp;
+          if(qmt >= r){
+            backtrack_qm1(vc, pstruc, d1, d2, k, j);
+            return;
+          }
+        }
+        da2 = referenceBPs1[my_iindx[i]-j] - referenceBPs1[my_iindx[k]-j];
+        db2 = referenceBPs2[my_iindx[i]-j] - referenceBPs2[my_iindx[k]-j];
+        if(Q_M1[jindx[j]+k])
+          for(cnt1 = k_min_Q_M1[jindx[j]+k];
+              cnt1 <= k_max_Q_M1[jindx[j]+k];
+              cnt1++)
+            for(cnt2 = l_min_Q_M1[jindx[j]+k][cnt1];
+                cnt2 <= l_max_Q_M1[jindx[j]+k][cnt1];
+                cnt2 += 2)
+              if(((cnt1 + da2) > maxD1) || ((cnt2 + db2) > maxD2)){
+                qmt += Q_M1[jindx[j]+k][cnt1][cnt2/2] * tmp;
+                if(qmt >= r){
+                  backtrack_qm1(vc, pstruc, cnt1, cnt2, k, j);
+                  return;
+                }
+              }
+
+        da = da2 - referenceBPs1[my_iindx[i]-k+1];
+        db = db2 - referenceBPs2[my_iindx[i]-k+1];
+
+        cnt1 = cnt2 = cnt3 = cnt4 = -1;
+        if(Q_M_rem[my_iindx[i]-k+1] != 0.){
+          if(Q_M1_rem[jindx[j]+k] != 0.){
+            qmt += Q_M_rem[my_iindx[i]-k+1] * Q_M1_rem[jindx[j]+k];
+            if(qmt >= r) goto backtrack_qm_early_escape;
+          }
+          if(Q_M1[jindx[j]+k])
+            for(cnt3 = k_min_Q_M1[jindx[j]+k];
+                cnt3 <= k_max_Q_M1[jindx[j]+k];
+                cnt3++)
+              for(cnt4 = l_min_Q_M1[jindx[j]+k][cnt3];
+                  cnt4 <= l_max_Q_M1[jindx[j]+k][cnt3];
+                  cnt4 += 2){
+                qmt += Q_M_rem[my_iindx[i]-k+1] * Q_M1[jindx[j]+k][cnt3][cnt4/2];
+                if(qmt >= r) goto backtrack_qm_early_escape;
+              }
+        }
+        if(Q_M1_rem[jindx[j]+k] != 0.){
+          cnt3 = cnt4 = -1;
+          if(Q_M[my_iindx[i]-k+1])
+            for(cnt1 = k_min_Q_M[my_iindx[i]-k+1];
+                cnt1 <= k_max_Q_M[my_iindx[i]-k+1];
+                cnt1++)
+              for(cnt2 = l_min_Q_M[my_iindx[i]-k+1][cnt1];
+                  cnt2 <= l_max_Q_M[my_iindx[i]-k+1][cnt1];
+                  cnt2 += 2){
+                qmt += Q_M[my_iindx[i]-k+1][cnt1][cnt2/2] * Q_M1_rem[jindx[j]+k];
+                if(qmt >= r) goto backtrack_qm_early_escape;
+              }
+        }
+
+        if(!Q_M[my_iindx[i]-k+1]) continue;
+        if(!Q_M1[jindx[j]+k]) continue;
+        for(cnt1 = k_min_Q_M[my_iindx[i]-k+1];
+            cnt1 <= k_max_Q_M[my_iindx[i]-k+1];
+            cnt1++)
+          for(cnt2 = l_min_Q_M[my_iindx[i]-k+1][cnt1];
+              cnt2 <= l_max_Q_M[my_iindx[i]-k+1][cnt1];
+              cnt2 += 2)
+            for(cnt3 = k_min_Q_M1[jindx[j]+k];
+                cnt3 <= k_max_Q_M1[jindx[j]+k];
+                cnt3++)
+              for(cnt4 = l_min_Q_M1[jindx[j]+k][cnt3];
+                  cnt4 <= l_max_Q_M1[jindx[j]+k][cnt3];
+                  cnt4 += 2)
+                if(((cnt1 + cnt3 + da) > maxD1) || ((cnt2 + cnt4 + db) > maxD2)){
+                  qmt += Q_M[my_iindx[i]-k+1][cnt1][cnt2/2] * Q_M1[jindx[j]+k][cnt3][cnt4/2];
+                  if(qmt >= r) goto backtrack_qm_early_escape;
+                }
+      }
+
+    }
+    else{
+      /* find corresponding qm1 contribution */
+      if(Q_M1[jindx[j]+i])
+        if((d1 >= k_min_Q_M1[jindx[j]+i]) && (d1 <= k_max_Q_M1[jindx[j]+i]))
+          if((d2 >= l_min_Q_M1[jindx[j]+i][d1]) && (d2 <= l_max_Q_M1[jindx[j]+i][d1])){
+            qmt = Q_M1[jindx[j]+i][d1][d2/2];
+          }
+
+      k=i;
+      if(qmt<r){
+        for(k=i+1; k<=j; k++){
+          /* calculate introduced distancies to reference structures */
+          da2 = referenceBPs1[my_iindx[i]-j] - referenceBPs1[my_iindx[k]-j];
+          db2 = referenceBPs2[my_iindx[i]-j] - referenceBPs2[my_iindx[k]-j];
+          da = da2 - referenceBPs1[my_iindx[i]-k+1];
+          db = db2 - referenceBPs2[my_iindx[i]-k+1];
+
+
+          FLT_OR_DBL tmp = pow(pf_params->expMLbase, k-i) * scale[k-i];
+
+          /* collect unpaired + qm1 contributions */
+          if(d1 >= da2 && d2 >= db2)
+            if((d1 - da2 >= k_min_Q_M1[jindx[j]+k]) && (d1 - da2 <= k_max_Q_M1[jindx[j]+k]))
+              if((d2 - db2 >= l_min_Q_M1[jindx[j]+k][d1-da2]) && (d2 - db2 <= l_max_Q_M1[jindx[j]+k][d1-da2])){
+                cnt3 = d1-da2;
+                cnt4 = d2-db2;
+                qmt += Q_M1[jindx[j]+k][cnt3][cnt4/2] * tmp;
+                if(qmt >= r){
+                  backtrack_qm1(vc, pstruc, cnt3, cnt4, k, j);
+                  return;
+                }
+              }
+
+          /* collect qm + qm1 contributions */
+          if(d1 >= da && d2 >= db && Q_M[my_iindx[i]-k+1] && Q_M1[jindx[j]+k])
+            for(cnt1 = k_min_Q_M[my_iindx[i]-k+1]; cnt1 <= MIN2(k_max_Q_M[my_iindx[i]-k+1], d1 - da); cnt1++)
+              for(cnt2 = l_min_Q_M[my_iindx[i]-k+1][cnt1]; cnt2 <= MIN2(l_max_Q_M[my_iindx[i]-k+1][cnt1], d2 - db); cnt2+=2)
+                if((d1 - da - cnt1 >= k_min_Q_M1[jindx[j]+k]) && (d1 - da - cnt1 <= k_max_Q_M1[jindx[j]+k]))
+                  if((d2 - db - cnt2 >= l_min_Q_M1[jindx[j]+k][d1-da-cnt1]) && (d2 - db - cnt2 <= l_max_Q_M1[jindx[j]+k][d1-da-cnt1])){
+                    cnt3 = d1 - da - cnt1;
+                    cnt4 = d2 - db - cnt2;
+                    qmt += Q_M[my_iindx[i]-k+1][cnt1][cnt2/2] * Q_M1[jindx[j]+k][cnt3][cnt4/2];
+                    if(qmt >= r) goto backtrack_qm_early_escape;
+                  }
+        }
+      }
+      else{
+        backtrack_qm1(vc, pstruc, d1, d2, k, j);
+        return;
+      }
+    }
+
+    if(k>j) vrna_message_error("backtrack_qm@2Dpfold.c: backtrack failed in qm");
+
+backtrack_qm_early_escape:
+
+    backtrack_qm1(vc, pstruc, cnt3, cnt4, k, j);
+
+    if(k<i+TURN) break; /* no more pairs */
+
+    d1 = cnt1;
+    d2 = cnt2;
+
+
+    if(d1 == referenceBPs1[my_iindx[i]-k+1] && d2 == referenceBPs2[my_iindx[i]-k+1]){
+      /* is interval [i,k] totally unpaired? */
+      FLT_OR_DBL tmp = pow(pf_params->expMLbase, k-i) * scale[k-i];
+      r = vrna_urn() * (Q_M[my_iindx[i]-k+1][d1][d2/2] + tmp);
+      if(tmp >= r) return; /* no more pairs */
+    }
+    j = k-1;
+  }
+}
+
+
+
+
+PRIVATE void  adjustArrayBoundaries(FLT_OR_DBL ***array,
+                                    int *k_min, int *k_max,
+                                    int **l_min, int **l_max,
+                                    int k_min_post, int k_max_post,
+                                    int *l_min_post, int *l_max_post){
+
+  int cnt1;
+  int k_diff_pre  = k_min_post - *k_min;
+  int mem_size    = k_max_post - k_min_post + 1;
+
+  if(k_min_post < INF){
+    /* free all the unused memory behind actual data */
+    for(cnt1 = k_max_post + 1; cnt1 <= *k_max; cnt1++){
+      (*array)[cnt1] += (*l_min)[cnt1]/2;
+      free((*array)[cnt1]);
+    }
+
+    /* free unused memory before actual data */
+    for(cnt1 = *k_min; cnt1 < k_min_post; cnt1++){
+      (*array)[cnt1] += (*l_min)[cnt1]/2;
+      free((*array)[cnt1]);
+    }
+    /* move data to front and thereby eliminating unused memory in front of actual data */
+    if(k_diff_pre > 0){
+      memmove((FLT_OR_DBL **)(*array),((FLT_OR_DBL **)(*array)) + k_diff_pre, sizeof(FLT_OR_DBL *) * mem_size);
+      memmove((int *) (*l_min),((int *) (*l_min)) + k_diff_pre, sizeof(int)   * mem_size);
+      memmove((int *) (*l_max),((int *) (*l_max)) + k_diff_pre, sizeof(int)   * mem_size);
+    }
+
+    /* reallocating memory to actual size used */
+    *array  +=  *k_min;
+    *array  =   (FLT_OR_DBL **)realloc(*array, sizeof(FLT_OR_DBL *) * mem_size);
+    *array  -=  k_min_post;
+
+    *l_min  +=  *k_min;
+    *l_min  =   (int *)realloc(*l_min, sizeof(int) * mem_size);
+    *l_min  -=   k_min_post;
+
+    *l_max  +=  *k_min;
+    *l_max  =   (int *)realloc(*l_max, sizeof(int) * mem_size);
+    *l_max  -=  k_min_post;
+
+
+    for(cnt1 = k_min_post; cnt1 <= k_max_post; cnt1++){
+      if(l_min_post[cnt1] < INF){
+        /* new memsize */
+        mem_size        = (l_max_post[cnt1] - l_min_post[cnt1] + 1)/2 + 1;
+        /* reshift the pointer */
+        (*array)[cnt1]  += (*l_min)[cnt1]/2;
+
+        int shift       = (l_min_post[cnt1]%2 == (*l_min)[cnt1]%2) ? 0 : 1;
+        /* eliminate unused memory in front of actual data */
+        unsigned int    start = (l_min_post[cnt1] - (*l_min)[cnt1])/2 + shift;
+        if(start > 0)
+          memmove((FLT_OR_DBL *)((*array)[cnt1]), (FLT_OR_DBL *)((*array)[cnt1])+start, sizeof(FLT_OR_DBL) * mem_size);
+        (*array)[cnt1]  = (FLT_OR_DBL *) realloc((*array)[cnt1], sizeof(FLT_OR_DBL) * mem_size);
+
+        (*array)[cnt1]  -= l_min_post[cnt1]/2;
+      }
+      else{
+        /* free according memory */
+        (*array)[cnt1] += (*l_min)[cnt1]/2;
+        free((*array)[cnt1]);
+      }
+
+      (*l_min)[cnt1] = l_min_post[cnt1];
+      (*l_max)[cnt1] = l_max_post[cnt1];
+    }
+  }
+  else{
+    /* we have to free all unused memory */
+    for(cnt1 = *k_min; cnt1 <= *k_max; cnt1++){
+      (*array)[cnt1] += (*l_min)[cnt1]/2;
+      free((*array)[cnt1]);
+    }
+    (*l_min) += *k_min;
+    (*l_max) += *k_min;
+    free(*l_min);
+    free(*l_max);
+    (*array) += *k_min;
+    free(*array);
+    *array = NULL;
+  }
+
+  l_min_post  += *k_min;
+  l_max_post  += *k_min;
+  *k_min      = k_min_post;
+  *k_max      = k_max_post;
+
+  free(l_min_post);
+  free(l_max_post);
+}
+
+
+PRIVATE INLINE void preparePosteriorBoundaries(int size, int shift, int *min_k, int *max_k, int **min_l, int **max_l){
+  int i;
+  *min_k  = INF;
+  *max_k  = 0;
+
+  *min_l  = (int *)vrna_alloc(sizeof(int) * size);
+  *max_l  = (int *)vrna_alloc(sizeof(int) * size);
+
+  for(i = 0; i < size; i++){
+    (*min_l)[i] = INF;
+    (*max_l)[i] = 0;
+  }
+
+  *min_l  -= shift;
+  *max_l  -= shift;
+}
+
+PRIVATE INLINE void updatePosteriorBoundaries(int d1, int d2, int *min_k, int *max_k, int **min_l, int **max_l){
+  (*min_l)[d1]  = MIN2((*min_l)[d1], d2);
+  (*max_l)[d1]  = MAX2((*max_l)[d1], d2);
+  *min_k        = MIN2(*min_k, d1);
+  *max_k        = MAX2(*max_k, d1);
+}
+
+PRIVATE INLINE  void  prepareBoundaries(int min_k_pre, int max_k_pre, int min_l_pre, int max_l_pre, int bpdist, int *min_k, int *max_k, int **min_l, int **max_l){
+  int cnt;
+  int mem = max_k_pre - min_k_pre + 1;
+
+  *min_k  = min_k_pre;
+  *max_k  = max_k_pre;
+  *min_l  = (int *) vrna_alloc(sizeof(int) * mem);
+  *max_l  = (int *) vrna_alloc(sizeof(int) * mem);
+
+  *min_l  -= min_k_pre;
+  *max_l  -= min_k_pre;
+
+  /* for each k guess the according minimum l*/
+  for(cnt = min_k_pre; cnt <= max_k_pre; cnt++){
+    (*min_l)[cnt] = min_l_pre;
+    (*max_l)[cnt] = max_l_pre;
+    while((*min_l)[cnt] + cnt < bpdist) (*min_l)[cnt]++;
+    if((bpdist % 2) != (((*min_l)[cnt] + cnt) % 2)) (*min_l)[cnt]++;
+  }
+}
+
+PRIVATE INLINE  void  prepareArray(FLT_OR_DBL ***array, int min_k, int max_k, int *min_l, int *max_l){
+  int i, mem;
+  *array  = (FLT_OR_DBL **)vrna_alloc(sizeof(FLT_OR_DBL *) * (max_k - min_k + 1));
+  *array  -= min_k;
+
+  for(i = min_k; i <= max_k; i++){
+    mem         = (max_l[i] - min_l[i] + 1)/2 + 1;
+    (*array)[i] = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * mem);
+    (*array)[i] -= min_l[i]/2;
+  }
+}
+
+/*
+#################################
+# DEPRECATED FUNCTIONS BELOW    #
+#################################
+*/
+PRIVATE void
+crosslink(TwoDpfold_vars *vars){
+
+  vrna_fold_compound_t  *c;
+  vrna_mx_pf_t        *m;
+
+  c                     = vars->compatibility;
+  m                     = c->exp_matrices;
+
+  vars->sequence      = c->sequence;
+  vars->seq_length    = c->length;
+  vars->reference_pt1 = c->reference_pt1;
+  vars->reference_pt2 = c->reference_pt2;
+  vars->referenceBPs1 = c->referenceBPs1;
+  vars->referenceBPs2 = c->referenceBPs2;
+  vars->mm1           = c->mm1;
+  vars->mm2           = c->mm2;
+  vars->bpdist        = c->bpdist;
+  vars->dangles       = c->exp_params->model_details.dangles;
+  vars->circ          = c->exp_params->model_details.circ;
+  vars->temperature   = c->exp_params->model_details.temperature;
+  vars->init_temp     = c->exp_params->model_details.temperature;
+  vars->pf_scale      = c->exp_params->pf_scale;
+  vars->pf_params     = c->exp_params;
+
+  vars->scale         = m->scale;
+  vars->ptype         = c->ptype_pf_compat;
+  vars->S             = c->sequence_encoding2;
+  vars->S1            = c->sequence_encoding;
+
+  vars->jindx         = c->jindx;
+  vars->my_iindx      = c->iindx;
+  vars->maxD1         = c->maxD1;
+  vars->maxD2         = c->maxD2;
+
+  vars->Q                = m->Q;
+  vars->l_min_values     = m->l_min_Q;
+  vars->l_max_values     = m->l_max_Q;
+  vars->k_min_values     = m->k_min_Q;
+  vars->k_max_values     = m->k_max_Q;
+
+  vars->Q_B              = m->Q_B;
+  vars->l_min_values_b   = m->l_min_Q_B;
+  vars->l_max_values_b   = m->l_max_Q_B;
+  vars->k_min_values_b   = m->k_min_Q_B;
+  vars->k_max_values_b   = m->k_max_Q_B;
+
+  vars->Q_M              = m->Q_M;
+  vars->l_min_values_m   = m->l_min_Q_M;
+  vars->l_max_values_m   = m->l_max_Q_M;
+  vars->k_min_values_m   = m->k_min_Q_M;
+  vars->k_max_values_m   = m->k_max_Q_M;
+
+  vars->Q_M1             = m->Q_M1;
+  vars->l_min_values_m1  = m->l_min_Q_M1;
+  vars->l_max_values_m1  = m->l_max_Q_M1;
+  vars->k_min_values_m1  = m->k_min_Q_M1;
+  vars->k_max_values_m1  = m->k_max_Q_M1;
+
+  vars->Q_M2_rem         = m->Q_M2_rem;
+  vars->Q_M2             = m->Q_M2;
+  vars->l_min_values_m2  = m->l_min_Q_M2;
+  vars->l_max_values_m2  = m->l_max_Q_M2;
+  vars->k_min_values_m2  = m->k_min_Q_M2;
+  vars->k_max_values_m2  = m->k_max_Q_M2;
+
+  vars->Q_c               = m->Q_c;
+  vars->Q_cH              = m->Q_cH;
+  vars->Q_cI              = m->Q_cI;
+  vars->Q_cM              = m->Q_cM;
+  vars->Q_c_rem           = m->Q_c_rem;
+  vars->Q_cH_rem          = m->Q_cH_rem;
+  vars->Q_cI_rem          = m->Q_cI_rem;
+  vars->Q_cM_rem          = m->Q_cM_rem;
+
+  vars->Q_rem             = m->Q_rem;
+  vars->Q_B_rem           = m->Q_B_rem;
+  vars->Q_M_rem           = m->Q_M_rem;
+  vars->Q_M1_rem          = m->Q_M1_rem;
+}
+
+PUBLIC char *
+TwoDpfold_pbacktrack( TwoDpfold_vars *vars,
+                      int d1,
+                      int d2){
+
+  return vrna_pbacktrack_TwoD(vars->compatibility, d1, d2);
+}
+
+PUBLIC char *
+TwoDpfold_pbacktrack5(TwoDpfold_vars *vars,
+                      int d1,
+                      int d2,
+                      unsigned int length){
+
+  return vrna_pbacktrack5_TwoD(vars->compatibility, d1, d2, length);
+}
+
+PUBLIC TwoDpfold_vars *
+get_TwoDpfold_variables(const char *seq,
+                        const char *structure1,
+                        char *structure2,
+                        int circ){
+
+  vrna_md_t           md;
+  TwoDpfold_vars      *vars;
+  vrna_fold_compound_t  *c;
+  vrna_mx_mfe_t       *m;
+
+  set_model_details(&md);
+  md.circ = circ;
+
+  vars = (TwoDpfold_vars *)malloc(sizeof(TwoDpfold_vars));
+  vars->compatibility = vrna_fold_compound_TwoD(seq, structure1, structure2, &md, VRNA_OPTION_PF);
+
+  crosslink(vars);
+
+  return vars;
+}
+
+PUBLIC void
+destroy_TwoDpfold_variables(TwoDpfold_vars *vars){
+
+  if(vars == NULL) return;
+
+  vrna_fold_compound_free(vars->compatibility);
+
+  free(vars);
+}
+
+vrna_sol_TwoD_pf_t *
+TwoDpfoldList(TwoDpfold_vars *vars,
+              int distance1,
+              int distance2){
+
+  vrna_sol_TwoD_pf_t *sol;
+
+  sol = vrna_pf_TwoD(vars->compatibility, distance1, distance2);
+
+  crosslink(vars);
+
+  return sol;
+}
diff --git a/C/ViennaRNA/2Dpfold.h b/C/ViennaRNA/2Dpfold.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/2Dpfold.h
@@ -0,0 +1,399 @@
+#ifndef VIENNA_RNA_PACKAGE_TWO_D_PF_FOLD_H
+#define VIENNA_RNA_PACKAGE_TWO_D_PF_FOLD_H
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file 2Dpfold.h
+ *  @ingroup kl_neighborhood
+ *  @brief Partition function implementations for base pair distance classes
+ *
+ */
+
+/**
+ *  @addtogroup kl_neighborhood_pf
+ *  @brief Compute the partition function and stochastically sample secondary structures for a partitioning of
+ *  the secondary structure space according to the base pair distance to two fixed reference structures
+ *
+ *  @{
+ *  @ingroup  kl_neighborhood_pf
+ */
+
+#include <ViennaRNA/data_structures.h>
+
+/**
+ *  @brief Solution element returned from vrna_pf_TwoD()
+ *
+ *  This element contains the partition function for the appropriate
+ *  kappa (k), lambda (l) neighborhood
+ *  The datastructure contains two integer attributes 'k' and 'l'
+ *  as well as an attribute 'q' of type #FLT_OR_DBL
+ *
+ *  A value of #INF in k denotes the end of a list
+ *
+ *  @see  vrna_pf_TwoD()
+ */
+typedef struct vrna_sol_TwoD_pf_t{
+  int k;          /**<  @brief  Distance to first reference */
+  int l;          /**<  @brief  Distance to second reference */
+  FLT_OR_DBL  q;  /**<  @brief  partition function */
+} vrna_sol_TwoD_pf_t;
+
+/**
+ * @brief Compute the partition function for all distance classes
+ *
+ * This function computes the partition functions for all distance classes
+ * according the two reference structures specified in the datastructure 'vars'.
+ * Similar to vrna_mfe_TwoD() the arguments maxDistance1 and maxDistance2 specify
+ * the maximum distance to both reference structures. A value of '-1' in either of
+ * them makes the appropriate distance restrictionless, i.e. all basepair distancies
+ * to the reference are taken into account during computation.
+ * In case there is a restriction, the returned solution contains an entry where
+ * the attribute k=l=-1 contains the partition function for all structures exceeding
+ * the restriction.
+ * A value of #INF in the attribute 'k' of the returned list denotes the end of the list
+ *
+ * @see vrna_fold_compound_TwoD(), vrna_fold_compound_free(), #vrna_fold_compound
+ *      #vrna_sol_TwoD_pf_t
+ *
+ * @param vc            The datastructure containing all necessary folding attributes and matrices
+ * @param maxDistance1  The maximum basepair distance to reference1 (may be -1)
+ * @param maxDistance2  The maximum basepair distance to reference2 (may be -1)
+ * @returns             A list of partition funtions for the corresponding distance classes
+ */
+vrna_sol_TwoD_pf_t  *
+vrna_pf_TwoD(vrna_fold_compound_t *vc,
+                  int maxDistance1,
+                  int maxDistance2);
+
+/** @} */ /* End of group kl_neighborhood_pf */
+
+/**
+ *  @addtogroup kl_neighborhood_stochbt
+ *  @brief Contains functions related to stochastic backtracking from a specified distance class
+ *  @{
+ */
+
+/**
+ *  @brief Sample secondary structure representatives from a set of distance classes according to their 
+ *  Boltzmann probability
+ *
+ *  If the argument 'd1' is set to '-1', the structure will be backtracked in the distance class
+ *  where all structures exceeding the maximum basepair distance to either of the references reside.
+ *
+ *  @pre      The argument 'vars' must contain precalculated partition function matrices,
+ *            i.e. a call to vrna_pf_TwoD() preceding this function is mandatory!
+ *
+ *  @see      vrna_pf_TwoD()
+ *
+ *  @param[inout]  vc The #vrna_fold_compound_t datastructure containing all necessary folding attributes and matrices
+ *  @param[in]  d1    The distance to reference1 (may be -1)
+ *  @param[in]  d2    The distance to reference2
+ *  @returns    A sampled secondary structure in dot-bracket notation
+ */
+char *
+vrna_pbacktrack_TwoD( vrna_fold_compound_t *vc,
+                      int d1,
+                      int d2);
+
+/**
+ * @brief Sample secondary structure representatives with a specified length from a set of distance classes according to their 
+ *  Boltzmann probability
+ *
+ * This function does essentially the same as vrna_pbacktrack_TwoD() with the only difference that partial structures,
+ * i.e. structures beginning from the 5' end with a specified length of the sequence, are backtracked
+ *
+ * @note      This function does not work (since it makes no sense) for circular RNA sequences!
+ * @pre       The argument 'vars' must contain precalculated partition function matrices,
+ *            i.e. a call to vrna_pf_TwoD() preceding this function is mandatory!
+ *
+ * @see       vrna_pbacktrack_TwoD(), vrna_pf_TwoD()
+ *
+ *  @param[inout] vc    The #vrna_fold_compound_t datastructure containing all necessary folding attributes and matrices
+ *  @param[in]  d1      The distance to reference1 (may be -1)
+ *  @param[in]  d2      The distance to reference2
+ *  @param[in]  length  The length of the structure beginning from the 5' end
+ *  @returns            A sampled secondary structure in dot-bracket notation
+ */
+char *
+vrna_pbacktrack5_TwoD(vrna_fold_compound_t *vc,
+                      int d1,
+                      int d2,
+                      unsigned int length);
+
+/**
+ *  @}
+ */ /* End of group kl_neighborhood_stochbt */
+
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+#define TwoDpfold_solution       vrna_sol_TwoD_pf_t         /* restore compatibility of struct rename */
+
+/**
+ *  @brief  Variables compound for 2Dfold partition function folding
+ *
+ *  @deprecated This data structure will be removed from the library soon!
+ *              Use #vrna_fold_compound_t and the corresponding functions vrna_fold_compound_TwoD(),
+ *              vrna_pf_TwoD(), and vrna_fold_compound_free() instead!
+ */
+typedef struct{
+
+  unsigned int    alloc;
+  char            *ptype;         /**<  @brief  Precomputed array of pair types */
+  char            *sequence;      /**<  @brief  The input sequence  */
+  short           *S, *S1;        /**<  @brief  The input sequences in numeric form */
+  unsigned int    maxD1;          /**<  @brief  Maximum allowed base pair distance to first reference */
+  unsigned int    maxD2;          /**<  @brief  Maximum allowed base pair distance to second reference */
+
+  double          temperature;    /* temperature in last call to scale_pf_params */
+  double          init_temp;      /* temperature in last call to scale_pf_params */
+  FLT_OR_DBL      *scale;
+  FLT_OR_DBL      pf_scale;
+  vrna_exp_param_t  *pf_params;     /* holds all [unscaled] pf parameters */
+
+  int             *my_iindx;      /**<  @brief  Index for moving in quadratic distancy dimensions */
+  int             *jindx;         /**<  @brief  Index for moving in the triangular matrix qm1 */
+
+  short           *reference_pt1;
+  short           *reference_pt2;
+
+  unsigned int    *referenceBPs1; /**<  @brief  Matrix containing number of basepairs of reference structure1 in interval [i,j] */
+  unsigned int    *referenceBPs2; /**<  @brief  Matrix containing number of basepairs of reference structure2 in interval [i,j] */
+  unsigned int    *bpdist;        /**<  @brief  Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j] */
+
+  unsigned int    *mm1;           /**<  @brief  Maximum matching matrix, reference struct 1 disallowed */
+  unsigned int    *mm2;           /**<  @brief  Maximum matching matrix, reference struct 2 disallowed */
+
+  int             circ;
+  int             dangles;
+  unsigned int    seq_length;
+
+  FLT_OR_DBL      ***Q;
+  FLT_OR_DBL      ***Q_B;
+  FLT_OR_DBL      ***Q_M;
+  FLT_OR_DBL      ***Q_M1;
+  FLT_OR_DBL      ***Q_M2;
+
+  FLT_OR_DBL      **Q_c;
+  FLT_OR_DBL      **Q_cH;
+  FLT_OR_DBL      **Q_cI;
+  FLT_OR_DBL      **Q_cM;
+
+  int             **l_min_values;
+  int             **l_max_values;
+  int             *k_min_values;
+  int             *k_max_values;
+
+  int             **l_min_values_b;
+  int             **l_max_values_b;
+  int             *k_min_values_b;
+  int             *k_max_values_b;
+
+  int             **l_min_values_m;
+  int             **l_max_values_m;
+  int             *k_min_values_m;
+  int             *k_max_values_m;
+
+  int             **l_min_values_m1;
+  int             **l_max_values_m1;
+  int             *k_min_values_m1;
+  int             *k_max_values_m1;
+
+  int             **l_min_values_m2;
+  int             **l_max_values_m2;
+  int             *k_min_values_m2;
+  int             *k_max_values_m2;
+
+  int             *l_min_values_qc;
+  int             *l_max_values_qc;
+  int             k_min_values_qc;
+  int             k_max_values_qc;
+
+  int             *l_min_values_qcH;
+  int             *l_max_values_qcH;
+  int             k_min_values_qcH;
+  int             k_max_values_qcH;
+
+  int             *l_min_values_qcI;
+  int             *l_max_values_qcI;
+  int             k_min_values_qcI;
+  int             k_max_values_qcI;
+
+  int             *l_min_values_qcM;
+  int             *l_max_values_qcM;
+  int             k_min_values_qcM;
+  int             k_max_values_qcM;
+
+  /* auxilary arrays for remaining set of coarse graining (k,l) > (k_max, l_max) */
+  FLT_OR_DBL      *Q_rem;
+  FLT_OR_DBL      *Q_B_rem;
+  FLT_OR_DBL      *Q_M_rem;
+  FLT_OR_DBL      *Q_M1_rem;
+  FLT_OR_DBL      *Q_M2_rem;
+
+  FLT_OR_DBL      Q_c_rem;
+  FLT_OR_DBL      Q_cH_rem;
+  FLT_OR_DBL      Q_cI_rem;
+  FLT_OR_DBL      Q_cM_rem;
+
+  vrna_fold_compound_t *compatibility;
+} TwoDpfold_vars;
+
+/**
+ * @brief Get a datastructure containing all necessary attributes and global folding switches
+ *
+ * This function prepares all necessary attributes and matrices etc which are needed for a call
+ * of TwoDpfold() .
+ * A snapshot of all current global model switches (dangles, temperature and so on) is done and
+ * stored in the returned datastructure. Additionally, all matrices that will hold the partition
+ * function values are prepared.
+ *
+ *  @deprecated Use the new API that relies on #vrna_fold_compound_t and the corresponding functions
+ *              vrna_fold_compound_TwoD(), vrna_pf_TwoD(), and vrna_fold_compound_free() instead!
+ *
+ * @param seq         the RNA sequence in uppercase format with letters from the alphabet {AUCG}
+ * @param structure1  the first reference structure in dot-bracket notation
+ * @param structure2  the second reference structure in dot-bracket notation
+ * @param circ        a switch indicating if the sequence is linear (0) or circular (1)
+ * @returns           the datastructure containing all necessary partition function attributes
+ */
+DEPRECATED(TwoDpfold_vars  *
+get_TwoDpfold_variables(const char *seq,
+                        const char *structure1,
+                        char *structure2,
+                        int circ));
+
+/**
+ * @brief Free all memory occupied by a TwoDpfold_vars datastructure
+ *
+ * This function free's all memory occupied by a datastructure obtained from from
+ * get_TwoDpfold_variabless() or get_TwoDpfold_variables_from_MFE()
+ *
+ *  @deprecated Use the new API that relies on #vrna_fold_compound_t and the corresponding functions
+ *              vrna_fold_compound_TwoD(), vrna_pf_TwoD(), and vrna_fold_compound_free() instead!
+ *
+ * @see get_TwoDpfold_variables(), get_TwoDpfold_variables_from_MFE()
+ *
+ * @param vars   the datastructure to be free'd
+ */
+DEPRECATED(void 
+destroy_TwoDpfold_variables(TwoDpfold_vars *vars));
+
+/**
+ * @brief Compute the partition function for all distance classes
+ *
+ * This function computes the partition functions for all distance classes
+ * according the two reference structures specified in the datastructure 'vars'.
+ * Similar to TwoDfold() the arguments maxDistance1 and maxDistance2 specify
+ * the maximum distance to both reference structures. A value of '-1' in either of
+ * them makes the appropriate distance restrictionless, i.e. all basepair distancies
+ * to the reference are taken into account during computation.
+ * In case there is a restriction, the returned solution contains an entry where
+ * the attribute k=l=-1 contains the partition function for all structures exceeding
+ * the restriction.
+ * A values of #INF in the attribute 'k' of the returned list denotes the end of the list
+ *
+ *  @deprecated Use the new API that relies on #vrna_fold_compound_t and the corresponding functions
+ *              vrna_fold_compound_TwoD(), vrna_pf_TwoD(), and vrna_fold_compound_free() instead!
+ *
+ * @see get_TwoDpfold_variables(), destroy_TwoDpfold_variables(), #vrna_sol_TwoD_pf_t
+ *
+ * @param vars          the datastructure containing all necessary folding attributes and matrices
+ * @param maxDistance1  the maximum basepair distance to reference1 (may be -1)
+ * @param maxDistance2  the maximum basepair distance to reference2 (may be -1)
+ * @returns             a list of partition funtions for the appropriate distance classes
+ */
+DEPRECATED(TwoDpfold_solution  *
+TwoDpfoldList(TwoDpfold_vars *vars,
+              int maxDistance1,
+              int maxDistance2));
+
+/**
+ *  @brief Sample secondary structure representatives from a set of distance classes according to their 
+ *  Boltzmann probability
+ *
+ *  If the argument 'd1' is set to '-1', the structure will be backtracked in the distance class
+ *  where all structures exceeding the maximum basepair distance to either of the references reside.
+ *
+ *  @pre      The argument 'vars' must contain precalculated partition function matrices,
+ *            i.e. a call to TwoDpfold() preceding this function is mandatory!
+ *
+ *  @deprecated Use the new API that relies on #vrna_fold_compound_t and the corresponding functions
+ *              vrna_fold_compound_TwoD(), vrna_pf_TwoD(), vrna_pbacktrack_TwoD(), and
+ *              vrna_fold_compound_free() instead!
+ *
+ *  @see      TwoDpfold()
+ *
+ *  @param[in]  vars  the datastructure containing all necessary folding attributes and matrices
+ *  @param[in]  d1    the distance to reference1 (may be -1)
+ *  @param[in]  d2    the distance to reference2
+ *  @returns    A sampled secondary structure in dot-bracket notation
+ */
+DEPRECATED(char *
+TwoDpfold_pbacktrack( TwoDpfold_vars *vars,
+                      int d1,
+                      int d2));
+
+/**
+ * @brief Sample secondary structure representatives with a specified length from a set of distance classes according to their 
+ *  Boltzmann probability
+ *
+ * This function does essentially the same as TwoDpfold_pbacktrack() with the only difference that partial structures,
+ * i.e. structures beginning from the 5' end with a specified length of the sequence, are backtracked
+ *
+ * @note      This function does not work (since it makes no sense) for circular RNA sequences!
+ * @pre       The argument 'vars' must contain precalculated partition function matrices,
+ *            i.e. a call to TwoDpfold() preceding this function is mandatory!
+ *
+ *  @deprecated Use the new API that relies on #vrna_fold_compound_t and the corresponding functions
+ *              vrna_fold_compound_TwoD(), vrna_pf_TwoD(), vrna_pbacktrack5_TwoD(), and
+ *              vrna_fold_compound_free() instead!
+ *
+ * @see       TwoDpfold_pbacktrack(), TwoDpfold()
+ *
+ *  @param[in]  vars    the datastructure containing all necessary folding attributes and matrices
+ *  @param[in]  d1      the distance to reference1 (may be -1)
+ *  @param[in]  d2      the distance to reference2
+ *  @param[in]  length  the length of the structure beginning from the 5' end
+ *  @returns    A sampled secondary structure in dot-bracket notation
+ */
+DEPRECATED(char *
+TwoDpfold_pbacktrack5(TwoDpfold_vars *vars,
+                      int d1,
+                      int d2,
+                      unsigned int length));
+
+/**
+ * @brief
+ *
+ *
+ */
+DEPRECATED(FLT_OR_DBL          **TwoDpfold(TwoDpfold_vars *our_variables,
+                                int maxDistance1,
+                                int maxDistance2));
+
+/**
+ * @brief
+ *
+ *
+ */
+DEPRECATED(FLT_OR_DBL          **TwoDpfold_circ(
+                                TwoDpfold_vars *our_variables,
+                                int maxDistance1,
+                                int maxDistance2));
+
+#endif
+
+#endif
diff --git a/C/ViennaRNA/LPfold.c b/C/ViennaRNA/LPfold.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/LPfold.c
@@ -0,0 +1,1373 @@
+/*
+  local pair probabilities for RNA secondary structures
+
+  Stephan Bernhart, Ivo L Hofacker
+  Vienna RNA package
+*/
+/*
+  todo: compute energy z-score for each window
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <float.h>    /* #defines FLT_MAX ... */
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/PS_dot.h"
+#include "ViennaRNA/part_func.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/LPfold.h"
+#include "ViennaRNA/Lfold.h"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+
+#define ISOLATED  256.0
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+PRIVATE float       cutoff;
+PRIVATE int         num_p=0; /* for counting basepairs in pairlist pl, can actually be moved into pfl_fold */
+PRIVATE FLT_OR_DBL  *expMLbase=NULL;
+PRIVATE FLT_OR_DBL  **q=NULL, **qb=NULL, **qm=NULL, *qqm=NULL, *qqm1=NULL, *qq=NULL, *qq1=NULL, **pR=NULL, **qm2=NULL, **QI5=NULL,  **q2l=NULL, **qmb=NULL;/*,**QI3,*/
+PRIVATE FLT_OR_DBL  *prml=NULL, *prm_l=NULL, *prm_l1=NULL, *q1k=NULL, *qln=NULL;
+PRIVATE FLT_OR_DBL  *scale=NULL;
+PRIVATE char        **ptype=NULL; /* precomputed array of pair types */
+PRIVATE int         *jindx=NULL;
+PRIVATE int         *my_iindx=NULL;
+PRIVATE vrna_exp_param_t   *pf_params=NULL;
+PRIVATE short       *S=NULL, *S1=NULL;
+PRIVATE int         ulength;
+PRIVATE int         pUoutput;
+PRIVATE double      alpha = 1.0;
+
+#ifdef _OPENMP
+
+/* NOTE: all variables are assumed to be uninitialized if they are declared as threadprivate
+*/
+#pragma omp threadprivate(cutoff, num_p, scale, ptype, jindx, my_iindx, pf_params,\
+                          expMLbase, q, qb, qm, qqm, qqm1, qq, qq1, pR, qm2, QI5, q2l, qmb,\
+                          prml, prm_l, prm_l1, q1k, qln,\
+                          S, S1, ulength, pUoutput, alpha)
+
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+PRIVATE void  init_partfunc_L(int length, vrna_exp_param_t *parameters);
+PRIVATE void  get_arrays_L(unsigned int length);
+PRIVATE void  free_pf_arrays_L(void);
+PRIVATE void  scale_pf_params(unsigned int length, vrna_exp_param_t *parameters);
+PRIVATE void  GetPtype(int j, int pairsize, const short *S, int n);
+PRIVATE void  FreeOldArrays(int i);
+PRIVATE void  GetNewArrays(int j, int winSize);
+PRIVATE void  printpbar(FLT_OR_DBL **prb,int winSize, int i, int n);
+PRIVATE plist *get_deppp(plist *pl, int start, int pairsize, int length);
+PRIVATE plist *get_plistW(plist *pl, int length, int start, FLT_OR_DBL **Tpr, int winSize);
+PRIVATE void  print_plist(int length, int start, FLT_OR_DBL **Tpr, int winSize, FILE *fp);
+PRIVATE void  compute_pU(int k, int ulength, double **pU, int winSize, int n, char *sequence);
+PRIVATE void  putoutpU(double **pU,int k, int ulength, FILE *fp);
+/*PRIVATE void make_ptypes(const short *S, const char *structure);*/
+
+PRIVATE void putoutpU_splitup(double **pUx, int k, int ulength, FILE *fp, char ident);
+PRIVATE void compute_pU_splitup(int k, int ulength, double **pU,  double **pUO, double **pUH, double **pUI, double **pUM, int winSize,int n, char *sequence);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PRIVATE void init_partfunc_L(int length, vrna_exp_param_t *parameters){
+  if (length<1) vrna_message_error("init_partfunc_L: length must be greater 0");
+#ifdef _OPENMP
+/* Explicitly turn off dynamic threads */
+  omp_set_dynamic(0);
+  free_pf_arrays_L(); /* free previous allocation */
+#else
+  free_pf_arrays_L(); /* free previous allocation */
+#endif
+
+#ifdef SUN4
+  nonstandard_arithmetic();
+#else
+#ifdef HP9
+  fpsetfastmode(1);
+#endif
+#endif
+  make_pair_matrix();
+  get_arrays_L((unsigned) length);
+  scale_pf_params((unsigned) length, parameters);
+
+}
+
+PRIVATE void get_arrays_L(unsigned int length){
+  /*arrays in 2 dimensions*/
+
+  q         = (FLT_OR_DBL **) vrna_alloc(sizeof(FLT_OR_DBL *)*(length+1));
+  qb        = (FLT_OR_DBL **) vrna_alloc(sizeof(FLT_OR_DBL *)*(length+1));
+  qm        = (FLT_OR_DBL **) vrna_alloc(sizeof(FLT_OR_DBL *)*(length+1));
+  pR        = (FLT_OR_DBL **) vrna_alloc(sizeof(FLT_OR_DBL *)*(length+1));
+  q1k       = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)  *(length+1));
+  qln       = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)  *(length+2));
+  qq        = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)  *(length+2));
+  qq1       = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)  *(length+2));
+  qqm       = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)  *(length+2));
+  qqm1      = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)  *(length+2));
+  prm_l     = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)  *(length+2));
+  prm_l1    = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)  *(length+2));
+  prml      = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)  *(length+2));
+  expMLbase = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)  *(length+1));
+  scale     = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)  *(length+1));
+  ptype     = (char **)       vrna_alloc(sizeof(char *)      *(length+2));
+
+  if (ulength>0) {
+    /* QI3 = (FLT_OR_DBL **) vrna_alloc((length+1)*sizeof(FLT_OR_DBL *));*/
+    QI5 = (FLT_OR_DBL **) vrna_alloc((length+1)*sizeof(FLT_OR_DBL *));
+    qmb = (FLT_OR_DBL **) vrna_alloc((length+1)*sizeof(FLT_OR_DBL *));
+    qm2 = (FLT_OR_DBL **) vrna_alloc((length+1)*sizeof(FLT_OR_DBL *));
+    q2l = (FLT_OR_DBL **) vrna_alloc((length+1)*sizeof(FLT_OR_DBL *));
+  }
+  my_iindx  = vrna_idx_row_wise(length);
+  iindx     = vrna_idx_row_wise(length); /* for backward compatibility and Perl wrapper */
+  jindx     = vrna_idx_col_wise(length);
+}
+
+PRIVATE void free_pf_arrays_L(void){
+  if(q)         free(q);
+  if(qb)        free(qb);
+  if(qm)        free(qm);
+  if(pR)        free(pR);
+  if(qm2)       free(qm2);
+  if(qq)        free(qq);
+  if(qq1)       free(qq1);
+  if(qqm)       free(qqm);
+  if(qqm1)      free(qqm1);
+  if(q1k)       free(q1k);
+  if(qln)       free(qln);
+  if(prm_l)     free(prm_l);
+  if(prm_l1)    free(prm_l1);
+  if(prml)      free(prml);
+  if(expMLbase) free(expMLbase);
+  if(scale)     free(scale);
+  if(my_iindx)  free(my_iindx);
+  if(iindx)     free(iindx); /* for backward compatibility and Perl wrapper */
+  if(jindx)     free(jindx);
+  if(ptype)     free(ptype);
+  if(QI5)       free(QI5);
+  if(qmb)       free(qmb);
+  if(q2l)       free(q2l);
+  if(pf_params) free(pf_params);
+
+  q = qb = qm = pR = QI5 = qmb = qm2 = q2l = NULL;
+  qq = qq1 = qqm = qqm1 = q1k = qln = prml = prm_l = prm_l1 = expMLbase = NULL;
+  my_iindx = jindx = iindx = NULL;
+  pf_params = NULL;
+  ptype     = NULL;
+  scale = NULL;
+
+#ifdef SUN4
+  standard_arithmetic();
+#else
+#ifdef HP9
+  fpsetfastmode(0);
+#endif
+#endif
+
+}
+
+PUBLIC void update_pf_paramsLP(int length){
+  update_pf_paramsLP_par(length, NULL);
+}
+
+PUBLIC void update_pf_paramsLP_par(int length, vrna_exp_param_t *parameters){
+  init_partfunc_L(length, parameters);
+}
+
+PUBLIC plist *pfl_fold( char *sequence,
+                        int winSize,
+                        int pairSize,
+                        float cutoffb,
+                        double **pU,
+                        plist **dpp2,
+                        FILE *pUfp,
+                        FILE *spup){
+  return pfl_fold_par(sequence, winSize, pairSize, cutoffb, pU, dpp2, pUfp, spup, NULL);
+}
+
+PUBLIC plist *pfl_fold_par( char *sequence,
+                            int winSize,
+                            int pairSize,
+                            float cutoffb,
+                            double **pU,
+                            plist **dpp2,
+                            FILE *pUfp,
+                            FILE *spup,
+                            vrna_exp_param_t *parameters){
+
+  int         n, m, i, j, k, l, u, u1, type, type_2, tt, ov, do_dpp, simply_putout, noGUclosure;
+  double      max_real;
+  FLT_OR_DBL  temp, Qmax, prm_MLb, prmt, prmt1, qbt1, *tmp, expMLclosing;
+  plist       *dpp, *pl;
+  int split=0;
+
+  ov            = 0;
+  Qmax          = 0;
+  do_dpp        = 0;
+  simply_putout = 0;
+  dpp           = NULL;
+  pl            = NULL;
+  pUoutput      = 0;
+  ulength       = 0;
+  cutoff        = cutoffb;
+
+  if(pU != NULL)  ulength       = (int)pU[0][0]+0.49;
+  if(spup !=NULL) simply_putout = 1; /*can't have one without the other*/
+  if(pUfp!=NULL)  pUoutput      = 1;
+  else if((pUoutput)&&(ulength!=0)){
+    vrna_message_warning("There was a problem with non existing File Pointer for unpaireds, terminating process\n");
+    return pl;
+  }
+  dpp = *dpp2;
+  if(dpp !=NULL)  do_dpp=1;
+
+  /*here, I allocate memory for pU, if has to be saved, I allocate all in one go,
+    if pU is put out and freed, I only allocate what I really need*/
+
+  n = (int) strlen(sequence);
+
+  /* allocate memory and initialize unpaired probabilities */
+  if (ulength > 0) {
+    if (pUoutput) {
+      for (i = 1; i <= ulength; i++)
+        pU[i] = (double *)vrna_alloc((MAX2(MAXLOOP,ulength)+2)*sizeof(double));
+    }
+    else {
+      for (i = 1; i <= n; i++)
+        pU[i]=(double *)vrna_alloc((MAX2(MAXLOOP,ulength)+2)*sizeof(double));
+    }
+  }
+
+  if (n < TURN + 2) {
+    if (ulength > 0) {
+      if (pUoutput) {
+        for (i = 1; i <= ulength; i++) {
+          for (j = 0; j < MAX2(MAXLOOP,ulength) + 1; j++)
+            pU[i][j] = 1.;
+        }
+      }
+      else {
+        for (i = 1; i <= n; i++) {
+          for (j = 0; j < MAX2(MAXLOOP,ulength) + 1; j++)
+            pU[i][j] = 1.;
+        }
+      }
+    }
+    return pl;
+  }
+
+  /* always init everything since all global static variables are uninitialized when entering a thread */
+  init_partfunc_L(n, parameters);
+
+  expMLclosing  = pf_params->expMLclosing;
+  noGUclosure   = pf_params->model_details.noGUclosure;
+
+
+  max_real = (sizeof(FLT_OR_DBL) == sizeof(float)) ? FLT_MAX : DBL_MAX;
+
+  S   = encode_sequence(sequence, 0);
+  S1  = encode_sequence(sequence, 1);
+
+  /*  make_ptypes(S, structure); das machmadochlieber lokal, ey!*/
+
+  /*array initialization ; qb,qm,q
+    qb,qm,q (i,j) are stored as ((n+1-i)*(n-i) div 2 + n+1-j */
+  num_p = 0;
+  pl    = (plist *)vrna_alloc(1000*sizeof(plist));
+
+
+  /*ALWAYS q[i][j] => i>j!!*/
+  for (j=1; j<MIN2(TURN+2,n); j++) { /*allocate start*/
+    GetNewArrays(j, winSize);
+    GetPtype(j,pairSize,S,n);
+    for (i=1; i<=j; i++) q[i][j]=scale[(j-i+1)];
+  }
+  for (j=TURN+2;j<=n+winSize; j++) {
+    if (j<=n) {
+      GetNewArrays(j, winSize);
+      GetPtype(j,pairSize,S,n);
+      for (i=MAX2(1,j-winSize); i<=j/*-TURN*/; i++)
+        q[i][j]=scale[(j-i+1)];
+      for (i=j-TURN-1;i>=MAX2(1,(j-winSize+1)); i--) {
+        /* construction of partition function of segment i,j*/
+        /*firstly that given i bound to j : qb(i,j) */
+        u = j-i-1;
+        type = ptype[i][j];
+        if (type!=0) {
+          /*hairpin contribution*/
+          if (((type==3)||(type==4))&&noGUclosure) qbt1 = 0;
+          else
+            qbt1 = exp_E_Hairpin(u, type, S1[i+1], S1[j-1], sequence+i-1, pf_params) * scale[u+2];
+
+          /* interior loops with interior pair k,l */
+          for (k=i+1; k<=MIN2(i+MAXLOOP+1,j-TURN-2); k++) {
+            u1 = k-i-1;
+            for (l=MAX2(k+TURN+1,j-1-MAXLOOP+u1); l<j; l++) {
+              type_2 = ptype[k][l];
+              if (type_2) {
+                type_2 = rtype[type_2];
+                qbt1 += qb[k][l] *
+                  exp_E_IntLoop(u1, j-l-1, type, type_2,
+                                S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params) * scale[k-i+j-l];
+              }
+            }
+          }
+          /*multiple stem loop contribution*/
+          temp = 0.0;
+          for (k=i+2; k<=j-1; k++) temp += qm[i+1][k-1]*qqm1[k];
+          tt = rtype[type];
+          qbt1 += temp * expMLclosing * exp_E_MLstem(tt, S1[j-1], S1[i+1], pf_params) * scale[2];
+
+          qb[i][j] = qbt1;
+        } /* end if (type!=0) */
+        else qb[i][j] = 0.0;
+
+        /* construction of qqm matrix containing final stem
+           contributions to multiple loop partition function
+           from segment i,j */
+        qqm[i] = qqm1[i]*expMLbase[1];
+        if (type) {
+          qbt1 = qb[i][j] * exp_E_MLstem(type, (i>1) ? S1[i-1] : -1, (j<n) ? S1[j+1] : -1, pf_params);
+          qqm[i] += qbt1;
+        }
+
+        /*construction of qm matrix containing multiple loop
+          partition function contributions from segment i,j */
+        temp = 0.0;
+        /*ii = my_iindx[i];   ii-k=[i,k-1] */
+        /*new qm2 computation done here*/
+        for (k=i+1; k<=j; k++) temp += (qm[i][k-1])*qqm[k];
+        if (ulength>0) qm2[i][j]=temp;/*new qm2 computation done here*/
+        for (k=i+1; k<=j; k++) temp += expMLbase[k-i] * qqm[k];
+        qm[i][j] = (temp + qqm[i]);
+
+        /*auxiliary matrix qq for cubic order q calculation below */
+        qbt1 = qb[i][j];
+        if (type) {
+          qbt1 *= exp_E_ExtLoop(type, (i>1) ? S1[i-1] : -1, (j < n) ? S1[j+1] : -1, pf_params);
+        }
+        qq[i] = qq1[i]*scale[1] + qbt1;
+
+        /*construction of partition function for segment i,j */
+        temp = 1.0*scale[1+j-i] + qq[i];
+        for (k=i; k<=j-1; k++) temp += q[i][k]*qq[k+1];
+        q[i][j] = temp;
+
+        if (temp>Qmax) {
+          Qmax = temp;
+          if (Qmax>max_real/10.)
+            vrna_message_warning("Q close to overflow: %d %d %g\n", i,j,temp);
+        }
+        if (temp>=max_real) {
+          vrna_message_error("overflow in pf_fold while calculating q[%d,%d]\n"
+                                    "use larger pf_scale", i,j);
+        }
+      } /*end for i*/
+      tmp = qq1;  qq1 =qq;  qq =tmp;
+      tmp = qqm1; qqm1=qqm; qqm=tmp;
+    }
+
+    /* just as a general service, I save here the free energy of the windows
+       no output is generated, however,...
+    */
+    if ((j>=winSize) && (j<=n) && (ulength) && !(pUoutput)) {
+      double Fwindow=0.;
+      Fwindow=(-log(q[j-winSize+1][j])-winSize*log(pf_params->pf_scale))*pf_params->kT/1000.0;
+
+      pU[j][0]=Fwindow;
+      /*
+      if (ulength>=winSize)
+        pU[j][winSize]=scale[winSize]/q[j-winSize+1][j];
+      */
+    }
+    if (j>winSize) {
+      Qmax=0;
+      /* i=j-winSize; */
+      /* initialize multiloopfs */
+      for (k=j-winSize; k<=MIN2(n,j); k++) {
+        prml[k]=0;
+        prm_l[k]=0;
+        /*        prm_l1[k]=0;  others stay*/
+      }
+      prm_l1[j-winSize]=0;
+      k=j-winSize;
+      for (l=k+TURN+1; l<=MIN2(n,k+winSize-1); l++) {
+        int a;
+        pR[k][l] = 0; /* set zero at start */
+        type=ptype[k][l];
+        if (qb[k][l]==0) continue;
+
+        for (a=MAX2(1,l-winSize+2); a<MIN2(k,n-winSize+2);a++)
+          pR[k][l]+=q[a][k-1]*q[l+1][a+winSize-1]/q[a][a+winSize-1];
+
+        if (l-k+1==winSize)
+          pR[k][l]+=1./q[k][l];
+        else {
+          if (k+winSize-1<=n)          /* k outermost */
+            pR[k][l]+=q[l+1][k+winSize-1]/q[k][k+winSize-1];
+          if (l-winSize+1>=1)  /*l outermost*/
+            pR[k][l]+=q[l-winSize+1][k-1]/q[l-winSize+1][l];
+        }
+        pR[k][l] *= exp_E_ExtLoop(type, (k>1) ? S1[k-1] : -1, (l<n) ? S1[l+1] : -1, pf_params);
+
+        type_2 = ptype[k][l];
+        type_2 = rtype[type_2];
+
+        for (i=MAX2(MAX2(l-winSize+1,k-MAXLOOP-1),1); i<=k-1; i++) {
+          for (m=l+1; m<=MIN2(MIN2(l+ MAXLOOP -k+i+2,i+winSize-1),n); m++) {
+            type = ptype[i][m];
+            if ((pR[i][m]>0))
+              pR[k][l] += pR[i][m]*exp_E_IntLoop(k-i-1, m-l-1, type, type_2,
+                                                 S1[i+1], S1[m-1], S1[k-1], S1[l+1], pf_params) * scale[k-i+m-l];
+          }
+        }
+        if (ulength) { /* NOT IF WITHIN INNER LOOP */
+          for (i=MAX2(MAX2(l-winSize+1,k-MAXLOOP-1),1); i<=k-1; i++) {
+            for (m=l+1; m<=MIN2(MIN2(l+ MAXLOOP -k+i+2,i+winSize-1),n); m++) {
+              type = ptype[i][m];
+              if ((pR[i][m]>0)){
+                temp=pR[i][m]*qb[k][l]*exp_E_IntLoop(k-i-1, m-l-1, type, type_2,
+                                                     S1[i+1], S1[m-1], S1[k-1], S1[l+1], pf_params) * scale[k-i+m-l];
+                QI5[l][m-l-1]+=temp;
+                QI5[i][k-i-1]+=temp;
+              }
+            }
+           }
+        }
+      }
+      /* 3. bonding k,l as substem of multi-loop enclosed by i,m */
+      prm_MLb = 0.;
+      if(k>1) /*sonst nix!*/
+        for (l=MIN2(n-1,k+winSize-2); l>=k+TURN+1; l--) { /* opposite direction */
+          m=l+1;
+          prmt = prmt1 = 0.0;
+          tt = ptype[k-1][m]; tt=rtype[tt];
+          prmt1 = pR[k-1][m] * expMLclosing * exp_E_MLstem(tt, S1[l], S1[k], pf_params);
+          for (i=MAX2(1,l-winSize+2); i<k-1/*TURN*/; i++) {
+            tt = ptype[i][m]; tt = rtype[tt];
+            prmt += pR[i][m] * exp_E_MLstem(tt, S1[m-1], S1[i+1], pf_params) * qm[i+1][k-1];
+          }
+          tt = ptype[k][l];
+          prmt *= expMLclosing;
+          prml[ m] = prmt;
+          prm_l[m] = prm_l1[m]*expMLbase[1]+prmt1;
+
+          prm_MLb = prm_MLb*expMLbase[1] + prml[m];
+          /* same as:    prm_MLb = 0;
+             for (i=n; i>k; i--)  prm_MLb += prml[i]*expMLbase[k-i-1];
+          */
+          prml[m] = prml[ m] + prm_l[m];
+
+          if (qb[k][l] == 0.) continue;
+
+          temp = prm_MLb;
+
+          if (ulength) {
+            double dang;
+            /* coefficient for computations of unpairedarrays */
+            dang  =   qb[k][l] * exp_E_MLstem(tt, S1[k-1], S1[l+1], pf_params) * scale[2];
+            for (m=MIN2(k+winSize-2,n);m>=l+2; m--){
+              qmb[l][m-l-1] +=  prml[m]*dang;
+              q2l[l][m-l-1] +=  (prml[m]-prm_l[m])*dang;
+            }
+          }
+
+          for (m=MIN2(k+winSize-2,n);m>=l+2; m--)
+            temp += prml[m]*qm[l+1][m-1];
+
+          temp      *= exp_E_MLstem(tt, (k>1) ? S1[k-1] : -1, (l<n) ? S1[l+1] : -1, pf_params) * scale[2];
+          pR[k][l]  += temp;
+
+          if (pR[k][l]>Qmax) {
+            Qmax = pR[k][l];
+            if (Qmax>max_real/10.)
+              vrna_message_warning("P close to overflow: %d %d %g %g\n",
+                                          i, m, pR[k][l], qb[k][l]);
+          }
+          if (pR[k][l]>=max_real) {
+            ov++;
+            pR[k][l]=FLT_MAX;
+          }
+
+        } /* end for (l=..) */
+      tmp = prm_l1; prm_l1=prm_l; prm_l=tmp;
+
+      /* end for (l=..)   */
+      if ((ulength)&&(k-MAXLOOP-1>0)){
+        /* if (pUoutput) pU[k-MAXLOOP-1]=(double *)vrna_alloc((ulength+2)*sizeof(double)); */
+        if(split){ /*generate the new arrays, if you want them somewhere else, you have to generate them and overgive them ;)*/
+          double **pUO;
+          double **pUI;
+          double **pUM;
+          double **pUH;
+          pUO= (double **)  vrna_alloc((n+1)*sizeof(double *));
+          pUI= (double **)  vrna_alloc((n+1)*sizeof(double *));
+          pUM= (double **)  vrna_alloc((n+1)*sizeof(double *));
+          pUH= (double **)  vrna_alloc((n+1)*sizeof(double *));
+          if (pUoutput) {
+            for (i=1; i<=ulength; i++) {
+              pUH[i]=(double *)vrna_alloc((MAX2(MAXLOOP,ulength)+2)*sizeof(double));
+              pUI[i]=(double *)vrna_alloc((MAX2(MAXLOOP,ulength)+2)*sizeof(double));
+              pUO[i]=(double *)vrna_alloc((MAX2(MAXLOOP,ulength)+2)*sizeof(double));
+              pUM[i]=(double *)vrna_alloc((MAX2(MAXLOOP,ulength)+2)*sizeof(double));
+            }
+          }
+          //dont want to have that yet?
+          /*  else {
+            for (i=1; i<=n; i++) pU[i]=(double *)vrna_alloc((MAX2(MAXLOOP,ulength)+2)*sizeof(double));
+            }*/
+          compute_pU_splitup(k-MAXLOOP-1,ulength,pU,pUO,pUH, pUI, pUM, winSize, n, sequence);
+          if (pUoutput) {
+            putoutpU_splitup(pUO,k-MAXLOOP-1, ulength, pUfp,'E');
+            putoutpU_splitup(pUH,k-MAXLOOP-1, ulength, pUfp,'H');
+            putoutpU_splitup(pUI,k-MAXLOOP-1, ulength, pUfp,'I');
+            putoutpU_splitup(pUM,k-MAXLOOP-1, ulength, pUfp,'M');
+          }
+        }
+        else {
+        compute_pU(k-MAXLOOP-1,ulength,pU, winSize, n, sequence);
+
+        /* here, we put out and free pUs not in use any more (hopefully) */
+        if (pUoutput)
+          putoutpU(pU,k-MAXLOOP-1, ulength, pUfp);
+      }
+      }
+
+      if (j-(2*winSize+MAXLOOP+1)>0) {
+        printpbar(pR,winSize,j-(2*winSize+MAXLOOP+1),n);
+        if (simply_putout) {
+          print_plist(n, j-(2*winSize+MAXLOOP+1), pR, winSize, spup);
+        }
+        else{
+          pl=get_plistW(pl, n, j-(2*winSize+MAXLOOP+1), pR, winSize);
+        }
+        if (do_dpp)dpp=get_deppp(dpp,j-(2*winSize-MAXLOOP),pairSize, n);
+        FreeOldArrays(j-(2*winSize+MAXLOOP+1));
+      }
+    }   /* end if (do_backtrack)*/
+
+  }/* end for j */
+
+  /* finish output and free */
+  for (j=MAX2(1,n-MAXLOOP); j<=n;j++) {
+    /* if (pUoutput) pU[j]=(double *)vrna_alloc((ulength+2)*sizeof(double)); */
+    if (ulength) compute_pU(j,ulength,pU, winSize, n, sequence);
+    /*here, we put out and free pUs not in use any more (hopefully)*/
+    if (pUoutput) putoutpU(pU,j, ulength, pUfp);
+  }
+  for (j=MAX2(n-winSize-MAXLOOP,1); j<=n; j++) {
+    printpbar(pR,winSize,j,n);
+    if (simply_putout) {
+      print_plist(n, j, pR, winSize, spup);
+    }
+    else {
+      pl=get_plistW(pl, n, j, pR, winSize);
+    }
+    if ((do_dpp)&&j<n) dpp=get_deppp(dpp,j,pairSize, n);
+    FreeOldArrays(j);
+  }
+  /* free_pf_arrays_L(); */
+  free(S);
+  free(S1);
+  S = S1 = NULL;
+  if(ov > 0)
+    vrna_message_warning("%d overflows occurred while backtracking;\n"
+                                "you might try a smaller pf_scale than %g\n",
+                                ov, pf_params->pf_scale);
+  *dpp2=dpp;
+
+  return pl;
+}
+
+PRIVATE void scale_pf_params(unsigned int length, vrna_exp_param_t *parameters){
+  unsigned int i;
+  double  kT, scaling_factor;
+
+  if(pf_params) free(pf_params);
+
+  if(parameters){
+    pf_params = vrna_exp_params_copy(parameters);
+  } else {
+    vrna_md_t  md;
+    set_model_details(&md);
+    pf_params = vrna_exp_params(&md);
+  }
+
+  scaling_factor = pf_params->pf_scale;
+  kT = pf_params->kT;   /* kT in cal/mol  */
+
+   /* scaling factors (to avoid overflows) */
+  if (scaling_factor == -1) { /* mean energy for random sequences: 184.3*length cal */
+    scaling_factor = exp(-(-185+(pf_params->temperature-37.)*7.27)/kT);
+    if (scaling_factor<1) scaling_factor=1;
+    pf_params->pf_scale = scaling_factor;
+  }
+  scale[0] = 1.;
+  scale[1] = 1./scaling_factor;
+  expMLbase[0] = 1;
+  expMLbase[1] = pf_params->expMLbase/scaling_factor;
+  for (i=2; i<=length; i++) {
+    scale[i] = scale[i/2]*scale[i-(i/2)];
+    expMLbase[i] = pow(pf_params->expMLbase, (double)i) * scale[i];
+  }
+}
+
+PRIVATE void printpbar(FLT_OR_DBL **prb,int winSize, int i, int n) {
+  int j;
+  int howoften=0; /* how many samples do we have for this pair */
+  int pairdist;
+
+  for (j=i+TURN; j<MIN2(i+winSize,n+1); j++) {
+    pairdist=(j-i+1);
+    /*4cases*/
+    howoften=MIN2(winSize-pairdist+1,i); /*pairdist,start*/
+    howoften=MIN2(howoften,n-j+1);       /*end*/
+    howoften=MIN2(howoften,n-winSize+1); /*windowsize*/
+    prb[i][j] *= qb[i][j]/howoften;
+  }
+  return;
+}
+
+PRIVATE void FreeOldArrays(int i) {
+  /*free arrays no longer needed*/
+  free(pR[i]+i);
+  free(q[i]+i);
+  free(qb[i]+i);
+  free(qm[i]+i);
+  if (ulength!=0) {
+    free(qm2[i]+i);
+    free(QI5[i]);
+    free(qmb[i]);
+    free(q2l[i]);
+  }
+  free(ptype[i]+i);
+  return;
+}
+
+PRIVATE void GetNewArrays(int j, int winSize) {
+  /*allocate new part of arrays*/
+  pR[j]=(FLT_OR_DBL *)vrna_alloc((winSize+1)*sizeof(FLT_OR_DBL));
+  pR[j]-=j;
+  q[j]=(FLT_OR_DBL *)vrna_alloc((winSize+1)*sizeof(FLT_OR_DBL));
+  q[j]-=j;
+  qb[j]=(FLT_OR_DBL *)vrna_alloc((winSize+1)*sizeof(FLT_OR_DBL));
+  qb[j]-=j;
+  qm[j]=(FLT_OR_DBL *)vrna_alloc((winSize+1)*sizeof(FLT_OR_DBL));
+  qm[j]-=j;
+  if (ulength!=0) {
+    qm2[j]=(FLT_OR_DBL *)vrna_alloc((winSize+1)*sizeof(FLT_OR_DBL));
+    qm2[j]-=j;
+    QI5[j]=(FLT_OR_DBL *)vrna_alloc((winSize+1)*sizeof(FLT_OR_DBL));
+    qmb[j]=(FLT_OR_DBL *)vrna_alloc((winSize+1)*sizeof(FLT_OR_DBL));
+    q2l[j]=(FLT_OR_DBL *)vrna_alloc((winSize+1)*sizeof(FLT_OR_DBL));
+  }
+  ptype[j]=(char *)vrna_alloc((winSize+1)*sizeof(char));
+  ptype[j]-=j;
+  return;
+}
+
+
+PRIVATE void GetPtype(int i, int winSize,const short *S,int n) {
+  /*make new entries in ptype array*/
+  int j;
+  int type;
+  for (j=i; j<=MIN2(i+winSize,n); j++) {
+    type = pair[S[i]][S[j]];
+    ptype[i][j] = (char) type;
+  }
+  return;
+}
+
+
+PRIVATE plist *get_plistW(plist *pl, int length,
+                                 int start, FLT_OR_DBL **Tpr, int winSize) {
+  /* get pair probibilities out of pr array */
+  int  j,  max_p;
+  max_p=1000;
+  while (max_p<num_p)
+    max_p*=2;
+
+  for (j=start+1; j<=MIN2(start+winSize, length); j++) {
+    if (Tpr[start][j]<cutoff) continue;
+    if (num_p==max_p-1) {
+      max_p*=2;
+      pl=(plist *)vrna_realloc(pl,max_p*sizeof(plist));
+    }
+    pl[num_p].i=start;
+    pl[num_p].j=j;
+    pl[num_p++].p=Tpr[start][j];
+  }
+
+  /* mark end of data with zeroes */
+  pl[num_p].i=0;
+  pl[num_p].j=0;
+  pl[num_p].p=0.;
+  /* pl=(plist *)vrna_realloc(pl,(count)*sizeof(plist)); */
+  return pl;
+}
+
+
+PRIVATE plist *get_deppp(plist *pl, int start, int pairsize, int length) {
+  /* compute dependent pair probabilities */
+  int i, j, count=0;
+  double tmp;
+  plist *temp;
+  temp=(plist *)vrna_alloc(pairsize*sizeof(plist)); /* holds temporary deppp */
+  for (j=start+TURN; j<MIN2(start+pairsize,length); j++) {
+
+    if ((qb[start][j]*qb[start-1][(j+1)])>10e-200) {
+      int type=ptype[start-1][j+1];
+      int type_2=rtype[(unsigned char)ptype[start][j]];
+      tmp=qb[start][j]/qb[start-1][(j+1)]*exp_E_IntLoop(0, 0, type, type_2,
+                                                        S1[start], S1[j], S1[start-1], S1[j+1], pf_params) * scale[2];
+       temp[count].i=start;
+      temp[count].j=j;
+      temp[count++].p=tmp;
+    }
+  }
+  /* write it to list of deppps */
+  for (i=0; pl[i].i!=0; i++);
+  pl=(plist *)vrna_realloc(pl,(i+count+1)*sizeof(plist));
+  for (j=0; j<count; j++) {
+    pl[i+j].i=temp[j].i;
+    pl[i+j].j=temp[j].j;
+    pl[i+j].p=temp[j].p;
+  }
+  pl[i+count].i=0;
+  pl[i+count].j=0;
+  pl[i+count].p=0;
+  free(temp);
+  return pl;
+}
+
+
+PRIVATE void print_plist(int length,int start, FLT_OR_DBL **Tpr, int winSize, FILE *fp) {
+  /* print out of pr array, do not save */
+  int  j;
+
+
+  for (j=start+1; j<=MIN2(start+winSize, length); j++) {
+    if (Tpr[start][j]<cutoff) continue;
+    fprintf(fp,"%d  %d  %g\n",start,j,Tpr[start][j]);
+  }
+
+  /* mark end of data with zeroes */
+
+  return ;
+}
+
+PRIVATE void compute_pU(int k, int ulength, double **pU, int winSize,int n, char *sequence) {
+/*  here, we try to add a function computing all unpaired probabilities starting at some i,
+    going down to $unpaired, to be unpaired, i.e. a list with entries from 1 to unpaired for
+    every i, with the probability of a stretch of length x, starting at i-x+1, to be unpaired
+*/
+  int startu;
+  int i5;
+  int j3, len, obp;
+  double temp;
+  double *QBE;
+  FLT_OR_DBL  expMLclosing      = pf_params->expMLclosing;
+
+  QBE=(double *) vrna_alloc((MAX2(ulength,MAXLOOP)+2)*sizeof(double));
+
+  /* first, we will */
+  /* for k<=ulength, pU[k][k]=0, because no bp can enclose it */
+  if (pUoutput&&k+ulength<=n)  pU[k+ulength]=(double *)vrna_alloc((ulength+2)*sizeof(double));
+  /*compute pu[k+ulength][ulength] */
+   for (i5=MAX2(k+ulength-winSize+1,1);i5<=k;i5++) {
+    for (j3=k+ulength+1; j3<=MIN2(n,i5+winSize-1); j3++) {
+      /*  if (k>400) {
+        printf("i%d j%d  ",i5,j3);
+        fflush(stdout);
+        } */
+      if (ptype[i5][j3]!=0) {/**/
+        /* (.. >-----|..........)
+          i5  j     j+ulength  j3              */
+        /*Multiloops*/
+        temp = (i5<k) ? qm2[i5+1][k] * expMLbase[j3-k-1] : 0.; /* (..{}{}-----|......) */
+
+        if(j3-1>k+ulength)
+          temp  +=  qm2[k+ulength+1][j3-1] * expMLbase[k+ulength-i5]; /* (..|-----|{}{}) */
+
+        if((i5<k)&&(j3-1>k+ulength))
+          temp  +=  qm[i5+1][k] * qm[k+ulength+1][j3-1] * expMLbase[ulength]; /* ({}|-----|{}) */
+
+        /* add dangles, multloopclosing etc. */
+        temp  *=  exp_E_MLstem(rtype[(unsigned char)ptype[i5][j3]], S1[j3-1], S1[i5+1], pf_params) * scale[2] * expMLclosing;
+        /*add hairpins*/
+        temp  +=  exp_E_Hairpin(j3-i5-1, ptype[i5][j3], S1[i5+1], S1[j3-1], sequence+i5-1, pf_params) * scale[j3-i5+1];
+        /*add outer probability*/
+        temp *= pR[i5][j3];
+        pU[k+ulength][ulength] += temp;
+
+      }
+    }
+   }
+   /* code doubling to avoid if within loop */
+#if 0
+  /*initialization for interior loops,
+    it is not recomended to have verysmall ulengths!!*/
+  if (ulength<MAXLOOP) {
+    int k5;
+    int l3;
+    int outype;
+    /* kl bp is 5' */
+    /* MAXLOOP>((l5-k5-1)+(j3-l3-1)
+      k-winSize+ulength<i5<k-TURN-1;
+      k+ulength<j3<=k+MAXLOOP+1
+      if i then use l3, it is easier by far:
+      j3-MAXLOOP<=l3<=k
+      i5<k5<k-TURN k5<=i5+l3+2+MAXLOOP-j3
+      k5+TURN<l3<=k
+    */
+    for (i5=MAX2(k+ulength-winSize,1);i5<k-TURN-1;i5++) {
+
+      for (j3=k+ulength+1; j3<=MIN2(n,MIN2(i5+winSize-1,k+MAXLOOP+1)); j3++) {
+        double temp=0;
+        if (outype=ptype[i5][j3]>0) /* oder so halt */
+          for (l3=MAX2(i5+TURN+1,j3-MAXLOOP-1); l3<=k; l3++){
+            for (k5=i5+1; k5<=MIN2(l3-TURN-1,MAXLOOP+i5+l3+2-j3); k5++){
+              if (ptype[k5][l3]) {
+                temp+= qb[k5][l3]*expLoopEnergy(k5-i5-1, j3-l3-1, outype, rtype[ptype[k5][l3]], S1[i5+1], S1[j3-1], S1[k5-1], S1[l3+1]);
+              }
+            }
+          }
+        temp*=pR[i5][j3];
+        pU[k+ulength][ulength]+= temp;
+      }
+    }
+    /* kl bp is 3' */
+    /*
+      k+ulength-MAXLOOP<=i5<=k
+      k+ulength+1+TURN<j3<i5+winSize
+      k+ulength+1<=k5<i5+MAXLOOP+2 || k5<j3-TURN
+      k5<l3<j3 || j3-k5-i5-2-ML<=l3<j3
+    */
+    for (i5=MAX2(1,MAX2(k+ulength-winSize,k+ulength-MAXLOOP));i5<=k; i5++){
+      for (j3=k+ulength+TURN+2; j3<MIN2(n+1,i5+winSize); j3++) {
+        double temp = 0;
+        if (outype=ptype[i5][j3]>0) /* oder so halt */
+          for (k5=k+ulength+1; k5<MIN2(j3-TURN-1,i5+MAXLOOP+2); k5++) {
+            for (l3=MAX2(k5+TURN+1,j3+k5-i5-2-MAXLOOP); l3<j3; l3++) {
+              if (ptype[k5][l3])
+                temp += qb[k5][l3]*expLoopEnergy(k5-i5-1, j3-l3-1, outype, rtype[ptype[k5][l3]], S1[i5+1], S1[j3-1], S1[k5-1], S1[l3+1]);
+            }
+          }
+        temp*=pR[i5][j3];
+        pU[k+ulength][ulength]+= temp;
+      }
+    }
+  }
+  /* Add up Is QI5[l][m-l-1] QI3 */
+  /* Add up Interior loop terms */
+  temp=0.;
+
+  for (len=winSize; len>=ulength; len--) temp+=QI3[k][len];
+  for (;len>0; len--) {
+    temp += QI3[k][len];
+    QBE[len] += temp;
+  }
+#endif
+  temp=0.;
+  for (len=winSize; len>=MAX2(ulength,MAXLOOP); len--) temp+=QI5[k][len];
+  for (;len>0; len--) {
+    temp += QI5[k][len];
+    QBE[len] += temp;  /* replace QBE with QI */
+  }
+  /* Add Hairpinenergy to QBE */
+  temp=0.;
+  for(obp = MIN2(n, k + winSize - 1); obp > k + ulength; obp--)
+    if(ptype[k][obp])
+      temp += pR[k][obp] * exp_E_Hairpin(obp-k-1, ptype[k][obp], S1[k+1], S1[obp-1], sequence+k-1, pf_params) * scale[obp-k+1];
+  for(obp = MIN2(n, MIN2(k + winSize - 1, k + ulength)); obp > k + 1; obp--){
+    if (ptype[k][obp])
+      temp += pR[k][obp] * exp_E_Hairpin(obp-k-1, ptype[k][obp], S1[k+1], S1[obp-1], sequence+k-1, pf_params) * scale[obp-k+1];
+    QBE[obp-k-1] += temp;  /* add hairpins to QBE (all in one array) */
+  }
+  /* doubling the code to get the if out of the loop */
+
+  /* Add up Multiloopterms  qmb[l][m]+=prml[m]*dang;
+    q2l[l][m]+=(prml[m]-prm_l[m])*dang; */
+
+  temp=0.;
+  for(len = winSize; len >= ulength; len--)
+    temp += q2l[k][len] * expMLbase[len];
+  for( ; len > 0; len--){
+    temp += q2l[k][len] * expMLbase[len];
+    QBE[len] += temp; /* add (()()____) type cont. to I3 */
+  }
+  for(len = 1; len < ulength; len++){
+    for(obp = k + len + TURN; obp <= MIN2(n, k + winSize - 1); obp++){
+      /* add (()___()) */
+      QBE[len] += qmb[k][obp-k-1] * qm[k+len+1/*2*/][obp-1] * expMLbase[len];
+    }
+  }
+  for (len=1; len<ulength; len++) {
+    for (obp=k+len+TURN+TURN; obp<=MIN2(n,k+winSize-1); obp++) {
+      if (ptype[k][obp]) {
+        temp      =   exp_E_MLstem(rtype[(unsigned char)ptype[k][obp]], S1[obp-1], S1[k+1], pf_params) * scale[2] * expMLbase[len] * expMLclosing; /* k:obp */
+        QBE[len]  +=  pR[k][obp] * temp * qm2[k+len+1][obp-1]; /* add (___()()) */
+      }
+    }
+  }
+  /* After computing all these contributions in QBE[len], that k is paired
+    and the unpaired stretch is AT LEAST len long, we start to add that to
+    the old unpaired thingies; */
+  for(len = 1; len < MIN2(MAX2(ulength, MAXLOOP), n - k); len++){
+    pU[k+len][len] += pU[k+len][len+1] + QBE[len];
+  }
+
+  /*open chain*/
+  if ((ulength>=winSize)&&(k>=ulength)) {
+    pU[k][winSize]=scale[winSize]/q[k-winSize+1][k];
+  }
+  /* now the not enclosed by any base pair terms for whatever it is we do not need anymore...
+    ... which should be e.g; k, again */
+  for(startu = MIN2(ulength, k); startu > 0; startu--){
+    temp=0.;
+    for(i5 = MAX2(1, k - winSize + 2); i5 <= MIN2(k - startu, n - winSize + 1); i5++){
+      temp += q[i5][k - startu] * q[k + 1][i5 + winSize - 1] * scale[startu]/q[i5][i5 + winSize - 1];
+    }
+    /* the 2 Cases where the borders are on the edge of the interval */
+    if((k >= winSize) && (startu + 1 <= winSize))
+      temp += q[k - winSize + 1][k - startu]*scale[startu]/q[k - winSize + 1][k];
+    if((k <= n - winSize+ startu) && (k - startu >= 0) && (k < n) && (startu + 1 <= winSize))
+      temp += q[k + 1][k - startu + winSize] * scale[startu] / q[k - startu + 1][k - startu + winSize];
+
+    /* Divide by number of possible windows */
+    pU[k][startu] += temp;
+    {
+      int leftmost, rightmost;
+
+      leftmost      = MAX2(1, k - winSize + 1);
+      rightmost     = MIN2(n - winSize + 1, k - startu + 1);
+      pU[k][startu] /= (rightmost - leftmost + 1);
+    }
+  }
+  free(QBE);
+  return;
+}
+
+
+PRIVATE void putoutpU(double **pUx, int k, int ulength, FILE *fp) {
+  /*put out unpaireds for k, and free pU[k], make sure we don't need pU[k] any more!!*/
+  /*could use that for hairpins, also!*/
+  int i;
+  fprintf(fp,"%d\t",k);
+  for (i=1; i<=MIN2(ulength,k); i++) {
+    fprintf(fp,"%.5g\t",pUx[k][i]);
+  }
+  fprintf(fp,"\n");
+  free(pUx[k]);
+}
+PRIVATE void putoutpU_splitup(double **pUx, int k, int ulength, FILE *fp, char ident) {
+  /*put out unpaireds for k, and free pU[k], make sure we don't need pU[k] any more!!*/
+  /*could use that for hairpins, also!*/
+  int i;
+  fprintf(fp,"%d\t",k);
+  for (i=1; i<=MIN2(ulength,k); i++) {
+    fprintf(fp,"%.5g\t",pUx[k][i]);
+  }
+  fprintf(fp,"\t%c\n",ident);
+  free(pUx[k]);
+}
+
+PUBLIC void putoutpU_prob(double **pU,int length, int ulength, FILE *fp, int energies) {
+  putoutpU_prob_par(pU, length, ulength, fp, energies, pf_params);
+}
+
+
+PUBLIC void putoutpU_prob_par(double **pU,int length, int ulength, FILE *fp, int energies, vrna_exp_param_t *parameters){
+  /*put out unpaireds */
+  int i,k;
+  double kT = parameters->kT/1000.0;
+  double temp;
+  if (energies) fprintf(fp,"#opening energies\n #i$\tl=");
+  else  fprintf(fp,"#unpaired probabilities\n #i$\tl=");
+  for (i=1; i<=ulength; i++) {
+    fprintf(fp,"%d\t", i);
+  }
+  fprintf(fp,"\n");
+
+  for (k=1; k<=length; k++){
+    fprintf(fp,"%d\t",k);
+    for (i=1; i<=ulength; i++) {
+      if (i>k) {
+        fprintf(fp,"NA\t");
+        continue;
+      }
+      if (energies) temp=-log(pU[k][i])*kT;
+      else temp=pU[k][i];
+      fprintf(fp,"%.7g\t",temp);
+    }
+    fprintf(fp,"\n");
+    free(pU[k]);
+  }
+  fflush(fp);
+}
+
+PUBLIC void putoutpU_prob_bin(double **pU,int length, int ulength, FILE *fp, int energies) {
+  putoutpU_prob_bin_par(pU, length, ulength, fp, energies, pf_params);
+}
+
+PUBLIC void putoutpU_prob_bin_par(double **pU,int length, int ulength, FILE *fp, int energies, vrna_exp_param_t *parameters) {
+
+  /*put out unpaireds */
+  int i,k;
+  double kT= parameters->kT/1000.0;
+  int *p;
+  p = (int*) vrna_alloc(sizeof(int)*1);
+  /* write first line */
+  p[0]=ulength; /* u length */
+  fwrite(p,sizeof(int),1,fp);
+  p[0]=length; /* seq length */
+  fwrite(p,sizeof(int),1,fp);
+  for (k=3; k<=(length+20); k++){ /* all the other lines are set to 1000000 because we are at ulength=0 */
+    p[0]=1000000;
+    fwrite(p,sizeof(int),1,fp);
+  }
+  /* data */
+  for (i=1; i<=ulength; i++) {
+    for (k=1; k<=11; k++){/* write first ten entries to 1000000 */
+      p[0]=1000000;
+      fwrite(p,sizeof(int),1,fp);
+    }
+    for (k=1; k<=length; k++){/* write data now */
+      if (i>k) {
+        p[0]=1000000;         /* check if u > pos */
+        fwrite(p,sizeof(int),1,fp);
+        continue;
+      }
+      else{
+        p[0]= (int) rint(100 *(-log(pU[k][i])*kT));
+        fwrite(p,sizeof(int),1,fp);
+      }
+    }
+    for (k=1; k<=9; k++){/* finish by writing the last 10 entries */
+      p[0]=1000000;
+      fwrite(p,sizeof(int),1,fp);
+    }
+  }
+  /* free pU array; */
+  for (k=1; k<=length; k++){
+    free(pU[k]);
+  }
+  free(p);
+  fflush(fp);
+}
+
+
+/*
+ Here: Space for questions...
+*/
+PRIVATE void compute_pU_splitup(int k, int ulength, double **pU,  double **pUO, double **pUH, double **pUI, double **pUM, int winSize,int n, char *sequence) {
+/*  here, we try to add a function computing all unpaired probabilities starting at some i,
+    going down to $unpaired, to be unpaired, i.e. a list with entries from 1 to unpaired for
+    every i, with the probability of a stretch of length x, starting at i-x+1, to be unpaired
+*/
+  int startu;
+  int i5;
+  int j3, len, obp;
+  double temp;
+  double *QBE;
+  double *QBI;
+  double *QBM;
+  double *QBH;
+  
+  FLT_OR_DBL  expMLclosing      = pf_params->expMLclosing;
+
+  QBE=(double *) vrna_alloc((MAX2(ulength,MAXLOOP)+2)*sizeof(double));
+  QBM=(double *) vrna_alloc((MAX2(ulength,MAXLOOP)+2)*sizeof(double));
+  QBI=(double *) vrna_alloc((MAX2(ulength,MAXLOOP)+2)*sizeof(double));
+  QBH=(double *) vrna_alloc((MAX2(ulength,MAXLOOP)+2)*sizeof(double));
+
+  /* first, we will */
+  /* for k<=ulength, pU[k][k]=0, because no bp can enclose it */
+  if (pUoutput&&k+ulength<=n)  pU[k+ulength]=(double *)vrna_alloc((ulength+2)*sizeof(double));
+  /*compute pu[k+ulength][ulength] */
+   for (i5=MAX2(k+ulength-winSize+1,1);i5<=k;i5++) {
+    for (j3=k+ulength+1; j3<=MIN2(n,i5+winSize-1); j3++) {
+      /*  if (k>400) {
+        printf("i%d j%d  ",i5,j3);
+        fflush(stdout);
+        } */
+      if (ptype[i5][j3]!=0) {/**/
+        /* (.. >-----|..........)
+          i5  j     j+ulength  j3              */
+        /*Multiloops*/
+        temp = (i5<k) ? qm2[i5+1][k] * expMLbase[j3-k-1] : 0.; /* (..{}{}-----|......) */
+
+        if(j3-1>k+ulength)
+          temp  +=  qm2[k+ulength+1][j3-1] * expMLbase[k+ulength-i5]; /* (..|-----|{}{}) */
+
+        if((i5<k)&&(j3-1>k+ulength))
+          temp  +=  qm[i5+1][k] * qm[k+ulength+1][j3-1] * expMLbase[ulength]; /* ({}|-----|{}) */
+
+        /* add dangles, multloopclosing etc. */
+        temp  *=  exp_E_MLstem(rtype[(unsigned char)ptype[i5][j3]], S1[j3-1], S1[i5+1], pf_params) * scale[2] * expMLclosing;
+        /*add hairpins*/
+        temp  +=  exp_E_Hairpin(j3-i5-1, ptype[i5][j3], S1[i5+1], S1[j3-1], sequence+i5-1, pf_params) * scale[j3-i5+1];
+        /*add outer probability*/
+        temp *= pR[i5][j3];
+        pU[k+ulength][ulength] += temp;
+
+      }
+    }
+   }
+   /* code doubling to avoid if within loop */
+  temp=0.;
+  for (len=winSize; len>=MAX2(ulength,MAXLOOP); len--) temp+=QI5[k][len];
+  for (;len>0; len--) {
+    temp += QI5[k][len];
+    QBI[len] += temp; 
+    QBE[len] += temp;  /* replace QBE with QI */
+  }
+  /* Add Hairpinenergy to QBE */
+  temp=0.;
+  for(obp = MIN2(n, k + winSize - 1); obp > k + ulength; obp--)
+    if(ptype[k][obp])
+      temp += pR[k][obp] * exp_E_Hairpin(obp-k-1, ptype[k][obp], S1[k+1], S1[obp-1], sequence+k-1, pf_params) * scale[obp-k+1];
+  for(obp = MIN2(n, MIN2(k + winSize - 1, k + ulength)); obp > k + 1; obp--){
+    if (ptype[k][obp])
+      temp += pR[k][obp] * exp_E_Hairpin(obp-k-1, ptype[k][obp], S1[k+1], S1[obp-1], sequence+k-1, pf_params) * scale[obp-k+1];
+    QBH[obp-k-1] += temp;
+    QBE[obp-k-1] += temp;  /* add hairpins to QBE (all in one array) */
+  }
+  /* doubling the code to get the if out of the loop */
+
+  /* Add up Multiloopterms  qmb[l][m]+=prml[m]*dang;
+    q2l[l][m]+=(prml[m]-prm_l[m])*dang; */
+
+  temp=0.;
+  for(len = winSize; len >= ulength; len--)
+    temp += q2l[k][len] * expMLbase[len];
+  for( ; len > 0; len--){
+    temp += q2l[k][len] * expMLbase[len];
+    QBM[len] += temp; 
+    QBE[len] += temp; /* add (()()____) type cont. to I3 */
+  }
+  for(len = 1; len < ulength; len++){
+    for(obp = k + len + TURN; obp <= MIN2(n, k + winSize - 1); obp++){
+      /* add (()___()) */
+      QBM[len] += qmb[k][obp-k-1] * qm[k+len+1/*2*/][obp-1] * expMLbase[len];
+      QBE[len] += qmb[k][obp-k-1] * qm[k+len+1/*2*/][obp-1] * expMLbase[len];
+    }
+  }
+  for (len=1; len<ulength; len++) {
+    for (obp=k+len+TURN+TURN; obp<=MIN2(n,k+winSize-1); obp++) {
+      if (ptype[k][obp]) {
+        temp      =   exp_E_MLstem(rtype[(unsigned char)ptype[k][obp]], S1[obp-1], S1[k+1], pf_params) * scale[2] * expMLbase[len] * expMLclosing; /* k:obp */
+        QBE[len]  +=  pR[k][obp] * temp * qm2[k+len+1][obp-1]; /* add (___()()) */
+        QBM[len]  +=  pR[k][obp] * temp * qm2[k+len+1][obp-1]; /* add (___()()) */
+      }
+    }
+  }
+  /* After computing all these contributions in QBE[len], that k is paired
+    and the unpaired stretch is AT LEAST len long, we start to add that to
+    the old unpaired thingies; */
+  for(len = 1; len < MIN2(MAX2(ulength, MAXLOOP), n - k); len++){
+    pU[k+len][len] += pU[k+len][len+1] + QBE[len];
+    pUH[k+len][len] += pUH[k+len][len+1] + QBH[len];
+    pUM[k+len][len] += pUM[k+len][len+1] + QBM[len];
+    pUI[k+len][len] += pUI[k+len][len+1] + QBI[len];
+    
+  }
+
+  /* open chain */
+  if ((ulength>=winSize)&&(k>=ulength)) {
+    pUO[k][winSize]=scale[winSize]/q[k-winSize+1][k];
+  }
+  /*open chain*/
+  if ((ulength>=winSize)&&(k>=ulength)) {
+    pU[k][winSize]=scale[winSize]/q[k-winSize+1][k];
+  }
+  /* now the not enclosed by any base pair terms for whatever it is we do not need anymore...
+    ... which should be e.g; k, again */
+  for(startu = MIN2(ulength, k); startu > 0; startu--){
+    temp=0.;
+    for(i5 = MAX2(1, k - winSize + 2); i5 <= MIN2(k - startu, n - winSize + 1); i5++){
+      temp += q[i5][k - startu] * q[k + 1][i5 + winSize - 1] * scale[startu]/q[i5][i5 + winSize - 1];
+    }
+    /* the 2 Cases where the borders are on the edge of the interval */
+    if((k >= winSize) && (startu + 1 <= winSize))
+      temp += q[k - winSize + 1][k - startu]*scale[startu]/q[k - winSize + 1][k];
+    if((k <= n - winSize+ startu) && (k - startu >= 0) && (k < n) && (startu + 1 <= winSize))
+      temp += q[k + 1][k - startu + winSize] * scale[startu] / q[k - startu + 1][k - startu + winSize];
+
+    /* Divide by number of possible windows */
+    pU[k][startu] += temp;
+    pUO[k][startu] += temp;
+    
+    {
+      int leftmost, rightmost;
+
+      leftmost      = MAX2(1, k - winSize + 1);
+      rightmost     = MIN2(n - winSize + 1, k - startu + 1);
+      pU[k][startu] /= (rightmost - leftmost + 1);
+      /*Do we want to make a distinction between those?*/
+      pUH[k][startu] /= (rightmost - leftmost + 1);
+      pUO[k][startu] /= (rightmost - leftmost + 1);
+      pUI[k][startu] /= (rightmost - leftmost + 1);
+      pUM[k][startu] /= (rightmost - leftmost + 1);
+    }
+  }
+  free(QBE);
+  free(QBI);
+  free(QBH);
+  free(QBM);
+  return;
+}
+PUBLIC void putoutpU_prob_splitup(double **pU, double **pUO, double **pUH, double **pUI, double **pUM, int length, int ulength, FILE *fp, int energies) {
+  /*put out unpaireds */
+  int i,k;
+  double kT= (temperature+K0)*GASCONST/1000.0;
+  double temp;
+  if (energies) fprintf(fp,"#opening energies\n #i$\tl=");
+  else  fprintf(fp,"#unpaired probabilities\n #i$\tl=");
+  
+  fprintf(fp,"Total\n");
+  for (i=1; i<=ulength; i++) {
+    fprintf(fp,"%d\t", i);
+  }
+  fprintf(fp,"\n");
+
+  for (k=1; k<=length; k++){
+    fprintf(fp,"%d\t",k);
+    for (i=1; i<=ulength; i++) {
+      if (i>k) {
+        fprintf(fp,"NA\t");
+        continue;
+      }
+      if (energies) temp=-log(pU[k][i])*kT;
+      else temp=pU[k][i];
+      fprintf(fp,"%.7g\t",temp);
+    }
+    fprintf(fp,"\tT\n");
+    free(pU[k]);
+  }
+  fprintf(fp,"\n###################################################################\nHairpin\n");
+  for (i=1; i<=ulength; i++) {
+    fprintf(fp,"%d\t", i);
+  }
+  fprintf(fp,"\n");
+
+  for (k=1; k<=length; k++){
+    fprintf(fp,"%d\t",k);
+    for (i=1; i<=ulength; i++) {
+      if (i>k) {
+        fprintf(fp,"NA\t");
+        continue;
+      }
+      if (energies) temp=-log(pUH[k][i])*kT;
+      else temp=pUH[k][i];
+      fprintf(fp,"%.7g\t",temp);
+    }
+    fprintf(fp,"\tH\n");
+    free(pUH[k]);
+  }
+  fprintf(fp,"\n###################################################################\nInterior\n");
+  for (i=1; i<=ulength; i++) {
+    fprintf(fp,"%d\t", i);
+  }
+  fprintf(fp,"\n");
+
+  for (k=1; k<=length; k++){
+    fprintf(fp,"%d\t",k);
+    for (i=1; i<=ulength; i++) {
+      if (i>k) {
+        fprintf(fp,"NA\t");
+        continue;
+      }
+      if (energies) temp=-log(pUI[k][i])*kT;
+      else temp=pUI[k][i];
+      fprintf(fp,"%.7g\t",temp);
+    }
+    fprintf(fp,"\tI\n");
+    free(pUI[k]);
+  }
+  fprintf(fp,"\n###################################################################\nMultiloop\n");
+  for (i=1; i<=ulength; i++) {
+    fprintf(fp,"%d\t", i);
+  }
+  fprintf(fp,"\n");
+
+  for (k=1; k<=length; k++){
+    fprintf(fp,"%d\t",k);
+    for (i=1; i<=ulength; i++) {
+      if (i>k) {
+        fprintf(fp,"NA\t");
+        continue;
+      }
+      if (energies) temp=-log(pUM[k][i])*kT;
+      else temp=pUM[k][i];
+      fprintf(fp,"%.7g\t",temp);
+    }
+    fprintf(fp,"\tM\n");
+    free(pUM[k]);
+  }
+  fprintf(fp,"\n###################################################################\nExterior\n");
+  for (i=1; i<=ulength; i++) {
+    fprintf(fp,"%d\t", i);
+  }
+  fprintf(fp,"\t E\n");
+
+  for (k=1; k<=length; k++){
+    fprintf(fp,"%d\t",k);
+    for (i=1; i<=ulength; i++) {
+      if (i>k) {
+        fprintf(fp,"NA\t");
+        continue;
+      }
+      if (energies) temp=-log(pUO[k][i])*kT;
+      else temp=pUO[k][i];
+      fprintf(fp,"%.7g\t",temp);
+    }
+    fprintf(fp,"\n");
+    free(pU[k]);
+  }
+  fflush(fp);
+}
+
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC void init_pf_foldLP(int length){ /* DO NOTHING */}
+
diff --git a/C/ViennaRNA/LPfold.h b/C/ViennaRNA/LPfold.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/LPfold.h
@@ -0,0 +1,167 @@
+#ifndef VIENNA_RNA_PACKAGE_LPFOLD_H
+#define VIENNA_RNA_PACKAGE_LPFOLD_H
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file     LPfold.h
+ *  @ingroup  local_fold
+ *  @brief    Partition function implementation for the Lfold algorithm
+ *
+ */
+
+
+/**
+ *  \brief
+ *
+ *  \ingroup local_pf_fold
+ * 
+ *  \param  length
+ */
+void update_pf_paramsLP(int length);
+
+/**
+ *  \brief
+ *
+ *  \ingroup local_pf_fold
+ * 
+ */
+void update_pf_paramsLP_par(int length, vrna_exp_param_t *parameters);
+
+/**
+ *  \brief Compute partition functions for locally stable secondary structures
+ * 
+ *  pfl_fold computes partition functions for every window of size
+ *  'winSize' possible in a RNA molecule, allowing only pairs with a span
+ *  smaller than 'pairSize'. It returns the mean pair probabilities averaged
+ *  over all windows containing the pair in 'pl'. 'winSize' should
+ *  always be >= 'pairSize'. Note that in contrast to Lfold(),
+ *  bases outside of the window do not influence the structure at all. Only
+ *  probabilities higher than 'cutoffb' are kept.
+ * 
+ *  If 'pU' is supplied (i.e is not the NULL pointer), pfl_fold()
+ *  will also compute the mean probability that regions of length 'u' and smaller are 
+ *  unpaired. The parameter 'u' is supplied in 'pup[0][0]'. On return
+ *  the 'pup' array will contain these probabilities, with the entry on
+ *  'pup[x][y]' containing the mean probability that x and the y-1
+ *  preceding bases are unpaired. The 'pU' array needs to be large
+ *  enough to hold n+1 float* entries, where n is the sequence length.
+ * 
+ *  If an array dpp2 is supplied, the probability of base pair (i,j)
+ *  given that there already exists a base pair (i+1,j-1) is also
+ *  computed and saved in this array. If pUfp is given (i.e. not NULL), pU
+ *  is not saved but put out imediately. If spup is given (i.e. is not NULL),
+ *  the pair probabilities in pl are not saved but put out imediately.
+ *
+ *  \ingroup local_pf_fold
+ * 
+ *  \param  sequence  RNA sequence
+ *  \param  winSize   size of the window
+ *  \param  pairSize  maximum size of base pair
+ *  \param  cutoffb   cutoffb for base pairs
+ *  \param  pU        array holding all unpaired probabilities   
+ *  \param  dpp2  array of dependent pair probabilities    
+ *  \param  pUfp     file pointer for pU 
+ *  \param  spup     file pointer for pair probabilities   
+ *  \return list of pair probabilities       
+ */
+plist *pfl_fold(char *sequence,
+                int winSize,
+                int pairSize,
+                float cutoffb,
+                double **pU,
+                plist **dpp2,
+                FILE *pUfp,
+                FILE *spup);
+
+/**
+ *  \brief Compute partition functions for locally stable secondary structures
+ * 
+ *  \ingroup local_pf_fold
+ * 
+ */
+plist *pfl_fold_par(char *sequence,
+                    int winSize,
+                    int pairSize,
+                    float cutoffb,
+                    double **pU,
+                    plist **dpp2,
+                    FILE *pUfp,
+                    FILE *spup,
+                    vrna_exp_param_t *parameters);
+
+
+void putoutpU_prob_par( double **pU,
+                        int length,
+                        int ulength,
+                        FILE *fp,
+                        int energies,
+                        vrna_exp_param_t *parameters);
+
+
+/**
+ *  \brief Writes the unpaired probabilities (pU) or opening energies into a file
+ * 
+ *  Can write either the unpaired probabilities (accessibilities) pU or
+ *  the opening energies -log(pU)kT into a file
+ * 
+ *  \ingroup local_pf_fold
+ * 
+ *  \param  pU       pair probabilities
+ *  \param  length   length of RNA sequence 
+ *  \param  ulength  maximum length of unpaired stretch 
+ *  \param  fp file pointer of destination file       
+ *  \param  energies  switch to put out as  opening energies 
+ */
+void    putoutpU_prob(double **pU,
+                      int length,
+                      int ulength,
+                      FILE *fp,
+                      int energies);
+
+void putoutpU_prob_bin_par( double **pU,
+                            int length,
+                            int ulength,
+                            FILE *fp,
+                            int energies,
+                            vrna_exp_param_t *parameters);
+
+/**
+ *  \brief Writes the unpaired probabilities (pU) or opening energies into a binary file 
+ * 
+ *  Can write either the unpaired probabilities (accessibilities) pU or
+ *  the opening energies -log(pU)kT into a file
+ * 
+ *  \ingroup local_pf_fold
+ * 
+ *  \param  pU       pair probabilities
+ *  \param  length   length of RNA sequence 
+ *  \param  ulength  maximum length of unpaired stretch 
+ *  \param  fp file pointer of destination file       
+ *  \param  energies  switch to put out as  opening energies 
+ */
+void    putoutpU_prob_bin(double **pU,
+                          int length,
+                          int ulength,
+                          FILE *fp,
+                          int energies);
+
+/**
+ *  Dunno if this function was ever used by external programs linking to RNAlib, but it
+ *  was declared PUBLIC before.
+ *  Anyway, never use this function as it will be removed soon and does nothing at all
+ */
+DEPRECATED(void init_pf_foldLP(int length));
+
+#endif
diff --git a/C/ViennaRNA/Lfold.c b/C/ViennaRNA/Lfold.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/Lfold.c
@@ -0,0 +1,1413 @@
+/*
+                  minimum free energy
+                  RNA secondary structure prediction
+                  with maximum distance base pairs
+
+                  c Ivo Hofacker, Peter Stadler
+
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/Lfold.h"
+
+#ifdef USE_SVM
+#include "svm.h"
+#include "svm_utils.h"
+#endif
+
+#define MAXSECTORS                  500   /* dimension for a backtrack array */
+#define INT_CLOSE_TO_UNDERFLOW(i)   ((i) <= (INT_MIN/16))
+#define UNDERFLOW_CORRECTION        (INT_MIN/32)
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE float wrap_Lfold( vrna_fold_compound_t *vc,
+                          int with_zsc,
+                          double min_z,
+                          FILE *file);
+PRIVATE void  make_ptypes(vrna_fold_compound_t *vc,
+                          int i);
+PRIVATE char  *backtrack( vrna_fold_compound_t *vc,
+                          int start,
+                          int maxdist);
+PRIVATE int   fill_arrays(vrna_fold_compound_t *vc,
+                          int with_zsc,
+                          double min_z,
+#ifdef USE_SVM
+                          struct svm_model *avg_model,
+                          struct svm_model *sd_model,
+#endif
+                          int *underflow,
+                          FILE *output);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC float
+vrna_Lfold( const char *string,
+            int window_size,
+            FILE  *file){
+
+  float               energy;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t           md;
+
+  vrna_md_set_default(&md);
+
+  md.window_size = window_size;
+  md.max_bp_span = window_size;
+
+  vc  = vrna_fold_compound(string, &md, VRNA_OPTION_WINDOW);
+
+  energy = wrap_Lfold(vc, 0, 0.0, file);
+
+  vrna_fold_compound_free(vc);
+
+  return energy;
+}
+
+PUBLIC float
+vrna_mfe_window( vrna_fold_compound_t *vc,
+            FILE *file){
+
+  return wrap_Lfold(vc, 0, 0.0, file);
+}
+
+#ifdef USE_SVM
+
+PUBLIC float
+vrna_Lfoldz(const char *string,
+            int window_size,
+            double min_z,
+            FILE *file){
+
+  float               energy;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t           md;
+
+  vrna_md_set_default(&md);
+
+  md.window_size = window_size;
+  md.max_bp_span = window_size;
+
+  vc  = vrna_fold_compound(string, &md, VRNA_OPTION_WINDOW);
+
+  energy = wrap_Lfold(vc, 1, min_z, file);
+
+  vrna_fold_compound_free(vc);
+
+  return energy;
+}
+
+PUBLIC float
+vrna_mfe_window_zscore( vrna_fold_compound_t *vc,
+             double min_z,
+             FILE *file){
+
+  return wrap_Lfold(vc, 1, min_z, file);
+}
+
+#endif
+
+/*
+#####################################
+# BEGIN OF STATIC HELPER FUNCTIONS  #
+#####################################
+*/
+
+PRIVATE float
+wrap_Lfold( vrna_fold_compound_t *vc,
+            int with_zsc,
+            double min_z,
+            FILE *file){
+
+  int     i, energy, underflow, n, maxdist;
+  float   mfe_local;
+  FILE    *out;
+
+#ifdef USE_SVM
+  struct svm_model  *avg_model = NULL;
+  struct svm_model  *sd_model = NULL;
+#endif
+
+  if(!vrna_fold_compound_prepare(vc, VRNA_OPTION_MFE | VRNA_OPTION_WINDOW)){
+    vrna_message_warning("vrna_mfe_window@Lfold.c: Failed to prepare vrna_fold_compound");
+    return (float)(INF/100.);
+  }
+
+
+  n       = vc->length;
+  maxdist = vc->window_size;
+  out     = (file) ? file : stdout;
+
+  for(i = n; (i >= (int)n - (int)maxdist - 4) && (i > 0); i--)
+    make_ptypes(vc, i);
+
+#ifdef USE_SVM  /*svm*/
+  if(with_zsc){
+    avg_model = svm_load_model_string(avg_model_string);
+    sd_model  = svm_load_model_string(sd_model_string);
+  }
+#endif
+
+  /* keep track of how many times we were close to an integer underflow */
+  underflow = 0;
+
+#ifdef USE_SVM
+  energy = fill_arrays(vc, with_zsc, min_z, avg_model, sd_model, &underflow, out);
+  if(with_zsc){
+    svm_free_model_content(avg_model);
+    svm_free_model_content(sd_model);
+  }
+#else
+  energy = fill_arrays(vc, with_zsc, min_z, &underflow, out);
+#endif
+
+  mfe_local = (underflow > 0) ? ((float)underflow * (float)(UNDERFLOW_CORRECTION)) / 100. : 0.;
+  mfe_local += (float)energy/100.;
+
+  return mfe_local;
+}
+
+PRIVATE int
+fill_arrays(vrna_fold_compound_t *vc,
+            int zsc,
+            double min_z,
+#ifdef USE_SVM
+            struct svm_model *avg_model,
+            struct svm_model *sd_model,
+#endif
+            int *underflow,
+            FILE *output){
+
+  /* fill "c", "fML" and "f3" arrays and return  optimal energy */
+
+  int   i, j, k, length, energy, maxdist;
+  int   **c, **fML, *f3, **ggg;
+  int   decomp, new_fML;
+  int   no_close, type, type_2, tt, with_gquad, dangle_model, noLP, noGUclosure, turn;
+  int   *rtype;
+  int   fij;
+  int   lind;
+
+  int   *cc = NULL;        /* linear array for calculating canonical structures */
+  int   *cc1 = NULL;       /*   "     "        */
+  int   *Fmi = NULL;       /* holds row i of fML (avoids jumps in memory) */
+  int   *DMLi = NULL;      /* DMLi[j] holds MIN(fML[i,k]+fML[k+1,j])  */
+  int   *DMLi1 = NULL;     /*             MIN(fML[i+1,k]+fML[k+1,j])  */
+  int   *DMLi2 = NULL;     /*             MIN(fML[i+2,k]+fML[k+1,j])  */
+
+  short         *S, *S1;
+  char          *string, **ptype, *prev;
+  vrna_param_t  *P;
+  vrna_md_t     *md;
+
+
+  string        = vc->sequence;
+  length        = vc->length;
+  S             = vc->sequence_encoding2;
+  S1            = vc->sequence_encoding;
+  ptype         = vc->ptype_local;
+  maxdist       = vc->window_size;
+  P             = vc->params;
+  md            = &(P->model_details);
+  dangle_model  = md->dangles;
+  with_gquad    = md->gquad;
+  noLP          = md->noLP;
+  noGUclosure   = md->noGUclosure;
+  turn          = md->min_loop_size;
+  rtype         = &(md->rtype[0]);
+
+  prev          = NULL;
+
+  c           = vc->matrices->c_local;
+  fML         = vc->matrices->fML_local;
+  f3          = vc->matrices->f3_local;
+  ggg         = vc->matrices->ggg_local;
+
+  cc    = (int *)   vrna_alloc(sizeof(int)   *(maxdist+5));
+  cc1   = (int *)   vrna_alloc(sizeof(int)   *(maxdist+5));
+  Fmi   = (int *)   vrna_alloc(sizeof(int)   *(maxdist+5));
+  DMLi  = (int *)   vrna_alloc(sizeof(int)   *(maxdist+5));
+  DMLi1 = (int *)   vrna_alloc(sizeof(int)   *(maxdist+5));
+  DMLi2 = (int *)   vrna_alloc(sizeof(int)   *(maxdist+5));
+
+
+  for (j=0; j<maxdist+5; j++)
+    Fmi[j]=DMLi[j]=DMLi1[j]=DMLi2[j]=INF;
+  for (j=length; j>length-maxdist-4; j--) {
+    for (i=(length-maxdist-4>0)?length-maxdist-4:1 ; i<j; i++)
+      c[i][j-i] = fML[i][j-i] = INF;
+  }
+
+  if(with_gquad){
+    vrna_gquad_mx_local_update(vc, length - maxdist - 4);
+    ggg = vc->matrices->ggg_local;
+  }
+
+  for (i = length-turn-1; i >= 1; i--) { /* i,j in [1..length] */
+    for (j = i+turn+1; j <= length && j <= i+maxdist; j++) {
+      int p, q;
+      type = ptype[i][j-i];
+
+      no_close = (((type==3)||(type==4))&&noGUclosure);
+
+      if (type) {   /* we have a pair */
+        int new_c=0, stackEnergy=INF;
+        /* hairpin ----------------------------------------------*/
+
+        new_c = (no_close) ? FORBIDDEN : E_Hairpin(j-i-1, type, S1[i+1], S1[j-1], string+i-1, P);
+
+        /*--------------------------------------------------------
+          check for elementary structures involving more than one
+          closing pair.
+          --------------------------------------------------------*/
+
+        for (p = i+1; p <= MIN2(j-2-turn,i+MAXLOOP+1) ; p++){
+          int minq = j-i+p-MAXLOOP-2;
+          if (minq<p+1+turn) minq = p+1+turn;
+          for (q = minq; q < j; q++) {
+            type_2 = ptype[p][q-p];
+
+            if (type_2==0) continue;
+            type_2 = rtype[type_2];
+
+            if (noGUclosure)
+              if (no_close||(type_2==3)||(type_2==4))
+                if ((p>i+1)||(q<j-1)) continue;  /* continue unless stack */
+
+            energy = E_IntLoop(p-i-1, j-q-1, type, type_2, S1[i+1], S1[j-1], S1[p-1], S1[q+1],P);
+            new_c = MIN2(new_c, energy + c[p][q-p]);
+            if ((p==i+1)&&(j==q+1)) stackEnergy = energy; /* remember stack energy */
+          } /* end q-loop */
+        } /* end p-loop */
+
+        /* multi-loop decomposition ------------------------*/
+        if (!no_close) {
+          decomp  = DMLi1[j-1-(i+1)];
+          tt      = rtype[type];
+          switch(dangle_model){
+            /* no dangle_model */
+            case 0:   decomp += E_MLstem(tt, -1, -1, P);
+                      break;
+            /* double dangle_model */
+            case 2:   decomp += E_MLstem(tt, S1[j-1], S1[i+1], P);
+                      break;
+            /* normal dangle_model, aka dangle_model = 1 */
+            default:  decomp += E_MLstem(tt, -1, -1, P);
+                      decomp = MIN2(decomp, DMLi2[j-1-(i+2)] + E_MLstem(tt, -1, S1[i+1], P) + P->MLbase);
+                      decomp = MIN2(decomp, DMLi2[j-2-(i+2)] + E_MLstem(tt, S1[j-1], S1[i+1], P) + 2*P->MLbase);
+                      decomp = MIN2(decomp, DMLi1[j-2-(i+1)] + E_MLstem(tt, S1[j-1], -1, P) + P->MLbase);
+                      break;
+          }
+          new_c = MIN2(new_c, decomp + P->MLclosing);
+        }
+
+        /* coaxial stacking of (i.j) with (i+1.k) or (k+1.j-1) */
+
+        if (dangle_model==3) {
+          decomp = INF;
+          for (k = i+2+turn; k < j-2-turn; k++) {
+            type_2 = ptype[i+1][k-i-1]; type_2 = rtype[type_2];
+            if (type_2)
+              decomp = MIN2(decomp, c[i+1][k-i-1]+P->stack[type][type_2]+
+                            fML[k+1][j-1-k-1]);
+            type_2 = ptype[k+1][j-1-k-1]; type_2 = rtype[type_2];
+            if (type_2)
+              decomp = MIN2(decomp, c[k+1][j-1-k-1]+P->stack[type][type_2]+
+                            fML[i+1][k-i-1]);
+          }
+          /* no TermAU penalty if coax stack */
+          decomp += 2*P->MLintern[1] + P->MLclosing;
+          new_c = MIN2(new_c, decomp);
+        }
+
+        if(with_gquad){
+          /* include all cases where a g-quadruplex may be enclosed by base pair (i,j) */
+          if (!no_close) {
+            tt = rtype[type];
+            energy = E_GQuad_IntLoop_L(i, j, type, S1, ggg, maxdist, P);
+            new_c = MIN2(new_c, energy);
+          }
+        }
+
+        new_c = MIN2(new_c, cc1[j-1-(i+1)]+stackEnergy);
+        cc[j-i] = new_c;
+        if (noLP)
+          c[i][j-i] = cc1[j-1-(i+1)]+stackEnergy;
+        else
+          c[i][j-i] = cc[j-i];
+
+      } /* end >> if (pair) << */
+
+      else c[i][j-i] = INF;
+
+      /* done with c[i,j], now compute fML[i,j] */
+      /* free ends ? -----------------------------------------*/
+      new_fML = INF;
+      switch(dangle_model){
+        /* no dangle_model */
+        case 0:   new_fML = fML[i+1][j-i-1] + P->MLbase;
+                  new_fML = MIN2(new_fML, fML[i][j-1-i] + P->MLbase);
+                  new_fML = MIN2(new_fML, c[i][j-i] + E_MLstem(type, -1, -1, P));
+                  break;
+        /* double dangle_model */
+        case 2:   new_fML = fML[i+1][j-i-1] + P->MLbase;
+                  new_fML = MIN2(fML[i][j-1-i] + P->MLbase, new_fML);
+                  new_fML = MIN2(new_fML,  c[i][j-i] + E_MLstem(type, (i>1) ? S1[i-1] : -1, (j<length) ? S1[j+1] : -1, P));
+                  break;
+        /* normal dangle_model, aka dangle_model = 1 */
+        default:  /* i unpaired */
+                  new_fML = fML[i+1][j-i-1] + P->MLbase;
+                  /* j unpaired */
+                  new_fML = MIN2(new_fML, fML[i][j-1-i] + P->MLbase);
+                  /* i,j */
+                  if(type) new_fML = MIN2(new_fML, c[i][j-i] + E_MLstem(type, -1, -1, P));
+                  /* i+1,j */
+                  tt = ptype[i+1][j-i-1];
+                  if(tt) new_fML = MIN2(new_fML, c[i+1][j-i-1] + E_MLstem(tt, S1[i], -1, P) + P->MLbase);
+                  /* i, j-1 */
+                  tt = ptype[i][j-1-i];
+                  if(tt) new_fML = MIN2(new_fML, c[i][j-1-i] + E_MLstem(tt, -1, S1[j], P) + P->MLbase);
+                  /* i+1,j-1 */
+                  tt = ptype[i+1][j-1-i-1];
+                  if(tt) new_fML = MIN2(new_fML, c[i+1][j-1-i-1] + E_MLstem(tt, S1[i], S1[j], P) + 2*P->MLbase);
+                  break;
+      }
+
+      if(with_gquad){
+        new_fML = MIN2(new_fML, ggg[i][j - i] + E_MLstem(0, -1, -1, P));
+      }
+
+      /* modular decomposition -------------------------------*/
+      for (decomp = INF, k = i+1+turn; k <= j-2-turn; k++)
+        decomp = MIN2(decomp, Fmi[k-i]+fML[k+1][j-k-1]);
+
+      DMLi[j-i] = decomp;               /* store for use in ML decompositon */
+      new_fML   = MIN2(new_fML, decomp);
+
+      /* coaxial stacking */
+      if (dangle_model==3) {
+        /* additional ML decomposition as two coaxially stacked helices */
+        for (decomp = INF, k = i+1+turn; k <= j-2-turn; k++) {
+          type = ptype[i][k-i]; type = rtype[type];
+          type_2 = ptype[k+1][j-k-1]; type_2 = rtype[type_2];
+          if (type && type_2)
+            decomp = MIN2(decomp,
+                          c[i][k-i]+c[k+1][j-k-1]+P->stack[type][type_2]);
+        }
+
+        decomp += 2*P->MLintern[1];          /* no TermAU penalty if coax stack */
+#if 0
+        /* This is needed for Y shaped ML loops with coax stacking of
+           interior pairts, but backtracking will fail if activated */
+        DMLi[j-i] = MIN2(DMLi[j-i], decomp);
+        DMLi[j-i] = MIN2(DMLi[j-i], DMLi[j-1-i]+P->MLbase);
+        DMLi[j-i] = MIN2(DMLi[j-i], DMLi1[j-(i+1)]+P->MLbase);
+        new_fML = MIN2(new_fML, DMLi[j-i]);
+#endif
+        new_fML = MIN2(new_fML, decomp);
+      }
+      fML[i][j-i] = Fmi[j-i] = new_fML;     /* substring energy */
+    } /* for (j...) */
+
+    /* calculate energies of 5' and 3' fragments */
+    {
+      static int do_backtrack = 0, prev_i=0;
+      char *ss=NULL;
+      double prevz = 0.;
+
+      /* first case: i stays unpaired */
+      f3[i] = f3[i+1];
+
+      /* next all cases where i is paired */
+      switch(dangle_model){
+        /* dont use dangling end and mismatch contributions at all */
+        case 0:   for(j=i+turn+1; j<length && j<=i+maxdist; j++){
+                    type = ptype[i][j-i];
+
+                    if(with_gquad){
+                      f3[i] = MIN2(f3[i], f3[j+1] + ggg[i][j-i]);
+                    }
+
+                    if(type)
+                      f3[i] = MIN2(f3[i], f3[j+1] + c[i][j-i] + E_ExtLoop(type, -1, -1, P));
+                  }
+                  if(length<=i+maxdist){
+                    j=length;
+
+                    if(with_gquad){
+                      f3[i] = MIN2(f3[i], ggg[i][j-i]);
+                    }
+
+                    type = ptype[i][j-i];
+                    if(type)
+                      f3[i] = MIN2(f3[i], c[i][j-i] + E_ExtLoop(type, -1, -1, P));
+                  }
+                  break;
+        /* always use dangle_model on both sides */
+        case 2:   for(j=i+turn+1; j<length && j<=i+maxdist; j++){
+                    type = ptype[i][j-i];
+
+                    if(with_gquad){
+                      if(ggg[i][j-i] != INF)
+                        f3[i] = MIN2(f3[i], f3[j+1] + ggg[i][j-i]);
+                    }
+
+                    if(type)
+                      f3[i] = MIN2(f3[i], f3[j+1] + c[i][j-i] + E_ExtLoop(type, (i>1) ? S1[i-1] : -1, S1[j+1], P));
+                  }
+                  if(length<=i+maxdist){
+                    j=length;
+
+                    if(with_gquad){
+                      f3[i] = MIN2(f3[i], ggg[i][j-i]);
+                    }
+
+                    type = ptype[i][j-i];
+                    if(type)
+                      f3[i] = MIN2(f3[i], c[i][j-i] + E_ExtLoop(type, (i>1) ? S1[i-1] : -1, -1, P));
+                  }
+                  break;
+        /* normal dangle_model, aka dangle_model = 1 */
+        default:  for(j=i+turn+1; j<length && j<=i+maxdist; j++){
+                    type = ptype[i][j-i];
+
+                    if(with_gquad){
+                      f3[i] = MIN2(f3[i], f3[j+1] + ggg[i][j-i]);
+                    }
+
+                    if(type){
+                      f3[i] = MIN2(f3[i], f3[j+1] + c[i][j-i] + E_ExtLoop(type, -1, -1, P));
+                      f3[i] = MIN2(f3[i], ((j+2<=length) ? f3[j+2] : 0) + c[i][j-i] + E_ExtLoop(type, -1, S1[j+1], P));
+                    }
+                    type = ptype[i+1][j-i-1];
+                    if(type){
+                      f3[i] = MIN2(f3[i], f3[j+1] + c[i+1][j-i-1] + E_ExtLoop(type, S1[i], -1, P));
+                      f3[i] = MIN2(f3[i], ((j + 1 < length) ? f3[j+2] : 0) + c[i+1][j-i-1] + E_ExtLoop(type, S1[i], S1[j+1], P));
+                    }
+                  }
+                  if(length<=i+maxdist){
+                    j     = length;
+
+                    if(with_gquad){
+                      f3[i] = MIN2(f3[i], ggg[i][j-i]);
+                    }
+
+                    type  = ptype[i][j-i];
+                    if(type)
+                      f3[i] = MIN2(f3[i], c[i][j-i] + E_ExtLoop(type, -1, -1, P));
+                    type  = ptype[i+1][j-i-1];
+                    if(type)
+                      f3[i] = MIN2(f3[i], c[i+1][j-i-1] + E_ExtLoop(type, S1[i], -1, P));
+                  }
+                  break;
+      } /* switch(dangle_model)... */
+
+      /* backtrack partial structure */
+      if (f3[i] < f3[i+1]){
+        do_backtrack=1;
+      }
+      else if (do_backtrack) {
+        int pairpartner; /*i+1?? is paired with pairpartner*/
+        int cc;
+        int traced2=0;
+        fij = f3[i+1];
+        lind=i+1;
+        /*start "short" backtrack*/
+
+        /*get paired base*/
+        while(fij==f3[lind+1])
+          lind++;
+
+        /*get pairpartner*/
+        for (pairpartner = lind + turn; pairpartner <= lind + maxdist; pairpartner++){
+          type = ptype[lind][pairpartner-lind];
+          switch(dangle_model){
+            case 0:   if(type){
+                        cc = c[lind][pairpartner-lind] + E_ExtLoop(type, -1, -1, P);
+                        if(fij == cc + f3[pairpartner + 1])
+                          traced2 = 1;
+                      }
+                      else if(with_gquad) {
+                        cc = ggg[lind][pairpartner-lind];
+                        if(fij == cc + f3[pairpartner + 1])
+                          traced2 = 1;
+                      }
+
+                      break;
+            case 2:   if(type){
+                        cc = c[lind][pairpartner-lind] + E_ExtLoop(type, (lind > 1) ? S1[lind-1] : -1, (pairpartner < length) ? S1[pairpartner+1] : -1, P);
+                        if(fij == cc + f3[pairpartner + 1])
+                          traced2 = 1;
+                      }
+                      else if(with_gquad){
+                        cc = ggg[lind][pairpartner-lind];
+                        if(fij == cc + f3[pairpartner + 1])
+                          traced2 = 1;
+                      }
+
+                      break;
+            default:  if(type){
+                        cc = c[lind][pairpartner-lind] + E_ExtLoop(type, -1, -1, P);
+                        if(fij == cc + f3[pairpartner + 1]){
+                          traced2 = 1;
+                          break;
+                        }
+                        else if(pairpartner < length){
+                          cc = c[lind][pairpartner-lind] + E_ExtLoop(type, -1, S1[pairpartner+1], P);
+                          if(fij == cc + f3[pairpartner + 2]){
+                            traced2 = 1;
+                            break;
+                          }
+                        }
+                      }
+                      else if(with_gquad){
+                        cc = ggg[lind][pairpartner-lind];
+                        if(fij == cc + f3[pairpartner + 1])
+                          traced2 = 1;
+                      }
+
+                      type = ptype[lind+1][pairpartner-lind-1];
+                      if(type){
+                        cc = c[lind+1][pairpartner-(lind+1)] + E_ExtLoop(type, S1[lind], -1, P);
+                        if(fij == cc + f3[pairpartner+1]){
+                          traced2 = 1;
+                          break;
+                        }
+                        else if(pairpartner < length){
+                          cc = c[lind+1][pairpartner-(lind+1)] + E_ExtLoop(type, S1[lind], S1[pairpartner+1], P);
+                          if(fij == cc + f3[pairpartner+2])
+                            traced2 = 1;
+                        }
+                      }
+                      break;
+          }
+          if(traced2) break;
+        }
+        if (!traced2) vrna_message_error("backtrack failed in short backtrack 1");
+        if (zsc){
+#ifdef USE_SVM
+          int info_avg;
+          double average_free_energy;
+          double sd_free_energy;
+          double my_z;
+          int *AUGC = get_seq_composition(S, lind-1, MIN2((pairpartner+1),length), length);
+          /*\svm*/
+          average_free_energy = avg_regression(AUGC[0], AUGC[1], AUGC[2], AUGC[3], AUGC[4], avg_model, &info_avg);
+          if (info_avg == 0)  {
+            double difference;
+            double min_sd = minimal_sd(AUGC[0],AUGC[1],AUGC[2],AUGC[3],AUGC[4]);
+            difference=(fij-f3[pairpartner+1])/100.-average_free_energy;
+            if ( difference - ( min_z * min_sd ) <= 0.0001 ) {
+              sd_free_energy = sd_regression(AUGC[0],AUGC[1],AUGC[2],AUGC[3],AUGC[4],sd_model);
+              my_z=difference/sd_free_energy;
+              if (my_z<=min_z){
+                ss =  backtrack(vc, lind, pairpartner+1);
+                if (prev) {
+                  if ((i+strlen(ss)<prev_i+strlen(prev)) ||
+                      strncmp(ss+prev_i-i,prev,strlen(prev))) { /* ss does not contain prev */
+                    if (dangle_model==2)
+                      fprintf(output, ".%s (%6.2f) %4d z= %.3f\n", prev, (f3[prev_i]-f3[prev_i+strlen(prev)-1])/100., prev_i-1, prevz);
+                    else
+                      fprintf(output, "%s (%6.2f) %4d z=%.3f\n ", prev, (f3[prev_i]-f3[prev_i+strlen(prev)])/100., prev_i, prevz);
+                  }
+                  free(prev);
+                }
+                prev=ss; prev_i = lind; prevz=my_z;
+              }
+            }
+
+          }
+          free(AUGC);
+          do_backtrack=0;
+#endif
+        }
+        else {
+          /* original code for Lfold*/
+          ss =  backtrack(vc, lind , pairpartner+1);
+          if (prev) {
+            if ((i+strlen(ss)<prev_i+strlen(prev)) || strncmp(ss+prev_i-i,prev,strlen(prev))){
+              /* ss does not contain prev */
+              if (dangle_model==2){
+                fprintf(output, ".%s (%6.2f) %4d\n", prev, (f3[prev_i]-f3[prev_i+strlen(prev)-1])/100., prev_i-1);
+              } else
+                fprintf(output, "%s (%6.2f) %4d\n", prev, (f3[prev_i]-f3[prev_i+strlen(prev)])/100., prev_i);
+            }
+            free(prev);
+          }
+          prev=ss;
+          prev_i = lind;
+          do_backtrack=0;
+        }
+      }
+      if (i==1) {
+        if (prev) {
+          if(zsc) {
+            if (dangle_model==2)
+              fprintf(output, ".%s (%6.2f) %4d z= %.2f\n", prev, (f3[prev_i]-f3[prev_i+strlen(prev)-1])/100., prev_i-1, prevz);
+           else
+              fprintf(output, "%s (%6.2f) %4dz= %.2f \n", prev, (f3[prev_i]-f3[prev_i+strlen(prev)])/100., prev_i, prevz);
+          }
+          else {
+            if (dangle_model==2)
+              fprintf(output, ".%s (%6.2f) %4d\n", prev, (f3[prev_i]-f3[prev_i+strlen(prev)-1])/100., prev_i-1);
+            else
+              fprintf(output, "%s (%6.2f) %4d\n", prev, (f3[prev_i]-f3[prev_i+strlen(prev)])/100., prev_i);
+          }
+          free(prev); prev=NULL;
+        } else if ((f3[i]<0) && (!zsc)) do_backtrack=1;
+
+        if (do_backtrack) {
+          int pairpartner; /*i+1?? is paired with pairpartner*/
+          int cc;
+          double average_free_energy;
+          double sd_free_energy;
+          int info_avg;
+          double my_z;
+          int traced2 = 0;
+          fij = f3[i];
+          lind=i;
+          while(fij==f3[lind+1]) lind++;
+          /*get pairpartner*/
+          for(pairpartner = lind + turn; pairpartner <= lind + maxdist; pairpartner++){
+            type = ptype[lind][pairpartner-lind];
+            switch(dangle_model){
+              case 0:   if(type){
+                          cc = c[lind][pairpartner-lind] + E_ExtLoop(type, -1, -1, P);
+                          if(fij == cc + f3[pairpartner + 1])
+                            traced2 = 1;
+                        }
+                        else if(with_gquad){
+                          cc = ggg[lind][pairpartner-lind];
+                          if(fij == cc + f3[pairpartner + 1])
+                            traced2 = 1;
+                        }
+
+                        break;
+              case 2:   if(type){
+                          cc = c[lind][pairpartner-lind] + E_ExtLoop(type, (lind > 1) ? S1[lind-1] : -1, (pairpartner < length) ? S1[pairpartner+1] : -1, P);
+                          if(fij == cc + f3[pairpartner + 1])
+                            traced2 = 1;
+                        }
+                        else if(with_gquad){
+                          cc = ggg[lind][pairpartner-lind];
+                          if(fij == cc + f3[pairpartner + 1])
+                            traced2 = 1;
+                        }
+
+                        break;
+              default:  if(type){
+                          cc = c[lind][pairpartner-lind] + E_ExtLoop(type, -1, -1, P);
+                          if(fij == cc + f3[pairpartner + 1]){
+                            traced2 = 1;
+                            break;
+                          }
+                          else if(pairpartner < length){
+                            cc = c[lind][pairpartner-lind] + E_ExtLoop(type, -1, S1[pairpartner + 1], P);
+                            if(fij == cc + f3[pairpartner + 1]){
+                              traced2 = 1;
+                              break;
+                            }
+                          }
+                        }
+                        else if(with_gquad){
+                          cc = ggg[lind][pairpartner-lind];
+                          if(fij == cc + f3[pairpartner + 1])
+                            traced2 = 1;
+                        }
+
+                        type = ptype[lind+1][pairpartner-lind-1];
+                        if(type){
+                          cc = c[lind+1][pairpartner-(lind+1)] + E_ExtLoop(type, S1[lind], -1, P);
+                          if(fij == cc + f3[pairpartner+1]){
+                            traced2 = 1;
+                            break;
+                          }
+                          else if (pairpartner < length){
+                            cc = c[lind+1][pairpartner-(lind+1)] + E_ExtLoop(type, S1[lind], S1[pairpartner+1], P);
+                            if(fij == cc + f3[pairpartner + 2]){
+                              traced2 =1;
+                              break;
+                            }
+                          }
+                        }
+            }
+            if(traced2) break;
+          }
+          if (!traced2) vrna_message_error("backtrack failed in short backtrack 2");
+
+          if(zsc){
+#ifdef USE_SVM
+            int *AUGC = get_seq_composition(S, lind-1, MIN2((pairpartner+1),length), length);
+            average_free_energy = avg_regression(AUGC[0],AUGC[1],AUGC[2],AUGC[3],AUGC[4],avg_model,&info_avg);
+            if (info_avg == 0)  {
+              double difference;
+              double min_sd = minimal_sd(AUGC[0],AUGC[1],AUGC[2],AUGC[3],AUGC[4]);
+              difference=(fij-f3[pairpartner+1])/100.-average_free_energy;
+              if ( difference - ( min_z * min_sd ) <= 0.0001 ) {
+                sd_free_energy = sd_regression(AUGC[0],AUGC[1],AUGC[2],AUGC[3],AUGC[4],sd_model);
+                my_z=difference/sd_free_energy;
+                if (my_z<=min_z){
+                  ss =  backtrack(vc, lind , pairpartner+1);
+                  fprintf(output, "%s (%6.2f) %4d z= %.2f\n", ss, (f3[lind]-f3[lind+strlen(ss)-1])/100., lind, my_z);
+                }
+              }
+            }
+            free(AUGC);
+#endif
+          }
+          else {
+            ss =  backtrack(vc, lind , pairpartner+1);
+            if (dangle_model==2)
+              fprintf(output, "%s (%6.2f) %4d\n", ss, (f3[lind]-f3[lind+strlen(ss)-1])/100., 1);
+            else
+              fprintf(output, "%s (%6.2f) %4d\n", ss, (f3[lind]-f3[lind+strlen(ss)])/100., 1);
+            free(ss);
+          }
+        }
+        do_backtrack=0;
+      }
+    }
+    {
+      int ii, *FF; /* rotate the auxilliary arrays */
+
+      /* check for values close to integer underflow */
+      if(INT_CLOSE_TO_UNDERFLOW(f3[i])){
+        /* correct f3 free energies and increase underflow counter */
+        int cnt, cnt2;
+        for(cnt=i; cnt <= length && cnt <= lind + maxdist + 2; cnt++) {
+          f3[cnt] -= UNDERFLOW_CORRECTION;
+        }
+        (*underflow)++;
+      }
+
+      FF = DMLi2; DMLi2 = DMLi1; DMLi1 = DMLi; DMLi = FF;
+      FF = cc1; cc1=cc; cc=FF;
+      for(j = 0; j < maxdist + 5; j++){
+        cc[j] = Fmi[j] = DMLi[j] = INF;
+      }
+
+      /*
+        rotate the DP matrices
+        NOTE: here we rotate them only locally, i.e. their
+        actual configuration within vc remains intact
+      */
+      if( i + maxdist + 4 <= length ){
+        c[i - 1]                = c[i + maxdist + 4];
+        c[i + maxdist + 4]      = NULL;
+        fML[i - 1]              = fML[i + maxdist + 4];
+        fML[i + maxdist + 4]    = NULL;
+        ptype[i - 1]            = ptype[i + maxdist + 4];
+        ptype[i + maxdist + 4]  = NULL;
+        if( i > 1 ){
+          make_ptypes(vc, i - 1);
+          if(with_gquad){
+            vrna_gquad_mx_local_update(vc, i - 1);
+            ggg = vc->matrices->ggg_local;
+          }
+        }
+        for(ii = 0; ii < maxdist + 5; ii++){
+          c[i - 1][ii]    = INF;
+          fML[i - 1][ii]  = INF;
+        }
+      }
+
+    }
+  }
+
+  free(cc);
+  free(cc1);
+  free(Fmi);
+  free(DMLi);
+  free(DMLi1);
+  free(DMLi2);
+
+  return f3[1];
+}
+
+PRIVATE char *
+backtrack(vrna_fold_compound_t *vc,
+          int start,
+          int maxdist){
+
+  /*------------------------------------------------------------------
+    trace back through the "c", "f3" and "fML" arrays to get the
+    base pairing list. No search for equivalent structures is done.
+    This is fast, since only few structure elements are recalculated.
+    ------------------------------------------------------------------*/
+  sect          sector[MAXSECTORS];   /* backtracking sectors */
+  int           i, j, k, length, energy, new, no_close, type, type_2, tt, s=0;
+  int           with_gquad, bt_type, turn, dangle_model, noLP, noGUclosure, *rtype;
+  int           **c, **fML, *f3, **ggg;
+  char          *string, *structure, **ptype;
+  short         *S, *S1;
+  vrna_param_t  *P;
+  vrna_md_t     *md;
+
+  string        = vc->sequence;
+  length        = vc->length;
+  S             = vc->sequence_encoding2;
+  S1            = vc->sequence_encoding;
+  ptype         = vc->ptype_local;
+  P             = vc->params;
+  md            = &(P->model_details);
+  dangle_model  = md->dangles;
+  noLP          = md->noLP;
+  noGUclosure   = md->noGUclosure;
+  with_gquad    = md->gquad;
+  bt_type       = md->backtrack_type;
+  turn          = md->min_loop_size;
+  rtype         = &(md->rtype[0]);
+
+  c       = vc->matrices->c_local;
+  fML     = vc->matrices->fML_local;
+  f3      = vc->matrices->f3_local;
+  ggg     = vc->matrices->ggg_local;
+
+  /* length = strlen(string); */
+  sector[++s].i = start;
+  sector[s].j   = MIN2(length, maxdist+1);
+  sector[s].ml  = (bt_type=='M') ? 1 : ((bt_type=='C')?2:0);
+
+  structure = (char *) vrna_alloc((MIN2(length-start, maxdist)+3)*sizeof(char));
+  for (i=0; i<=MIN2(length-start, maxdist); i++) structure[i] = '-';
+
+  while (s>0) {
+    int ml, fij, cij, traced, i1, j1, mm, mm5, mm3, mm53, p, q, jj=0, gq=0;
+    int canonical = 1;     /* (i,j) closes a canonical structure */
+    i  = sector[s].i;
+    j  = sector[s].j;
+    ml = sector[s--].ml;   /* ml is a flag indicating if backtracking is to
+                              occur in the fML- (1) or in the f-array (0) */
+    if (ml==2) {
+      structure[i-start] = '(';
+      structure[j-start] = ')';
+      goto repeat1;
+    }
+
+    if (j < i + turn + 1) continue; /* no more pairs in this interval */
+
+    fij = (ml)? fML[i][j-i] : f3[i];
+
+    if (ml == 0) { /* backtrack in f3 */
+
+      if (fij == f3[i+1]) {
+        sector[++s].i = i+1;
+        sector[s].j   = j;
+        sector[s].ml  = ml;
+        continue;
+      }
+      /* i or i+1 is paired. Find pairing partner */
+      switch(dangle_model){
+        case 0:   for(traced = 0, k=j; k>i+turn; k--){
+
+                    if(with_gquad){
+                      if(fij == ggg[i][k-i] + f3[k+1]){
+                        /* found the decomposition */
+                        traced = i; jj = k + 1; gq = 1;
+                        break;
+                      }
+                    }
+
+                    jj    = k+1;
+                    type  = ptype[i][k-i];
+                    if(type)
+                      if(fij == c[i][k-i] + E_ExtLoop(type, -1, -1, P) + f3[k+1]){
+                        traced = i;
+                        break;
+                      }
+                  }
+                  break;
+        case 2:   for(traced = 0, k=j; k>i+turn; k--){
+
+                    if(with_gquad){
+                      if(fij == ggg[i][k-i] + f3[k+1]){
+                        /* found the decomposition */
+                        traced = i; jj = k + 1; gq = 1;
+                        break;
+                      }
+                    }
+
+                    jj    = k+1;
+                    type  = ptype[i][k-i];
+                    if(type)
+                      if(fij == c[i][k-i] + E_ExtLoop(type, (i>1) ? S1[i-1] : -1, (k<length) ? S1[k+1] : -1, P) + f3[k+1]){
+                        traced = i;
+                        break;
+                      }
+                  }
+                  break;
+        default:  for(traced = 0,k=j; k>i+turn; k--){
+
+                    if(with_gquad){
+                      if(fij == ggg[i][k-i] + f3[k+1]){
+                        /* found the decomposition */
+                        traced = i; jj = k + 1; gq = 1;
+                        break;
+                      }
+                    }
+
+                    jj = k+1;
+                    type = ptype[i+1][k-(i+1)];
+                    if(type){
+                      if(fij == c[i+1][k-(i+1)] + E_ExtLoop(type, S1[i], -1, P) + f3[k+1]){
+                        traced=i+1;
+                      }
+                      if(k < length){
+                        if(fij == c[i+1][k-(i+1)] + E_ExtLoop(type, S1[i], S1[k+1], P) + f3[k+2]){
+                          traced  = i+1;
+                          jj      = k+2;
+                        }
+                      }
+                    }
+                    type = ptype[i][k-i];
+                    if(type){
+                      if(fij == c[i][k-i] + E_ExtLoop(type, -1, -1, P) + f3[k+1]){
+                        traced = i;
+                      }
+                      if(k<length){
+                        if(fij == c[i][k-i] + E_ExtLoop(type, -1, S1[k+1], P) + f3[k+2]){
+                          traced  = i;
+                          jj      = k+2;
+                        }
+                      }
+                    }
+                    if(traced) break;
+                  }
+                  break;
+      } /* switch(dangle_model)...*/
+
+      if (!traced) vrna_message_error("backtrack failed in f3");
+      if (j==length) { /* backtrack only one component, unless j==length */
+        sector[++s].i = jj;
+        sector[s].j   = j;
+        sector[s].ml  = ml;
+      }
+      i=traced; j=k;
+
+      if(with_gquad && gq){
+        /* goto backtrace of gquadruplex */
+        goto repeat_gquad;
+      }
+
+      structure[i-start] = '('; structure[j-start] = ')';
+      if (((jj==j+2) || (dangle_model==2)) && (j < length)) structure[j+1-start] = '.';
+      goto repeat1;
+    }
+    else { /* trace back in fML array */
+      if (fML[i][j-1-i]+P->MLbase == fij) {  /* 3' end is unpaired */
+        sector[++s].i = i;
+        sector[s].j   = j-1;
+        sector[s].ml  = ml;
+        continue;
+      }
+      if (fML[i+1][j-(i+1)]+P->MLbase == fij) { /* 5' end is unpaired */
+        sector[++s].i = i+1;
+        sector[s].j   = j;
+        sector[s].ml  = ml;
+        continue;
+      }
+
+      if(with_gquad){
+        if(fij == ggg[i][j-i] + E_MLstem(0, -1, -1, P)){
+          /* go to backtracing of quadruplex */
+          goto repeat_gquad;
+        }
+      }
+
+      switch(dangle_model){
+        case 0:   tt = ptype[i][j-i];
+                  if(fij == c[i][j-i] + E_MLstem(tt, -1, -1, P)){
+                    structure[i-start] = '(';
+                    structure[j-start] = ')';
+                    goto repeat1;
+                  }
+                  break;
+        case 2:   tt = ptype[i][j-i];
+                  if(fij == c[i][j-i] + E_MLstem(tt, (i>1) ? S1[i-1] : -1, (j < length) ? S1[j+1] : -1, P)){
+                    structure[i-start] = '(';
+                    structure[j-start] = ')';
+                    goto repeat1;
+                  }
+                  break;
+        default:  tt = ptype[i][j-i];
+                  if(fij == c[i][j-i] + E_MLstem(tt, -1, -1, P)){
+                    structure[i-start] = '(';
+                    structure[j-start] = ')';
+                    goto repeat1;
+                  }
+                  tt = ptype[i+1][j-(i+1)];
+                  if(fij == c[i+1][j-(i+1)] + E_MLstem(tt, S1[i], -1, P) + P->MLbase){
+                    structure[++i-start] = '(';
+                    structure[j-start] = ')';
+                    goto repeat1;
+                  }
+                  tt = ptype[i][j-1-i];
+                  if(fij == c[i][j-1-i] + E_MLstem(tt, -1, S1[j], P) + P->MLbase){
+                    structure[i-start] = '(';
+                    structure[--j-start] = ')';
+                    goto repeat1;
+                  }
+                  tt = ptype[i+1][j-1-(i+1)];
+                  if(fij == c[i+1][j-1-(i+1)] + E_MLstem(tt, S1[i], S1[j], P) + 2*P->MLbase){
+                    structure[++i-start] = '(';
+                    structure[--j-start] = ')';
+                    goto repeat1;
+                  }
+                  break;
+      } /* switch(dangle_model)... */
+
+      /* modular decomposition */
+      for (k = i+1+turn; k <= j-2-turn; k++)
+        if (fij == (fML[i][k-i]+fML[k+1][j-(k+1)]))
+          break;
+
+      if ((dangle_model==3)&&(k>j-2-turn)) { /* must be coax stack */
+        ml = 2;
+        for (k = i+1+turn; k <= j-2-turn; k++) {
+          type = ptype[i][k-i];  type= rtype[type];
+          type_2 = ptype[k+1][j-(k+1)]; type_2= rtype[type_2];
+          if (type && type_2)
+            if (fij == c[i][k-i]+c[k+1][j-(k+1)]+P->stack[type][type_2]+
+                       2*P->MLintern[1])
+              break;
+        }
+      }
+
+      sector[++s].i = i;
+      sector[s].j   = k;
+      sector[s].ml  = ml;
+      sector[++s].i = k+1;
+      sector[s].j   = j;
+      sector[s].ml  = ml;
+
+      if (k>j-2-turn) vrna_message_error("backtrack failed in fML");
+      continue;
+    }
+
+  repeat1:
+
+    /*----- begin of "repeat:" -----*/
+    if (canonical)  cij = c[i][j-i];
+
+    type = ptype[i][j-i];
+
+
+    if (noLP)
+      if (cij == c[i][j-i]) {
+        /* (i.j) closes canonical structures, thus
+           (i+1.j-1) must be a pair                */
+        type_2 = ptype[i+1][j-1-(i+1)]; type_2 = rtype[type_2];
+        cij -= P->stack[type][type_2];
+        structure[i+1-start] = '('; structure[j-1-start] = ')';
+        i++; j--;
+        canonical=0;
+        goto repeat1;
+      }
+    canonical = 1;
+
+
+    no_close = (((type==3)||(type==4))&&noGUclosure);
+    if (no_close) {
+      if (cij == FORBIDDEN) continue;
+    } else
+      if (cij == E_Hairpin(j-i-1, type, S1[i+1], S1[j-1],string+i-1, P))
+        continue;
+
+    for (p = i+1; p <= MIN2(j-2-turn,i+MAXLOOP+1); p++) {
+      int minq;
+      minq = j-i+p-MAXLOOP-2;
+      if (minq<p+1+turn) minq = p+1+turn;
+      for (q = j-1; q >= minq; q--) {
+
+        type_2 = ptype[p][q-p];
+        if (type_2==0) continue;
+        type_2 = rtype[type_2];
+        if (noGUclosure)
+          if (no_close||(type_2==3)||(type_2==4))
+            if ((p>i+1)||(q<j-1)) continue;  /* continue unless stack */
+
+        /* energy = oldLoopEnergy(i, j, p, q, type, type_2); */
+        energy = E_IntLoop(p-i-1, j-q-1, type, type_2, S1[i+1], S1[j-1], S1[p-1], S1[q+1],P);
+
+        new = energy+c[p][q-p];
+        traced = (cij == new);
+        if (traced) {
+          structure[p-start] = '(';
+          structure[q-start] = ')';
+          i = p, j = q;
+          goto repeat1;
+        }
+      }
+    }
+
+    /* end of repeat: --------------------------------------------------*/
+
+    /* (i.j) must close a multi-loop */
+    tt = rtype[type];
+    i1 = i+1; j1 = j-1;
+
+    if(with_gquad){
+      /*
+        The case that is handled here actually resembles something like
+        an interior loop where the enclosing base pair is of regular
+        kind and the enclosed pair is not a canonical one but a g-quadruplex
+        that should then be decomposed further...
+      */
+      if(backtrack_GQuad_IntLoop_L(cij, i, j, type, S, ggg, maxdist, &p, &q, P)){
+        i = p; j = q;
+        goto repeat_gquad;
+      }
+    }
+
+    sector[s+1].ml  = sector[s+2].ml = 1;
+
+    switch(dangle_model){
+      case 0:   mm = P->MLclosing + E_MLstem(tt, -1, -1, P);
+                for(k = i+2+turn; k < j-2-turn; k++){
+                  if(cij == fML[i+1][k-(i+1)] + fML[k+1][j-1-(k+1)] + mm)
+                    break;
+                }
+                break;
+      case 2:   mm = P->MLclosing + E_MLstem(tt, S1[j-1], S1[i+1], P);
+                for(k = i+2+turn; k < j-2-turn; k++){
+                  if(cij == fML[i+1][k-(i+1)] + fML[k+1][j-1-(k+1)] + mm)
+                    break;
+                }
+                break;
+      default:  mm    = P->MLclosing + E_MLstem(tt, -1, -1, P);
+                mm5   = P->MLclosing + E_MLstem(tt, S1[j-1], -1, P) + P->MLbase;
+                mm3   = P->MLclosing + E_MLstem(tt, -1, S1[i+1], P) + P->MLbase;
+                mm53  = P->MLclosing + E_MLstem(tt, S1[j-1], S1[i+1], P) + 2*P->MLbase;
+                for(k = i+2+turn; k < j-2-turn; k++){
+                  if(cij == fML[i+1][k-(i+1)] + fML[k+1][j-1-(k+1)] + mm)
+                    break;
+                  else if(cij == fML[i+2][k-(i+2)] + fML[k+1][j-1-(k+1)] + mm3){
+                    i1 = i+2;
+                    break;
+                  }
+                  else if(cij == fML[i+1][k-(i+1)] + fML[k+1][j-2-(k+1)] + mm5){
+                    j1 = j-2;
+                    break;
+                  }
+                  else if(cij == fML[i+2][k-(i+2)] + fML[k+1][j-2-(k+1)] + mm53){
+                    i1 = i+2;
+                    j1 = j-2;
+                    break;
+                  }
+                  /* coaxial stacking of (i.j) with (i+1.k) or (k.j-1) */
+                  /* use MLintern[1] since coax stacked pairs don't get TerminalAU */
+                  if (dangle_model==3) {
+                    int en;
+                    type_2 = ptype[i+1][k-(i+1)]; type_2 = rtype[type_2];
+                    if (type_2) {
+                      en = c[i+1][k-(i+1)]+P->stack[type][type_2]+fML[k+1][j-1-(k+1)];
+                      if (cij == en+2*P->MLintern[1]+P->MLclosing) {
+                        ml = 2;
+                        sector[s+1].ml  = 2;
+                        break;
+                      }
+                    }
+                    type_2 = ptype[k+1][j-1-(k+1)]; type_2 = rtype[type_2];
+                    if (type_2) {
+                      en = c[k+1][j-1-(k+1)]+P->stack[type][type_2]+fML[i+1][k-(i+1)];
+                      if (cij == en+2*P->MLintern[1]+P->MLclosing) {
+                        sector[s+2].ml = 2;
+                        break;
+                      }
+                    }
+                  }
+                }
+                break;
+    } /* switch(dangle_model)... */
+
+    if (k<=j-3-turn) { /* found the decomposition */
+      sector[++s].i = i1;
+      sector[s].j   = k;
+      sector[++s].i = k+1;
+      sector[s].j   = j1;
+    } else {
+#if 0
+      /* Y shaped ML loops fon't work yet */
+      if (dangle_model==3) {
+        /* (i,j) must close a Y shaped ML loop with coax stacking */
+        if (cij ==  fML[i+1][j-2-(i+2)] + mm + d3 + d5 + P->MLbase + P->MLbase) {
+          i1 = i+2;
+          j1 = j-2;
+        } else if (cij ==  fML[i+1][j-2-(i+1)] + mm + d5 + P->MLbase)
+          j1 = j-2;
+        else if (cij ==  fML[i+2][j-1-(i+2)] + mm + d3 + P->MLbase)
+          i1 = i+2;
+        else /* last chance */
+          if (cij != fML[i+1][j-1-(i+1)] + mm + P->MLbase)
+            fprintf(stderr,  "backtracking failed in repeat");
+        /* if we arrive here we can express cij via fML[i1,j1]+dangle_model */
+        sector[++s].i = i1;
+        sector[s].j   = j1;
+      }
+      else
+#endif
+        vrna_message_error("backtracking failed in repeat");
+    }
+
+    continue; /* this is a workarround to not accidentally proceed in the following block */
+
+  repeat_gquad:
+    /*
+      now we do some fancy stuff to backtrace the stacksize and linker lengths
+      of the g-quadruplex that should reside within position i,j
+    */
+    {
+      int l[3], L, a;
+      L = -1;
+
+      get_gquad_pattern_mfe(S, i, j, P, &L, l);
+      if(L != -1){
+        /* fill the G's of the quadruplex into the structure string */
+        for(a=0;a<L;a++){
+          structure[i+a-start] = '+';
+          structure[i+L+l[0]+a-start] = '+';
+          structure[i+L+l[0]+L+l[1]+a-start] = '+';
+          structure[i+L+l[0]+L+l[1]+L+l[2]+a-start] = '+';
+        }
+        goto repeat_gquad_exit;
+      }
+      vrna_message_error("backtracking failed in repeat_gquad");
+    }
+  repeat_gquad_exit:
+    __asm("nop");
+
+  }
+
+  for (i=strlen(structure)-1; i>0 && structure[i] == '-'; i--)
+    structure[i] = '\0';
+  for (;i>=0; i--)
+   if (structure[i]=='-') structure[i]='.';
+
+  return structure;
+}
+
+PRIVATE void
+make_ptypes(vrna_fold_compound_t *vc, int i){
+
+  int       j, k, type, n, maxdist, turn, noLP;
+  short     *S;
+  char      **ptype;
+  vrna_md_t *md;
+
+  n       = (int)vc->length;
+  S       = vc->sequence_encoding2;
+  ptype   = vc->ptype_local;
+  maxdist = vc->window_size;
+  md      = &(vc->params->model_details);
+  turn    = md->min_loop_size;
+  noLP    = md->noLP;
+
+  for(k = turn + 1; k < maxdist; k++){
+    j = i + k;
+    if (j > n)
+      break;
+    type = md->pair[S[i]][S[j]];
+
+    if(noLP && type){
+      if(!ptype[i + 1][j - 1 - i - 1])
+        if(j == n || i == 1 || (!md->pair[S[i - 1]][S[j + 1]]))
+          type = 0;
+    }
+    ptype[i][j - i] = type;
+  }
+}
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+PUBLIC float Lfold( const char *string,
+                    char *structure,
+                    int window_size){
+
+  float               energy;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t           md;
+
+  set_model_details(&md);
+
+  md.window_size = window_size;
+  md.max_bp_span = window_size;
+
+  vc  = vrna_fold_compound(string, &md, VRNA_OPTION_WINDOW);
+
+  energy = wrap_Lfold(vc, 0, 0.0, NULL);
+
+  vrna_fold_compound_free(vc);
+
+  return energy;
+}
+
+PUBLIC float
+Lfoldz( const char *string,
+        char *structure,
+        int window_size,
+        int zsc,
+        double min_z){
+
+  float               energy;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t           md;
+
+  set_model_details(&md);
+
+  md.window_size = window_size;
+  md.max_bp_span = window_size;
+
+  vc  = vrna_fold_compound(string, &md, VRNA_OPTION_WINDOW);
+
+#ifndef USE_SVM
+  zsc = 0;  /* deactivate z-scoring if no compiled-in svm support is available */
+#endif
+
+  energy = wrap_Lfold(vc, zsc, min_z, NULL);
+
+  vrna_fold_compound_free(vc);
+
+  return energy;
+}
+
+#endif
diff --git a/C/ViennaRNA/Lfold.h b/C/ViennaRNA/Lfold.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/Lfold.h
@@ -0,0 +1,136 @@
+#ifndef VIENNA_RNA_PACKAGE_LFOLD_H
+#define VIENNA_RNA_PACKAGE_LFOLD_H
+
+/**
+ *  @file Lfold.h
+ *  @ingroup  local_fold
+ *  @brief    Functions for locally optimal MFE structure prediction
+ */
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+#include <ViennaRNA/mfe.h>
+
+/**
+ *  @brief Local MFE prediction using a sliding window approach (simplified interface)
+ * 
+ *  This simplified interface to vrna_mfe_window() computes the MFE and locally
+ *  optimal secondary structure using default options. Structures are predicted
+ *  using a sliding window approach, where base pairs may not span outside the
+ *  window. Memory required for dynamic programming (DP) matrices will
+ *  be allocated and free'd on-the-fly. Hence, after return of this function, the recursively filled
+ *  matrices are not available any more for any post-processing.
+ *
+ *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
+ *  you require other conditions than specified by the default model details, use vrna_mfe_window(),
+ *  and the data structure #vrna_fold_compound_t instead.
+ *
+ *  @ingroup local_mfe_fold
+ *
+ *  @see  vrna_mfe_window(), vrna_Lfoldz(), vrna_mfe_window_zscore(), vrna_fold_compound(),
+ *        #vrna_fold_compound_t
+ *
+ *  @param  string      The nucleic acid sequence
+ *  @param  window_size The window size for locally optimal structures
+ *  @param  file        The output file handle where predictions are written to (if NULL, output is written to stdout)
+ */
+float
+vrna_Lfold( const char *string,
+            int window_size,
+            FILE  *file);
+
+#ifdef USE_SVM
+/**
+ *  @brief Local MFE prediction using a sliding window approach with z-score cut-off (simplified interface)
+ * 
+ *  This simplified interface to vrna_mfe_window_zscore() computes the MFE and locally
+ *  optimal secondary structure using default options. Structures are predicted
+ *  using a sliding window approach, where base pairs may not span outside the
+ *  window. Memory required for dynamic programming (DP) matrices will
+ *  be allocated and free'd on-the-fly. Hence, after return of this function, the recursively filled
+ *  matrices are not available any more for any post-processing.
+ *  This function is the z-score version of vrna_Lfold(), i.e.
+ *  only predictions above a certain z-score cut-off value are
+ *  printed.
+ *
+ *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
+ *  you require other conditions than specified by the default model details, use vrna_mfe_window(),
+ *  and the data structure #vrna_fold_compound_t instead.
+ *
+ *  @ingroup local_mfe_fold
+ *
+ *  @see  vrna_mfe_window_zscore(), vrna_Lfold(), vrna_mfe_window(), vrna_fold_compound(),
+ *        #vrna_fold_compound_t
+ *
+ *  @param  string      The nucleic acid sequence
+ *  @param  window_size The window size for locally optimal structures
+ *  @param  min_z       The minimal z-score for a predicted structure to appear in the output
+ *  @param  file        The output file handle where predictions are written to (if NULL, output is written to stdout)
+ */
+float
+vrna_Lfoldz(const char *string,
+            int window_size,
+            double min_z,
+            FILE *file);
+
+#endif
+
+
+/**
+ *  @addtogroup local_consensus_fold
+ *  @{
+ *
+ *  @}
+ */
+
+/**
+ *  @brief
+ *
+ *  @ingroup local_consensus_fold
+ * 
+ *  @param strings
+ *  @param structure
+ *  @param maxdist
+ *  @return
+ */
+float aliLfold( const char **strings,
+                char *structure,
+                int maxdist);
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief The local analog to fold().
+ * 
+ *  Computes the minimum free energy structure including only base pairs
+ *  with a span smaller than 'maxdist'
+ *
+ *  @ingroup local_mfe_fold
+ *
+ *  @deprecated Use vrna_mfe_window() instead!
+ */
+DEPRECATED(float Lfold(const char *string, char *structure, int maxdist));
+
+/**
+ *  @brief
+ * 
+ *  @ingroup local_mfe_fold
+ * 
+ *  @deprecated Use vrna_mfe_window_zscore() instead!
+ */
+DEPRECATED(float Lfoldz(const char *string, char *structure, int maxdist, int zsc, double min_z));
+
+#endif
+
+#endif
diff --git a/C/ViennaRNA/MEA.c b/C/ViennaRNA/MEA.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/MEA.c
@@ -0,0 +1,288 @@
+/*
+                               MEA.c
+                 c  Ivo L Hofacker, Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <float.h>    /* #defines DBL_EPSILON */
+#include <math.h>
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/MEA.h"
+
+/* compute an MEA structure, i.e. the structure maximising
+   EA = \sum_{(i,j) \in S} 2\gamma p_{i,j} + \sum_{i is unpaired} p^u_i
+
+   This can be computed by a variant of the Nussinov recursion:
+   M(i,j) = min(M(i,j-1)+pu[j], min_k M(i,k-1)+C(k,j)
+   C(i,j) = 2*gamma*p_ij + M(i+1,j-1)
+
+   Just for fun, we implement it as a sparse DP algorithm.
+   At any time we store only the current and previous row of M.
+   The C matrix is implemented as a sparse matrix:
+   For each j we store in C[j] a list of values (i, MEA([i..j])), containing
+   the MEA over all structures closed by (i,j).
+   The list is sparse since only C values where C(i,j)==M(i,j) can
+   contribute to the optimal solution.
+*/
+
+typedef struct Litem {
+  int i;
+  double A;
+} Litem;
+
+typedef struct List {
+  unsigned size;   /* allocated space */
+  unsigned nelem;
+  Litem *list;
+} List;
+
+PRIVATE int comp_plist(const void *a, const void *b);
+PRIVATE plist *prune_sort(plist *p, double *pu, int n, double gamma, short *S, int gq);
+PRIVATE void pushC(List *c, int i, double a);
+
+struct MEAdat{
+  plist *pl;
+  double *pu;
+  double gamma;
+  List *C;
+  double *Mi;
+  char * structure;
+};
+
+PRIVATE void mea_backtrack(const struct MEAdat *bdat, int i, int j, int paired, short *S, vrna_exp_param_t *pf);
+
+PUBLIC float MEA(plist *p, char *structure, double gamma) {
+  return MEA_seq(p, NULL, structure, gamma, NULL);
+}
+
+PUBLIC float MEA_seq(plist *p, const char *sequence, char *structure, double gamma, vrna_exp_param_t *pf){
+
+  int i,j,n;
+  Litem *li;
+  plist *pp, *pl;
+  short *S = NULL;
+  int with_gquad = 0;
+
+  List *C;
+  double MEA, *Mi, *Mi1, *tmp, *pu;
+  struct MEAdat bdat;
+
+  n = strlen(structure);
+  for (i=0; i<n; i++) structure[i] = '.';
+
+  if(sequence){
+    if(pf){
+      S = vrna_seq_encode(sequence, &(pf->model_details));
+    } else {
+      vrna_exp_param_t *pf_params;
+      vrna_md_t         md;
+      set_model_details(&md);
+      pf_params = vrna_exp_params(&md);
+      S = vrna_seq_encode(sequence, &(pf_params->model_details));
+      with_gquad = pf_params->model_details.gquad;
+      free(pf_params);
+    }
+  }
+  if(pf)
+    with_gquad = pf->model_details.gquad;
+
+  pu = vrna_alloc(sizeof(double)*(n+1));
+  pp = pl = prune_sort(p, pu, n, gamma, S, with_gquad);
+
+  C = (List*) vrna_alloc((n+1)*(sizeof(List)));
+
+  Mi = (double *) vrna_alloc((n+1)*sizeof(double));
+  Mi1 = (double *) vrna_alloc((n+1)*sizeof(double));
+
+  for (i=n; i>0; i--) {
+    Mi[i] = pu[i];
+    for (j=i+1; j<=n; j++) {
+      double EA;
+      Mi[j] = Mi[j-1] + pu[j];
+      for (li=C[j].list; li<C[j].list+C[j].nelem; li++) {
+        EA = li->A + Mi[(li->i) -1];
+        Mi[j] = MAX2(Mi[j], EA);
+      }
+      if (pp->i == i && pp->j ==j) {
+        EA = 2*gamma*pp->p +  Mi1[j-1];
+        if (Mi[j]<EA) {
+          Mi[j]=EA;
+          pushC(&C[j], i, EA); /* only push into C[j] list if optimal */
+        }
+        pp++;
+      }
+
+    }
+    tmp = Mi1; Mi1 = Mi; Mi = tmp;
+  }
+
+  MEA = Mi1[n];
+
+  bdat.structure = structure; bdat.gamma = gamma;
+  bdat.C = C;  bdat.Mi=Mi1; bdat.pl=pl; bdat.pu = pu;
+  mea_backtrack(&bdat, 1, n, 0, S, pf);
+  free(Mi); free(Mi1); free(pl); free(pu);
+  for (i=1; i<=n; i++)
+    if (C[i].list) free(C[i].list);
+  free(C);
+  if(S) free(S);
+  return MEA;
+}
+
+PRIVATE int comp_plist(const void *a, const void *b) {
+  plist *A, *B;
+  int di;
+  A = (plist *)a;
+  B = (plist *)b;
+  di = (B->i - A->i);
+  if (di!=0) return di;
+  return (A->j - B->j);
+}
+
+
+PRIVATE plist *prune_sort(plist *p, double *pu, int n, double gamma, short *S, int gq){
+  /*
+     produce a list containing all base pairs with
+     2*gamma*p_ij > p^u_i + p^u_j
+     already sorted to be in the order we need them within the DP
+  */
+  unsigned size, i, nump = 0;
+  plist *pp, *pc, *pc2;
+
+  for (i=1; i<=n; i++) pu[i]=1.;
+
+  for (pc=p; pc->i >0; pc++) {
+    pu[pc->i] -= pc->p;
+    pu[pc->j] -= pc->p;
+  }
+
+  if(gq){
+    if(!S) vrna_message_error("no sequence information available in MEA gquad!");
+    /* remove probabilities that i or j are enclosed by a gquad */
+    for (i=1; i<=n; i++){
+      for(pc2 = p; pc2->i > 0; pc2++){
+        /* skip all non-gquads */
+        if(S[pc2->i] != 3) continue;
+        if(S[pc2->j] != 3) continue;
+        /* remove only if i is enclosed */
+        if((pc2->i < i) && (pc2->j > i))
+          pu[i] -= pc2->p;
+      }
+    }
+  }
+
+  size = n+1;
+  pp = vrna_alloc(sizeof(plist)*(n+1));
+  for (pc=p; pc->i >0; pc++) {
+    if (pc->i > n) vrna_message_error("mismatch between plist and structure in MEA()");
+    if (pc->p*2*gamma > pu[pc->i] + pu[pc->j]) {
+      if (nump+1 >= size) {
+        size += size/2 + 1;
+        pp = vrna_realloc(pp, size*sizeof(plist));
+      }
+      pp[nump++] = *pc;
+    }
+  }
+  pp[nump].i = pp[nump].j = pp[nump].p = 0;
+  qsort(pp, nump, sizeof(plist), comp_plist);
+  return pp;
+}
+
+PRIVATE void pushC(List *c, int i, double a) {
+  if (c->nelem+1>=c->size) {
+    c->size = MAX2(8,c->size*sqrt(2));
+    c->list = vrna_realloc(c->list, sizeof(Litem)*c->size);
+  }
+  c->list[c->nelem].i = i;
+  c->list[c->nelem].A = a;
+  c->nelem++;
+}
+
+PRIVATE void mea_backtrack(const struct MEAdat *bdat, int i, int j, int pair, short *S, vrna_exp_param_t *pf){
+  /* backtrack structure for the interval [i..j] */
+  /* recursively calls itself, recomputes the necessary parts of the M matrix */
+  List *C; Litem *li;
+  double *Mi, prec;
+  double *pu;
+  int fail=1;
+  int gq = 0;
+  if(pf)
+    gq = pf->model_details.gquad;
+
+
+  C = bdat->C;
+  Mi = bdat->Mi;
+  pu = bdat->pu;
+
+  if (pair) {
+    int k;
+    /* if pair == 1, insert pair and re-compute Mi values */
+    /* else Mi is already filled */
+    if(gq){
+      if((S[i] == 3) && (S[j] == 3)){
+        int L, l[3];
+        get_gquad_pattern_pf(S, i, j, pf, &L, l);
+        for(k=0;k<L;k++){
+          bdat->structure[i+k-1]\
+          = bdat->structure[i+k+L+l[0]-1]\
+          = bdat->structure[i+k+2*L+l[0]+l[1]-1]\
+          = bdat->structure[i+k+3*L+l[0]+l[1]+l[2]-1]\
+          = '+';
+        }
+        return;
+      } else {
+        bdat->structure[i-1] = '(';
+        bdat->structure[j-1] = ')';
+        i++; j--;
+        /* We've done this before in MEA() but didn't keep the results */
+        Mi[i-1]=0; Mi[i]=pu[i];
+        for (k=i+1; k<=j; k++) {
+          Mi[k] = Mi[k-1] + pu[k];
+          for (li=C[k].list; li<C[k].list+C[k].nelem && li->i >= i; li++) {
+            double EA;
+            EA = li->A + Mi[(li->i) -1];
+            Mi[k] = MAX2(Mi[k], EA);
+          }
+        }
+      }
+    } else {
+      bdat->structure[i-1] = '(';
+      bdat->structure[j-1] = ')';
+      i++; j--;
+      /* We've done this before in MEA() but didn't keep the results */
+      Mi[i-1]=0; Mi[i]=pu[i];
+      for (k=i+1; k<=j; k++) {
+        Mi[k] = Mi[k-1] + pu[k];
+        for (li=C[k].list; li<C[k].list+C[k].nelem && li->i >= i; li++) {
+          double EA;
+          EA = li->A + Mi[(li->i) -1];
+          Mi[k] = MAX2(Mi[k], EA);
+        }
+      }
+    }
+  }
+
+  prec = DBL_EPSILON * Mi[j];
+  /* Mi values are filled, do the backtrace */
+  while (j>i && Mi[j] <= Mi[j-1] + pu[j] + prec) {
+    bdat->structure[j-1]='.';
+    j--;
+  }
+  for (li=C[j].list; li<C[j].list + C[j].nelem && li->i >= i; li++) {
+    if (Mi[j] <= li->A + Mi[(li->i) -1] + prec) {
+      if (li->i > i+3) mea_backtrack(bdat, i, (li->i)-1, 0, S, pf);
+      mea_backtrack(bdat, li->i, j, 1, S, pf);
+      fail = 0;
+    }
+  }
+  if (fail && j>i) vrna_message_error("backtrack failed for MEA()");
+}
diff --git a/C/ViennaRNA/MEA.h b/C/ViennaRNA/MEA.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/MEA.h
@@ -0,0 +1,36 @@
+#ifndef VIENNA_RNA_PACKAGE_MEA_H
+#define VIENNA_RNA_PACKAGE_MEA_H
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+
+/**
+ *  @file MEA.h
+ *  @ingroup subopt_and_representatives
+ *  @brief Computes a MEA (maximum expected accuracy) structure.
+ */
+
+/**
+ *  @brief Computes a MEA (maximum expected accuracy) structure.
+ *
+ *  @ingroup  mea_fold
+ *
+ *  The algorithm maximizes the expected accuracy
+ *  @f[ A(S) = \sum_{(i,j) \in S} 2 \gamma p_{ij} + \sum_{i \notin S} p^u_i @f]
+ *  Higher values of @f$\gamma@f$ result in more base pairs of lower
+ *  probability and thus higher sensitivity. Low values of @f$\gamma@f$ result in structures
+ *  containing only highly likely pairs (high specificity).
+ *  The code of the MEA function also demonstrates the use of sparse dynamic
+ *  programming scheme to reduce the time and memory complexity of folding.
+ */
+float MEA(plist *p,
+          char *structure,
+          double gamma);
+
+float MEA_seq(plist *p,
+              const char *sequence,
+              char *structure,
+              double gamma,
+              vrna_exp_param_t *pf);
+
+#endif
diff --git a/C/ViennaRNA/PKplex.h b/C/ViennaRNA/PKplex.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/PKplex.h
@@ -0,0 +1,25 @@
+#ifndef PKPLEX_H
+#define PKPLEX_H
+
+#include <ViennaRNA/data_structures.h>
+
+extern dupVar *PlexHits;
+extern int    PlexHitsArrayLength;
+extern int    NumberOfHits;
+extern int    verbose;
+
+
+/**
+ *  \brief 
+ */
+dupVar  **PKLduplexfold_XS( const char *s1,
+                            int **access_s1,
+                            const int threshold,
+                            const int alignment_length,
+                            const int delta);
+
+int     arraySize(duplexT **array);
+
+void    freeDuplexT(duplexT **array);
+
+#endif
diff --git a/C/ViennaRNA/PS_dot.c b/C/ViennaRNA/PS_dot.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/PS_dot.c
@@ -0,0 +1,1293 @@
+/*
+        PostScript and GML output for RNA secondary structures
+                    and pair probability matrices
+
+                 c  Ivo Hofacker and Peter F Stadler
+                          Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+#include "ViennaRNA/model.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/PS_dot.h"
+#include "ViennaRNA/aln_util.h"
+#include "ViennaRNA/gquad.h"
+
+/*
+#################################
+# PRIVATE MACROS                #
+#################################
+*/
+
+#define SIZE 452.
+#define PMIN 0.00001
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+static const char *RNAdp_prolog =
+"%This file contains the square roots of the base pair probabilities in the form\n"
+"% i  j  sqrt(p(i,j)) ubox\n\n"
+"%%BeginProlog\n"
+"/DPdict 100 dict def\n"
+"DPdict begin\n"
+"/logscale false def\n"
+"/lpmin 1e-05 log def\n\n"
+"/DataVisible  [ true true true true] def\n"
+"/DataTitles   [ false false false false ] def\n\n"
+"/min { 2 copy gt { exch } if pop } bind def\n\n"
+"/max { 2 copy lt { exch } if pop } bind def\n\n"
+"/box { %size x y box - draws box centered on x,y\n"
+"   2 index 0.5 mul sub            % x -= 0.5\n"
+"   exch 2 index 0.5 mul sub exch  % y -= 0.5\n"
+"   3 -1 roll dup rectfill\n"
+"} bind def\n\n"
+"/ubox {\n"
+"   logscale {\n"
+"      log dup add lpmin div 1 exch sub dup 0 lt { pop 0 } if\n"
+"   } if\n"
+"   3 1 roll\n"
+"   exch len exch sub 1 add box\n"
+"} bind def\n\n"
+"/lbox {\n"
+"   3 1 roll\n"
+"   len exch sub 1 add box\n"
+"} bind def\n\n"
+"/drawseq {\n"
+"% print sequence along all 4 sides\n"
+"[ [0.7 -0.3 0 ]\n"
+"  [0.7 0.7 len add 0]\n"
+"  [-0.3 len sub -0.4 -90]\n"
+"  [-0.3 len sub 0.7 len add -90]\n"
+"] {\n"
+"   gsave\n"
+"    aload pop rotate translate\n"
+"    0 1 len 1 sub {\n"
+"     dup 0 moveto\n"
+"     sequence exch 1 getinterval\n"
+"     show\n"
+"    } for\n"
+"   grestore\n"
+"  } forall\n"
+"} bind def\n\n"
+"/drawgrid{\n"
+"  gsave\n"
+"  0.5 dup translate"
+"  0.01 setlinewidth\n"
+"  len log 0.9 sub cvi 10 exch exp  % grid spacing\n"
+"  dup 1 gt {\n"
+"     dup dup 20 div dup 2 array astore exch 40 div setdash\n"
+"  } { [0.3 0.7] 0.1 setdash } ifelse\n"
+"  0 exch len {\n"
+"     dup dup\n"
+"     0 moveto\n"
+"     len lineto\n"
+"     dup\n"
+"     len exch sub 0 exch moveto\n"
+"     len exch len exch sub lineto\n"
+"     stroke\n"
+"  } for\n"
+"  [] 0 setdash\n"
+"  0.04 setlinewidth\n"
+"  currentdict /cutpoint known {\n"
+"    cutpoint 1 sub\n"
+"    dup dup -1 moveto len 1 add lineto\n"
+"    len exch sub dup\n"
+"    -1 exch moveto len 1 add exch lineto\n"
+"    stroke\n"
+"  } if\n"
+"  %% draw diagonal\n"
+"  0 len moveto len 0 lineto stroke\n"
+"  grestore\n"
+"} bind def\n\n"
+"/drawTitle {\n"
+"  currentdict /DPtitle known {\n"
+"    % center title text\n"
+"    /Helvetica findfont 10 scalefont setfont\n"
+"    360 705 moveto DPtitle dup stringwidth pop 2 div neg 0 rmoveto show\n"
+"  } if\n"
+"} bind def\n\n"
+"/prepareCoords {\n"
+"  0 1 3 {\n"
+"    % check whether we want to display current data\n"
+"    dup DataVisible exch get\n"
+"    {\n"
+"      % check whether we've actually got some data\n"
+"      DataSource exch get dup currentdict exch known {\n"
+"        % data source s_j is present, so find length of array\n"
+"        currentdict exch get length \n"
+"      } { pop 0 } ifelse\n"
+"    } if\n"
+"  } for\n"
+"  exch dup 5 -1 roll add 4 -1 roll dup 5 1 roll 4 -1 roll add max\n"
+"  len add 3 add 700 exch div dup scale\n"
+"  exch 1 add exch 1 add translate\n"
+"} bind def\n\n";
+
+static const char *RNAdp_sd =
+"/utri{ % i j prob utri\n"
+"  gsave\n"
+"  0.5 dup translate\n"
+"  1 min 2 div\n"
+"  0.85 mul 0.15 add 0.95  0.33\n"
+"  3 1 roll % prepare hsb color\n"
+"  sethsbcolor\n"
+"  % now produce the coordinates for lines\n"
+"  exch 1 sub dup len exch sub dup 4 -1 roll dup 3 1 roll dup len exch sub\n"
+"  moveto lineto lineto closepath fill\n"
+"  grestore\n"
+"} bind def\n\n";
+
+static const char *RNAdp_ud =
+"/uUDmotif{ % i j uUDmotif\n"
+"  gsave\n"
+"  0.5 dup translate\n"
+"  1 min 2 div\n"
+"  0.85 mul 0.15 add 0.95 0.6\n"
+"  3 1 roll % prepare hsb color\n"
+"  sethsbcolor\n"
+"  % now produce the coordinates for lines\n"
+"  exch 1 sub dup len exch sub dup 4 -1 roll dup 3 1 roll dup len exch sub\n"
+"  moveto lineto lineto closepath fill\n"
+"  grestore\n"
+"} bind def\n"
+"/lUDmotif{ % i j lUDmotif\n"
+"  gsave\n"
+"  0.5 dup translate\n"
+"  1 min 2 div\n"
+"  0.85 mul 0.15 add 0.95 0.6\n"
+"  3 1 roll % prepare hsb color\n"
+"  sethsbcolor\n"
+"  % now produce the coordinates for lines\n"
+"  dup len exch sub dup 4 -1 roll 1 sub dup 3 1 roll dup len exch sub\n"
+"  moveto lineto lineto closepath fill\n"
+"  grestore\n"
+"} bind def\n\n";
+
+static const char *RNAdp_sc_motifs =
+"/uHmotif{ % i j uHmotif\n"
+"  gsave\n"
+"  0.5 dup translate\n"
+"  1 min 2 div\n"
+"  0.85 mul 0.15 add 0.95  0.99\n"
+"  3 1 roll % prepare hsb color\n"
+"  sethsbcolor\n"
+"  % now produce the coordinates for lines\n"
+"  exch 1 sub dup len exch sub dup 4 -1 roll dup 3 1 roll dup len exch sub\n"
+"  moveto lineto lineto closepath fill\n"
+"  grestore\n"
+"} bind def\n"
+"/lHmotif{ % i j lHmotif\n"
+"  gsave\n"
+"  0.5 dup translate\n"
+"  1 min 2 div\n"
+"  0.85 mul 0.15 add 0.95  0.99\n"
+"  3 1 roll % prepare hsb color\n"
+"  sethsbcolor\n"
+"  % now produce the coordinates for lines\n"
+"  dup len exch sub dup 4 -1 roll 1 sub dup 3 1 roll dup len exch sub\n"
+"  moveto lineto lineto closepath fill\n"
+"  grestore\n"
+"} bind def\n"
+"/uImotif{ % i j k l uImotif\n"
+"  gsave\n"
+"  0.5 dup translate\n"
+"  1 min 2 div\n"
+"  0.85 mul 0.15 add 0.95  0.99\n"
+"  3 1 roll % prepare hsb color\n"
+"  sethsbcolor\n"
+"  % now produce the coordinates for lines\n"
+"  1 sub dup 5 1 roll exch len exch sub dup 5 1 roll 3 -1 roll dup\n"
+"  5 1 roll exch 4 1 roll 3 1 roll exch 1 sub len exch sub dup 3 1 roll\n"
+"  moveto lineto lineto lineto closepath fill\n"
+"  grestore\n"
+"} bind def\n"
+"/lImotif{ % i j k l lImotif\n"
+"  gsave\n"
+"  0.5 dup translate\n"
+"  1 min 2 div\n"
+"  0.85 mul 0.15 add 0.95  0.99\n"
+"  3 1 roll % prepare hsb color\n"
+"  sethsbcolor\n"
+"  % now produce the coordinates for lines\n"
+"  4 -1 roll 1 sub dup 5 1 roll exch 1 sub len exch sub dup 3 -1 roll exch\n"
+"  5 -1 roll len exch sub dup 6 -1 roll dup 3 1 roll 7 4 roll\n"
+"  moveto lineto lineto lineto closepath fill\n"
+"  grestore\n"
+"} bind def\n";
+
+static const char *RNAdp_prolog_turn =
+"/drawseq_turn {"
+"% print sequence at bottom\n"
+"   gsave\n"
+"   len 2 sqrt div dup neg 0.28 add exch 0.78 sub translate\n"
+"    0 1 len 1 sub {\n"
+"     dup dup 2 sqrt mul 0 moveto\n"
+"     sequence exch 1 getinterval\n"
+"     show\n"
+"    } for\n"
+"   grestore\n"
+"} bind def\n"
+"/drawgrid_turn{\n"
+"  0.01 setlinewidth\n"
+"  len log 0.9 sub cvi 10 exch exp  % grid spacing\n"
+"  dup 1 gt {\n"
+"     dup dup 20 div dup 2 array astore exch 40 div setdash\n"
+"  } { [0.3 0.7] 0.1 setdash } ifelse\n"
+"  0 exch len {    %for (0, gridspacing, len) \n"
+"     dup dup      %duplicate what - gridspacing??\n"
+"     dup len exch sub moveto     %moveto diagonal?\n"
+"     dup winSize gt\n"
+"     {dup dup len exch sub winSize add lineto}\n"
+"     {dup len lineto}ifelse\n"
+"     dup len exch sub moveto  %moveto diagonal?\n"
+"     dup len winSize sub le\n"
+"     {dup dup len exch sub dup winSize exch sub len add exch lineto}\n"
+"     {dup dup len exch sub len exch lineto}ifelse"
+"     stroke pop pop\n"
+"  } for\n"
+"  len log 0.9 sub cvi 10 exch exp  % grid spacing\n"
+"      dup 1 gt {\n"
+"          dup dup 20 div dup 2 array astore exch 40 div setdash\n"
+"      } { [0.3 0.7] 0.1 setdash } ifelse\n"
+"      0 exch len {    %for (0, gridspacing, len) \n"
+"     dup dup      %duplicate what - gridspacing??\n"
+"     dup len exch sub moveto     %moveto diagonal?\n"
+"     len exch sub 0.7 sub exch 0.7 sub exch lineto\n"
+"     stroke\n"
+"   }for\n"
+" winSize len moveto  len winSize  lineto stroke\n"
+"  [] 0 setdash\n"
+"  0.04 setlinewidth \n"
+"  currentdict /cutpoint known {\n"
+"    cutpoint 1 sub\n"
+"    dup dup -1 moveto len 1 add lineto\n"
+"    len exch sub dup\n"
+"    -1 exch moveto len 1 add exch lineto\n"
+"   stroke\n"
+"  } if\n"
+"  0.5 neg dup translate\n"
+"} bind def \n\n";
+
+static const char *RNAdp_linear_data =
+"/drawDataSquareBottom { % x v n dataSquareBottom draw box\n"
+"  len add 2 add exch lbox\n"
+"} bind def\n\n"
+"/drawDataSquareTop { % x v n dataSquareBottom draw box\n"
+"  neg 1 sub exch lbox\n"
+"} bind def\n\n"
+"/drawDataSquareLeft { % y v n dataSquareBottom draw box\n"
+"  neg 1 sub 3 1 roll lbox\n"
+"} bind def\n\n"
+"/drawDataSquareRight { % y v n dataSquareBottom draw box\n"
+"  % use size x y box to draw box\n"
+"  2 add len add 3 1 roll lbox\n"
+"} bind def\n\n"
+"/drawDataSquareBottomHSB { % x v h s b n dataSquareBottomHSB draw box\n"
+"  % use size x y box to draw box\n"
+"  len add 2 add 5 1 roll sethsbcolor lbox\n"
+"} bind def\n\n"
+"/drawDataSquareTopHSB { % x v h s b n dataSquareBottomHSB draw box\n"
+"  % use size x y box to draw box\n"
+"  neg 1 sub 5 1 roll sethsbcolor lbox\n"
+"} bind def\n\n"
+"/drawDataSquareLeftHSB { % x v h s b n dataSquareLeftHSB draw box\n"
+"  % use size x y box to draw box\n"
+"  neg 1 sub 6 1 roll sethsbcolor lbox\n"
+"} bind def\n\n"
+"/drawDataSquareRightHSB { % x v h s b n dataSquareLeftHSB draw box\n"
+"  % use size x y box to draw box\n"
+"  2 add len add 6 1 roll sethsbcolor lbox\n"
+"} bind def\n\n"
+"/drawDataTitleBottom {\n"
+"  /Helvetica findfont 0.95 scalefont setfont\n"
+"  0 -1.4 3 -1 roll sub moveto \n"
+"  dup stringwidth pop neg 0 rmoveto   \n"
+"  show\n"
+"} bind def\n\n"
+"/drawDataTitleTop {\n"
+"  /Helvetica findfont 0.95 scalefont setfont\n"
+"  0 len 1.6 add 3 -1 roll add moveto \n"
+"  dup stringwidth pop neg 0 rmoveto   \n"
+"  show\n"
+"} bind def\n\n"
+"/drawDataTitleLeft {\n"
+"  /Helvetica findfont 0.95 scalefont setfont\n"
+"  neg 1.4 sub len 1 add moveto \n"
+"  dup stringwidth pop 0 exch rmoveto -90 rotate\n"
+"  show 90 rotate\n"
+"} bind def\n\n"
+"/drawDataTitleRight {\n"
+"  /Helvetica findfont 0.95 scalefont setfont\n"
+"  1.6 add len add len 1 add moveto \n"
+"  dup stringwidth pop 0 exch rmoveto -90 rotate\n"
+"  show 90 rotate\n"
+"} bind def\n\n"
+"% do not modify the arrays below unless you know what you're doing!\n"
+"/DataSource     [ /topData /leftData /bottomData /rightData ] def\n"
+"/DataDrawBox    [ /drawDataSquareTop  /drawDataSquareLeft /drawDataSquareBottom /drawDataSquareRight] def\n"
+"/DataDrawBoxHSB [ /drawDataSquareTopHSB /drawDataSquareLeftHSB /drawDataSquareBottomHSB /drawDataSquareRightHSB ] def\n"
+"/DataDrawTitle  [ /drawDataTitleTop /drawDataTitleLeft /drawDataTitleBottom /drawDataTitleRight ] def\n\n"
+"% this is the logic to parse the auxiliary linear data\n"
+"% given in arrays topData, leftData, bottomData, and rightData\n"
+"% See also the Boolean arrays DataVisible and DataTitles that\n"
+"% are used to control which part of data will be visible\n"
+"/drawData {\n"
+"  0 1 3 {\n"
+"    % check whether we want to display current data\n"
+"    dup DataVisible exch get\n"
+"    {\n"
+"      % check whether we've actually got some data\n"
+"      dup DataSource exch get dup currentdict exch known {\n"
+"        % data source s_j is present, so we load the\n"
+"        % corresponding data array a and loop over all data sets a[i]\n"
+"        currentdict exch get dup length 1 sub 0 1 3 -1 roll {\n"
+"          dup dup\n"
+"          % now on stack: j a i i i\n\n"
+"          % load data set, i.e. a[i]\n"
+"          4 -1 roll         % j i i i a\n"
+"          dup 3 -1 roll get dup % j i i a a[i] a[i]\n\n"
+"          % 1. check whether we need to process data set title\n"
+"          6 -1 roll dup 7 1 roll DataTitles exch get {\n"
+"            % get current title drawing function key\n"
+"            6 -1 roll dup 7 1 roll DataDrawTitle exch get\n"
+"            % now on stack: ... j i i a a[i] a[i] title_draw_key\n\n"
+"            % get current title and execute drawing function\n"
+"            exch 0 get exch currentdict exch get 5 -1 roll exch exec\n"
+"          } { % remove unused variables\n"
+"              pop 3 -1 roll pop\n"
+"          } ifelse\n"
+"          % now on stack: ... j i a a[i]\n\n"
+"          % 2. process actual data a[k] for 1 <= k < n\n"
+"          dup length 1 sub 1 exch getinterval { \n"
+"            % on stack: j i a a[i][k]\n"
+"            gsave\n"
+"            dup length 2 eq { % print black box if two-valued\n"
+"              % get box drawing function\n"
+"              4 -1 roll dup 5 1 roll DataDrawBox exch get currentdict exch get exch\n"
+"              aload pop 5 -1 roll dup 6 1 roll 4 -1 roll exec\n"
+"            } {\n"
+"              dup length 5 eq { % print box with hsb color\n"
+"                % get box drawing function\n"
+"                4 -1 roll dup 5 1 roll DataDrawBoxHSB exch get currentdict exch get exch\n"
+"                % on stack: j i a f a[i]\n"
+"                % load data array and prepare for drawing\n"
+"                aload pop 8 -1 roll dup 9 1 roll 7 -1 roll exec\n"
+"              } { pop } ifelse\n"
+"            } ifelse\n"
+"            grestore\n"
+"          } forall\n"
+"          exch pop \n"
+"          % left on stack: j a\n"
+"        } for\n"
+"        \n"
+"      } if\n"
+"    } if\n"
+"  } for\n"
+"} bind def\n\n";
+
+
+#define dp_add_lindata(data_var, data, title_var, title, size, avail)  \
+  (title_var)[size] = title; \
+  (data_var)[size]  = data; \
+  if((++size) == (avail)){ \
+    avail *= 1.2; \
+    data_var  = (vrna_data_lin_t **)vrna_realloc(data_var, sizeof(vrna_data_lin_t *) * avail); \
+    title_var = (char **)vrna_realloc(title_var, sizeof(char *) * avail); \
+  }
+
+
+#define dp_finalize_lindata(data_var, title_var, size) \
+  (data_var)[size]  = NULL; \
+  (title_var)[size] = NULL; \
+  (data_var)        = (vrna_data_lin_t **)vrna_realloc(data_var, sizeof(vrna_data_lin_t *) * (size + 1)); \
+  (title_var)       = (char **)vrna_realloc(title_var, sizeof(char *) * (size + 1));
+
+
+#define DP_MACRO_NONE         0U
+#define DP_MACRO_LINEAR_DATA  1U
+#define DP_MACRO_SC_MOTIFS    2U
+#define DP_MACRO_SD           4U
+#define DP_MACRO_UD           8U
+
+#define DP_MACRO_ALL          (DP_MACRO_LINEAR_DATA | DP_MACRO_SC_MOTIFS | DP_MACRO_SD | DP_MACRO_UD)
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+PRIVATE FILE  *PS_dot_common(const char *seq, int cp, const char *wastlfile, char *comment, int winsize, unsigned int options);
+PRIVATE int   sort_plist_by_type_desc(const void *p1, const void *p2);
+PRIVATE int   sort_plist_by_prob_asc(const void *p1, const void *p2);
+PRIVATE void  EPS_footer(FILE *eps);
+PRIVATE void  EPS_print_title(FILE *eps, const char *title);
+PRIVATE void  EPS_print_seq(FILE *eps, const char *sequence);
+PRIVATE void  EPS_print_header(FILE *eps, int bbox[4], const char *comment, unsigned int options);
+PRIVATE void  EPS_print_ud_data(FILE *eps, plist *pl, plist *mf);
+PRIVATE void  EPS_print_sd_motif_data(FILE *eps, plist *pl, plist *mf);
+PRIVATE void  EPS_print_sc_motif_data(FILE *eps, plist *pl, plist *mf);
+PRIVATE void  EPS_print_bpp_data(FILE *eps, plist *pl, plist *mf);
+PRIVATE void  EPS_print_linear_data_top(FILE *eps, const char **data_title, vrna_data_lin_t **data);
+PRIVATE void  EPS_print_linear_data_left(FILE *eps, const char **data_title, vrna_data_lin_t **data);
+PRIVATE void  EPS_print_linear_data_bottom(FILE *eps, const char **data_title, vrna_data_lin_t **data);
+PRIVATE void  EPS_print_linear_data_right(FILE *eps, const char **data_title, vrna_data_lin_t **data);
+PRIVATE void  EPS_print_linear_data(FILE *eps, const char *varname, const char **data_title, vrna_data_lin_t **data);
+PRIVATE vrna_data_lin_t *plist_to_accessibility(plist *pl, unsigned int length);
+PRIVATE vrna_data_lin_t *plist_to_ud_motif_prob(plist *pl, unsigned int length);
+PRIVATE void  EPS_print_sd_data(FILE *eps, vrna_plist_t *pl, vrna_plist_t *mf);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC int
+PS_color_dot_plot(char *seq,
+                  cpair *pi,
+                  char *wastlfile){
+
+  /* produce color PostScript dot plot from cpair */
+
+  FILE *wastl;
+  int i;
+
+  wastl = PS_dot_common(seq, cut_point, wastlfile, NULL, 0, DP_MACRO_NONE);
+  if (wastl==NULL)  return 0; /* return 0 for failure */
+
+  fprintf(wastl, "/hsb {\n"
+          "dup 0.3 mul 1 exch sub sethsbcolor\n"
+          "} bind def\n\n");
+
+  fprintf(wastl,  "\n%%draw the grid\ndrawgrid\n\n");
+  fprintf(wastl,"%%start of base pair probability data\n");
+
+  /* print boxes */
+   i=0;
+   while (pi[i].j>0) {
+     fprintf(wastl,"%1.2f %1.2f hsb %d %d %1.6f ubox\n",
+             pi[i].hue, pi[i].sat, pi[i].i, pi[i].j, sqrt(pi[i].p));
+
+     if (pi[i].mfe)
+       fprintf(wastl,"%1.2f %1.2f hsb %d %d %1.4f lbox\n",
+               pi[i].hue, pi[i].sat, pi[i].i, pi[i].j, pi[i].p);
+     i++;
+   }
+
+   EPS_footer(wastl);
+
+   fclose(wastl);
+   return 1; /* success */
+}
+
+
+PUBLIC int
+PS_dot_plot_list( char *seq,
+                  char *wastlfile,
+                  plist *pl,
+                  plist *mf,
+                  char *comment){
+
+  return vrna_plot_dp_PS_list(seq, cut_point, wastlfile, pl, mf, comment);
+}
+
+
+PUBLIC int
+vrna_plot_dp_PS_list( char *seq,
+                      int cp,
+                      char *wastlfile,
+                      plist *pl,
+                      plist *mf,
+                      char *comment){
+
+  FILE *wastl;
+  int pl_size, gq_num;
+  double tmp;
+  plist *pl1;
+
+  wastl = PS_dot_common(seq, cp, wastlfile, comment, 0, DP_MACRO_ALL);
+
+  if (wastl==NULL) return 0; /* return 0 for failure */
+
+  fprintf(wastl,"%%data starts here\n");
+
+  /* sort the plist to bring all gquad triangles to the front */
+  for(gq_num = pl_size = 0, pl1 = pl; pl1->i > 0; pl1++, pl_size++)
+    if(pl1->type == 1) gq_num++;
+  qsort(pl, pl_size, sizeof(plist), sort_plist_by_type_desc);
+  /* sort all gquad triangles by probability to bring lower probs to the front */
+  qsort(pl, gq_num, sizeof(plist), sort_plist_by_prob_asc);
+
+  EPS_print_sd_data(wastl, pl, mf);
+  EPS_print_sc_motif_data(wastl, pl, mf);
+
+  fprintf(wastl, "\n%%draw the grid\ndrawgrid\n\n");
+  fprintf(wastl,"%%start of base pair probability data\n");
+
+  EPS_print_bpp_data(wastl, pl, mf);
+
+  EPS_footer(wastl);
+
+  fclose(wastl);
+  return 1; /* success */
+}
+
+
+PUBLIC int
+vrna_plot_dp_EPS( const char              *filename,
+                  const char              *sequence,
+                  vrna_plist_t            *upper,
+                  vrna_plist_t            *lower,
+                  vrna_dotplot_auxdata_t  *auxdata,
+                  unsigned int            options){
+
+  char            **lintoptitle,**linbottomtitle,**linlefttitle,**linrighttitle,
+                  *c, *comment, *title;
+  int             pl_size, gq_num, i, lintop_num, lintop_size, linbottom_num,
+                  linbottom_size, linleft_num, linleft_size, linright_num,
+                  linright_size, bbox[4];
+  double          tmp;
+  FILE            *fh;
+  plist           *pl1;
+  vrna_data_lin_t **lintop, **linbottom, **linleft, **linright, *ud_lin, *access;
+
+  fh = fopen(filename, "w");
+  if(!fh){
+    vrna_message_warning("can't open %s for dot plot", filename);
+    return 0; /* return 0 for failure */
+  }
+
+  comment = title = NULL;
+
+  lintop_num      = 0;
+  lintop_size     = 5;
+  linbottom_num   = 0;
+  linbottom_size  = 5;
+  linleft_num     = 0;
+  linleft_size    = 5;
+  linright_num    = 0;
+  linright_size   = 5;
+  bbox[0]         = 0;
+  bbox[1]         = 0;
+  bbox[2]         = 700;
+  bbox[3]         = 720;
+  access          = NULL;
+  ud_lin          = NULL;
+  lintop          = (vrna_data_lin_t **)vrna_alloc(sizeof(vrna_data_lin_t *) * lintop_size);
+  lintoptitle     = (char **)vrna_alloc(sizeof(char *) * lintop_size);
+  linbottom       = (vrna_data_lin_t **)vrna_alloc(sizeof(vrna_data_lin_t *) * linbottom_size);
+  linbottomtitle  = (char **)vrna_alloc(sizeof(char *) * linbottom_size);
+  linleft         = (vrna_data_lin_t **)vrna_alloc(sizeof(vrna_data_lin_t *) * linleft_size);
+  linlefttitle    = (char **)vrna_alloc(sizeof(char *) * linleft_size);
+  linright        = (vrna_data_lin_t **)vrna_alloc(sizeof(vrna_data_lin_t *) * linright_size);
+  linrighttitle   = (char **)vrna_alloc(sizeof(char *) * linright_size);
+
+  /* prepare linear data and retrieve number of additional linear data lines to correct bounding box */
+  if(options & VRNA_PLOT_PROBABILITIES_UD_LIN){
+    ud_lin = plist_to_ud_motif_prob(upper, strlen(sequence));
+    if(ud_lin){
+      dp_add_lindata(lintop, ud_lin, lintoptitle, "Protein binding", lintop_num, lintop_size);
+      dp_add_lindata(linleft, ud_lin, linlefttitle, "Protein binding", linleft_num, linleft_size);
+      dp_add_lindata(linbottom, ud_lin, linbottomtitle, "Protein binding", linbottom_num, linbottom_size);
+      dp_add_lindata(linright, ud_lin, linrighttitle, "Protein binding", linright_num, linright_size);
+    }
+  }
+
+  if(options & VRNA_PLOT_PROBABILITIES_ACC){
+    access = plist_to_accessibility(upper, strlen(sequence));
+    dp_add_lindata(lintop, access, lintoptitle, "Accessibility", lintop_num, lintop_size);
+  }
+
+  if(auxdata){
+    if(auxdata->top){
+      for(i = 0; auxdata->top[i]; i++){
+        dp_add_lindata(lintop, auxdata->top[i], lintoptitle, auxdata->top_title[i], lintop_num, lintop_size);
+      }
+    }
+    if(auxdata->bottom){
+      for(i = 0; auxdata->bottom[i]; i++){
+        dp_add_lindata(linbottom, auxdata->bottom[i], linbottomtitle, auxdata->bottom_title[i], linbottom_num, linbottom_size);
+      }
+    }
+    if(auxdata->left){
+      for(i = 0; auxdata->left[i]; i++){
+        dp_add_lindata(linleft, auxdata->left[i], linlefttitle, auxdata->left_title[i], linleft_num, linleft_size);
+      }
+    }
+    if(auxdata->right){
+      for(i = 0; auxdata->right[i]; i++){
+        dp_add_lindata(linright, auxdata->right[i], linrighttitle, auxdata->right_title[i], linright_num, linright_size);
+      }
+    }
+  }
+
+  dp_finalize_lindata(lintop, lintoptitle, lintop_num);
+  dp_finalize_lindata(linbottom, linbottomtitle, linbottom_num);
+  dp_finalize_lindata(linleft, linlefttitle, linleft_num);
+  dp_finalize_lindata(linright, linrighttitle, linright_num);
+
+  if(auxdata){
+    comment = auxdata->comment;
+    title   = (auxdata->title) ? strdup(auxdata->title) : NULL;
+  }
+
+  if(!title){
+    title = strdup(filename);
+    if((c=strrchr(title, '_')))
+      *c='\0';
+  }
+
+  /* start printing postscript file */
+  EPS_print_header(fh, bbox, comment, DP_MACRO_ALL);
+  EPS_print_title(fh, title);
+  EPS_print_seq(fh, sequence);
+
+  fprintf(fh,"%% BEGIN linear data array\n\n");
+  EPS_print_linear_data_top(fh, (const char **)lintoptitle, lintop);
+  EPS_print_linear_data_left(fh, (const char **)linlefttitle, linleft);
+  EPS_print_linear_data_bottom(fh, (const char **)linbottomtitle, linbottom);
+  EPS_print_linear_data_right(fh, (const char **)linrighttitle, linright);
+  fprintf(fh,"%% END linear data arrays\n");
+
+  fprintf(fh, "\n%%Finally, prepare canvas\n\n"
+              "%%draw title\ndrawTitle\n\n"
+              "%%prepare coordinate system, draw grid and sequence\n"
+              "/Helvetica findfont 0.95 scalefont setfont\n\n"
+              "%%prepare coordinate system\nprepareCoords\n\n"
+              "%%draw sequence arround grid\ndrawseq\n\n"
+              "%%draw grid\ndrawgrid\n\n"
+              "%%draw auxiliary linear data (if available)\ndrawData\n\n");
+
+  fprintf(fh,"%%data (commands) starts here\n");
+
+  if(options & VRNA_PLOT_PROBABILITIES_SD){
+    EPS_print_sd_data(fh, upper, lower);
+  }
+
+  if(options & VRNA_PLOT_PROBABILITIES_UD){
+    EPS_print_ud_data(fh, upper, lower);
+  }
+
+
+  EPS_print_sc_motif_data(fh, upper, lower);
+  EPS_print_bpp_data(fh, upper, lower);
+
+  EPS_footer(fh);
+
+  fclose(fh);
+  free(lintoptitle);
+  free(lintop);
+  free(linbottomtitle);
+  free(linbottom);
+  free(linlefttitle);
+  free(linleft);
+  free(linrighttitle);
+  free(linright);
+  free(access);
+  free(ud_lin);
+  free(title);
+
+  return 1; /* success */
+}
+
+
+PUBLIC int
+PS_color_dot_plot_turn( char *seq,
+                        cpair *pi,
+                        char *wastlfile,
+                        int winSize) {
+
+  /* produce color PostScript dot plot from cpair */
+
+  FILE *wastl;
+  int i;
+
+  wastl = PS_dot_common(seq, cut_point, wastlfile, NULL, winSize, DP_MACRO_NONE);
+  if (wastl==NULL)
+    return 0; /* return 0 for failure */
+
+  fprintf(wastl, "/hsb {\n"
+          "dup 0.3 mul 1 exch sub sethsbcolor\n"
+          "} bind def\n\n"
+          "%%BEGIN DATA\n");
+
+  if(winSize > 0)
+    fprintf(wastl, "\n%%draw the grid\ndrawgrid_turn\n\n");
+  else
+    fprintf(wastl,  "\n%%draw the grid\ndrawgrid\n\n");
+  fprintf(wastl,"%%start of base pair probability data\n");
+
+  /* print boxes */
+   i=0;
+   while (pi[i].j>0) {
+     fprintf(wastl,"%1.2f %1.2f hsb %d %d %1.6f ubox\n",
+             pi[i].hue, pi[i].sat, pi[i].i, pi[i].j, sqrt(pi[i].p));/*sqrt??*/
+
+     if (pi[i].mfe)
+       fprintf(wastl,"%1.2f %1.2f hsb %d %d %1.4f lbox\n",
+               pi[i].hue, pi[i].sat, pi[i].i, pi[i].j, pi[i].p);
+     i++;
+   }
+
+   EPS_footer(wastl);
+
+   fclose(wastl);
+   return 1; /* success */
+}
+
+
+PUBLIC int
+PS_dot_plot_turn( char *seq,
+                  plist *pl,
+                  char *wastlfile,
+                  int winSize) {
+
+  /* produce color PostScript dot plot from cpair */
+
+  FILE *wastl;
+  int i;
+
+  wastl = PS_dot_common(seq, cut_point, wastlfile, NULL, winSize, DP_MACRO_NONE);
+  if (wastl==NULL)
+    return 0; /* return 0 for failure */
+
+  if(winSize > 0)
+    fprintf(wastl, "\n%%draw the grid\ndrawgrid_turn\n\n");
+  else
+    fprintf(wastl,  "\n%%draw the grid\ndrawgrid\n\n");
+  fprintf(wastl,"%%start of base pair probability data\n");
+  /* print boxes */
+  i=0;
+  if (pl) {
+    while (pl[i].j>0) {
+      fprintf(wastl,"%d %d %1.4f ubox\n",
+              pl[i].i, pl[i].j, sqrt(pl[i].p));
+      i++;
+    }
+  }
+
+  EPS_footer(wastl);
+
+  fclose(wastl);
+  return 1; /* success */
+}
+
+
+/*
+#####################################
+# BEGIN OF STATIC HELPER FUNCTIONS  #
+#####################################
+*/
+
+PRIVATE void
+EPS_footer(FILE *eps){
+
+   fprintf(eps,"showpage\n"
+               "end\n"
+               "%%%%EOF\n");
+}
+
+
+PRIVATE void
+EPS_print_title(FILE *eps, const char *title){
+
+  unsigned int i;
+
+  fprintf(eps,"/DPtitle {\n  (%s)\n} def\n\n", title);
+}
+
+
+PRIVATE void
+EPS_print_seq(FILE *eps, const char *sequence){
+
+  unsigned int i;
+
+  fprintf(eps,"/sequence { (\\\n");
+  for(i = 0; i < strlen(sequence); i += 255)
+    fprintf(eps, "%.255s\\\n", sequence + i);
+  fprintf(eps,") } def\n\n"
+              "/len { sequence length } bind def\n\n");
+}
+
+
+PRIVATE void
+EPS_print_header( FILE          *eps,
+                  int           bbox[4],
+                  const char    *comment,
+                  unsigned int  options){
+
+  fprintf(eps,
+          "%%!PS-Adobe-3.0 EPSF-3.0\n"
+          "%%%%Title: RNA Dot Plot\n"
+          "%%%%Creator: ViennaRNA-%s\n"
+          "%%%%CreationDate: %s", VERSION, vrna_time_stamp());
+
+  fprintf(eps, "%%%%BoundingBox: %d %d %d %d\n", bbox[0], bbox[1], bbox[2], bbox[3]);
+
+  fprintf(eps,
+          "%%%%DocumentFonts: Helvetica\n"
+          "%%%%Pages: 1\n"
+          "%%%%EndComments\n\n"
+          "%%Options: %s\n", option_string());
+
+  if(comment)
+    fprintf(eps,"%% %s\n",comment);
+
+  fprintf(eps,"%s", RNAdp_prolog);
+
+  /* add auxiliary macros */
+  if(options & DP_MACRO_SD){  /* gquads et al. */
+    fprintf(eps,"%s", RNAdp_sd);
+  }
+
+  if(options & DP_MACRO_UD){  /* unstructured domains */
+    fprintf(eps,"%s", RNAdp_ud);
+  }
+
+  if(options & DP_MACRO_SC_MOTIFS){ /* soft constraint motifs */
+    fprintf(eps,"%s", RNAdp_sc_motifs);
+  }
+
+  if(options & DP_MACRO_LINEAR_DATA){ /* linear data */
+    fprintf(eps,"%s", RNAdp_linear_data);
+  }
+
+  fprintf(eps, "end\n%%EndProlog\n\nDPdict begin\n\n");
+}
+
+
+PRIVATE void
+EPS_print_sd_data(FILE          *eps,
+                  vrna_plist_t  *pl,
+                  vrna_plist_t  *mf){
+
+  int     pl_size, gq_num;
+  double  tmp;
+  plist   *pl1;
+
+  /* sort the plist to bring all gquad triangles to the front */
+  for(gq_num = pl_size = 0, pl1 = pl; pl1->i > 0; pl1++, pl_size++)
+    if(pl1->type == VRNA_PLIST_TYPE_GQUAD) gq_num++;
+
+  qsort(pl, pl_size, sizeof(plist), sort_plist_by_type_desc);
+
+  /* sort all gquad triangles by probability to bring lower probs to the front */
+  qsort(pl, gq_num, sizeof(plist), sort_plist_by_prob_asc);
+
+  /* print triangles for g-quadruplexes in upper half */
+  fprintf(eps,"\n%%start of quadruplex data\n");
+
+  for (pl1=pl; pl1->i > 0; pl1++) {
+    if(pl1->type == VRNA_PLIST_TYPE_GQUAD){
+      tmp = sqrt(pl1->p);
+      fprintf(eps, "%d %d %1.9f utri\n", pl1->i, pl1->j, tmp);
+    }
+  }
+}
+
+
+PRIVATE void
+EPS_print_sc_motif_data(FILE          *eps,
+                        vrna_plist_t  *pl,
+                        vrna_plist_t  *mf){
+
+  int     pl_size;
+  double  tmp;
+  plist   *pl1;
+
+  /* print triangles for hairpin loop motifs in upper half */
+  fprintf(eps,"\n%%start of Hmotif data\n");
+  for (pl1=pl; pl1->i > 0; pl1++) {
+    if(pl1->type == VRNA_PLIST_TYPE_H_MOTIF){
+      tmp = sqrt(pl1->p);
+      fprintf(eps, "%d %d %1.9f uHmotif\n", pl1->i, pl1->j, tmp);
+    }
+  }
+  for (pl1=mf; pl1->i > 0; pl1++) {
+    if(pl1->type == VRNA_PLIST_TYPE_H_MOTIF){
+      tmp = sqrt(pl1->p);
+      fprintf(eps, "%d %d %1.9f lHmotif\n", pl1->i, pl1->j, tmp);
+    }
+  }
+
+  /* print triangles for interior loop motifs in upper half */
+  fprintf(eps,"\n%%start of Imotif data\n");
+  int   a,b;
+  float ppp;
+  a = b = 0;
+  for (pl1=pl; pl1->i > 0; pl1++) {
+    if(pl1->type == VRNA_PLIST_TYPE_I_MOTIF){
+      if(a == 0){
+        a = pl1->i;
+        b = pl1->j;
+        ppp = tmp = sqrt(pl1->p);
+      } else {
+        fprintf(eps, "%d %d %d %d %1.9f uImotif\n", a, b, pl1->i, pl1->j, ppp);
+        a = b = 0;
+      }
+    }
+  }
+  for (a = b= 0, pl1=mf; pl1->i > 0; pl1++) {
+    if(pl1->type == VRNA_PLIST_TYPE_I_MOTIF){
+      if(a == 0){
+        a = pl1->i;
+        b = pl1->j;
+        ppp = sqrt(pl1->p);
+      } else {
+        fprintf(eps, "%d %d %d %d %1.9f lImotif\n", a, b, pl1->i, pl1->j, ppp);
+        a = b = 0;
+      }
+    }
+  }
+}
+
+
+PRIVATE void
+EPS_print_bpp_data( FILE          *eps,
+                    vrna_plist_t  *pl,
+                    vrna_plist_t  *mf){
+
+  int     pl_size;
+  double  tmp;
+  plist   *pl1;
+
+  fprintf(eps,"%%start of base pair probability data\n");
+
+  /* print boxes in upper right half*/
+  for (pl1 = pl; pl1->i>0; pl1++) {
+    tmp = sqrt(pl1->p);
+    if(pl1->type == VRNA_PLIST_TYPE_BASEPAIR)
+        fprintf(eps,"%d %d %1.9f ubox\n", pl1->i, pl1->j, tmp);
+  }
+
+
+  /* print boxes in lower left half (mfe) */
+  for (pl1=mf; pl1->i>0; pl1++) {
+    tmp = sqrt(pl1->p);
+    if(pl1->type == VRNA_PLIST_TYPE_BASEPAIR)
+      fprintf(eps,"%d %d %1.7f lbox\n", pl1->i, pl1->j, tmp);
+  }
+}
+
+
+PRIVATE void
+EPS_print_ud_data(FILE          *eps,
+                  vrna_plist_t  *pl,
+                  vrna_plist_t  *mf){
+
+  int     pl_size;
+  double  tmp;
+  plist   *pl1;
+
+  /* print triangles for unstructured domain motifs in upper half */
+  fprintf(eps,"\n%%start of unstructured domain motif data\n");
+  for(pl1 = pl; pl1->i > 0; pl1++){
+    if(pl1->type == VRNA_PLIST_TYPE_UD_MOTIF){
+      tmp = sqrt(pl1->p);
+      fprintf(eps, "%d %d %1.9f uUDmotif\n", pl1->i, pl1->j, tmp);
+    }
+  }
+  for(pl1 = mf; pl1->i > 0; pl1++){
+    if(pl1->type == VRNA_PLIST_TYPE_UD_MOTIF){
+      tmp = sqrt(pl1->p);
+      fprintf(eps, "%d %d %1.9f lUDmotif\n", pl1->i, pl1->j, tmp);
+    }
+  }
+}
+
+
+PRIVATE void
+EPS_print_linear_data_top(FILE            *eps,
+                          const char      **data_title,
+                          vrna_data_lin_t **data){
+
+  EPS_print_linear_data(eps, "topData", data_title, data);
+}
+
+
+PRIVATE void
+EPS_print_linear_data_left( FILE            *eps,
+                            const char      **data_title,
+                            vrna_data_lin_t **data){
+
+  EPS_print_linear_data(eps, "leftData", data_title, data);
+}
+
+
+PRIVATE void
+EPS_print_linear_data_bottom( FILE            *eps,
+                              const char      **data_title,
+                              vrna_data_lin_t **data){
+
+  EPS_print_linear_data(eps, "bottomData", data_title, data);
+}
+
+
+PRIVATE void
+EPS_print_linear_data_right(FILE            *eps,
+                            const char      **data_title,
+                            vrna_data_lin_t **data){
+
+  EPS_print_linear_data(eps, "rightData", data_title, data);
+}
+
+
+PRIVATE void
+EPS_print_linear_data(FILE            *eps,
+                      const char      *varname,
+                      const char      **data_title,
+                      vrna_data_lin_t **data){
+
+  int             n, i;
+  vrna_data_lin_t *ptr;
+
+  /* count number of data sets */
+  for(n = 0; data_title[n]; n++);
+
+  fprintf(eps, "/%s [\n", varname);
+  for(i = 0; i < n; i++){
+    fprintf(eps, "[ (%s)\n", data_title[i]);
+    for(ptr = data[i]; ptr->position > 0; ptr++){
+      if((ptr->color.hue + ptr->color.sat + ptr->color.bri) == 0.){
+        fprintf(eps, "  [ %d %1.9f ]\n", ptr->position, ptr->value);
+      } else {
+        fprintf(eps, "  [ %d %1.9f %1.4f %1.4f %1.4f]\n", ptr->position, ptr->value, ptr->color.hue, ptr->color.sat, ptr->color.bri);
+      }
+    }
+    fprintf(eps, "]\n");
+  }
+  fprintf(eps, "] def\n\n");
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+
+static int sort_plist_by_type_desc(const void *p1, const void *p2){
+  if(((plist*)p1)->type > ((plist*)p2)->type) return -1;
+  if(((plist*)p1)->type < ((plist*)p2)->type) return 1;
+  return 0;
+}
+
+static int sort_plist_by_prob_asc(const void *p1, const void *p2){
+  if(((plist*)p1)->p > ((plist*)p2)->p) return 1;
+  if(((plist*)p1)->p < ((plist*)p2)->p) return -1;
+  return 0;
+}
+
+
+PRIVATE vrna_data_lin_t *
+plist_to_accessibility(plist *pl, unsigned int length){
+
+  int   n, i;
+  plist *ptr;
+
+  vrna_data_lin_t *data = NULL;
+
+  data = (vrna_data_lin_t *)vrna_alloc(sizeof(vrna_data_lin_t) * (length + 1));
+
+  for(ptr = pl; ptr->i > 0; ptr++){
+    if(ptr->type == VRNA_PLIST_TYPE_BASEPAIR){
+      data[ptr->i - 1].value += ptr->p;
+      data[ptr->j - 1].value += ptr->p;
+    }
+  }
+
+  /* go through the entire list and square-root probabilities again */
+  for(i = 0; i < length; i++){
+    data[i].position = i + 1;
+    data[i].value    = sqrt((double)(1. - data[i].value));
+  }
+
+  data[length].position = 0; /* end marker */
+
+  return data;
+}
+
+PRIVATE vrna_data_lin_t *
+plist_to_ud_motif_prob(plist *pl, unsigned int length){
+
+  int   n, i;
+  plist *ptr;
+
+  vrna_data_lin_t *data = NULL;
+
+  data = (vrna_data_lin_t *)vrna_alloc(sizeof(vrna_data_lin_t) * (length + 1));
+
+  for(ptr = pl; ptr->i > 0; ptr++){
+    if(ptr->type == VRNA_PLIST_TYPE_UD_MOTIF){
+      for(i = ptr->i; i <= ptr->j; i++){
+        data[i - 1].value += ptr->p;
+      }
+    }
+  }
+
+  /*  go through the entire list, remove entries with 0 probability,
+      and square-root probabilities again
+  */
+  unsigned int actual_length  = length;
+  unsigned int actual_pos     = 1;
+  for(i = 0; i < actual_length; i++, actual_pos++){
+    if(data[i].value == 0.){
+      memmove(data + i, data + i + 1, sizeof(vrna_data_lin_t) * (actual_length - i));
+      actual_length--;
+      i--;
+    } else {
+      data[i].position  = actual_pos;
+      data[i].value     = sqrt(data[i].value);
+      data[i].color.hue = 0.6;
+      data[i].color.sat = 0.8;
+      data[i].color.bri = 0.95;
+    }
+  }
+
+  if(actual_length > 0){
+    data[actual_length].position = 0; /* end marker */
+    data = (vrna_data_lin_t *)vrna_realloc(data, sizeof(vrna_data_lin_t) * (actual_length + 1));
+    return data;
+  } else {
+    free(data);
+    return NULL;
+  }
+}
+
+
+
+PRIVATE FILE *
+PS_dot_common(const char *seq,
+              int cp,
+              const char *wastlfile,
+              char *comment,
+              int winsize,
+              unsigned int options){
+
+  /* write PS header etc for all dot plot variants */
+  FILE *wastl;
+  char *name, *c;
+  int i;
+
+  wastl = fopen(wastlfile,"w");
+  if (wastl==NULL) {
+    vrna_message_warning("can't open %s for dot plot", wastlfile);
+    return NULL; /* return 0 for failure */
+  }
+  name = strdup(wastlfile);
+  if((c=strrchr(name, '_')))
+    *c='\0';
+
+  int bbox[4];
+  if(winsize > 0){
+    bbox[0] = 66;
+    bbox[1] = 530;
+    bbox[2] = 520;
+    bbox[3] = 650;
+  } else {
+    bbox[0] = 66;
+    bbox[1] = 211;
+    bbox[2] = 518;
+    bbox[3] = 662;
+  }
+
+  EPS_print_header(wastl, bbox, comment, options);
+
+  EPS_print_title(wastl, name);
+
+  EPS_print_seq(wastl, seq);
+
+  if (winsize>0)
+    fprintf(wastl,"/winSize %d def\n",winsize);
+
+  if (cp>0) fprintf(wastl,"/cutpoint %d def\n\n", cp);
+
+
+  if (winsize>0)
+  fprintf(wastl,"292 416 translate\n"
+          "72 6 mul len 1 add winSize add 2 sqrt mul div dup scale\n");
+  else
+    fprintf(wastl,"72 216 translate\n"
+          "72 6 mul len 1 add div dup scale\n");
+  fprintf(wastl, "/Helvetica findfont 0.95 scalefont setfont\n\n");
+
+  if (winsize>0) {
+    fprintf(wastl, "%s", RNAdp_prolog_turn);
+    fprintf(wastl,"0.5 dup translate\n"
+          "drawseq_turn\n"
+          "45 rotate\n\n");
+  }
+  else
+    fprintf(wastl,"drawseq\n");
+
+  free(name);
+  return(wastl);
+}
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+int PS_dot_plot(char *string, char *wastlfile) {
+  /* this is just a wrapper to call PS_dot_plot_list */
+  int i, j, k, length, maxl, mf_num;
+  plist *pl;
+  plist *mf;
+
+  length = strlen(string);
+  maxl = 2*length;
+  pl = (plist *)vrna_alloc(maxl*sizeof(plist));
+  k=0;
+  /*make plist out of pr array*/
+  for (i=1; i<length; i++)
+    for (j=i+1; j<=length; j++) {
+      if (pr[iindx[i]-j]<PMIN) continue;
+      if (k>=maxl-1) {
+        maxl *= 2;
+        pl = (plist *)vrna_realloc(pl,maxl*sizeof(plist));
+      }
+      pl[k].i = i;
+      pl[k].j = j;
+      pl[k++].p = pr[iindx[i]-j];
+    }
+  pl[k].i=0;
+  pl[k].j=0;
+  pl[k++].p=0.;
+  /*make plist out of base_pair array*/
+  mf_num = base_pair ? base_pair[0].i : 0;
+  mf = (plist *)vrna_alloc((mf_num+1)*sizeof(plist));
+  for (k=0; k<mf_num; k++) {
+    mf[k].i = base_pair[k+1].i;
+    mf[k].j = base_pair[k+1].j;
+    mf[k].p = 0.95*0.95;
+  }
+  mf[k].i=0;
+  mf[k].j=0;
+  mf[k].p=0.;
+  i = PS_dot_plot_list(string, wastlfile, pl, mf, "");
+  free(mf);
+  free(pl);
+  return (i);
+}
+
+#endif
+
diff --git a/C/ViennaRNA/PS_dot.h b/C/ViennaRNA/PS_dot.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/PS_dot.h
@@ -0,0 +1,148 @@
+#ifndef VIENNA_RNA_PACKAGE_PS_DOT_H
+#define VIENNA_RNA_PACKAGE_PS_DOT_H
+
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/plot_structure.h>
+#include <ViennaRNA/plot_aln.h>
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file PS_dot.h
+ *  @ingroup   plotting_utils
+ *  @brief Various functions for plotting RNA secondary structures, dot-plots and other
+ *  visualizations
+ */
+
+/**
+ *  @{
+ *  @ingroup   plotting_utils
+ */
+
+#define VRNA_PLOT_PROBABILITIES_BP        1U
+#define VRNA_PLOT_PROBABILITIES_ACC       2U
+
+#define VRNA_PLOT_PROBABILITIES_UD        4U
+#define VRNA_PLOT_PROBABILITIES_UD_LIN    8U
+
+#define VRNA_PLOT_PROBABILITIES_SD        16U
+
+#define VRNA_PLOT_PROBABILITIES_SC_MOTIF  32U
+#define VRNA_PLOT_PROBABILITIES_SC_UP     64U
+#define VRNA_PLOT_PROBABILITIES_SC_BP     128U
+
+#define VRNA_PLOT_PROBABILITIES_DEFAULT   (   VRNA_PLOT_PROBABILITIES_BP \
+                                            | VRNA_PLOT_PROBABILITIES_SD \
+                                            | VRNA_PLOT_PROBABILITIES_SC_MOTIF \
+                                            | VRNA_PLOT_PROBABILITIES_UD_LIN )
+typedef struct {
+  char            *comment;
+  char            *title;
+
+  vrna_data_lin_t **top;
+  char            **top_title;
+
+  vrna_data_lin_t **bottom;
+  char            **bottom_title;
+
+  vrna_data_lin_t **left;
+  char            **left_title;
+
+  vrna_data_lin_t **right;
+  char            **right_title;
+} vrna_dotplot_auxdata_t;
+
+
+int
+vrna_plot_dp_EPS( const char              *filename,
+                  const char              *sequence,
+                  vrna_plist_t            *upper,
+                  vrna_plist_t            *lower,
+                  vrna_dotplot_auxdata_t  *auxdata,
+                  unsigned int            options);
+
+int PS_color_dot_plot(char *string,
+                      cpair *pi,
+                      char *filename);
+
+int PS_color_dot_plot_turn( char *seq,
+                            cpair *pi,
+                            char *filename,
+                            int winSize);
+
+/**
+ *  @brief Produce a postscript dot-plot from two pair lists
+ *
+ *  This function reads two plist structures (e.g. base pair probabilities and a secondary structure)
+ *  as produced by assign_plist_from_pr() and assign_plist_from_db() and produces a postscript
+ *  "dot plot" that is written to 'filename'.\n
+ *  Using base pair probabilities in the first and mfe structure in the second plist, the resulting
+ *  "dot plot" represents each base pairing probability by a square of corresponding area in a upper
+ *  triangle matrix. The lower part of the matrix contains the minimum free energy structure.
+ *
+ *  @see assign_plist_from_pr(), assign_plist_from_db()
+ *
+ *  @param seq      The RNA sequence
+ *  @param filename A filename for the postscript output
+ *  @param pl       The base pair probability pairlist
+ *  @param mf       The mfe secondary structure pairlist
+ *  @param comment  A comment
+ *  @return         1 if postscript was successfully written, 0 otherwise
+ */
+int PS_dot_plot_list( char *seq,
+                      char *filename,
+                      plist *pl,
+                      plist *mf,
+                      char *comment);
+
+int vrna_plot_dp_PS_list( char *seq,
+                          int cp,
+                          char *wastlfile,
+                          plist *pl,
+                          plist *mf,
+                          char *comment);
+
+int PS_dot_plot_turn( char *seq,
+                      plist *pl,
+                      char *filename,
+                      int winSize);
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/**
+ *  Wrapper to PS_dot_plot_list
+ *
+ *  @brief Produce postscript dot-plot
+ *
+ *  Reads base pair probabilities produced by pf_fold() from the
+ *  global array #pr and the pair list #base_pair produced by
+ *  fold() and produces a postscript "dot plot" that is written to
+ *  'filename'. The "dot plot" represents each base pairing
+ *  probability by a square of corresponding area in a upper triangle
+ *  matrix. The lower part of the matrix contains the minimum free energy
+ *  @note DO NOT USE THIS FUNCTION ANYMORE SINCE IT IS NOT THREADSAFE
+ *
+ *  @deprecated This function is deprecated and will be removed soon! Use @ref PS_dot_plot_list() instead!
+ */
+DEPRECATED(int PS_dot_plot( char *string,
+                            char *file));
+
+#endif
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/ProfileAln.c b/C/ViennaRNA/ProfileAln.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/ProfileAln.c
@@ -0,0 +1,273 @@
+/*
+   Fast, but crude, pairwise structural Alignments of RNA sequences
+
+   Possible structures of each RNA are encoded in a linear
+   "probability profile", by computing for each base the probability
+   of being unpaired, or paired upstream or downstream. These profiles
+   can be aligned using standard string alignment.
+
+   The is an extension of the old method in ProfileDist.c with the
+   following changes:
+   - use sequence as well as structure profile for scoring
+   - use similarity alignment instead of distance (maybe add local alinment)
+   - use affine gap costs
+
+	  C Ivo L Hofacker, Vienna RNA Package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include <float.h>
+#include "ViennaRNA/dist_vars.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/part_func.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/profiledist.h"
+#include "ViennaRNA/ProfileAln.h"
+
+
+#define EQUAL(x,y)     (fabs((x)-(y)) <= fabs(x)*2*FLT_EPSILON)
+
+PRIVATE int *alignment[2];
+
+PRIVATE void    sprint_aligned_bppm(const float *T1, const char *seq1,
+				    const float *T2, const char *seq2);
+PRIVATE double  PrfEditScore(const float *p1, const float *p2,
+			     char c1, char c2);
+PRIVATE double  average(double x, double y);
+
+PRIVATE double  open=-1.5, ext=-0.666;  /* defaults from clustalw */
+PRIVATE double  seqw=0.5;
+PRIVATE int     free_ends=1;            /* whether to use free end gaps */
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE float **newmat(int l1, int l2) {
+  float **a;
+  int i;
+  a = (float **) vrna_alloc((l1+1)*sizeof(float *));
+  for (i=0; i<=l1; i++) a[i] = (float *) vrna_alloc((l2+1)*sizeof(float));
+  return a;
+}
+
+PUBLIC float profile_aln(const float *T1, const char *seq1,
+			 const float *T2, const char *seq2)
+{
+  /* align the 2 probability profiles T1, T2 */
+  /* This is like a Needleman-Wunsch alignment, with affine gap-costs
+     ala Gotoh. The score looks at both seq and pair profile */
+
+  float  **S, **E, **F, tot_score;
+  int    i, j, length1, length2;
+
+  length1 = strlen(seq1);
+  length2 = strlen(seq2);
+  S = newmat(length1, length2);
+  E = newmat(length1, length2);
+  F = newmat(length1, length2);
+
+  E[0][0] = F[0][0] = open - ext;
+  S[0][0] = 0;
+  for (i=1; i<=length1; i++) F[i][0] = -9999; /* impossible */
+  for (j=1; j<=length2; j++) E[0][j] = -9999; /* impossible */
+  if (!free_ends) {
+    for (i=1; i<=length1; i++) S[i][0] = E[i][0] = E[i-1][0] +ext;
+    for (j=1; j<=length2; j++) S[0][j] = F[0][j] = F[0][j-1] +ext;
+  }
+
+  for (i=1; i<=length1; i++) {
+    for (j=1; j<=length2; j++) {
+      float M;
+      E[i][j] = MAX2(E[i-1][j]+ext, S[i-1][j]+open);
+      F[i][j] = MAX2(F[i][j-1]+ext, S[i][j-1]+open);
+      M = S[i-1][j-1] + PrfEditScore(T1+3*i,T2+3*j, seq1[i-1], seq2[j-1]);
+      S[i][j] = MAX3(M, E[i][j], F[i][j]);
+    }
+  }
+
+  if (edit_backtrack) {
+    double score=0;
+    char state = 'S';
+    int pos, i,j;
+    alignment[0] = (int *) vrna_alloc((length1+length2+1)*sizeof(int));
+    alignment[1] = (int *) vrna_alloc((length1+length2+1)*sizeof(int));
+
+    pos = length1+length2;
+    i   = length1;
+    j   = length2;
+
+    tot_score = S[length1][length2];
+
+    if (free_ends) {
+      /* find starting point for backtracking,
+	 search for highest entry in last row or column */
+      int imax=0;
+      for (i=1; i<=length1; i++) {
+	if (S[i][length2]>score) {
+	  score=S[i][length2];
+	  imax=i;
+	}
+      }
+      for (j=1; j<=length2; j++) {
+	if (S[length1][j]>score) {
+	  score=S[length1][j];
+	  imax=-j;
+	}
+      }
+      if (imax<0) {
+	for (j=length2; j> -imax; j--) {
+	  alignment[0][pos] = 0;
+	  alignment[1][pos--] = j;
+	}
+	i=length1;
+      } else {
+	for (i=length1; i>imax; i--) {
+	  alignment[0][pos] = i;
+	  alignment[1][pos--] = 0;
+	}
+	j=length2;
+      }
+      tot_score=score;
+    }
+
+    while (i>0 && j>0) {
+      switch (state) {
+      case 'E':
+	score = E[i][j];
+	alignment[0][pos] = i;
+	alignment[1][pos--] = 0;
+	if (EQUAL(score, S[i-1][j] + open)) state = 'S';
+	i--;
+	break;
+      case 'F':
+	score = F[i][j];
+	alignment[0][pos] = 0;
+	alignment[1][pos--] = j;
+	if (EQUAL(score, S[i][j-1] + open)) state = 'S';
+	j--;
+	break;
+      case 'S':
+	score = S[i][j];
+	if (EQUAL(score, E[i][j])) state = 'E';
+	else if (EQUAL(score, F[i][j])) state = 'F';
+	else if (EQUAL(score, S[i-1][j-1] +
+		       PrfEditScore(T1+3*i,T2+3*j, seq1[i-1], seq2[j-1]))) {
+	  alignment[0][pos] = i;
+	  alignment[1][pos--] = j;
+	  i--; j--;
+	}
+	else vrna_message_error("backtrack of alignment failed");
+	break;
+      }
+    }
+
+    for (; j>0; j--) {
+      alignment[0][pos] = 0;
+      alignment[1][pos--] = j;
+    }
+    for (; i>0; i--) {
+      alignment[0][pos] = i;
+      alignment[1][pos--] = 0;
+    }
+
+    for(i=pos+1; i<=length1+length2; i++){
+      alignment[0][i-pos] = alignment[0][i];
+      alignment[1][i-pos] = alignment[1][i];
+    }
+    alignment[0][0] = length1+length2-pos;   /* length of alignment */
+
+    sprint_aligned_bppm(T1,seq1, T2,seq2);
+    free(alignment[0]);
+    free(alignment[1]);
+  }
+  for (i=0; i<=length1; i++) {
+    free(S[i]); free(E[i]); free(F[i]);
+  }
+  free(S); free(E); free(F);
+
+  return tot_score;
+}
+
+
+/*---------------------------------------------------------------------------*/
+PRIVATE inline double average(double x, double y) {
+  /*
+     As in Bonhoeffer et al (1993) 'RNA Multi Structure Landscapes',
+     Eur. Biophys. J. 22: 13-24 we have chosen  the geometric mean.
+  */
+  return (float) sqrt(x*y);
+}
+
+PRIVATE double PrfEditScore(const float *p1, const float *p2, char c1, char c2)
+{
+  double  score;
+  int    k;
+
+  for(score=0.,k=0; k<3; k++)
+    score += average(p1[k],p2[k]);
+
+  score *= (1- seqw);
+  if (c1==c2) score +=  seqw;
+  else if (((c1=='A') && (c2=='G')) ||
+	   ((c1=='G') && (c2=='A')) ||
+	   ((c1=='C') && (c2=='U')) ||
+	   ((c1=='U') && (c2=='C')))
+    score += 0.5*seqw;
+  else score -= 0.9*seqw;
+  return score;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void sprint_aligned_bppm(const float *T1, const char *seq1,
+				 const float *T2, const char *seq2) {
+   int     i, length;
+   length = alignment[0][0];
+   for (i=0; i<4; i++) {
+     if (aligned_line[i] != NULL) free(aligned_line[i]);
+     aligned_line[i] = (char *) vrna_alloc((length+1)*sizeof(char));
+   }
+   for(i=1; i<=length; i++){
+      if (alignment[0][i]==0)
+	aligned_line[0][i-1] = aligned_line[2][i-1] = '_';
+      else {
+	aligned_line[0][i-1] = vrna_bpp_symbol(T1+alignment[0][i]*3);
+	aligned_line[2][i-1] = seq1[alignment[0][i]-1];
+      }
+      if (alignment[1][i]==0)
+	aligned_line[1][i-1] = aligned_line[3][i-1] = '_';
+      else {
+	aligned_line[1][i-1] = vrna_bpp_symbol(T2+alignment[1][i]*3);
+	aligned_line[3][i-1] = seq2[alignment[1][i]-1];
+      }
+   }
+}
+
+PUBLIC int set_paln_params(double gap_open, double gap_ext,
+			   double seq_weight, int freeends) {
+  open = (gap_open>0) ? -gap_open : gap_open;
+  ext = (gap_ext>0) ? -gap_ext : gap_ext;
+  if (open > ext)
+    vrna_message_warning( "Gap extension penalty is smaller than "
+                          "gap open. Do you realy want this?");
+  seqw = seq_weight;
+  if (seqw<0) {
+    seqw = 0;
+    vrna_message_warning("Sequence weight set to 0 (must be in [0..1])");
+  } else
+  if (seqw>1) {
+    seqw = 1;
+    vrna_message_warning("Sequence weight set to 1 (must be in [0..1])");
+  }
+  free_ends = (freeends) ? 1 : 0;
+  return 0;
+}
+
+/*---------------------------------------------------------------------------*/
diff --git a/C/ViennaRNA/ProfileAln.h b/C/ViennaRNA/ProfileAln.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/ProfileAln.h
@@ -0,0 +1,14 @@
+#ifndef VIENNA_RNA_PACKAGE_PROFILEALN_H
+#define VIENNA_RNA_PACKAGE_PROFILEALN_H
+
+float profile_aln(const float *T1,
+                  const char *seq1,
+                  const float *T2,
+                  const char *seq2);
+
+int set_paln_params(double gap_open,
+                    double gap_ext,
+                    double seqweight,
+                    int free_ends);
+
+#endif
diff --git a/C/ViennaRNA/ProfileDist.c b/C/ViennaRNA/ProfileDist.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/ProfileDist.c
@@ -0,0 +1,247 @@
+/*
+	  Functions for handling the Base Pair Probability Matrix
+		      Peter F Stadler, Ivo L Hofacker
+			    Vienna RNA Package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include "ViennaRNA/dist_vars.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/part_func.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/profiledist.h"
+
+PRIVATE int *alignment[2];
+
+PRIVATE void    sprint_aligned_bppm(const float *T1, const float *T2);
+PRIVATE double  PrfEditCost(int i, int j, const float *T1, const float *T2);
+PRIVATE double  average(double x, double y);
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC float profile_edit_distance(const float *T1, const float *T2)
+{
+  /* align the 2 probability profiles T1, T2 */
+  /* This is like a Needleman-Wunsch alignment,
+     we should really use affine gap-costs ala Gotoh */
+
+  float    **distance;
+  short    **i_point, **j_point;
+
+  int           i, j, i1, j1, pos, length1,length2;
+  float         minus, plus, change, temp;
+
+  length1 = (int) T1[0];
+  length2 = (int) T2[0];
+  distance = (float **)     vrna_alloc((length1 +1)*sizeof(float *));
+  if(edit_backtrack){
+    i_point  = (short **)  vrna_alloc((length1 +1)*sizeof(short *));
+    j_point  = (short **)  vrna_alloc((length1 +1)*sizeof(short *));
+  }
+  for(i=0; i<= length1; i++){
+    distance[i] = (float *) vrna_alloc( (length2+1)*sizeof(float));
+    if(edit_backtrack){
+      i_point[i]  = (short *) vrna_alloc( (length2+1)*sizeof(short));
+      j_point[i]  = (short *) vrna_alloc( (length2+1)*sizeof(short));
+    }
+  }
+
+  for(i = 1; i <= length1; i++) {
+    distance[i][0] = distance[i-1][0]+PrfEditCost(i,0,T1,T2);
+    if(edit_backtrack){ i_point[i][0] = (short) i-1; j_point[i][0] = 0;   }
+  }
+  for(j = 1; j <= length2; j++) {
+    distance[0][j] = distance[0][j-1]+PrfEditCost(0,j,T1,T2);
+    if(edit_backtrack){ i_point[0][j] = 0;   j_point[0][j] = (short) j-1; }
+  }
+  for (i = 1; i <= length1; i++) {
+    for (j = 1; j <= length2 ; j++) {
+      minus  = distance[i-1][j]  + PrfEditCost(i,0,T1,T2);
+      plus   = distance[i][j-1]  + PrfEditCost(0,j,T1,T2);
+      change = distance[i-1][j-1]+ PrfEditCost(i,j,T1,T2);
+
+      distance[i][j] = MIN3(minus, plus, change);
+      /* printf("%g ", distance[i][j]); */
+
+      if(edit_backtrack){
+	if(distance[i][j] == change) {
+	  i_point[i][j]= (short)i-1; j_point[i][j]= (short) j-1;  }
+	else if(distance[i][j] == plus) {
+	  i_point[i][j]= (short)i  ; j_point[i][j]= (short)j-1;  }
+	else {
+	  i_point[i][j]= (short)i-1; j_point[i][j]= (short)j  ;  }
+      }
+    }
+    /* printf("\n"); */
+  }
+  /* printf("\n"); */
+  temp = distance[length1][length2];
+  for(i=0;i<=length1;i++)
+    free(distance[i]);
+  free(distance);
+
+  if(edit_backtrack){
+    alignment[0] = (int *) vrna_alloc((length1+length2+1)*sizeof(int));
+    alignment[1] = (int *) vrna_alloc((length1+length2+1)*sizeof(int));
+
+    pos = length1+length2;
+    i   = length1;
+    j   = length2;
+    while( (i>0)||(j>0) ) {
+      i1 = i_point[i][j];
+      j1 = j_point[i][j];
+      if( ((i-i1)==1)&&((j-j1)==1) )  {  /* substitution    */
+	alignment[0][pos] = i;
+	alignment[1][pos] = j;
+      }
+      if( ((i-i1)==1)&&(j==j1) )      {  /* Deletion in [1] */
+	alignment[0][pos] = i;
+	alignment[1][pos] = 0;
+      }
+      if( (i==i1)&&((j-j1)==1)  )      {  /* Deletion in [0] */
+	alignment[0][pos] = 0;
+	alignment[1][pos] = j;
+      }
+      pos--;
+      i = i1;
+      j = j1;
+    }
+    for(i=pos+1; i<=length1+length2; i++){
+      alignment[0][i-pos] = alignment[0][i];
+      alignment[1][i-pos] = alignment[1][i];
+    }
+    alignment[0][0] = length1+length2-pos;   /* length of alignment */
+
+    for(i=0; i<=length1; i++){
+      free(i_point[i]); free(j_point[i]);
+    }
+    free(i_point); free(j_point);
+    sprint_aligned_bppm(T1,T2);
+    free(alignment[0]);
+    free(alignment[1]);
+  }
+
+  return temp;
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE double PrfEditCost(int i, int j, const float *T1, const float *T2)
+{
+  double  dist;
+  int    k, kmax;
+
+  kmax = (int) T1[1];
+  if ((int) T2[1] != kmax) vrna_message_error("inconsistent Profiles in PrfEditCost");
+
+  if(i==0) {
+    for(dist = 0. ,k=0 ; k<kmax ; k++)
+      dist += T2[j*kmax+k];
+  }
+  if(j==0) {
+    for(dist = 0. ,k=0 ; k<kmax ; k++)
+      dist += T1[i*kmax+k];
+  }
+  if((i>0)&&(j>0)) {
+    for(dist = 2.,k=0; k<kmax; k++)
+      dist -= 2.*average(T1[i*kmax+k],T2[j*kmax+k]);
+  }
+  return dist;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE double average(double x, double y)
+
+/* can be essentially anything that fulfils :
+   1.)     a(x,y)  =  a(y,x)
+   2.)     a(x,y) >=  0       for 0<= x,y <= 1
+   3.)     a(x,y) <=  (x+y)/2
+   4.)     a(x,x) >=  a(x,y)  for 0<= x,y <= 1
+   As in Bonhoeffer et al (1993) 'RNA Multi Structure Landscapes',
+   Eur. Biophys. J. 22: 13-24 we have chosen  the geometric mean.
+*/
+
+{
+    float a;
+    a = (float) sqrt(x*y);
+    return a;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC float *Make_bp_profile_bppm(FLT_OR_DBL *bppm, int length){
+   int i,j;
+   int L=3;
+   float *P; /* P[i*3+0] unpaired, P[i*3+1] upstream, P[i*3+2] downstream p */
+   int *index = vrna_idx_row_wise((unsigned) length);
+
+   P =  (float *) vrna_alloc((length+1)*3*sizeof(float));
+   /* indices start at 1 use first entries to store length and dimension */
+   P[0] = (float) length;
+   P[1] = (float) L;
+
+   for( i=1; i<length; i++)
+     for( j=i+1; j<=length; j++ ) {
+       P[i*L+1] += bppm[index[i]-j];
+       P[j*L+2] += bppm[index[i]-j];
+     }
+   for( i=1; i<=length; i++)
+     P[i*3+0] = 1 - P[i*3+1] - P[i*3+2];
+
+   free(index);
+
+   return (float *) P;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void sprint_aligned_bppm(const float *T1, const float *T2)
+{
+   int     i, length;
+   length = alignment[0][0];
+   aligned_line[0] = (char *) vrna_alloc((length+1)*sizeof(char));
+   aligned_line[1] = (char *) vrna_alloc((length+1)*sizeof(char));
+   for(i=1; i<=length; i++){
+      if(alignment[0][i] ==0) aligned_line[0][i-1] = '_';
+      else { aligned_line[0][i-1] = vrna_bpp_symbol(T1+alignment[0][i]*3); }
+      if(alignment[1][i] ==0) aligned_line[1][i-1] = '_';
+      else { aligned_line[1][i-1] = vrna_bpp_symbol(T2+alignment[1][i]*3); }
+   }
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC void print_bppm(const float *T)
+{
+   int i;
+   for(i=1; i<=( (int)T[0]); i++)
+      printf("%c",vrna_bpp_symbol(T+i*3));
+   printf("\n");
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC void     free_profile(float *T)
+{
+   free(T);
+}
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC float *Make_bp_profile(int length){
+   return Make_bp_profile_bppm(pr, length);
+}
+
+
diff --git a/C/ViennaRNA/RNAstruct.c b/C/ViennaRNA/RNAstruct.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/RNAstruct.c
@@ -0,0 +1,579 @@
+/*
+		parse and convert secondary structures
+	   Walter Fontana, Ivo L Hofacker, Peter F Stadler
+			Vienna RNA Package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/RNAstruct.h"
+
+#define PRIVATE  static
+#define PUBLIC
+
+#define MAXLEN    10000
+
+
+PRIVATE char *aux_struct(const char *structure);
+
+/* on return from parse_structure(), b2C() or b2Shapiro() ... */
+PUBLIC int    loop_size[STRUC];       /* contains loop sizes of a structure */
+PUBLIC int    helix_size[STRUC];      /* contains helix sizes of a structure */
+PUBLIC int    loop_degree[STRUC];     /* contains loop degrees of a structure */
+PUBLIC int    loops;                  /* n of loops and stacks in a structure */
+PUBLIC int    unpaired, pairs;        /* n of unpaired digits and pairs */
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE char *aux_struct(const char* structure )
+{
+   short        *match_paren;
+   int          i, o, p;
+   char        *string;
+
+   string = (char *) vrna_alloc(sizeof(char)*(strlen(structure)+1));
+   match_paren = (short *) vrna_alloc(sizeof(short)*(strlen(structure)/2+1));
+   strcpy(string, structure);
+
+   i = o = 0;
+   while (string[i]) {
+      switch (string[i]) {
+       case '.': break;
+       case '(':
+	 match_paren[++o]=i;
+	 break;
+       case ')':
+	 p=i;
+	 while ((string[p+1]==')')&&(match_paren[o-1]==match_paren[o]-1)) {
+	    p++; o--;
+	 }
+	 string[p]=']';
+	 i=p;
+	 string[match_paren[o]]='[';
+	 o--;
+	 break;
+       default:
+	 vrna_message_error("Junk in structure at aux_structure\n");
+      }
+      i++;
+   }
+   free(match_paren);
+   return(string);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC char *b2HIT(const char *structure)
+{
+
+   int            i, u, p, l;
+   char          *string, *temp, *HIT, tt[10];
+
+   temp = (char *) vrna_alloc(strlen(structure)*4+4);
+   string = aux_struct( structure );
+
+   strcpy(temp,"(");
+   i=p=u=0; l=1;
+   while (string[i]) {
+      switch(string[i]) {
+       case '.':
+	 u++; break;
+       case '[':
+	 if (u>0) {
+	    sprintf(tt, "(U%d)" , u);
+	    strcat(temp+l, tt);
+	    l+=strlen(tt);
+	    u=0;
+	 }
+	 strcat(temp+l, "("); l++;
+	 break;
+       case ')':
+	 if (u>0) {
+	    sprintf(tt, "(U%d)" , u);
+	    strcat(temp+l, tt);
+	    l+=strlen(tt);
+	    u=0;
+	 }
+	 p++;
+	 break;
+       case ']':
+	 if (u>0) {
+	    sprintf(tt, "(U%d)" , u);
+	    strcat(temp+l, tt);
+	    l+=strlen(tt);
+	    u=0;
+	 }
+	 sprintf(tt,"P%d)", p+1);
+	 strcat(temp+l, tt);
+	 l+=strlen(tt);
+	 p=0;
+	 break;
+      }
+      i++;
+   }
+   if (u>0) {
+      sprintf(tt, "(U%d)" , u);
+      strcat(temp+l, tt);
+      l+=strlen(tt);
+   }
+   strcat(temp+l, "R)");
+
+   free( string );
+
+   HIT = (char *) vrna_alloc(sizeof(char)*(strlen(temp)+2));
+   strcpy(HIT, temp);
+   free(temp);
+   return(HIT);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC char *b2C(const char *structure )
+{
+   short *bulge, *loop;
+
+   int    i, lp, p, l;
+   char  *string, *Coarse, *temp;
+
+   bulge = (short *) vrna_alloc(sizeof(short)*(strlen(structure)/3+1));
+   loop = (short *) vrna_alloc(sizeof(short)*(strlen(structure)/3+1));
+   temp = (char *) vrna_alloc(4*strlen(structure)+2);
+
+   for (i = 0; i < STRUC; i++) {
+      loop_size[i] = helix_size[i] = 0;
+   }
+   loop_degree[0]=0;         /* open structure has degree 0 */
+   pairs = unpaired = loops = lp = 0;
+   loop[0]=0;
+
+   string = aux_struct( structure );
+
+   i=p=l=0;
+   temp[l++] = '(';
+   while (string[i]) {
+      switch(string[i]) {
+       case '.':
+	 loop_size[loop[lp]]++;
+	 break;
+       case '[':
+	 temp[l++]='(';
+	 if ((i>0)&&(string[i-1]=='(')) bulge[lp]=1;
+	 lp++;
+	 loop_degree[++loops]=1;
+	 loop[lp]=loops;
+	 bulge[lp]=0;
+	 break;
+       case ')':
+	 if (string[i-1]==']') bulge[lp]=1;
+	 p++;
+	 break;
+       case ']':
+	 if (string[i-1]==']') bulge[lp]=1;
+	 switch (loop_degree[loop[lp]]) {
+	  case 1:  temp[l++]='H'; break;           /* hairpin */
+	  case 2:
+	    if (bulge[lp]==1)
+	       temp[l++] = 'B';                    /* bulge */
+	    else
+	       temp[l++] = 'I';                    /* internal loop */
+	    break;
+	  default: temp[l++] = 'M';                /* multiloop */
+	 }
+	 temp[l++] = ')';
+	 pairs+=p+1;
+	 p=0;
+	 loop_degree[loop[--lp]]++;
+	 break;
+      }
+      i++;
+   }
+   temp[l++] = 'R';
+   temp[l++] = ')';
+   temp[l]='\0';
+   free(string);
+   Coarse = (char *) vrna_alloc(sizeof(char)*(strlen(temp)+2));
+   strcpy(Coarse, temp);
+   free(temp);
+   free(bulge); free(loop);
+   return(Coarse);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC char *b2Shapiro(const char *structure )
+{
+
+   short *bulge, *loop;
+
+   int            i, lp, p, l, k;
+   char          *string, *Shapiro, *temp, tt[10];
+
+   bulge = (short *) vrna_alloc(sizeof(short)*(strlen(structure)/3+1));
+   loop = (short *) vrna_alloc(sizeof(short)*(strlen(structure)/3+1));
+   temp = (char *) vrna_alloc(4*strlen(structure)+3);
+
+   for (i = 0; i < STRUC; i++) {
+      loop_size[i] = helix_size[i] = 0;
+   }
+   loop_degree[0]=0;         /* open structure has degree 0 */
+   pairs = unpaired = loops = lp = 0;
+   loop[0]=0;
+
+   string = aux_struct( structure );
+
+   i=p=l=0;
+   temp[l++] = '(';    /* root */
+   while (string[i]) {
+      switch(string[i]) {
+       case '.':
+	 unpaired++;
+	 loop_size[loop[lp]]++;
+	 break;
+       case '[':
+	 temp[l++]='(';
+	 temp[l++]='(';
+	 if ((i>0)&&(string[i-1]=='(' || string[i-1]=='['))
+	   bulge[lp]=1;
+	 lp++;
+	 loop_degree[++loops]=1;
+	 loop[lp]=loops;
+	 bulge[lp]=0;
+	 break;
+       case ')':
+	 if (string[i-1]==']') bulge[lp]=1;
+	 p++;
+	 break;
+       case ']':
+	 if (string[i-1]==']') bulge[lp]=1;
+	 switch (loop_degree[loop[lp]]) {
+	  case 1:  temp[l++]='H'; break;           /* hairpin */
+	  case 2:
+	    if (bulge[lp]==1)
+	       temp[l++] = 'B';                    /* bulge */
+	    else
+	       temp[l++] = 'I';                    /* internal loop */
+	    break;
+	  default: temp[l++] = 'M';                /* multiloop */
+	 }
+	 helix_size[loop[lp]]=p+1;
+
+         sprintf(tt, "%d)" , loop_size[loop[lp]]);
+         for(k=0; k<strlen(tt); k++) temp[l++] = tt[k];
+	 sprintf(tt, "S%d)" , helix_size[loop[lp]]);
+         for(k=0; k<strlen(tt); k++) temp[l++] = tt[k];
+
+	 pairs+=p+1;
+	 p=0;
+	 loop_degree[loop[--lp]]++;
+	 break;
+      }
+      i++;
+   }
+
+   *tt = '\0';
+   if (loop_size[0]) sprintf(tt, "E%d)" , loop_size[0]);
+   strcat(tt,"R)");
+   temp[l]='\0';
+   strcat(temp, tt);
+   Shapiro = (char *) vrna_alloc(sizeof(char)*(strlen(temp)+2));
+   if (loop_size[0]) {
+      Shapiro[0]='(';
+      strcpy(Shapiro+1, temp);
+   } else strcpy(Shapiro, temp);
+   free(string);
+   free(temp);
+   free(loop); free(bulge);
+   return Shapiro;
+}
+
+
+
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC void parse_structure(const char *structure)
+
+/*-----------------------------------------------------------------------------
+
+    upon return from parse_structure():
+
+    loops    ....................... number of loops or stacks in structure.
+    loop_size[1 <= i <= loops] ..... size of i-th loop.
+    loop_size[0] ................... number of external digits.
+    loop_degree[1 <= i <= loops] ... degree (branches) of i-th loop.
+    loop_degree[0] ................. number of components.
+    helix_size[1 <= i <= loops] .... size of i-th stack.
+    unpaired ....................... n of unpaired digits.
+    pairs .......................... n of base pairs.
+
+-----------------------------------------------------------------------------*/
+
+{
+   short  *bulge, *loop;
+
+   int            i, lp, p;
+   char          *string, *temp;
+
+   temp = (char *)  vrna_alloc(strlen(structure)*4+2);
+   bulge = (short *) vrna_alloc(sizeof(short)*(strlen(structure)/3+1));
+   loop = (short *) vrna_alloc(sizeof(short)*(strlen(structure)/3+1));
+
+   for (i = 0; i < STRUC; i++) {
+      loop_size[i] = helix_size[i] = 0;
+   }
+   loop[0] = loop_degree[0]=0;         /* open structure has degree 0 */
+   pairs = unpaired = loops = lp = 0;
+   *temp='\0';
+
+   string = aux_struct(structure);
+
+   i=p=0;
+   while (string[i]) {
+      switch(string[i]) {
+       case '.':
+	 unpaired++;
+	 loop_size[loop[lp]]++;
+	 break;
+       case '[':
+	 if ((i>0)&&(string[i-1]=='(')) bulge[lp]=1;
+	 lp++;
+	 loop_degree[++loops]=1;
+	 loop[lp]=loops;
+	 bulge[lp]=0;
+	 break;
+       case ')':
+	 if (string[i-1]==']') bulge[lp]=1;
+	 p++;
+	 break;
+       case ']':
+	 if (string[i-1]==']') bulge[lp]=1;
+	 helix_size[loop[lp]]=p+1;
+	 pairs+=p+1;
+	 p=0;
+	 loop_degree[loop[--lp]]++;
+	 break;
+      }
+      i++;
+   }
+   free(string);
+   free(bulge); free(loop);
+   free(temp);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC char *add_root(const char *structure)
+{
+    char *xS;
+    xS = (char *) vrna_alloc(sizeof(char)*(strlen(structure)+4));
+    xS[0] = '(';
+    strcat(xS,structure);
+    strcat(xS,"R)");
+    return xS;
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC char *expand_Shapiro(const char *structure)
+{
+   char  *xS, *temp;
+   int  i, l;
+
+   temp = (char *) vrna_alloc(4*strlen(structure)+2);
+
+   i = 1;
+   l = 1;
+   temp[0] = '(';
+   while (i<strlen(structure)-1) {
+      temp[l++] = structure[i];
+      if      (structure[i] == '(') temp[l++] = '(';
+      else if (structure[i] == ')') {
+	 temp[l++] = 'S';
+	 temp[l++] = ')';
+      }
+      i++;
+   }
+   temp[l++] = ')';
+   temp[l] = '\0';
+
+   xS = (char *) vrna_alloc(sizeof(char)*(strlen(temp)+1));
+   strcpy(xS, temp);
+   free(temp);
+   return (xS);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC char *expand_Full(const char *structure)
+{
+    char *xF, *temp;
+    int  i, l;
+
+    temp = (char *) vrna_alloc(4*strlen(structure)+2);
+
+    i = 0;
+    l = 0;
+    while (structure[i]) {
+        if      (structure[i] == '(') temp[l++] = '(';
+        else if (structure[i] == ')') {
+            temp[l++] = 'P';
+	    temp[l++] = ')';
+        }
+        else {
+            temp[l++] = '(';
+            temp[l++] = 'U';
+            temp[l++] = ')';
+        }
+        i++;
+     }
+     temp[l] = '\0';
+
+     xF = (char *) vrna_alloc(sizeof(char)*(l+5));
+     strcpy(xF, "(");
+     strcat(xF, temp);
+     strcat(xF, "R)");
+     free(temp);
+     return (xF);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC char *unexpand_Full(const char *structure)
+{
+   short        *match_paren;
+   char id[10], *full, *temp;
+   int    i, j, k, l, o, w;
+
+   temp = (char *) vrna_alloc(4*strlen(structure)+2);
+   match_paren = (short *) vrna_alloc(sizeof(short)*(strlen(structure)/2+1));
+
+   i = strlen(structure)-1;
+   l = o = 0; k=9;
+   id[9]='\0';
+   while (i>=0) {
+     switch (structure[i]) {
+     case '(':
+       for (j=0; j<match_paren[o]; j++) temp[l++]='(';
+       match_paren[o--] = 0;
+       break;
+     case 'U':
+       w=1;
+       sscanf(id+k, "%d", &w);
+       for (j=0; j<w; j++) temp[l++]='.';
+       k=9;
+       break;
+     case 'P':
+           w=1;
+       sscanf(id+k, "%d", &w);
+       for (j=0; j<w; j++) temp[l++]=')';
+       match_paren[o]=w;
+       k=9;
+       break;
+     case 'R':
+       break;
+     case ')':
+       o++;
+       break;
+     default:
+       id[--k]=structure[i];
+     }
+     i--;
+   }
+
+   temp[l] = '\0';
+   full = (char *) vrna_alloc(sizeof(char)*(l+1));
+   for (i=0; i<l; i++) full[i]=temp[l-i-1];
+   full[l]='\0';
+   free(temp);
+   free(match_paren);
+   return full;
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC char *unweight(const char *structure)
+{
+   int i,l;
+   char *full, *temp;
+
+   temp = (char *) vrna_alloc(4*strlen(structure)+1);
+
+   i=l=0;
+   while (structure[i]) {
+      if (!isdigit((int)structure[i])) temp[l++]=structure[i];
+      i++;
+   }
+   temp[l]='\0';
+   full = (char *) vrna_alloc(sizeof(char)*(l+1));
+   strcpy(full, temp);
+   free(temp);
+   return full;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC void unexpand_aligned_F(char *align[2])
+{
+   char *t0, *t1;
+   int i,l;
+
+   t0 = (char *) vrna_alloc(strlen(align[0])+1);
+   t1 = (char *) vrna_alloc(strlen(align[0])+1);
+
+   for (i=0, l=0; i<strlen(align[0]); i++) {
+      switch (align[0][i]) {
+       case '(':
+       case ')':
+	 t0[l] = align[0][i];
+	 t1[l++]=align[1][i];
+	 break;
+       case 'U':
+	 switch (align[1][i]) {
+	  case 'U':
+	    t0[l-1]=t1[l-1]='.';
+	    break;
+	  case '_':
+	    t0[l-1]='.';
+	    t1[l-1]='_';
+	    break;
+	  case 'P':
+	    t0[l-1]='_'; t0[l]='.';
+	    t1[l-1]='('; t1[l]=')'; l++;
+	 }
+	 while (align[0][i]!=')') i++;
+	 break;
+       case '_':
+	 switch (align[1][i]) {
+	  case '(':
+	  case ')':
+	    t0[l] = align[0][i];
+	    t1[l++]=align[1][i];
+	    break;
+	  case 'U':
+	    while (align[1][i]!=')') i++;
+	    t1[l-1]='.';
+	    t0[l-1]='_';
+	    break;
+	 }
+       case 'P':
+	 if (align[1][i]=='U') {
+	    t1[l-1]='_'; t1[l]='.'; t0[l++]=')';
+	    while (align[0][i]!=')') i++;
+	 }
+	 break;
+      }
+   }
+   t0[l-1]=t1[l-1]='\0';
+   strcpy(align[0], t0+1);
+   strcpy(align[1], t1+1);
+   free(t0); free(t1);
+}
diff --git a/C/ViennaRNA/RNAstruct.h b/C/ViennaRNA/RNAstruct.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/RNAstruct.h
@@ -0,0 +1,160 @@
+#ifndef VIENNA_RNA_PACKAGE_RNASTRUCT_H
+#define VIENNA_RNA_PACKAGE_RNASTRUCT_H
+
+/**
+ *  @addtogroup   struct_utils
+ *
+ *  @{
+ *
+ *  @file RNAstruct.h
+ *  @brief Parsing and Coarse Graining of Structures
+ * 
+ *   Example:
+ *  @verbatim
+ *   .((..(((...)))..((..)))).   is the bracket or full tree
+ *   becomes expanded:   - expand_Full() -
+ *   ((U)(((U)(U)((((U)(U)(U)P)P)P)(U)(U)(((U)(U)P)P)P)P)(U)R)
+ *   HIT:                - b2HIT() -
+ *   ((U1)((U2)((U3)P3)(U2)((U2)P2)P2)(U1)R)
+ *   Coarse:             - b2C() -
+ *   ((H)((H)M)R)
+ *   becomes expanded:   - expand_Shapiro() -
+ *   (((((H)S)((H)S)M)S)R)
+ *   weighted Shapiro:   - b2Shapiro() -
+ *   ((((((H3)S3)((H2)S2)M4)S2)E2)R)
+ *  @endverbatim
+ */
+
+#define STRUC     2000
+
+/**
+ *  @brief Converts the full structure from bracket notation to the HIT
+ *  notation including root.
+ * 
+ *  @param structure
+ *  @return
+ */
+char *b2HIT(const char *structure);             /* Full   -> HIT    [incl. root] */
+
+/**
+ *  @brief Converts the full structure from bracket notation to the a
+ *  coarse grained notation using the 'H' 'B' 'I' 'M' and 'R' identifiers.
+ * 
+ *  @param structure
+ *  @return
+ */
+char *b2C(const char *structure);               /* Full   -> Coarse [incl. root] */
+
+/**
+ *  @brief Converts the full structure from bracket notation to the
+ *  <i>weighted</i> coarse grained notation using the 'H' 'B' 'I' 'M' 'S' 'E' and
+ *  'R' identifiers.
+ * 
+ *  @param structure
+ *  @return
+ */
+char *b2Shapiro(const char *structure);         /* Full -> weighted Shapiro [i.r.] */
+
+/**
+ *  @brief Adds a root to an un-rooted tree in any except bracket notation.
+ * 
+ *  @param  structure
+ *  @return
+ */
+char *add_root(const char *structure);                   /* {Tree} -> ({Tree}R)          */
+
+/**
+ *  @brief Inserts missing 'S' identifiers in unweighted coarse grained structures
+ *  as obtained from b2C().
+ * 
+ *  @param coarse
+ *  @return
+ */
+char  *expand_Shapiro(const char *coarse);
+
+/* add S for stacks to coarse struct */
+/**
+ *  @brief Convert the full structure from bracket notation to the
+ *  expanded notation including root.
+ * 
+ *  @param structure
+ *  @return 
+ */
+char  *expand_Full(const char *structure);      /* Full   -> FFull         */
+
+/**
+ *  @brief Restores the bracket notation from an expanded full or HIT tree, that is
+ *  any tree using only identifiers 'U' 'P' and 'R'.
+ * 
+ *  @param ffull
+ *  @return 
+ */
+char  *unexpand_Full(const char *ffull);        /* FFull  -> Full          */
+
+/**
+ *  @brief Strip weights from any weighted tree.
+ * 
+ *  @param wcoarse
+ *  @return
+ */
+char  *unweight(const char *wcoarse);           /* remove weights from coarse struct */
+
+/**
+ *  @brief Converts two aligned structures in expanded notation.
+ * 
+ *  Takes two aligned structures as produced by
+ *  tree_edit_distance() function back to bracket notation with '_'
+ *  as the gap character. The result overwrites the input.
+ * 
+ *  @param align
+ */
+void   unexpand_aligned_F(char *align[2]);
+
+/**
+ *  @brief Collects a statistic of structure elements of the full structure in
+ *  bracket notation.
+ * 
+ *  The function writes to the following global variables:
+ *  #loop_size, #loop_degree, #helix_size, #loops, #pairs, #unpaired
+ * 
+ *  @param structure
+ *  @return
+ */
+void   parse_structure(const char *structure);  /* make structure statistics */
+
+/**
+ *  @brief contains a list of all loop sizes. loop_size[0] contains the
+ *  number of external bases.
+ */
+extern int    loop_size[STRUC];       /* loop sizes of a structure */
+
+/**
+ *  @brief contains a list of all stack sizes.
+ */
+extern int    helix_size[STRUC];      /* helix sizes of a structure */
+
+/**
+ *  @brief contains the corresponding list of loop degrees.
+ */
+extern int    loop_degree[STRUC];     /* loop degrees of a structure */
+
+/**
+ *  @brief contains the number of loops ( and therefore of stacks ).
+ */
+extern int    loops;                  /* n of loops and stacks */
+
+/**
+ *  @brief contains the number of unpaired bases.
+ */
+extern int    unpaired;
+
+/**
+ *  @brief contains the number of base pairs in the last parsed structure.
+ */
+extern int    pairs;        /* n of unpaired digits and pairs */
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/aliLfold.c b/C/ViennaRNA/aliLfold.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/aliLfold.c
@@ -0,0 +1,963 @@
+/*
+                  minimum free energy consensus
+                  RNA secondary structure prediction
+                  with maximum distance base pairs
+
+                  c Ivo Hofacker, Stephan Bernhart
+
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/ribo.h"
+#include "ViennaRNA/alifold.h"
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/loop_energies.h"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+
+#define PAREN
+
+#define STACK_BULGE1  1   /* stacking energies for bulges of size 1 */
+#define NEW_NINIO     1   /* new asymetry penalty */
+#define MAXSECTORS      500     /* dimension for a backtrack array */
+#define LOCALITY        0.      /* locality parameter for base-pairs */
+#define UNIT 100
+#define MINPSCORE -2 * UNIT
+#define NONE -10000 /* score for forbidden pairs */
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+PRIVATE vrna_param_t    *P = NULL;
+PRIVATE int             **c = NULL;       /* energy array, given that i-j pair */
+PRIVATE int             *cc = NULL;       /* linear array for calculating canonical structures */
+PRIVATE int             *cc1 = NULL;      /*   "     "        */
+PRIVATE int             *f3 = NULL;       /* energy of 5' end */
+PRIVATE int             **fML = NULL;     /* multi-loop auxiliary energy array */
+PRIVATE int             *Fmi = NULL;      /* holds row i of fML (avoids jumps in memory) */
+PRIVATE int             *DMLi = NULL;     /* DMLi[j] holds MIN(fML[i,k]+fML[k+1,j])  */
+PRIVATE int             *DMLi1 = NULL;    /*             MIN(fML[i+1,k]+fML[k+1,j])  */
+PRIVATE int             *DMLi2 = NULL;    /*             MIN(fML[i+2,k]+fML[k+1,j])  */
+PRIVATE int             **pscore = NULL;  /* precomputed array of pair types */
+PRIVATE unsigned int    length;
+PRIVATE short           **S = NULL;
+PRIVATE short           **S5 = NULL;      /*S5[s][i] holds next base 5' of i in sequence s*/
+PRIVATE short           **S3 = NULL;      /*Sl[s][i] holds next base 3' of i in sequence s*/
+PRIVATE char            **Ss = NULL;
+PRIVATE unsigned short  **a2s = NULL;
+PRIVATE float           **dm = NULL;
+PRIVATE int             olddm[7][7]= {{0,0,0,0,0,0,0}, /* hamming distance between pairs PRIVATE needed??*/
+                                      {0,0,2,2,1,2,2} /* CG */,
+                                      {0,2,0,1,2,2,2} /* GC */,
+                                      {0,2,1,0,2,1,2} /* GU */,
+                                      {0,1,2,2,0,2,1} /* UG */,
+                                      {0,2,2,1,2,0,2} /* AU */,
+                                      {0,2,2,2,1,2,0} /* UA */};
+PRIVATE int             energyout;
+PRIVATE int             energyprev;
+
+#ifdef _OPENMP
+
+/* NOTE: all variables are assumed to be uninitialized if they are declared as threadprivate
+*/
+#pragma omp threadprivate(P, c, cc, cc1, f3, fML, Fmi, DMLi, DMLi1, DMLi2, pscore, length, S, dm, S5, S3, Ss, a2s, energyout, energyprev)
+
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE void  initialize_aliLfold(int length, int maxdist);
+PRIVATE void  free_aliL_arrays(int maxdist);
+PRIVATE void  get_arrays(unsigned int size, int maxdist);
+PRIVATE short *encode_seq(const char *sequence, short *s5, short *s3, char *ss, unsigned short *as);
+PRIVATE void  make_pscores(const char ** AS, const char *structure,int maxdist, int start);
+PRIVATE int   fill_arrays(const char **strings, int maxdist, char *structure);
+PRIVATE char  *backtrack(const char **strings, int start, int maxdist);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PRIVATE void initialize_aliLfold(int length, int maxdist){
+  if (length<1) vrna_message_error("initialize_fold: argument must be greater 0");
+  get_arrays((unsigned) length, maxdist);
+  make_pair_matrix();
+  if(P) free(P);
+  vrna_md_t   md;
+  set_model_details(&md);
+  P = vrna_params(&md);
+}
+
+/*--------------------------------------------------------------------------*/
+
+PRIVATE void get_arrays(unsigned int size, int maxdist)
+{
+  int i;
+  c       = (int **)vrna_alloc(sizeof(int *)*(size+1));
+  fML     = (int **)vrna_alloc(sizeof(int *)*(size+1));
+  pscore  = (int **)vrna_alloc(sizeof(int *)*(size+1));
+  f3      = (int *) vrna_alloc(sizeof(int)*(size+2));  /* has to be one longer */
+  cc      = (int *) vrna_alloc(sizeof(int)*(maxdist+5));
+  cc1     = (int *) vrna_alloc(sizeof(int)*(maxdist+5));
+  Fmi     = (int *) vrna_alloc(sizeof(int)*(maxdist+5));
+  DMLi    = (int *) vrna_alloc(sizeof(int)*(maxdist+5));
+  DMLi1   = (int *) vrna_alloc(sizeof(int)*(maxdist+5));
+  DMLi2   = (int *) vrna_alloc(sizeof(int)*(maxdist+5));
+  for (i=size; i>(int)size-maxdist-5 && i>=0; i--) {
+    c[i]      = (int *) vrna_alloc(sizeof(int) *(maxdist+5));
+    fML[i]    = (int *) vrna_alloc(sizeof(int) *(maxdist+5));
+    pscore[i] = (int *) vrna_alloc(sizeof(int )*(maxdist+5));
+  }
+
+}
+
+/*--------------------------------------------------------------------------*/
+
+PRIVATE void free_aliL_arrays(int maxdist) {
+  int i;
+  for(i=0; i<maxdist+5 && i<=length; i++){
+    free(c[i]);
+    free(fML[i]);
+    free(pscore[i]);
+  }
+  free(c);
+  free(fML);
+  free(f3);
+  free(cc);
+  free(cc1);
+  free(pscore);
+  free(Fmi);
+  free(DMLi);
+  free(DMLi1);
+  free(DMLi2);
+}
+
+/*--------------------------------------------------------------------------*/
+PUBLIC float aliLfold(const char **strings, char *structure, int maxdist) {
+  int length, energy, s, n_seq, i, j;
+  length = (int) strlen(strings[0]);
+  if (maxdist>length) maxdist = length;
+  initialize_aliLfold(length, maxdist);
+
+  for (s=0; strings[s]!=NULL; s++);
+  n_seq = s;
+  S   = (short **)          vrna_alloc(n_seq*sizeof(short *));
+  S5  = (short **)          vrna_alloc(n_seq*sizeof(short *));
+  S3  = (short **)          vrna_alloc(n_seq*sizeof(short *));
+  a2s = (unsigned short **) vrna_alloc(n_seq*sizeof(unsigned short *));
+  Ss  = (char **)           vrna_alloc(n_seq*sizeof(char *));
+
+  for (s=0; s<n_seq; s++) {
+    if (strlen(strings[s]) != length) vrna_message_error("uneqal seqence lengths");
+    S5[s]   = (short *)           vrna_alloc((length+2)*sizeof(short));
+    S3[s]   = (short *)           vrna_alloc((length+2)*sizeof(short));
+    a2s[s]  = (unsigned short *)  vrna_alloc((length+2)*sizeof(unsigned short));
+    Ss[s]   = (char *)            vrna_alloc((length+2)*sizeof(char));
+    S[s]    = encode_seq(strings[s], S5[s],S3[s],Ss[s],a2s[s]);
+  }
+
+  if (ribo) {
+    if (RibosumFile !=NULL) dm=readribosum(RibosumFile);
+    else dm=get_ribosum(strings, n_seq, S[0][0]);
+  }
+  else { /*use usual matrix*/
+    dm=(float **)vrna_alloc(7*sizeof(float*));
+    for (i=0; i<7;i++) {
+      dm[i]=(float *)vrna_alloc(7*sizeof(float));
+      for (j=0; j<7; j++)
+        dm[i][j] = (float) olddm[i][j];
+    }
+  }
+
+  for (i=length; i>=(int)length-(int)maxdist-4 && i>0; i--)
+    make_pscores((const char **) strings,structure,maxdist,i);
+
+  energy = fill_arrays(strings, maxdist, structure);
+
+  free_aliL_arrays(maxdist);
+  return (float) energy/100.;
+}
+
+PRIVATE int fill_arrays(const char **strings, int maxdist, char *structure) {
+  /* fill "c", "fML" and "f3" arrays and return  optimal energy */
+
+  int   i, j, k, length, energy;
+  int   decomp, new_fML,MLenergy ;
+  int   *type, type_2, tt, s, n_seq, lastf, lastf2, thisj, lastj;
+
+  lastf = lastf2 = INF;
+
+  /* int   bonus=0;*/
+
+  length = (int) strlen(strings[0]);
+  for (s=0; strings[s]!=NULL; s++);
+  n_seq = s;
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+  for (j=0; j<maxdist+5; j++)
+    Fmi[j]=DMLi[j]=DMLi1[j]=DMLi2[j]=INF;
+  for (j=length; j>length-maxdist-3; j--) {
+    for (i=(length-maxdist-2>0)?length-maxdist-2:1 ; i<j; i++)
+      c[i][j-i] = fML[i][j-i] = INF;
+  }
+
+  for (i = length-TURN-1; i >= 1; i--) { /* i,j in [1..length] */
+    for (j = i+1; j<=length && j<=i+TURN; j++) {
+      c[i][j-i]=fML[i][j-i]=INF;
+    }
+   for (j = i+TURN+1; j <= length && j <= i+maxdist; j++) {
+      int p, q, psc;
+      /* bonus = 0;*/
+      for (s=0; s<n_seq; s++) {
+        type[s] = pair[S[s][i]][S[s][j]];
+        if (type[s]==0) type[s]=7;
+      }
+
+      psc = pscore[i][j-i];
+
+      if (psc>=cv_fact*MINPSCORE) {   /* we have a pair 2 consider */
+        int new_c=0, stackEnergy=INF;
+        /* hairpin ----------------------------------------------*/
+        for (new_c=s=0; s<n_seq; s++){
+          if((a2s[s][j-1] - a2s[s][i]) < 3) new_c += 600;
+          else new_c += E_Hairpin(a2s[s][j-1]-a2s[s][i],type[s],S3[s][i],S5[s][j],Ss[s]+(a2s[s][i-1]), P);
+        }
+        /*--------------------------------------------------------
+          check for elementary structures involving more than one
+          closing pair.
+          --------------------------------------------------------*/
+        for (p = i+1; p <= MIN2(j-2-TURN,i+MAXLOOP+1) ; p++) {
+          int minq = j-i+p-MAXLOOP-2;
+          if (minq<p+1+TURN) minq = p+1+TURN;
+          for (q = minq; q < j; q++) {
+            if (pscore[p][q-p]<MINPSCORE) continue;
+
+
+            for (energy = s=0; s<n_seq; s++) {
+              type_2 = pair[S[s][q]][S[s][p]]; /* q,p not p,q! */
+              if (type_2 == 0) type_2 = 7;
+              energy += E_IntLoop(a2s[s][p-1]-a2s[s][i],
+                                  a2s[s][j-1]-a2s[s][q],
+                                  type[s],
+                                  type_2,
+                                  S3[s][i],
+                                  S5[s][j],
+                                  S5[s][p],
+                                  S3[s][q],
+                                  P);
+            }
+            new_c = MIN2(energy+c[p][q-p], new_c);
+            if ((p==i+1)&&(j==q+1)) stackEnergy = energy; /* remember stack energy */
+
+          } /* end q-loop */
+        } /* end p-loop */
+
+
+        /* multi-loop decomposition ------------------------*/
+        decomp = DMLi1[j-1-(i+1)];
+        if (dangles) {
+          for (s=0; s<n_seq; s++) {
+            tt = rtype[type[s]];
+            decomp += E_MLstem(tt, S5[s][j], S3[s][i], P);
+          }
+        }
+        else{
+          for(s=0; s<n_seq; s++){
+            tt = rtype[type[s]];
+            decomp += E_MLstem(tt, -1, -1, P);
+          }
+        }
+        MLenergy = decomp + n_seq*P->MLclosing;
+        new_c = MIN2(new_c, MLenergy);
+
+        new_c = MIN2(new_c, cc1[j-1-(i+1)]+stackEnergy);
+        cc[j-i] = new_c - psc; /* add covariance bonnus/penalty */
+        if (noLonelyPairs)
+          c[i][j-i] = cc1[j-1-(i+1)]+stackEnergy-psc;
+        else
+          c[i][j-i] = cc[j-i];
+
+      } /* end >> if (pair) << */
+      else c[i][j-i] = INF;
+
+
+      /* done with c[i,j], now compute fML[i,j] */
+      /* free ends ? -----------------------------------------*/
+
+      new_fML = fML[i+1][j-i-1]+n_seq*P->MLbase;
+      new_fML = MIN2(fML[i][j-1-i]+n_seq*P->MLbase, new_fML);
+      energy = c[i][j-i]/*+P->MLintern[type]*/;
+      if(dangles){
+        for (s=0; s<n_seq; s++) {
+          energy += E_MLstem(type[s], (i > 1) ? S5[s][i] : -1, (j < length) ? S3[s][j] : -1, P);
+        }
+      }
+      else{
+        for (s=0; s<n_seq; s++) {
+          energy += E_MLstem(type[s], -1, -1, P);
+        }
+      }
+      new_fML = MIN2(energy, new_fML);
+
+      /* modular decomposition -------------------------------*/
+
+      for (decomp = INF, k = i+1+TURN; k <= j-2-TURN; k++)
+        decomp = MIN2(decomp, Fmi[k-i]+fML[k+1][j-k-1]);
+
+      DMLi[j-i] = decomp;               /* store for use in ML decompositon */
+      new_fML = MIN2(new_fML,decomp);
+
+
+
+      fML[i][j-i] = Fmi[j-i] = new_fML;     /* substring energy */
+
+    } /* for (j...) */
+
+    /* calculate energies of 5' and 3' fragments */
+    {
+      static int do_backtrack = 0, prev_i=0;
+      static char * prev=NULL;
+      char *ss;
+      int thisf=0;
+      f3[i] = f3[i+1];
+      for (j=i+TURN+1; j<length && j<=i+maxdist; j++) {
+        if(c[i][j-i]<INF) {
+        /*        if (c[j+1]<INF) {*/
+          energy = c[i][j-i];
+          if(dangles){
+            for(s = 0; s < n_seq; s++){
+              tt = pair[S[s][i]][S[s][j]];
+              if(tt==0) tt=7;
+              energy += E_ExtLoop(tt, (i>1) ? S5[s][i] : -1, S3[s][j], P);
+            }
+          }
+          else{
+            for(s = 0; s < n_seq; s++){
+              tt = pair[S[s][i]][S[s][j]];
+              if(tt==0) tt=7;
+              energy += E_ExtLoop(tt, -1, -1, P);
+            }
+          }
+          if (energy/(j-i+1) < thisf){
+            thisf = energy/(j-i+1);
+            thisj = j;
+          }
+          energy += f3[j+1];
+          if(f3[i] > energy){
+            f3[i] = energy;
+          }
+        }
+      }
+      if(length <= i+maxdist){
+        j = length;
+        if(c[i][j-i]<INF) {
+          energy = c[i][j-i];
+          if(dangles){
+            for (s=0; s<n_seq; s++) {
+              tt = pair[S[s][i]][S[s][j]];
+              if(tt==0) tt=7;
+              energy += E_ExtLoop(tt, (i>1) ? S5[s][i] : -1, -1, P);
+            }
+          }
+          else{
+            for (s=0; s<n_seq; s++) {
+              tt = pair[S[s][i]][S[s][j]];
+              if(tt==0) tt=7;
+              energy += E_ExtLoop(tt, -1, -1, P);
+            }
+          }
+          /*  thisf=MIN2(energy/(j-i+1),thisf); ???*/
+          if (energy/(j-i+1) < thisf){
+            thisf = energy/(j-i+1);
+            thisj = j;
+          }
+          f3[i] = MIN2(f3[i], energy);
+        }
+      }
+      /* backtrack partial structure */
+      /* if (i+maxdist<length) {*/
+      if (i<length-1){
+        if (f3[i] != f3[i+1]) {
+          do_backtrack    = 1;
+          backtrack_type  = 'F';
+          if (prev_i==0) {
+            prev          =  backtrack(strings, i , MIN2(maxdist,length-i));
+            prev_i        = i;
+            do_backtrack  = 0;
+            lastf2        = lastf;
+            energyprev    = f3[i];
+          }
+        }
+        else if((thisf < lastf) && (thisf < lastf2) && ((thisf/(n_seq*100)) < -0.01)){ /*?????????*/
+          do_backtrack    = 2;
+          backtrack_type  = 'C';
+        }
+        else if (do_backtrack){
+          if(do_backtrack == 1){
+            ss =  backtrack(strings, i+1 , MIN2(maxdist,length-i)/*+1*/);
+            energyout = f3[i] - f3[i+strlen(ss)-1];/*??*/
+          }
+          else {
+            ss =  backtrack(strings, i+1 , lastj-i-2);
+            energyout=c[i+1][lastj-(i+1)];
+            if(dangles){
+              for (s=0; s<n_seq; s++) {
+                int type;
+                type = pair[S[s][i+1]][S[s][lastj-i]]; if (type==0) type=7;
+                energyout += E_ExtLoop(type, (i>1) ? S5[s][i+1] : -1, S3[s][lastj-i], P);
+              }
+            }
+            else{
+              for (s=0; s<n_seq; s++) {
+                int type;
+                type = pair[S[s][i+1]][S[s][lastj-i]]; if (type==0) type=7;
+                energyout += E_ExtLoop(type, -1, -1, P);
+              }
+            }
+          }
+
+          if((prev_i + strlen(prev) > i+1+strlen(ss)) || (do_backtrack==2)){
+            char *outstr = (char *)vrna_alloc(sizeof(char) * (strlen(prev)+1));
+            strncpy(outstr, strings[0]+prev_i-1, strlen(prev));
+            outstr[strlen(prev)] = '\0';
+            if (csv==1)  printf("%s , %6.2f, %4d, %4d\n",prev, energyprev/(100.*n_seq), prev_i,prev_i + (int)strlen(prev)-1);
+            /* if(do_backtrack==1)*/
+            else {
+              printf("%s (%6.2f) %4d - %4d\n",prev, energyprev/(100.*n_seq), prev_i,prev_i + (int)strlen(prev)-1);
+            }
+            free(outstr);
+          }
+          free(prev);
+          prev = ss;
+          energyprev = energyout;
+          prev_i = i+1;
+          do_backtrack = 0;
+          backtrack_type='F';
+        }
+      }
+      lastf2 = lastf;
+      lastf  = thisf;
+      lastj  = thisj;
+
+
+      if (i==1) {
+        char *outstr = NULL;
+        if (prev) {
+          outstr = (char *)vrna_alloc(sizeof(char) *(strlen(prev) + 1));
+          strncpy(outstr, strings[0]+prev_i-1, strlen(prev));
+          outstr[strlen(prev)] = '\0';
+          if(csv==1)
+            printf("%s ,%6.2f, %4d, %4d\n", prev, (energyprev)/(100.*n_seq), prev_i,prev_i + (int)strlen(prev)-1);
+          else{
+            printf("%s (%6.2f) %4d - %4d\n", prev, (energyprev)/(100.*n_seq), prev_i,prev_i + (int)strlen(prev)-1);
+          }
+        }
+        if ((f3[prev_i] != f3[1]) || !prev){
+          ss      =  backtrack(strings, i , maxdist);
+          if(outstr) free(outstr);
+          outstr  = (char *)vrna_alloc(sizeof(char) * (strlen(ss) + 1));
+          strncpy(outstr, strings[0], strlen(ss));
+          outstr[strlen(ss)] = '\0';
+          printf("%s \n", outstr);
+          if(csv==1)
+            printf("%s ,%6.2f ,%4d ,%4d\n", ss, (f3[1]-f3[1 + strlen(ss)-1])/(100.*n_seq), 1, (int)strlen(ss)-1);
+          else{
+            printf("%s (%6.2f) %4d - %4d\n", ss, (f3[1]-f3[1 + strlen(ss)-1])/(100.*n_seq), 1, (int)strlen(ss)-1);
+          }
+          free(ss);
+        }
+        if(prev)    free(prev);
+        if(outstr)  free(outstr);
+      }
+    }
+    {
+      int ii, *FF; /* rotate the auxilliary arrays */
+      FF = DMLi2; DMLi2 = DMLi1; DMLi1 = DMLi; DMLi = FF;
+      FF = cc1; cc1=cc; cc=FF;
+      for (j=0; j< maxdist+5; j++) {cc[j]=Fmi[j]=DMLi[j]=INF; }
+      if (i<=length-maxdist-4) {
+        c[i-1] = c[i+maxdist+4]; c[i+maxdist+4] = NULL;
+        fML[i-1] = fML[i+maxdist+4]; fML[i+maxdist+4]=NULL;
+        pscore[i-1] = pscore[i+maxdist+4]; pscore[i+maxdist+4] = NULL;
+        if(i > 1)
+          make_pscores((const char**) strings, structure, maxdist, i-1);
+        for(ii=0; ii<maxdist+5; ii++) {
+          c[i-1][ii] = fML[i-1][ii] = INF;
+        }
+      }
+    }
+  }
+
+  return f3[1];
+}
+
+PRIVATE char * backtrack(const char **strings, int start, int maxdist) {
+  /*------------------------------------------------------------------
+    trace back through the "c", "f3" and "fML" arrays to get the
+    base pairing list. No search for equivalent structures is done.
+    This is fast, since only few structure elements are recalculated.
+    ------------------------------------------------------------------*/
+  sect  sector[MAXSECTORS];   /* backtracking sectors */
+
+  int   i, j, k, energy;
+  int   *type, type_2, tt, n_seq;
+  /*int   bonus;*/
+  int   s=0, ss;
+  char *structure;
+  for (s=0; strings[s]!=NULL; s++);
+  n_seq = s;
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+  s=0;
+  length = strlen(strings[0]);
+  sector[++s].i = start;
+  sector[s].j = MIN2(length, start+maxdist+1);
+  sector[s].ml = (backtrack_type=='M') ? 1 : ((backtrack_type=='C')?2:0);
+
+  structure = (char *) vrna_alloc((MIN2(length-start, maxdist)+3)*sizeof(char));
+  for (i=0; i<=MIN2(length-start, maxdist); i++) structure[i] = '.';
+
+  while (s>0) {
+    int ml, fij, cij, traced, i1, j1, mm, p, q, jj=0;
+    int canonical = 1;     /* (i,j) closes a canonical structure */
+    i  = sector[s].i;
+    j  = sector[s].j;
+    ml = sector[s--].ml;   /* ml is a flag indicating if backtracking is to
+                              occur in the fML- (1) or in the f-array (0) */
+    if (ml==2) {
+      structure[i-start] = '(';
+      structure[j-start] = ')';
+      goto repeat1;
+    }
+
+    if (j < i+TURN+1) continue; /* no more pairs in this interval */
+
+    fij = (ml)? fML[i][j-i] : f3[i];
+
+    if (ml == 0) { /* backtrack in f3 */
+
+      if (fij == f3[i+1]) {
+        sector[++s].i = i+1;
+        sector[s].j   = j;
+        sector[s].ml  = ml;
+        continue;
+      }
+      /* i is paired. Find pairing partner */
+      for (k=i+TURN+1,traced=0; k<=j; k++) {
+        int cc;
+        jj = k+1;
+        cc = c[i][k-(i)];
+        if (cc<INF) {
+          if(dangles){
+            for (ss=0; ss<n_seq; ss++) {
+              type[ss] = pair[S[ss][i]][S[ss][k]];
+              if (type[ss]==0) type[ss]=7;
+              cc += E_ExtLoop(type[ss], (i>1) ? S5[ss][i] : -1, (k<length) ? S3[ss][k] : -1, P);
+            }
+          }
+          else{
+            for (ss=0; ss<n_seq; ss++) {
+              type[ss] = pair[S[ss][i]][S[ss][k]];
+              if (type[ss]==0) type[ss]=7;
+              cc += E_ExtLoop(type[ss], -1, -1, P);
+            }
+          }
+          if (fij == cc + f3[k+1]) traced=i;
+        }
+        if (traced) break;
+      }
+
+      if (!traced) vrna_message_error("backtrack failed in f3");
+      if (j==length) { /* backtrack only one component, unless j==length */
+        sector[++s].i = jj;
+        sector[s].j   = j;
+        sector[s].ml  = ml;
+      }
+      i=traced; j=k;
+      structure[i-start] = '('; structure[j-start] = ')';
+      goto repeat1;
+    }
+    else { /* trace back in fML array */
+      if (fML[i][j-1-i]+n_seq*P->MLbase == fij) {  /* 3' end is unpaired */
+        sector[++s].i = i;
+        sector[s].j   = j-1;
+        sector[s].ml  = ml;
+        continue;
+      }
+      if (fML[i+1][j-(i+1)]+n_seq*P->MLbase == fij) { /* 5' end is unpaired */
+        sector[++s].i = i+1;
+        sector[s].j   = j;
+        sector[s].ml  = ml;
+        continue;
+      }
+
+      cij = c[i][j-i] ;
+      if(dangles){
+        for (ss=0; ss<n_seq; ss++) {
+          tt  = pair[S[ss][i]][S[ss][j]];
+          if (tt==0) tt=7;
+          cij += E_MLstem(tt, (i>1) ? S5[ss][i] : -1, (j<length) ? S3[ss][j] : -1, P);
+        }
+      }
+      else{
+        for (ss=0; ss<n_seq; ss++) {
+          tt  = pair[S[ss][i]][S[ss][j]];
+          if (tt==0) tt=7;
+          cij += E_MLstem(tt, -1, -1, P);
+        }
+      }
+
+      if(fij==cij){
+        /* found a pair */
+        structure[i-start] = '('; structure[j-start] = ')';
+        goto repeat1;
+      }
+
+      for (k = i+1+TURN; k <= j-2-TURN; k++)
+        if (fij == (fML[i][k-i]+fML[k+1][j-(k+1)]))
+          break;
+
+      sector[++s].i = i;
+      sector[s].j   = k;
+      sector[s].ml  = ml;
+      sector[++s].i = k+1;
+      sector[s].j   = j;
+      sector[s].ml  = ml;
+
+      if (k>j-2-TURN) vrna_message_error("backtrack failed in fML");
+      continue;
+    }
+
+  repeat1:
+
+    /*----- begin of "repeat:" -----*/
+    if (canonical)  cij = c[i][j-i];
+
+    for (ss=0; ss<n_seq; ss++) {
+      type[ss] = pair[S[ss][i]][S[ss][j]];
+      if (type[ss]==0) type[ss] = 7;
+    }
+
+    /*    bonus = 0;*/
+
+    if (noLonelyPairs)
+      if (cij == c[i][j-i]) {
+        /* (i.j) closes canonical structures, thus
+           (i+1.j-1) must be a pair                */
+        for (ss=0; ss<n_seq; ss++) {
+          type_2 = pair[S[ss][j-1]][S[ss][i+1]];  /* j,i not i,j */
+          if (type_2==0) type_2 = 7;
+          cij -= P->stack[type[ss]][type_2];
+        }
+        cij += pscore[i][j-i];
+        structure[i+1-start] = '('; structure[j-1-start] = ')';
+        i++; j--;
+        canonical=0;
+        goto repeat1;
+      }
+    canonical = 1;
+    cij += pscore[i][j-i];
+
+    {
+      int cc=0;
+      for (ss=0; ss<n_seq; ss++){
+        if((a2s[ss][j-1] - a2s[ss][i]) < 3) cc += 600;
+        else cc += E_Hairpin(a2s[ss][j-1] - a2s[ss][i], type[ss], S3[ss][i], S5[ss][j], Ss[ss] + a2s[ss][i-1], P);
+      }
+      if (cij == cc) /* found hairpin */
+        continue;
+    }
+
+    for (p = i+1; p <= MIN2(j-2-TURN,i+MAXLOOP+1); p++) {
+      int minq;
+      minq = j-i+p-MAXLOOP-2;
+      if (minq<p+1+TURN) minq = p+1+TURN;
+      for (q = j-1; q >= minq; q--) {
+        if (c[p][q-p]>=INF) continue;
+         for (ss=energy=0; ss<n_seq; ss++) {
+          type_2 = pair[S[ss][q]][S[ss][p]];  /* q,p not p,q */
+          if (type_2==0) type_2 = 7;
+          energy += E_IntLoop(a2s[ss][p-1] - a2s[ss][i],
+                              a2s[ss][j-1] - a2s[ss][q],
+                              type[ss],
+                              type_2,
+                              S3[ss][i],
+                              S5[ss][j],
+                              S5[ss][p],
+                              S3[ss][q],
+                              P);
+        }
+        traced = (cij == energy+c[p][q-p]);
+        if (traced) {
+          structure[p-start] = '(';
+          structure[q-start] = ')';
+          i = p, j = q;
+          goto repeat1;
+        }
+      }
+    }
+
+    /* end of repeat: --------------------------------------------------*/
+
+    /* (i.j) must close a multi-loop */
+    mm = n_seq*P->MLclosing;
+    if(dangles){
+      for (ss=0; ss<n_seq; ss++) {
+        tt = rtype[type[ss]];
+        mm += E_MLstem(tt, S5[ss][j],S3[ss][i], P);
+      }
+    }
+    else{
+      for (ss=0; ss<n_seq; ss++) {
+        tt = rtype[type[ss]];
+        mm += E_MLstem(tt, -1, -1, P);
+      }
+    }
+    i1 = i+1; j1 = j-1;
+    sector[s+1].ml  = sector[s+2].ml = 1;
+
+    for (k = i+TURN+2; k < j-TURN-2; k++){
+      if(cij == fML[i+1][k-(i+1)] + fML[k+1][j-1-(k+1)] + mm) break;
+    }
+    if (k<=j-3-TURN){ /* found the decomposition */
+      sector[++s].i = i1;
+      sector[s].j   = k;
+      sector[++s].i = k+1;
+      sector[s].j   = j1;
+    } else {
+        vrna_message_error("backtracking failed in repeat");
+    }
+
+  }
+  if (start+maxdist<length) {
+    for (i=strlen(structure); i>0 && structure[i-1] == '.'; i--)
+      structure[i] = '\0';
+  }
+  return structure;
+}
+
+/*---------------------------------------------------------------------------*/
+PRIVATE short *encode_seq(const char *sequence, short *s5, short *s3, char *ss, unsigned short *as){
+  unsigned int    i,l;
+  short           *S;
+  unsigned short  p;
+
+  l     = strlen(sequence);
+  S     = (short *) vrna_alloc(sizeof(short)*(l+2));
+  S[0]  = (short) l;
+
+  s5[0]=s5[1]=0;
+  /* make numerical encoding of sequence */
+  for (i=1; i<=l; i++) {
+    short ctemp = (short)encode_char(toupper(sequence[i-1]));
+    S[i]  = ctemp ;
+  }
+
+   if (oldAliEn) {
+     /*use alignment sequences in all energy evaluations*/
+     ss[0]=sequence[0];
+     for (i=1; i<l; i++) {
+       s5[i]=S[i-1];
+       s3[i]=S[i+1];
+       ss[i]= sequence[i];
+       as[i]=i;
+     }
+     ss[l] = sequence[l];
+     as[l]=l;
+     s5[l]=S[l-1];
+     s3[l]=0;
+     S[l+1] = S[1];
+     s5[1]=0;
+     if (1) {
+       s5[1]=S[l];
+       s3[l]=S[1];
+       ss[l+1]=S[1];
+     }
+     return S;
+   }
+   else {
+     if (1) {
+       for (i=l; i>0; i--) {
+         char c5;
+         c5=sequence[i-1];
+         if ((c5=='-')||(c5=='_')||(c5=='~')||(c5=='.')) continue;
+         s5[1] = S[i];
+         break;
+       }
+       for (i=1; i<=l; i++) {
+         char c3;
+         c3 = sequence[i-1];
+         if ((c3=='-')||(c3=='_')||(c3=='~')||(c3=='.')) continue;
+         s3[l] = S[i];
+         break;
+       }
+     } else  s5[1]=s3[l]=0;
+
+     for (i=1,p=0; i<=l; i++) {
+       char c5;
+       c5=sequence[i-1];
+       if ((c5=='-')||(c5=='_')||(c5=='~')||(c5=='.'))
+         s5[i+1]=s5[i];
+       else { /* no gap */
+         ss[p++]=sequence[i-1]; /*start at 0!!*/
+         s5[i+1]=S[i];
+       }
+       as[i]=p;
+     }
+     for (i=l; i>=1; i--) {
+       char c3;
+       c3=sequence[i-1];
+       if ((c3=='-')||(c3=='_')||(c3=='~')||(c3=='.'))
+         s3[i-1]=s3[i];
+       else
+         s3[i-1]=S[i];
+     }
+   }
+
+   return S;
+}
+
+PRIVATE double cov_score(const char **AS, int i, int j) {
+  int n_seq,k,l,s;
+  double score;
+  int pfreq[8]={0,0,0,0,0,0,0,0};
+  for (n_seq=0; AS[n_seq]!=NULL; n_seq++);
+  for (s=0; s<n_seq; s++) {
+    int type;
+    if (S[s][i]==0 && S[s][j]==0) type = 7; /* gap-gap  */
+    else {
+      if ((AS[s][i] == '~')||(AS[s][j] == '~')) type = 7;
+      else type = pair[S[s][i]][S[s][j]];
+    }
+
+    pfreq[type]++;
+  }
+  if (pfreq[0]*2+pfreq[7]>n_seq)
+    return NONE;
+  else
+    for (k=1,score=0.; k<=6; k++) /* ignore pairtype 7 (gap-gap) */
+      for (l=k; l<=6; l++)
+        /* scores for replacements between pairtypes    */
+        /* consistent or compensatory mutations score 1 or 2  */
+        score += pfreq[k]*pfreq[l]*dm[k][l];
+
+  /* counter examples score -1, gap-gap scores -0.25   */
+  return cv_fact * ((UNIT*score)/n_seq - nc_fact*UNIT*(pfreq[0] + pfreq[7]*0.25));
+}
+
+PRIVATE void make_pscores(const char ** AS,
+                          const char *structure, int maxd, int i) {
+  /* calculate co-variance bonus for each pair depending on  */
+  /* compensatory/consistent mutations and incompatible seqs */
+  /* should be 0 for conserved pairs, >0 for good pairs      */
+  int n,j,l;
+  n=S[0][0];  /* length of seqs */
+
+  /*first allocate space:*/
+  pscore[i]=(int *)vrna_alloc((maxd+5)*sizeof(int));
+  /*  pscore[start]-=start;*/
+  /*fill pscore[start], too close*/
+  for (j=i+1; (j<i+TURN+1) && (j<=n); j++) {
+    pscore[i][j-i] = NONE;
+  }
+  for (j=i+TURN+1; ((j<=n) && (j<=i+maxd)); j++) {
+    pscore[i][j-i] = cov_score(AS, i, j);
+  }
+
+  if (noLonelyPairs) { /* remove unwanted lonely pairs */
+    int otype=0, ntype=0;
+    for (j=i+TURN; ((j<n)&&(j<i+maxd)); j++) {
+      if ((i>1) && (j<n)) otype = cov_score(AS, i-1, j+1);
+      if (i<n) ntype=pscore[i+1][j-1-(i+1)];
+      else ntype=NONE;
+
+      if ((otype<-4*UNIT)&&(ntype<-4*UNIT))  /* worse than 2 counterex */
+        pscore[i][j-i] = NONE; /* i.j can only form isolated pairs */
+    }
+  }
+
+  if (fold_constrained&&(structure!=NULL)) {
+    int psij, hx, *stack;
+    stack = (int *) vrna_alloc(sizeof(int)*(n+1));
+    hx=psij=0;
+    /* for(hx=0, j=i+TURN; ((j<=i+maxd)&&(j<=n)); j++) {*/
+    switch (structure[i-1]) {
+    case 'x': /* can't pair */
+      for (l=i+TURN+1; l<=i+maxd; l++) pscore[i][l-i] = NONE;
+      break;
+    case '(':
+        hx=1;
+        psij=1;
+        for (l=i+1; l<=i+maxd; l++) {
+          switch (structure[l-1]) {
+          case '(':
+            hx++;
+            pscore[i][l-i] = NONE;
+            break;
+          case ')':
+            hx--;
+            if (hx!=0) pscore[i][l-i] = NONE;
+            break;
+          default:
+            pscore[i][l-i] = NONE;
+          }
+          /* fallthrough */
+                }
+    case ')':
+      for (l=i+TURN+1; l<=i+maxd; l++) pscore[i][l-i] = NONE;
+      break;
+    case '>':
+      for (l=i+TURN+1; l<=i+maxd; l++) pscore[i][l-i] = NONE;
+      break;
+
+    }
+    if (!psij) for (l=i+1; l<=i+maxd; l++) { /*no '(' constraint on i*/
+      switch (structure[l-1]) {
+      case '(':
+        pscore[i][l-i] = NONE;
+        break;
+      case '<':
+        pscore[i][l-i] = NONE;
+        break;
+      case 'x':
+        pscore[i][l-i] = NONE;
+        break;
+      case ')':
+         pscore[i][l-i] = NONE;
+        break;
+      }
+    }
+    if (hx!=0) {
+      vrna_message_error("%s\nunbalanced brackets in constraint string", structure);
+    }
+    free(stack);
+  }
+}
diff --git a/C/ViennaRNA/ali_plex.c b/C/ViennaRNA/ali_plex.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/ali_plex.c
@@ -0,0 +1,1308 @@
+/*
+           compute the duplex structure of two RNA strands,
+                allowing only inter-strand base pairs.
+         see cofold() for computing hybrid structures without
+                             restriction.
+                             Ivo Hofacker
+                          Vienna RNA package
+
+*/
+
+
+/*
+  library containing the function used in rnaplex
+  the program rnaplex uses the following function
+  Lduplexfold: finds high scoring segments
+  it stores the end-position of these segments in an array
+  and call then for each of these positions the duplexfold function
+  which allows one to make backtracking for each of the high scoring position
+  It allows one to find suboptimal partially overlapping (depends on a a parameter)
+  duplexes between a long RNA and a shorter one.
+  Contrarly to RNAduplex, the energy model is not in E~log(N),
+  where N is the length of an interial loop but used an affine model,
+  where the extension and begin parameter are fitted to the energy
+  parameter used by RNAduplex. This allows one to check for duplex between a short RNA(20nt)
+  and a long one at the speed of 1Mnt/s. At this speed the whole genome (3Gnt) can be analyzed for one siRNA
+  in about 50 minutes.
+  The algorithm is based on an idea by Durbin and Eddy:when the alginment reach a value larger than a
+  given threshold this value is stored in an array. When the alignment score goes
+  then under this threshold, the alignemnent begin from this value, in that way the backtracking allow us
+  to find all non-overlapping high-scoring segments.
+  For more information check "durbin, biological sequence analysis"
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/plex.h"
+#include "ViennaRNA/ali_plex.h"
+
+
+#define PUBLIC
+#define PRIVATE static
+
+#define STACK_BULGE1  1   /* stacking energies for bulges of size 1 */
+#define NEW_NINIO     1   /* new asymetry penalty */
+#define ARRAY 32          /*array size*/
+#define UNIT 100
+#define MINPSCORE -2 * UNIT
+/**
+*** Due to the great similarity between functions,
+*** more annotation can be found in plex.c
+**/
+
+PRIVATE short *encode_seq(const char *seq);
+PRIVATE void  update_dfold_params(void);
+/**
+*** aliduplexfold(_XS)/alibacktrack(_XS) computes duplex interaction with standard energy and considers extension_cost
+*** alifind_max(_XS)/aliplot_max(_XS) find suboptimals and MFE
+**/
+PRIVATE duplexT aliduplexfold(const char *s1[], const char *s2[], const int extension_cost);
+PRIVATE char *    alibacktrack(int i, int j, const short *s1[], const short *s2[], const int extension_cost);
+PRIVATE void      alifind_max(const int *position, const int *position_j,const int delta, const int threshold,
+                           const int alignment_length, const char *s1[], const char *s2[], const int extension_cost, const int fast);
+PRIVATE void      aliplot_max(const int max, const int max_pos, const int max_pos_j,
+                           const int alignment_length, const char *s1[], const char *s2[], const int extension_cost, const int fast);
+PRIVATE duplexT aliduplexfold_XS(const char *s1[], const char *s2[],const int **access_s1,
+                                 const int **access_s2, const int i_pos, const int j_pos, const int threshold,const int i_flag, const int j_flag);
+PRIVATE char *    alibacktrack_XS(int i, int j, const short *s1[], const short *s2[], const int** access_s1, const int** access_s2,const int i_flag, const int j_flag);
+PRIVATE void  alifind_max_XS(const int *position, const int *position_j,
+                                 const int delta,  const int threshold, const int alignment_length,
+                                 const char* s1[], const char* s2[],
+                                 const int **access_s1, const int **access_s2, const int fast);
+PRIVATE void aliplot_max_XS(const int max, const int max_pos, const int max_pos_j,
+                            const int alignment_length, const char *s1[], const char* s2[],
+                            const int **access_s1, const int **access_s2, const int fast);
+
+/**
+*** computes covariance score
+**/
+
+PRIVATE int covscore(const int *types, int n_seq);
+
+extern double cv_fact; /* from alifold.c, default 1 */
+extern double nc_fact;
+
+
+/*@unused@*/
+
+#define MAXSECTORS      500     /* dimension for a backtrack array */
+#define LOCALITY        0.      /* locality parameter for base-pairs */
+
+PRIVATE vrna_param_t *P = NULL;
+PRIVATE int   **c = NULL;
+PRIVATE int  **lc = NULL, **lin = NULL, **lbx = NULL, **lby = NULL,**linx = NULL, **liny = NULL;
+
+
+
+
+PRIVATE int   n1,n2;
+PRIVATE int n3, n4;
+PRIVATE int delay_free=0;
+
+
+/*-----------------------------------------------------------------------duplexfold_XS---------------------------------------------------------------------------*/
+
+
+
+/*----------------------------------------------ALIDUPLEXFOLD-----------------------------------------------------------------------------------------------------------*/
+PRIVATE duplexT aliduplexfold(const char *s1[], const char *s2[], const int extension_cost) {
+  int i, j, s, n_seq, Emin=INF, i_min=0, j_min=0;
+  char *struc;
+  duplexT mfe;
+  vrna_md_t   md;
+  short **S1, **S2;
+  int *type;
+  n3 = (int) strlen(s1[0]);
+  n4 = (int) strlen(s2[0]);
+  for (s=0; s1[s]!=NULL; s++);
+  n_seq = s;
+  for (s=0; s2[s]!=NULL; s++);
+  if (n_seq != s) vrna_message_error("unequal number of sequences in aliduplexfold()\n");
+
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    update_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+
+  c = (int **) vrna_alloc(sizeof(int *) * (n3+1));
+  for (i=1; i<=n3; i++) c[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+
+  S1 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  S2 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  for (s=0; s<n_seq; s++) {
+    if (strlen(s1[s]) != n3) vrna_message_error("uneqal seqence lengths");
+    if (strlen(s2[s]) != n4) vrna_message_error("uneqal seqence lengths");
+    S1[s] = encode_seq(s1[s]);
+    S2[s] = encode_seq(s2[s]);
+  }
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+
+  for (i=1; i<=n3; i++) {
+    for (j=n4; j>0; j--) {
+      int k,l,E,psc;
+      for (s=0; s<n_seq; s++) {
+        type[s] = pair[S1[s][i]][S2[s][j]];
+      }
+      psc = covscore(type, n_seq);
+      for (s=0; s<n_seq; s++) if (type[s]==0) type[s]=7;
+      c[i][j] = (psc>=MINPSCORE) ? (n_seq*(P->DuplexInit + 2*extension_cost)) : INF;
+      if (psc<MINPSCORE) continue;
+      for (s=0; s<n_seq; s++) {
+        c[i][j] += E_ExtLoop(type[s], (i>1) ? S1[s][i-1] : -1, (j<n4) ? S2[s][j+1] : -1, P) + 2*extension_cost;
+      }
+      for (k=i-1; k>0 && k>i-MAXLOOP-2; k--) {
+        for (l=j+1; l<=n4; l++) {
+          int type2;
+          if (i-k+l-j-2>MAXLOOP) break;
+          if (c[k][l]>INF/2) continue;
+          for (E=s=0; s<n_seq; s++) {
+            type2 = pair[S1[s][k]][S2[s][l]];
+            if (type2==0) type2=7;
+            E += E_IntLoop(i-k-1, l-j-1, type2, rtype[type[s]],
+                           S1[s][k+1], S2[s][l-1], S1[s][i-1], S2[s][j+1],P) + (i-k+l-j)*extension_cost;
+          }
+          c[i][j] = MIN2(c[i][j], c[k][l]+E);
+        }
+      }
+      c[i][j] -= psc;
+      E = c[i][j];
+      for (s=0; s<n_seq; s++) {
+        E += E_ExtLoop(rtype[type[s]], (j>1) ? S2[s][j-1] : -1, (i<n3) ? S1[s][i+1] : -1, P) +2*extension_cost;
+      }
+      if (E<Emin) {
+        Emin=E; i_min=i; j_min=j;
+      }
+    }
+  }
+  struc = alibacktrack(i_min, j_min, (const short int**) S1, (const short int**) S2 , extension_cost);
+  if (i_min<n3) i_min++;
+  if (j_min>1 ) j_min--;
+  int size;
+  size=strlen(struc)-1;
+  Emin-=size * n_seq * extension_cost;
+  mfe.i = i_min;
+  mfe.j = j_min;
+  mfe.energy = (float) (Emin/(100.*n_seq));
+  mfe.structure = struc;
+  if (!delay_free) {
+    for (i=1; i<=n3; i++) free(c[i]);
+    free(c);
+  }
+  for (s=0; s<n_seq; s++) {
+    free(S1[s]); free(S2[s]);
+  }
+  free(S1); free(S2); free(type);
+  return mfe;
+}
+
+
+PRIVATE char *alibacktrack(int i, int j, const short *S1[], const short *S2[], const int extension_cost) {
+  /* backtrack structure going backwards from i, and forwards from j
+     return structure in bracket notation with & as separator */
+  int k, l, *type, type2, E, traced, i0, j0, s, n_seq;
+  char *st1, *st2, *struc;
+
+  n3 = (int) S1[0][0];
+  n4 = (int) S2[0][0];
+
+  for (s=0; S1[s]!=NULL; s++);
+  n_seq = s;
+  for (s=0; S2[s]!=NULL; s++);
+  if (n_seq != s) vrna_message_error("unequal number of sequences in alibacktrack()\n");
+
+  st1 = (char *) vrna_alloc(sizeof(char)*(n3+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n4+1));
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+
+  i0=MIN2(i+1,n3); j0=MAX2(j-1,1);
+
+  while (i>0 && j<=n4) {
+    int psc;
+    E = c[i][j]; traced=0;
+    st1[i-1] = '(';
+    st2[j-1] = ')';
+    for (s=0; s<n_seq; s++) {
+      type[s] = pair[S1[s][i]][S2[s][j]];
+    }
+    psc = covscore(type, n_seq);
+    for (s=0; s<n_seq; s++) if (type[s]==0) type[s] = 7;
+    E += psc;
+    for (k=i-1; k>0 && k>i-MAXLOOP-2; k--) {
+      for (l=j+1; l<=n4; l++) {
+        int LE;
+        if (i-k+l-j-2>MAXLOOP) break;
+        if (c[k][l]>INF/2) continue;
+        for (s=LE=0; s<n_seq; s++) {
+          type2 = pair[S1[s][k]][S2[s][l]];
+          if (type2==0) type2=7;
+          LE += E_IntLoop(i-k-1, l-j-1, type2, rtype[type[s]],
+                          S1[s][k+1], S2[s][l-1], S1[s][i-1], S2[s][j+1],P)+(i-k+l-j)*extension_cost;
+        }
+        if (E == c[k][l]+LE) {
+          traced=1;
+          i=k; j=l;
+          break;
+        }
+      }
+      if (traced) break;
+    }
+    if (!traced) {
+      for (s=0; s<n_seq; s++) {
+        E -= E_ExtLoop(type[s], (i>1) ? S1[s][i-1] : -1, (j<n4) ? S2[s][j+1] : -1, P) + 2*extension_cost;
+      }
+      if (E != n_seq*P->DuplexInit + n_seq*2*extension_cost) {
+        vrna_message_error("backtrack failed in aliduplex");
+      } else break;
+    }
+  }
+  if (i>1)  i--;
+  if (j<n4) j++;
+
+  struc = (char *) vrna_alloc(i0-i+1+j-j0+1+2);
+  for (k=MAX2(i,1); k<=i0; k++) if (!st1[k-1]) st1[k-1] = '.';
+  for (k=j0; k<=j; k++) if (!st2[k-1]) st2[k-1] = '.';
+  strcpy(struc, st1+MAX2(i-1,0)); strcat(struc, "&");
+  strcat(struc, st2+j0-1);
+
+  /* printf("%s %3d,%-3d : %3d,%-3d\n", struc, i,i0,j0,j);  */
+  free(st1); free(st2); free(type);
+
+  return struc;
+}
+
+duplexT** aliLduplexfold(const char *s1[], const char *s2[], const int threshold, const int extension_cost, const int alignment_length, const int delta, const int fast,const int il_a, const int il_b, const int b_a, const int b_b)
+{
+  short **S1, **S2;
+  int *type, type2;
+  int i, j,s,n_seq;
+  s=0;
+  int bopen=b_b;
+  int bext=b_a+extension_cost;
+  int iopen=il_b;
+  int iext_s=2*(il_a+extension_cost);/* iext_s 2 nt nucleotide extension of interior loop, on i and j side */
+  int iext_ass=50+il_a+extension_cost;/* iext_ass assymetric extension of interior loop, either on i or on j side. */
+  int min_colonne=INF; /* enthaelt das maximum einer kolonne */
+  int i_length;
+  int max_pos;/* get position of the best hit */
+  int max_pos_j;
+  int temp;
+  int min_j_colonne;
+  int max=INF;
+  /* FOLLOWING NEXT 4 LINE DEFINES AN ARRAY CONTAINING POSITION OF THE SUBOPT IN S1 */
+  int *position; /* contains the position of the hits with energy > E */
+  int *position_j;
+
+
+  n1 = (int) strlen(s1[0]);
+  n2 = (int) strlen(s2[0]);
+  for (s=0; s1[s]; s++);
+  n_seq = s;
+  for (s=0; s2[s]; s++);
+  if (n_seq != s) vrna_message_error("unequal number of sequences in aliduplexfold()\n");
+
+  position = (int *) vrna_alloc((delta+(n1)+4+delta) * sizeof(int));
+  position_j= (int *) vrna_alloc((delta+(n1)+4+delta) * sizeof(int));
+
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)){
+    update_dfold_params();
+  }
+
+  lc   = (int**) vrna_alloc(sizeof(int *) * 5);
+  lin  = (int**) vrna_alloc(sizeof(int *) * 5);
+  lbx  = (int**) vrna_alloc(sizeof(int *) * 5);
+  lby  = (int**) vrna_alloc(sizeof(int *) * 5);
+  linx = (int**) vrna_alloc(sizeof(int *) * 5);
+  liny = (int**) vrna_alloc(sizeof(int *) * 5);
+
+  for (i=0; i<=4; i++){
+    lc[i]  = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lin[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lbx[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lby[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    linx[i]= (int *) vrna_alloc(sizeof(int) * (n2+5));
+    liny[i]= (int *) vrna_alloc(sizeof(int) * (n2+5));
+  }
+
+
+  S1 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  S2 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  for (s=0; s<n_seq; s++) {
+    if (strlen(s1[s]) != n1) vrna_message_error("uneqal seqence lengths");
+    if (strlen(s2[s]) != n2) vrna_message_error("uneqal seqence lengths");
+    S1[s] = encode_seq(s1[s]);
+    S2[s] = encode_seq(s2[s]);
+  }
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+  /**
+  *** array initialization
+  **/
+  for(j=n2;j>=0;j--) {
+    lbx[0][j]=lbx[1][j]=lbx[2][j]=lbx[3][j]    = lbx[4][j] =INF;
+    lin[0][j]=lin[1][j]=lin[2][j]=lin[3][j]    = lin[4][j] =INF;
+    lc[0][j] =lc[1][j] =lc[2][j] = lc[3][j]    =  lc[4][j] =INF;
+    lby[0][j]=lby[1][j]=lby[2][j]=lby[3][j]    = lby[4][j] =INF;
+    liny[0][j]=liny[1][j]=liny[2][j]=liny[3][j]=liny[4][j]=INF;
+    linx[0][j]=linx[1][j]=linx[2][j]=linx[3][j]=linx[4][j]=INF;
+  }
+  i=10;
+  i_length= n1 - 9 ;
+  while(i < i_length) {
+    int idx=i%5;
+    int idx_1=(i-1)%5;
+    int idx_2=(i-2)%5;
+    int idx_3=(i-3)%5;
+    int idx_4=(i-4)%5;
+    j=n2-9;
+    while (9 < --j) {
+      int psc;
+      for (s=0; s<n_seq; s++) {
+        type[s] = pair[S1[s][i]][S2[s][j]];
+      }
+      psc = covscore(type, n_seq);
+      for (s=0; s<n_seq; s++) if (type[s]==0) type[s]=7;
+      lc[idx][j] = (psc>=MINPSCORE) ? (n_seq*P->DuplexInit + 2*n_seq*extension_cost) : INF;
+      /**
+      *** Update matrix. It is the average over all sequence of a given structure element
+      *** c_stack -> stacking of c
+      *** c_10, c01 -> stack from bulge
+      *** c_nm -> arrives in stack from nxm loop
+      *** c_in -> arrives in stack from interior loop
+      *** c_bx -> arrives in stack from large bulge on target
+      *** c_by -> arrives in stack from large bulge on query
+      ***
+      **/
+      int c_stack, c_10, c_01, c_11, c_22, c_21, c_12, c_23, c_32, c_in, c_in2x, c_in2y, c_bx, c_by, c_inx, c_iny;  /* matrix c */
+      int in, in_x, in_y, in_xy; /*  in begin, in_x assymetric, in_y assymetric, in_xy symetric; */
+      int inx, inx_x;
+      int iny, iny_y;
+      int bx, bx_x;
+      int by, by_y;
+      in=lc[idx_1][j+1]; in_x=lin[idx_1][j]; in_y=lin[idx][j+1]; in_xy=lin[idx_1][j+1];
+      inx=lc[idx_1][j+1]; inx_x=linx[idx_1][j];
+      iny=lc[idx_1][j+1]; iny_y=liny[idx][j+1];
+      bx=lc[idx_1][j]; bx_x=lbx[idx_1][j];
+      by=lc[idx][j+1]; by_y=lby[idx][j+1];
+      c_stack=lc[idx_1][j+1]; c_01=lc[idx_1][j+2];c_10=lc[idx_2][j+1];
+      c_12=lc[idx_2][j+3];c_21=lc[idx_3][j+2];c_11=lc[idx_2][j+2];
+      c_22=lc[idx_3][j+3];c_32=lc[idx_4][j+3];c_23=lc[idx_3][j+4];
+      c_in=lin[idx_3][j+3];c_in2x=lin[idx_4][j+2];c_in2y=lin[idx_2][j+4];
+      c_inx=linx[idx_3][j+1]; c_iny=liny[idx_1][j+3];
+      c_bx=lbx[idx_2][j+1];c_by=lby[idx_1][j+2];
+      for (s=0; s<n_seq; s++) {
+        type2 = pair[S2[s][j+1]][S1[s][i-1]];
+        in   +=P->mismatchI[type2][S2[s][j]][S1[s][i]]+iopen+iext_s;
+        in_x +=iext_ass;
+        in_y +=iext_ass;
+        in_xy+=iext_s;
+        inx  +=P->mismatch1nI[type2][S2[s][j]][S1[s][i]]+iopen+iext_s;
+        inx_x+=iext_ass;
+        iny  +=P->mismatch1nI[type2][S2[s][j]][S1[s][i]]+iopen+iext_s;
+        iny_y+=iext_ass;
+        type2=pair[S2[s][j]][S1[s][i-1]];
+        bx   +=bopen+bext+(type2>2?P->TerminalAU:0);
+        bx_x +=bext;
+        type2=pair[S2[s][j+1]][S1[s][i]];
+        by   +=bopen+bext+(type2>2?P->TerminalAU:0);
+        by_y +=bext;
+      }
+      lin [idx][j]=MIN2(in, MIN2(in_x, MIN2(in_y, in_xy)));
+      linx[idx][j]=MIN2(inx_x, inx);
+      liny[idx][j]=MIN2(iny_y, iny);
+      lby[idx][j] =MIN2(by, by_y);
+      lbx[idx][j] =MIN2(bx, bx_x);
+
+      if (psc<MINPSCORE) continue;
+      for (s=0; s<n_seq; s++) {
+        lc[idx][j]+=E_ExtLoop(type[s], S1[s][i-1],S2[s][j+1], P) + 2*extension_cost;
+      }
+      for (s=0; s<n_seq; s++) {
+        type2=pair[S1[s][i-1]][S2[s][j+1]];if (type2==0) type2=7;
+        c_stack+=E_IntLoop(0,0,type2, rtype[type[s]],S1[s][i], S2[s][j], S1[s][i-1], S2[s][j+1], P)+2*extension_cost;
+        type2=pair[S1[s][i-1]][S2[s][j+2]];if (type2==0) type2=7;
+        c_01   +=E_IntLoop(0,1,type2, rtype[type[s]],S1[s][i], S2[s][j+1], S1[s][i-1], S2[s][j+1], P)+3*extension_cost;
+        type2=pair[S1[s][i-2]][S2[s][j+1]]; if (type2==0) type2=7;
+        c_10   +=E_IntLoop(1,0,type2, rtype[type[s]],S1[s][i-1], S2[s][j], S1[s][i-1], S2[s][j+1], P)+3*extension_cost;
+        type2=pair[S1[s][i-2]][S2[s][j+2]]; if (type2==0) type2=7;
+        c_11   +=E_IntLoop(1,1,type2, rtype[type[s]],S1[s][i-1], S2[s][j+1], S1[s][i-1], S2[s][j+1], P)+4*extension_cost;
+        type2 = pair[S1[s][i-3]][S2[s][j+3]];if (type2==0) type2=7;
+        c_22   +=E_IntLoop(2,2,type2, rtype[type[s]],S1[s][i-2], S2[s][j+2], S1[s][i-1], S2[s][j+1], P)+6*extension_cost;
+        type2 = pair[S1[s][i-3]][S2[s][j+2]];if (type2==0) type2=7;
+        c_21   +=E_IntLoop(2,1,type2, rtype[type[s]],S1[s][i-2], S2[s][j+1], S1[s][i-1], S2[s][j+1], P)+5*extension_cost;
+        type2 = pair[S1[s][i-2]][S2[s][j+3]];if (type2==0) type2=7;
+        c_12   +=E_IntLoop(1,2,type2, rtype[type[s]],S1[s][i-1], S2[s][j+2], S1[s][i-1], S2[s][j+1], P)+5*extension_cost;
+        type2 = pair[S1[s][i-4]][S2[s][j+3]];if (type2==0) type2=7;
+        c_32   +=E_IntLoop(3,2,type2, rtype[type[s]],S1[s][i-3], S2[s][j+2], S1[s][i-1], S2[s][j+1], P)+7*extension_cost;
+        type2 = pair[S1[s][i-3]][S2[s][j+4]];if (type2==0) type2=7;
+        c_23   +=E_IntLoop(2,3,type2, rtype[type[s]],S1[s][i-2], S2[s][j+3], S1[s][i-1], S2[s][j+1], P)+7*extension_cost;
+        c_in   +=P->mismatchI[rtype[type[s]]][S1[s][i-1]][S2[s][j+1]]+2*extension_cost+2*iext_s;
+        c_in2x +=P->mismatchI[rtype[type[s]]][S1[s][i-1]][S2[s][j+1]]+iext_s+2*iext_ass+2*extension_cost;
+        c_in2y +=P->mismatchI[rtype[type[s]]][S1[s][i-1]][S2[s][j+1]]+iext_s+2*iext_ass+2*extension_cost;
+        c_inx  +=P->mismatch1nI[rtype[type[s]]][S1[s][i-1]][S2[s][j+1]]+iext_ass+iext_ass+2*extension_cost;
+        c_iny  +=P->mismatch1nI[rtype[type[s]]][S1[s][i-1]][S2[s][j+1]]+iext_ass+iext_ass+2*extension_cost;
+        int bAU;
+        bAU=(type[s]>2?P->TerminalAU:0);
+        c_bx   +=2*extension_cost+bext+bAU;
+        c_by   +=2*extension_cost+bext+bAU;
+      }
+      lc[idx][j] =MIN2(lc[idx][j],
+                       MIN2(c_stack,
+                            MIN2(c_10,
+                                 MIN2(c_01,
+                                      MIN2(c_11,
+                                           MIN2(c_21,
+                                                MIN2(c_12,
+                                                     MIN2(c_22,
+                                                          MIN2(c_23,
+                                                               MIN2(c_32,
+                                                                    MIN2(c_bx,
+                                                                         MIN2(c_by,
+                                                                              MIN2(c_in,
+                                                                                   MIN2(c_in2x,
+                                                                                        MIN2(c_in2y,
+                                                                                             MIN2(c_inx,c_iny)
+                                                                                             )
+                                                                                        )
+                                                                                   )
+                                                                              )
+                                                                         )
+                                                                    )
+                                                               )
+                                                          )
+                                                     )
+                                                )
+                                           )
+                                      )
+                                 )
+                            )
+                       );
+      lc[idx][j]-=psc;
+      temp=lc[idx][j];
+      for (s=0; s<n_seq; s++) {
+        temp+=E_ExtLoop(rtype[type[s]], S2[s][j-1],S1[s][i+1],P)+2*extension_cost;
+      }
+      if(min_colonne > temp){
+        min_colonne=temp;
+        min_j_colonne=j;
+      }
+    }
+    if(max>=min_colonne){
+            max=min_colonne;
+            max_pos=i;
+        max_pos_j=min_j_colonne;
+    }
+    position[i+delta]=min_colonne;min_colonne=INF;
+    position_j[i+delta]=min_j_colonne;
+    i++;
+  }
+  /* printf("MAX:%d ",max); */
+  for (s=0; s<n_seq; s++) {free(S1[s]);free(S2[s]);}
+  free(S1); free(S2);
+  if(max<threshold){
+    alifind_max(position, position_j, delta, threshold, alignment_length, s1, s2, extension_cost, fast);
+  }
+  aliplot_max(max, max_pos, max_pos_j,alignment_length, s1, s2, extension_cost,fast);
+  for (i=0; i<=4; i++) {free(lc[i]);free(lin[i]);free(lbx[i]);free(lby[i]);free(linx[i]);free(liny[i]);}
+  /* free(lc[0]);free(lin[0]);free(lbx[0]);free(lby[0]);free(linx[0]);free(liny[0]); */
+  free(lc);free(lin);free(lbx);free(lby);free(linx);free(liny);
+  free(position);
+  free(position_j);
+  free(type);
+  return NULL;
+}
+
+
+PRIVATE void alifind_max(const int *position, const int *position_j,
+                         const int delta, const int threshold, const int alignment_length,
+                         const char *s1[], const char *s2[],
+                         const int extension_cost, const int fast){
+  int n_seq=0;
+  for (n_seq=0; s1[n_seq]!=NULL; n_seq++);
+  int pos=n1-9;
+  if(fast==1){
+    while(10<pos--){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        int max;
+        max=position[pos+delta];
+        printf("target upper bound %d: query lower bound %d  (%5.2f) \n", pos-10, max_pos_j-10, ((double)max)/(n_seq*100));
+        pos=MAX2(10,pos+temp_min-delta);
+      }
+    }
+  }
+  else{
+    pos=n1-9;
+    while(pos-- > 10) {
+      /* printf("delta %d position:%d value:%d\n", delta, pos, position[pos]); */
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        /* printf("%d %d %d\n", pos, max_pos_j,position[pos+delta]); */
+        int begin_t=MAX2(11, pos-alignment_length+1);
+        int end_t  =MIN2(n1-10, pos+1);
+        int begin_q=MAX2(11, max_pos_j-1);
+        int end_q  =MIN2(n2-10, max_pos_j+alignment_length-1);
+        char **s3, **s4;
+        s3 = (char**) vrna_alloc(sizeof(char*)*(n_seq+1));
+        s4 = (char**) vrna_alloc(sizeof(char*)*(n_seq+1));
+        int i;
+        for(i=0; i<n_seq; i++){
+          s3[i] = (char*) vrna_alloc(sizeof(char)*(end_t-begin_t+2));
+          s4[i] = (char*) vrna_alloc(sizeof(char)*(end_q-begin_q+2));
+          strncpy(s3[i], (s1[i]+begin_t-1), end_t - begin_t +1);
+          strncpy(s4[i], (s2[i]+begin_q-1), end_q - begin_q +1);
+          s3[i][end_t - begin_t +1]='\0';
+          s4[i][end_q - begin_q +1]='\0';
+        }
+        duplexT test;
+        test = aliduplexfold((const char**)s3, (const char**)s4, extension_cost);
+        /* printf("test %d threshold %d",test.energy*100,(threshold/n_seq)); */
+        if(test.energy * 100 < (int) (threshold/n_seq)){
+          int l1=strchr(test.structure, '&')-test.structure;
+                   printf("%s %3d,%-3d : %3d,%-3d (%5.2f)\n", test.structure,
+                 begin_t -10 +test.i-l1,
+                 begin_t -10 +test.i-1,
+                 begin_q -10 + test.j - 1,
+                 begin_q-11 + test.j + (int)strlen(test.structure) -l1 -2 , test.energy);
+          pos=MAX2(10,pos+temp_min-delta);
+
+        }
+        for(i=0;i<n_seq;i++){
+          free(s3[i]);free(s4[i]);
+        }
+        free(s3);free(s4);
+        free(test.structure);
+      }
+    }
+  }
+}
+PRIVATE void aliplot_max(const int max, const int max_pos, const int max_pos_j, const int alignment_length, const char *s1[], const char *s2[], const int extension_cost, const int fast)
+{
+  int n_seq;
+  for (n_seq=0; !(s1[n_seq]==NULL); n_seq++);
+  n1 = strlen(s1[0]); /* get length of alignment */
+  n2 = strlen(s2[0]); /* get length of alignment */
+  if(fast==1){
+    printf("target upper bound %d: query lower bound %d (%5.2f)\n",
+           max_pos-10, max_pos_j-10, (double) ((double)max)/(100*n_seq));
+  }
+  else{
+    int begin_t=MAX2(11, max_pos-alignment_length+1);
+    int end_t  =MIN2(n1-10, max_pos+1);
+    int begin_q=MAX2(11, max_pos_j-1);
+    int end_q  =MIN2(n2-10, max_pos_j+alignment_length-1);
+    char **s3, **s4;
+    s3 = (char**) vrna_alloc(sizeof(char*)*(n_seq+1));
+    s4 = (char**) vrna_alloc(sizeof(char*)*(n_seq+1));
+    int i;
+    for(i=0; i<n_seq; i++){
+      s3[i] = (char*) vrna_alloc(sizeof(char)*(end_t-begin_t+2));
+      s4[i] = (char*) vrna_alloc(sizeof(char)*(end_q-begin_q+2));
+      strncpy(s3[i], (s1[i]+begin_t-1), end_t - begin_t +1);
+      strncpy(s4[i], (s2[i]+begin_q-1), end_q - begin_q +1);
+      s3[i][end_t - begin_t +1]='\0';
+      s4[i][end_q - begin_q +1]='\0';
+    }
+    duplexT test;
+    s3[n_seq]=s4[n_seq]=NULL;
+    test = aliduplexfold((const char**) s3,(const char**) s4, extension_cost);
+    int l1=strchr(test.structure, '&')-test.structure;
+    printf("%s %3d,%-3d : %3d,%-3d (%5.2f)\n",
+           test.structure,
+           begin_t -10 +test.i-l1,
+           begin_t -10 +test.i-1,
+           begin_q-10 + test.j - 1,
+           begin_q -11 + test.j + (int)strlen(test.structure) - l1 - 2,
+           test.energy);
+    for(i=0; i<n_seq ; i++){
+      free(s3[i]);free(s4[i]);
+    }
+    free(s3);free(s4);
+    free(test.structure);
+  }
+}
+
+PRIVATE duplexT aliduplexfold_XS(const char *s1[], const char *s2[],
+                                 const int **access_s1, const int **access_s2,
+                                 const int i_pos, const int j_pos, const int threshold,
+                                 const int i_flag, const int j_flag){
+  int i,j,s,p,q, Emin=INF, l_min=0, k_min=0;
+  char *struc;
+  short **S1,**S2;
+  int *type,*type2;
+  struc=NULL;
+  duplexT mfe;
+  vrna_md_t   md;
+  int n_seq;
+  n3 = (int) strlen(s1[0]);
+  n4 = (int) strlen(s2[0]);
+  for (s=0; s1[s]!=NULL; s++);
+  n_seq = s;
+  for (s=0; s2[s]!=NULL; s++);
+  /* printf("%d \n",i_pos); */
+
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    update_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  c = (int **) vrna_alloc(sizeof(int *) * (n3+1));
+  for (i=0; i<=n3; i++) c[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+  for (i=0; i<=n3; i++){
+    for(j=0;j<=n4;j++){
+      c[i][j]=INF;
+    }
+  }
+  S1 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  S2 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  for (s=0; s<n_seq; s++) {
+    if (strlen(s1[s]) != n3) vrna_message_error("uneqal seqence lengths");
+    if (strlen(s2[s]) != n4) vrna_message_error("uneqal seqence lengths");
+    S1[s] = encode_seq(s1[s]);
+    S2[s] = encode_seq(s2[s]);
+  }
+  type =  (int *) vrna_alloc(n_seq*sizeof(int));
+  type2 = (int *) vrna_alloc(n_seq*sizeof(int));
+  int type3, E, k,l;
+  i=n3-i_flag; j=1+j_flag;
+  for (s=0; s<n_seq; s++) {
+    type[s] = pair[S1[s][i]][S2[s][j]];
+  }
+  c[i][j] = n_seq*P->DuplexInit - covscore(type,n_seq);
+  for (s=0; s<n_seq; s++) if (type[s]==0) type[s]=7;
+  for (s=0; s<n_seq; s++) {
+    c[i][j]+=E_ExtLoop(rtype[type[s]], (j_flag ? S2[s][j-1] : -1) , (i_flag ? S1[s][i+1] : -1),  P);
+  }
+  k_min=i; l_min=j; Emin=c[i][j];
+  for (k=i; k>1 ; k--) {
+    if(k<i) c[k+1][0]=INF;
+    for (l=j; l<=n4-1; l++) {
+      if(!(k==i && l==j)){
+        c[k][l]=INF;
+      }
+      int psc2;
+      for(s=0;s<n_seq;s++){
+        type2[s] = pair[S1[s][k]][S2[s][l]];
+      }
+      psc2=covscore(type2, n_seq);
+      if (psc2<MINPSCORE) continue;
+      for (s=0; s<n_seq; s++) if (type2[s]==0) type2[s]=7;
+      for (p=k+1; p<= n3 -i_flag && p<k+MAXLOOP-1; p++) {
+        for (q = l-1; q >= 1+j_flag; q--) {
+          if (p-k+l-q-2>MAXLOOP) break;
+          for(E=s=0;s<n_seq;s++){
+            type3=pair[S1[s][p]][S2[s][q]];
+            if(type3==0) type3=7;
+            E += E_IntLoop(p-k-1, l-q-1, type2[s], rtype[type3],
+                           S1[s][k+1], S2[s][l-1], S1[s][p-1], S2[s][q+1],P);
+          }
+          c[k][l] = MIN2(c[k][l], c[p][q]+E);
+        }
+      }
+      c[k][l]-=psc2;
+      E = c[k][l];
+      E+=n_seq*(access_s1[i-k+1][i_pos]+access_s2[l-1][j_pos+(l-1)-1]);
+      for (s=0; s<n_seq; s++) {
+        E+=E_ExtLoop(type2[s], (k>1) ? S1[s][k-1] : -1, (l<n4) ? S2[s][l+1] : -1, P);
+      }
+      if (E<Emin) {
+        Emin=E; k_min=k; l_min=l;
+      }
+    }
+  }
+  if(Emin > threshold-1){
+    mfe.structure=NULL;
+    mfe.energy=INF;
+    for (i=0; i<=n3; i++) free(c[i]);
+    free(c);
+    for(i=0; i<=n_seq;i++){
+      free(S1[i]);
+      free(S2[i]);
+    }
+    free(S1); free(S2); /* free(SS1); free(SS2); */
+    free(type);free(type2);
+    return mfe;
+    } else{
+    struc = alibacktrack_XS(k_min, l_min,(const short int**)S1,(const short int**)S2,access_s1, access_s2,i_flag,j_flag);
+    }
+  int dx_5, dx_3, dy_5, dy_3,dGx,dGy;
+  dx_5=0; dx_3=0; dy_5=0; dy_3=0;dGx=0;dGy=0;
+  dGx =n_seq*(access_s1[i-k_min+1][i_pos]);dx_3=0; dx_5=0;
+  dGy =n_seq*access_s2[l_min-j+1][j_pos + (l_min-1)-1];
+  mfe.tb=i_pos -9 - i + k_min -1 -dx_5;
+  mfe.te=i_pos -9 -1 + dx_3;
+  mfe.qb=j_pos -9 -1 - dy_5;
+  mfe.qe=j_pos + l_min -3 -9 + dy_3;
+  mfe.ddG=(double) (Emin *0.01);
+  mfe.dG1=(double) (dGx*(0.01));
+  mfe.dG2=(double) (dGy*(0.01));
+  mfe.energy= mfe.ddG - mfe.dG1 - mfe.dG2;
+  mfe.structure = struc;
+  for (i=0; i<=n3; i++) free(c[i]);
+  free(c);
+  for(i=0; i<=n_seq;i++){
+    free(S1[i]);
+    free(S2[i]);
+  }
+  free(S1); free(S2); free(type);free(type2);
+  return mfe;
+}
+
+PRIVATE char *alibacktrack_XS(int i, int j, const short *S1[], const short *S2[],
+                              const int** access_s1, const int ** access_s2, const int i_flag, const int j_flag) {
+  int n3,n4,k, l, *type, type2, E, traced, i0, j0,s,n_seq,psc;
+  char *st1=NULL, *st2=NULL, *struc=NULL;
+
+  n3 = (int) S1[0][0];
+  n4 = (int) S2[0][0];
+  for (s=0; S1[s]!=NULL; s++);
+  n_seq = s;
+  for (s=0; S2[s]!=NULL; s++);
+  if (n_seq != s) vrna_message_error("unequal number of sequences in alibacktrack()\n");
+
+  st1 = (char *) vrna_alloc(sizeof(char)*(n3+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n4+1));
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+
+  i0=i;/*MAX2(i-1,1);*/j0=j;/*MIN2(j+1,n4);*/
+  while (i<=n3-i_flag && j>=1+j_flag) {
+    E = c[i][j]; traced=0;
+    st1[i-1] = '(';
+    st2[j-1] = ')';
+    for (s=0; s<n_seq; s++) {
+      type[s] = pair[S1[s][i]][S2[s][j]];
+    }
+    psc = covscore(type,n_seq);
+    for (s=0; s<n_seq; s++) if (type[s]==0) type[s] = 7;
+    E += psc;
+    for (k=i+1; k<=n3 && k>i-MAXLOOP-2; k++) {
+      for (l=j-1; l>=1; l--) {
+        int LE;
+        if (i-k+l-j-2>MAXLOOP) break;
+        for (s=LE=0; s<n_seq; s++) {
+          type2 = pair[S1[s][k]][S2[s][l]];
+          if (type2==0) type2=7;
+          LE += E_IntLoop(k-i-1, j-l-1, type[s], rtype[type2],
+                          S1[s][i+1], S2[s][j-1], S1[s][k-1], S2[s][l+1],P);
+        }
+        if (E == c[k][l]+LE) {
+          traced=1;
+          i=k; j=l;
+          break;
+        }
+      }
+      if (traced) break;
+    }
+    if (!traced) {
+      for (s=0; s<n_seq; s++) {
+        if (type[s]>2) E -= P->TerminalAU;
+      }
+      break;
+      if (E != n_seq*P->DuplexInit) {
+        vrna_message_error("backtrack failed in fold duplex bal");
+      } else break;
+    }
+  }
+  struc = (char *) vrna_alloc(i-i0+1+j0-j+1+2);
+  for (k=MAX2(i0,1); k<=i; k++) if (!st1[k-1]) st1[k-1] = '.';
+  for (k=j; k<=j0; k++) if (!st2[k-1]) st2[k-1] = '.';
+  strcpy(struc, st1+MAX2(i0-1,0)); strcat(struc, "&");
+  strcat(struc, st2+j-1);
+  free(st1);
+  free(st2);
+  free(type);
+  return struc;
+}
+
+duplexT** aliLduplexfold_XS(const char*s1[], const char* s2[], const int **access_s1, const int **access_s2, const int threshold, const int alignment_length, const int delta,  const int fast,const int il_a, const int il_b, const int b_a, const int b_b)
+{
+  short **S1, **S2;
+  int *type,type2;
+  int i, j,s,n_seq;
+  s=0;
+  int bopen=b_b;
+  int bext=b_a;
+  int iopen=il_b;
+  int iext_s=2*(il_a);/* iext_s 2 nt nucleotide extension of interior loop, on i and j side */
+  int iext_ass=50+il_a;/* iext_ass assymetric extension of interior loop, either on i or on j side. */
+  int min_colonne=INF; /* enthaelt das maximum einer kolonne */
+  int i_length;
+  int max_pos;/* get position of the best hit */
+  int max_pos_j;
+  int temp;
+  int min_j_colonne;
+  int max=INF;
+  /* FOLLOWING NEXT 4 LINE DEFINES AN ARRAY CONTAINING POSITION OF THE SUBOPT IN S1 */
+  int *position; /* contains the position of the hits with energy > E */
+  int *position_j;
+  int maxPenalty[4];
+
+  n1 = (int) strlen(s1[0]);
+  n2 = (int) strlen(s2[0]);
+  for (s=0; s1[s]; s++);
+  n_seq = s;
+  for (s=0; s2[s]; s++);
+  if (n_seq != s) vrna_message_error("unequal number of sequences in aliduplexfold()\n");
+
+  position = (int *) vrna_alloc((delta+(n1)+4+delta) * sizeof(int));
+  position_j= (int *) vrna_alloc((delta+(n1)+4+delta) * sizeof(int));
+
+  /**
+  *** extension penalty, computed only once, further reduce the computation time
+  **/
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)){
+    update_dfold_params();
+  }
+  maxPenalty[0]=(int) -1*P->stack[2][2]/2;
+  maxPenalty[1]=(int) -1*P->stack[2][2];
+  maxPenalty[2]=(int) -3*P->stack[2][2]/2;
+  maxPenalty[3]=(int) -2*P->stack[2][2];
+
+
+  lc   = (int**) vrna_alloc(sizeof(int *) * 5);
+  lin  = (int**) vrna_alloc(sizeof(int *) * 5);
+  lbx  = (int**) vrna_alloc(sizeof(int *) * 5);
+  lby  = (int**) vrna_alloc(sizeof(int *) * 5);
+  linx = (int**) vrna_alloc(sizeof(int *) * 5);
+  liny = (int**) vrna_alloc(sizeof(int *) * 5);
+
+  for (i=0; i<=4; i++){
+    lc[i]  = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lin[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lbx[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lby[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    linx[i]= (int *) vrna_alloc(sizeof(int) * (n2+5));
+    liny[i]= (int *) vrna_alloc(sizeof(int) * (n2+5));
+  }
+
+
+  S1 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  S2 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  for (s=0; s<n_seq; s++) {
+    if (strlen(s1[s]) != n1) vrna_message_error("uneqal seqence lengths");
+    if (strlen(s2[s]) != n2) vrna_message_error("uneqal seqence lengths");
+    S1[s] = encode_seq(s1[s]);
+    S2[s] = encode_seq(s2[s]);
+  }
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+  /**
+  *** array initialization
+  **/
+
+  for(j=n2+4;j>=0;j--) {
+    lbx[0][j]=lbx[1][j]=lbx[2][j]=lbx[3][j]    = lbx[4][j] =INF;
+    lin[0][j]=lin[1][j]=lin[2][j]=lin[3][j]    = lin[4][j] =INF;
+    lc[0][j] =lc[1][j] =lc[2][j] = lc[3][j]    =  lc[4][j] =INF;
+    lby[0][j]=lby[1][j]=lby[2][j]=lby[3][j]    = lby[4][j] =INF;
+    liny[0][j]=liny[1][j]=liny[2][j]=liny[3][j]=liny[4][j]=INF;
+    linx[0][j]=linx[1][j]=linx[2][j]=linx[3][j]=linx[4][j]=INF;
+  }
+  i=10;
+  i_length= n1 - 9 ;
+  int di1,di2,di3,di4; /* contains accessibility penalty */
+  while(i < i_length) {
+    int idx=i%5;
+    int idx_1=(i-1)%5;
+    int idx_2=(i-2)%5;
+    int idx_3=(i-3)%5;
+    int idx_4=(i-4)%5;
+
+    di1 = access_s1[5][i]   - access_s1[4][i-1];
+    di2 = access_s1[5][i-1] - access_s1[4][i-2] + di1;
+    di3 = access_s1[5][i-2] - access_s1[4][i-3] + di2;
+    di4 = access_s1[5][i-3] - access_s1[4][i-4] + di3;
+    di1=MIN2(di1,maxPenalty[0]);
+    di2=MIN2(di2,maxPenalty[1]);
+    di3=MIN2(di3,maxPenalty[2]);
+    di4=MIN2(di3,maxPenalty[3]);
+    j=n2-9;
+    while (9 < --j) {
+      int dj1,dj2,dj3,dj4;
+      dj1 = access_s2[5][j+4] - access_s2[4][j+4];
+      dj2 = access_s2[5][j+5] - access_s2[4][j+5] + dj1;
+      dj3 = access_s2[5][j+6] - access_s2[4][j+6] + dj2;
+      dj4 = access_s2[5][j+7] - access_s2[4][j+7] + dj3;
+      dj1=MIN2(dj1,maxPenalty[0]);
+      dj2=MIN2(dj2,maxPenalty[1]);
+      dj3=MIN2(dj3,maxPenalty[2]);
+      dj4=MIN2(dj4,maxPenalty[3]);
+      int psc;
+      for (s=0; s<n_seq; s++) { /* initialize type1 */
+        type[s] = pair[S1[s][i]][S2[s][j]];
+      }
+      psc = covscore(type, n_seq);
+      for (s=0; s<n_seq; s++) if (type[s]==0) type[s]=7;
+      lc[idx][j] = ((psc >= MINPSCORE) ? n_seq*(P->DuplexInit) : INF);
+      int c_stack, c_10, c_01, c_11, c_22, c_21, c_12, c_23, c_32, c_in, c_in2x, c_in2y, c_bx, c_by, c_inx, c_iny;  /* matrix c */
+      int in,  in_x, in_y, in_xy; /*  in begin, in_x assymetric, in_y assymetric, in_xy symetric; */
+      int inx, inx_x;
+      int iny, iny_y;
+      int bx,  bx_x;
+      int by,  by_y;
+      in=lc[idx_1][j+1]; in_x=lin[idx_1][j]; in_y=lin[idx][j+1]; in_xy=lin[idx_1][j+1];
+      inx=lc[idx_1][j+1]; inx_x=linx[idx_1][j];
+      iny=lc[idx_1][j+1]; iny_y=liny[idx][j+1];
+      bx=lc[idx_1][j]; bx_x=lbx[idx_1][j];
+      by=lc[idx][j+1]; by_y=lby[idx][j+1];
+      c_stack=lc[idx_1][j+1]; c_01=lc[idx_1][j+2];c_10=lc[idx_2][j+1];
+      c_12=lc[idx_2][j+3];c_21=lc[idx_3][j+2];c_11=lc[idx_2][j+2];
+      c_22=lc[idx_3][j+3];c_32=lc[idx_4][j+3];c_23=lc[idx_3][j+4];
+      c_in=lin[idx_3][j+3];c_in2x=lin[idx_4][j+2];c_in2y=lin[idx_2][j+4];
+      c_inx=linx[idx_3][j+1]; c_iny=liny[idx_1][j+3];
+      c_bx=lbx[idx_2][j+1];c_by=lby[idx_1][j+2];
+      for (s=0; s<n_seq; s++) {
+        type2 = pair[S2[s][j+1]][S1[s][i-1]];
+        in   +=P->mismatchI[type2][S2[s][j]][S1[s][i]]+iopen+iext_s+di1+dj1;
+        in_x +=iext_ass+di1;
+        in_y +=iext_ass+dj1;
+        in_xy+=iext_s+di1+dj1;
+        inx  +=P->mismatch1nI[type2][S2[s][j]][S1[s][i]]+iopen+iext_s+di1+dj1;
+        inx_x+=iext_ass+di1;
+        iny  +=P->mismatch1nI[type2][S2[s][j]][S1[s][i]]+iopen+iext_s+di1+dj1;
+        iny_y+=iext_ass+dj1;
+        type2=pair[S2[s][j]][S1[s][i-1]];
+        bx   +=bopen+bext+(type2>2?P->TerminalAU:0)+di1;
+        bx_x +=bext+di1;
+        type2=pair[S2[s][j+1]][S1[s][i]];
+        by   +=bopen+bext+(type2>2?P->TerminalAU:0)+dj1;
+        by_y +=bext+dj1;
+      }
+      lin[idx][j]=MIN2(in, MIN2(in_x, MIN2(in_y, in_xy)));
+      linx[idx][j]=MIN2(inx_x, inx);
+      liny[idx][j]=MIN2(iny_y, iny);
+      lby[idx][j]=MIN2(by, by_y);
+      lbx[idx][j]=MIN2(bx, bx_x);
+      if (psc<MINPSCORE) continue;
+      for (s=0; s<n_seq; s++) {
+        lc[idx][j]+=E_ExtLoop(type[s], S1[s][i-1],S2[s][j+1],P);
+      }
+      for (s=0; s<n_seq; s++) {
+        type2=pair[S1[s][i-1]][S2[s][j+1]];if (type2==0) type2=7;
+        c_stack+=E_IntLoop(0,0,type2, rtype[type[s]],S1[s][i], S2[s][j], S1[s][i-1], S2[s][j+1], P)+di1+dj1;
+        type2=pair[S1[s][i-1]][S2[s][j+2]];if (type2==0) type2=7;
+        c_01   +=E_IntLoop(0,1,type2, rtype[type[s]],S1[s][i], S2[s][j+1], S1[s][i-1], S2[s][j+1], P)+di1+dj2;
+        type2=pair[S1[s][i-2]][S2[s][j+1]];if (type2==0) type2=7;
+        c_10   +=E_IntLoop(1,0,type2, rtype[type[s]],S1[s][i-1], S2[s][j], S1[s][i-1], S2[s][j+1], P)+di2+dj1;
+        type2=pair[S1[s][i-2]][S2[s][j+2]];if (type2==0) type2=7;
+        c_11   +=E_IntLoop(1,1,type2, rtype[type[s]],S1[s][i-1], S2[s][j+1], S1[s][i-1], S2[s][j+1], P)+di2+dj2;
+        type2=pair[S1[s][i-3]][S2[s][j+3]];if (type2==0) type2=7;
+        c_22   +=E_IntLoop(2,2,type2, rtype[type[s]],S1[s][i-2], S2[s][j+2], S1[s][i-1], S2[s][j+1], P)+di3+dj3;
+        type2= pair[S1[s][i-3]][S2[s][j+2]];if (type2==0) type2=7;
+        c_21   +=E_IntLoop(2,1,type2, rtype[type[s]],S1[s][i-2], S2[s][j+1], S1[s][i-1], S2[s][j+1], P)+di3+dj2;
+        type2= pair[S1[s][i-2]][S2[s][j+3]];if (type2==0) type2=7;
+        c_12   +=E_IntLoop(1,2,type2, rtype[type[s]],S1[s][i-1], S2[s][j+2], S1[s][i-1], S2[s][j+1], P)+di2+dj3;
+        type2 = pair[S1[s][i-4]][S2[s][j+3]];if (type2==0) type2=7;
+        c_32   +=E_IntLoop(3,2,type2, rtype[type[s]],S1[s][i-3], S2[s][j+2], S1[s][i-1], S2[s][j+1], P)+di4+dj3;
+        type2 = pair[S1[s][i-3]][S2[s][j+4]];if (type2==0) type2=7;
+        c_23   +=E_IntLoop(2,3,type2, rtype[type[s]],S1[s][i-2], S2[s][j+3], S1[s][i-1], S2[s][j+1], P)+dj4+di3;
+        c_in   +=P->mismatchI[rtype[type[s]]][S1[s][i-1]][S2[s][j+1]]+di3+dj3+2*iext_s;
+        c_in2x +=P->mismatchI[rtype[type[s]]][S1[s][i-1]][S2[s][j+1]]+iext_s+2*iext_ass+di4+dj2;
+        c_in2y +=P->mismatchI[rtype[type[s]]][S1[s][i-1]][S2[s][j+1]]+iext_s+2*iext_ass+di2+dj4;
+        c_inx  +=P->mismatch1nI[rtype[type[s]]][S1[s][i-1]][S2[s][j+1]]+iext_ass+iext_ass+di3+dj1;
+        c_iny  +=P->mismatch1nI[rtype[type[s]]][S1[s][i-1]][S2[s][j+1]]+iext_ass+iext_ass+di1+dj3;
+        int bAU;
+        bAU=(type[s]>2?P->TerminalAU:0);
+        c_bx   +=di2+dj1+bext+bAU;
+        c_by   +=di1+dj2+bext+bAU;
+      }
+      lc[idx][j] =MIN2(lc[idx][j],
+                       MIN2(c_stack,
+                            MIN2(c_10,
+                                 MIN2(c_01,
+                                      MIN2(c_11,
+                                           MIN2(c_21,
+                                                MIN2(c_12,
+                                                     MIN2(c_22,
+                                                          MIN2(c_23,
+                                                               MIN2(c_32,
+                                                                    MIN2(c_bx,
+                                                                         MIN2(c_by,
+                                                                              MIN2(c_in,
+                                                                                   MIN2(c_in2x,
+                                                                                        MIN2(c_in2y,
+                                                                                             MIN2(c_inx,c_iny)
+                                                                                             )
+                                                                                        )
+                                                                                   )
+                                                                              )
+                                                                         )
+                                                                    )
+                                                               )
+                                                          )
+                                                     )
+                                                )
+                                           )
+                                      )
+                                 )
+                            )
+                       );
+      lc[idx][j]-=psc;
+      temp=lc[idx][j];
+
+      for (s=0; s<n_seq; s++) {
+        temp+=E_ExtLoop(rtype[type[s]], S2[s][j-1],S1[s][i+1],P);
+      }
+      if(min_colonne > temp){
+        min_colonne=temp;
+        min_j_colonne=j;
+      }
+    }
+    if(max>=min_colonne){
+            max=min_colonne;
+            max_pos=i;
+        max_pos_j=min_j_colonne;
+    }
+    position[i+delta]=min_colonne;min_colonne=INF;
+    position_j[i+delta]=min_j_colonne;
+    i++;
+  }
+  /* printf("MAX: %d",max); */
+  for (s=0; s<n_seq; s++) {free(S1[s]);free(S2[s]);}
+  free(S1); free(S2);
+  if(max<threshold){
+    alifind_max_XS(position, position_j, delta, threshold, alignment_length, s1, s2,access_s1,access_s2, fast);
+  }
+  aliplot_max_XS(max, max_pos, max_pos_j,alignment_length, s1, s2, access_s1, access_s2, fast);
+  for (i=0; i<=4; i++) {free(lc[i]);free(lin[i]);free(lbx[i]);free(lby[i]);free(linx[i]);free(liny[i]);}
+  /* free(lc[0]);free(lin[0]);free(lbx[0]);free(lby[0]);free(linx[0]);free(liny[0]); */
+  free(lc);free(lin);free(lbx);free(lby);free(linx);free(liny);
+  free(position);
+  free(position_j);
+  free(type);
+  return NULL;
+}
+
+
+
+
+PRIVATE void alifind_max_XS(const int *position, const int *position_j,
+                                const int delta, const int threshold, const int alignment_length,
+                                const char *s1[], const char *s2[],
+                                const int **access_s1, const int **access_s2, const int fast){
+
+  int n_seq=0;
+  for (n_seq=0; s1[n_seq]!=NULL; n_seq++);
+  int pos=n1-9;
+  if(fast==1){
+    while(10 < pos--){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        /*
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        int max;
+        max=position[pos+delta];
+        printf("target upper bound %d: query lower bound %d  (%5.2f) \n", pos-10, max_pos_j-10, ((double)max)/100);
+        */
+        pos=MAX2(10,pos+temp_min-delta);
+      }
+    }
+  }
+  else{
+    pos=n1-9;
+    while( pos-- > 10 ) {
+      /* printf("delta %d position:%d value:%d\n", delta, pos, position[pos]); */
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+           if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta]; /* position on j */
+        int begin_t=MAX2(11, pos-alignment_length);
+        int end_t  =MIN2(n1-10, pos+1);
+        int begin_q=MAX2(11, max_pos_j-1);
+        int end_q  =MIN2(n2-10, max_pos_j+alignment_length-1);
+        int i_flag;
+        int j_flag;
+        i_flag = (end_t   ==  pos+1?1:0);
+        j_flag = (begin_q == max_pos_j-1?1:0);
+        char **s3, **s4;
+        s3 = (char**) vrna_alloc(sizeof(char*)*(n_seq+1));
+        s4 = (char**) vrna_alloc(sizeof(char*)*(n_seq+1));
+        int i;
+        for(i=0; i<n_seq; i++){
+          s3[i] = (char*) vrna_alloc(sizeof(char)*(end_t-begin_t+2));
+          s4[i] = (char*) vrna_alloc(sizeof(char)*(end_q-begin_q+2));
+          strncpy(s3[i], (s1[i]+begin_t), end_t - begin_t +1);
+          strncpy(s4[i], (s2[i]+begin_q), end_q - begin_q +1);
+          s3[i][end_t - begin_t +1]='\0';
+          s4[i][end_q - begin_q +1]='\0';
+        }
+        duplexT test;
+        test = aliduplexfold_XS((const char**) s3, (const char**) s4, access_s1, access_s2,pos, max_pos_j,threshold,i_flag,j_flag);
+        /*         printf("position %d approximation %d test %d threshold %d\n", pos, position[pos+delta], (int)test.energy,(int)(threshold/n_seq)); */
+        if(test.energy*100  < (int) (threshold/n_seq)){
+        printf("%s %3d,%-3d: %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f)\n", test.structure,
+               test.tb,test.te,test.qb,test.qe, test.ddG/n_seq, test.energy/n_seq, test.dG1/n_seq, test.dG2/n_seq);
+        free(test.structure);
+	pos=MAX2(10,pos+temp_min-delta);
+        }
+        for(i=0;i<n_seq;i++){
+          free(s3[i]);free(s4[i]);
+        }
+        free(s3);free(s4);
+        /* free(test.structure); */
+      }
+
+    }
+  }
+}
+
+PRIVATE void aliplot_max_XS(const int max, const int max_pos, const int max_pos_j,const int alignment_length,
+                            const char *s1[], const char* s2[],const int **access_s1, const int **access_s2,
+                            const int fast){
+
+  int n_seq;
+  for (n_seq=0; !(s1[n_seq]==NULL); n_seq++);
+  n1 = strlen(s1[0]); /* get length of alignment */
+  n2 = strlen(s2[0]); /* get length of alignme */
+
+  if(fast){
+    printf("target upper bound %d: query lower bound %d (%5.2f)\n",
+           max_pos-10, max_pos_j-10, (double) ((double)max)/(100*n_seq));
+  }
+  else{
+    int begin_t=MAX2(11, max_pos-alignment_length); /* only get the position that binds.. */
+    int end_t  =MIN2(n1-10, max_pos+1);              /* ..no dangles */
+    int begin_q=MAX2(11, max_pos_j-1);
+    int end_q  =MIN2(n2-10, max_pos_j+alignment_length-1);
+    int i_flag;
+    int j_flag;
+    i_flag = (end_t   == max_pos+1?1:0);
+    j_flag = (begin_q == max_pos_j-1?1:0);
+    char **s3, **s4;
+    s3 = (char**) vrna_alloc(sizeof(char*)*(n_seq+1));
+    s4 = (char**) vrna_alloc(sizeof(char*)*(n_seq+1));
+    int i;
+    for(i=0; i<n_seq; i++){
+      s3[i] = (char*) vrna_alloc(sizeof(char)*(end_t-begin_t+2));
+      s4[i] = (char*) vrna_alloc(sizeof(char)*(end_q-begin_q+2));
+      strncpy(s3[i], (s1[i]+begin_t), end_t - begin_t +1);
+      strncpy(s4[i], (s2[i]+begin_q), end_q - begin_q +1);
+      s3[i][end_t - begin_t +1]='\0';
+      s4[i][end_q - begin_q +1]='\0';
+    }
+    duplexT test;
+    test = aliduplexfold_XS((const char**) s3, (const char**) s4, access_s1, access_s2,max_pos, max_pos_j,INF,i_flag,j_flag);
+    printf("%s %3d,%-3d: %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f)\n", test.structure,
+           test.tb,test.te,test.qb,test.qe, test.ddG/n_seq, test.energy/n_seq, test.dG1/n_seq, test.dG2/n_seq);
+    free(test.structure);
+    for(i=0;i<n_seq;i++){
+      free(s3[i]);free(s4[i]);
+    }
+    free(s3);free(s4);
+  }
+}
+
+PRIVATE int covscore(const int *types, int n_seq) {
+  /* calculate co-variance bonus for a pair depending on  */
+  /* compensatory/consistent mutations and incompatible seqs */
+  /* should be 0 for conserved pairs, >0 for good pairs      */
+#define NONE -10000 /* score for forbidden pairs */
+  int k,l,s,score, pscore;
+  int dm[7][7]={{0,0,0,0,0,0,0}, /* hamming distance between pairs */
+                {0,0,2,2,1,2,2} /* CG */,
+                {0,2,0,1,2,2,2} /* GC */,
+                {0,2,1,0,2,1,2} /* GU */,
+                {0,1,2,2,0,2,1} /* UG */,
+                {0,2,2,1,2,0,2} /* AU */,
+                {0,2,2,2,1,2,0} /* UA */};
+
+  int pfreq[8]={0,0,0,0,0,0,0,0};
+  for (s=0; s<n_seq; s++)
+    pfreq[types[s]]++;
+
+  if (pfreq[0]*2>n_seq) return NONE;
+  for (k=1,score=0; k<=6; k++) /* ignore pairtype 7 (gap-gap) */
+    for (l=k+1; l<=6; l++)
+      /* scores for replacements between pairtypes    */
+      /* consistent or compensatory mutations score 1 or 2  */
+      score += pfreq[k]*pfreq[l]*dm[k][l];
+
+  /* counter examples score -1, gap-gap scores -0.25   */
+  pscore = cv_fact *
+    ((UNIT*score)/n_seq - nc_fact*UNIT*(pfreq[0] + pfreq[7]*0.25));
+  return pscore;
+}
+
+
+PRIVATE void update_dfold_params(void)
+{
+  vrna_md_t md;
+  if(P) free(P);
+  set_model_details(&md);
+  P = vrna_params(&md);
+  make_pair_matrix();
+}
+
+
+
+PRIVATE short * encode_seq(const char *sequence) {
+  unsigned int i,l;
+  short *S;
+  l = strlen(sequence);
+  S = (short *) vrna_alloc(sizeof(short)*(l+2));
+  S[0] = (short) l;
+
+  /* make numerical encoding of sequence */
+  for (i=1; i<=l; i++)
+    S[i]= (short) encode_char(toupper(sequence[i-1]));
+
+  /* for circular folding add first base at position n+1 */
+  S[l+1] = S[1];
+
+  return S;
+}
diff --git a/C/ViennaRNA/ali_plex.h b/C/ViennaRNA/ali_plex.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/ali_plex.h
@@ -0,0 +1,40 @@
+#ifndef VIENNA_RNA_PACKAGE_ALI_PLEX_H
+#define VIENNA_RNA_PACKAGE_ALI_PLEX_H
+
+#include <ViennaRNA/data_structures.h>
+/**
+*** aliLduplexfold computes the duplexes between two alignments
+**/
+duplexT** aliLduplexfold( const char *s1[],
+                          const char *s2[],
+                          const int threshold,
+                          const int extension_cost,
+                          const int alignment_length,
+                          const int delta,
+                          const int fast,
+                          const int il_a,
+                          const int il_b,
+                          const int b_a,
+                          const int b_b);
+/**
+*** aliLduplexfold computes the duplexes between two alignments. It also takes the average accessibility into account
+**/
+duplexT** aliLduplexfold_XS(const char* s1[],
+                            const char* s2[],
+                            const int **access_s1,
+                            const int **access_s2, 
+                            const int threshold,
+                            const int alignment_length,
+                            const int delta,
+                            const int fast,
+                            const int il_a,
+                            const int il_b,
+                            const int b_a,
+                            const int b_b);
+
+/*
+extern duplexT aliduplexfold(const char *s1[], const char *s2[], const int extension_cost);
+extern duplexT aliduplexfold_XS(const char *s1[], const char *s2[],const int **access_s1, 
+const int **access_s2, const int i_pos, const int j_pos, const int threshold);
+*/
+#endif
diff --git a/C/ViennaRNA/alicircfold.inc b/C/ViennaRNA/alicircfold.inc
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/alicircfold.inc
@@ -0,0 +1,148 @@
+/* -*-C-*- */
+/* this file contains code for alifolding circular RNAs */
+/* it's #include'd into alifold.c */
+
+PRIVATE void
+fill_arrays_comparative_circ( vrna_fold_compound_t *vc,
+                              sect bt_stack[],
+                              int *bt){
+
+  /* variant of alifold() for circular RNAs */
+  /* auxiliarry arrays:
+     fM2 = multiloop region with exactly two stems, extending to 3' end
+     for stupid dangles=1 case we also need:
+     fM_d3 = multiloop region with >= 2 stems, starting at pos 2
+             (a pair (k,n) will form 3' dangle with pos 1)
+     fM_d5 = multiloop region with >= 2 stems, extending to pos n-1
+             (a pair (1,k) will form a 5' dangle with pos n)
+  */
+  int               Fc, FcH, FcI, FcM, Hi, Hj, Ii, Ij, Ip, Iq, ip, iq, Mi, FcMd3, FcMd5;
+  int               i, j, ij, u, length, new_c, fm, n_seq, s;
+  int               *indx, *c, *fML, *fM2;
+  char              *hard_constraints;
+  unsigned short    **a2s;
+  vrna_param_t      *P;
+  vrna_hc_t         *hc;
+  vrna_sc_t         **sc;
+
+  a2s               = vc->a2s;
+  P                 = vc->params;
+  indx              = vc->jindx;     /* index for moving in the triangle matrices c[] and fMl[]*/
+  c                 = vc->matrices->c;     /* energy array, given that i-j pair */
+  fML               = vc->matrices->fML;     /* multi-loop auxiliary energy array */
+  fM2               = vc->matrices->fM2;
+  hc                = vc->hc;
+  sc                = vc->scs;
+  hard_constraints  = hc->matrix;
+  n_seq             = vc->n_seq;
+  length            = vc->length;
+
+  /* extra arrays for circfold() */
+  FcH = FcI= FcM = FcMd3= FcMd5= INF;
+
+  if(hc->up_ext[1] >= length){
+    Fc = 0;
+    if(sc){
+      for(s = 0; s < n_seq; s++){
+        if(sc[s]->energy_up)
+          Fc += sc[s]->energy_up[1][a2s[s][length] - 1];
+      }
+    }
+  } else {
+    Fc = INF;
+  }
+
+  for (i=1; i<length; i++)
+    for (j=i+TURN+1; j <= length; j++) {
+      u = length-j + i-1;
+      if (u<TURN) continue;
+
+      ij = indx[j]+i;
+
+      if (!hard_constraints[ij])
+        continue;
+
+      /* exterior hairpin case */
+      new_c =   vrna_E_hp_loop(vc, j, i)
+              + c[ij];
+
+      if (new_c<FcH) {
+        FcH = new_c;
+        Hi  = i;
+        Hj  = j;
+      }
+
+      /* exterior interior loop case */
+      ip = iq = 0;
+      new_c =   vrna_E_ext_int_loop(vc, i, j, &ip, &iq)
+              + c[ij];
+
+      if(ip != 0){
+        if(new_c < FcI){
+          FcI = new_c;
+          Ii  = i;
+          Ij  = j;
+          Ip  = ip;
+          Iq  = iq;
+        }
+      }
+    }
+  Fc = MIN2(Fc, FcH);
+  Fc = MIN2(Fc, FcI);
+
+  /* compute the fM2 array (multi loops with exactly 2 helices) */
+  /* to get a unique ML decomposition, just use fM1 instead of fML
+     below. However, that will not work with dangles==1  */
+  for (i=1; i<length-TURN; i++) {
+    fM2[i] = INF;
+    for (u=i+TURN; u<length-TURN; u++)
+      fM2[i] = MIN2(fM2[i], fML[indx[u]+i] + fML[indx[length]+u+1]);
+  }
+
+  for (i=TURN+1; i<length-2*TURN; i++) {
+    fm = fML[indx[i]+1]+fM2[i+1]+n_seq*P->MLclosing;
+    if (fm<FcM) {
+      FcM=fm; Mi=i;
+    }
+  }
+  Fc = MIN2(Fc, FcM);
+
+  if (FcH==Fc) {
+    bt_stack[++(*bt)].i = Hi;
+    bt_stack[(*bt)].j = Hj;
+    bt_stack[(*bt)].ml = 2;
+  }
+  else if (FcI==Fc) {
+    bt_stack[++(*bt)].i = Ii;
+    bt_stack[(*bt)].j = Ij;
+    bt_stack[(*bt)].ml = 2;
+    bt_stack[++(*bt)].i = Ip;
+    bt_stack[(*bt)].j = Iq;
+    bt_stack[(*bt)].ml = 2;
+  }
+  else if (FcM==Fc) { /* grumpf we found a Multiloop */
+    /* backtrack in fM2 */
+    fm = fM2[Mi+1];
+    for (u=Mi+TURN+1; u<length-TURN; u++)
+      if (fm == fML[indx[u]+Mi+1] + fML[indx[length]+u+1]) {
+        bt_stack[++(*bt)].i=Mi+1;
+        bt_stack[(*bt)].j=u;
+        bt_stack[(*bt)].ml = 1;
+        bt_stack[++(*bt)].i=u+1;
+        bt_stack[(*bt)].j=length;
+        bt_stack[(*bt)].ml = 1;
+        break;
+      }
+    bt_stack[++(*bt)].i = 1;
+    bt_stack[(*bt)].j = Mi;
+    bt_stack[(*bt)].ml = 1;
+  } else { /* must be totally unstructured */
+    bt_stack[++(*bt)].i = 1;
+    bt_stack[(*bt)].j = 1;
+    bt_stack[(*bt)].ml = 0;
+  }
+  vc->matrices->FcH = FcH;
+  vc->matrices->FcI = FcI;
+  vc->matrices->FcM = FcM;
+  vc->matrices->Fc  = Fc;
+}
diff --git a/C/ViennaRNA/alifold.c b/C/ViennaRNA/alifold.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/alifold.c
@@ -0,0 +1,307 @@
+/*
+                  minimum free energy folding
+                  for a set of aligned sequences
+
+                  c Ivo Hofacker
+
+                  Vienna RNA package
+*/
+
+/**
+*** \file alifold.c
+**/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/data_structures.h"
+#include "ViennaRNA/mfe.h"
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/eval.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/ribo.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/alifold.h"
+#include "ViennaRNA/aln_util.h"
+#include "ViennaRNA/loop_energies.h"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+#define MAXSECTORS        500     /* dimension for a backtrack array */
+
+/* some backward compatibility stuff */
+PRIVATE vrna_fold_compound_t  *backward_compat_compound = NULL;
+PRIVATE int                 backward_compat           = 0;
+
+#ifdef _OPENMP
+
+#pragma omp threadprivate(backward_compat_compound, backward_compat)
+
+#endif
+
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+PRIVATE float   wrap_alifold( const char **strings,
+                              char *structure,
+                              vrna_param_t *parameters,
+                              int is_constrained,
+                              int is_circular);
+#endif
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC float
+vrna_alifold( const char **strings,
+              char *structure){
+
+  float                 mfe;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vrna_md_set_default(&md);
+
+  vc  = vrna_fold_compound_comparative(strings, &md, VRNA_OPTION_DEFAULT);
+  mfe = vrna_mfe(vc, structure);
+
+  vrna_fold_compound_free(vc);
+
+  return mfe;
+}
+
+PUBLIC float
+vrna_circalifold( const char **sequences,
+                  char *structure){
+
+  float                 mfe;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vrna_md_set_default(&md);
+  md.circ = 1;
+
+  vc  = vrna_fold_compound_comparative(sequences, &md, VRNA_OPTION_DEFAULT);
+  mfe = vrna_mfe(vc, structure);
+
+  vrna_fold_compound_free(vc);
+
+  return mfe;
+}
+
+
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+PRIVATE float
+wrap_alifold( const char **strings,
+              char *structure,
+              vrna_param_t *parameters,
+              int is_constrained,
+              int is_circular){
+
+  vrna_fold_compound_t  *vc;
+  vrna_param_t          *P;
+  float                 mfe;
+
+#ifdef _OPENMP
+/* Explicitly turn off dynamic threads */
+  omp_set_dynamic(0);
+#endif
+
+  /* we need the parameter structure for hard constraints */
+  if(parameters){
+    P = vrna_params_copy(parameters);
+  } else {
+    vrna_md_t md;
+    set_model_details(&md);
+    md.temperature = temperature;
+    P = vrna_params(&md);
+  }
+  P->model_details.circ = is_circular;
+
+  vc = vrna_fold_compound_comparative(strings, &(P->model_details), VRNA_OPTION_DEFAULT);
+
+  if(parameters){ /* replace params if necessary */
+    free(vc->params);
+    vc->params = P;
+  } else {
+    free(P);
+  }
+
+  /* handle hard constraints in pseudo dot-bracket format if passed via simple interface */
+  if(is_constrained && structure)
+    vrna_constraints_add(vc, (const char *)structure, VRNA_CONSTRAINT_DB_DEFAULT);
+
+  if(backward_compat_compound && backward_compat)
+    vrna_fold_compound_free(backward_compat_compound);
+
+  backward_compat_compound  = vc;
+  backward_compat           = 1;
+
+  /* call mfe() function without backtracking */
+  mfe = vrna_mfe(vc, NULL);
+
+  /* backtrack structure */
+  if(structure && vc->params->model_details.backtrack){
+    char            *ss;
+    int             length;
+    sect            bt_stack[MAXSECTORS];
+    vrna_bp_stack_t *bp;
+
+    length  = vc->length;
+    bp      = (vrna_bp_stack_t *)vrna_alloc(sizeof(vrna_bp_stack_t) * (4*(1+length/2))); /* add a guess of how many G's may be involved in a G quadruplex */
+
+    vrna_backtrack_from_intervals(vc, bp, bt_stack, 0);
+
+    ss = vrna_db_from_bp_stack(bp, length);
+    strncpy(structure, ss, length + 1);
+    free(ss);
+
+    if(base_pair)
+      free(base_pair);
+    base_pair = bp;
+  }
+
+  return mfe;
+}
+
+
+PUBLIC void
+free_alifold_arrays(void){
+
+  if(backward_compat_compound && backward_compat){
+    vrna_fold_compound_free(backward_compat_compound);
+    backward_compat_compound  = NULL;
+    backward_compat           = 0;
+  }
+}
+
+PUBLIC float
+alifold(const char **strings,
+        char *structure){
+
+  return wrap_alifold(strings, structure, NULL, fold_constrained, 0);
+}
+
+PUBLIC float circalifold( const char **strings,
+                          char *structure) {
+
+  return wrap_alifold(strings, structure, NULL, fold_constrained, 1);
+}
+
+PUBLIC void 
+update_alifold_params(void){
+
+  vrna_fold_compound_t *v;
+
+  if(backward_compat_compound && backward_compat){
+    v = backward_compat_compound;
+
+    if(v->params)
+      free(v->params);
+
+    vrna_md_t md;
+    set_model_details(&md);
+    v->params = vrna_params(&md);
+  }
+}
+
+PUBLIC float
+energy_of_ali_gquad_structure(const char **sequences,
+                              const char *structure,
+                              int n_seq,
+                              float *energy){
+
+  unsigned int  n;
+  short         *pt;
+  int           *loop_idx;
+
+  if(sequences[0] != NULL){
+    
+    vrna_fold_compound_t  *vc;
+
+    vrna_md_t md;
+    set_model_details(&md);
+    md.gquad = 1;
+
+    vc = vrna_fold_compound_comparative(sequences, &md, VRNA_OPTION_EVAL_ONLY);
+
+    energy[0] = vrna_eval_structure(vc, structure);
+    energy[1] = vrna_eval_covar_structure(vc, structure);
+
+    vrna_fold_compound_free(vc);
+  }
+  else vrna_message_error("energy_of_alistruct(): no sequences in alignment!");
+
+  return energy[0];
+
+}
+
+PUBLIC  float
+energy_of_alistruct(const char **sequences,
+                    const char *structure,
+                    int n_seq,
+                    float *energy){
+
+  short         *pt;
+
+  if(sequences[0] != NULL){
+    vrna_fold_compound_t  *vc;
+
+    vrna_md_t md;
+    set_model_details(&md);
+
+    vc = vrna_fold_compound_comparative(sequences, &md, VRNA_OPTION_EVAL_ONLY);
+
+    energy[0] = vrna_eval_structure(vc, structure);
+    energy[1] = vrna_eval_covar_structure(vc, structure);
+
+    vrna_fold_compound_free(vc);
+  }
+  else vrna_message_error("energy_of_alistruct(): no sequences in alignment!");
+
+  return energy[0];
+}
+
+#endif
diff --git a/C/ViennaRNA/alifold.h b/C/ViennaRNA/alifold.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/alifold.h
@@ -0,0 +1,416 @@
+#ifndef VIENNA_RNA_PACKAGE_ALIFOLD_H
+#define VIENNA_RNA_PACKAGE_ALIFOLD_H
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+#include <ViennaRNA/ribo.h>
+#include <ViennaRNA/mfe.h>
+#include <ViennaRNA/part_func.h>
+#include <ViennaRNA/aln_util.h>
+#include <ViennaRNA/boltzmann_sampling.h>
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file alifold.h
+ *  @ingroup consensus_fold
+ *  @brief Functions for comparative structure prediction using RNA sequence alignments
+ *
+ */
+
+/*
+##############################################
+# MFE VARIANTS OF THE ALIFOLD IMPLEMENTATION #
+##############################################
+*/
+
+/**
+ *  @brief  Compute Minimum Free Energy (MFE), and a corresponding consensus secondary structure
+ *          for an RNA sequence alignment using a comparative method
+ *
+ *  @ingroup consensus_mfe_fold
+ *
+ *  This simplified interface to vrna_mfe() computes the MFE and, if required, a consensus secondary
+ *  structure for an RNA sequence alignment using default options. Memory required for dynamic programming
+ *  (DP) matrices will be allocated and free'd on-the-fly. Hence, after return of this function, the
+ *  recursively filled matrices are not available any more for any post-processing, e.g. suboptimal
+ *  backtracking, etc.
+ *
+ *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
+ *  you require other conditions than specified by the default model details, use vrna_mfe(),
+ *  and the data structure #vrna_fold_compound_t instead.
+ *
+ *  @see vrna_circalifold(), vrna_mfe(), vrna_fold_compound(), #vrna_fold_compound_t
+ *
+ *  @param sequences  RNA sequence alignment
+ *  @param structure  A pointer to the character array where the
+ *         secondary structure in dot-bracket notation will be written to
+ *  @return the minimum free energy (MFE) in kcal/mol
+ */
+float
+vrna_alifold( const char **sequences,
+              char *structure);
+
+/**
+ *  @brief  Compute Minimum Free Energy (MFE), and a corresponding consensus secondary structure
+ *          for a sequence alignment of circular RNAs using a comparative method
+ *
+ *  @ingroup consensus_mfe_fold
+ *
+ *  This simplified interface to vrna_mfe() computes the MFE and, if required, a consensus secondary
+ *  structure for an RNA sequence alignment using default options. Memory required for dynamic programming
+ *  (DP) matrices will be allocated and free'd on-the-fly. Hence, after return of this function, the
+ *  recursively filled matrices are not available any more for any post-processing, e.g. suboptimal
+ *  backtracking, etc.
+ *
+ *  Folding of circular RNA sequences is handled as a post-processing step of the forward
+ *  recursions. See @cite hofacker:2006 for further details.
+ *
+ *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
+ *  you require other conditions than specified by the default model details, use vrna_mfe(),
+ *  and the data structure #vrna_fold_compound_t instead.
+ *
+ *  @see vrna_alifold(), vrna_mfe(), vrna_fold_compound(), #vrna_fold_compound_t
+ *
+ *  @param sequences  Sequence alignment of circular RNAs
+ *  @param structure  A pointer to the character array where the
+ *         secondary structure in dot-bracket notation will be written to
+ *  @return the minimum free energy (MFE) in kcal/mol
+ */
+float
+vrna_circalifold( const char **sequences,
+                  char *structure);
+
+/*
+#############################################################
+# PARTITION FUNCTION VARIANTS OF THE ALIFOLD IMPLEMENTATION #
+#############################################################
+*/
+
+/**
+ *  @brief  Compute Partition function @f$Q@f$ (and base pair probabilities) for an RNA
+ *          sequence alignment using a comparative method
+ *
+ *  @ingroup consensus_pf_fold
+ *
+ *  This simplified interface to vrna_pf() computes the partition function and, if required,
+ *  base pair probabilities for an RNA sequence alignment using default options. Memory required for
+ *  dynamic programming (DP) matrices will be allocated and free'd on-the-fly. Hence, after return of
+ *  this function, the recursively filled matrices are not available any more for any post-processing.
+ *
+ *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
+ *  you require other conditions than specified by the default model details, use vrna_pf(),
+ *  and the data structure #vrna_fold_compound_t instead.
+ *
+ *  @see vrna_pf_circalifold(), vrna_pf(), vrna_fold_compound_comparative(), #vrna_fold_compound_t
+ *
+ *  @param sequences  RNA sequence alignment
+ *  @param structure  A pointer to the character array where position-wise pairing propensity
+ *                    will be stored. (Maybe NULL)
+ *  @param pl         A pointer to a list of #vrna_plist_t to store pairing probabilities (Maybe NULL)
+ *  @return The Gibbs free energy of the ensemble (@f$G = -RT \cdot \log(Q) @f$) in kcal/mol
+ */
+float vrna_pf_alifold(const char **sequences, char *structure, vrna_plist_t **pl);
+
+/**
+ *  @brief  Compute Partition function @f$Q@f$ (and base pair probabilities) for an alignment
+ *          of circular RNA sequences using a comparative method
+ *
+ *  @ingroup consensus_pf_fold
+ *
+ *  This simplified interface to vrna_pf() computes the partition function and, if required,
+ *  base pair probabilities for an RNA sequence alignment using default options. Memory required for
+ *  dynamic programming (DP) matrices will be allocated and free'd on-the-fly. Hence, after return of
+ *  this function, the recursively filled matrices are not available any more for any post-processing.
+ *
+ *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
+ *  you require other conditions than specified by the default model details, use vrna_pf(),
+ *  and the data structure #vrna_fold_compound_t instead.
+ *
+ *  Folding of circular RNA sequences is handled as a post-processing step of the forward
+ *  recursions. See @cite hofacker:2006 for further details.
+ *
+ *  @see vrna_pf_alifold(), vrna_pf(), vrna_fold_compound_comparative(), #vrna_fold_compound_t
+ *
+ *  @param sequences  Sequence alignment of circular RNAs
+ *  @param structure  A pointer to the character array where position-wise pairing propensity
+ *                    will be stored. (Maybe NULL)
+ *  @param pl         A pointer to a list of #vrna_plist_t to store pairing probabilities (Maybe NULL)
+ *  @return The Gibbs free energy of the ensemble (@f$G = -RT \cdot \log(Q) @f$) in kcal/mol
+ */
+float vrna_pf_circalifold(const char **sequences, char *structure, vrna_plist_t **pl);
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*
+#################################################
+# DEPRECATED FUNCTIONS                          #
+#################################################
+*/
+
+
+/**
+ *  @brief Compute MFE and according consensus structure of an alignment of sequences
+ * 
+ *  This function predicts the consensus structure for the aligned 'sequences'
+ *  and returns the minimum free energy; the mfe structure in bracket
+ *  notation is returned in 'structure'.
+ * 
+ *  Sufficient space must be allocated for 'structure' before calling
+ *  alifold().
+ * 
+ *  @ingroup consensus_mfe_fold
+ * 
+ *  @deprecated Usage of this function is discouraged! Use vrna_alifold(), or vrna_mfe() instead!
+ *  @see vrna_alifold(), vrna_mfe()
+ *
+ *  @param strings    A pointer to a NULL terminated array of character arrays
+ *  @param structure  A pointer to a character array that may contain a constraining consensus structure
+ *                    (will be overwritten by a consensus structure that exhibits the MFE)
+ *  @return           The free energy score in kcal/mol
+ */
+DEPRECATED(float alifold( const char **strings, char *structure));
+
+/**
+ *  @brief Compute MFE and according structure of an alignment of sequences assuming the sequences are circular instead of linear
+ * 
+ *  @ingroup consensus_mfe_fold
+ * 
+ *  @deprecated Usage of this function is discouraged! Use vrna_alicircfold(), and vrna_mfe() instead!
+ *  @see vrna_alicircfold(), vrna_alifold(), vrna_mfe()
+ * 
+ *  @param strings    A pointer to a NULL terminated array of character arrays
+ *  @param structure  A pointer to a character array that may contain a constraining consensus structure
+ *                    (will be overwritten by a consensus structure that exhibits the MFE)
+ *  @return           The free energy score in kcal/mol
+ */
+DEPRECATED(float circalifold( const char **strings, char *structure));
+
+/**
+ *  @brief Free the memory occupied by MFE alifold functions
+ * 
+ *  @deprecated Usage of this function is discouraged! It only
+ *  affects memory being free'd that was allocated by an old API
+ *  function before. Release of memory occupied by the newly introduced
+ *  #vrna_fold_compound_t is handled by vrna_vrna_fold_compound_free()
+ *
+ *  @see vrna_vrna_fold_compound_free()
+ *
+ *  @ingroup consensus_mfe_fold
+ * 
+ */
+DEPRECATED(void free_alifold_arrays(void));
+
+/**
+ *  @brief Calculate the free energy of a consensus structure given a set of aligned sequences
+ * 
+ *  @ingroup consensus_fold
+ *
+ *  @deprecated Usage of this function is discouraged! Use vrna_eval_structure(), and vrna_eval_covar_structure() instead!
+ *
+ *  @param  sequences   The NULL terminated array of sequences
+ *  @param  structure   The consensus structure
+ *  @param  n_seq       The number of sequences in the alignment
+ *  @param  energy      A pointer to an array of at least two floats that will hold the free energies
+ *                      (energy[0] will contain the free energy, energy[1] will be filled with the covariance energy term)
+ *  @returns free energy in kcal/mol
+ * 
+ */
+DEPRECATED(float energy_of_alistruct(const char **sequences, const char *structure, int n_seq, float *energy));
+
+DEPRECATED(float energy_of_ali_gquad_structure(const char **sequences, const char *structure, int n_seq, float *energy));
+
+/**
+ *  @brief This variable controls the weight of the covariance term in the
+ *  energy function of alignment folding algorithms
+ * 
+ *  @ingroup consensus_fold
+ *
+ *  @deprecated See #vrna_md_t.cv_fact, and vrna_mfe() to avoid using global variables
+ *
+ *  Default is 1.
+ */
+DEPRECATED(extern  double  cv_fact);
+/**
+ *  @brief This variable controls the magnitude of the penalty for non-compatible sequences in
+ *  the covariance term of alignment folding algorithms.
+ * 
+ *  @ingroup consensus_fold
+ * 
+ *  @deprecated See #vrna_md_t.nc_fact, and vrna_mfe() to avoid using global variables
+ *
+ *  Default is 1.
+ */
+DEPRECATED(extern  double  nc_fact);
+
+/**
+ *  @brief
+ * 
+ *  @ingroup consensus_pf_fold
+ * 
+ *  @deprecated Use vrna_pf() instead
+ *
+ *  @param  sequences
+ *  @param  structure
+ *  @param  pl
+ *  @param  parameters
+ *  @param  calculate_bppm
+ *  @param  is_constrained
+ *  @param  is_circular
+ *  @return
+ */
+DEPRECATED(float alipf_fold_par( const char **sequences,
+                      char *structure,
+                      vrna_plist_t **pl,
+                      vrna_exp_param_t *parameters,
+                      int calculate_bppm,
+                      int is_constrained,
+                      int is_circular));
+
+/**
+ *  @brief
+ * 
+ *  The partition function version of alifold() works in analogy to
+ *  pf_fold(). Pair probabilities and information about sequence
+ *  covariations are returned via the 'pi' variable as a list of
+ *  #vrna_pinfo_t structs. The list is terminated by the first entry with
+ *  pi.i = 0.
+ * 
+ *  @ingroup consensus_pf_fold
+ * 
+ *  @deprecated Use vrna_pf() instead
+ *
+ *  @param sequences
+ *  @param structure
+ *  @param pl
+ *  @return
+ */
+DEPRECATED(float alipf_fold( const char **sequences, char *structure, vrna_plist_t **pl));
+
+/**
+ *  @brief
+ * 
+ *  @ingroup consensus_pf_fold
+ *
+ *  @deprecated Use vrna_pf() instead
+ * 
+ *  @param sequences
+ *  @param structure
+ *  @param pl
+ *  @return
+ */
+DEPRECATED(float alipf_circ_fold(const char **sequences, char *structure, vrna_plist_t **pl));
+
+
+/**
+ *  @brief Get a pointer to the base pair probability array
+ * 
+ *  Accessing the base pair probabilities for a pair (i,j) is achieved by
+ *  @verbatim FLT_OR_DBL *pr = export_bppm(); pr_ij = pr[iindx[i]-j]; @endverbatim
+ * 
+ *  @ingroup consensus_pf_fold
+ *
+ *  @deprecated Usage of this function is discouraged! The new #vrna_fold_compound_t
+ *  allows direct access to the folding matrices, including the pair probabilities!
+ *  The pair probability array returned here reflects the one of the latest call
+ *  to vrna_pf(), or any of the old API calls for consensus structure
+ *  partition function folding.
+ * 
+ *  @see #vrna_fold_compound_t, vrna_fold_compound_comparative(), and vrna_pf()
+ *
+ *  @return A pointer to the base pair probability array
+ */
+DEPRECATED(FLT_OR_DBL *export_ali_bppm(void));
+
+/**
+ *  @brief Free the memory occupied by folding matrices allocated by alipf_fold, alipf_circ_fold, etc.
+ *
+ *  @ingroup consensus_pf_fold
+ * 
+ *  @deprecated Usage of this function is discouraged! This function only free's memory
+ *  allocated by old API function calls. Memory allocated by any of the new API calls (starting with vrna_)
+ *  will be not affected!
+ *
+ *  @see #vrna_fold_compound_t, vrna_vrna_fold_compound_free()
+ *
+ */
+DEPRECATED(void  free_alipf_arrays(void));
+
+/**
+ *  @brief Sample a consensus secondary structure from the Boltzmann ensemble according its probability
+ * 
+ *  @ingroup consensus_stochbt
+ *
+ *  @deprecated Use vrna_pbacktrack() instead!
+ *
+ *  @param  prob  to be described (berni)
+ *  @return       A sampled consensus secondary structure in dot-bracket notation
+ */
+DEPRECATED(char  *alipbacktrack(double *prob));
+
+/**
+ *  @brief Get pointers to (almost) all relavant arrays used in alifold's partition function computation
+ *
+ *  @ingroup consensus_fold
+ *
+ *  @note To obtain meaningful pointers, call alipf_fold first!
+ *
+ *  @see pf_alifold(), alipf_circ_fold()
+ *
+ *  @deprecated It is discouraged to use this function! The new #vrna_fold_compound_t allows
+ *  direct access to all necessary consensus structure prediction related variables!
+ *
+ *  @see #vrna_fold_compound_t, vrna_fold_compound_comparative(), vrna_pf()
+ *
+ *  @param S_p      A pointer to the 'S' array (integer representation of nucleotides)
+ *  @param S5_p     A pointer to the 'S5' array
+ *  @param S3_p     A pointer to the 'S3' array
+ *  @param a2s_p    A pointer to the pair type matrix
+ *  @param Ss_p     A pointer to the 'Ss' array
+ *  @param qb_p     A pointer to the Q<sup>B</sup> matrix
+ *  @param qm_p     A pointer to the Q<sup>M</sup> matrix
+ *  @param q1k_p    A pointer to the 5' slice of the Q matrix (@f$q1k(k) = Q(1, k)@f$)
+ *  @param qln_p    A pointer to the 3' slice of the Q matrix (@f$qln(l) = Q(l, n)@f$)
+ *  @param pscore   A pointer to the start of a pscore list
+ *  @return         Non Zero if everything went fine, 0 otherwise
+ */
+DEPRECATED(int get_alipf_arrays(short ***S_p,
+                     short ***S5_p,
+                     short ***S3_p,
+                     unsigned short ***a2s_p,
+                     char ***Ss_p,
+                     FLT_OR_DBL **qb_p,
+                     FLT_OR_DBL **qm_p,
+                     FLT_OR_DBL **q1k_p,
+                     FLT_OR_DBL **qln_p,
+                     short **pscore));
+
+
+/**
+ *  @brief Update the energy parameters for alifold function
+ *
+ *  Call this to recalculate the pair matrix and energy parameters after a
+ *  change in folding parameters like #temperature
+ *
+ *  @ingroup  consensus_fold
+ *  @deprecated Usage of this function is discouraged! The new API uses #vrna_fold_compound_t
+ *  to lump all folding related necessities together, including the energy parameters. Use
+ *  vrna_update_fold_params() to update the energy parameters within a #vrna_fold_compound_t.
+ */
+DEPRECATED(void update_alifold_params(void));
+
+#endif
+
+
+#endif
diff --git a/C/ViennaRNA/alipfold.c b/C/ViennaRNA/alipfold.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/alipfold.c
@@ -0,0 +1,345 @@
+/*
+                  partiton function and base pair probabilities
+                  for RNA secvondary structures
+                  of a set of aligned sequences
+
+                  Ivo L Hofacker
+                  Vienna RNA package
+*/
+
+/**
+*** \file alipfold.c
+**/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <float.h>    /* #defines FLT_MIN */
+#include <limits.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/PS_dot.h"
+#include "ViennaRNA/ribo.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/eval.h"
+#include "ViennaRNA/mfe.h"
+#include "ViennaRNA/part_func.h"
+#include "ViennaRNA/structure_utils.h"
+#include "ViennaRNA/alifold.h"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+/*
+#################################
+# PUBLIC GLOBAL VARIABLES       #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE GLOBAL VARIABLES      #
+#################################
+*/
+
+/* some backward compatibility stuff */
+PRIVATE vrna_fold_compound_t  *backward_compat_compound = NULL;
+PRIVATE int                   backward_compat           = 0;
+
+#ifdef _OPENMP
+
+#pragma omp threadprivate(backward_compat_compound, backward_compat)
+
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+PRIVATE float     wrap_alipf_fold(const char **sequences,
+                                  char *structure,
+                                  plist **pl,
+                                  vrna_exp_param_t *parameters,
+                                  int calculate_bppm,
+                                  int is_constrained,
+                                  int is_circular);
+
+
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC float
+vrna_pf_alifold(const char **strings,
+                char *structure,
+                vrna_plist_t **pl){
+
+  float                 free_energy;
+  double                mfe;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vrna_md_set_default(&md);
+
+  /* no need to backtrack MFE structure */
+  md.backtrack = 0;
+
+  if(!pl){ /* no need for pair probability computations if we do not store them somewhere */
+    md.compute_bpp = 0;
+  }
+
+  vc  = vrna_fold_compound_comparative(strings, &md, VRNA_OPTION_DEFAULT);
+  mfe = (double)vrna_pf(vc, structure);
+  vrna_exp_params_rescale(vc, &mfe);
+  free_energy = vrna_pf(vc, structure);
+
+  /* fill plist */
+  if(pl){
+    *pl = vrna_plist_from_probs(vc, /*cut_off:*/ 1e-6);
+  }
+
+  vrna_fold_compound_free(vc);
+
+  return free_energy;
+}
+
+PUBLIC float
+vrna_pf_circalifold(const char **sequences,
+                    char *structure,
+                    vrna_plist_t **pl){
+
+  float                 free_energy;
+  double                mfe;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vrna_md_set_default(&md);
+  md.circ = 1;
+
+  /* no need to backtrack MFE structure */
+  md.backtrack = 0;
+
+  if(!pl){ /* no need for pair probability computations if we do not store them somewhere */
+    md.compute_bpp = 0;
+  }
+
+  vc  = vrna_fold_compound_comparative(sequences, &md, VRNA_OPTION_DEFAULT);
+  mfe = (double)vrna_mfe(vc, structure);
+  vrna_exp_params_rescale(vc, &mfe);
+  free_energy = vrna_pf(vc, structure);
+
+  /* fill plist */
+  if(pl){
+    *pl = vrna_plist_from_probs(vc, /*cut_off:*/ 1e-6);
+  }
+
+  vrna_fold_compound_free(vc);
+
+  return free_energy;
+}
+
+
+
+/*-----------------------------------------------------------------*/
+PRIVATE float
+wrap_alipf_fold(const char **sequences,
+                char *structure,
+                plist **pl,
+                vrna_exp_param_t *parameters,
+                int calculate_bppm,
+                int is_constrained,
+                int is_circular){
+
+  int                 n_seq;
+  float               free_energy;
+  vrna_fold_compound_t  *vc;
+  vrna_exp_param_t    *exp_params;
+
+  if(sequences == NULL) return 0.;
+
+  for(n_seq=0;sequences[n_seq];n_seq++); /* count the sequences */
+  
+  vc                  = NULL;
+
+  /* we need vrna_exp_param_t datastructure to correctly init default hard constraints */
+  if(parameters)
+    exp_params = vrna_exp_params_copy(parameters);
+  else{
+    vrna_md_t md;
+    set_model_details(&md); /* get global default parameters */
+    exp_params = vrna_exp_params_comparative(n_seq, &md);
+  }
+  exp_params->model_details.circ        = is_circular;
+  exp_params->model_details.compute_bpp = calculate_bppm;
+
+  vc = vrna_fold_compound_comparative(sequences, &(exp_params->model_details), VRNA_OPTION_PF);
+
+  if(parameters){ /* replace exp_params if necessary */
+    free(vc->exp_params);
+    vc->exp_params = exp_params;
+  } else {
+    free(exp_params);
+  }
+  vc->exp_params->pf_scale = pf_scale;
+
+  if(is_constrained && structure){
+    unsigned int constraint_options = 0;
+    constraint_options |= VRNA_CONSTRAINT_DB
+                          | VRNA_CONSTRAINT_DB_PIPE
+                          | VRNA_CONSTRAINT_DB_DOT
+                          | VRNA_CONSTRAINT_DB_X
+                          | VRNA_CONSTRAINT_DB_ANG_BRACK
+                          | VRNA_CONSTRAINT_DB_RND_BRACK;
+
+    vrna_constraints_add(vc, (const char *)structure, constraint_options);
+  }
+
+  if(backward_compat_compound && backward_compat_compound)
+    vrna_fold_compound_free(backward_compat_compound);
+
+  backward_compat_compound  = vc;
+  iindx                     = backward_compat_compound->iindx;
+  backward_compat           = 1;
+
+  free_energy = vrna_pf(vc, structure);
+  
+  /* fill plist */
+  if(pl && calculate_bppm){
+    *pl = vrna_plist_from_probs(vc, /*cut_off:*/ 1e-6);
+  }
+
+  return free_energy;
+}
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC float
+alipf_fold( const char **sequences,
+                  char *structure,
+                  plist **pl){
+
+  return wrap_alipf_fold(sequences, structure, pl, NULL, do_backtrack, fold_constrained, 0);
+}
+
+PUBLIC float
+alipf_circ_fold(const char **sequences,
+                      char *structure,
+                      plist **pl){
+
+  return wrap_alipf_fold(sequences, structure, pl, NULL, do_backtrack, fold_constrained, 1);
+}
+
+PUBLIC float
+alipf_fold_par( const char **sequences,
+                char *structure,
+                plist **pl,
+                vrna_exp_param_t *parameters,
+                int calculate_bppm,
+                int is_constrained,
+                int is_circular){
+
+  return wrap_alipf_fold(sequences, structure, pl, parameters, calculate_bppm, is_constrained, is_circular);
+}
+
+PUBLIC FLT_OR_DBL *
+alipf_export_bppm(void){
+
+  if(backward_compat_compound)
+    if(backward_compat_compound->exp_matrices)
+      if(backward_compat_compound->exp_matrices->probs)
+        return backward_compat_compound->exp_matrices->probs;
+
+  return NULL;
+}
+
+PUBLIC FLT_OR_DBL *
+export_ali_bppm(void){
+
+  if(backward_compat_compound)
+    if(backward_compat_compound->exp_matrices)
+      if(backward_compat_compound->exp_matrices->probs)
+        return backward_compat_compound->exp_matrices->probs;
+
+  return NULL;
+}
+
+/*brauch ma nurnoch pscores!*/
+PUBLIC char *
+alipbacktrack(double *prob){
+
+  if(backward_compat_compound)
+    if(backward_compat_compound->exp_matrices){
+      vrna_exp_param_t *params = backward_compat_compound->exp_params;
+      int n     = backward_compat_compound->length;
+      int n_seq = backward_compat_compound->n_seq;
+      int *idx  = backward_compat_compound->iindx;
+      double Q  = (double)backward_compat_compound->exp_matrices->q[idx[1]-n];
+      char *s   = vrna_pbacktrack(backward_compat_compound);
+      double e  = (double)vrna_eval_structure(backward_compat_compound, s);
+      e        -= (double)vrna_eval_covar_structure(backward_compat_compound, s);
+      double fe = (-log(Q)-n*log(params->pf_scale))*params->kT/(1000.0 * n_seq);
+      *prob     = exp((fe - e)/params->kT);
+      return s;
+    }
+  return NULL;
+}
+
+/*-------------------------------------------------------------------------*/
+/* make arrays used for alipf_fold available to other routines */
+PUBLIC int
+get_alipf_arrays( short ***S_p,
+                  short ***S5_p,
+                  short ***S3_p,
+                  unsigned short ***a2s_p,
+                  char ***Ss_p,
+                  FLT_OR_DBL **qb_p,
+                  FLT_OR_DBL **qm_p,
+                  FLT_OR_DBL **q1k_p,
+                  FLT_OR_DBL **qln_p,
+                  short **pscore_p) {
+
+  if(backward_compat_compound){
+    if(backward_compat_compound->exp_matrices)
+      if(backward_compat_compound->exp_matrices->qb){
+        *S_p      = backward_compat_compound->S;
+        *S5_p     = backward_compat_compound->S5;
+        *S3_p     = backward_compat_compound->S3;
+        *a2s_p    = backward_compat_compound->a2s;
+        *Ss_p     = backward_compat_compound->Ss;
+        *qb_p     = backward_compat_compound->exp_matrices->qb;
+        *qm_p     = backward_compat_compound->exp_matrices->qm;
+        *q1k_p    = backward_compat_compound->exp_matrices->q1k;
+        *qln_p    = backward_compat_compound->exp_matrices->qln;
+        *pscore_p = backward_compat_compound->pscore_pf_compat;
+        return 1;
+      }
+  }
+  return 0;
+}
+
+PUBLIC void
+free_alipf_arrays(void){
+
+  if(backward_compat_compound && backward_compat){
+    vrna_fold_compound_free(backward_compat_compound);
+    backward_compat_compound  = NULL;
+    backward_compat           = 0;
+    iindx                     = NULL;
+  }
+}
diff --git a/C/ViennaRNA/aln_util.c b/C/ViennaRNA/aln_util.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/aln_util.c
@@ -0,0 +1,617 @@
+/*
+                               aln_util.c
+               Helper functions frelated to alignments
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/model.h"
+#include "ViennaRNA/ribo.h"
+#include "ViennaRNA/aln_util.h"
+
+#define MAX_NUM_NAMES    500
+int read_clustal(FILE *clust, char *AlignedSeqs[], char *names[]) {
+   char *line, name[100]="", *seq;
+   int  n, nn=0, num_seq = 0, i;
+
+   if ((line=vrna_read_line(clust)) == NULL) {
+     vrna_message_warning("Empty CLUSTAL file"); return 0;
+   }
+
+   if ((strncmp(line,"CLUSTAL", 7) !=0) && (!strstr(line,"STOCKHOLM"))) {
+     vrna_message_warning("This doesn't look like a CLUSTAL/STOCKHOLM file, sorry");
+     free(line); return 0;
+   }
+   free(line);
+   line = vrna_read_line(clust);
+
+   while (line!=NULL) {
+    if(strncmp(line, "//", 2) == 0){
+      free(line);
+      break;
+    }
+
+    if (((n=strlen(line))<4) || isspace((int)line[0])) {
+      /* skip non-sequence line */
+      free(line); line = vrna_read_line(clust);
+      nn=0; /* reset seqence number */
+      continue;
+    }
+    /* skip comments */
+    if(line[0] == '#'){
+      free(line);
+      line = vrna_read_line(clust);
+      continue;
+    }
+
+     seq = (char *) vrna_alloc( (n+1)*sizeof(char) );
+     sscanf(line,"%99s %s", name, seq);
+
+    for(i=0;i<strlen(seq);i++){
+      if(seq[i] == '.') seq[i] = '-'; /* replace '.' gaps by '-' */
+      /* comment the next line and think about something more difficult to deal with
+         lowercase sequence letters if you really want to */
+      seq[i] = toupper(seq[i]);
+    }
+
+     if (nn == num_seq) { /* first time */
+       names[nn] = strdup(name);
+       AlignedSeqs[nn] = strdup(seq);
+     }
+     else {
+       if (strcmp(name, names[nn])!=0) {
+         /* name doesn't match */
+         vrna_message_warning("Sorry, your file is messed up (inconsitent seq-names)");
+         free(line); free(seq);
+         return 0;
+       }
+       AlignedSeqs[nn] = (char *)
+         vrna_realloc(AlignedSeqs[nn], strlen(seq)+strlen(AlignedSeqs[nn])+1);
+       strcat(AlignedSeqs[nn], seq);
+     }
+     nn++;
+     if (nn>num_seq) num_seq = nn;
+     free(seq);
+     free(line);
+     if (num_seq>=MAX_NUM_NAMES) {
+       vrna_message_warning("Too many sequences in CLUSTAL/STOCKHOLM file");
+       return 0;
+     }
+
+     line = vrna_read_line(clust);
+   }
+
+   AlignedSeqs[num_seq] = NULL;
+   names[num_seq] = NULL;
+   if (num_seq == 0) {
+     vrna_message_warning("No sequences found in CLUSTAL/STOCKHOLM file");
+     return 0;
+   }
+   n = strlen(AlignedSeqs[0]);
+   for (nn=1; nn<num_seq; nn++) {
+     if (strlen(AlignedSeqs[nn])!=n) {
+       vrna_message_warning("Sorry, your file is messed up.\n"
+                            "Unequal lengths!");
+       return 0;
+     }
+   }
+
+   vrna_message_info(stderr, "%d sequences; length of alignment %d.", nn, n);
+   return num_seq;
+}
+
+char *consensus(const char *AS[]) {
+  /* simple consensus sequence (most frequent character) */
+  char *string;
+  int i,n;
+
+  string = NULL;
+
+  if(AS){
+    n = strlen(AS[0]);
+    string = (char *) vrna_alloc((n+1)*sizeof(char));
+    for (i=0; i<n; i++) {
+      int s,c,fm, freq[8] = {0,0,0,0,0,0,0,0};
+      for (s=0; AS[s]!=NULL; s++)
+        freq[encode_char(AS[s][i])]++;
+      for (s=c=fm=0; s<8; s++) /* find the most frequent char */
+        if (freq[s]>fm) {c=s, fm=freq[c];}
+      if (s>4) s++; /* skip T */
+      string[i]=Law_and_Order[c];
+    }
+  }
+  return string;
+}
+
+/* IUP nucleotide classes indexed by a bit string of the present bases */
+/* A C AC G AG CG ACG U AU CU ACU GU AGU CGU ACGU */
+static char IUP[17] = "-ACMGRSVUWYHKDBN";
+char *consens_mis(const char*AS[]) {
+  /* MIS displays the 'most informative sequence' (Freyhult et al 2004),
+     elements in columns with frequency greater than the background
+     frequency are projected into iupac notation. Columns where gaps are
+     over-represented are in lower case. */
+
+  char *cons;
+  int i, s, n, N, c;
+  int bgfreq[8] = {0,0,0,0,0,0,0,0};
+
+  cons = NULL;
+
+  if(AS){
+    n = strlen(AS[0]);
+    for (N=0; AS[N]!=NULL; N++);
+    cons = (char *) vrna_alloc((n+1)*sizeof(char));
+
+    for (i=0; i<n; i++)
+      for (s=0; s<N; s++) {
+        c = encode_char(AS[s][i]);
+        if (c>4) c=5;
+        bgfreq[c]++;
+      }
+
+    for (i=0; i<n; i++) {
+      int freq[8] = {0,0,0,0,0,0,0,0};
+      int code = 0;
+      for (s=0; s<N; s++) {
+        c = encode_char(AS[s][i]);
+        if (c>4) c=5;
+        freq[c]++;
+      }
+      for (c=4; c>0; c--) {
+        code <<=1;
+        if (freq[c]*n>=bgfreq[c]) code++;
+      }
+      cons[i] = IUP[code];
+      if (freq[0]*n>bgfreq[0])
+        cons[i] = tolower(IUP[code]);
+    }
+  }
+  return cons;
+}
+
+PUBLIC char *
+get_ungapped_sequence(const char *seq){
+
+  char  *tmp_sequence, *b;
+  int   i;
+
+  tmp_sequence = strdup(seq);
+
+  b = tmp_sequence;
+  i = 0;
+  do{
+    if((*b=='-')||(*b=='_')||(*b=='~')||(*b=='.')) continue;
+    tmp_sequence[i] = *b;
+    i++;
+  }while(*(++b));
+
+  tmp_sequence = (char *)vrna_realloc(tmp_sequence, (i+1)*sizeof(char));
+  tmp_sequence[i] = '\0';
+
+  return tmp_sequence;
+}
+
+PUBLIC int
+vrna_aln_mpi(const char **alignment){
+
+  int   i, j, k, s, n_seq, n, pairnum = 0, sumident = 0;
+  float ident = 0;
+
+  if(alignment){
+    n = (int)strlen(alignment[0]);
+    for(s = 0; alignment[s]; s++);
+    n_seq = s;
+
+    for(j = 0; j < n_seq - 1; j++)
+      for(k = j + 1; k < n_seq; k++) {
+        ident = 0;
+        for (i = 1; i <= n; i++){
+          if(alignment[k][i] == alignment[j][i])
+            ident++;
+          pairnum++;
+        }
+        sumident+=ident;
+      }
+
+    if(pairnum > 0)
+      return (int) (sumident*100/pairnum);
+  }
+  return 0;
+}
+
+/*---------------------------------------------------------------------------*/
+PRIVATE int
+compare_pinfo(const void *pi1,
+              const void *pi2){
+
+  vrna_pinfo_t *p1, *p2;
+  int  i, nc1, nc2;
+  p1 = (vrna_pinfo_t *)pi1;  p2 = (vrna_pinfo_t *)pi2;
+  for (nc1=nc2=0, i=1; i<=6; i++) {
+    if (p1->bp[i]>0) nc1++;
+    if (p2->bp[i]>0) nc2++;
+  }
+  /* sort mostly by probability, add
+     epsilon * comp_mutations/(non-compatible+1) to break ties */
+  return (p1->p + 0.01*nc1/(p1->bp[0]+1.)) <
+         (p2->p + 0.01*nc2/(p2->bp[0]+1.)) ? 1 : -1;
+}
+
+PUBLIC vrna_pinfo_t *
+vrna_aln_pinfo( vrna_fold_compound_t *vc,
+                const char *structure,
+                double threshold){
+
+  int i,j, num_p=0, max_p = 64;
+  vrna_pinfo_t *pi;
+  double *duck, p;
+  short *ptable = NULL;
+
+  short **S = vc->S;
+  char **AS = vc->sequences;
+  int n_seq = vc->n_seq;
+  int n     = vc->length;
+  int         *my_iindx = vc->iindx;
+  FLT_OR_DBL  *probs    = vc->exp_matrices->probs;
+  vrna_md_t   *md = &(vc->exp_params->model_details);
+
+  max_p = 64; pi = vrna_alloc(max_p*sizeof(vrna_pinfo_t));
+  duck =  (double *) vrna_alloc((n+1)*sizeof(double));
+  if(structure)
+    ptable = vrna_ptable(structure);
+
+  for (i=1; i<n; i++)
+    for (j=i+TURN+1; j<=n; j++) {
+      if ((p=probs[my_iindx[i]-j])>=threshold) {
+        duck[i] -=  p * log(p);
+        duck[j] -=  p * log(p);
+
+        int type, s;
+        pi[num_p].i   = i;
+        pi[num_p].j   = j;
+        pi[num_p].p   = p;
+        pi[num_p].ent = duck[i]+duck[j]-p*log(p);
+
+        for (type=0; type<8; type++) pi[num_p].bp[type]=0;
+        for (s=0; s<n_seq; s++) {
+          type = md->pair[S[s][i]][S[s][j]];
+          if(S[s][i]==0 && S[s][j]==0) type = 7; /* gap-gap  */
+          if ((AS[s][i-1] == '-')||(AS[s][j-1] == '-')) type = 7;
+          if ((AS[s][i-1] == '~')||(AS[s][j-1] == '~')) type = 7;
+          pi[num_p].bp[type]++;
+        }
+        if(ptable)
+          pi[num_p].comp = (ptable[i] == j) ? 1:0;
+
+        num_p++;
+        if (num_p>=max_p) {
+          max_p *= 2;
+          pi = vrna_realloc(pi, max_p * sizeof(vrna_pinfo_t));
+        }
+      }
+    }
+  free(duck);
+  pi = vrna_realloc(pi, (num_p+1)*sizeof(vrna_pinfo_t));
+  pi[num_p].i=0;
+  qsort(pi, num_p, sizeof(vrna_pinfo_t), compare_pinfo );
+
+  free(ptable);
+  return pi;
+}
+
+
+PUBLIC int *
+vrna_aln_pscore(const char  **alignment,
+                vrna_md_t   *md){
+
+  /* calculate co-variance bonus for each pair depending on  */
+  /* compensatory/consistent mutations and incompatible seqs */
+  /* should be 0 for conserved pairs, >0 for good pairs      */
+
+#define NONE -10000 /* score for forbidden pairs */
+
+  int         i, j, k, l, s, n, n_seq, *indx, turn, max_span;
+  float       **dm;
+  vrna_md_t   md_default;
+  int         *pscore;
+  short       **S;
+
+  int olddm[7][7]={{0,0,0,0,0,0,0}, /* hamming distance between pairs */
+                  {0,0,2,2,1,2,2} /* CG */,
+                  {0,2,0,1,2,2,2} /* GC */,
+                  {0,2,1,0,2,1,2} /* GU */,
+                  {0,1,2,2,0,2,1} /* UG */,
+                  {0,2,2,1,2,0,2} /* AU */,
+                  {0,2,2,2,1,2,0} /* UA */};
+
+  pscore = NULL;
+
+  if(!md){
+    vrna_md_set_default(&md_default);
+    md = &md_default;
+  }
+
+  if(alignment){
+    /* length of alignment */
+    n = (int)strlen(alignment[0]);
+
+    /* count number of sequences */
+    for(s = 0; alignment[s]; s++);
+    n_seq = s;
+
+    /* make numeric encoding of sequences */
+    S = (short **)vrna_alloc(sizeof(short *) * (n_seq + 1));
+    for(s = 0; s < n_seq; s++){
+      S[s] = vrna_seq_encode_simple(alignment[s], md);
+    }
+
+    indx  = vrna_idx_col_wise(n);
+
+    turn    = md->min_loop_size;
+
+    pscore = (int *)vrna_alloc(sizeof(int) * ((n+1)*(n+2)/2 + 2));
+
+    if (md->ribo) {
+      if (RibosumFile !=NULL) dm=readribosum(RibosumFile);
+      else dm=get_ribosum(alignment, n_seq, n);
+    }
+    else { /*use usual matrix*/
+      dm = vrna_alloc(7*sizeof(float*));
+      for (i=0; i<7;i++) {
+        dm[i] = vrna_alloc(7*sizeof(float));
+        for (j=0; j<7; j++)
+          dm[i][j] = (float) olddm[i][j];
+      }
+    }
+
+    max_span = md->max_bp_span;
+    if((max_span < turn+2) || (max_span > n))
+      max_span = n;
+    for (i=1; i<n; i++) {
+      for (j=i+1; (j<i+turn+1) && (j<=n); j++)
+        pscore[indx[j]+i] = NONE;
+      for (j=i+turn+1; j<=n; j++) {
+        int pfreq[8]={0,0,0,0,0,0,0,0};
+        double score;
+        for (s=0; s<n_seq; s++) {
+          int type;
+          if (S[s][i]==0 && S[s][j]==0) type = 7; /* gap-gap  */
+          else {
+            if ((alignment[s][i] == '~')||(alignment[s][j] == '~')) type = 7;
+            else type = md->pair[S[s][i]][S[s][j]];
+          }
+          pfreq[type]++;
+        }
+        if (pfreq[0]*2+pfreq[7]>n_seq) { pscore[indx[j]+i] = NONE; continue;}
+        for (k=1,score=0; k<=6; k++) /* ignore pairtype 7 (gap-gap) */
+          for (l=k; l<=6; l++)
+            score += pfreq[k]*pfreq[l]*dm[k][l];
+        /* counter examples score -1, gap-gap scores -0.25   */
+        pscore[indx[j]+i] = md->cv_fact *
+          ((UNIT*score)/n_seq - md->nc_fact*UNIT*(pfreq[0] + pfreq[7]*0.25));
+
+        if((j - i + 1) > max_span){
+          pscore[indx[j]+i] = NONE;
+        }
+      }
+    }
+
+    if (md->noLP) /* remove unwanted pairs */
+      for (k=1; k<n-turn-1; k++)
+        for (l=1; l<=2; l++) {
+          int type,ntype=0,otype=0;
+          i=k; j = i+turn+l;
+          type = pscore[indx[j]+i];
+          while ((i>=1)&&(j<=n)) {
+            if ((i>1)&&(j<n)) ntype = pscore[indx[j+1]+i-1];
+            if ((otype<md->cv_fact*MINPSCORE)&&(ntype<md->cv_fact*MINPSCORE))  /* too many counterexamples */
+              pscore[indx[j]+i] = NONE; /* i.j can only form isolated pairs */
+            otype =  type;
+            type  = ntype;
+            i--; j++;
+          }
+        }
+
+    /*free dm */
+    for (i=0; i<7;i++) {
+      free(dm[i]);
+    }
+    free(dm);
+
+    for(s = 0; s < n_seq; s++){
+      free(S[s]);
+    }
+    free(S);
+
+    free(indx);
+  }
+
+  return pscore;
+}
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC int
+get_mpi(char *Alseq[],
+        int n_seq,
+        int length,
+        int *mini){
+
+  int   i, j, k, pairnum = 0, sumident = 0;
+  float ident = 0, minimum = 1.;
+
+  for(j=0; j<n_seq-1; j++)
+    for(k=j+1; k<n_seq; k++) {
+      ident=0;
+      for (i=1; i<=length; i++){
+        if (Alseq[k][i]==Alseq[j][i]) ident++;
+        pairnum++;
+      }
+      if ((ident/length)<minimum) minimum=ident/(float)length;
+      sumident+=ident;
+    }
+  mini[0]=(int)(minimum*100.);
+  if (pairnum>0)   return (int) (sumident*100/pairnum);
+  else return 0;
+}
+
+PUBLIC void
+alloc_sequence_arrays(const char **sequences,
+                      short ***S,
+                      short ***S5,
+                      short ***S3,
+                      unsigned short ***a2s,
+                      char ***Ss,
+                      int circ){
+
+  unsigned int s, n_seq, length;
+  if(sequences[0] != NULL){
+    length = strlen(sequences[0]);
+    for (s=0; sequences[s] != NULL; s++);
+    n_seq = s;
+    *S    = (short **)          vrna_alloc((n_seq+1) * sizeof(short *));
+    *S5   = (short **)          vrna_alloc((n_seq+1) * sizeof(short *));
+    *S3   = (short **)          vrna_alloc((n_seq+1) * sizeof(short *));
+    *a2s  = (unsigned short **) vrna_alloc((n_seq+1) * sizeof(unsigned short *));
+    *Ss   = (char **)           vrna_alloc((n_seq+1) * sizeof(char *));
+    for (s=0; s<n_seq; s++) {
+      if(strlen(sequences[s]) != length) vrna_message_error("uneqal seqence lengths");
+      (*S5)[s]  = (short *)         vrna_alloc((length + 2) * sizeof(short));
+      (*S3)[s]  = (short *)         vrna_alloc((length + 2) * sizeof(short));
+      (*a2s)[s] = (unsigned short *)vrna_alloc((length + 2) * sizeof(unsigned short));
+      (*Ss)[s]  = (char *)          vrna_alloc((length + 2) * sizeof(char));
+      (*S)[s]   = (short *)         vrna_alloc((length + 2) * sizeof(short));
+      encode_ali_sequence(sequences[s], (*S)[s], (*S5)[s], (*S3)[s], (*Ss)[s], (*a2s)[s], circ);
+    }
+    (*S5)[n_seq]  = NULL;
+    (*S3)[n_seq]  = NULL;
+    (*a2s)[n_seq] = NULL;
+    (*Ss)[n_seq]  = NULL;
+    (*S)[n_seq]   = NULL;
+  }
+  else vrna_message_error("alloc_sequence_arrays: no sequences in the alignment!");
+}
+
+PUBLIC void
+free_sequence_arrays( unsigned int n_seq,
+                      short ***S,
+                      short ***S5,
+                      short ***S3,
+                      unsigned short ***a2s,
+                      char ***Ss){
+
+  unsigned int s;
+  for (s=0; s<n_seq; s++) {
+    free((*S)[s]);
+    free((*S5)[s]);
+    free((*S3)[s]);
+    free((*a2s)[s]);
+    free((*Ss)[s]);
+  }
+  free(*S);   *S    = NULL;
+  free(*S5);  *S5   = NULL;
+  free(*S3);  *S3   = NULL;
+  free(*a2s); *a2s  = NULL;
+  free(*Ss);  *Ss   = NULL;
+}
+
+PUBLIC void
+encode_ali_sequence(const char *sequence,
+                    short *S,
+                    short *s5,
+                    short *s3,
+                    char *ss,
+                    unsigned short *as,
+                    int circular){
+
+  unsigned int i,l;
+  unsigned short p;
+  l     = strlen(sequence);
+  S[0]  = (short) l;
+  s5[0] = s5[1] = 0;
+
+  /* make numerical encoding of sequence */
+  for(i=1; i<=l; i++){
+    short ctemp;
+    ctemp=(short) encode_char(toupper(sequence[i-1]));
+    S[i]= ctemp ;
+  }
+
+  if (oldAliEn){
+    /* use alignment sequences in all energy evaluations */
+    ss[0]=sequence[0];
+    for(i=1; i<l; i++){
+      s5[i] = S[i-1];
+      s3[i] = S[i+1];
+      ss[i] = sequence[i];
+      as[i] = i;
+    }
+    ss[l]   = sequence[l];
+    as[l]   = l;
+    s5[l]   = S[l-1];
+    s3[l]   = 0;
+    S[l+1]  = S[1];
+    s5[1]   = 0;
+    if (circular) {
+      s5[1]   = S[l];
+      s3[l]   = S[1];
+      ss[l+1] = S[1];
+    }
+  }
+  else{
+    if(circular){
+      for(i=l; i>0; i--){
+        char c5;
+        c5 = sequence[i-1];
+        if ((c5=='-')||(c5=='_')||(c5=='~')||(c5=='.')) continue;
+        s5[1] = S[i];
+        break;
+      }
+      for (i=1; i<=l; i++) {
+        char c3;
+        c3 = sequence[i-1];
+        if ((c3=='-')||(c3=='_')||(c3=='~')||(c3=='.')) continue;
+        s3[l] = S[i];
+        break;
+      }
+    }
+    else  s5[1]=s3[l]=0;
+
+    for(i=1,p=0; i<=l; i++){
+      char c5;
+      c5 = sequence[i-1];
+      if ((c5=='-')||(c5=='_')||(c5=='~')||(c5=='.'))
+        s5[i+1]=s5[i];
+      else { /* no gap */
+        ss[p++]=sequence[i-1]; /*start at 0!!*/
+        s5[i+1]=S[i];
+      }
+      as[i]=p;
+    }
+    for (i=l; i>=1; i--) {
+      char c3;
+      c3 = sequence[i-1];
+      if ((c3=='-')||(c3=='_')||(c3=='~')||(c3=='.'))
+        s3[i-1]=s3[i];
+      else
+        s3[i-1]=S[i];
+    }
+  }
+}
+
diff --git a/C/ViennaRNA/aln_util.h b/C/ViennaRNA/aln_util.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/aln_util.h
@@ -0,0 +1,206 @@
+#ifndef VIENNA_RNA_PACKAGE_ALN_UTIL_H
+#define VIENNA_RNA_PACKAGE_ALN_UTIL_H
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file aln_util.h
+ *  @ingroup utils
+ *  @brief Various utility- and helper-functions for sequence alignments and comparative structure prediction
+ */
+
+/**
+ *  @{
+ *  @ingroup   aln_utils
+ *
+ */
+
+/** @brief Typename for the base pair info repesenting data structure #vrna_pinfo_s */
+typedef struct vrna_pinfo_s     vrna_pinfo_t;
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/* the following typedefs are for backward compatibility only */
+
+/**
+ *  @brief Old typename of #vrna_pinfo_s
+ *  @deprecated Use #vrna_pinfo_t instead!
+*/
+typedef struct vrna_pinfo_s     pair_info;
+
+#endif
+
+/**
+ *  @brief A base pair info structure
+ *
+ *  For each base pair (i,j) with i,j in [0, n-1] the structure lists:
+ *  - its probability 'p'
+ *  - an entropy-like measure for its well-definedness 'ent'
+ *  - the frequency of each type of pair in 'bp[]'
+ *    + 'bp[0]' contains the number of non-compatible sequences
+ *    + 'bp[1]' the number of CG pairs, etc.
+ */
+struct vrna_pinfo_s {
+   unsigned i;    /**<  @brief  nucleotide position i */
+   unsigned j;    /**<  @brief  nucleotide position j */
+   float p;       /**< @brief  Probability */
+   float ent;     /**< @brief  Pseudo entropy for @f$ p(i,j) = S_i + S_j - p_ij*ln(p_ij) @f$ */
+   short bp[8];   /**< @brief  Frequencies of pair_types */
+   char comp;     /**< @brief  1 iff pair is in mfe structure */
+};
+
+int read_clustal( FILE *clust,
+                  char *AlignedSeqs[],
+                  char *names[]);
+
+char *consensus(const char *AS[]);
+
+char *consens_mis(const char *AS[]);
+
+char *
+get_ungapped_sequence(const char *seq);
+
+/**
+ *  @brief Get the mean pairwise identity in steps from ?to?(ident)
+ * 
+ *  @ingroup consensus_fold
+ * 
+ *  @param alignment  Aligned sequences
+ *  @return       The mean pairwise identity
+ */
+int vrna_aln_mpi( const char **alignment);
+
+/**
+ *  \brief Retrieve an array of #vrna_pinfo_t structures from precomputed pair probabilities
+ *
+ *  This array of structures contains information about positionwise pair probabilies,
+ *  base pair entropy and more
+ *
+ *  \see #vrna_pinfo_t, and vrna_pf()
+ *
+ *  \param  vc          The #vrna_fold_compound_t of type #VRNA_FC_TYPE_COMPARATIVE with precomputed partition function matrices
+ *  \param  structure   An optional structure in dot-bracket notation (Maybe NULL)
+ *  \param  threshold   Do not include results with pair probabilities below threshold
+ *  \return             The #vrna_pinfo_t array
+ */
+vrna_pinfo_t *vrna_aln_pinfo(vrna_fold_compound_t *vc,
+                                  const char *structure,
+                                  double threshold);
+
+int *
+vrna_aln_pscore(const char  **alignment,
+                vrna_md_t   *md);
+
+
+/**
+ *  @brief Get the mean pairwise identity in steps from ?to?(ident)
+ * 
+ *  @ingroup consensus_fold
+ *
+ *  @deprecated Use vrna_aln_mpi() as a replacement
+ *
+ *  @param Alseq
+ *  @param n_seq  The number of sequences in the alignment
+ *  @param length The length of the alignment
+ *  @param mini
+ *  @return       The mean pairwise identity
+ */
+DEPRECATED(int get_mpi(char *Alseq[], int n_seq, int length, int *mini));
+
+/*
+#############################################################
+# some helper functions that might be useful in the library #
+#############################################################
+*/
+
+/**
+ *  @brief Get arrays with encoded sequence of the alignment
+ *
+ *  this function assumes that in S, S5, s3, ss and as enough
+ *  space is already allocated (size must be at least sequence length+2)
+ * 
+ *  @ingroup consensus_fold
+ * 
+ *  @param sequence The gapped sequence from the alignment
+ *  @param S        pointer to an array that holds encoded sequence
+ *  @param s5      pointer to an array that holds the next base 5' of alignment position i
+ *  @param s3      pointer to an array that holds the next base 3' of alignment position i
+ *  @param ss
+ *  @param as
+ *  @param circ    assume the molecules to be circular instead of linear (circ=0)
+ */
+void encode_ali_sequence( const char *sequence,
+                          short *S,
+                          short *s5,
+                          short *s3,
+                          char *ss,
+                          unsigned short *as,
+                          int circ);
+
+/**
+ *  @brief Allocate memory for sequence array used to deal with aligned sequences
+ * 
+ *  Note that these arrays will also be initialized according to the sequence alignment given
+ * 
+ *  @ingroup consensus_fold
+ * 
+ *  @see free_sequence_arrays()
+ * 
+ *  @param sequences  The aligned sequences
+ *  @param S          A pointer to the array of encoded sequences
+ *  @param S5         A pointer to the array that contains the next 5' nucleotide of a sequence position
+ *  @param S3         A pointer to the array that contains the next 3' nucleotide of a sequence position
+ *  @param a2s        A pointer to the array that contains the alignment to sequence position mapping
+ *  @param Ss         A pointer to the array that contains the ungapped sequence
+ *  @param circ       assume the molecules to be circular instead of linear (circ=0)
+ */
+void  alloc_sequence_arrays(const char **sequences,
+                            short ***S,
+                            short ***S5,
+                            short ***S3,
+                            unsigned short ***a2s,
+                            char ***Ss,
+                            int circ);
+
+/**
+ *  @brief Free the memory of the sequence arrays used to deal with aligned sequences
+ * 
+ *  This function frees the memory previously allocated with alloc_sequence_arrays()
+ * 
+ *  @ingroup consensus_fold
+ * 
+ *  @see alloc_sequence_arrays()
+ * 
+ *  @param n_seq      The number of aligned sequences
+ *  @param S          A pointer to the array of encoded sequences
+ *  @param S5         A pointer to the array that contains the next 5' nucleotide of a sequence position
+ *  @param S3         A pointer to the array that contains the next 3' nucleotide of a sequence position
+ *  @param a2s        A pointer to the array that contains the alignment to sequence position mapping
+ *  @param Ss         A pointer to the array that contains the ungapped sequence
+ */
+void  free_sequence_arrays( unsigned int n_seq,
+                            short ***S,
+                            short ***S5,
+                            short ***S3,
+                            unsigned short ***a2s,
+                            char ***Ss);
+
+
+/**
+ * @}
+ */
+
+
+#endif
diff --git a/C/ViennaRNA/alphabet.c b/C/ViennaRNA/alphabet.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/alphabet.c
@@ -0,0 +1,399 @@
+/*
+    alphabet.c
+    
+    Code for handling nucleotide and base pair alphabet
+    
+    Part of the ViennaRNA Package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/alphabet.h"
+
+/*
+  For now, we neglect all non-standard nucleotides in an input sequence, i.e. only
+  ACGTUN is allowed.
+
+  However, the standard nucleotide ambiguity code table would allow for many more:
+
+  A = Adenylic acid
+  C = Cytidylic acid
+  G = Guanylic acid
+  T = Thymidylic acid
+  U = Uridylic acid
+  I = Inosylic acid
+  R = A or G = puRine
+  Y = C or T = pYrimidine
+  K = G or T = Keto
+  M = A or C = aMino
+  S = G or C = Strong base pair
+  W = A or T = Weak base pair
+  B = not A (G or C or T)
+  D = not C (A or G or T)
+  H = not G (A or C or T)
+  V = not T/U (A or C or G)
+  N = aNy base  (by convention, X is used for unknown amino acids, N for unknown nucleotides)
+
+  For the future, we aim to accept all of the above codes.
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+PRIVATE const char Law_and_Order[] = "_ACGUTXKI";
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE char  *wrap_get_ptypes(const short *S, vrna_md_t *md);  /* provides backward compatibility for old ptypes array in pf computations */
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC unsigned int
+vrna_sequence_length_max(unsigned int options){
+
+  if(options & VRNA_OPTION_WINDOW)
+    return (unsigned int)INT_MAX;
+
+/*
+  return (unsigned int)sqrt((double)INT_MAX);
+*/
+  /*
+      many functions in RNAlib still rely on the sequence length
+      at pos 0 in the integer encoded sequence array S. Since this
+      encoding is stored in a short * array, the maximum length
+      of any sequence is SHRT_MAX
+  */
+  return (unsigned int)SHRT_MAX;
+}
+
+
+PUBLIC int
+vrna_nucleotide_IUPAC_identity( char nt,
+                                char mask){
+
+  char n1,n2,*p;
+
+  p   = NULL;
+  n1  = toupper(nt);
+  n2  = toupper(mask);
+
+  switch(n1){
+    case 'A': p = strchr("ARMWDHVN", n2);
+              break;
+    case 'C': p = strchr("CYMSBHVN", n2);
+              break;
+    case 'G': p = strchr("GRKSBDVN", n2);
+              break;
+    case 'T': p = strchr("TYKWBDHN", n2);
+              break;
+    case 'U': p = strchr("UYKWBDHN", n2);
+              break;
+    case 'I': p = strchr("IN", n2);
+              break;
+    case 'R': p = strchr("AGR", n2);
+              break;
+    case 'Y': p = strchr("CTUY", n2);
+              break;
+    case 'K': p = strchr("GTUK", n2);
+              break;
+    case 'M': p = strchr("ACM", n2);
+              break;
+    case 'S': p = strchr("GCS", n2);
+              break;
+    case 'W': p = strchr("ATUW", n2);
+              break;
+    case 'B': p = strchr("GCTBU", n2);
+              break;
+    case 'D': p = strchr("AGTUD", n2);
+              break;
+    case 'H': p = strchr("ACTUH", n2);
+              break;
+    case 'V': p = strchr("ACGV", n2);
+              break;
+    case 'N': p = strchr("ACGTUN", n2);
+              break;
+  }
+
+  return (p) ? 1 : 0;
+}
+
+
+PUBLIC char *
+vrna_ptypes(const short *S,
+                vrna_md_t *md){
+
+  char *ptype;
+  int n,i,j,k,l,*idx;
+  int min_loop_size = md->min_loop_size;
+
+  n     = S[0];
+
+  if((unsigned int)n > vrna_sequence_length_max(VRNA_OPTION_DEFAULT)){
+    vrna_message_warning("vrna_ptypes@alphabet.c: sequence length of %d exceeds addressable range", n);
+    return NULL;
+  }
+
+  ptype = (char *)vrna_alloc(sizeof(char)*((n*(n+1))/2+2));
+  idx   = vrna_idx_col_wise(n);
+
+  for (k=1; k<n-min_loop_size; k++)
+    for (l=1; l<=2; l++) {
+      int type,ntype=0,otype=0;
+      i=k; j = i+min_loop_size+l; if (j>n) continue;
+      type = md->pair[S[i]][S[j]];
+      while ((i>=1)&&(j<=n)) {
+        if ((i>1)&&(j<n)) ntype = md->pair[S[i-1]][S[j+1]];
+        if (md->noLP && (!otype) && (!ntype))
+          type = 0; /* i.j can only form isolated pairs */
+        ptype[idx[j]+i] = (char) type;
+        otype =  type;
+        type  = ntype;
+        i--; j++;
+      }
+    }
+  free(idx);
+  return ptype;
+}
+
+PUBLIC short *
+vrna_seq_encode(const char *sequence,
+                vrna_md_t *md){
+
+  unsigned int  i, l;
+  short         *S = NULL;
+  
+  if(sequence && md){
+    S = vrna_seq_encode_simple(sequence, md);
+
+    l = (unsigned int)strlen(sequence);
+
+    for(i=1; i<=l; i++)
+      S[i] = md->alias[S[i]];
+
+    S[l+1] = S[1];
+    S[0] = S[l];
+  }
+
+  return S;
+}
+
+PUBLIC short *
+vrna_seq_encode_simple( const char *sequence,
+                        vrna_md_t *md){
+
+  unsigned int  i, l;
+  short         *S = NULL;
+
+  if(sequence && md){
+    l = (unsigned int)strlen(sequence);
+    S = (short *) vrna_alloc(sizeof(short)*(l+2));
+
+    for(i=1; i<=l; i++) /* make numerical encoding of sequence */
+      S[i]= (short) vrna_nucleotide_encode(toupper(sequence[i-1]), md);
+
+    S[l+1] = S[1];
+    S[0] = (short) l;
+  }
+
+  return S;
+}
+
+PUBLIC  int
+vrna_nucleotide_encode( char c,
+                        vrna_md_t *md){
+
+  /* return numerical representation of nucleotide used e.g. in vrna_md_t.pair[][] */
+  int code = -1;
+
+  if(md){
+    if (md->energy_set>0) code = (int) (c-'A')+1;
+    else {
+      const char *pos;
+      pos = strchr(Law_and_Order, c);
+      if (pos==NULL) code=0;
+      else code = (int) (pos-Law_and_Order);
+      if (code>5) code = 0;
+      if (code>4) code--; /* make T and U equivalent */
+    }
+  }
+
+  return code;
+}
+
+PUBLIC  char
+vrna_nucleotide_decode( int enc,
+                        vrna_md_t *md){
+
+  if(md){
+    if(md->energy_set > 0)
+      return (char)enc + 'A' - 1;
+    else
+      return (char)Law_and_Order[enc];
+  } else {
+    return (char)0;
+  }
+}
+
+PUBLIC void
+vrna_aln_encode(const char *sequence,
+                    short **S_p,
+                    short **s5_p,
+                    short **s3_p,
+                    char **ss_p,
+                    unsigned short **as_p,
+                    vrna_md_t *md){
+
+  unsigned  int   i,l;
+  unsigned  short p;
+
+  l     = strlen(sequence);
+
+  (*s5_p)   = (short *)         vrna_alloc((l + 2) * sizeof(short));
+  (*s3_p)   = (short *)         vrna_alloc((l + 2) * sizeof(short));
+  (*as_p)  = (unsigned short *)vrna_alloc((l + 2) * sizeof(unsigned short));
+  (*ss_p)   = (char *)          vrna_alloc((l + 2) * sizeof(char));
+
+  /* make numerical encoding of sequence */
+  (*S_p)    = vrna_seq_encode_simple(sequence, md);
+
+  (*s5_p)[0] = (*s5_p)[1] = 0;
+
+  if(md->oldAliEn){
+    /* use alignment sequences in all energy evaluations */
+    (*ss_p)[0]=sequence[0];
+    for(i=1; i<l; i++){
+      (*s5_p)[i] = (*S_p)[i-1];
+      (*s3_p)[i] = (*S_p)[i+1];
+      (*ss_p)[i] = sequence[i];
+      (*as_p)[i] = i;
+    }
+    (*ss_p)[l]   = sequence[l];
+    (*as_p)[l]   = l;
+    (*s5_p)[l]   = (*S_p)[l-1];
+    (*s3_p)[l]   = 0;
+    (*S_p)[l+1]  = (*S_p)[1];
+    (*s5_p)[1]   = 0;
+    if(md->circ){
+      (*s5_p)[1]   = (*S_p)[l];
+      (*s3_p)[l]   = (*S_p)[1];
+      (*ss_p)[l+1] = (*S_p)[1];
+    }
+  }
+  else{
+    if(md->circ){
+      for(i=l; i>0; i--){
+        char c5;
+        c5 = sequence[i-1];
+        if ((c5=='-')||(c5=='_')||(c5=='~')||(c5=='.')) continue;
+        (*s5_p)[1] = (*S_p)[i];
+        break;
+      }
+      for (i=1; i<=l; i++) {
+        char c3;
+        c3 = sequence[i-1];
+        if ((c3=='-')||(c3=='_')||(c3=='~')||(c3=='.')) continue;
+        (*s3_p)[l] = (*S_p)[i];
+        break;
+      }
+    }
+    else  (*s5_p)[1]=(*s3_p)[l]=0;
+
+    for(i=1,p=0; i<=l; i++){
+      char c5;
+      c5 = sequence[i-1];
+      if ((c5=='-')||(c5=='_')||(c5=='~')||(c5=='.'))
+        (*s5_p)[i+1]=(*s5_p)[i];
+      else { /* no gap */
+        (*ss_p)[p++]=sequence[i-1]; /*start at 0!!*/
+        (*s5_p)[i+1]=(*S_p)[i];
+      }
+      (*as_p)[i]=p;
+    }
+    for (i=l; i>=1; i--) {
+      char c3;
+      c3 = sequence[i-1];
+      if ((c3=='-')||(c3=='_')||(c3=='~')||(c3=='.'))
+        (*s3_p)[i-1]=(*s3_p)[i];
+      else
+        (*s3_p)[i-1]=(*S_p)[i];
+    }
+  }
+}
+
+PRIVATE char *
+wrap_get_ptypes(const short *S,
+                vrna_md_t *md){
+
+  char *ptype;
+  int n,i,j,k,l,*idx;
+
+  n     = S[0];
+  ptype = (char *)vrna_alloc(sizeof(char)*((n*(n+1))/2+2));
+  idx   = vrna_idx_row_wise(n);
+  int min_loop_size = md->min_loop_size;
+
+  for (k=1; k<n-min_loop_size; k++)
+    for (l=1; l<=2; l++) {
+      int type,ntype=0,otype=0;
+      i=k; j = i+min_loop_size+l; if (j>n) continue;
+      type = md->pair[S[i]][S[j]];
+      while ((i>=1)&&(j<=n)) {
+        if ((i>1)&&(j<n)) ntype = md->pair[S[i-1]][S[j+1]];
+        if (md->noLP && (!otype) && (!ntype))
+          type = 0; /* i.j can only form isolated pairs */
+        ptype[idx[i]-j] = (char) type;
+        otype =  type;
+        type  = ntype;
+        i--; j++;
+      }
+    }
+  free(idx);
+  return ptype;
+}
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC char *
+get_ptypes( const short *S,
+            vrna_md_t *md,
+            unsigned int idx_type){
+
+  if(S){
+    if((unsigned int)S[0] > vrna_sequence_length_max(VRNA_OPTION_DEFAULT)){
+      vrna_message_warning("get_ptypes@alphabet.c: sequence length of %d exceeds addressable range", (int)S[0]);
+      return NULL;
+    }
+
+    if(idx_type)
+      return wrap_get_ptypes(S, md);
+    else
+      return vrna_ptypes(S, md);
+  } else {
+    return NULL;
+  }
+}
+
+#endif
+
diff --git a/C/ViennaRNA/alphabet.h b/C/ViennaRNA/alphabet.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/alphabet.h
@@ -0,0 +1,107 @@
+#ifndef VIENNA_RNA_PACKAGE_ALPHABET_H
+#define VIENNA_RNA_PACKAGE_ALPHABET_H
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file     alphabet.h
+ *  @ingroup  utils
+ *  @brief    Functions to process, convert, and generally handle different nucleotide
+ *            and/or base pair alphabets
+ */
+
+/**
+ *  @{
+ *  @ingroup utils
+ */
+
+#include <ViennaRNA/model.h>
+
+unsigned int vrna_sequence_length_max(unsigned int options);
+
+int vrna_nucleotide_IUPAC_identity(char a, char b);
+
+/**
+ *  @brief Get an array of the numerical encoding for each possible base pair (i,j)
+ *
+ *  @note This array is always indexed in column-wise order, in contrast to previously
+ *  different indexing between mfe and pf variants!
+ *
+ *  @see  vrna_idx_col_wise(), #vrna_fold_compound_t
+ *
+ */
+char  *vrna_ptypes( const short *S,
+                    vrna_md_t *md);
+
+/**
+ *  @brief Get a numerical representation of the nucleotide sequence
+ *
+ */
+short *vrna_seq_encode( const char *sequence,
+                        vrna_md_t *md);
+
+/**
+ *  @brief Get a numerical representation of the nucleotide sequence (simple version)
+ *
+ */
+short *vrna_seq_encode_simple(const char *sequence,
+                              vrna_md_t *md);
+
+/**
+ *  @brief  Encode a nucleotide character to numerical value
+ *
+ *  This function encodes a nucleotide character to its numerical representation as required by many functions in RNAlib.
+ *
+ *  @see  vrna_nucleotide_decode(), vrna_seq_encode()
+ *
+ *  @param  c   The nucleotide character to encode
+ *  @param  md  The model details that determine the kind of encoding
+ *  @return     The encoded nucleotide
+ */
+int vrna_nucleotide_encode( char c,
+                            vrna_md_t *md);
+
+/**
+ *  @brief  Decode a numerical representation of a nucleotide back into nucleotide alphabet
+ *
+ *  This function decodes a numerical representation of a nucleotide character back into nucleotide alphabet
+ *
+ *  @see  vrna_nucleotide_encode(), vrna_seq_encode()
+ *
+ *  @param  enc The encoded nucleotide
+ *  @param  md  The model details that determine the kind of decoding
+ *  @return     The decoded nucleotide character
+ */
+char vrna_nucleotide_decode(int enc,
+                            vrna_md_t *md);
+
+void vrna_aln_encode( const char *sequence,
+                      short **S_p,
+                      short **s5_p,
+                      short **s3_p,
+                      char **ss_p,
+                      unsigned short **as_p,
+                      vrna_md_t *md);
+
+/**
+ *  @}
+ */
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+DEPRECATED(char  *get_ptypes(const short *S, vrna_md_t *md, unsigned int idx_type));
+
+#endif
+
+#endif
diff --git a/C/ViennaRNA/boltzmann_sampling.c b/C/ViennaRNA/boltzmann_sampling.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/boltzmann_sampling.c
@@ -0,0 +1,1109 @@
+/*
+                  partiton function for RNA secondary structures
+
+                  Ivo L Hofacker + Ronny Lorenz
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/boltzmann_sampling.h"
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE void  backtrack(int i, int j, char *pstruc, vrna_fold_compound_t *vc);
+PRIVATE void  backtrack_qm(int i, int j, char *pstruc, vrna_fold_compound_t *vc);
+PRIVATE void  backtrack_qm1(int i,int j, char *pstruc, vrna_fold_compound_t *vc);
+PRIVATE void  backtrack_qm2(int u, int n, char *pstruc, vrna_fold_compound_t *vc);
+PRIVATE char  *wrap_pbacktrack_circ(vrna_fold_compound_t *vc);
+
+PRIVATE void  backtrack_comparative(vrna_fold_compound_t *vc, char *pstruc, int i, int j, double *prob);
+PRIVATE void  backtrack_qm1_comparative(vrna_fold_compound_t *vc, char *pstruc, int i,int j, double *prob);
+
+/*
+ *  @brief Sample a consensus secondary structure from the Boltzmann ensemble according its probability
+ * 
+ *  @ingroup consensus_stochbt
+ *
+ *  @see vrna_pf() for precomputing the partition function matrices, and
+ *
+ *  @param  vc    The #vrna_fold_compound_t of type #VRNA_FC_TYPE_COMPARATIVE with precomputed partition function matrices
+ *  @param  prob  to be described (berni)
+ *  @return       A sampled consensus secondary structure in dot-bracket notation
+ */
+PRIVATE char *pbacktrack_comparative(vrna_fold_compound_t *vc, double *prob);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+/*
+  stochastic backtracking in pf_fold arrays
+  returns random structure S with Boltzman probabilty
+  p(S) = exp(-E(S)/kT)/Z
+*/
+PUBLIC char *
+vrna_pbacktrack(vrna_fold_compound_t *vc){
+
+  char    *structure  = NULL;
+  double  prob        = 1.;
+
+  if(vc && vc->exp_params){
+      switch(vc->type){
+        case VRNA_FC_TYPE_SINGLE:     if(vc->exp_params->model_details.circ){
+                                        return wrap_pbacktrack_circ(vc);
+                                      } else {
+                                        return vrna_pbacktrack5(vc, vc->length);
+                                      }
+                                      break;
+
+        case VRNA_FC_TYPE_COMPARATIVE:  return pbacktrack_comparative(vc, &prob);
+                                      break;
+
+        default:                      vrna_message_warning("unrecognized fold compound type");
+                                      return structure;
+                                      break;
+      }
+  }
+
+  return structure;
+}
+
+PUBLIC char *
+vrna_pbacktrack5( vrna_fold_compound_t *vc,
+                  int length){
+
+  FLT_OR_DBL        r, qt, q_temp, qkl;
+  int               i,j,ij, n, k, u, start, type;
+  char              *pstruc;
+  int               *my_iindx, *jindx, hc_decompose, *hc_up_ext;
+  FLT_OR_DBL        *q, *qb, *q1k, *qln, *scale;
+  char              *ptype, *hard_constraints;
+  short             *S1;
+  vrna_mx_pf_t      *matrices;
+  vrna_hc_t         *hc;
+  vrna_sc_t         *sc;
+  vrna_exp_param_t  *pf_params;
+
+  n         = vc->length;
+
+  pf_params = vc->exp_params;
+  my_iindx  = vc->iindx;
+  jindx     = vc->jindx;
+  matrices  = vc->exp_matrices;
+
+  hc        = vc->hc;
+  sc        = vc->sc;
+  ptype     = vc->ptype;
+  S1        = vc->sequence_encoding;
+
+  q         = matrices->q;
+  qb        = matrices->qb;
+  q1k       = matrices->q1k;
+  qln       = matrices->qln;
+  scale     = matrices->scale;
+
+  hard_constraints  = hc->matrix;
+  hc_up_ext         = hc->up_ext;
+
+  if(length > n)
+    vrna_message_error("part_func.c@pbacktrack5: 3'-end exceeds sequence length");
+  else if(length < 1)
+    vrna_message_error("part_func.c@pbacktrack5: 3'-end too small");
+
+/*
+  if (init_length<1)
+    vrna_message_error("can't backtrack without pf arrays.\n"
+            "Call pf_fold() before pbacktrack()");
+*/
+
+  pstruc = vrna_alloc((length+1)*sizeof(char));
+
+  for (i=0; i<length; i++)
+    pstruc[i] = '.';
+
+  if(!(q1k && qln)){
+    matrices->q1k = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+1));
+    matrices->qln = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+    q1k           = matrices->q1k;
+    qln           = matrices->qln;
+    for (k=1; k<=n; k++) {
+      q1k[k] = q[my_iindx[1] - k];
+      qln[k] = q[my_iindx[k] - n];
+    }
+    q1k[0] = 1.0;
+    qln[n+1] = 1.0;
+  }
+
+
+#ifdef WITH_BOUSTROPHEDON
+  j = length;
+  while (j > 1) {
+  /* find i position of first pair */
+    for (; j>1; j--){
+      if(hc_up_ext[j]){
+        r = vrna_urn() * q[my_iindx[1] - j];
+        q_temp = q[my_iindx[1] - j + 1] * scale[1];
+
+        if(sc){
+          if (sc->exp_energy_up)
+            q_temp *= sc->exp_energy_up[j][1];
+
+          if(sc->exp_f)
+            q_temp *= sc->exp_f(1, j, 1, j-1, VRNA_DECOMP_EXT_EXT, sc->data);
+        }
+
+        if (r > q_temp)  break; /* i is paired */
+      }
+    }
+    if (j<=1) break; /* no more pairs */
+
+    /* now find the pairing partner i */
+    r = vrna_urn() * (q[my_iindx[1] - j] - q_temp);
+    u = j - 1;
+
+    for (qt=0, k=1; k<j; k++) {
+      /* apply alternating boustrophedon scheme to variable i */
+      i             = (int)(1 + (u - 1)*((k - 1) % 2)) + (int)((1-(2*((k - 1) % 2)))*((k - 1)/2));
+      ij            = my_iindx[i]-j;
+      type          = ptype[jindx[j] + i];
+      hc_decompose  = hard_constraints[jindx[j] + i];
+      if (hc_decompose & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+
+        if(type == 0)
+          type = 7;
+
+        qkl = qb[ij] * exp_E_ExtLoop(type, (i>1) ? S1[i-1] : -1, (j<n) ? S1[j+1] : -1, pf_params);
+
+        if (i > 1){
+          qkl *= q[my_iindx[1] - i + 1];
+          if(sc){
+            if(sc->exp_f)
+              qkl *= sc->exp_f(1, j, i-1, i, VRNA_DECOMP_EXT_EXT_STEM, sc->data);
+          }
+        } else {
+          if(sc){
+            if(sc->exp_f)
+              qkl *= sc->exp_f(i, j, i, j, VRNA_DECOMP_EXT_STEM, sc->data);
+          }
+        }
+
+        qt += qkl;
+        if (qt > r) break; /* j is paired */
+      }
+    }
+    if (k==j) vrna_message_error("backtracking failed in ext loop");
+    backtrack(i,j, pstruc, vc);
+    j = i - 1;
+  }
+#else
+  start = 1;
+  while (start<length) {
+  /* find i position of first pair */
+    for (i=start; i<length; i++) {
+      if(hc_up_ext[i]){
+        r = vrna_urn() * qln[i];
+        q_temp = qln[i+1]*scale[1];
+
+        if(sc){
+          if (sc->exp_energy_up)
+            q_temp *= sc->exp_energy_up[i][1];
+
+          if(sc->exp_f)
+            q_temp *= sc->exp_f(i, length, i+1, length, VRNA_DECOMP_EXT_EXT, sc->data);
+        }
+
+        if (r > q_temp)  break; /* i is paired */
+      }
+    }
+    if (i>=length) break; /* no more pairs */
+    /* now find the pairing partner j */
+    r = vrna_urn() * (qln[i] - q_temp);
+    for (qt=0, j=i+1; j<=length; j++) {
+      ij            = my_iindx[i]-j;
+      type          = ptype[jindx[j] + i];
+      hc_decompose  = hard_constraints[jindx[j] + i];
+      if (hc_decompose & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+
+        if(type == 0)
+          type = 7;
+
+        qkl = qb[ij] * exp_E_ExtLoop(type, (i>1) ? S1[i-1] : -1, (j<n) ? S1[j+1] : -1, pf_params);
+
+        if (j<length){
+          qkl *= qln[j+1];
+          if(sc){
+            if(sc->exp_f)
+              qkl *= sc->exp_f(i, length, j, j+1, VRNA_DECOMP_EXT_STEM_EXT, sc->data);
+          }
+        } else {
+          if(sc){
+            if(sc->exp_f)
+              qkl *= sc->exp_f(i, j, i, j, VRNA_DECOMP_EXT_STEM, sc->data);
+          }
+        }
+
+        qt += qkl;
+        if (qt > r) break; /* j is paired */
+      }
+    }
+    if (j==length+1) vrna_message_error("backtracking failed in ext loop");
+    start = j+1;
+    backtrack(i,j, pstruc, vc);
+  }
+#endif
+  return pstruc;
+}
+
+PRIVATE void
+backtrack_qm( int i,
+              int j,
+              char *pstruc,
+              vrna_fold_compound_t *vc){
+
+  /* divide multiloop into qm and qm1  */
+  FLT_OR_DBL        qmt, r, q_temp;
+  int               k, n, u, cnt, span, turn;
+  FLT_OR_DBL        *qm, *qm1, *expMLbase;
+  int               *my_iindx, *jindx, *hc_up_ml;
+  vrna_sc_t         *sc;
+  vrna_hc_t         *hc;
+
+  n = j;
+  vrna_mx_pf_t  *matrices = vc->exp_matrices;
+
+  my_iindx  = vc->iindx;
+  jindx     = vc->jindx;
+
+  hc        = vc->hc;
+  sc        = vc->sc;
+  hc_up_ml  = hc->up_ml;
+
+  qm        = matrices->qm;
+  qm1       = matrices->qm1;
+  expMLbase = matrices->expMLbase;
+
+  turn      = vc->exp_params->model_details.min_loop_size;
+
+  while(j>i){
+    /* now backtrack  [i ... j] in qm[] */
+    r   = vrna_urn() * qm[my_iindx[i] - j];
+    qmt = qm1[jindx[j]+i];
+    k = cnt  = i;
+    if(qmt<r)
+      for(span = j - i,cnt=i+1; cnt<=j; cnt++){
+#ifdef WITH_BOUSTROPHEDON
+        k = (int)(i + 1 + span * ((cnt - i - 1) % 2)) + (int)((1 - (2 * ((cnt - i - 1) % 2))) * ((cnt - i) / 2));
+#else
+        k = cnt;
+#endif
+        q_temp = 0.;
+        u = k - i;
+        /* [i...k] is unpaired */
+        if(hc_up_ml[i] >= u){
+          q_temp += expMLbase[u] * qm1[jindx[j]+k];
+
+          if(sc){
+            if(sc->exp_energy_up)
+              q_temp *= sc->exp_energy_up[i][u];
+
+            if(sc->exp_f)
+              q_temp *= sc->exp_f(i, j, k, j, VRNA_DECOMP_ML_ML, sc->data);
+          }
+
+          qmt += q_temp;
+        }
+
+        /* split between k-1, k */
+        q_temp = qm[my_iindx[i]-(k-1)] * qm1[jindx[j]+k];
+
+        if(sc){
+          if(sc->exp_f)
+            q_temp *= sc->exp_f(i, j, k-1, k, VRNA_DECOMP_ML_ML_ML, sc->data);
+        }
+
+        qmt += q_temp;
+
+        if(qmt >= r){ break;}
+      }
+    if(cnt>j) vrna_message_error("backtrack failed in qm");
+
+    backtrack_qm1(k, j, pstruc, vc);
+
+    if(k<i+turn) break; /* no more pairs */
+
+    u = k - i;
+    /* check whether we make the decision to leave [i..k-1] unpaired */
+    if(hc_up_ml[i] >= u){
+      q_temp = expMLbase[u];
+
+      if(sc){
+        if(sc->exp_energy_up)
+          q_temp *= sc->exp_energy_up[i][u];
+
+        if(sc->exp_f)
+          q_temp *= sc->exp_f(i, k-1, i, k-1, VRNA_DECOMP_ML_UP, sc->data);
+      }
+
+      r = vrna_urn() * (qm[my_iindx[i]-(k-1)] + q_temp);
+      if(q_temp >= r) break;
+    }
+    j = k-1;
+  }
+}
+
+PRIVATE void
+backtrack_qm1(int i,
+              int j,
+              char *pstruc,
+              vrna_fold_compound_t *vc){
+
+  /* i is paired to l, i<l<j; backtrack in qm1 to find l */
+  int           ii, l, il, type, n, turn;
+  FLT_OR_DBL    qt, r, q_temp;
+  FLT_OR_DBL    *qm1, *qb, *expMLbase;
+  vrna_mx_pf_t  *matrices;
+  int           u, *my_iindx, *jindx, *hc_up_ml;
+  char          *ptype, *hard_constraints;
+  short         *S1;
+  vrna_sc_t     *sc;
+  vrna_hc_t     *hc;
+  vrna_exp_param_t  *pf_params;
+
+
+  pf_params = vc->exp_params;
+  my_iindx  = vc->iindx;
+  jindx     = vc->jindx;
+
+  ptype     = vc->ptype;
+
+  sc        = vc->sc;
+  hc        = vc->hc;
+  hc_up_ml  = hc->up_ml;
+  hard_constraints  = hc->matrix;
+
+  matrices  = vc->exp_matrices;
+  qb        = matrices->qb;
+  qm1       = matrices->qm1;
+  expMLbase = matrices->expMLbase;
+  S1        = vc->sequence_encoding;
+
+  turn      = pf_params->model_details.min_loop_size;
+
+  n = j;
+  r = vrna_urn() * qm1[jindx[j]+i];
+  ii = my_iindx[i];
+  for (qt=0., l=j; l > i + turn; l--) {
+    il = jindx[l] + i;
+    if(hard_constraints[il] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC){
+      u = j - l;
+      if(hc_up_ml[l+1] >= u){
+        type = ptype[il];
+
+        if(type == 0)
+          type = 7;
+
+        q_temp =  qb[ii-l]
+                  * exp_E_MLstem(type, S1[i-1], S1[l+1], pf_params)
+                  * expMLbase[j-l];
+
+        if(sc){
+          if(sc->exp_energy_up)
+            q_temp *= sc->exp_energy_up[l+1][j-l];
+
+          if(sc->exp_f)
+            q_temp *= sc->exp_f(i, j, i, l, VRNA_DECOMP_ML_STEM, sc->data);
+        }
+
+        qt += q_temp;
+        if (qt>=r) break;
+      } else {
+        l = i + turn;
+        break;
+      }
+    }
+  }
+  if (l < i + turn + 1) vrna_message_error("backtrack failed in qm1");
+  backtrack(i, l, pstruc, vc);
+}
+
+PRIVATE void
+backtrack_qm2(int k,
+              int n,
+              char *pstruc,
+              vrna_fold_compound_t *vc){
+
+  FLT_OR_DBL  qom2t, r;
+  int         u, turn;
+  FLT_OR_DBL  *qm1, *qm2;
+  int         *jindx;
+
+  jindx     = vc->jindx;
+  qm1       = vc->exp_matrices->qm1;
+  qm2       = vc->exp_matrices->qm2;
+  turn      = vc->exp_params->model_details.min_loop_size;
+
+  r= vrna_urn()*qm2[k];
+  /* we have to search for our barrier u between qm1 and qm1  */
+  for (qom2t = 0.,u=k+turn+1; u<n-turn-1; u++){
+    qom2t += qm1[jindx[u]+k]*qm1[jindx[n]+(u+1)];
+    if(qom2t > r) break;
+  }
+  if(u==n-turn) vrna_message_error("backtrack failed in qm2");
+  backtrack_qm1(k, u, pstruc, vc);
+  backtrack_qm1(u+1, n, pstruc, vc);
+}
+
+PRIVATE void
+backtrack(int i,
+          int j,
+          char *pstruc,
+          vrna_fold_compound_t *vc){
+
+  char              *ptype, *sequence, *hard_constraints, hc_decompose;
+  vrna_exp_param_t  *pf_params;
+  FLT_OR_DBL        *qb, *qm, *qm1, *scale, tmp;
+  FLT_OR_DBL        r, qbt1, qt, q_temp;
+  vrna_mx_pf_t      *matrices;
+  int               *my_iindx, *jindx, *hc_up_int, *hc_up_hp;
+  vrna_sc_t         *sc;
+  vrna_hc_t         *hc;
+  short             *S1;
+
+  sequence    = vc->sequence;
+  pf_params   = vc->exp_params;
+  ptype       = vc->ptype;
+  S1          = vc->sequence_encoding;
+  my_iindx    = vc->iindx;
+  jindx       = vc->jindx;
+
+  sc          = vc->sc;
+  hc          = vc->hc;
+  hc_up_hp    = hc->up_hp;
+  hc_up_int   = hc->up_int;
+  hard_constraints  = hc->matrix;
+
+  matrices    = vc->exp_matrices;
+  qb          = matrices->qb;
+  qm          = matrices->qm;
+  qm1         = matrices->qm1;
+  scale       = matrices->scale;
+
+  int noGUclosure = pf_params->model_details.noGUclosure;
+  int turn        = pf_params->model_details.min_loop_size;
+  int   *rtype    = &(pf_params->model_details.rtype[0]);
+  int n;
+  n = j;
+  do {
+    int k, l, kl, u, u1, u2, max_k, min_l;
+    unsigned char type;
+    k = i;
+    l = j;
+
+    pstruc[i-1] = '('; pstruc[j-1] = ')';
+
+    r = vrna_urn() * qb[my_iindx[i]-j];
+    tmp = qb[my_iindx[i]-j];
+    type = (unsigned char)ptype[jindx[j] + i];
+    hc_decompose = hard_constraints[jindx[j] + i];
+    if(hc_decompose & VRNA_CONSTRAINT_CONTEXT_HP_LOOP){ /* hairpin contribution */
+
+      if(type == 0)
+        type = 7;
+
+      u = j-i-1;
+
+      if (((type==3)||(type==4))&&noGUclosure) qbt1 = 0;
+      else{
+        q_temp = exp_E_Hairpin(u, type, S1[i+1], S1[j-1], sequence+i-1, pf_params) * scale[u+2];
+
+        if(sc){
+          if(sc->exp_energy_up)
+            q_temp *= sc->exp_energy_up[i+1][u];
+
+          if(sc->exp_f)
+            q_temp *= sc->exp_f(i, j, i, j, VRNA_DECOMP_PAIR_HP, sc->data);
+        }
+
+        qbt1 = q_temp;
+
+      }
+      if (qbt1>=r) return; /* found the hairpin we're done */
+    }
+
+    if(hc_decompose & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){ /* interior loop contributions */
+
+      if(type == 0)
+        type = 7;
+
+      max_k = i + MAXLOOP + 1;
+      max_k = MIN2(max_k, j - turn - 2);
+      max_k = MIN2(max_k, i + 1 + hc_up_int[i+1]);
+      for (k = i + 1; k<=max_k; k++) {
+        u1    = k-i-1;
+        min_l = MAX2(k+turn+1,j-1-MAXLOOP+u1);
+        kl    = my_iindx[k] - j + 1;
+        for (u2 = 0, l=j-1; l>=min_l; l--, kl++, u2++){
+          if(hc_up_int[l+1] < u2) break;
+          if(hard_constraints[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC){
+            unsigned char type_2 = (unsigned char)ptype[jindx[l] + k];
+            type_2 = rtype[type_2];
+
+            if(type_2 == 0)
+              type_2 = 7;
+
+            /* add *scale[u1+u2+2] */
+            q_temp = qb[kl]
+                     * scale[u1+u2+2]
+                     * exp_E_IntLoop(u1, u2, type, type_2, S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params);
+
+            if(sc){
+              if(sc->exp_energy_up)
+                q_temp *=   sc->exp_energy_up[i+1][u1]
+                          * sc->exp_energy_up[l+1][u2];
+
+              if(sc->exp_energy_stack)
+                if((i + 1 == k) && (j - 1 == l))
+                  q_temp *=   sc->exp_energy_stack[i]
+                            * sc->exp_energy_stack[k]
+                            * sc->exp_energy_stack[l]
+                            * sc->exp_energy_stack[j];
+
+              if(sc->exp_f)
+                q_temp *= sc->exp_f(i, j, k, l, VRNA_DECOMP_PAIR_IL, sc->data);
+            }
+
+            qbt1 += q_temp;
+            if (qbt1 >= r) break;
+          }
+        }
+        if (qbt1 >= r) break;
+      }
+      if (k <= max_k) {
+        i=k; j=l;
+      } else { /* interior loop contributions did not exceed threshold, so we break */
+        break;
+      }
+    } else { /* must not be interior loop, so we break out */
+      break;
+    }
+  } while (1);
+
+  /* backtrack in multi-loop */
+  {
+    int k, ii, jj, tt;
+    FLT_OR_DBL closingPair;
+    tt = rtype[(unsigned char)ptype[jindx[j] + i]];
+    closingPair =   pf_params->expMLclosing
+                  * exp_E_MLstem(tt, S1[j-1], S1[i+1], pf_params)
+                  * scale[2];
+    if(sc){
+      if(sc->exp_f)
+        closingPair *= sc->exp_f(i, j, i, j, VRNA_DECOMP_PAIR_ML, sc->data);
+    }
+
+    i++; j--;
+    /* find the first split index */
+    ii = my_iindx[i]; /* ii-j=[i,j] */
+    jj = jindx[j]; /* jj+i=[j,i] */
+    for (qt=qbt1, k=i+1; k<j; k++) {
+
+      q_temp = qm[ii-(k-1)] * qm1[jj+k] * closingPair;
+
+      if(sc){
+        if(sc->exp_f)
+          q_temp *= sc->exp_f(i, j, k-1, k, VRNA_DECOMP_ML_ML_ML, sc->data);
+      }
+
+      qt += q_temp;
+      qbt1 += q_temp;
+      if (qt>=r) break;
+    }
+    if (k>=j){
+      vrna_message_error("backtrack failed, can't find split index ");
+    }
+
+    backtrack_qm1(k, j, pstruc, vc);
+
+    j = k-1;
+    backtrack_qm(i, j, pstruc, vc);
+  }
+}
+
+PRIVATE char *
+wrap_pbacktrack_circ(vrna_fold_compound_t *vc){
+
+  FLT_OR_DBL  r, qt;
+  int         i, j, k, l, n;
+  vrna_exp_param_t   *pf_params;
+  FLT_OR_DBL  qo, qmo;
+  FLT_OR_DBL  *scale, *qb, *qm, *qm2;
+  char        *sequence, *ptype, *pstruc;
+  int         *my_iindx, *jindx;
+  short       *S1;
+
+  vrna_mx_pf_t *matrices;
+
+  pf_params     = vc->exp_params;
+  matrices      = vc->exp_matrices;
+  ptype         = vc->ptype;
+  my_iindx      = vc->iindx;
+  jindx         = vc->jindx;
+  S1            = vc->sequence_encoding;
+
+  qo            = matrices->qo;
+  qmo           = matrices->qmo;
+  qb            = matrices->qb;
+  qm            = matrices->qm;
+  qm2           = matrices->qm2;
+  scale         = matrices->scale;
+
+  FLT_OR_DBL  expMLclosing  = pf_params->expMLclosing;
+  int         *rtype        = &(pf_params->model_details.rtype[0]);
+  int         turn          = pf_params->model_details.min_loop_size;
+
+  sequence  = vc->sequence;
+  n         = vc->length;
+
+/*
+  if (init_length<1)
+    vrna_message_error("can't backtrack without pf arrays.\n"
+      "Call pf_circ_fold() before pbacktrack_circ()");
+*/
+
+  pstruc = vrna_alloc((n+1)*sizeof(char));
+
+  /* initialize pstruct with single bases  */
+  for (i=0; i<n; i++) pstruc[i] = '.';
+
+  qt = 1.0*scale[n];
+  r = vrna_urn() * qo;
+
+  /* open chain? */
+  if(qt > r) return pstruc;
+
+  for(i=1; (i < n); i++){
+    for(j=i+turn+1;(j<=n); j++){
+
+      int type, u;
+      /* 1. first check, wether we can do a hairpin loop  */
+      u = n-j + i-1;
+      if (u<turn) continue;
+
+      type = ptype[jindx[j] + i];
+      if (!type) continue;
+
+      type=rtype[type];
+
+      char loopseq[10];
+      if (u<7){
+        strcpy(loopseq , sequence+j-1);
+        strncat(loopseq, sequence, i);
+      }
+
+      qt += qb[my_iindx[i]-j] * exp_E_Hairpin(u, type, S1[j+1], S1[i-1],  loopseq, pf_params) * scale[u];
+      /* found a hairpin? so backtrack in the enclosed part and we're done  */
+      if(qt>r){ backtrack(i,j, pstruc, vc); return pstruc;}
+
+      /* 2. search for (k,l) with which we can close an interior loop  */
+      for(k=j+1; (k < n); k++){
+        int ln1, lstart;
+        ln1 = k - j - 1;
+        if(ln1+i-1>MAXLOOP) break;
+
+        lstart = ln1+i-1+n-MAXLOOP;
+        if(lstart<k+turn+1) lstart = k + turn + 1;
+        for(l=lstart; (l <= n); l++){
+            int ln2, type2;
+            ln2 = (i - 1) + (n - l);
+            if((ln1+ln2) > MAXLOOP) continue;
+
+            type2 = ptype[jindx[l] + k];
+            if(!type) continue;
+            type2 = rtype[type2];
+            qt += qb[my_iindx[i]-j] * qb[my_iindx[k]-l] * exp_E_IntLoop(ln2, ln1, type2, type, S1[l+1], S1[k-1], S1[i-1], S1[j+1], pf_params) * scale[ln1 + ln2];
+            /* found an exterior interior loop? also this time, we can go straight  */
+            /* forward and backtracking the both enclosed parts and we're done      */
+            if(qt>r){ backtrack(i,j, pstruc, vc); backtrack(k,l, pstruc, vc); return pstruc;}
+        }
+      } /* end of kl double loop */
+    }
+  } /* end of ij double loop  */
+  {
+    /* as we reach this part, we have to search for our barrier between qm and qm2  */
+    qt = 0.;
+    r = vrna_urn()*qmo;
+    for(k=turn+2; k<n-2*turn-3; k++){
+      qt += qm[my_iindx[1]-k] * qm2[k+1] * expMLclosing;
+      /* backtrack in qm and qm2 if we've found a valid barrier k  */
+      if(qt>r){ backtrack_qm(1,k, pstruc, vc); backtrack_qm2(k+1,n, pstruc, vc); return pstruc;}
+    }
+  }
+  /* if we reach the actual end of this function, an error has occured  */
+  /* cause we HAVE TO find an exterior loop or an open chain!!!         */
+  vrna_message_error("backtracking failed in exterior loop");
+  return pstruc;
+}
+
+
+PRIVATE char *
+pbacktrack_comparative( vrna_fold_compound_t *vc,
+                        double *prob){
+
+  FLT_OR_DBL  r, gr, qt;
+  int         k,i,j, start,s;
+  FLT_OR_DBL      probs=1;
+  char        *pstruc = NULL;
+
+  int               n_seq       = vc->n_seq;
+  int               n           = vc->length;
+  short             **S         = vc->S;
+  short             **S5        = vc->S5;     /*S5[s][i] holds next base 5' of i in sequence s*/
+  short             **S3        = vc->S3;     /*Sl[s][i] holds next base 3' of i in sequence s*/
+  vrna_exp_param_t  *pf_params  = vc->exp_params;
+  vrna_mx_pf_t      *matrices   = vc->exp_matrices;
+  vrna_md_t         *md         = &(pf_params->model_details);
+  int               *my_iindx   = vc->iindx;
+  vrna_hc_t         *hc         = vc->hc;
+  vrna_sc_t         **sc        = vc->scs;
+  FLT_OR_DBL        *q          = matrices->q;
+  FLT_OR_DBL        *qb         = matrices->qb;
+
+  if((matrices->q1k == NULL) || (matrices->qln == NULL)){
+    free(matrices->q1k);
+    matrices->q1k = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+1));
+    free(matrices->qln);
+    matrices->qln = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+  }
+
+  FLT_OR_DBL *q1k   = matrices->q1k;
+  FLT_OR_DBL *qln   = matrices->qln;
+  FLT_OR_DBL *scale = matrices->scale;
+
+  for (k=1; k<=n; k++) {
+    q1k[k] = q[my_iindx[1] - k];
+    qln[k] = q[my_iindx[k] - n];
+  }
+  q1k[0] = 1.0;
+  qln[n+1] = 1.0;
+
+  pstruc = vrna_alloc((n+1)*sizeof(char));
+
+  for (i=0; i<n; i++)
+    pstruc[i] = '.';
+
+
+  start = 1;
+  while (start<n) {
+  /* find i position of first pair */
+    probs=1.;
+    for (i=start; i<n; i++) {
+      gr = vrna_urn() * qln[i];
+      if (gr > qln[i+1]*scale[1]) {
+        *prob=*prob*probs*(1-qln[i+1]*scale[1]/qln[i]);
+        break; /* i is paired */
+      }
+      probs*=qln[i+1]*scale[1]/qln[i];
+    }
+    if (i>=n) {
+      *prob=*prob*probs;
+      break; /* no more pairs */
+    }
+    /* now find the pairing partner j */
+    r = vrna_urn() * (qln[i] - qln[i+1]*scale[1]);
+    for (qt=0, j=i+1; j<=n; j++) {
+      int xtype;
+      /*  type = ptype[my_iindx[i]-j];
+          if (type) {*/
+      FLT_OR_DBL qkl;
+      if (qb[my_iindx[i]-j]>0) {
+        qkl = qb[my_iindx[i]-j]*qln[j+1];  /*if psc too small qb=0!*/
+        for (s=0; s< n_seq; s++) {
+          xtype=md->pair[S[s][i]][S[s][j]];
+          if (xtype==0) xtype=7;
+          qkl *= exp_E_ExtLoop(xtype, (i>1) ? S5[s][i] : -1, (j<n) ? S3[s][j] : -1, pf_params);
+        }
+        qt += qkl; /*?*exp(pscore[jindx[j]+i]/kTn)*/
+        if (qt > r) {
+          *prob=*prob*(qkl/(qln[i] - qln[i+1]*scale[1]));/*probs*=qkl;*/
+          break; /* j is paired */
+        }
+      }
+    }
+    if (j==n+1) vrna_message_error("backtracking failed in ext loop");
+    start = j+1;
+    backtrack_comparative(vc, pstruc, i, j, prob); /*?*/
+  }
+
+  return pstruc;
+}
+
+
+PRIVATE void
+backtrack_comparative(vrna_fold_compound_t *vc,
+          char *pstruc,
+          int i,
+          int j,
+          double *prob){
+
+  int               n_seq       = vc->n_seq;
+  short             **S         = vc->S;
+  short             **S5        = vc->S5;     /*S5[s][i] holds next base 5' of i in sequence s*/
+  short             **S3        = vc->S3;     /*Sl[s][i] holds next base 3' of i in sequence s*/
+  char              **Ss        = vc->Ss;
+  unsigned short    **a2s       = vc->a2s;
+  vrna_exp_param_t  *pf_params  = vc->exp_params;
+  vrna_mx_pf_t      *matrices   = vc->exp_matrices;
+  vrna_md_t         *md         = &(pf_params->model_details);
+  int               *my_iindx   = vc->iindx;
+  int               *jindx      = vc->jindx;
+  vrna_hc_t         *hc         = vc->hc;
+  vrna_sc_t         **sc        = vc->scs;
+  FLT_OR_DBL        *qb         = matrices->qb;
+  FLT_OR_DBL        *qm         = matrices->qm;
+  FLT_OR_DBL        *qm1        = matrices->qm1;
+  int               *pscore     = vc->pscore;     /* precomputed array of pair types */
+
+  FLT_OR_DBL        *scale        = matrices->scale;
+  FLT_OR_DBL        *expMLbase    = matrices->expMLbase;
+
+  /*backtrack given i,j basepair!*/
+  FLT_OR_DBL kTn = pf_params->kT/10.;
+  int *type = (int *)vrna_alloc(sizeof(int) * n_seq);
+
+  do {
+    FLT_OR_DBL  r, qbt1, max_k, min_l;
+    int         k, l, u, u1, u2, s;
+    pstruc[i-1] = '('; pstruc[j-1] = ')';
+    for (s=0; s<n_seq; s++) {
+      type[s] = md->pair[S[s][i]][S[s][j]];
+      if (type[s]==0) type[s]=7;
+    }
+    r = vrna_urn() * (qb[my_iindx[i]-j]/exp(pscore[jindx[j]+i]/kTn)); /*?*exp(pscore[jindx[j]+i]/kTn)*/
+
+    qbt1=1.;
+    for (s=0; s<n_seq; s++){
+      u = a2s[s][j-1]-a2s[s][i];
+      if (a2s[s][i]<1) continue;
+      char loopseq[10];
+      if(u < 9){
+        strncpy(loopseq, Ss[s]+a2s[s][i]-1, 10);
+      }
+      qbt1 *= exp_E_Hairpin(u, type[s], S3[s][i], S5[s][j], loopseq, pf_params);
+    }
+    qbt1 *= scale[j-i+1];
+
+    if (qbt1>r) {
+      *prob=*prob*qbt1/(qb[my_iindx[i]-j]/exp(pscore[jindx[j]+i]/kTn));/*probs*=qbt1;*/
+      free(type);
+      return; /* found the hairpin we're done */
+    }
+
+
+    max_k = MIN2(i+MAXLOOP+1,j-TURN-2);
+    l = MAX2(i+TURN+2,j-MAXLOOP-1);
+    for (k=i+1; k<=max_k; k++){
+      min_l = MAX2(k+TURN+1,j-1-MAXLOOP+k-i-1);
+
+      for (l=min_l; l<j; l++){
+        FLT_OR_DBL qloop=1;
+        int type_2;
+        if (qb[my_iindx[k]-l]==0) {qloop=0; continue;}
+        for (s=0; s<n_seq; s++) {
+          u1      = a2s[s][k-1] - a2s[s][i]/*??*/;
+          u2      = a2s[s][j-1] - a2s[s][l];
+          type_2  = md->pair[S[s][l]][S[s][k]];
+          if(type_2 == 0) type_2 = 7;
+
+          qloop *= exp_E_IntLoop(u1, u2, type[s], type_2, S3[s][i], S5[s][j],S5[s][k], S3[s][l], pf_params);
+        }
+
+        if(sc)
+          for (s=0; s<n_seq; s++) {
+            if(sc[s]){
+              int u1 = a2s[s][k-1] - a2s[s][i];
+              int u2 = a2s[s][j-1] - a2s[s][l];
+              if(u1 + u2 == 0)
+                if(sc[s]->exp_energy_stack){
+                  if(S[s][i] && S[s][j] && S[s][k] && S[s][l]){ /* don't allow gaps in stack */
+                    qloop *=    sc[s]->exp_energy_stack[i]
+                              * sc[s]->exp_energy_stack[k]
+                              * sc[s]->exp_energy_stack[l]
+                              * sc[s]->exp_energy_stack[j];
+                  }
+                }
+            }
+          }
+
+        qbt1 += qb[my_iindx[k]-l] * qloop * scale[k-i+j-l];
+
+        if (qbt1 > r) {
+         *prob =  *prob
+                  * qb[my_iindx[k]-l]
+                  * qloop
+                  * scale[k-i+j-l]
+                  / (   qb[my_iindx[i]-j]
+                      / exp(pscore[jindx[j]+i] / kTn));
+         /*
+          prob*=qb[my_iindx[k]-l] * qloop * scale[k-i+j-l];
+         */
+          break;
+        }
+      }
+      if (qbt1 > r) break;
+    }
+    if (l<j) {
+      i=k; j=l;
+    }
+    else {
+      *prob=*prob*(1-qbt1/(qb[my_iindx[i]-j]/exp(pscore[jindx[j]+i]/kTn)));
+      break;
+    }
+  } while (1);
+
+  /* backtrack in multi-loop */
+  {
+    FLT_OR_DBL r, qt;
+    int k, ii, jj;
+    FLT_OR_DBL qttemp=0;;
+    i++; j--;
+    /* find the first split index */
+    ii = my_iindx[i]; /* ii-j=[i,j] */
+    jj = jindx[j]; /* jj+i=[j,i] */
+    for (qt=0., k=i+1; k<j; k++) qttemp += qm[ii-(k-1)]*qm1[jj+k];
+    r = vrna_urn() * qttemp;
+    for (qt=0., k=i+1; k<j; k++) {
+      qt += qm[ii-(k-1)]*qm1[jj+k];
+      if (qt>=r){
+        *prob = *prob
+                * qm[ii-(k-1)]
+                * qm1[jj+k]
+                / qttemp;/*qttemp;*/
+        /*        prob*=qm[ii-(k-1)]*qm1[jj+k];*/
+        break;
+      }
+    }
+    if (k>=j) vrna_message_error("backtrack failed, can't find split index ");
+
+    backtrack_qm1_comparative(vc, pstruc, k, j, prob);
+
+    j = k-1;
+    while (j>i) {
+      /* now backtrack  [i ... j] in qm[] */
+      jj = jindx[j];/*habides??*/
+      ii = my_iindx[i];
+      r = vrna_urn() * qm[ii - j];
+      qt = qm1[jj+i]; k=i;
+      if (qt<r)
+        for (k=i+1; k<=j; k++) {
+          qt += (qm[ii-(k-1)]+expMLbase[k-i]/*n_seq??*/)*qm1[jj+k];
+          if (qt >= r) {
+            *prob = *prob
+                    * (qm[ii-(k-1)] + expMLbase[k-i])
+                    * qm1[jj+k]
+                    / qm[ii - j];/*???*/
+            /*            probs*=qt;*/
+            break;
+          }
+        }
+      else {
+        *prob = *prob * qt / qm[ii - j];/*??*/
+      }
+      if (k>j) vrna_message_error("backtrack failed in qm");
+
+      backtrack_qm1_comparative(vc, pstruc, k, j, prob);
+
+      if (k<i+TURN) break; /* no more pairs */
+      r = vrna_urn() * (qm[ii-(k-1)] + expMLbase[k-i]);
+      if (expMLbase[k-i] >= r) {
+        *prob = *prob * expMLbase[k-i] / (qm[ii-(k-1)] + expMLbase[k-i]);
+        break; /* no more pairs */
+      }
+      j = k-1;
+      /* whatishere?? */
+    }
+  }
+  free(type);
+}
+
+PRIVATE void
+backtrack_qm1_comparative(vrna_fold_compound_t *vc,
+              char *pstruc,
+              int i,
+              int j,
+              double *prob){
+
+  int               n_seq       = vc->n_seq;
+  short             **S         = vc->S;
+  short             **S5        = vc->S5;     /*S5[s][i] holds next base 5' of i in sequence s*/
+  short             **S3        = vc->S3;     /*Sl[s][i] holds next base 3' of i in sequence s*/
+  vrna_exp_param_t  *pf_params  = vc->exp_params;
+  vrna_mx_pf_t      *matrices   = vc->exp_matrices;
+  vrna_md_t         *md         = &(pf_params->model_details);
+  int               *my_iindx   = vc->iindx;
+  int               *jindx      = vc->jindx;
+  vrna_hc_t         *hc         = vc->hc;
+  vrna_sc_t         **sc        = vc->scs;
+  FLT_OR_DBL        *qb         = matrices->qb;
+  FLT_OR_DBL        *qm1        = matrices->qm1;
+  FLT_OR_DBL        *expMLbase    = matrices->expMLbase;
+
+  /* i is paired to l, i<l<j; backtrack in qm1 to find l */
+  int ii, l, xtype,s;
+  FLT_OR_DBL qt, r, tempz;
+  r = vrna_urn() * qm1[jindx[j]+i];
+  ii = my_iindx[i];
+  for (qt=0., l=i+TURN+1; l<=j; l++) {
+    if (qb[ii-l]==0) continue;
+    tempz=1.;
+    for (s=0; s<n_seq; s++) {
+      xtype = md->pair[S[s][i]][S[s][l]];
+      if (xtype==0) xtype=7;
+      tempz *= exp_E_MLstem(xtype, S5[s][i], S3[s][l], pf_params);
+    }
+    qt +=  qb[ii-l]*tempz*expMLbase[j-l];
+    if (qt>=r) {
+      *prob = *prob
+              * qb[ii-l]
+              * tempz
+              * expMLbase[j-l]
+              / qm1[jindx[j]+i];
+      /* probs*=qb[ii-l]*tempz*expMLbase[j-l];*/
+      break;
+    }
+  }
+  if (l>j) vrna_message_error("backtrack failed in qm1");
+
+  backtrack_comparative(vc, pstruc, i, l, prob);
+}
+
diff --git a/C/ViennaRNA/boltzmann_sampling.h b/C/ViennaRNA/boltzmann_sampling.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/boltzmann_sampling.h
@@ -0,0 +1,46 @@
+#ifndef VIENNA_RNA_PACKAGE_BOLTZMANN_SAMPLING_H
+#define VIENNA_RNA_PACKAGE_BOLTZMANN_SAMPLING_H
+
+#include <ViennaRNA/data_structures.h>
+
+/**
+ *  @file boltzmann_sampling.h
+ *  @ingroup subopt_and_representatives
+ *  @brief Boltzmann Sampling of secondary structures from the ensemble
+ *
+ *  A.k.a. Stochastic backtracking
+ */
+
+/**
+ *  @brief Sample a secondary structure of a subsequence from the Boltzmann ensemble according its probability
+ *
+ *  @ingroup subopt_stochbt
+ *  @pre    The fold compound has to be obtained using the #VRNA_OPTION_HYBRID option in vrna_fold_compound()
+ *  @pre    vrna_pf() has to be called first to fill the partition function matrices
+ *
+ *  @param  vc      The fold compound data structure
+ *  @param  length  The length of the subsequence to consider (starting with 5' end)
+ *  @return         A sampled secondary structure in dot-bracket notation
+ */
+char    *vrna_pbacktrack5(vrna_fold_compound_t *vc, int length);
+
+/**
+ *  @brief Sample a secondary structure (consensus structure) from the Boltzmann ensemble according its probability
+ *
+ *  @ingroup subopt_stochbt
+ *  @pre    The dynamic programming (DP) matrices have to allow for unique multibranch loop decomposition, i.e.
+ *          the vrna_md_t.uniq_ML flag has to be non-zero before calling vrna_fold_compound()
+ *  @pre    vrna_pf() has to be called first to fill the partition function matrices
+ *
+ *  @note This function is polymorphic. It accepts #vrna_fold_compound_t of type
+ *        #VRNA_FC_TYPE_SINGLE, and #VRNA_FC_TYPE_COMPARATIVE.
+ *
+ *  @note The function will automagically detect cicular RNAs based on the model_details in exp_params as
+ *        provided via the #vrna_fold_compound_t
+ *
+ *  @param  vc      The fold compound data structure
+ *  @return         A sampled secondary structure in dot-bracket notation
+ */
+char    *vrna_pbacktrack(vrna_fold_compound_t *vc);
+
+#endif
diff --git a/C/ViennaRNA/c_plex.c b/C/ViennaRNA/c_plex.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/c_plex.c
@@ -0,0 +1,1194 @@
+/*
+           compute the duplex structure of two RNA strands,
+                allowing only inter-strand base pairs.
+         see cofold() for computing hybrid structures without
+                             restriction.
+                             Ivo Hofacker
+                          Vienna RNA package
+
+*/
+
+
+/*
+  library containing the function used in rnaplex
+  the program rnaplex uses the following function
+  Lduplexfold: finds high scoring segments
+  it stores the end-position of these segments in an array
+  and call then for each of these positions the duplexfold function
+  which allows one to make backtracking for each of the high scoring position
+  It allows one to find suboptimal partially overlapping (depends on a a parameter)
+  duplexes between a long RNA and a shorter one.
+  Contrarly to RNAduplex, the energy model is not in E~log(N),
+  where N is the length of an interial loop but used an affine model,
+  where the extension and begin parameter are fitted to the energy
+  parameter used by RNAduplex. This allows one to check for duplex between a short RNA(20nt)
+  and a long one at the speed of 1Mnt/s. At this speed the whole genome (3Gnt) can be analyzed for one siRNA
+  in about 50 minutes.
+  The algorithm is based on an idea by Durbin and Eddy:when the alginment reach a value larger than a
+  given threshold this value is stored in an array. When the alignment score goes
+  then under this threshold, the alignemnent begin from this value, in that way the backtracking allow us
+  to find all non-overlapping high-scoring segments.
+  For more information check "durbin, biological sequence analysis"
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/plex.h"
+#include "ViennaRNA/ali_plex.h"
+#include "ViennaRNA/loop_energies.h"
+
+/* int subopt_sorted=0; */
+
+#define PUBLIC
+#define PRIVATE static
+
+#define STACK_BULGE1  1   /* stacking energies for bulges of size 1 */
+#define NEW_NINIO     1   /* new asymetry penalty */
+#define ARRAY 32          /*array size*/
+#define UNIT 100
+#define MINPSCORE -2 * UNIT
+PRIVATE void  encode_seqs(const char *s1, const char *s2);
+PRIVATE short *encode_seq(const char *seq);
+/* PRIVATE void  my_encode_seq(const char *s1, const char *s2); */
+PRIVATE void  update_dfold_params(void);
+/* PRIVATE int   compare(const void *sub1, const void *sub2); */
+/* PRIVATE int   compare_XS(const void *sub1, const void *sub2); */
+/* PRIVATE duplexT* backtrack(int threshold, const int extension_cost); */
+/* static void  print_struct(duplexT const *dup); */
+
+/* PRIVATE int   print_struct(duplexT const *dup); */
+/* PRIVATE int   get_rescaled_energy(duplexT const *dup); */
+
+PRIVATE char * backtrack_C(int i, int j, const int extension_cost, const char * structure, int *E);
+PRIVATE void   find_max_C(const int *position, const int *position_j, const int delta, const int threshold, const int constthreshold, const int length, const char *s1, const char *s2, const int extension_cost, const int fast, const char* structure);
+PRIVATE void   plot_max_C(const int max, const int max_pos, const int max_pos_j, const int alignment_length, const char *s1, const char *s2, const int extension_cost, const int fast, const char* structure);
+
+
+PRIVATE char *   backtrack_CXS(int i, int j, const int** access_s1, const int** access_s2, const char* structure, int *E);
+PRIVATE void find_max_CXS(const int *position, const int *position_j,const int delta, const int threshold, const int constthreshold, const int alignment_length, const char *s1, const char *s2, const int **access_s1, const int **access_s2, const int fast,const char* structure);
+PRIVATE void     plot_max_CXS(const int max, const int max_pos, const int max_pos_j, const int alignment_length,const char *s1, const char *s2, const int **access_s1, const int **access_s2, const int fast, const char* structure);
+PRIVATE duplexT duplexfold_C(const char *s1, const char *s2, const int extension_cost, const char* structure);
+PRIVATE duplexT duplexfold_CXS(const char *s1, const char *s2,const int **access_s1, const int **access_s2, const int i_pos, const int j_pos, const int threshold ,const char* structure);
+
+
+/*@unused@*/
+
+#define MAXSECTORS      500     /* dimension for a backtrack array */
+#define LOCALITY        0.      /* locality parameter for base-pairs */
+
+#define MIN2(A, B)      ((A) < (B) ? (A) : (B))
+#define MAX2(A, B)      ((A) > (B) ? (A) : (B))
+
+PRIVATE vrna_param_t *P = NULL;
+PRIVATE int   **c = NULL;/*, **in, **bx, **by;*/      /* energy array used in duplexfold */
+/* PRIVATE int ****c_XS; */
+PRIVATE int  **lc = NULL, **lin = NULL, **lbx = NULL, **lby = NULL, **linx = NULL, **liny = NULL;   /* energy array used in Lduplexfold
+                                             this arrays contains only 3 columns
+                                             In this way I reduce my memory use and
+                                             I can make most of my computation and
+                                             accession in the computer cash
+                                             which is the main performance boost*/
+
+
+
+/*PRIVATE int last_cell;                    this variable is the last_cell containing
+                                            the information about the alignment
+                                            useful only if there is an alignment
+                                            which extends till the last nucleotide of
+                                            the long sequence*/
+
+PRIVATE short  *S1 = NULL, *SS1 = NULL, *S2 = NULL, *SS2 = NULL;/*contains the sequences*/
+PRIVATE int   n1,n2;    /* sequence lengths */
+PRIVATE int n3, n4; /*sequence length for the duplex*/;
+PRIVATE int delay_free=0;
+
+
+/*-----------------------------------------------------------------------duplexfold_XS---------------------------------------------------------------------------*/
+
+PRIVATE duplexT duplexfold_CXS(const char *s1, const char *s2, const int **access_s1, const int **access_s2,
+                               const int i_pos, const int j_pos, const int threshold, const char* structure) {
+  int i, j,p,q,Emin=INF, l_min=0, k_min=0;
+  char *struc;
+  struc=NULL;
+  duplexT mfe;
+  vrna_md_t md;
+  int bonus=-10000;
+  n3 = (int) strlen(s1);
+  n4 = (int) strlen(s2);
+
+  int *previous_const;
+  previous_const=(int *) vrna_alloc(sizeof(int) * (n4+1));
+  j=0;
+  previous_const[j]=1;
+  int prev_temp = 1;
+  while(j++<n4){
+    if(structure[j-1]=='|'){
+      previous_const[j]=prev_temp;
+      prev_temp=j;
+    }
+    else{
+      previous_const[j]=prev_temp;
+    }
+  }
+
+  set_model_details(&md);
+
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    update_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+
+  c = (int **) vrna_alloc(sizeof(int *) * (n3+1));
+  for (i=0; i<=n3; i++) c[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+  for (i=0; i<=n3; i++){
+    for(j=0;j<=n4;j++){
+      c[i][j]=INF;
+    }
+  }
+  encode_seqs(s1, s2);
+  int type, type2, type3, E, k,l;
+  i=n3-1; j=2;
+  type = pair[S1[i]][S2[j]];
+  if(!type){
+    printf("Error during initialization of the duplex in duplexfold_XS\n");
+    mfe.structure=NULL;
+    mfe.energy = INF;
+    return mfe;
+  }
+  c[i][j] = P->DuplexInit + (structure[j-1]=='|' ? bonus : 0 ); /* check if first pair is constrained  */
+  if(!(structure[j-2] == '|')){
+    c[i][j]+=P->mismatchExt[rtype[type]][SS2[j-1]][SS1[i+1]];
+  }
+  else{
+    c[i][j]+=P->dangle3[rtype[type]][SS1[i+1]];
+  }
+  if (type>2) c[i][j] += P->TerminalAU;
+  for (k=i-1; k>0 ; k--) {
+    c[k+1][0]=INF;
+    for (l=j+1; l<=n4; l++) {
+      c[k][l]=INF;
+      int bonus_2 = (structure[l-1]=='|'? bonus : 0 ); /* check if position is constrained and prepare bonus accordingly */
+      type2 = pair[S1[k]][S2[l]];
+      if (!type2) continue;
+      for (p=k+1; p< n3 && p<k+MAXLOOP-1; p++){
+        for (q = l-1; q >= previous_const[l] && q > 1; q--) {
+          if (p-k+l-q-2>MAXLOOP) break;
+          type3=pair[S1[p]][S2[q]];
+          if(!type3) continue;
+          E = E_IntLoop(p-k-1, l-q-1, type2, rtype[type3],SS1[k+1], SS2[l-1], SS1[p-1], SS2[q+1],P) + bonus_2;
+          c[k][l] = MIN2(c[k][l], c[p][q]+E);
+        }
+      }
+      E = c[k][l];
+      if (type2>2) E += P->TerminalAU;
+      E+=access_s1[i-k+1][i_pos]+access_s2[l-1][j_pos+(l-1)-1];
+      if (k>1 && l<n4 && !(structure[l]=='|') ){
+        E+=P->mismatchExt[type2][SS1[k-1]][SS2[l+1]];
+      }
+      else if(k>1){
+        E += P->dangle5[type2][SS1[k-1]];
+      }
+      else if(l<n4 && !(structure[l]=='|')){
+        E += P->dangle3[type2][SS2[l+1]];
+      }
+      if (E<Emin) {
+        Emin=E; k_min=k; l_min=l;
+      }
+    }
+  }
+  free(previous_const);
+  if(Emin  > threshold){
+    mfe.energy=INF;
+    mfe.ddG=INF;
+    mfe.structure=NULL;
+    for (i=0; i<=n3; i++) free(c[i]);
+    free(c);
+    free(S1); free(S2); free(SS1); free(SS2);
+    return mfe;
+  } else{
+    struc = backtrack_CXS(k_min, l_min, access_s1, access_s2,structure,&Emin);
+  }
+
+
+  /* lets take care of the dangles */
+  /* find best combination  */
+  int dx_5, dx_3, dy_5, dy_3,dGx,dGy,bonus_x;
+  dx_5=0; dx_3=0; dy_5=0; dy_3=0;dGx=0;dGy=0;bonus_x=0;
+  dGx = access_s1[i-k_min+1][i_pos];dx_3=0; dx_5=0;bonus_x=0;
+  dGy = access_s2[l_min-j+1][j_pos + (l_min-1)-1];
+  mfe.tb=i_pos -9 - i + k_min -1 -dx_5;
+  mfe.te=i_pos -9 -1 + dx_3;
+  mfe.qb=j_pos -9 -1 - dy_5;
+  mfe.qe=j_pos + l_min -3 -9 + dy_3;
+  mfe.ddG=(double) Emin * 0.01;
+  mfe.dG1=(double) dGx*0.01 ;
+  mfe.dG2=(double) dGy*0.01 ;
+  /* mfe.energy += bonus_y + bonus_x; */
+  mfe.energy= mfe.ddG - mfe.dG1 - mfe.dG2;
+
+  mfe.structure = struc;
+  for (i=0; i<=n3; i++) free(c[i]);
+  free(c);
+  free(S1); free(S2); free(SS1); free(SS2);
+  return mfe;
+}
+
+
+PRIVATE char *backtrack_CXS (int i, int j, const int **access_s1,const int **access_s2,const char* structure, int *Emin ) {
+  /* backtrack structure going backwards from i, and forwards from j
+     return structure in bracket notation with & as separator */
+  int k, l, type, type2, E, traced, i0, j0;
+  char *st1, *st2, *struc;
+  int *previous_const;
+  int bonus=-10000;
+  previous_const=(int *) vrna_alloc(sizeof(int) * (n4+1));
+  int j_temp=0;
+  previous_const[j_temp]=1;
+  int prev_temp = 1;
+  while(j_temp++<n4){
+    if(structure[j_temp-1]=='|'){
+      previous_const[j_temp]=prev_temp;
+      prev_temp=j_temp;
+    }
+    else{
+      previous_const[j_temp]=prev_temp;
+    }
+  }
+  st1 = (char *) vrna_alloc(sizeof(char)*(n3+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n4+1));
+  i0=i;/*MAX2(i-1,1);*/j0=j;/*MIN2(j+1,n4);*/
+  while (i<=n3-1 && j>=2) {
+    int bonus_2 = (structure[j-1]== '|'? bonus: 0);
+    E = c[i][j]; traced=0;
+    st1[i-1] = '(';
+    st2[j-1] = ')';
+    type = pair[S1[i]][S2[j]];
+    if (!type) vrna_message_error("backtrack failed in fold duplex bli");
+    for (k=i+1; k<=n3 && k>i-MAXLOOP-2; k++) {
+      for (l=j-1; l >= previous_const[j] && l>=1; l--) {
+        int LE;
+        if (i-k+l-j-2>MAXLOOP) break;
+        type2 = pair[S1[k]][S2[l]];
+        if (!type2) continue;
+        LE = E_IntLoop(k-i-1, j-l-1, type, rtype[type2], SS1[i+1], SS2[j-1], SS1[k-1], SS2[l+1],P) + bonus_2;
+        if (E == c[k][l]+LE) {
+          *Emin-=bonus_2;
+          traced=1;
+          i=k; j=l;
+          break;
+        }
+      }
+      if (traced) break;
+    }
+    if (!traced) {
+      if(i<n3 && j>1 && !(structure[j-2]=='|')){
+        E -= P->mismatchExt[rtype[type]][SS2[j-1]][SS1[i+1]];
+      }
+      else if (i<n3){
+        E -= P->dangle3[rtype[type]][SS1[i+1]];/* +access_s1[1][i+1]; */
+      }
+      else if (j>1){
+        E -= (!(structure[j-2]=='|') ? P->dangle5[rtype[type]][SS2[j-1]] : 0);/* +access_s2[1][j+1]; */
+      }
+      if (type>2) E -= P->TerminalAU;
+
+      /* break; */
+      if (E != P->DuplexInit + bonus_2)  {
+        vrna_message_error("backtrack failed in fold duplex bal");
+      } else {
+        *Emin-=bonus_2;
+        break;
+      }
+    }
+  }
+  /* if (i<n3)  i++; */
+  /* if (j>1)   j--; */
+  struc = (char *) vrna_alloc(i-i0+1+j0-j+1+2);
+  for (k=MAX2(i0,1); k<=i; k++) if (!st1[k-1]) st1[k-1] = '.';
+  for (k=j; k<=j0; k++) if (!st2[k-1]) st2[k-1] = '.';
+  strcpy(struc, st1+MAX2(i0-1,0)); strcat(struc, "&");
+  strcat(struc, st2+j-1);
+  free(st1); free(st2);free(previous_const);
+  return struc;
+}
+
+
+duplexT** Lduplexfold_CXS(const char *s1, const char *s2, const int **access_s1, const int **access_s2, const int threshold, const int alignment_length, const int delta, const int fast, const char* structure,const int il_a, const int il_b, const int b_a, const int b_b)/* , const int target_dead, const int query_dead) */
+{
+
+  int i, j;
+  int bopen=b_b;
+  int bext=b_a;
+  int iopen=il_b;
+  int iext_s=2*il_a;/* iext_s 2 nt nucleotide extension of interior loop, on i and j side */
+  int iext_ass=50+il_a;/* iext_ass assymetric extension of interior loop, either on i or on j side. */
+  int min_colonne=INF; /* enthaelt das maximum einer kolonne */
+  int i_length;
+  int max_pos;/* get position of the best hit */
+  int max_pos_j;
+  /* int temp; */
+  int min_j_colonne;
+  int max=INF;
+  int bonus=-10000;
+  int constthreshold=0; /* minimal threshold corresponding to a structure complying to all constraints */
+  int maxPenalty[4];
+  vrna_md_t   md;
+
+  i=0;
+  while(structure[i]!='\0'){
+    if(structure[i]=='|') constthreshold+=bonus;
+    i++;
+  }
+  int *position; /* contains the position of the hits with energy > E */
+  int *position_j;
+  n1 = (int) strlen(s1);
+  n2 = (int) strlen(s2);
+  position = (int *) vrna_alloc((delta+n1+3+delta) * sizeof(int));
+  position_j= (int *) vrna_alloc((delta+n1+3+delta) * sizeof(int));
+
+  set_model_details(&md);
+
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)){
+    update_dfold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+
+  encode_seqs(s1,s2);
+
+  maxPenalty[0]=(int) -1*P->stack[2][2]/2;
+  maxPenalty[1]=(int) -1*P->stack[2][2];
+  maxPenalty[2]=(int) -3*P->stack[2][2]/2;
+  maxPenalty[3]=(int) -2*P->stack[2][2];
+
+  lc   = (int**) vrna_alloc(sizeof(int *) * 5);
+  lin  = (int**) vrna_alloc(sizeof(int *) * 5);
+  lbx  = (int**) vrna_alloc(sizeof(int *) * 5);
+  lby  = (int**) vrna_alloc(sizeof(int *) * 5);
+  linx = (int**) vrna_alloc(sizeof(int *) * 5);
+  liny = (int**) vrna_alloc(sizeof(int *) * 5);
+
+  for (i=0; i<=4; i++){
+    lc[i]  = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lin[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lbx[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lby[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    linx[i]= (int *) vrna_alloc(sizeof(int) * (n2+5));
+    liny[i]= (int *) vrna_alloc(sizeof(int) * (n2+5));
+  }
+  for(j=n2;j>=0;j--) {
+    lbx[0][j]=lbx[1][j]=lbx[2][j]=lbx[3][j]    = lbx[4][j] =INF;
+    lin[0][j]=lin[1][j]=lin[2][j]=lin[3][j]    = lin[4][j] =INF;
+    lc[0][j] =lc[1][j] =lc[2][j] = lc[3][j]    =  lc[4][j] =INF;
+    lby[0][j]=lby[1][j]=lby[2][j]=lby[3][j]    = lby[4][j] =INF;
+    liny[0][j]=liny[1][j]=liny[2][j]=liny[3][j]=liny[4][j]=INF;
+    linx[0][j]=linx[1][j]=linx[2][j]=linx[3][j]=linx[4][j]=INF;
+  }
+
+  i=10 /*target_dead*/; /* start from 2 (        i=4) because no structure allowed to begin with a single base pair */
+  i_length= n1 - 9  /*- target_dead*/ ;
+  while(i < i_length) {
+    int idx=i%5;
+    int idx_1=(i-1)%5;
+    int idx_2=(i-2)%5;
+    int idx_3=(i-3)%5;
+    int idx_4=(i-4)%5;
+    int di1,di2,di3,di4;
+    di1 = access_s1[5][i]   - access_s1[4][i-1];
+    di2 = access_s1[5][i-1] - access_s1[4][i-2] + di1;
+    di3 = access_s1[5][i-2] - access_s1[4][i-3] + di2;
+    di4 = access_s1[5][i-3] - access_s1[4][i-4] + di3;
+    di1=MIN2(di1,maxPenalty[0]);
+    di2=MIN2(di2,maxPenalty[1]);
+    di3=MIN2(di3,maxPenalty[2]);
+    di4=MIN2(di4,maxPenalty[3]);
+    j=n2 - 9 /*- query_dead*/; /* start from n2-1 because no structure allow to begin with a single base pair  */
+    while (--j > 9/*query_dead - 1*/) {
+      /* ----------------------------------------------------------update lin lbx lby matrix */
+      int bonus_2 = (structure[j-1]=='|' ? bonus :0 );
+      int dj1,dj2,dj3,dj4;
+      dj1 = access_s2[5][j+4] - access_s2[4][j+4];
+      dj2 = access_s2[5][j+5] - access_s2[4][j+5] + dj1;
+      dj3 = access_s2[5][j+6] - access_s2[4][j+6] + dj2;
+      dj4 = access_s2[5][j+7] - access_s2[4][j+7] + dj3;
+      dj1=MIN2(dj1,maxPenalty[0]);
+      dj2=MIN2(dj2,maxPenalty[1]);
+      dj3=MIN2(dj3,maxPenalty[2]);
+      dj4=MIN2(dj4,maxPenalty[3]);
+      int type2, type,temp;
+      type  = pair[S1[i]][S2[j]];
+      lc[idx][j]= type ? P->DuplexInit + bonus_2 : INF;
+      if(!bonus_2){
+        type2=pair[S2[j+1]][S1[i-1]];
+        lin[idx][j]=MIN2(lc[idx_1][j+1]+P->mismatchI[type2][SS2[j]][SS1[i]]+di1+dj1+iopen+iext_s,lin[idx_1][j]+iext_ass + di1);
+        lin[idx][j]=MIN2(lin[idx][j],lin[idx][j+1]+iext_ass + dj1);
+        lin[idx][j]=MIN2(lin[idx][j],lin[idx_1][j+1]+iext_s + di1 + dj1);
+        linx[idx][j]=MIN2(lc[idx_1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+di1+dj1+iopen+iext_s,linx[idx_1][j]+iext_ass + di1);
+        liny[idx][j]=MIN2(lc[idx_1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+di1+dj1+iopen+iext_s,liny[idx][j+1]+iext_ass + dj1);
+        type2=pair[S2[j+1]][S1[i]];
+        lby[idx][j]=MIN2(lby[idx][j+1]+bext + dj1 ,
+                         lc[idx][j+1]+bopen+bext+(type2>2?P->TerminalAU:0)+dj1);
+      }
+      else{
+        lin[idx][j] = lby[idx][j] = linx[idx][j]= liny[idx][j]=INF; /* all loop containing "|" are rejected */
+      }
+      type2=pair[S2[j]][S1[i-1]];
+      lbx[idx][j]=MIN2(lbx[idx_1][j]+bext + di1, lc[idx_1][j]+bopen+bext+(type2>2?P->TerminalAU:0) + di1);
+      /* --------------------------------------------------------------- end update recursion */
+      if(!type){continue;}
+      if(!(structure[j]=='|')){
+        lc[idx][j]+=P->mismatchExt[type][SS1[i-1]][SS2[j+1]];
+      }
+      else{
+        lc[idx][j]+=P->dangle5[type][SS1[i-1]];
+      }
+      lc[idx][j]+=(type>2?P->TerminalAU:0);
+      /* type > 2 -> no GC or CG pair */
+      /* ------------------------------------------------------------------update c  matrix  */
+      /*  Be careful, no lc may come from a region where a "|" is in a loop, avoided in lin = lby = INF ... jedoch fuer klein loops muss man aufpassen .. */
+      if((type2=pair[S1[i-1]][S2[j+1]]))
+        lc[idx][j]=MIN2(lc[idx_1][j+1]+E_IntLoop(0,0,type2, rtype[type],SS1[i], SS2[j], SS1[i-1], SS2[j+1], P)+di1+dj1, lc[idx][j]); /* 0x0+1x1 */
+      if((type2=pair[S1[i-2]][S2[j+1]]))
+        lc[idx][j]=MIN2(lc[idx_2][j+1]+E_IntLoop(1,0,type2, rtype[type],SS1[i-1], SS2[j], SS1[i-1], SS2[j+1], P)+di2+dj1,lc[idx][j]);/* 0x1 +1x1 */
+      /* kleine loops checks wird in den folgenden if test gemacht. */
+      if(!(structure[j]=='|')){
+        if((type2=pair[S1[i-1]][S2[j+2]]))
+          lc[idx][j]=MIN2(lc[idx_1][j+2]+E_IntLoop(0,1,type2, rtype[type],SS1[i], SS2[j+1], SS1[i-1], SS2[j+1], P)+di1+dj2,lc[idx][j]);/* 1x0 + 1x1 */
+        if((type2=pair[S1[i-2]][S2[j+2]]))
+          lc[idx][j]=MIN2(lc[idx_2][j+2]+E_IntLoop(1,1,type2, rtype[type],SS1[i-1], SS2[j+1], SS1[i-1], SS2[j+1], P)+di2+dj2, lc[idx][j]); /*  1x1 +1x1 */
+        if((type2 = pair[S1[i-3]][S2[j+2]]))
+          lc[idx][j]=MIN2(lc[idx_3][j+2]+E_IntLoop(2,1,type2, rtype[type],SS1[i-2], SS2[j+1], SS1[i-1], SS2[j+1], P)+di3+dj2, lc[idx][j]); /*  2x1 +1x1 */
+        if(!(structure[j+1]=='|')){
+          if((type2 = pair[S1[i-3]][S2[j+3]]))
+            lc[idx][j]=MIN2(lc[idx_3][j+3]+E_IntLoop(2,2,type2, rtype[type],SS1[i-2], SS2[j+2], SS1[i-1], SS2[j+1], P)+di3+dj3,lc[idx][j]);/* 2x2 + 1x1 */
+          if((type2 = pair[S1[i-2]][S2[j+3]]))
+            lc[idx][j]=MIN2(lc[idx_2][j+3]+E_IntLoop(1,2,type2, rtype[type],SS1[i-1], SS2[j+2], SS1[i-1], SS2[j+1], P)+di2+dj3, lc[idx][j]);/*  1x2 +1x1 */
+          if((type2 = pair[S1[i-4]][S2[j+3]]))
+            lc[idx][j]=MIN2(lc[idx_4][j+3]+E_IntLoop(3,2,type2, rtype[type],SS1[i-3], SS2[j+2], SS1[i-1], SS2[j+1], P)+di4+dj3, lc[idx][j]);
+          if(!(structure[j+2]=='|')){
+            if((type2 = pair[S1[i-3]][S2[j+4]]))
+              lc[idx][j]=MIN2(lc[idx_3][j+4]+E_IntLoop(2,3,type2, rtype[type],SS1[i-2], SS2[j+3], SS1[i-1], SS2[j+1], P)+di3+dj4, lc[idx][j]);
+          }
+        }
+      }
+      /* internal->stack  */
+      lc[idx][j]=MIN2(lin[idx_3][j+3]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+di3+dj3+2*iext_s, lc[idx][j]);
+      lc[idx][j]=MIN2(lin[idx_4][j+2]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+di4+dj2, lc[idx][j]);
+      lc[idx][j]=MIN2(lin[idx_2][j+4]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+di2+dj4, lc[idx][j]);
+      lc[idx][j]=MIN2(linx[idx_3][j+1]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+di3+dj1, lc[idx][j]);
+      lc[idx][j]=MIN2(liny[idx_1][j+3]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+dj3+di1, lc[idx][j]);
+      /* bulge -> stack */
+      int bAU;
+      bAU=(type>2?P->TerminalAU:0);
+      lc[idx][j]=MIN2(lbx[idx_2][j+1]+di2+dj1+bext+bAU, lc[idx][j]);
+      /* min2=by[i][j+1]; */
+      lc[idx][j]=MIN2(lby[idx_1][j+2]+di1+dj2+bext+bAU, lc[idx][j]);
+      lc[idx][j]+=bonus_2;
+      /* if(j<=const5end){ */
+      temp=min_colonne;
+      min_colonne=MIN2(lc[idx][j]+(type>2?P->TerminalAU:0)+
+                       (!(structure[j-2]=='|') ?
+                        P->mismatchExt[rtype[type]][SS2[j-1]][SS1[i+1]] : P->dangle3[rtype[type]][SS1[i+1]]),
+                       min_colonne);
+      if(temp>min_colonne){
+        min_j_colonne=j;
+      }
+      /* } */
+      /* ---------------------------------------------------------------------end update */
+    }
+    if(max>=min_colonne){
+      max=min_colonne;
+      max_pos=i;
+      max_pos_j=min_j_colonne;
+    }
+    position[i+delta]=min_colonne;min_colonne=INF;
+    position_j[i+delta]=min_j_colonne;
+    i++;
+  }
+  /* printf("MAX :%d ", max); */
+  free(S1); free(S2); free(SS1); free(SS2);
+  if(max<threshold+constthreshold){
+    find_max_CXS(position, position_j, delta, threshold+constthreshold, constthreshold, alignment_length, s1, s2, access_s1, access_s2, fast, structure);
+  }
+  if(max<constthreshold){
+    plot_max_CXS(max, max_pos, max_pos_j,alignment_length, s1, s2, access_s1, access_s2,fast,structure);
+  }
+  for (i=0; i<=4; i++) {free(lc[i]);free(lin[i]);free(lbx[i]);free(lby[i]);free(linx[i]);free(liny[i]);}
+  /* free(lc[0]);free(lin[0]);free(lbx[0]);free(lby[0]); */
+  free(lc);free(lin);free(lbx);free(lby);free(linx);free(liny);
+  free(position);
+  free(position_j);
+  return NULL;
+}
+
+PRIVATE void find_max_CXS(const int *position, const int *position_j,const int delta, const int threshold, const int constthreshold, const int alignment_length, const char *s1, const char *s2, const int **access_s1, const int **access_s2, const int fast, const char* structure){
+  int pos=n1-9;
+  if(fast==1){
+    while(10 < pos--){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        int max;
+        max=position[pos+delta];
+        printf("target upper bound %d: query lower bound %d  (%5.2f) \n", pos-10, max_pos_j-10, ((double)max)/100);
+        pos=MAX2(10,pos+temp_min-delta);
+      }
+    }
+  }
+  else{
+    pos=n1-9;
+    while( pos-- > 10 ){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min; /* position on i */
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta]; /* position on j */
+        /* int begin_t=MAX2(9, pos-alignment_length); */
+        /* int end_t  =MIN2(n1-10, pos); */
+        /* int begin_q=MAX2(9, max_pos_j-2); */
+        /* int end_q  =MIN2(n2-10, max_pos_j+alignment_length-2); */
+        int begin_t=MAX2(9,pos-alignment_length);
+        int end_t  =pos;
+        int begin_q=max_pos_j-2;
+        int end_q  =MIN2(n2-9,max_pos_j+alignment_length-2);
+        char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2));
+        char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2));
+        char *local_structure = (char*) vrna_alloc(sizeof(char) * ( end_q - begin_q +2));
+        strncpy(s3, (s1+begin_t),  end_t - begin_t+1);
+        strncpy(s4, (s2+begin_q) , end_q - begin_q+1 );
+        strncpy(local_structure, (structure+begin_q), end_q - begin_q +1);
+        s3[end_t -begin_t +1 ]='\0';
+        s4[end_q -begin_q +1 ]='\0';
+        local_structure[end_q - begin_q +1]='\0';
+        duplexT test;
+        test = duplexfold_CXS(s3,s4,access_s1,access_s2,pos, max_pos_j,threshold,local_structure);
+        if(test.energy * 100 < (threshold - constthreshold)){
+          int l1=strchr(test.structure, '&')-test.structure;
+          int dL = strrchr(structure,'|') - strchr(structure,'|');
+          dL+=1;
+          if(dL <=  strlen(test.structure)-l1-1){
+            printf("%s %3d,%-3d : %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f)\n", test.structure,
+                   test.tb,test.te,test.qb,test.qe, test.ddG, test.energy, test.dG1, test.dG2);
+            pos=MAX2(10,pos+temp_min-delta);
+          }
+        }
+        free(s3);free(s4);
+        free(test.structure);
+        free(local_structure);
+      }
+    }
+  }
+}
+
+
+PRIVATE void plot_max_CXS(const int max, const int max_pos, const int max_pos_j, const int alignment_length, const char *s1, const char *s2, const int ** access_s1, const int ** access_s2, const int fast, const char* structure)
+{
+  if(fast==1){
+    printf("target upper bound %d: query lower bound %d (%5.2f)\n", max_pos-3, max_pos_j, ((double)max)/100);
+  }
+  else{
+    int begin_t=MAX2(9,max_pos-alignment_length);
+    int end_t  =max_pos;
+    int begin_q=max_pos_j-2;
+    int end_q  =MIN2(n2-9,max_pos_j+alignment_length-2);
+    char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2));
+    char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2));
+    char *local_structure = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2));
+    strncpy(s3, (s1+begin_t),  end_t - begin_t+1);
+    strncpy(s4, (s2+begin_q) , end_q - begin_q+1 );
+    strncpy(local_structure, (structure+begin_q) , end_q - begin_q +1 );
+    s3[end_t -begin_t +1 ]='\0';
+    s4[end_q -begin_q +1 ]='\0';
+    local_structure[end_q - begin_q +1]='\0';
+    duplexT test;
+    test = duplexfold_CXS(s3,s4,access_s1,access_s2,max_pos, max_pos_j,INF,local_structure);
+    int l1=  strchr(test.structure, '&')-test.structure;
+    int dL = strrchr(structure,'|') - strchr(structure,'|');
+    dL+=1;
+    if(dL<=strlen(test.structure)-l1-1){
+      printf("%s %3d,%-3d : %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f)\n", test.structure,
+             test.tb,test.te,test.qb,test.qe, test.ddG, test.energy, test.dG1, test.dG2);
+    }
+    free(s3);free(s4);free(test.structure);free(local_structure);
+
+  }
+}
+
+
+/*---------------------------------------------------------duplexfold----------------------------------------------------------------------------------*/
+
+
+PRIVATE duplexT duplexfold_C(const char *s1, const char *s2, const int extension_cost, const char* structure ) {
+  int i, j, l1, Emin=INF, i_min=0, j_min=0;
+  char *struc;
+  duplexT mfe;
+  vrna_md_t   md;
+  int bonus=-10000;
+  int *previous_const; /* for each "|" constraint returns the position of the next "|" constraint */
+
+  n3 = (int) strlen(s1);
+  n4 = (int) strlen(s2);
+
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    update_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  previous_const=(int *) vrna_alloc(sizeof(int) * (n4+1));
+  j=n4+1;
+  previous_const[j-1]=n4;
+  int prev_temp = n4;
+  while(--j){
+    if(structure[j-1]=='|'){
+      previous_const[j-1]=prev_temp;
+      prev_temp=j;
+    }
+    else{
+      previous_const[j-1]=prev_temp;
+    }
+  }
+  c = (int **) vrna_alloc(sizeof(int *) * (n3+1));
+  for (i=0; i<=n3; i++) c[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+  encode_seqs(s1, s2);
+  for (i=1; i<=n3; i++) {
+    for (j=n4; j>0; j--) {
+      int type, type2, E, k,l;
+      int bonus_2 = (structure[j-1]=='|'? bonus: 0);
+      type = pair[S1[i]][S2[j]];
+      c[i][j] = type ? P->DuplexInit +2 * extension_cost + bonus_2: INF;
+      if(!type){ continue;}
+      if(j<n4 && i>1 && !(structure[j]=='|') ) {
+        c[i][j]+=P->mismatchExt[type][SS1[i-1]][SS2[j+1]]+2*extension_cost;
+      }
+      else if(i>1){
+        c[i][j] += P->dangle5[type][SS1[i-1]]+ extension_cost;
+      }
+      else if(j<n4 && !(structure[j]=='|')){
+        c[i][j] += P->dangle3[type][SS2[j+1]]+ extension_cost;
+      }
+      if (type>2) c[i][j] += P->TerminalAU;
+      for (k=i-1; k>0 && k>i-MAXLOOP-2; k--) {
+        for (l=j+1; l<=previous_const[j]; l++) {
+          if (i-k+l-j-2>MAXLOOP) break;
+          type2 = pair[S1[k]][S2[l]];
+          if (!type2) continue;
+          E = E_IntLoop(i-k-1, l-j-1, type2, rtype[type],
+                        SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P)+(i-k+l-j)*extension_cost + bonus_2;
+          c[i][j] = MIN2(c[i][j], c[k][l]+E);
+        }
+      }
+      E = c[i][j];
+      if(i<n3 && j>1 && !(structure[j-2]=='|')){
+        E+= P->mismatchExt[rtype[type]][SS2[j-1]][SS1[i+1]]+2*extension_cost;
+      }
+      else if (i<n3){
+        E += P->dangle3[rtype[type]][SS1[i+1]]+extension_cost;
+      }
+      else if (j>1 && !(structure[j-2]=='|')){
+        E += P->dangle5[rtype[type]][SS2[j-1]]+extension_cost;
+      }
+      if (type>2) E += P->TerminalAU;
+
+      if (E<Emin) {
+        Emin=E; i_min=i; j_min=j;
+      }
+    }
+  }
+  struc = backtrack_C(i_min, j_min, extension_cost,structure,&Emin);
+  if (i_min<n3) i_min++;
+  if (j_min>1 ) j_min--;
+  l1 = strchr(struc, '&')-struc;
+  int size;
+  size=strlen(struc)-1;
+  Emin-= size * (extension_cost);
+  mfe.i = i_min;
+  mfe.j = j_min;
+  mfe.energy = (double) Emin/100.;
+  mfe.structure = struc;
+  free(previous_const);
+  if (!delay_free) {
+    for (i=0; i<=n3; i++) free(c[i]);
+
+    free(c);
+    free(S1); free(S2); free(SS1); free(SS2);
+  }
+  return mfe;
+}
+
+PRIVATE char *backtrack_C(int i, int j, const int extension_cost, const char* structure, int *Emin) {
+  /* backtrack structure going backwards from i, and forwards from j
+     return structure in bracket notation with & as separator */
+  int k, l, type, type2, E, traced, i0, j0, *previous_const;
+  char *st1, *st2, *struc;
+  int bonus=-10000;
+  previous_const=(int *) vrna_alloc(sizeof(int) * (n4+1)); /* encodes the position of the constraints */
+  int j_temp=n4+1;
+  previous_const[j_temp-1]=n4;
+  int prev_temp = n4;
+  while(--j_temp){
+    if(structure[j_temp-1]=='|'){
+      previous_const[j_temp-1]=prev_temp;
+      prev_temp=j_temp;
+    }
+    else{
+      previous_const[j_temp-1]=prev_temp;
+    }
+  }
+  st1 = (char *) vrna_alloc(sizeof(char)*(n3+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n4+1));
+  i0=MIN2(i+1,n3); j0=MAX2(j-1,1);
+  while (i>0 && j<=n4) {
+    int bonus_2 = (structure[j-1]== '|'? bonus: 0);
+    E = c[i][j]; traced=0;
+    st1[i-1] = '(';
+    st2[j-1] = ')';
+    type = pair[S1[i]][S2[j]];
+    if (!type) vrna_message_error("backtrack failed in fold duplex a");
+    for (k=i-1; k>0 && k>i-MAXLOOP-2; k--) {
+      for (l=j+1; l<=previous_const[j]; l++) {
+        int LE;
+        if (i-k+l-j-2>MAXLOOP) break;
+        type2 = pair[S1[k]][S2[l]];
+        if (!type2) continue;
+        LE = E_IntLoop(i-k-1, l-j-1, type2, rtype[type],
+                       SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P)+(i-k+l-j)*extension_cost + bonus_2;
+        if (E == c[k][l]+LE) {
+          *Emin-=bonus_2;
+          traced=1;
+          i=k; j=l;
+          break;
+        }
+      }
+      if (traced) break;
+    }
+    if (!traced) {
+
+      if (i>1 && j<n4 && !(structure[j]=='|')){
+        E -=P->mismatchExt[type][SS1[i-1]][SS2[j+1]]+2*extension_cost;
+      }
+      else if(i>1){
+        E -= P->dangle5[type][SS1[i-1]]+extension_cost;
+      }
+      else if (j<n4 && !(structure[j]=='|')){
+        E -= P->dangle3[type][SS2[j+1]]+ extension_cost;
+      }
+      /* if (j<n4) E -= P->dangle3[type][SS2[j+1]]+extension_cost; */
+      if (type>2) E -= P->TerminalAU;
+      if (E != P->DuplexInit+2*extension_cost + bonus_2) {
+        vrna_message_error("backtrack failed in fold duplex b");
+      } else {
+        *Emin-=bonus_2;
+        break;
+      }
+    }
+  }
+  if (i>1)  i--;
+  if (j<n4) j++;
+
+  struc = (char *) vrna_alloc(i0-i+1+j-j0+1+2);
+  for (k=MAX2(i,1); k<=i0; k++) if (!st1[k-1]) st1[k-1] = '.';
+  for (k=j0; k<=j; k++) if (!st2[k-1]) st2[k-1] = '.';
+  strcpy(struc, st1+MAX2(i-1,0)); strcat(struc, "&");
+  strcat(struc, st2+j0-1);
+
+  /* printf("%s %3d,%-3d : %3d,%-3d\n", struc, i,i0,j0,j);  */
+  free(st1); free(st2);
+  free(previous_const);
+  return struc;
+}
+
+
+
+
+duplexT ** Lduplexfold_C(const char *s1, const char *s2, const int threshold, const int extension_cost, const int alignment_length, const int delta, const int fast, const char* structure, const int il_a, const int il_b, const int b_a, const int b_b)
+{
+  /* duplexT test = duplexfold_C(s1, s2, extension_cost,structure); */
+
+  int i, j;
+  int bopen=b_b;
+  int bext=b_a+extension_cost;
+  int iopen=il_b;
+  int iext_s=2*(il_a+extension_cost);/* iext_s 2 nt nucleotide extension of interior loop, on i and j side */
+  int iext_ass=50+il_a+extension_cost;/* iext_ass assymetric extension of interior loop, either on i or on j side. */
+  int min_colonne=INF; /* enthaelt das maximum einer kolonne */
+  int i_length;
+  int max_pos;/* get position of the best hit */
+  int max_pos_j=10;
+  int temp;
+  int min_j_colonne=11;
+  int max=INF;
+  int bonus = -10000;
+  int constthreshold=0; /* minimal threshold corresponding to a structure complying to all constraints */
+  i=0;
+  while(structure[i]!='\0'){
+    if(structure[i]=='|') constthreshold+=bonus;
+    i++;
+  }
+  /* FOLLOWING NEXT 4 LINE DEFINES AN ARRAY CONTAINING POSITION OF THE SUBOPT IN S1 */
+  /* int nsubopt=10;  */ /* total number of subopt */
+  int *position; /* contains the position of the hits with energy > E */
+  int *position_j;
+  /*   int const5end; */ /* position of the 5'most constraint. Only interaction reaching this position are taken into account. */
+  /* const5end = strchr(structure,'|') - structure; */
+  /* const5end++; */
+  n1 = (int) strlen(s1);
+  n2 = (int) strlen(s2);
+  /* delta_check is the minimal distance allowed for two hits to be accepted */
+  /* if both hits are closer, reject the smaller ( in term of position)  hits  */
+  position = (int *) vrna_alloc((delta+n1+3+delta) * sizeof(int));
+  position_j= (int *) vrna_alloc((delta+n1+3+delta) * sizeof(int));
+  /* i want to implement a function that, given a position in a long sequence and a small sequence, */
+  /* duplexfold them at this position and report the result at the command line */
+  /* for this i first need to rewrite backtrack in order to remove the printf functio */
+  /* END OF DEFINITION FOR NEEDED SUBOPT DATA  */
+
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6))
+  update_dfold_params();
+
+  lc   = (int**) vrna_alloc(sizeof(int *) * 5);
+  lin  = (int**) vrna_alloc(sizeof(int *) * 5);
+  lbx  = (int**) vrna_alloc(sizeof(int *) * 5);
+  lby  = (int**) vrna_alloc(sizeof(int *) * 5);
+  linx = (int**) vrna_alloc(sizeof(int *) * 5);
+  liny = (int**) vrna_alloc(sizeof(int *) * 5);
+
+  for (i=0; i<=4; i++){
+    lc[i]  = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lin[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lbx[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    lby[i] = (int *) vrna_alloc(sizeof(int) * (n2+5));
+    linx[i]= (int *) vrna_alloc(sizeof(int) * (n2+5));
+    liny[i]= (int *) vrna_alloc(sizeof(int) * (n2+5));
+  }
+  for(j=n2;j>=0;j--) {
+    lbx[0][j]=lbx[1][j]=lbx[2][j]=lbx[3][j]    = lbx[4][j] =INF;
+    lin[0][j]=lin[1][j]=lin[2][j]=lin[3][j]    = lin[4][j] =INF;
+    lc[0][j] =lc[1][j] =lc[2][j] = lc[3][j]    =  lc[4][j] =INF;
+    lby[0][j]=lby[1][j]=lby[2][j]=lby[3][j]    = lby[4][j] =INF;
+    liny[0][j]=liny[1][j]=liny[2][j]=liny[3][j]=liny[4][j]=INF;
+    linx[0][j]=linx[1][j]=linx[2][j]=linx[3][j]=linx[4][j]=INF;
+  }
+  encode_seqs(s1,s2);
+  i=10;
+  i_length= n1 - 9 ;
+  while(i < i_length) {
+    int idx=i%5;
+    int idx_1=(i-1)%5;
+    int idx_2=(i-2)%5;
+    int idx_3=(i-3)%5;
+    int idx_4=(i-4)%5;
+    j=n2-9;
+    while (9 < --j) {
+      int bonus_2 = (structure[j-1]=='|' ? bonus : 0) ;
+      int type, type2;
+      type = pair[S1[i]][S2[j]];
+      lc[idx][j]=type ? P->DuplexInit + 2*extension_cost + bonus_2 : INF; /* to avoid that previous value influence result should actually not be erforderlich */
+      if(!bonus_2){
+        type2=pair[S2[j+1]][S1[i-1]];
+        lin[idx][j]=MIN2(lc[idx_1][j+1]+P->mismatchI[type2][SS2[j]][SS1[i]]+iopen+iext_s, lin[idx_1][j]+iext_ass);
+        lin[idx][j]=MIN2(lin[idx][j],lin[idx][j+1]+iext_ass);
+        lin[idx][j]=MIN2(lin[idx][j],lin[idx_1][j+1]+iext_s);
+        linx[idx][j]=MIN2(lc[idx_1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s,linx[idx_1][j]+iext_ass);
+        liny[idx][j]=MIN2(lc[idx_1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s,liny[idx][j+1]+iext_ass);
+        type2=pair[S2[j+1]][S1[i]];
+        lby[idx][j]=MIN2(lby[idx][j+1]+bext, lc[idx][j+1]+bopen+bext+(type2>2?P->TerminalAU:0));
+      }
+      else{
+        lin[idx][j] = lby[idx][j] = linx[idx][j]= liny[idx][j]=INF;
+      }
+      type2=pair[S2[j]][S1[i-1]];
+      lbx[idx][j]=MIN2(lbx[idx_1][j]+bext, lc[idx_1][j]+bopen+bext+(type2>2?P->TerminalAU:0));
+      /* --------------------------------------------------------------- end update recursion */
+      if(!type){continue;}
+      if(!(structure[j]=='|')){
+        lc[idx][j]+=P->mismatchExt[type][SS1[i-1]][SS2[j+1]]+2*extension_cost;
+      }
+      else{
+        lc[idx][j]+=P->dangle5[type][SS1[i-1]]+extension_cost;
+      }
+      lc[idx][j]+=(type>2?P->TerminalAU:0);
+      /* type > 2 -> no GC or CG pair */
+      /* ------------------------------------------------------------------update c  matrix  */
+      /*  Be careful, no lc may come from a region where a "|" is in a loop, avoided in lin = lby = INF ... jedoch fuer klein loops muss man aufpassen .. */
+      type2=pair[S1[i-1]][S2[j+1]];
+      lc[idx][j]=MIN2(lc[idx_1][j+1]+E_IntLoop(0,0,type2, rtype[type],SS1[i], SS2[j], SS1[i-1], SS2[j+1], P)+2*extension_cost, lc[idx][j]);
+      type2=pair[S1[i-2]][S2[j+1]];
+      lc[idx][j]=MIN2(lc[idx_2][j+1]+E_IntLoop(1,0,type2, rtype[type],SS1[i-1], SS2[j], SS1[i-1], SS2[j+1], P)+3*extension_cost,lc[idx][j]);
+      /* kleine loops checks wird in den folgenden if test gemacht. */
+      if(!(structure[j]=='|')){
+        type2=pair[S1[i-1]][S2[j+2]];
+        lc[idx][j]=MIN2(lc[idx_1][j+2]+E_IntLoop(0,1,type2, rtype[type],SS1[i], SS2[j+1], SS1[i-1], SS2[j+1], P)+3*extension_cost,lc[idx][j]);
+        type2=pair[S1[i-2]][S2[j+2]];
+        lc[idx][j]=MIN2(lc[idx_2][j+2]+E_IntLoop(1,1,type2, rtype[type],SS1[i-1], SS2[j+1], SS1[i-1], SS2[j+1], P)+4*extension_cost, lc[idx][j]);
+        type2 = pair[S1[i-3]][S2[j+2]];
+        lc[idx][j]=MIN2(lc[idx_3][j+2]+E_IntLoop(2,1,type2, rtype[type],SS1[i-2], SS2[j+1], SS1[i-1], SS2[j+1], P)+5*extension_cost, lc[idx][j]);
+        if(!(structure[j+1]=='|')){
+          type2 = pair[S1[i-3]][S2[j+3]];
+          lc[idx][j]=MIN2(lc[idx_3][j+3]+E_IntLoop(2,2,type2, rtype[type],SS1[i-2], SS2[j+2], SS1[i-1], SS2[j+1], P)+6*extension_cost,lc[idx][j]);
+          type2 = pair[S1[i-2]][S2[j+3]];
+          lc[idx][j]=MIN2(lc[idx_2][j+3]+E_IntLoop(1,2,type2, rtype[type],SS1[i-1], SS2[j+2], SS1[i-1], SS2[j+1], P)+5*extension_cost, lc[idx][j]);
+          type2 = pair[S1[i-4]][S2[j+3]];
+          lc[idx][j]=MIN2(lc[idx_4][j+3]+E_IntLoop(3,2,type2, rtype[type],SS1[i-3], SS2[j+2], SS1[i-1], SS2[j+1], P)+7*extension_cost, lc[idx][j]);
+          if(!(structure[j+2]=='|')){
+            type2 = pair[S1[i-3]][S2[j+4]];
+            lc[idx][j]=MIN2(lc[idx_3][j+4]+E_IntLoop(2,3,type2, rtype[type],SS1[i-2], SS2[j+3], SS1[i-1], SS2[j+1], P)+7*extension_cost, lc[idx][j]);
+          }
+        }
+      }
+      /* internal->stack  */
+      lc[idx][j]=MIN2(lin[idx_3][j+3]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+2*extension_cost+2*iext_s, lc[idx][j]);
+      lc[idx][j]=MIN2(lin[idx_4][j+2]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+2*extension_cost, lc[idx][j]);
+      lc[idx][j]=MIN2(lin[idx_2][j+4]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+2*extension_cost, lc[idx][j]);
+      lc[idx][j]=MIN2(linx[idx_3][j+1]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+2*extension_cost, lc[idx][j]);
+      lc[idx][j]=MIN2(liny[idx_1][j+3]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+2*extension_cost, lc[idx][j]);
+      /* bulge -> stack */
+      int bAU;
+      bAU=(type>2?P->TerminalAU:0);
+      lc[idx][j]=MIN2(lbx[idx_2][j+1]+2*extension_cost+bext+bAU, lc[idx][j]);
+      /* min2=by[i][j+1]; */
+      lc[idx][j]=MIN2(lby[idx_1][j+2]+2*extension_cost+bext+bAU, lc[idx][j]);
+      lc[idx][j]+=bonus_2;
+      /*       if(j<=const5end){ */
+      temp=min_colonne;
+      min_colonne=MIN2(lc[idx][j]+(type>2?P->TerminalAU:0)+
+                       (!(structure[j-2]=='|') ?
+                        P->mismatchExt[rtype[type]][SS2[j-1]][SS1[i+1]]+2*extension_cost :
+                        P->dangle3[rtype[type]][SS1[i+1]]+extension_cost),
+                       min_colonne);
+      if(temp>min_colonne){
+        min_j_colonne=j;
+        /*         } */
+      }
+      /* ---------------------------------------------------------------------end update       */
+    }
+    if(max>=min_colonne){
+      max=min_colonne;
+      max_pos=i;
+      max_pos_j=min_j_colonne;
+    }
+    position[i+delta]=min_colonne;min_colonne=INF;
+    position_j[i+delta]=min_j_colonne;
+    i++;
+  }
+  free(S1); free(S2); free(SS1); free(SS2);
+  /* printf("MAX: %d",max); */
+  if(max<threshold+constthreshold){
+    find_max_C(position, position_j, delta, threshold+constthreshold, constthreshold, alignment_length, s1, s2, extension_cost, fast, structure);
+  }
+  if(max<constthreshold){
+    plot_max_C(max, max_pos, max_pos_j,alignment_length, s1, s2, extension_cost,fast,structure);
+  }
+  for (i=0; i<=4; i++) {free(lc[i]);free(lin[i]);free(lbx[i]);free(lby[i]);free(linx[i]);free(liny[i]);}
+  /*  free(lc[0]);free(lin[0]);free(lbx[0]);free(lby[0]); */
+  free(lc);free(lin);free(lbx);free(lby);free(linx);free(liny);
+  free(position);
+  free(position_j);
+  return NULL;
+}
+
+
+PRIVATE void find_max_C(const int *position, const int *position_j,const int delta, const int threshold, const int constthreshold, const int alignment_length, const char *s1, const char *s2, const int extension_cost, const int fast,const char* structure){
+  int pos=n1-9;
+  if(fast==1){
+    while(10 < pos--){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        int max;
+        max=position[pos+delta];
+        printf("target upper bound %d: query lower bound %d  (%5.2f) \n", pos-10, max_pos_j-10, ((double)max)/100);
+        pos=MAX2(10,pos-delta);
+      }
+    }
+  }
+  else{
+    pos=n1-9;
+    while(10 < pos--){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        /* max_pos_j und pos entsprechen die realen position
+           in der erweiterten sequenz.
+           pos=1 -> position 1 in the sequence (and not 0 like in C)
+           max_pos_j -> position 1 in the sequence ( not 0 like in C)
+        */
+        int begin_t=MAX2(11, pos-alignment_length+1);
+        int end_t  =MIN2(n1-10, pos+1);
+        int begin_q=MAX2(11, max_pos_j-1);
+        int end_q  =MIN2(n2-10, max_pos_j+alignment_length-2);
+        char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2));
+        char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2));
+        char *local_structure = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2));
+        strncpy(s3, (s1+begin_t-1),  end_t - begin_t +1);
+        strncpy(s4, (s2+begin_q-1) , end_q - begin_q +1);
+        strncpy(local_structure, (structure+begin_q-1) , end_q - begin_q +1 );
+        s3[end_t -begin_t +1 ]='\0';
+        s4[end_q -begin_q +1 ]='\0';
+        local_structure[end_q - begin_q +1]='\0';
+        duplexT test;
+        test = duplexfold_C(s3, s4, extension_cost,local_structure);
+        if(test.energy * 100 < (threshold-constthreshold)){
+          int l1=strchr(test.structure, '&')-test.structure;
+          int dL = strrchr(structure,'|') - strchr(structure,'|');
+          dL+=1;
+          if(dL <=  strlen(test.structure)-l1-1){
+            printf("%s %3d,%-3d : %3d,%-3d (%5.2f)\n", test.structure,
+                   begin_t-10+test.i-l1,
+                   begin_t-10+test.i-1,
+                   begin_q-10 + test.j-1 ,
+                   (begin_q -11) + test.j + (int)strlen(test.structure)-l1-2,
+                   test.energy);
+            pos=MAX2(10,pos-delta);
+          }
+        }
+        free(s3);free(s4);
+        free(test.structure);
+        free(local_structure);
+      }
+    }
+  }
+}
+PRIVATE void plot_max_C(const int max, const int max_pos, const int max_pos_j, const int alignment_length, const char *s1, const char *s2, const int extension_cost, const int fast,const char* structure)
+{
+  if(fast==1){
+    printf("target upper bound %d: query lower bound %d (%5.2f)\n", max_pos-10, max_pos_j-10, ((double)max)/100);
+  }
+  else{
+    duplexT test;
+    int begin_t=MAX2(11, max_pos-alignment_length+1);
+    int end_t  =MIN2(n1-10, max_pos+1);
+    int begin_q=MAX2(11, max_pos_j-1);
+    int end_q  =MIN2(n2-10, max_pos_j+alignment_length-2);
+    char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2));
+    char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2));
+    char *local_structure = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2));
+    strncpy(s3, (s1+begin_t-1),  end_t - begin_t + 1);
+    strncpy(s4, (s2+begin_q-1) , end_q - begin_q +1 );
+    strncpy(local_structure, (structure+begin_q-1) , end_q - begin_q +1 );
+    s3[end_t -begin_t +1 ]='\0';
+    s4[end_q -begin_q +1 ]='\0';
+    local_structure[end_q - begin_q +1]='\0';
+    test = duplexfold_C(s3, s4, extension_cost,local_structure);
+    int l1=strchr(test.structure, '&')-test.structure;
+    int dL = strrchr(structure,'|') - strchr(structure,'|');
+    dL+=1;
+    if(dL <=  strlen(test.structure)-l1-1){
+      printf("%s %3d,%-3d : %3d,%-3d (%5.2f)\n", test.structure,
+             begin_t-10+test.i-l1, begin_t-10+test.i-1, begin_q-10 +test.j-1 ,
+             (begin_q -11) + test.j + (int)strlen(test.structure)-l1-2  , test.energy);
+      free(s3);free(s4);free(test.structure);
+    }
+    free(local_structure);
+  }
+}
+
+
+PRIVATE void update_dfold_params(void)
+{
+  vrna_md_t md;
+  if(P)
+    free(P);
+  set_model_details(&md);
+  P = vrna_params(&md);
+  make_pair_matrix();
+}
+
+/*---------------------------------------------------------------------------*/
+
+
+PRIVATE void encode_seqs(const char *s1, const char *s2) {
+  unsigned int i,l;
+
+  l = strlen(s1);
+  S1 = encode_seq(s1);
+  SS1= (short *) vrna_alloc(sizeof(short)*(l+1));
+  /* SS1 exists only for the special X K and I bases and energy_set!=0 */
+
+  for (i=1; i<=l; i++) { /* make numerical encoding of sequence */
+    SS1[i] = alias[S1[i]];   /* for mismatches of nostandard bases */
+  }
+
+  l = strlen(s2);
+  S2 = encode_seq(s2);
+  SS2= (short *) vrna_alloc(sizeof(short)*(l+1));
+  /* SS2 exists only for the special X K and I bases and energy_set!=0 */
+
+  for (i=1; i<=l; i++) { /* make numerical encoding of sequence */
+    SS2[i] = alias[S2[i]];   /* for mismatches of nostandard bases */
+  }
+}
+
+
+PRIVATE short * encode_seq(const char *sequence) {
+  unsigned int i,l;
+  short *S;
+  l = strlen(sequence);
+  S = (short *) vrna_alloc(sizeof(short)*(l+2));
+  S[0] = (short) l;
+
+  /* make numerical encoding of sequence */
+  for (i=1; i<=l; i++)
+    S[i]= (short) encode_char(toupper(sequence[i-1]));
+
+  /* for circular folding add first base at position n+1 */
+  S[l+1] = S[1];
+
+  return S;
+}
+
+
diff --git a/C/ViennaRNA/centroid.c b/C/ViennaRNA/centroid.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/centroid.c
@@ -0,0 +1,204 @@
+/*
+                  centroid structure prediction
+
+                  Ivo L Hofacker + Ronny Lorenz
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/centroid.h"
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC char *
+vrna_centroid_from_plist( int length,
+                          double *dist,
+                          vrna_plist_t *pl){
+
+  /* compute the centroid structure of the ensemble, i.e. the strutcure
+     with the minimal average distance to all other structures
+     <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij}
+     Thus, the centroid is simply the structure containing all pairs with
+     p_ij>0.5 */
+  int i;
+  char *centroid;
+
+  if (pl==NULL)
+    vrna_message_error("vrna_centroid_from_plist@centroid.c: pl==NULL!");
+
+  *dist = 0.;
+  centroid = (char *) vrna_alloc((length+1)*sizeof(char));
+  for (i=0; i<length; i++) centroid[i]='.';
+  for (i=0; pl[i].i>0; i++){
+    if ((pl[i].p)>0.5) {
+      centroid[pl[i].i-1] = '(';
+      centroid[pl[i].j-1] = ')';
+      *dist += (1-pl[i].p);
+    } else
+      *dist += pl[i].p;
+  }
+  centroid[length] = '\0';
+  return centroid;
+}
+
+PUBLIC char *
+vrna_centroid_from_probs( int length,
+                          double *dist,
+                          FLT_OR_DBL *probs){
+
+  /* compute the centroid structure of the ensemble, i.e. the strutcure
+     with the minimal average distance to all other structures
+     <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij}
+     Thus, the centroid is simply the structure containing all pairs with
+     p_ij>0.5 */
+  int i,j;
+  FLT_OR_DBL p;
+  char  *centroid;
+  int   *index = vrna_idx_row_wise(length);
+
+  if (probs == NULL)
+    vrna_message_error("vrna_centroid_from_probs@centroid.c: probs==NULL!");
+
+  *dist = 0.;
+  centroid = (char *) vrna_alloc((length+1)*sizeof(char));
+  for (i=0; i<length; i++) centroid[i]='.';
+  for (i=1; i<=length; i++)
+    for (j=i+TURN+1; j<=length; j++) {
+      if ((p=probs[index[i]-j])>0.5) {
+        centroid[i-1] = '(';
+        centroid[j-1] = ')';
+        *dist += (1-p);
+      } else
+        *dist += p;
+    }
+  free(index);
+  centroid[length] = '\0';
+  return centroid;
+}
+
+PUBLIC char *
+vrna_centroid(vrna_fold_compound_t *vc,
+             double *dist){
+
+  /* compute the centroid structure of the ensemble, i.e. the strutcure
+     with the minimal average distance to all other structures
+     <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij}
+     Thus, the centroid is simply the structure containing all pairs with
+     p_ij>0.5 */
+  int i,j, k, length;
+  FLT_OR_DBL p;
+  char  *centroid;
+  short *S;
+  vrna_mx_pf_t      *matrices;
+  FLT_OR_DBL        *probs;
+  int               *my_iindx;
+  vrna_exp_param_t  *pf_params;
+
+
+  if(!vc){
+    vrna_message_error("vrna_centroid@centroid.c: run vrna_pf_fold first!");
+  } else if( !vc->exp_matrices->probs){
+    vrna_message_error("vrna_centroid@centroid.c: probs==NULL!");
+  }
+
+  length      = vc->length;
+  pf_params   = vc->exp_params;
+  S           = vc->sequence_encoding2;
+  my_iindx    = vc->iindx;
+
+  matrices    = vc->exp_matrices;
+  probs       = matrices->probs;
+
+  *dist = 0.;
+  centroid = (char *) vrna_alloc((length+1)*sizeof(char));
+  for (i=0; i<length; i++) centroid[i]='.';
+  for (i=1; i<=length; i++)
+    for (j=i+TURN+1; j<=length; j++) {
+      if ((p=probs[my_iindx[i]-j])>0.5) {
+        if(pf_params->model_details.gquad){
+          /* check for presence of gquadruplex */
+          if((S[i] == 3) && (S[j] == 3)){
+            int L, l[3];
+            get_gquad_pattern_pf(S, i, j, pf_params, &L, l);
+            for(k=0;k<L;k++){
+              centroid[i+k-1]\
+              = centroid[i+k+L+l[0]-1]\
+              = centroid[i+k+2*L+l[0]+l[1]-1]\
+              = centroid[i+k+3*L+l[0]+l[1]+l[2]-1]\
+              = '+';
+            }
+            /* skip everything within the gquad */
+            i = j; j = j+TURN+1;
+            *dist += (1-p); /* right? */
+            break;
+          }
+        }
+        /* regular base pair */
+        centroid[i-1] = '(';
+        centroid[j-1] = ')';
+        *dist += (1-p);
+      } else
+        *dist += p;
+    }
+
+  centroid[length] = '\0';
+  return centroid;
+}
+
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+
+/* this function is a threadsafe replacement for centroid() */
+PUBLIC char *
+get_centroid_struct_pl( int length,
+                        double *dist,
+                        vrna_plist_t *pl){
+
+  return vrna_centroid_from_plist(length, dist, pl);
+}
+
+/* this function is a threadsafe replacement for centroid() */
+PUBLIC char *
+get_centroid_struct_pr( int length,
+                        double *dist,
+                        FLT_OR_DBL *probs){
+
+  return vrna_centroid_from_probs(length, dist, probs);
+}
+
diff --git a/C/ViennaRNA/centroid.h b/C/ViennaRNA/centroid.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/centroid.h
@@ -0,0 +1,103 @@
+#ifndef VIENNA_RNA_PACKAGE_CENTROID_H
+#define VIENNA_RNA_PACKAGE_CENTROID_H
+
+#include <ViennaRNA/data_structures.h>
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file   centroid.h
+ *  @ingroup subopt_and_representatives
+ *  @brief  Centroid structure computation
+ */
+
+/**
+ *  @brief Get the centroid structure of the ensemble
+ * 
+ *  The centroid is the structure with the minimal average distance to all other structures
+ *  \n @f$ <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij} @f$ \n
+ *  Thus, the centroid is simply the structure containing all pairs with @f$p_ij>0.5@f$
+ *  The distance of the centroid to the ensemble is written to the memory adressed by @a dist.
+ * 
+ *  @ingroup              centroid_fold
+ *  @param[in]    vc      The fold compound data structure
+ *  @param[out]   dist    A pointer to the distance variable where the centroid distance will be written to
+ *  @return               The centroid structure of the ensemble in dot-bracket notation
+ */
+char *vrna_centroid(vrna_fold_compound_t *vc,
+                    double *dist);
+
+/**
+ *  @brief Get the centroid structure of the ensemble
+ * 
+ *  This function is a threadsafe replacement for @ref centroid() with a #vrna_plist_t input
+ * 
+ *  The centroid is the structure with the minimal average distance to all other structures
+ *  \n @f$ <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij} @f$ \n
+ *  Thus, the centroid is simply the structure containing all pairs with @f$p_ij>0.5@f$
+ *  The distance of the centroid to the ensemble is written to the memory adressed by @a dist.
+ *
+ *  @ingroup            centroid_fold
+ *  @param[in]  length  The length of the sequence
+ *  @param[out] dist    A pointer to the distance variable where the centroid distance will be written to
+ *  @param[in]  pl      A pair list containing base pair probability information about the ensemble
+ *  @return             The centroid structure of the ensemble in dot-bracket notation
+ */
+char  *vrna_centroid_from_plist(int length,
+                                double *dist,
+                                vrna_plist_t *pl);
+
+/**
+ *  @brief Get the centroid structure of the ensemble
+ * 
+ *  This function is a threadsafe replacement for @ref centroid() with a probability array input
+ * 
+ *  The centroid is the structure with the minimal average distance to all other structures
+ *  \n @f$ <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij} @f$ \n
+ *  Thus, the centroid is simply the structure containing all pairs with @f$p_ij>0.5@f$
+ *  The distance of the centroid to the ensemble is written to the memory adressed by @a dist.
+ * 
+ *  @ingroup              centroid_fold
+ *  @param[in]    length  The length of the sequence
+ *  @param[out]   dist    A pointer to the distance variable where the centroid distance will be written to
+ *  @param[in]    probs   An upper triangular matrix containing base pair probabilities (access via iindx @ref vrna_idx_row_wise() )
+ *  @return               The centroid structure of the ensemble in dot-bracket notation
+ */
+char  *vrna_centroid_from_probs(int length,
+                                double *dist,
+                                FLT_OR_DBL *probs);
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief Get the centroid structure of the ensemble
+ *
+ *  @deprecated This function was renamed to vrna_centroid_from_plist()
+ */
+DEPRECATED(char  *get_centroid_struct_pl(int length,
+                              double *dist,
+                              vrna_plist_t *pl));
+
+/**
+ *  @brief Get the centroid structure of the ensemble
+ *
+ *  @deprecated This function was renamed to vrna_centroid_from_probs()
+ */
+DEPRECATED(char  *get_centroid_struct_pr(int length,
+                              double *dist,
+                              FLT_OR_DBL *pr));
+
+#endif
+
+#endif
diff --git a/C/ViennaRNA/circfold.inc b/C/ViennaRNA/circfold.inc
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/circfold.inc
@@ -0,0 +1,246 @@
+/* -*-C-*- */
+/* this file contains code for folding circular RNAs */
+/* it's #include'd into fold.c */
+
+PRIVATE void
+fill_arrays_circ( vrna_fold_compound_t *vc,
+                  sect bt_stack[],
+                  int *bt){
+
+  /* variant of fold() for circular RNAs */
+  /* auxiliarry arrays:
+     fM2 = multiloop region with exactly two stems, extending to 3' end
+     for stupid dangles=1 case we also need:
+     fM_d3 = multiloop region with >= 2 stems, starting at pos 2
+             (a pair (k,n) will form 3' dangle with pos 1)
+     fM_d5 = multiloop region with >= 2 stems, extending to pos n-1
+             (a pair (1,k) will form a 5' dangle with pos n)
+  */
+  int               Hi, Hj, Ii, Ij, Ip, Iq, ip, iq, Mi;
+  int               *fM_d3, *fM_d5, Md3i, Md5i, FcMd3, FcMd5;
+  int               FcH, FcI, FcM, Fc, *fM2;
+  int               i,j, ij, u, length, new_c, fm, type;
+  int               *my_c, *my_fML, *indx, dangle_model, turn;
+  vrna_param_t      *P;
+  char              *ptype, *hard_constraints;
+  short             *S1;
+  vrna_hc_t         *hc;
+  vrna_sc_t         *sc;
+
+  P                 = vc->params;
+  ptype             = vc->ptype;
+  indx              = vc->jindx;
+  S1                = vc->sequence_encoding;
+
+  dangle_model      = P->model_details.dangles;
+  turn              = P->model_details.min_loop_size;
+
+  hc                = vc->hc;
+  sc                = vc->sc;
+  hard_constraints  = hc->matrix;
+
+  my_c              = vc->matrices->c;
+  my_fML            = vc->matrices->fML;
+  fM2               = vc->matrices->fM2;
+
+  length            = vc->length;
+
+  FcH = FcI = FcM = FcMd3 = FcMd5 = INF;
+
+  if(hc->up_ext[1] >= length){
+    Fc = 0;
+    if(sc){
+      if(sc->energy_up)
+        Fc += sc->energy_up[1][length];
+    }
+  } else {
+    Fc = INF;
+  }
+
+  for(i = 1; i < length; i++)
+    for(j = i + turn + 1; j <= length; j++){
+      u = length-j + i-1;
+      if (u<TURN) continue;
+
+      ij = indx[j] + i;
+
+      if (!hard_constraints[ij])
+        continue;
+
+      /* exterior hairpin case */
+      new_c =   vrna_E_hp_loop(vc, j, i)
+              + my_c[ij];
+
+      if (new_c<FcH) {
+        FcH = new_c;
+        Hi  = i;
+        Hj  = j;
+      }
+
+      /* exterior interior loop case */
+      ip = iq = 0;
+      new_c =   vrna_E_ext_int_loop(vc, i, j, &ip, &iq)
+              + my_c[ij];
+
+      if(ip != 0){
+        if(new_c < FcI){
+          FcI = new_c;
+          Ii  = i;
+          Ij  = j;
+          Ip  = ip;
+          Iq  = iq;
+        }
+      }
+    } /* end of i,j loop */
+  Fc = MIN2(Fc, FcH);
+  Fc = MIN2(Fc, FcI);
+  /* compute the fM2 array (multi loops with exactly 2 helices) */
+  /* to get a unique ML decomposition, just use fM1 instead of fML
+     below. However, that will not work with dangle_model==1  */
+  for (i=1; i<length-TURN; i++) {
+    fM2[i] = INF;
+    for (u=i+TURN; u<length-TURN; u++)
+      fM2[i] = MIN2(fM2[i], my_fML[indx[u]+i] + my_fML[indx[length]+u+1]);
+  }
+
+  for (i=TURN+1; i<length-2*TURN; i++) {
+    fm = my_fML[indx[i]+1]+fM2[i+1]+P->MLclosing;
+    if (fm<FcM) {
+      FcM=fm; Mi=i;
+    }
+  }
+  Fc = MIN2(Fc, FcM);
+
+  if ((dangle_model == 1) || (dangle_model == 3)){
+    fM_d3 =  (int *) vrna_alloc(sizeof(int)*(length+2));
+    fM_d5 =  (int *) vrna_alloc(sizeof(int)*(length+2));
+
+    for (i=TURN+1; i<length-TURN; i++) {
+      fM_d3[i] = INF;
+      for (u=2+TURN; u<i-TURN; u++)
+        fM_d3[i] = MIN2(fM_d3[i], my_fML[indx[u]+2] + my_fML[indx[i]+u+1]);
+    }
+
+    for (i=2*TURN+1; i<length-TURN; i++) {
+      type = ptype[indx[length]+i+1];
+      if(hard_constraints[indx[length] + i + 1] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+        if(hc->up_ml[1]){
+          fm = fM_d3[i]+my_c[indx[length]+i+1]+E_MLstem(type, -1, S1[1], P) + P->MLclosing;
+          if (fm<FcMd3) {
+            FcMd3=fm; Md3i=i;
+          }
+
+          if(hc->up_ml[i]){
+            fm = fM_d3[i-1]+my_c[indx[length]+i+1]+E_MLstem(type, S1[i], S1[1], P) + P->MLclosing;
+            if (fm<FcMd3) {
+              FcMd3=fm; Md3i=-i;
+            }
+          }
+        }
+      }
+    }
+
+    for (i=TURN+1; i<length-TURN; i++) {
+      fM_d5[i] = INF;
+      for (u=i+TURN; u<length-TURN; u++)
+        fM_d5[i] = MIN2(fM_d5[i], my_fML[indx[u]+i] + my_fML[indx[length-1]+u+1]);
+    }
+
+    for (i=TURN+1; i<length-2*TURN; i++) {
+      if(hard_constraints[indx[i]+1] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+        type = ptype[indx[i]+1];
+        if(hc->up_ml[length]){
+          fm = E_MLstem(type, S1[length], -1, P) + my_c[indx[i]+1] + fM_d5[i+1] + P->MLclosing;
+          if (fm<FcMd5) {
+            FcMd5=fm; Md5i=i;
+          }
+          if(hc->up_ml[i+1]){
+            fm = E_MLstem(type, S1[length], S1[i+1], P) + my_c[indx[i]+1] + fM_d5[i+2] + P->MLclosing;
+            if (fm<FcMd5) {
+              FcMd5=fm; Md5i=-i;
+            }
+          }
+        }
+      }
+    }
+
+    if (FcMd5<MIN2(Fc,FcMd3)) {
+      /* looks like we have to do this ... */
+      bt_stack[++(*bt)].i = 1;
+      bt_stack[(*bt)].j = (Md5i>0)?Md5i:-Md5i;
+      bt_stack[(*bt)].ml = 2;
+      i = (Md5i>0)?Md5i+1 : -Md5i+2; /* let's backtrack fm_d5[Md5i+1] */
+      for (u=i+TURN; u<length-TURN; u++)
+        if (fM_d5[i] == my_fML[indx[u]+i] + my_fML[indx[length-1]+u+1]) {
+          bt_stack[++(*bt)].i = i;
+          bt_stack[(*bt)].j = u;
+          bt_stack[(*bt)].ml = 1;
+          bt_stack[++(*bt)].i =u+1;
+          bt_stack[(*bt)].j = length-1;
+          bt_stack[(*bt)].ml = 1;
+          break;
+        }
+      Fc = FcMd5;
+    } else if (FcMd3<Fc) {
+      /* here we go again... */
+      bt_stack[++(*bt)].i = (Md3i>0)?Md3i+1:-Md3i+1;
+      bt_stack[(*bt)].j = length;
+      bt_stack[(*bt)].ml = 2;
+      i = (Md3i>0)? Md3i : -Md3i-1; /* let's backtrack fm_d3[Md3i] */
+      for (u=2+TURN; u<i-TURN; u++)
+        if (fM_d3[i] == my_fML[indx[u]+2] + my_fML[indx[i]+u+1]) {
+          bt_stack[++(*bt)].i = 2;
+          bt_stack[(*bt)].j = u;
+          bt_stack[(*bt)].ml = 1;
+          bt_stack[++(*bt)].i =u+1;
+          bt_stack[(*bt)].j = i;
+          bt_stack[(*bt)].ml = 1;
+          break;
+        }
+      Fc = FcMd3;
+    }
+    free(fM_d3);
+    free(fM_d5);
+  }
+  else if(Fc < 0){
+    if (FcH==Fc) {
+      bt_stack[++(*bt)].i = Hi;
+      bt_stack[(*bt)].j = Hj;
+      bt_stack[(*bt)].ml = 2;
+    }
+    else if (FcI==Fc) {
+      bt_stack[++(*bt)].i = Ii;
+      bt_stack[(*bt)].j = Ij;
+      bt_stack[(*bt)].ml = 2;
+      bt_stack[++(*bt)].i = Ip;
+      bt_stack[(*bt)].j = Iq;
+      bt_stack[(*bt)].ml = 2;
+    }
+    else if (FcM==Fc) { /* grumpf we found a Multiloop */
+      /* backtrack in fM2 */
+      fm = fM2[Mi+1];
+      for (u=Mi+TURN+1; u<length-TURN; u++)
+        if (fm == my_fML[indx[u]+Mi+1] + my_fML[indx[length]+u+1]) {
+                bt_stack[++(*bt)].i=Mi+1;
+                bt_stack[(*bt)].j=u;
+                bt_stack[(*bt)].ml = 1;
+                bt_stack[++(*bt)].i=u+1;
+                bt_stack[(*bt)].j=length;
+                bt_stack[(*bt)].ml = 1;
+                break;
+        }
+      bt_stack[++(*bt)].i = 1;
+      bt_stack[(*bt)].j = Mi;
+      bt_stack[(*bt)].ml = 1;
+    }
+  } else { /* unstructured */
+    bt_stack[++(*bt)].i = 1;
+    bt_stack[(*bt)].j = 1;
+    bt_stack[(*bt)].ml = 0;
+  }
+  vc->matrices->FcH = FcH;
+  vc->matrices->FcI = FcI;
+  vc->matrices->FcM = FcM;
+  vc->matrices->Fc  = Fc;
+}
+
diff --git a/C/ViennaRNA/cofold.c b/C/ViennaRNA/cofold.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/cofold.c
@@ -0,0 +1,1222 @@
+/*
+                  minimum free energy
+                  RNA secondary structure prediction
+
+                  c Ivo Hofacker, Chrisoph Flamm
+                  original implementation by
+                  Walter Fontana
+
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/subopt.h"
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/cofold.h"
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#endif
+
+#define MAXSECTORS        500     /* dimension for a backtrack array */
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/* some backward compatibility stuff */
+PRIVATE int                 backward_compat           = 0;
+PRIVATE vrna_fold_compound_t  *backward_compat_compound = NULL;
+
+PRIVATE float   mfe1, mfe2;       /* minimum free energies of the monomers */
+
+#ifdef _OPENMP
+
+#pragma omp threadprivate(mfe1, mfe2, backward_compat_compound, backward_compat)
+
+#endif
+
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+PRIVATE void  backtrack(sect bt_stack[], vrna_bp_stack_t *bp_list, vrna_fold_compound_t *vc);
+PRIVATE int   fill_arrays(vrna_fold_compound_t *vc, int zuker);
+PRIVATE void  free_end(int *array, int i, int start, vrna_fold_compound_t *vc);
+PRIVATE void  doubleseq(vrna_fold_compound_t *vc);  /* do magic */
+PRIVATE void  halfseq(vrna_fold_compound_t *vc);    /* undo magic */
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/* wrappers for old API compatibility */
+PRIVATE void      wrap_array_export(int **f5_p,int **c_p,int **fML_p,int **fM1_p,int **fc_p,int **indx_p,char **ptype_p);
+PRIVATE float     wrap_cofold(const char *string,char *structure,vrna_param_t *parameters,int is_constrained);
+PRIVATE SOLUTION *wrap_zukersubopt( const char *string,vrna_param_t *parameters);
+
+#endif
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC float
+vrna_cofold(const char *seq,
+            char *structure){
+
+  float                 mfe;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vrna_md_set_default(&md);
+  md.min_loop_size = 0;  /* set min loop length to 0 */
+
+  /* get compound structure */
+  vc = vrna_fold_compound(seq, &md, 0);
+
+  mfe = vrna_mfe_dimer(vc, structure);
+
+  vrna_fold_compound_free(vc);
+
+  return mfe;
+}
+
+PUBLIC float
+vrna_mfe_dimer( vrna_fold_compound_t  *vc,
+                char                  *structure){
+
+  int     length, energy;
+  char    *s;
+  sect    bt_stack[MAXSECTORS]; /* stack of partial structures for backtracking */
+  vrna_bp_stack_t   *bp;
+
+  length = (int) vc->length;
+
+  vc->sequence_encoding[0] = vc->sequence_encoding2[0]; /* store length at pos. 0 in S1 too */
+
+  if(!vrna_fold_compound_prepare(vc, VRNA_OPTION_MFE | VRNA_OPTION_HYBRID)){
+    vrna_message_warning("vrna_mfe_dimer@cofold.c: Failed to prepare vrna_fold_compound");
+    return (float)(INF/100.);
+  }
+
+  /* call user-defined recursion status callback function */
+  if(vc->stat_cb)
+    vc->stat_cb(VRNA_STATUS_MFE_PRE, vc->auxdata);
+
+  energy = fill_arrays(vc, 0);
+
+  /* call user-defined recursion status callback function */
+  if(vc->stat_cb)
+    vc->stat_cb(VRNA_STATUS_MFE_POST, vc->auxdata);
+
+  if(structure && vc->params->model_details.backtrack){
+    bp = (vrna_bp_stack_t *)vrna_alloc(sizeof(vrna_bp_stack_t) * (4*(1+length/2))); /* add a guess of how many G's may be involved in a G quadruplex */
+
+    backtrack(bt_stack, bp, vc);
+
+    s = vrna_db_from_bp_stack(bp, length);
+    strncpy(structure, s, length + 1);
+    free(s);
+    free(bp);
+  }
+
+  if (vc->params->model_details.backtrack_type=='C')
+    return (float) vc->matrices->c[vc->jindx[length]+1]/100.;
+  else if (vc->params->model_details.backtrack_type=='M')
+    return (float) vc->matrices->fML[vc->jindx[length]+1]/100.;
+  else
+    return (float) energy/100.;
+}
+
+PRIVATE int
+fill_arrays(vrna_fold_compound_t  *vc,
+            int                 zuker){
+
+  /* fill "c", "fML" and "f5" arrays and return  optimal energy */
+
+  unsigned int  *sn;
+  int   i, j, length, energy;
+  int   cp, uniq_ML;
+  int   no_close, type, maxj, *indx;
+  int   *my_f5, *my_c, *my_fML, *my_fM1, *my_fc;
+  int   *cc, *cc1;  /* auxilary arrays for canonical structures     */
+  int   *Fmi;       /* holds row i of fML (avoids jumps in memory)  */
+  int   *DMLi;      /* DMLi[j] holds  MIN(fML[i,k]+fML[k+1,j])      */
+  int   *DMLi1;     /*                MIN(fML[i+1,k]+fML[k+1,j])    */
+  int   *DMLi2;     /*                MIN(fML[i+2,k]+fML[k+1,j])    */
+
+  int   dangle_model, noGUclosure, noLP, hc_decompose, turn;
+  char              *ptype, *hard_constraints;
+  vrna_param_t      *P;
+  vrna_mx_mfe_t     *matrices;
+  vrna_hc_t         *hc;
+
+  length            = (int)vc->length;
+  ptype             = vc->ptype;
+  indx              = vc->jindx;
+  P                 = vc->params;
+  dangle_model      = P->model_details.dangles;
+  noGUclosure       = P->model_details.noGUclosure;
+  noLP              = P->model_details.noLP;
+  uniq_ML           = P->model_details.uniq_ML;
+  sn                = vc->strand_number;
+  hc                = vc->hc;
+  hard_constraints  = hc->matrix;
+  matrices          = vc->matrices;
+  my_f5             = matrices->f5;
+  my_c              = matrices->c;
+  my_fML            = matrices->fML;
+  my_fM1            = matrices->fM1;
+  my_fc             = matrices->fc;
+  cp                = vc->cutpoint;
+  turn              = P->model_details.min_loop_size;
+
+  /* allocate memory for all helper arrays */
+  cc    = (int *) vrna_alloc(sizeof(int)*(length + 2));
+  cc1   = (int *) vrna_alloc(sizeof(int)*(length + 2));
+  Fmi   = (int *) vrna_alloc(sizeof(int)*(length + 1));
+  DMLi  = (int *) vrna_alloc(sizeof(int)*(length + 1));
+  DMLi1 = (int *) vrna_alloc(sizeof(int)*(length + 1));
+  DMLi2 = (int *) vrna_alloc(sizeof(int)*(length + 1));
+
+
+  /* hard code min_loop_size to 0, since we can not be sure yet that this is already the case */
+  turn = 0;
+
+  for (j=1; j<=length; j++) {
+    Fmi[j]=DMLi[j]=DMLi1[j]=DMLi2[j]=INF;
+    my_fc[j]=0;
+  }
+
+  for (j = 1; j<=length; j++)
+    for (i=1; i<=j; i++) {
+      my_c[indx[j]+i] = my_fML[indx[j]+i] = INF;
+      if (uniq_ML) my_fM1[indx[j]+i] = INF;
+    }
+
+  for (i = length-turn-1; i >= 1; i--) { /* i,j in [1..length] */
+
+    maxj=(zuker)? (MIN2(i+cp-1,length)):length;
+    for (j = i+turn+1; j <= maxj; j++) {
+      int ij;
+      ij            = indx[j]+i;
+      type          = (unsigned char)ptype[ij];
+      hc_decompose  = hard_constraints[ij];
+      energy        = INF;
+
+      no_close = (((type==3)||(type==4))&&noGUclosure);
+
+      if (hc_decompose) {   /* we have a pair */
+        int new_c = INF;
+
+        if(!no_close){
+          /* check for hairpin loop */
+          energy  = vrna_E_hp_loop(vc, i, j);
+          new_c   = MIN2(new_c, energy);
+
+          /* check for multibranch loops */
+          energy  = vrna_E_mb_loop_fast(vc, i, j, DMLi1, DMLi2);
+          new_c   = MIN2(new_c, energy);
+        }
+
+        if (dangle_model==3) { /* coaxial stacking */
+          energy  = E_mb_loop_stack(i, j, vc);
+          new_c   = MIN2(new_c, energy);
+        }
+
+        /* check for interior loops */
+        energy = vrna_E_int_loop(vc, i, j);
+        new_c = MIN2(new_c, energy);
+
+        /* remember stack energy for --noLP option */
+        if(noLP){
+          if ((sn[i] == sn[i + 1]) && (sn[j - 1] == sn[j])) {
+            int stackEnergy = vrna_E_stack(vc, i, j);
+            new_c = MIN2(new_c, cc1[j-1]+stackEnergy);
+            my_c[ij] = cc1[j-1]+stackEnergy;
+          } else { /* currently we don't allow stacking over the cut point */
+            my_c[ij] = FORBIDDEN;
+          }
+          cc[j] = new_c;
+        } else {
+          my_c[ij] = new_c;
+        }
+      } /* end >> if (pair) << */
+
+      else my_c[ij] = INF;
+
+      /* done with c[i,j], now compute fML[i,j] */
+      /* free ends ? -----------------------------------------*/
+
+      my_fML[ij] = vrna_E_ml_stems_fast(vc, i, j, Fmi, DMLi);
+
+      if(uniq_ML){  /* compute fM1 for unique decomposition */
+        my_fM1[ij] = E_ml_rightmost_stem(i, j, vc);
+      }
+
+    }
+
+    if (i==cp)
+      for (j=i; j<=maxj; j++)
+        free_end(my_fc, j, cp, vc);
+    if (i<cp)
+      free_end(my_fc,i,cp-1, vc);
+
+
+    {
+      int *FF; /* rotate the auxilliary arrays */
+      FF = DMLi2; DMLi2 = DMLi1; DMLi1 = DMLi; DMLi = FF;
+      FF = cc1; cc1=cc; cc=FF;
+      for (j=1; j<=maxj; j++) {cc[j]=Fmi[j]=DMLi[j]=INF; }
+    }
+  }
+
+  /* calculate energies of 5' and 3' fragments */
+
+  for (i=1; i<=length; i++)
+    free_end(my_f5, i, 1, vc);
+
+  if (cp>0) {
+    mfe1  = my_f5[cp-1];
+    mfe2  = my_fc[length];
+    /* add DuplexInit, check whether duplex*/
+    for (i=cp; i<=length; i++) {
+      my_f5[i] = MIN2(my_f5[i]+P->DuplexInit, my_fc[i]+my_fc[1]);
+    }
+  }
+
+  energy = my_f5[length];
+  if (cp<1) mfe1=mfe2=energy;
+
+  /* clean up memory */
+  free(cc);
+  free(cc1);
+  free(Fmi);
+  free(DMLi);
+  free(DMLi1);
+  free(DMLi2);
+
+  return energy;
+}
+
+PRIVATE void
+backtrack_co( sect bt_stack[],
+              vrna_bp_stack_t *bp_list,
+              int s,
+              int b, /* b=0: start new structure, b \ne 0: add to existing structure */
+              vrna_fold_compound_t *vc) {
+
+  /*------------------------------------------------------------------
+    trace back through the "c", "fc", "f5" and "fML" arrays to get the
+    base pairing list. No search for equivalent structures is done.
+    This is fast, since only few structure elements are recalculated.
+    ------------------------------------------------------------------*/
+
+  int   i, j, ij, k, length, energy, en, new, ml0, ml5, ml3, ml53, no_close, type, type_2, tt;
+  char  *string         = vc->sequence;
+  vrna_param_t  *P      = vc->params;
+  int     *indx         = vc->jindx;
+  char    *ptype        = vc->ptype;
+
+  short *S1             = vc->sequence_encoding;
+  short *S              = vc->sequence_encoding2;
+  int   dangle_model    = P->model_details.dangles;
+  int   noLP            = P->model_details.noLP;
+  int   noGUclosure     = P->model_details.noGUclosure;
+  int   with_gquad      = P->model_details.gquad;
+  int   turn            = P->model_details.min_loop_size;
+  int   *rtype          = &(P->model_details.rtype[0]);
+  char  backtrack_type  = P->model_details.backtrack_type;
+  int   cp              = vc->cutpoint;
+  vrna_hc_t  *hc        = vc->hc;
+  vrna_sc_t  *sc        = vc->sc;
+  char      *hard_constraints  = hc->matrix;
+
+  /* the folding matrices */
+  int   *my_f5, *my_c, *my_fML, *my_fc, *my_ggg;
+
+  length  = vc->length;
+  my_f5   = vc->matrices->f5;
+  my_c    = vc->matrices->c;
+  my_fML  = vc->matrices->fML;
+  my_fc   = vc->matrices->fc;
+  my_ggg  = vc->matrices->ggg;
+
+  /* int   b=0;*/
+
+  /* hard code min_loop_size to 0, since we can not be sure yet that this is already the case */
+  turn = 0;
+
+  length = strlen(string);
+  if (s==0) {
+    bt_stack[++s].i = 1;
+    bt_stack[s].j   = length;
+    bt_stack[s].ml  = (backtrack_type=='M') ? 1 : ((backtrack_type=='C')?2:0);
+  }
+  while (s>0) {
+    int ml, fij, fi, cij, traced, i1, j1, mm, p, q, jj=0, gq=0;
+    int canonical = 1;     /* (i,j) closes a canonical structure */
+
+    /* pop one element from stack */
+    i  = bt_stack[s].i;
+    j  = bt_stack[s].j;
+    ml = bt_stack[s--].ml;
+
+    switch(ml){
+      /* backtrack in f5 */
+      case 0: {
+                int p, q;
+                if(vrna_BT_ext_loop_f5(vc, &j, &p, &q, bp_list, &b)){
+                  if(j > 0){
+                    bt_stack[++s].i = 1;
+                    bt_stack[s].j   = j;
+                    bt_stack[s].ml  = 0;
+                  }
+                  if(p > 0){
+                    i = p;
+                    j = q;
+                    goto repeat1;
+                  }
+
+                  continue;
+                } else {
+                  vrna_message_error("backtrack failed in f5\n%s", string);
+                }
+              }
+              break;
+
+      /* true multi-loop backtrack in fML */
+      case 1: {
+                int p, q, comp1, comp2;
+                if(vrna_BT_mb_loop_split(vc, &i, &j, &p, &q, &comp1, &comp2, bp_list, &b)){
+                  if(i > 0){
+                    bt_stack[++s].i = i;
+                    bt_stack[s].j   = j;
+                    bt_stack[s].ml  = comp1;
+                  }
+                  if(p > 0){
+                    bt_stack[++s].i = p;
+                    bt_stack[s].j   = q;
+                    bt_stack[s].ml  = comp2;
+                  }
+
+                  continue;
+                } else {
+                  vrna_message_error("backtrack failed in fML\n%s", string);
+                }
+              }
+              break;
+
+      case 2: bp_list[++b].i = i;
+              bp_list[b].j   = j;
+              goto repeat1;
+
+      /* backtrack fake-multi loop parts */
+      case 3: case 4:
+              {
+                int lower, k, p, q;
+                p = i;
+                q = j;
+                lower = (i < cp) ? 1 : 0;
+
+                if(vrna_BT_mb_loop_fake(vc, &k, &i, &j, bp_list, &b)){
+                  if(k > 0){
+                    bt_stack[++s].i = (lower) ? k : p;
+                    bt_stack[s].j   = (lower) ? q : k;
+                    bt_stack[s].ml  = ml;
+                  }
+                  if(i > 0){
+                    goto repeat1;
+                  }
+
+                  continue;
+                } else {
+                  vrna_message_error("backtrack failed in fc\n%s", string);
+                }
+              }
+              break;
+    } /* end of switch(ml) */
+
+  repeat1:
+
+    /*----- begin of "repeat:" -----*/
+    ij = indx[j]+i;
+
+    if (canonical)
+      cij = my_c[ij];
+
+    type = ptype[ij];
+
+    if (noLP)
+      if(vrna_BT_stack(vc, &i, &j, &cij, bp_list, &b)){
+        canonical = 0;
+        goto repeat1;
+    }
+
+    canonical = 1;
+
+    no_close = (((type==3)||(type==4))&&noGUclosure);
+    if (no_close) {
+      if (cij == FORBIDDEN) continue;
+    } else {
+      if(vrna_BT_hp_loop(vc, i, j, cij, bp_list, &b))
+        continue;
+    }
+
+    if(vrna_BT_int_loop(vc, &i, &j, cij, bp_list, &b)){
+      if(i < 0)
+        continue;
+      else
+        goto repeat1;
+    }
+
+    /* (i.j) must close a fake or true multi-loop */
+    int comp1, comp2;
+
+    if(vrna_BT_mb_loop(vc, &i, &j, &k, cij, &comp1, &comp2)){
+      bt_stack[++s].i = i;
+      bt_stack[s].j   = k;
+      bt_stack[s].ml  = comp1;
+      bt_stack[++s].i = k + 1;
+      bt_stack[s].j   = j;
+      bt_stack[s].ml  = comp2;
+    } else {
+      vrna_message_error("backtracking failed in repeat");
+    }
+
+    /* end of repeat: --------------------------------------------------*/
+
+  } /* end >> while (s>0) << */
+
+  bp_list[0].i = b;    /* save the total number of base pairs */
+}
+
+PRIVATE void
+free_end( int *array,
+          int i,
+          int start,
+          vrna_fold_compound_t *vc){
+
+  unsigned int  *sn;
+  int inc, type, energy, en, length, j, left, right, cp, dangle_model, with_gquad, *indx, *c, *ggg, turn;
+  vrna_param_t  *P;
+  short         *S1;
+  char          *ptype, *hard_constraints;
+  vrna_mx_mfe_t *matrices;
+  vrna_hc_t     *hc;
+  vrna_sc_t     *sc;
+
+  cp            = vc->cutpoint;
+  P             = vc->params;
+  dangle_model  = P->model_details.dangles;
+  with_gquad    = P->model_details.gquad;
+  turn          = P->model_details.min_loop_size;
+  inc           = (i>start)? 1:-1;
+  length        = (int)vc->length;
+  S1            = vc->sequence_encoding;
+  ptype         = vc->ptype;
+  indx          = vc->jindx;
+  sn            = vc->strand_number;
+  matrices      = vc->matrices;
+  c             = matrices->c;
+  ggg           = matrices->ggg;
+  hc            = vc->hc;
+  sc            = vc->sc;
+  hard_constraints  = hc->matrix;
+
+  if(hc->up_ext[i]){
+    if (i==start) array[i]=0;
+    else array[i] = array[i-inc];
+    if(sc){
+      if(sc->energy_up)
+        array[i] += sc->energy_up[i][1];
+    }
+  } else
+    array[i] = INF;
+
+  if (inc>0) {
+    left = start; right=i;
+  } else {
+    left = i; right = start;
+  }
+
+  /* hard code min_loop_size to 0, since we can not be sure yet that this is already the case */
+  turn = 0;
+
+  for (j=start; inc*(i-j)>turn; j+=inc) {
+    int ii, jj;
+    short si, sj;
+    if (i>j) { ii = j; jj = i;} /* inc>0 */
+    else     { ii = i; jj = j;} /* inc<0 */
+    type = ptype[indx[jj]+ii];
+    if(hard_constraints[indx[jj]+ii] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+
+      if(type == 0)
+        type = 7;
+
+      si = ((ii > 1) && (sn[ii - 1] == sn[ii])) ? S1[ii - 1] : -1;
+      sj = ((jj < length) && (sn[jj] == sn[jj + 1])) ? S1[jj + 1] : -1;
+      energy = c[indx[jj]+ii];
+      if(energy != INF){
+        switch(dangle_model){
+          case 0:   if(array[j-inc] != INF){
+                      en = array[j-inc] + energy + E_ExtLoop(type, -1, -1, P);
+                      array[i] = MIN2(array[i], en);
+                    }
+                    break;
+          case 2:   if(array[j-inc] != INF){
+                      en = array[j-inc] + energy + E_ExtLoop(type, si, sj, P);
+                      array[i] = MIN2(array[i], en);
+                    }
+                    break;
+          default:  if(array[j-inc] != INF){
+                      en = array[j-inc] + energy + E_ExtLoop(type, -1, -1, P);
+                      array[i] = MIN2(array[i], en);
+                    }
+                    if(inc > 0){
+                      if(j > left){
+                        if(hc->up_ext[ii-1]){
+                          if(array[j-2] != INF){
+                            en = array[j-2] + energy + E_ExtLoop(type, si, -1, P);
+                            if(sc)
+                              if(sc->energy_up)
+                                en += sc->energy_up[ii-1][1];
+
+                            array[i] = MIN2(array[i], en);
+                          }
+                        }
+                      }
+                    } else if(j < right){
+                      if(hc->up_ext[jj+1]){
+                        if(array[j+2] != INF){
+                          en = array[j+2] + energy + E_ExtLoop(type, -1, sj, P);
+                          if(sc)
+                            if(sc->energy_up)
+                              en += sc->energy_up[jj+1][1];
+
+                          array[i] = MIN2(array[i], en);
+                        }
+                      }
+                    }
+                    break;
+        }
+      }
+    }
+
+    if(with_gquad){
+      if (sn[ii] == sn[jj])
+        if(array[j-inc] != INF)
+          array[i] = MIN2(array[i], array[j-inc] + ggg[indx[jj]+ii]);
+    }
+
+    if (dangle_model%2==1) {
+      /* interval ends in a dangle (i.e. i-inc is paired) */
+      if (i>j) { ii = j; jj = i-1;} /* inc>0 */
+      else     { ii = i+1; jj = j;} /* inc<0 */
+
+      if (!(hard_constraints[indx[jj]+ii] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP))
+        continue;
+
+      type = ptype[indx[jj]+ii];
+
+      if(type == 0)
+        type = 7;
+
+      si = (ii > left)  && (sn[ii - 1] == sn[ii]) ? S1[ii - 1] : -1;
+      sj = (jj < right) && (sn[jj] == sn[jj + 1]) ? S1[jj + 1] : -1;
+      energy = c[indx[jj]+ii];
+      if(energy != INF){
+        if(inc>0){
+          if(hc->up_ext[jj-1]){
+            if(array[j-inc] != INF){
+              en = array[j - inc] + energy + E_ExtLoop(type, -1, sj, P);
+              if(sc)
+                if(sc->energy_up)
+                  en += sc->energy_up[jj+1][1];
+
+              array[i] = MIN2(array[i], en);
+            }
+          }
+        } else {
+          if(hc->up_ext[ii-1]){
+            if(array[j - inc] != INF){
+              en = array[j - inc] + energy + E_ExtLoop(type, si, -1, P);
+              if(sc)
+                if(sc->energy_up)
+                  en += sc->energy_up[ii-1][1];
+
+              array[i] = MIN2(array[i], en);
+            }
+          }
+        }
+        if(j!= start){ /* dangle_model on both sides */
+          if(hc->up_ext[jj-1] && hc->up_ext[ii-1]){
+            if(array[j-2*inc] != INF){
+              en = array[j-2*inc] + energy + E_ExtLoop(type, si, sj, P);
+              if(sc)
+                if(sc->energy_up)
+                  en += sc->energy_up[ii-1][1] + sc->energy_up[jj+1][1];
+
+              array[i] = MIN2(array[i], en);
+            }
+          }
+        }
+      }
+    }
+  }
+}
+
+PRIVATE void
+backtrack(sect bt_stack[],
+          vrna_bp_stack_t *bp_list,
+          vrna_fold_compound_t *vc){
+
+  /*routine to call backtrack_co from 1 to n, backtrack type??*/
+  backtrack_co(bt_stack, bp_list, 0,0, vc);
+}
+
+PRIVATE void
+doubleseq(vrna_fold_compound_t *vc){
+
+  unsigned int  length, i, s;
+
+  length  = vc->length;
+
+  /* do some magic to re-use cofold code */
+  vc->sequence  = vrna_realloc(vc->sequence, sizeof(char)*(2*length+2));
+  memcpy(vc->sequence+length, vc->sequence, sizeof(char) * length);
+  vc->sequence[2*length] = '\0';
+  vc->length    = (unsigned int)strlen(vc->sequence);
+  vc->cutpoint  = length+1;
+
+  free(vc->strand_number);
+  vc->strand_number = (unsigned int *)vrna_alloc(sizeof(unsigned int) * (vc->length + 1));
+  for (s = i = 0; i <= vc->length; i++) {
+    if (i == length + 1)
+      s++;
+    vc->strand_number[i] = s;
+  }
+
+  vc->sequence_encoding = vrna_realloc(vc->sequence_encoding, sizeof(short)*(vc->length + 2));
+  memcpy(vc->sequence_encoding+length+1, vc->sequence_encoding+1, sizeof(short)*length);
+  vc->sequence_encoding[0] = vc->sequence_encoding[vc->length];
+  vc->sequence_encoding[vc->length+1] = vc->sequence_encoding[1];
+
+  vc->sequence_encoding2 = vrna_realloc(vc->sequence_encoding2, sizeof(short)*(vc->length + 2));
+  memcpy(vc->sequence_encoding2 + length + 1, vc->sequence_encoding2 + 1, sizeof(short)*length);
+  vc->sequence_encoding2[0] = vc->length;
+  vc->sequence_encoding2[vc->length+1] = 0;
+
+  free(vc->ptype);
+  vc->ptype = vrna_ptypes(vc->sequence_encoding2, &(vc->params->model_details));
+  free(vc->iindx);
+  vc->iindx = vrna_idx_row_wise(vc->length);
+  free(vc->jindx);
+  vc->jindx = vrna_idx_col_wise(vc->length);
+
+  vrna_hc_init(vc);
+
+  /* add DP matrices */
+  vrna_mx_mfe_add(vc, VRNA_MX_DEFAULT, 0);
+}
+
+PRIVATE void
+halfseq(vrna_fold_compound_t *vc){
+
+  unsigned int halflength;
+
+  halflength = vc->length/2;
+
+  vc->sequence = vrna_realloc(vc->sequence, sizeof(char)*(halflength + 1));
+  vc->sequence[halflength] = '\0';
+  vc->length = (unsigned int)strlen(vc->sequence);
+  vc->cutpoint = -1;
+  vc->strand_number = (unsigned int *)vrna_realloc(vc->strand_number, sizeof(unsigned int) * (vc->length + 1));
+
+  vc->sequence_encoding = vrna_realloc(vc->sequence_encoding, sizeof(short)*(vc->length + 2));
+  vc->sequence_encoding[0] = vc->sequence_encoding[vc->length];
+  vc->sequence_encoding[vc->length+1] = vc->sequence_encoding[1];
+
+  vc->sequence_encoding2 = vrna_realloc(vc->sequence_encoding2, sizeof(short)*(vc->length + 2));
+  vc->sequence_encoding2[0] = vc->length;
+  vc->sequence_encoding2[vc->length+1] = 0;
+
+  free(vc->ptype);
+  vc->ptype = vrna_ptypes(vc->sequence_encoding2, &(vc->params->model_details));
+  free(vc->iindx);
+  vc->iindx = vrna_idx_row_wise(vc->length);
+  free(vc->jindx);
+  vc->jindx = vrna_idx_col_wise(vc->length);
+
+  vrna_hc_init(vc);
+
+  /* add DP matrices */
+  vrna_mx_mfe_add(vc, VRNA_MX_DEFAULT, 0);
+}
+
+typedef struct{
+  int i;
+  int j;
+  int e;
+  int idxj;
+} zuker_pair;
+
+PRIVATE int comp_pair(const void *A, const void *B) {
+  zuker_pair *x,*y;
+  int ex, ey;
+  x = (zuker_pair *) A;
+  y = (zuker_pair *) B;
+  ex = x->e;
+  ey = y->e;
+  if (ex>ey) return 1;
+  if (ex<ey) return -1;
+  return (x->idxj + x->i - y->idxj + y->i);
+}
+
+PUBLIC SOLUTION *
+vrna_subopt_zuker(vrna_fold_compound_t *vc){
+
+/* Compute zuker suboptimal. Here, we're abusing the cofold() code
+   "double" sequence, compute dimerarray entries, track back every base pair.
+   This is slightly wasteful compared to the normal solution */
+
+  char          *structure, *mfestructure, **todo, *ptype;
+  int           i, j, counter, num_pairs, psize, p, *indx, *c, turn;
+  unsigned int  length, doublelength;
+  float         energy;
+  SOLUTION      *zukresults;
+  vrna_bp_stack_t         *bp_list;
+  zuker_pair              *pairlist;
+  sect          bt_stack[MAXSECTORS]; /* stack of partial structures for backtracking */
+  vrna_mx_mfe_t *matrices;
+  vrna_md_t     *md;
+
+  md                = &(vc->params->model_details);
+  turn              = md->min_loop_size;
+
+  /* do some magic to re-use cofold code although vc is single sequence */
+  md->min_loop_size = 0;
+  doubleseq(vc);
+
+  if(!vrna_fold_compound_prepare(vc, VRNA_OPTION_MFE | VRNA_OPTION_HYBRID)){
+    vrna_message_warning("vrna_subopt_zuker@cofold.c: Failed to prepare vrna_fold_compound");
+    return NULL;
+  }
+
+
+
+  doublelength    = vc->length;
+  length          = doublelength/2;
+  indx            = vc->jindx;
+  ptype           = vc->ptype;
+  matrices        = vc->matrices;
+  c               = matrices->c;
+  num_pairs       = counter = 0;
+  mfestructure    = (char *) vrna_alloc((unsigned) doublelength+1);
+  structure       = (char *) vrna_alloc((unsigned) doublelength+1);
+  zukresults      = (SOLUTION *)vrna_alloc(((length*(length-1))/2)*sizeof(SOLUTION));
+  mfestructure[0] = '\0';
+
+  /* store length at pos. 0 */
+  vc->sequence_encoding[0] = vc->sequence_encoding2[0];
+
+  /* get mfe and do forward recursion */
+  (void)fill_arrays(vc, 1);
+
+  psize     = length;
+  pairlist  = (zuker_pair *) vrna_alloc(sizeof(zuker_pair)*(psize+1));
+  bp_list   = (vrna_bp_stack_t *) vrna_alloc(sizeof(vrna_bp_stack_t) * (1 + length/2));
+  todo      = (char **) vrna_alloc(sizeof(char *)*(length+1));
+  for (i=1; i<length; i++) {
+    todo[i] = (char *) vrna_alloc(sizeof(char)*(length+1));
+  }
+
+  /* Make a list of all base pairs */
+  for (i=1; i<length; i++) {
+    for (j=i+turn+1/*??*/; j<=length; j++) {
+      if (ptype[indx[j]+i]==0) continue;
+      if (num_pairs>=psize) {
+        psize = 1.2*psize + 32;
+        pairlist = vrna_realloc(pairlist, sizeof(zuker_pair)*(psize+1));
+      }
+      pairlist[num_pairs].i       = i;
+      pairlist[num_pairs].j       = j;
+      pairlist[num_pairs].e       = c[indx[j]+i]+c[indx[i+length]+j];
+      pairlist[num_pairs++].idxj  = indx[j];
+
+      todo[i][j]=1;
+    }
+  }
+
+  qsort(pairlist, num_pairs, sizeof(zuker_pair), comp_pair);
+
+  for (p=0; p<num_pairs; p++) {
+    i=pairlist[p].i;
+    j=pairlist[p].j;
+    if (todo[i][j]) {
+      int   k;
+      char  *sz;
+      bt_stack[1].i   = i;
+      bt_stack[1].j   = j;
+      bt_stack[1].ml  = 2;
+      backtrack_co(bt_stack, bp_list, 1,0, vc);
+      bt_stack[1].i   = j;
+      bt_stack[1].j   = i + length;
+      bt_stack[1].ml  = 2;
+      backtrack_co(bt_stack, bp_list, 1,bp_list[0].i, vc);
+      energy = pairlist[p].e;
+      sz = vrna_db_from_bp_stack(bp_list, length);
+      zukresults[counter].energy      = energy/100.;
+      zukresults[counter++].structure = sz;
+      for (k = 1; k <= bp_list[0].i; k++) { /* mark all pairs in structure as done */
+        int x,y;
+        x=bp_list[k].i;
+        y=bp_list[k].j;
+        if (x>length) x-=length;
+        if (y>length) y-=length;
+        if (x>y) {
+          int temp;
+          temp=x; x=y; y=temp;
+        }
+        todo[x][y] = 0;
+      }
+    }
+  }
+
+  /* clean up */
+  free(pairlist);
+  for (i=1; i<length; i++)
+    free(todo[i]);
+  free(todo);
+  free(structure);
+  free(mfestructure);
+  free(bp_list);
+
+  /* undo magic */
+  halfseq(vc);
+  md->min_loop_size = turn;
+
+  return zukresults;
+}
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+PRIVATE void
+wrap_array_export(int **f5_p,
+                  int **c_p,
+                  int **fML_p,
+                  int **fM1_p,
+                  int **fc_p,
+                  int **indx_p,
+                  char **ptype_p){
+
+  /* make the DP arrays available to routines such as subopt() */
+  if(backward_compat_compound){
+    *f5_p     = backward_compat_compound->matrices->f5;
+    *c_p      = backward_compat_compound->matrices->c;
+    *fML_p    = backward_compat_compound->matrices->fML;
+    *fM1_p    = backward_compat_compound->matrices->fM1;
+    *fc_p     = backward_compat_compound->matrices->fc;
+    *indx_p   = backward_compat_compound->jindx;
+    *ptype_p  = backward_compat_compound->ptype;
+  }
+}
+
+/*--------------------------------------------------------------------------*/
+
+PRIVATE float
+wrap_cofold(const char *string,
+            char *structure,
+            vrna_param_t *parameters,
+            int is_constrained){
+
+  unsigned int        length;
+  char                *seq;
+  vrna_fold_compound_t  *vc;
+  vrna_param_t        *P;
+  float               mfe;
+
+  vc      = NULL;
+  length  = strlen(string);
+
+#ifdef _OPENMP
+/* Explicitly turn off dynamic threads */
+  omp_set_dynamic(0);
+#endif
+
+  /* we need the parameter structure for hard constraints */
+  if(parameters)
+    P = vrna_params_copy(parameters);
+  else{
+    vrna_md_t md;
+    set_model_details(&md);
+    md.temperature = temperature;
+    P = vrna_params(&md);
+  }
+  P->model_details.min_loop_size = 0;  /* set min loop length to 0 */
+
+  /* dirty hack to reinsert the '&' according to the global variable 'cut_point' */
+  seq = vrna_cut_point_insert(string, cut_point);
+
+  /* get compound structure */
+  vc = vrna_fold_compound(seq, &(P->model_details), 0);
+
+  if(parameters){ /* replace params if necessary */
+    free(vc->params);
+    vc->params = P;
+  } else {
+    free(P);
+  }
+
+  /* handle hard constraints in pseudo dot-bracket format if passed via simple interface */
+  if(is_constrained && structure){
+    unsigned int constraint_options = 0;
+    constraint_options |= VRNA_CONSTRAINT_DB
+                          | VRNA_CONSTRAINT_DB_PIPE
+                          | VRNA_CONSTRAINT_DB_DOT
+                          | VRNA_CONSTRAINT_DB_X
+                          | VRNA_CONSTRAINT_DB_ANG_BRACK
+                          | VRNA_CONSTRAINT_DB_RND_BRACK
+                          | VRNA_CONSTRAINT_DB_INTRAMOL
+                          | VRNA_CONSTRAINT_DB_INTERMOL;
+
+    vrna_constraints_add(vc, (const char *)structure, constraint_options);
+  }
+
+  if(backward_compat_compound)
+    vrna_fold_compound_free(backward_compat_compound);
+
+  backward_compat_compound  = vc;
+  backward_compat           = 1;
+
+  /* cleanup */
+  free(seq);
+
+  /* call mfe_dimer without backtracing */
+  mfe = vrna_mfe_dimer(vc, NULL);
+
+  /* now we backtrace in a backward compatible way */
+  if(structure && vc->params->model_details.backtrack){
+    char            *s;
+    sect            bt_stack[MAXSECTORS];
+    vrna_bp_stack_t *bp;
+
+    bp = (vrna_bp_stack_t *)vrna_alloc(sizeof(vrna_bp_stack_t) * (4*(1+length/2))); /* add a guess of how many G's may be involved in a G quadruplex */
+
+    backtrack(bt_stack, bp, vc);
+
+    s = vrna_db_from_bp_stack(bp, length);
+    strncpy(structure, s, length + 1);
+    free(s);
+
+    if(base_pair)
+      free(base_pair);
+    base_pair = bp;
+  }
+
+  return mfe;
+}
+
+PRIVATE SOLUTION *
+wrap_zukersubopt( const char *string,
+                  vrna_param_t *parameters){
+
+  vrna_fold_compound_t  *vc;
+  vrna_param_t        *P;
+
+  vc      = NULL;
+
+#ifdef _OPENMP
+/* Explicitly turn off dynamic threads */
+  omp_set_dynamic(0);
+#endif
+
+  /* we need the parameter structure for hard constraints */
+  if(parameters)
+    P = vrna_params_copy(parameters);
+  else{
+    vrna_md_t md;
+    set_model_details(&md);
+    md.temperature = temperature;
+    P = vrna_params(&md);
+  }
+
+  /* get compound structure */
+  vc = vrna_fold_compound(string, &(P->model_details), VRNA_OPTION_DEFAULT);
+
+  if(parameters){ /* replace params if necessary */
+    free(vc->params);
+    vc->params = P;
+  } else {
+    free(P);
+  }
+
+  if(backward_compat_compound)
+    vrna_fold_compound_free(backward_compat_compound);
+
+  backward_compat_compound  = vc;
+  backward_compat           = 1;
+
+  return vrna_subopt_zuker(vc);
+}
+
+PUBLIC void
+initialize_cofold(int length){ /* DO NOTHING */ }
+
+PUBLIC void
+free_co_arrays(void){
+
+  if(backward_compat_compound && backward_compat){
+    vrna_fold_compound_free(backward_compat_compound);
+    backward_compat_compound  = NULL;
+    backward_compat           = 0;
+  }
+}
+
+
+/*--------------------------------------------------------------------------*/
+
+PUBLIC void
+export_cofold_arrays_gq(int **f5_p,
+                        int **c_p,
+                        int **fML_p,
+                        int **fM1_p,
+                        int **fc_p,
+                        int **ggg_p,
+                        int **indx_p,
+                        char **ptype_p){
+
+  /* make the DP arrays available to routines such as subopt() */
+  wrap_array_export(f5_p, c_p, fML_p, fM1_p, fc_p, indx_p, ptype_p);
+  if(backward_compat_compound){
+    *ggg_p = backward_compat_compound->matrices->ggg;
+  }
+}
+
+PUBLIC void
+export_cofold_arrays( int **f5_p,
+                      int **c_p,
+                      int **fML_p,
+                      int **fM1_p,
+                      int **fc_p,
+                      int **indx_p,
+                      char **ptype_p){
+
+  wrap_array_export(f5_p, c_p, fML_p, fM1_p, fc_p, indx_p, ptype_p);
+}
+
+PUBLIC float
+cofold( const char *string,
+        char *structure){
+
+  return wrap_cofold(string, structure, NULL, fold_constrained);
+}
+
+PUBLIC float
+cofold_par( const char *string,
+            char *structure,
+            vrna_param_t *parameters,
+            int is_constrained){
+
+  return wrap_cofold(string, structure, parameters, is_constrained);
+}
+
+PUBLIC SOLUTION *
+zukersubopt(const char *string) {
+
+  return wrap_zukersubopt(string, NULL);
+}
+
+PUBLIC SOLUTION *
+zukersubopt_par(const char *string,
+                vrna_param_t *parameters){
+
+  return wrap_zukersubopt(string, parameters);
+}
+
+PUBLIC void
+update_cofold_params(void){
+
+  vrna_fold_compound_t *v;
+  
+  if(backward_compat_compound && backward_compat){
+    vrna_md_t md;
+    v = backward_compat_compound;
+
+    if(v->params)
+      free(v->params);
+
+    set_model_details(&md);
+    v->params = vrna_params(&md);
+  }
+}
+
+PUBLIC void
+update_cofold_params_par(vrna_param_t *parameters){
+
+  vrna_fold_compound_t *v;
+  
+  if(backward_compat_compound && backward_compat){
+    v = backward_compat_compound;
+
+    if(v->params)
+      free(v->params);
+
+    if(parameters){
+      v->params = vrna_params_copy(parameters);
+    } else {
+      vrna_md_t md;
+      set_model_details(&md);
+      md.temperature = temperature;
+      v->params = vrna_params(&md);
+    }
+  }
+}
+
+PUBLIC void get_monomere_mfes(float *e1, float *e2) {
+  /*exports monomere free energies*/
+  *e1 = mfe1;
+  *e2 = mfe2;
+}
+
+#endif
diff --git a/C/ViennaRNA/cofold.h b/C/ViennaRNA/cofold.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/cofold.h
@@ -0,0 +1,202 @@
+#ifndef VIENNA_RNA_PACKAGE_COFOLD_H
+#define VIENNA_RNA_PACKAGE_COFOLD_H
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+#include <ViennaRNA/mfe.h>
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file     cofold.h
+ *  @ingroup  cofold
+ *  @brief    MFE implementations for RNA-RNA interaction
+ */
+
+/**
+ *  @addtogroup mfe_cofold
+ *  @brief MFE version of cofolding routines
+ *  This file includes (almost) all function declarations within the <b>RNAlib</b> that are related to
+ *  MFE Cofolding...
+ *  This also includes the Zuker suboptimals calculations, since they are implemented using the cofold
+ *  routines.
+ *
+ *  @{
+ *  @ingroup mfe_cofold
+ */
+
+/**
+ *  @brief Compute Minimum Free Energy (MFE), and a corresponding secondary structure for two dimerized RNA sequences
+ *
+ *  This simplified interface to vrna_mfe() computes the MFE and, if required, a secondary structure for
+ *  two RNA sequences upon dimerization using default options. Memory required for dynamic programming
+ *  (DP) matrices will be allocated and free'd on-the-fly. Hence, after return of this function, the
+ *  recursively filled matrices are not available any more for any post-processing, e.g. suboptimal
+ *  backtracking, etc.
+ *
+ *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
+ *  you require other conditions than specified by the default model details, use vrna_mfe(),
+ *  and the data structure #vrna_fold_compound_t instead.
+ *
+ *  @see vrna_mfe_dimer(), vrna_fold_compound(), #vrna_fold_compound_t, vrna_cut_point_insert()
+ *
+ *  @param sequence   two RNA sequences separated by the '&' character
+ *  @param structure  A pointer to the character array where the
+ *         secondary structure in dot-bracket notation will be written to
+ *  @return the minimum free energy (MFE) in kcal/mol
+ */
+float
+vrna_cofold(const char *sequence,
+            char *structure);
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief Compute the minimum free energy of two interacting RNA molecules
+ *
+ *  The code is analog to the fold() function. If #cut_point ==-1 results
+ *  should be the same as with fold().
+ *
+ *  @ingroup mfe_cofold
+ *
+ *  @deprecated use vrna_mfe_dimer() instead
+ *
+ *  @param    sequence  The two sequences concatenated
+ *  @param    structure Will hold the barcket dot structure of the dimer molecule
+ *  @return   minimum free energy of the structure
+ */
+DEPRECATED(float
+cofold( const char *sequence,
+        char *structure));
+
+/**
+ *  @brief Compute the minimum free energy of two interacting RNA molecules
+ *
+ *  @deprecated use vrna_mfe_dimer() instead
+ *
+ */
+DEPRECATED(float
+cofold_par( const char *string,
+            char *structure,
+            vrna_param_t *parameters,
+            int is_constrained));
+
+/**
+ *  @brief Free memory occupied by cofold()
+ *
+ *  @deprecated This function will only free memory allocated by a prior call of cofold() or cofold_par().
+ *  See vrna_mfe_dimer() for how to use the new API
+ *
+ *  @note folding matrices now reside in the fold compound, and should be free'd there
+ *  @see  vrna_fc_destroy(), vrna_mfe_dimer()
+ */
+DEPRECATED(void free_co_arrays(void));
+
+/**
+ *  @brief Recalculate parameters
+ *  @deprecated See vrna_params_subst() for an alternative using the new API
+ */
+DEPRECATED(void update_cofold_params(void));
+
+/**
+ *  @brief Recalculate parameters
+ *  @deprecated See vrna_params_subst() for an alternative using the new API
+ */
+DEPRECATED(void update_cofold_params_par(vrna_param_t *parameters));
+
+
+/**
+ *  @brief Export the arrays of partition function cofold (with gquadruplex support)
+ *
+ *  Export the cofold arrays for use e.g. in the concentration
+ *  Computations or suboptimal secondary structure backtracking
+ *
+ *  @deprecated folding matrices now reside within the fold compound. Thus, this function will
+ *  only work in conjunction with a prior call to cofold() or cofold_par()
+ *
+ *  @see vrna_mfe_dimer() for the new API
+ *
+ *  @param  f5_p    A pointer to the 'f5' array, i.e. array conatining best free energy in interval [1,j]
+ *  @param  c_p     A pointer to the 'c' array, i.e. array containing best free energy in interval [i,j] given that i pairs with j
+ *  @param  fML_p   A pointer to the 'M' array, i.e. array containing best free energy in interval [i,j] for any multiloop segment with at least one stem
+ *  @param  fM1_p   A pointer to the 'M1' array, i.e. array containing best free energy in interval [i,j] for multiloop segment with exactly one stem
+ *  @param  fc_p    A pointer to the 'fc' array, i.e. array ...
+ *  @param  ggg_p   A pointer to the 'ggg' array, i.e. array containing best free energy of a gquadruplex delimited by [i,j]
+ *  @param  indx_p  A pointer to the indexing array used for accessing the energy matrices
+ *  @param  ptype_p A pointer to the ptype array containing the base pair types for each possibility (i,j)
+ */
+DEPRECATED(void export_cofold_arrays_gq(int **f5_p,
+                                        int **c_p,
+                                        int **fML_p,
+                                        int **fM1_p,
+                                        int **fc_p,
+                                        int **ggg_p,
+                                        int **indx_p,
+                                        char **ptype_p));
+
+/**
+ *  @brief Export the arrays of partition function cofold
+ *
+ *  Export the cofold arrays for use e.g. in the concentration
+ *  Computations or suboptimal secondary structure backtracking
+ *
+ *  @deprecated folding matrices now reside within the #vrna_fold_compound_t. Thus, this function will
+ *  only work in conjunction with a prior call to the deprecated functions cofold() or cofold_par()
+ *
+ *  @see vrna_mfe_dimer() for the new API
+ *
+ *  @param  f5_p    A pointer to the 'f5' array, i.e. array conatining best free energy in interval [1,j]
+ *  @param  c_p     A pointer to the 'c' array, i.e. array containing best free energy in interval [i,j] given that i pairs with j
+ *  @param  fML_p   A pointer to the 'M' array, i.e. array containing best free energy in interval [i,j] for any multiloop segment with at least one stem
+ *  @param  fM1_p   A pointer to the 'M1' array, i.e. array containing best free energy in interval [i,j] for multiloop segment with exactly one stem
+ *  @param  fc_p    A pointer to the 'fc' array, i.e. array ...
+ *  @param  indx_p  A pointer to the indexing array used for accessing the energy matrices
+ *  @param  ptype_p A pointer to the ptype array containing the base pair types for each possibility (i,j)
+ */
+DEPRECATED(void export_cofold_arrays( int **f5_p,
+                                      int **c_p,
+                                      int **fML_p,
+                                      int **fM1_p,
+                                      int **fc_p,
+                                      int **indx_p,
+                                      char **ptype_p));
+
+
+
+/**
+ *  @brief get_monomer_free_energies
+ *
+ *  Export monomer free energies out of cofold arrays
+ *  @deprecated{This function is obsolete and will be removed soon!}
+ *
+ *  @param e1 A pointer to a variable where the energy of molecule A will be written to
+ *  @param e2 A pointer to a variable where the energy of molecule B will be written to
+ */
+DEPRECATED(void get_monomere_mfes( float *e1, float *e2));
+
+
+/**
+ *  allocate arrays for folding
+ *  @deprecated{This function is obsolete and will be removed soon!}
+ */
+DEPRECATED(void initialize_cofold(int length));
+
+#endif
+
+/**
+ *  @}
+ */
+
+
+#endif
diff --git a/C/ViennaRNA/color_output.inc b/C/ViennaRNA/color_output.inc
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/color_output.inc
@@ -0,0 +1,338 @@
+
+/* deactivate ANSI colors in TTY output if we compile for windows */
+#ifndef WITHOUT_TTY_COLORS
+# ifdef _WIN32
+#   define WITHOUT_TTY_COLORS
+# endif
+#endif
+
+#ifndef WITHOUT_TTY_COLORS
+
+#define ANSI_COLOR_BRIGHT     "\x1b[1m"
+#define ANSI_COLOR_UNDERLINE  "\x1b[4m"
+#define ANSI_COLOR_RED        "\x1b[31m"
+#define ANSI_COLOR_GREEN      "\x1b[32m"
+#define ANSI_COLOR_YELLOW     "\x1b[33m"
+#define ANSI_COLOR_BLUE       "\x1b[34m"
+#define ANSI_COLOR_MAGENTA    "\x1b[35m"
+#define ANSI_COLOR_CYAN       "\x1b[36m"
+#define ANSI_COLOR_RED_B      "\x1b[1;31m"
+#define ANSI_COLOR_GREEN_B    "\x1b[1;32m"
+#define ANSI_COLOR_YELLOW_B   "\x1b[1;33m"
+#define ANSI_COLOR_BLUE_B     "\x1b[1;34m"
+#define ANSI_COLOR_MAGENTA_B  "\x1b[1;35m"
+#define ANSI_COLOR_CYAN_B     "\x1b[1;36m"
+#define ANSI_COLOR_RESET      "\x1b[0m"
+
+static void
+print_fasta_header( FILE *fp,
+                    const char *head){
+
+  if(head){
+    if(isatty(fileno(fp))){
+      fprintf(fp, ANSI_COLOR_YELLOW ">%s" ANSI_COLOR_RESET "\n", head);
+    } else {
+      fprintf(fp, ">%s\n", head);
+    }
+  }
+}
+
+static void
+print_structure(FILE *fp,
+                const char *structure,
+                const char *data){
+
+  if(structure){
+    if(data){
+      if(isatty(fileno(fp))){
+        fprintf(fp, "%s" ANSI_COLOR_GREEN "%s" ANSI_COLOR_RESET "\n", structure, data);
+      } else {
+        fprintf(fp, "%s%s\n", structure, data);
+      }
+    } else {
+      fprintf(fp, "%s\n", structure);
+    }
+  } else {
+    if(data){
+      if(isatty(fileno(fp))){
+        fprintf(fp, ANSI_COLOR_GREEN "%s" ANSI_COLOR_RESET "\n", data);
+      } else {
+        fprintf(fp, "%s\n", data);
+      }
+    }
+  }
+}
+
+
+static void
+print_eval_ext_loop(FILE  *fp,
+                    int   energy){
+
+  if(isatty(fileno(fp))){
+    fprintf(fp, ANSI_COLOR_CYAN "External loop" ANSI_COLOR_RESET
+                "                           : "
+                ANSI_COLOR_GREEN "%5d" ANSI_COLOR_RESET "\n", energy);
+  } else {
+    fprintf(fp, "External loop"
+                "                           : "
+                "%5d\n", energy);
+  }
+}
+
+static void
+print_eval_hp_loop( FILE  *fp,
+                    int   i,
+                    int   j,
+                    char  si,
+                    char  sj,
+                    int   energy){
+
+  if(isatty(fileno(fp))){
+    fprintf(fp, ANSI_COLOR_CYAN "Hairpin  loop" ANSI_COLOR_RESET
+                " (%3d,%3d) "
+                ANSI_COLOR_BRIGHT "%c%c" ANSI_COLOR_RESET
+                "              : "
+                ANSI_COLOR_GREEN "%5d" ANSI_COLOR_RESET "\n",
+                i, j,
+                si, sj,
+                energy);
+  } else {
+    fprintf(fp, "Hairpin  loop"
+                " (%3d,%3d) %c%c              : "
+                "%5d\n",
+                i, j,
+                si, sj,
+                energy);
+  }
+}
+
+
+static void
+print_eval_int_loop(FILE  *fp,
+                    int   i,
+                    int   j,
+                    char  si,
+                    char  sj,
+                    int   k,
+                    int   l,
+                    char  sk,
+                    char  sl,
+                    int   energy){
+
+  if(isatty(fileno(fp))){
+    fprintf(fp, ANSI_COLOR_CYAN "Interior loop" ANSI_COLOR_RESET
+                " (%3d,%3d) "
+                ANSI_COLOR_BRIGHT "%c%c" ANSI_COLOR_RESET
+                "; (%3d,%3d) "
+                ANSI_COLOR_BRIGHT "%c%c" ANSI_COLOR_RESET
+                ": "
+                ANSI_COLOR_GREEN "%5d" ANSI_COLOR_RESET "\n",
+                i, j,
+                si, sj,
+                k, l,
+                sk, sl,
+                energy);
+  } else {
+    fprintf(fp, "Interior loop"
+                " (%3d,%3d) "
+                "%c%c"
+                "; (%3d,%3d) "
+                "%c%c"
+                ": "
+                "%5d\n",
+                i, j,
+                si, sj,
+                k, l,
+                sk, sl,
+                energy);
+  }
+}
+
+
+static void
+print_eval_mb_loop( FILE  *fp,
+                    int   i,
+                    int   j,
+                    char  si,
+                    char  sj,
+                    int   energy){
+
+  if(isatty(fileno(fp))){
+    fprintf(fp, ANSI_COLOR_CYAN "Multi    loop" ANSI_COLOR_RESET
+                " (%3d,%3d) "
+                ANSI_COLOR_BRIGHT "%c%c" ANSI_COLOR_RESET
+                "              : "
+                ANSI_COLOR_GREEN "%5d" ANSI_COLOR_RESET "\n",
+                i, j,
+                si, sj,
+                energy);
+  } else {
+    fprintf(fp, "Multi    loop"
+                " (%3d,%3d) %c%c              : "
+                "%5d\n",
+                i, j,
+                si, sj,
+                energy);
+  }
+}
+
+
+static void
+print_table(FILE *fp,
+            const char *head,
+            const char *line){
+
+  if(head){
+    if(isatty(fileno(fp))){
+      fprintf(fp, ANSI_COLOR_UNDERLINE ANSI_COLOR_BRIGHT "%s" ANSI_COLOR_RESET "\n", head);
+    } else {
+      fprintf(fp, "%s\n", head);
+    }
+  }
+  if(line){
+    if(isatty(fileno(fp))){
+      fprintf(fp, ANSI_COLOR_GREEN "%s" ANSI_COLOR_RESET "\n", line);
+    } else {
+      fprintf(fp, "%s\n", line);
+    }
+  }
+}
+
+static void
+print_comment(FILE *fp,
+              const char *line){
+
+  if(line){
+    if(isatty(fileno(fp))){
+      fprintf(fp, ANSI_COLOR_CYAN "%s" ANSI_COLOR_RESET "\n", line);
+    } else {
+      fprintf(fp, "%s\n", line);
+    }
+  }
+}
+
+#else
+
+static void
+print_fasta_header( FILE *fp,
+                    const char *head){
+
+  if(head){
+    fprintf(fp, ">%s\n", head);
+  }
+}
+
+static void
+print_structure(FILE *fp,
+                const char *structure,
+                const char *data){
+
+  if(structure){
+    if(data){
+      fprintf(fp, "%s%s\n", structure, data);
+    } else {
+      fprintf(fp, "%s\n", structure);
+    }
+  } else {
+    if(data){
+      fprintf(fp, "%s\n", data);
+    }
+  }
+}
+
+
+static void
+print_eval_ext_loop(FILE  *fp,
+                    int   energy){
+
+  fprintf(fp, "External loop"
+              "                           : "
+              "%5d\n", energy);
+}
+
+
+static void
+print_eval_hp_loop( FILE  *fp,
+                    int   i,
+                    int   j,
+                    char  si,
+                    char  sj,
+                    int   energy){
+
+  fprintf(fp, "Hairpin  loop"
+              " (%3d,%3d) %c%c              : "
+              "%5d\n",
+              i, j,
+              si, sj,
+              energy);
+}
+
+
+static void
+print_eval_int_loop(FILE  *fp,
+                    int   i,
+                    int   j,
+                    char  si,
+                    char  sj,
+                    int   k,
+                    int   l,
+                    char  sk,
+                    char  sl,
+                    int   energy){
+
+  fprintf(fp, "Interior loop"
+              " (%3d,%3d) "
+              "%c%c"
+              "; (%3d,%3d) "
+              "%c%c"
+              ": "
+              "%5d\n",
+              i, j,
+              si, sj,
+              k, l,
+              sk, sl,
+              energy);
+}
+
+
+static void
+print_eval_mb_loop( FILE  *fp,
+                    int   i,
+                    int   j,
+                    char  si,
+                    char  sj,
+                    int   energy){
+
+  fprintf(fp, "Multi    loop"
+              " (%3d,%3d) %c%c              : "
+              "%5d\n",
+              i, j,
+              si, sj,
+              energy);
+}
+
+
+static void
+print_table(FILE *fp,
+            const char *head,
+            const char *line){
+
+  if(head){
+    fprintf(fp, "%s\n", head);
+  }
+  if(line){
+    fprintf(fp, "%s\n", line);
+  }
+}
+
+static void
+print_comment(FILE *fp,
+              const char *line){
+
+  if(line){
+    fprintf(fp, "%s\n", line);
+  }
+}
+
+#endif
+
diff --git a/C/ViennaRNA/commands.c b/C/ViennaRNA/commands.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/commands.c
@@ -0,0 +1,776 @@
+/*
+    commands.c
+
+    Various functions dealing with parsing and application of commands
+
+    (c) 2016 Ronny Lorenz
+
+    ViennaRNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <ctype.h>
+
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/commands.h"
+
+
+typedef void *(command_parser_function)(const char *line);
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE vrna_cmd_t parse_command(const char *line, int line_number, const char *filename);
+
+PRIVATE void *parse_ud_command( const char *line);
+
+PRIVATE void *parse_constraint_force(const char *line);
+PRIVATE void *parse_constraint_prohibit(const char *line);
+PRIVATE void *parse_constraint_con(const char *line);
+PRIVATE void *parse_constraint_allow(const char *line);
+PRIVATE void *parse_constraint_energy(const char *line);
+PRIVATE void *parse_constraint(const char *line, char command);
+
+PRIVATE int parse_constraints_line( const char *line,
+                                    char command,
+                                    int *i,
+                                    int *j,
+                                    int *k,
+                                    int *l,
+                                    char *loop,
+                                    char *orientation,
+                                    float *e);
+
+
+PRIVATE int apply_hard_constraint(vrna_fold_compound_t *vc,
+                                  void *constraint);
+
+PRIVATE int apply_soft_constraint(vrna_fold_compound_t *vc,
+                                  void *constraint);
+
+PRIVATE int apply_ud(vrna_fold_compound_t *vc, void *data);
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+typedef struct {
+  char                    cmd[3];
+  vrna_command_e          type;
+  command_parser_function *parser;
+} parsable;
+
+
+/* number of commands we currently know and are able to interpret */
+#define NUM_COMMANDS  7
+
+/* set of known parsable commands */
+parsable known_commands[NUM_COMMANDS] = {
+  /* cmd , type , parser */
+  { "UD", VRNA_CMD_UD, parse_ud_command },          /* unstructured domain */
+  { "SD", VRNA_CMD_SD, NULL },                      /* structured domain */
+  { "P",  VRNA_CMD_HC, parse_constraint_prohibit }, /* prohibit base pairing */
+  { "F",  VRNA_CMD_HC, parse_constraint_force },    /* force base pairing */
+  { "C",  VRNA_CMD_HC, parse_constraint_con },      /* remove conflicting pairs/force nucleotide in loop context */
+  { "A",  VRNA_CMD_HC, parse_constraint_allow },    /* allow (non-canonical) pairs */
+  { "E",  VRNA_CMD_SC, parse_constraint_energy }    /* soft constraint */
+};
+
+typedef struct {
+  int   i;
+  int   j;
+  int   k;
+  int   l;
+  int   size;
+  char  loop;
+  char  orientation;
+  float e;
+  char  command;
+} constraint_struct;
+
+
+typedef struct {
+  char          *motif;
+  float         motif_en;
+  unsigned int  loop_type;
+} ud_struct;
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC int
+vrna_file_commands_apply( vrna_fold_compound_t *vc,
+                          const char *filename,
+                          unsigned int options){
+
+  /** [Applying commands from file] */
+  int         r;
+  vrna_cmd_t  *cmds;
+
+  cmds  = vrna_file_commands_read(filename, options);
+  r     = vrna_commands_apply(vc, cmds, options);
+
+  vrna_commands_free(cmds);
+
+  return r;
+  /** [Applying commands from file] */
+}
+
+PUBLIC vrna_cmd_t *
+vrna_file_commands_read(const char *filename,
+                        unsigned int options){
+  FILE        *fp;
+  char        *line;
+  int         num_commands, max_commands, line_number, valid;
+  vrna_cmd_t  cmd, *output;
+
+  line_number   = 0;
+  num_commands  = 0;
+  max_commands  = 15;
+  line          = NULL;
+
+  if(!(fp = fopen(filename, "r"))){
+    vrna_message_warning("Command File could not be opened!");
+    return NULL;
+  }
+
+  output = (vrna_cmd_t *)vrna_alloc(sizeof(vrna_cmd_t) * max_commands);
+
+  /* let's go through the file line by line and parse the commands */
+  while((line=vrna_read_line(fp))){
+    line_number++;
+    switch(*line){
+      /* skip comment lines */
+      case '#': case '%': case ';': case '/': case '*': case ' ': case '\0':
+        free(line);
+        continue;
+      default:
+        cmd = parse_command((const char *)line, line_number, filename);
+        break;
+    }
+
+    free(line);
+
+    if(cmd.type == VRNA_CMD_LAST){ /* end of command list */
+      break;
+    } else { /* check whether command is valid in user-defined context */
+      valid = 0;
+      switch(cmd.type){
+        case VRNA_CMD_HC: valid = options & VRNA_CMD_PARSE_HC;
+                          break;
+
+        case VRNA_CMD_SC: valid = options & VRNA_CMD_PARSE_SC;
+                          break;
+
+        case VRNA_CMD_UD: valid = options & VRNA_CMD_PARSE_UD;
+                          break;
+
+        case VRNA_CMD_SD: valid = options & VRNA_CMD_PARSE_SD;
+                          break;
+
+        default:          break;
+      }
+      
+      if(valid){ /* add command to list */
+        output[num_commands++] = cmd;
+
+        /* increase length of command list if necessary */
+        if(num_commands == max_commands){
+          max_commands *= 1.2;
+          output = (vrna_cmd_t *)vrna_realloc(output, sizeof(vrna_cmd_t) * max_commands);
+        }
+      }
+    }
+  }
+
+  /* mark end of command list */
+  output = (vrna_cmd_t *)vrna_realloc(output, sizeof(vrna_cmd_t) * (num_commands + 1));
+  output[num_commands].type = VRNA_CMD_LAST;
+  output[num_commands].data = NULL;
+
+  /* cleanup */
+  free(line);
+
+  return output;
+}
+
+
+PUBLIC int
+vrna_commands_apply(vrna_fold_compound_t *vc,
+                    vrna_cmd_t *commands,
+                    unsigned int options){
+
+  int         r = 0;
+  vrna_cmd_t  *ptr;
+
+  if(vc && commands){
+    for(ptr = commands; ptr->type != VRNA_CMD_LAST; ptr++){
+      switch(ptr->type){
+        case VRNA_CMD_HC:   if(options & VRNA_CMD_PARSE_HC)
+                              r += apply_hard_constraint(vc, ptr->data);
+                            break;
+
+        case VRNA_CMD_SC:   if(options & VRNA_CMD_PARSE_SC)
+                              r += apply_soft_constraint(vc, ptr->data);
+                            break;
+
+        case VRNA_CMD_UD:   if(options & VRNA_CMD_PARSE_UD)
+                              r += apply_ud(vc, ptr->data);
+                            break;
+
+        default:            /* do nothing */
+                            break;
+      }
+    }
+  }
+  
+  return r;
+}
+
+PUBLIC void
+vrna_commands_free( vrna_cmd_t *commands){
+
+  vrna_cmd_t *ptr;
+
+  if(commands){
+    for(ptr = commands; ptr->type != VRNA_CMD_LAST; ptr++){
+      switch(ptr->type){
+        case VRNA_CMD_UD: {
+                            ud_struct *d = (ud_struct *)ptr->data;
+                            free(d->motif);
+                            free(ptr->data);
+                          }
+                          break;
+
+        default:          free(ptr->data);
+                          break;
+      }
+    }
+    free(commands);
+  }
+}
+
+
+PRIVATE int
+apply_ud(vrna_fold_compound_t *vc, void *data){
+
+
+  ud_struct *d = (ud_struct *)data;
+  vrna_ud_add_motif(vc, d->motif, d->motif_en, d->loop_type);
+  
+  return 1;
+}
+
+
+PRIVATE int
+apply_hard_constraint(vrna_fold_compound_t *vc,
+                      void *data){
+
+  int               i, j, k, l, h, cnt1, cnt2, cnt3;
+  int               num_hc_up, max_hc_up;
+  vrna_hc_up_t      *hc_up;
+  char              t, orientation;
+  constraint_struct *constraint = (constraint_struct *)data;
+
+  i           = constraint->i;
+  j           = constraint->j;
+  k           = constraint->k;
+  l           = constraint->l;
+  t           = constraint->loop;
+  orientation = constraint->orientation;
+  h           = constraint->size;
+
+  /* actually apply constraints */
+  if(h == 0){ /* range mode (prohibit pairs only) */
+    for(cnt1 = i; cnt1 <= j; cnt1++)
+      for(cnt2 = MAX2(cnt1 + 1, k); cnt2 <= l; cnt2++){
+        vrna_hc_add_bp(vc, cnt1, cnt2, t);
+      }
+  } else {
+
+    /* we'll collect hard constraints for unpairedness */
+    num_hc_up = 0;
+    max_hc_up = 15;
+    hc_up     = vrna_alloc(sizeof(vrna_hc_up_t) * max_hc_up);
+
+    for(cnt1 = i; cnt1 <= j; cnt1++)
+      for(cnt2 = k; cnt2 <= l; cnt2++)
+        for(cnt3 = h; cnt3 != 0; cnt3--){
+          if(cnt2 == 0){  /* enforce unpairedness of nucleotide */
+            /* just store this constraint, we'll apply it later */
+            hc_up[num_hc_up].position = cnt1 + (cnt3 - 1);
+            hc_up[num_hc_up].options  = t;
+            num_hc_up++;
+            if(num_hc_up == max_hc_up){ /* increase size of hc_up if necessary */
+              max_hc_up  = 1.2 * max_hc_up;
+              hc_up      = (vrna_hc_up_t *)vrna_realloc(hc_up, sizeof(vrna_hc_up_t) * max_hc_up);
+            }
+          } else if((i == j) && (j == k) && (k == l)){  /* enforce pairedness of nucleotide */
+            int d = 0;
+            if(orientation != '\0')
+              d = (orientation == 'U') ? -1 : 1;
+            vrna_hc_add_bp_nonspecific(vc, cnt1 + (cnt3 - 1), d, t);
+          } else {  /* enforce / prohibit base pair */
+            vrna_hc_add_bp(vc, cnt1 + (cnt3 - 1), cnt2 - (cnt3 - 1), t);
+          }
+        }
+
+    /* add hard constraints for unpairedness */
+    if(num_hc_up > 0){
+      hc_up[num_hc_up].position = 0; /* mark end of list */
+      vrna_hc_add_up_batch(vc, hc_up);
+    }
+    free(hc_up);
+
+  }
+
+  return 1;
+}
+
+
+PRIVATE int
+apply_soft_constraint(vrna_fold_compound_t *vc,
+                      void *data){
+
+  int               i, j, k, l, h, cnt1, cnt2, cnt3;
+  float             e;
+  constraint_struct *constraint = (constraint_struct *)data;
+
+  i           = constraint->i;
+  j           = constraint->j;
+  k           = constraint->k;
+  l           = constraint->l;
+  h           = constraint->size;
+  e           = constraint->e;
+
+  for(cnt1 = i; cnt1 <= j; cnt1++)
+    for(cnt2 = k; cnt2 <= l; cnt2++)
+      for(cnt3 = h; cnt3 != 0; cnt3--){
+        if((cnt2 == 0) || ((i == j) && (j == k) && (k == l))){  /* enforce nucleotide constraint */
+          vrna_sc_add_up(vc, cnt1 + (cnt3 - 1), e, VRNA_OPTION_DEFAULT);
+        } else {  /* enforce base pair constraint */
+          vrna_sc_add_bp(vc, cnt1 + (cnt3 - 1), cnt2 - (cnt3 - 1), e, VRNA_OPTION_DEFAULT);
+        }
+      }
+
+  return 1;
+}
+
+
+PRIVATE vrna_cmd_t
+parse_command(const char *line, int line_number, const char *filename){
+
+  vrna_cmd_t cmd;
+  int i, r;
+  char command[3];
+
+  command[0] = '\0';
+  i = NUM_COMMANDS;
+
+  r = sscanf(line, "%2c", command);
+  if(r == 1){
+    command[2] = '\0'; /* just a precaution */
+    for(i = 0; i < NUM_COMMANDS; i++){
+      if(!strncmp(known_commands[i].cmd, command, strlen(known_commands[i].cmd)))
+        break;
+    }
+  }
+
+  if(i < NUM_COMMANDS){ /* command is known, so lets try to process it */
+    cmd.data = (known_commands[i].parser) ? known_commands[i].parser(line) : NULL;
+    if(cmd.data)
+      cmd.type = known_commands[i].type;
+    else {
+      vrna_message_warning("Ignoring invalid command in file \"%s\":\nline %d: %s", filename, line_number, line);
+      cmd.type = VRNA_CMD_ERROR;
+    }
+  } else {
+    vrna_message_warning("Ignoring unknown command in file \"%s\":\nline %d: %s", filename, line_number, line);
+    cmd.type = VRNA_CMD_ERROR;
+    cmd.data = NULL;
+  }
+
+  return cmd;
+}
+
+
+PRIVATE void *
+parse_ud_command( const char *line){
+
+  int           ret, entries_seen, max_entries, pos, pp;
+  char          *ptr, *buffer;
+  float         e;
+  unsigned int  loop_type;
+  ud_struct     *data;
+
+  buffer        = (char *)vrna_alloc(sizeof(char) * (strlen(line) + 1));
+  data          = (ud_struct *)vrna_alloc(sizeof(ud_struct));
+  data->motif   = NULL;
+  ret           = 0;  /* error indicator */
+  entries_seen  = 0;  /* entries seen so far */
+  max_entries   = 3;  /* expected number of entries */
+  pos           = 2;  /* position relative to start of line */
+  pp            = 0;
+
+  while(!ret && (entries_seen < max_entries) && (sscanf(line+pos,"%s%n", buffer, &pp) == 1)){
+    pos += pp;
+    switch(entries_seen){
+      case 0:       /* motif in IUPAC format */
+                    data->motif = strdup(buffer);
+                    break;
+
+      case 1:       /* motif energy in kcal/mol */
+                    if(sscanf(buffer, "%g", &e) == 1){
+                      data->motif_en = e;
+                    } else {
+                      ret = 1;
+                    }
+                    break;
+
+      case 2:       /* motif loop type */
+                    loop_type = 0;
+                    for(ptr=buffer; *ptr != '\0'; ptr++){
+                      switch(*ptr){
+                        case 'A'  : loop_type |= VRNA_UNSTRUCTURED_DOMAIN_ALL_LOOPS;
+                                    break;
+                        case 'E'  : loop_type |= VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP;
+                                    break;
+                        case 'H'  : loop_type |= VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP;
+                                    break;
+                        case 'I'  : loop_type |= VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP;
+                                    break;
+                        case 'M'  : loop_type |= VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP;
+                                    break;
+                        default:    ret = 1;
+                                    break;
+                      }
+                      if(ret)
+                        break;
+                    }
+                    data->loop_type = loop_type;
+                    break;
+    }
+    entries_seen++;
+  }
+
+  free(buffer);
+
+  if(ret){
+    free(data->motif);
+    free(data);
+    return NULL;
+  }
+
+  if(data->loop_type == 0){
+    data->loop_type = VRNA_UNSTRUCTURED_DOMAIN_ALL_LOOPS;
+    vrna_message_warning("");
+  }
+  return (void *)data;
+}
+
+PRIVATE void *
+parse_constraint_force(const char *line){
+
+  return parse_constraint(line, 'F');
+}
+
+PRIVATE void *
+parse_constraint_prohibit(const char *line){
+
+  return parse_constraint(line, 'P');
+}
+
+PRIVATE void *
+parse_constraint_con(const char *line){
+
+  return parse_constraint(line, 'C');
+}
+
+PRIVATE void *
+parse_constraint_allow(const char *line){
+
+  return parse_constraint(line, 'A');
+}
+
+PRIVATE void *
+parse_constraint_energy(const char *line){
+
+  return parse_constraint(line, 'E');
+}
+
+
+PRIVATE void *
+parse_constraint( const char *line,
+                  char command){
+
+  int               ret, i, j, k, l, h, valid;
+  char              loop, orientation;
+  float             e;
+  constraint_struct *output;
+
+  output = NULL;
+
+  i = j = k = l = -1;
+  orientation = '\0'; /* no orientation */
+  e = 0.;
+
+  ret = parse_constraints_line(line + 1, command, &i, &j, &k, &l, &loop, &orientation, &e);
+
+  if(ret == 0){
+
+    /* do something with the constraint we've just read */
+
+    h = 1; /* helix length for pairs, or number of unpaired nucleotides */
+
+    /* check indices */
+    valid = 0;
+    if(i > 0){
+      if(j == -1){ /* i and range [k:l] */
+        if((k > 0) && (l > 0)){
+          if((k < l) && (i < k) && (orientation == '\0')){
+            j     = i;
+            valid = 1;
+          }
+        }
+      } else if(k <= 0){ /* range [i:j] and l */
+        if((i < j) && (j < l) && (orientation == '\0')){
+          k     = l;
+          valid = 1;
+        }
+      } else if(l <= 0){ /* helix of size k starting with pair (i,j), or segment [i:i+k-1] */
+        if(i != j){
+          if((j == 0) || (((j - i + 1) > 2*k) && (orientation == '\0'))){
+            h     = k;
+            k = l = j;
+            j     = i;
+            valid = 1;
+          }
+        }
+      } else if((i < j) && (k < l) && (i <= k) && (j <= l) && (orientation == '\0')){  /* range [i:j] and [k:l] */
+        if(command == 'P'){ /* we only allow this for 'prohibit pairing between two ranges' */
+          h     = 0;
+          valid = 1;
+        }
+      }
+    }
+
+    if(valid){
+      /* nucleotide constraint? */
+      if((k == 0) && (l == 0) && (i == j) && (h > 0)){
+        /* set correct loop type context */
+        switch(command){
+          case 'P': break;
+          case 'A': /* this case allows particular nucleotides to form non-canonical pairs */
+                    loop |= VRNA_CONSTRAINT_CONTEXT_NO_REMOVE; /* do not remove possibility to stay unpaired */
+                    /* fall through */
+          case 'F': /* set i == j == k == l */
+                    k = l = i;
+                    break;
+          case 'E': loop = VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS; /* soft constraints are always applied for all loops */
+                    break;
+          case 'C': loop |= VRNA_CONSTRAINT_CONTEXT_ENFORCE;  /* enforce context dependency */
+                    break;
+          default:  break;
+        }
+      } else { /* base pair constraint */
+        /* set correct loop type context */
+        switch(command){
+          case 'P': loop = ~loop; /* prohibit */
+                    loop &= VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS;
+                    loop |= VRNA_CONSTRAINT_CONTEXT_NO_REMOVE;  /* since we prohibit pairs, we do not want to remove incompatible pairs */
+                    break;
+          case 'F': loop |= VRNA_CONSTRAINT_CONTEXT_ENFORCE;  /* enforce */
+                    break;
+          case 'E': loop = VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS;  /* soft constraints are always applied for all loops */
+                    break;
+          case 'C': break;  /* remove conflicting pairs only */
+          case 'A': loop |= VRNA_CONSTRAINT_CONTEXT_NO_REMOVE; /* since we allow pairs, we do not want to remove incompatible pairs */
+                    break;
+          default:  break;
+        }
+      }
+
+      output = (constraint_struct *)vrna_alloc(sizeof(constraint_struct));
+      output->command     = command;
+      output->i           = i;
+      output->j           = j;
+      output->k           = k;
+      output->l           = l;
+      output->size        = h;
+      output->loop        = loop;
+      output->orientation = orientation;
+      output->e           = e;
+    }
+  }
+
+  return (void *)output;
+}
+
+PRIVATE int
+parse_constraints_line( const char *line,
+                        char command,
+                        int *i,
+                        int *j,
+                        int *k,
+                        int *l,
+                        char *loop,
+                        char *orientation,
+                        float *e){
+
+  int v1, v2;
+  int ret = 0;
+  int range_mode = 0;
+  int pos = 0;
+  int max_entries = 5;
+  int entries_seen = 0;
+  int pp;
+  float energy;
+  char buf[256], buf2[10], *c, tmp_loop;
+
+  switch(command){
+    case 'A':   /* fall through */
+    case 'F':   /* fall through */
+    case 'P':   max_entries = 5;
+                break;
+    case 'C':   /* fall through */
+    case 'E':   max_entries = 4;
+                break;
+    default:    ret = 1;  /* error */
+                break;
+  }
+
+  /* default to all loop types */
+  *loop     = VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS;
+  tmp_loop  = (char)0;
+
+  /* now lets scan the entire line for content */
+  while(!ret && (entries_seen < max_entries) && (sscanf(line+pos,"%15s%n", &buf[0], &pp) == 1)){
+    pos += pp;
+    switch(entries_seen){
+      case 0: /* must be i, or range */
+              if(sscanf(buf, "%d-%d%n", &v1, &v2, &pp) == 2){
+                if(pp == strlen(buf)){
+                  *i = v1;
+                  *j = v2;
+                  range_mode = 1;
+                  --max_entries; /* no orientation allowed now */
+                  break;
+                }
+              } else if(sscanf(buf, "%d%n", &v1, &pp) == 1){
+                if(pp == strlen(buf)){
+                  *i = v1;
+                  break;
+                }
+              }
+              ret = 1;
+              break;
+      case 1: /* must be j, or range */
+              if(sscanf(buf, "%d-%d%n", &v1, &v2, &pp) == 2){
+                if(pp == strlen(buf)){
+                  *k = v1;
+                  *l = v2;
+                  if(!range_mode)
+                    --max_entries; /* no orientation allowed now */
+                  range_mode = 1;
+                  break;
+                }
+              } else if(range_mode){
+                if(sscanf(buf, "%d%n", &v1, &pp) == 1){
+                  if(pp == strlen(buf)){
+                    *l = v1;
+                    break;
+                  }
+                }
+              } else if(sscanf(buf, "%d%n", &v1, &pp) == 1){
+                if(pp == strlen(buf)){
+                  *j = v1;
+                  break;
+                }
+              }
+              ret = 1;
+              break;
+      case 2: /* skip if in range_mode */
+              if(!range_mode){
+                /* must be k */
+                if(sscanf(buf, "%d%n", &v1, &pp) == 1){
+                  if(pp == strlen(buf)){
+                    *k = v1;
+                    break;
+                  }
+                }
+                ret = 1;
+                break;
+              } else {
+                --max_entries;
+                /* fall through */
+              }
+      case 3: 
+              if(command == 'E'){ /* must be pseudo energy */
+                if(sscanf(buf, "%g%n", &energy, &pp) == 1){
+                  if(pp == strlen(buf)){
+                    *e = energy;
+                    break;
+                  }
+                }
+              } else { /*  must be loop type, or orientation */
+                if(sscanf(buf, "%8s%n", &buf2[0], &pp) == 1){
+                  buf2[8] = '\0';
+                  if(pp == strlen(buf)){
+                    for(c = &(buf2[0]); (*c != '\0') && (!ret); c++){
+                      switch(*c){
+                        case 'E': tmp_loop |= VRNA_CONSTRAINT_CONTEXT_EXT_LOOP;
+                                  break;
+                        case 'H': tmp_loop |= VRNA_CONSTRAINT_CONTEXT_HP_LOOP;
+                                  break;
+                        case 'I': tmp_loop |= VRNA_CONSTRAINT_CONTEXT_INT_LOOP;
+                                  break;
+                        case 'i': tmp_loop |= VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC;
+                                  break;
+                        case 'M': tmp_loop |= VRNA_CONSTRAINT_CONTEXT_MB_LOOP;
+                                  break;
+                        case 'm': tmp_loop |= VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC;
+                                  break;
+                        case 'A': tmp_loop |= VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS;
+                                  break;
+                        case 'U': case 'D':
+                                  *orientation = *c;
+                                  break;
+                        default:  ret = 1;
+                      }
+                    }
+                    if(tmp_loop)
+                      *loop = tmp_loop;
+
+                    break;
+                  }
+                }
+              }
+              ret = 1;
+              break;
+      case 4: /* must be orientation */
+              if(!(sscanf(buf, "%c", orientation) == 1)){
+                ret = 1;
+              }
+              break;
+    }
+    ++entries_seen;
+  }
+
+  return ret;
+}
diff --git a/C/ViennaRNA/commands.h b/C/ViennaRNA/commands.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/commands.h
@@ -0,0 +1,131 @@
+#ifndef VIENNA_RNA_PACKAGE_COMMANDS_H
+#define VIENNA_RNA_PACKAGE_COMMANDS_H
+
+/**
+ *  @file     commands.h
+ *  @ingroup  file_utils
+ *  @brief    Parse and apply different commands that alter the behavior of
+ *  secondary structure prediction and evaluation
+ */
+
+/**
+ *  @{
+ *  @ingroup  file_utils
+ */
+
+/** @brief Typename for the command repesenting data structure #vrna_command_s */
+typedef struct vrna_command_s vrna_cmd_t;
+
+
+#include <ViennaRNA/data_structures.h>
+
+/**
+ * @brief Command parse/apply flag indicating hard constraints
+ * @see   #vrna_command_s, vrna_file_commands_read(), vrna_file_commands_apply(), vrna_commands_apply()
+ */
+#define VRNA_CMD_PARSE_HC      1U
+/**
+ * @brief Command parse/apply flag indicating soft constraints
+ * @see   #vrna_command_s, vrna_file_commands_read(), vrna_file_commands_apply(), vrna_commands_apply()
+ */
+#define VRNA_CMD_PARSE_SC      2U
+/**
+ * @brief Command parse/apply flag indicating unstructured domains
+ * @see   #vrna_command_s, vrna_file_commands_read(), vrna_file_commands_apply(), vrna_commands_apply()
+ */
+#define VRNA_CMD_PARSE_UD      4U
+/**
+ * @brief Command parse/apply flag indicating structured domains
+ * @see   #vrna_command_s, vrna_file_commands_read(), vrna_file_commands_apply(), vrna_commands_apply()
+ */
+#define VRNA_CMD_PARSE_SD      8U
+/**
+ * @brief Command parse/apply flag indicating default set of commands
+ * @see   #vrna_command_s, vrna_file_commands_read(), vrna_file_commands_apply(), vrna_commands_apply()
+ */
+#define VRNA_CMD_PARSE_DEFAULTS (   VRNA_CMD_PARSE_HC \
+                                  | VRNA_CMD_PARSE_SC \
+                                  | VRNA_CMD_PARSE_UD \
+                                  | VRNA_CMD_PARSE_SD \
+                                )
+
+/**
+ *  @brief Types of commands within a list of #vrna_command_s structures
+ */
+typedef enum {
+  VRNA_CMD_ERROR=-1,
+  VRNA_CMD_LAST=0,
+  VRNA_CMD_HC,
+  VRNA_CMD_SC,
+  VRNA_CMD_MOTIF,
+  VRNA_CMD_UD,
+  VRNA_CMD_SD
+} vrna_command_e;
+
+/**
+ *  @brief List element for commands ready for application to a #vrna_fold_compound_t
+ *  @see vrna_file_commands_read(), vrna_commands_apply(), vrna_commands_free()
+ */
+struct vrna_command_s {
+  vrna_command_e  type;
+  void *data;
+};
+
+/**
+ *  @brief Extract a list of commands from a command file
+ *
+ *  Read a list of commands specified in the input file
+ *  and return them as list of abstract commands
+ *
+ *  @see  vrna_commands_apply(), vrna_file_commands_apply(),
+ *        vrna_commands_free()
+ *
+ *  @param    filename  The filename
+ *  @param    options   Options to limit the type of commands read from the file
+ *  @return             A list of abstract commands
+ */
+vrna_cmd_t *vrna_file_commands_read(const char *filename,
+                                    unsigned int options);
+
+/**
+ *  @brief Apply a list of commands from a command file
+ *
+ *  This function is a shortcut to directly parse a commands file
+ *  and apply all successfully parsed commands to a #vrna_fold_compound_t
+ *  data structure. It is the same as:
+ *  @snippet commands.c Applying commands from file
+ *
+ *  @param    vc        The #vrna_fold_compound_t the command list will be applied to
+ *  @param    filename  The filename
+ *  @param    options   Options to limit the type of commands read from the file
+ *  @return             The number of commands successfully applied
+ */
+int vrna_file_commands_apply( vrna_fold_compound_t *vc,
+                              const char *filename,
+                              unsigned int options);
+
+/**
+ *  @brief Apply a list of commands to a #vrna_fold_compound_t
+ *
+ *  @param    vc        The #vrna_fold_compound_t the command list will be applied to
+ *  @param    commands  The list of commands to apply
+ *  @param    options   Options to limit the type of commands read from the file
+ *  @return             The number of commands successfully applied
+ */
+int vrna_commands_apply(vrna_fold_compound_t *vc,
+                        vrna_cmd_t *commands,
+                        unsigned int options);
+
+/**
+ *  @brief Free memory occupied by a list of commands
+ *
+ *  Release memory occupied by a list of commands
+ *  @param  commands  A pointer to a list of commands
+ */
+void vrna_commands_free( vrna_cmd_t *commands);
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/constraints.c b/C/ViennaRNA/constraints.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/constraints.c
@@ -0,0 +1,59 @@
+/* constraints handling */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/file_formats.h"
+#include "ViennaRNA/commands.h"
+#include "ViennaRNA/constraints.h"
+
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+PUBLIC  void
+vrna_constraints_add( vrna_fold_compound_t *vc,
+                      const char *constraint,
+                      unsigned int options){
+
+  if(vc){
+    if(!vc->hc)
+      vrna_hc_init(vc);
+
+    if(options & VRNA_CONSTRAINT_DB){ /* apply hard constraints from dot-bracket notation */
+      vrna_hc_add_from_db(vc, constraint, options);
+    } else { /* constraints from file is the default */
+      vrna_file_commands_apply(vc, constraint, VRNA_CMD_PARSE_HC | VRNA_CMD_PARSE_SC);
+    }
+  }
+}
diff --git a/C/ViennaRNA/constraints.h b/C/ViennaRNA/constraints.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/constraints.h
@@ -0,0 +1,370 @@
+#ifndef VIENNA_RNA_PACKAGE_CONSTRAINTS_H
+#define VIENNA_RNA_PACKAGE_CONSTRAINTS_H
+
+#include <ViennaRNA/data_structures.h>
+
+/* include all structure constraint related headers */
+#include <ViennaRNA/constraints_hard.h>
+#include <ViennaRNA/constraints_soft.h>
+#include <ViennaRNA/constraints_SHAPE.h>
+#include <ViennaRNA/perturbation_fold.h>
+#include <ViennaRNA/constraints_ligand.h>
+
+/**
+ *  @file     constraints.h
+ *  @brief    Functions and data structures for constraining secondary structure predictions and evaluation
+ *  @ingroup  constraints
+ */
+
+/**
+ *  @brief  Flag for vrna_constraints_add() to indicate that constraints are present in a text file
+ *
+ *  @see vrna_constraints_add()
+ *  @deprecated   Use 0 instead!
+ *  @ingroup  constraints
+ *
+ */
+#define VRNA_CONSTRAINT_FILE      0
+
+/**
+ *  @brief  Indicate generation of constraints for MFE folding
+ *  @deprecated   This flag has no meaning anymore, since constraints are now always stored!
+ *  @ingroup  constraints
+ *
+ */
+#define VRNA_CONSTRAINT_SOFT_MFE  0
+
+/**
+ *  @brief  Indicate generation of constraints for partition function computation
+ *  @deprecated   Use #VRNA_OPTION_PF instead!
+ *  @ingroup  constraints
+ *
+ */
+#define VRNA_CONSTRAINT_SOFT_PF   VRNA_OPTION_PF
+
+/**
+ *  @brief  Flag passed to generic softt constraints callback to indicate hairpin loop decomposition step
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates a hairpin loop enclosed by the base pair @f$(i,j)@f$.
+ *
+ *  @image html   decomp_hp.svg
+ *  @image latex  decomp_hp.eps
+ *
+ */
+#define VRNA_DECOMP_PAIR_HP     1
+
+/**
+ *  @brief  Indicator for interior loop decomposition step
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates an interior loop enclosed by the base pair @f$(i,j)@f$,
+ *  and enclosing the base pair @f$(k,l)@f$.
+ *
+ *  @image html   decomp_il.svg
+ *  @image latex  decomp_il.eps
+ *
+ */
+#define VRNA_DECOMP_PAIR_IL     2
+
+/**
+ *  @brief  Indicator for multibranch loop decomposition step
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates a multibranch loop enclosed by the base pair @f$(i,j)@f$,
+ *  and consisting of some enclosed multi loop content from k to l.
+ *
+ *  @image html   decomp_ml.svg
+ *  @image latex  decomp_ml.eps
+ *
+ */
+#define VRNA_DECOMP_PAIR_ML     3
+
+/**
+ *  @brief  Indicator for decomposition of multibranch loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates a multibranch loop part in the interval @f$[i:j]@f$,
+ *  which will be decomposed into two multibranch loop parts @f$[i:k]@f$, and @f$[l:j]@f$.
+ *
+ *  @image html   decomp_ml_ml_ml.svg
+ *  @image latex  decomp_ml_ml_ml.eps
+ *
+ */
+#define VRNA_DECOMP_ML_ML_ML    5
+
+/**
+ *  @brief  Indicator for decomposition of multibranch loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates a multibranch loop part in the interval @f$[i:j]@f$,
+ *  which will be considered a single stem branching off with base pair @f$(k,l)@f$.
+ *
+ *  @image html   decomp_ml_stem.svg
+ *  @image latex  decomp_ml_stem.eps
+ *
+ */
+#define VRNA_DECOMP_ML_STEM     4
+
+/**
+ *  @brief  Indicator for decomposition of multibranch loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates a multibranch loop part in the interval @f$[i:j]@f$,
+ *  which will be decomposed into a (usually) smaller multibranch loop part @f$[k:l]@f$.
+ *
+ *  @image html   decomp_ml_ml.svg
+ *  @image latex  decomp_ml_ml.eps
+ *
+ */
+#define VRNA_DECOMP_ML_ML       6
+
+/**
+ *  @brief  Indicator for decomposition of multibranch loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates a multibranch loop part in the interval @f$[i:j]@f$,
+ *  which will be considered a multibranch loop part that only consists of unpaired
+ *  nucleotides.
+ *
+ *  @image html   decomp_ml_up.svg
+ *  @image latex  decomp_ml_up.eps
+ *
+ */
+#define VRNA_DECOMP_ML_UP       11
+
+/**
+ *  @brief  Indicator for decomposition of multibranch loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates a multibranch loop part in the interval @f$[i:j]@f$,
+ *  which will decomposed into a multibranch loop part @f$[i:k]@f$, and a stem with
+ *  enclosing base pair @f$(l,j)@f$.
+ *
+ *  @image html   decomp_ml_ml_stem.svg
+ *  @image latex  decomp_ml_ml_stem.eps
+ *
+ */
+#define VRNA_DECOMP_ML_ML_STEM 20
+
+/**
+ *  @brief  Indicator for decomposition of multibranch loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates a multibranch loop part in the interval @f$[i:j]@f$,
+ *  where two stems with enclosing pairs @f$(i,k)@f$ and @f$(l,j)@f$ are coaxially stacking
+ *  onto each other.
+ *
+ *  @image html   decomp_ml_coaxial.svg
+ *  @image latex  decomp_ml_coaxial.eps
+ *
+ */
+#define VRNA_DECOMP_ML_COAXIAL  13
+
+/**
+ *  @brief  Indicator for decomposition of multibranch loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates a multibranch loop part in the interval @f$[i:j]@f$,
+ *  where two stems with enclosing pairs @f$(i,k)@f$ and @f$(l,j)@f$ are coaxially stacking
+ *  onto each other.
+ *
+ *  @image html   decomp_ml_coaxial.svg
+ *  @image latex  decomp_ml_coaxial.eps
+ *
+ */
+#define VRNA_DECOMP_ML_COAXIAL_ENC  22
+
+/**
+ *  @brief  Indicator for decomposition of exterior loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @def VRNA_DECOMP_EXT_EXT
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates an exterior loop part in the interval @f$[i:j]@f$,
+ *  which will be decomposed into a (usually) smaller exterior loop part @f$[k:l]@f$.
+ *
+ *  @image html   decomp_ext_ext.svg
+ *  @image latex  decomp_ext_ext.eps
+ *
+ */
+#define VRNA_DECOMP_EXT_EXT     9
+
+/**
+ *  @brief  Indicator for decomposition of exterior loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates an exterior loop part in the interval @f$[i:j]@f$,
+ *  which will be considered as an exterior loop component consisting of only unpaired
+ *  nucleotides.
+ *
+ *  @image html   decomp_ext_up.svg
+ *  @image latex  decomp_ext_up.eps
+ *
+ */
+#define VRNA_DECOMP_EXT_UP      8
+
+/**
+ *  @brief  Indicator for decomposition of exterior loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates an exterior loop part in the interval @f$[i:j]@f$,
+ *  which will be considered a stem with enclosing pair @f$(k,l)@f$.
+ *
+ *  @image html   decomp_ext_stem.svg
+ *  @image latex  decomp_ext_stem.eps
+ *
+ */
+#define VRNA_DECOMP_EXT_STEM 14
+
+/**
+ *  @brief  Indicator for decomposition of exterior loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates an exterior loop part in the interval @f$[i:j]@f$,
+ *  which will be decomposed into two exterior loop parts @f$[i:k]@f$ and @f$[l:j]@f$.
+ *
+ *  @image html   decomp_ext_ext_ext.svg
+ *  @image latex  decomp_ext_ext_ext.eps
+ *
+ */
+#define VRNA_DECOMP_EXT_EXT_EXT 15
+
+/**
+ *  @brief  Indicator for decomposition of exterior loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates an exterior loop part in the interval @f$[i:j]@f$,
+ *  which will be decomposed into a stem branching off with base pair @f$(i,k)@f$, and
+ *  an exterior loop part @f$[l:j]@f$.
+ *
+ *  @image html   decomp_ext_stem_ext.svg
+ *  @image latex  decomp_ext_stem_ext.eps
+ *
+ */
+#define VRNA_DECOMP_EXT_STEM_EXT 16
+
+/**
+ *  @brief  Indicator for decomposition of exterior loop part
+ *
+ *  @ingroup  constraints
+ *
+ */
+#define VRNA_DECOMP_EXT_STEM_OUTSIDE 17
+
+/**
+ *  @brief  Indicator for decomposition of exterior loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates an exterior loop part in the interval @f$[i:j]@f$,
+ *  which will be decomposed into an exterior loop part @f$[i:k]@f$, and a stem
+ *  branching off with base pair @f$(l,j)@f$.
+ *
+ *  @image html   decomp_ext_ext_stem.svg
+ *  @image latex  decomp_ext_ext_stem.eps
+ *
+ */
+#define VRNA_DECOMP_EXT_EXT_STEM 18
+
+/**
+ *  @brief  Indicator for decomposition of exterior loop part
+ *
+ *  @ingroup  constraints
+ *
+ *  @def VRNA_DECOMP_EXT_EXT_STEM1
+ *  @details This flag notifies the soft or hard constraint callback function that the current
+ *  decomposition step evaluates an exterior loop part in the interval @f$[i:j]@f$,
+ *  which will be decomposed into an exterior loop part @f$[i:k]@f$, and a stem
+ *  branching off with base pair @f$(l,j-1)@f$.
+ *
+ *  @image html   decomp_ext_ext_stem1.svg
+ *  @image latex  decomp_ext_ext_stem1.eps
+
+ */
+#define VRNA_DECOMP_EXT_EXT_STEM1 19
+
+
+#define VRNA_DECOMP_EXT_L         20
+
+
+#define VRNA_DECOMP_EXT_EXT_L     21
+
+/**
+ *  @brief  Add constraints to a #vrna_fold_compound_t data structure
+ *
+ *  Use this function to add/update the hard/soft constraints
+ *  The function allows for passing a string 'constraint' that can either be a
+ *  filename that points to a constraints definition file or it may be a
+ *  pseudo dot-bracket notation indicating hard constraints. For the latter, the
+ *  user has to pass the #VRNA_CONSTRAINT_DB option. Also, the
+ *  user has to specify, which characters are allowed to be interpreted as
+ *  constraints by passing the corresponding options via the third parameter.
+ *
+ *  @see      vrna_hc_init(), vrna_hc_add_up(), vrna_hc_add_up_batch(), vrna_hc_add_bp(),
+ *            vrna_sc_init(), vrna_sc_set_up(), vrna_sc_set_bp(), 
+ *            vrna_sc_add_SHAPE_deigan(),  vrna_sc_add_SHAPE_zarringhalam(),
+ *            vrna_hc_free(), vrna_sc_free(),
+ *            #VRNA_CONSTRAINT_DB, #VRNA_CONSTRAINT_DB_DEFAULT, #VRNA_CONSTRAINT_DB_PIPE,
+ *            #VRNA_CONSTRAINT_DB_DOT, #VRNA_CONSTRAINT_DB_X, #VRNA_CONSTRAINT_DB_ANG_BRACK,
+ *            #VRNA_CONSTRAINT_DB_RND_BRACK, #VRNA_CONSTRAINT_DB_INTRAMOL,
+ *            #VRNA_CONSTRAINT_DB_INTERMOL, #VRNA_CONSTRAINT_DB_GQUAD
+ *
+ *  @ingroup  constraints
+ *
+ *  The following is an example for adding hard constraints given in
+ *  pseudo dot-bracket notation. Here, @p vc is the #vrna_fold_compound_t object,
+ *  @p structure is a char array with the hard constraint in dot-bracket notation,
+ *  and @p enforceConstraints is a flag indicating whether or not constraints for
+ *  base pairs should be enforced instead of just doing a removal of base pair that
+ *  conflict with the constraint.
+ *
+ *  @snippet RNAfold.c Adding hard constraints from pseudo dot-bracket
+ *
+ *  In constrat to the above, constraints may also be read from file:
+ *
+ *  @snippet RNAfold.c Adding hard constraints from file
+ *
+ *  @see  vrna_hc_add_from_db(), vrna_hc_add_up(), vrna_hc_add_up_batch()
+ *        vrna_hc_add_bp_unspecific(), vrna_hc_add_bp()
+ *
+ *  @param  vc            The fold compound
+ *  @param  constraint    A string with either the filename of the constraint definitions
+ *                        or a pseudo dot-bracket notation of the hard constraint. May be NULL.
+ *  @param  options       The option flags
+ */
+void vrna_constraints_add(vrna_fold_compound_t *vc,
+                          const char *constraint,
+                          unsigned int options);
+
+#endif
diff --git a/C/ViennaRNA/constraints_SHAPE.c b/C/ViennaRNA/constraints_SHAPE.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/constraints_SHAPE.c
@@ -0,0 +1,575 @@
+/* SHAPE reactivity data handling */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/energy_const.h" /* defines MINPSCORE */
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/aln_util.h"
+#include "ViennaRNA/file_formats.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/constraints_SHAPE.h"
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE void
+sc_parse_parameters(const char *string,
+                    char c1,
+                    char c2,
+                    float *v1,
+                    float *v2);
+
+PRIVATE void
+sc_add_stack_en_mfe(vrna_fold_compound_t *vc,
+                    const FLT_OR_DBL *constraints,
+                    unsigned int options);
+
+PRIVATE void
+prepare_Boltzmann_weights_stack(vrna_fold_compound_t *vc);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+PUBLIC void
+vrna_constraints_add_SHAPE( vrna_fold_compound_t *vc,
+                            const char *shape_file,
+                            const char *shape_method,
+                            const char *shape_conversion,
+                            int verbose,
+                            unsigned int constraint_type){
+
+  float p1, p2;
+  char method;
+  char *sequence;
+  double *values;
+  int i, length = vc->length;
+
+  if(!vrna_sc_SHAPE_parse_method(shape_method, &method, &p1, &p2)){
+    vrna_message_warning("Method for SHAPE reactivity data conversion not recognized!");
+    return;
+  }
+
+  if(verbose){
+    if(method != 'W'){
+      if(method == 'Z')
+        vrna_message_info(stderr, "Using SHAPE method '%c' with parameter p1=%f", method, p1);
+      else
+        vrna_message_info(stderr, "Using SHAPE method '%c' with parameters p1=%f and p2=%f", method, p1, p2);
+    }
+  }
+
+  sequence = vrna_alloc(sizeof(char) * (length + 1));
+  values = vrna_alloc(sizeof(double) * (length + 1));
+  vrna_file_SHAPE_read(shape_file, length, method == 'W' ? 0 : -1, sequence, values);
+
+  if(method == 'D'){
+    (void)vrna_sc_add_SHAPE_deigan(vc, (const double *)values, p1, p2, constraint_type);
+  }
+  else if(method == 'Z'){
+    (void)vrna_sc_add_SHAPE_zarringhalam(vc, (const double *)values, p1, 0.5, shape_conversion, constraint_type);
+  } else {
+    assert(method == 'W');
+    FLT_OR_DBL *v = vrna_alloc(sizeof(FLT_OR_DBL) * (length + 1));
+    for(i = 0; i < length; i++)
+      v[i] = values[i];
+
+    vrna_sc_set_up(vc, v, constraint_type);
+
+    free(v);
+  }
+
+  free(values);
+  free(sequence);
+}
+
+
+PUBLIC void
+vrna_constraints_add_SHAPE_ali( vrna_fold_compound_t *vc,
+                      const char *shape_method,
+                      const char **shape_files,
+                      const int  *shape_file_association,
+                      int verbose,
+                      unsigned int constraint_type){
+
+  float p1, p2;
+  char method;
+
+  if(!vrna_sc_SHAPE_parse_method(shape_method, &method, &p1, &p2)){
+    vrna_message_warning("Method for SHAPE reactivity data conversion not recognized!");
+    return;
+  }
+
+  if(verbose){
+    if(method != 'W'){
+      if(method == 'Z')
+        vrna_message_info( stderr,
+                                  "Using SHAPE method '%c' with parameter p1=%f",
+                                  method, p1);
+      else
+        vrna_message_info( stderr,
+                                  "Using SHAPE method '%c' with parameters p1=%f and p2=%f",
+                                  method, p1, p2);
+    }
+  }
+
+  if(method == 'D'){
+    vrna_sc_add_SHAPE_deigan_ali(vc, shape_files, shape_file_association, p1, p2, constraint_type);
+    return;
+  }
+}
+
+
+PUBLIC int
+vrna_sc_SHAPE_to_pr(const char *shape_conversion,
+                    double *values,
+                    int length,
+                    double default_value){
+
+  int *indices;
+  int i, j;
+  int index;
+  int ret = 1;
+
+  if(!shape_conversion || !(*shape_conversion) || length <= 0)
+    return 0;
+
+  if(*shape_conversion == 'S')
+    return 1;
+
+  indices = vrna_alloc(sizeof(int) * (length + 1));
+  for (i = 1, j = 0; i <= length; ++i){
+    if(values[i] < 0)
+      values[i] = default_value;
+    else
+      indices[j++] = i;
+  }
+
+  if(*shape_conversion == 'M'){
+    double max;
+    double map_info[4][2] = {{0.25, 0.35},
+                           {0.30, 0.55},
+                           {0.70, 0.85},
+                           {0, 1}};
+
+    max = values[1];
+    for(i = 2; i <= length; ++i)
+      max = MAX2(max, values[i]);
+    map_info[3][0] = max;
+
+    for(i = 0; indices[i]; ++i){
+      double lower_source = 0;
+      double lower_target = 0;
+
+      index = indices[i];
+
+      if(values[index] == 0)
+        continue;
+
+      for(j = 0; j < 4; ++j){
+        if(values[index] > lower_source && values[index] <= map_info[j][0]){
+          double diff_source = map_info[j][0] - lower_source;
+          double diff_target = map_info[j][1] - lower_target;
+          values[index] = (values[index] - lower_source) / diff_source * diff_target + lower_target;
+          break;
+        }
+
+        lower_source = map_info[j][0];
+        lower_target = map_info[j][1];
+      }
+    }
+  }
+  else if (*shape_conversion == 'C'){
+    float cutoff = 0.25;
+    int i;
+
+    sscanf(shape_conversion + 1, "%f", &cutoff);
+
+    for(i = 0; indices[i]; ++i){
+      index = indices[i];
+      values[index] = values[index] < cutoff ? 0 : 1;
+    }
+  }
+  else if (*shape_conversion == 'L' || *shape_conversion == 'O'){
+    int i;
+    float slope = (*shape_conversion == 'L') ? 0.68 : 1.6;
+    float intercept = (*shape_conversion == 'L') ? 0.2 : -2.29;
+
+    sc_parse_parameters(shape_conversion + 1, 's', 'i', &slope, &intercept);
+
+    for(i = 0; indices[i]; ++i){
+      double v;
+      index = indices[i];
+
+      v = (*shape_conversion == 'L') ? values[index] : log(values[index]);
+      values[index] = MAX2(MIN2((v - intercept) / slope, 1),0);
+    }
+  }
+  else
+    ret = 0;
+
+  free(indices);
+
+  return ret;
+}
+
+PUBLIC  int
+vrna_sc_add_SHAPE_zarringhalam( vrna_fold_compound_t *vc,
+                                const double *reactivities,
+                                double b,
+                                double default_value,
+                                const char *shape_conversion,
+                                unsigned int options){
+
+  int       i, j, n, ret;
+  double        *pr;
+  FLT_OR_DBL    *up, **bp;
+  vrna_md_t *md;
+
+  ret = 0; /* error */
+
+  if(vc && reactivities && (vc->type == VRNA_FC_TYPE_SINGLE)){
+    n   = vc->length;
+    md  = &(vc->params->model_details);
+
+    /* first we copy over the reactivities to convert them into probabilities later on */
+    pr = (double *)vrna_alloc(sizeof(double) * (n + 1));
+    for(i=0; i<=n; i++)
+      pr[i] = reactivities[i];
+
+    if(vrna_sc_SHAPE_to_pr(shape_conversion, pr, n, default_value)){
+
+      /*  now, convert them into pseudo free energies for unpaired, and
+          paired nucleotides
+      */
+      up = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+      bp = (FLT_OR_DBL **)vrna_alloc(sizeof(FLT_OR_DBL *) * (n + 1));
+      for(i = 1; i <= n; ++i){
+        up[i] = b * fabs(pr[i] - 1);
+        bp[i] = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+        for(j = i + md->min_loop_size + 1; j <= n; ++j)
+          bp[i][j] = b * (pr[i] + pr[j]);
+      }
+
+      /* add the pseudo energies as soft constraints */
+      vrna_sc_set_up(vc, (const FLT_OR_DBL *)up, options);
+      vrna_sc_set_bp(vc, (const FLT_OR_DBL **)bp, options);
+
+      /* clean up memory */
+      for(i = 1; i <= n; ++i)
+        free(bp[i]);
+      free(bp);
+      free(up);
+
+      ret = 1; /* success */
+    }
+
+    free(pr);
+
+  }
+
+  return ret;
+}
+
+
+PUBLIC int
+vrna_sc_add_SHAPE_deigan( vrna_fold_compound_t *vc,
+                          const double *reactivities,
+                          double m,
+                          double b,
+                          unsigned int options){
+
+  int     i;
+  FLT_OR_DBL  *values;
+
+  if(vc && (vc->type == VRNA_FC_TYPE_SINGLE)){
+    if(reactivities){
+
+      values = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (vc->length + 1));
+
+      /* first convert the values according to provided slope and intercept values */
+      for (i = 1; i <= vc->length; ++i){
+        values[i] = reactivities[i] < 0 ? 0. : (FLT_OR_DBL)(m * log(reactivities[i] + 1) + b);
+      }
+
+      /* always store soft constraints in plain format */
+      sc_add_stack_en_mfe(vc, (const FLT_OR_DBL *)values, options);
+      free(values);
+    }
+
+    if(options & VRNA_OPTION_PF)
+      prepare_Boltzmann_weights_stack(vc);
+
+    return 1; /* success */
+  }
+  return 0; /* error */
+}
+
+PUBLIC int
+vrna_sc_add_SHAPE_deigan_ali( vrna_fold_compound_t *vc,
+                              const char **shape_files,
+                              const int *shape_file_association,
+                              double m,
+                              double b,
+                              unsigned int options){
+
+  float           reactivity, *reactivities, e1;
+  char            *line, nucleotide, *sequence;
+  int             s, i, p, r, position, *pseudo_energies, n_seq;
+  unsigned short  **a2s;
+
+  if(vc && (vc->type == VRNA_FC_TYPE_COMPARATIVE)){
+    n_seq = vc->n_seq;
+    a2s   = vc->a2s;
+
+    vrna_sc_init(vc);
+
+    for(s = 0; shape_file_association[s] != -1; s++){
+      int ss = shape_file_association[s]; /* actual sequence number in alignment */
+
+      if(ss >= n_seq){
+        vrna_message_warning("SHAPE file association exceeds sequence number in alignment");
+        continue;
+      }
+
+      /* read the shape file */
+      FILE *fp;
+      if(!(fp = fopen(shape_files[s], "r"))){
+        vrna_message_warning("SHAPE data file %d could not be opened. No shape data will be used.", s);
+      } else {
+
+        reactivities  = (float *)vrna_alloc(sizeof(float) * (vc->length + 1));
+        sequence      = (char *)vrna_alloc(sizeof(char) * (vc->length + 1));
+
+        /* initialize reactivities with missing data for entire alignment length */
+        for(i = 1; i <= vc->length; i++)
+          reactivities[i] = -1.;
+
+        while((line=vrna_read_line(fp))){
+          r = sscanf(line, "%d %c %f", &position, &nucleotide, &reactivity);
+          if(r){
+            if((position <= 0) || (position > vc->length))
+              vrna_message_error("provided shape data outside of sequence scope");
+
+            switch(r){
+              case 1:   nucleotide = 'N';
+                        /* fall through */
+              case 2:   reactivity = -1.;
+                        /* fall through */
+              default:  sequence[position-1]    = nucleotide;
+                        reactivities[position]  = reactivity;
+                        break;
+            }
+          }
+          free(line);
+        }
+        fclose(fp);
+
+        sequence[vc->length] = '\0';
+
+        /* double check information by comparing the sequence read from */
+        char *tmp_seq = get_ungapped_sequence(vc->sequences[shape_file_association[s]]);
+        if(strcmp(tmp_seq, sequence)){
+          vrna_message_warning("Input sequence %d differs from sequence provided via SHAPE file!\n", shape_file_association[s]);
+        }
+        free(tmp_seq);
+
+        /* convert reactivities to pseudo energies */
+        for(i = 1; i <= vc->length; i++){
+          if(reactivities[i] < 0)
+            reactivities[i] = 0.;
+          else
+            reactivities[i] = m * log(reactivities[i] + 1.) + b; /* this should be a value in kcal/mol */
+        }
+
+        /*  begin actual storage of the pseudo energies */
+        /*  beware of the fact that energy_stack will be accessed through a2s[s] array,
+            hence pseudo_energy might be gap-free (default)
+        */
+        /* ALWAYS store soft constraints in plain format */
+        int energy, cnt, gaps, is_gap;
+        pseudo_energies = (int *)vrna_alloc(sizeof(int) * (vc->length + 1));
+        for(gaps = cnt = 0, i = 1; i<=vc->length; i++){
+          is_gap  = (vc->sequences[ss][i-1] == '-') ? 1 : 0;
+          energy  = ((i - gaps > 0) && !(is_gap)) ? (int)roundf(reactivities[i - gaps] * 100.) : 0;
+
+          if(vc->params->model_details.oldAliEn){
+            pseudo_energies[i] = energy;
+            cnt++;
+          } else if(!is_gap){ /* store gap-free */
+            pseudo_energies[a2s[ss][i]] = energy;
+            cnt++;
+          }
+
+          gaps += is_gap;
+        }
+
+        /* resize to actual number of entries */
+        pseudo_energies = vrna_realloc(pseudo_energies, sizeof(int) * (cnt + 2));
+        vc->scs[ss]->energy_stack = pseudo_energies;
+
+        if(options & VRNA_OPTION_PF){
+          FLT_OR_DBL *exp_pe = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (vc->length + 1));
+          for(i=0;i<=vc->length;i++)
+            exp_pe[i] = 1.;
+
+          for(p = 0, i = 1; i<=vc->length; i++){
+            e1 = (i - p > 0) ? reactivities[i - p] : 0.;
+            if(vc->sequences[ss][i-1] == '-'){
+              p++; e1 = 0.;
+            }
+            exp_pe[i] = (FLT_OR_DBL)exp(-(e1 * 1000.) / vc->exp_params->kT );
+          }
+          vc->scs[ss]->exp_energy_stack = exp_pe;
+        }
+        
+        free(reactivities);
+      }
+    }
+
+    return 1; /* success */
+  } else {
+    return 0; /* error */
+  }
+}
+
+PUBLIC  int
+vrna_sc_SHAPE_parse_method( const char *method_string,
+                            char *method,
+                            float *param_1,
+                            float *param_2){
+
+  const char *params = method_string + 1;
+
+  *param_1 = 0;
+  *param_2 = 0;
+
+  if (!method_string || !method_string[0])
+    return 0;
+
+  *method = method_string[0];
+
+  switch(method_string[0]){
+    case 'Z':   *param_1 = 0.89;
+                sc_parse_parameters(params, 'b', '\0', param_1, NULL);
+                break;
+
+    case 'D':   *param_1 = 1.8;
+                *param_2 = -0.6;
+                sc_parse_parameters(params, 'm', 'b', param_1, param_2);
+                break;
+
+    case 'W':   break;
+
+    default:    *method = 0;
+                return 0;
+  }
+
+  return 1;
+}
+
+PRIVATE void
+sc_parse_parameters( const char *string,
+                        char c1,
+                        char c2,
+                        float *v1,
+                        float *v2){
+
+  char fmt[8];
+  const char warning[] = "SHAPE method parameters not recognized! Using default parameters!";
+  int r;
+
+  assert(c1);
+  assert(v1);
+
+  if(!string || !(*string))
+    return;
+
+  if(c2 == 0 || v2 == NULL){
+    sprintf(fmt, "%c%%f", c1);
+    r = sscanf(string, fmt, v1);
+
+    if(!r)
+      vrna_message_warning(warning);
+
+    return;
+  }
+
+  sprintf(fmt, "%c%%f%c%%f", c1, c2);
+  r = sscanf(string, fmt, v1, v2);
+
+  if(r!=2){
+    sprintf(fmt, "%c%%f", c1);
+    r = sscanf(string, fmt, v1);
+
+    if(!r){
+      sprintf(fmt, "%c%%f", c2);
+      r = sscanf(string, fmt, v2);
+
+      if(!r)
+        vrna_message_warning(warning);
+    }
+  }
+}
+
+PRIVATE void
+sc_add_stack_en_mfe(vrna_fold_compound_t *vc,
+                    const FLT_OR_DBL *constraints,
+                    unsigned int options){
+  int i;
+
+  if(!vc->sc)
+    vrna_sc_init(vc);
+
+  if(!vc->sc->energy_stack)
+    vc->sc->energy_stack = (int *)vrna_alloc(sizeof(int) * (vc->length + 1));
+
+  for(i = 1; i <= vc->length; ++i)
+    vc->sc->energy_stack[i] = (int)roundf(constraints[i] * 100.);
+}
+
+PRIVATE void
+prepare_Boltzmann_weights_stack(vrna_fold_compound_t *vc){
+  int i;
+  vrna_sc_t *sc = vc->sc;
+
+  if(sc->energy_stack){
+    if(!sc->exp_energy_stack){
+      sc->exp_energy_stack = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (vc->length + 1));
+      for(i = 0; i <= vc->length; ++i)
+        sc->exp_energy_stack[i] = 1.;
+    }
+
+    for(i = 1; i <= vc->length; ++i)
+      sc->exp_energy_stack[i] = (FLT_OR_DBL)exp(-(sc->energy_stack[i] * 10.)/ vc->exp_params->kT);
+  }
+}
+
diff --git a/C/ViennaRNA/constraints_SHAPE.h b/C/ViennaRNA/constraints_SHAPE.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/constraints_SHAPE.h
@@ -0,0 +1,142 @@
+#ifndef VIENNA_RNA_PACKAGE_CONSTRAINTS_SHAPE_H
+#define VIENNA_RNA_PACKAGE_CONSTRAINTS_SHAPE_H
+
+#include <ViennaRNA/data_structures.h>
+
+/**
+ *  @file constraints_SHAPE.h
+ *  @brief This module provides function to incorporate SHAPE reactivity data
+ *  into the folding recursions by means of soft constraints
+ *
+ *  @ingroup SHAPE_reactivities
+ */
+
+void vrna_constraints_add_SHAPE(vrna_fold_compound_t *vc,
+                                const char *shape_file,
+                                const char *shape_method,
+                                const char *shape_conversion,
+                                int verbose,
+                                unsigned int constraint_type);
+
+void vrna_constraints_add_SHAPE_ali(vrna_fold_compound_t *vc,
+                                    const char *shape_method,
+                                    const char **shape_files,
+                                    const int  *shape_file_association,
+                                    int verbose,
+                                    unsigned int constraint_type);
+/**
+ *  @brief  Add SHAPE reactivity data as soft constraints (Deigan et al. method)
+ *
+ *  This approach of SHAPE directed RNA folding uses the simple linear ansatz
+ *  @f[ \Delta G_{\text{SHAPE}}(i) = m \ln(\text{SHAPE reactivity}(i)+1)+ b @f]
+ *  to convert SHAPE reactivity values to pseudo energies whenever a
+ *  nucleotide @f$ i @f$ contributes to a stacked pair. A positive slope @f$ m @f$
+ *  penalizes high reactivities in paired regions, while a negative intercept @f$ b @f$
+ *  results in a confirmatory ``bonus'' free energy for correctly predicted base pairs.
+ *  Since the energy evaluation of a base pair stack involves two pairs, the pseudo
+ *  energies are added for all four contributing nucleotides. Consequently, the
+ *  energy term is applied twice for pairs inside a helix and only once for pairs
+ *  adjacent to other structures. For all other loop types the energy model remains
+ *  unchanged even when the experimental data highly disagrees with a certain motif.
+ *
+ *  @see  For further details, we refer to @cite deigan:2009.
+ *  @see  vrna_sc_remove(), vrna_sc_add_SHAPE_zarringhalam(), vrna_sc_minimize_pertubation()
+ *  @ingroup SHAPE_reactivities
+ *  @param  vc            The #vrna_fold_compound_t the soft constraints are associated with
+ *  @param  reactivities  A vector of normalized SHAPE reactivities
+ *  @param  m             The slope of the conversion function
+ *  @param  b             The intercept of the conversion function
+ *  @param  options       The options flag indicating how/where to store the soft constraints
+ *  @return               1 on successful extraction of the method, 0 on errors
+ */
+int vrna_sc_add_SHAPE_deigan( vrna_fold_compound_t *vc,
+                              const double *reactivities,
+                              double m,
+                              double b,
+                              unsigned int options);
+
+/**
+ *  @brief  Add SHAPE reactivity data from files as soft constraints for consensus structure prediction (Deigan et al. method)
+ *
+ *  @ingroup SHAPE_reactivities
+ *  @param  vc            The #vrna_fold_compound_t the soft constraints are associated with
+ *  @param  shape_files   A set of filenames that contain normalized SHAPE reactivity data
+ *  @param  shape_file_association  An array of integers that associate the files with sequences in the alignment
+ *  @param  m             The slope of the conversion function
+ *  @param  b             The intercept of the conversion function
+ *  @param  options       The options flag indicating how/where to store the soft constraints
+ *  @return               1 on successful extraction of the method, 0 on errors
+ */
+int vrna_sc_add_SHAPE_deigan_ali( vrna_fold_compound_t *vc,
+                                  const char **shape_files,
+                                  const int *shape_file_association,
+                                  double m,
+                                  double b,
+                                  unsigned int options);
+
+/**
+ *  @brief  Add SHAPE reactivity data as soft constraints (Zarringhalam et al. method)
+ *
+ *  This method first converts the observed SHAPE reactivity of nucleotide @f$ i @f$ into a
+ *  probability @f$ q_i @f$ that position @f$ i @f$ is unpaired by means of a non-linear map.
+ *  Then pseudo-energies of the form @f[ \Delta G_{\text{SHAPE}}(x,i) = \beta\ |x_i - q_i| @f]
+ *  are computed, where @f$ x_i=0 @f$ if position @f$ i @f$ is unpaired and @f$ x_i=1 @f$
+ *  if @f$ i @f$ is paired in a given secondary structure. The parameter @f$ \beta @f$ serves as
+ *  scaling factor. The magnitude of discrepancy between prediction and experimental observation
+ *  is represented by @f$ |x_i - q_i| @f$.
+ *
+ *  @see For further details, we refer to @cite zarringhalam:2012
+ *  @see  vrna_sc_remove(), vrna_sc_add_SHAPE_deigan(), vrna_sc_minimize_pertubation()
+ *  @ingroup SHAPE_reactivities
+ *  @param  vc                The #vrna_fold_compound_t the soft constraints are associated with
+ *  @param  reactivities      A vector of normalized SHAPE reactivities
+ *  @param  b                 The scaling factor @f$ \beta @f$ of the conversion function
+ *  @param  default_value     The default value for a nucleotide where reactivity data is missing for
+ *  @param  shape_conversion  A flag that specifies how to convert reactivities to probabilities
+ *  @param  options           The options flag indicating how/where to store the soft constraints
+ *  @return                   1 on successful extraction of the method, 0 on errors
+ */
+int vrna_sc_add_SHAPE_zarringhalam( vrna_fold_compound_t *vc,
+                                    const double *reactivities,
+                                    double b,
+                                    double default_value,
+                                    const char *shape_conversion,
+                                    unsigned int options);
+
+/**
+ *  @brief  Parse a character string and extract the encoded SHAPE reactivity conversion
+ *          method and possibly the parameters for conversion into pseudo free energies
+ *
+ *  @ingroup soft_cosntraints
+ *
+ *  @param  method_string   The string that contains the encoded SHAPE reactivity conversion method
+ *  @param  method          A pointer to the memory location where the method character will be stored
+ *  @param  param_1         A pointer to the memory location where the first parameter of the corresponding method will be stored
+ *  @param  param_2         A pointer to the memory location where the second parameter of the corresponding method will be stored
+ *  @return                 1 on successful extraction of the method, 0 on errors
+ */
+int vrna_sc_SHAPE_parse_method( const char *method_string,
+                                char *method,
+                                float *param_1,
+                                float *param_2);
+
+/**
+ *  @brief Convert SHAPE reactivity values to probabilities for being unpaired
+ *
+ *  This function parses the informations from a given file and stores the result
+ *  in the preallocated string sequence and the #FLT_OR_DBL array values.
+ *
+ *  @ingroup SHAPE_reactivities
+ *
+ *  @see vrna_file_SHAPE_read()
+ *  @param shape_conversion String definining the method used for the conversion process
+ *  @param values           Pointer to an array of SHAPE reactivities
+ *  @param length           Length of the array of SHAPE reactivities
+ *  @param default_value    Result used for position with invalid/missing reactivity values
+ */
+int vrna_sc_SHAPE_to_pr(const char *shape_conversion,
+                        double *values,
+                        int length,
+                        double default_value);
+
+#endif
diff --git a/C/ViennaRNA/constraints_hard.c b/C/ViennaRNA/constraints_hard.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/constraints_hard.c
@@ -0,0 +1,1056 @@
+/* constraints handling */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/energy_const.h" /* defines MINPSCORE */
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/aln_util.h"
+#include "ViennaRNA/file_formats.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/constraints_hard.h"
+
+
+#ifdef __GNUC__
+# define INLINE inline
+#else
+# define INLINE
+#endif
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE void
+hc_add_up(vrna_fold_compound_t *vc,
+          int i,
+          char option);
+
+PRIVATE INLINE  void
+hc_cant_pair( unsigned int i,
+              char c_option,
+              char *hc,
+              unsigned int length,
+              unsigned int min_loop_size,
+              int *index);
+
+PRIVATE INLINE  void
+hc_must_pair( unsigned int i,
+              char c_option,
+              char *hc,
+              int *index);
+
+PRIVATE INLINE  void
+hc_pairs_upstream(unsigned int i,
+                  char c_option,
+                  char *hc,
+                  unsigned int length,
+                  int *index);
+
+PRIVATE INLINE  void
+hc_pairs_downstream(unsigned int i,
+                    char c_option,
+                    char *hc,
+                    unsigned int length,
+                    int *index);
+
+PRIVATE INLINE  void
+hc_allow_pair(unsigned int i,
+              unsigned int j,
+              char c_option,
+              char *hc,
+              int *index);
+
+PRIVATE INLINE  void
+hc_weak_enforce_pair( unsigned int i,
+                      unsigned int j,
+                      char c_option,
+                      char *hc,
+                      unsigned int length,
+                      unsigned int min_loop_size,
+                      int *index);
+
+PRIVATE INLINE  void
+hc_enforce_pair(unsigned int i,
+                unsigned int j,
+                char c_option,
+                char *hc,
+                unsigned int length,
+                unsigned int min_loop_size,
+                int *index);
+
+PRIVATE INLINE  void
+hc_intramolecular_only( unsigned int i,
+                        char c_option,
+                        char *hc,
+                        unsigned int length,
+                        unsigned int min_loop_size,
+                        int cut,
+                        int *index);
+
+PRIVATE INLINE  void
+hc_intermolecular_only( unsigned int i,
+                        char c_option,
+                        char *hc,
+                        unsigned int length,
+                        unsigned int min_loop_size,
+                        int cut,
+                        int *index);
+
+PRIVATE void
+apply_DB_constraint(const char *constraint,
+                    char *ptype,
+                    unsigned int length,
+                    unsigned int min_loop_size,
+                    int cut,
+                    unsigned int options);
+
+PRIVATE void
+hc_reset_to_default(vrna_fold_compound_t *vc);
+
+PRIVATE void
+hc_update_up(vrna_fold_compound_t *vc);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+PUBLIC  void
+vrna_message_constraint_options_all(void){
+
+  vrna_message_constraint_options(  VRNA_CONSTRAINT_DB_PIPE
+                                  | VRNA_CONSTRAINT_DB_DOT
+                                  | VRNA_CONSTRAINT_DB_X
+                                  | VRNA_CONSTRAINT_DB_ANG_BRACK
+                                  | VRNA_CONSTRAINT_DB_RND_BRACK);
+}
+
+PUBLIC  void
+vrna_message_constraint_options(unsigned int option){
+
+  printf("Input structure constraints using the following notation:\n");
+  if(option & VRNA_CONSTRAINT_DB_PIPE)       printf("| : paired with another base\n");
+  if(option & VRNA_CONSTRAINT_DB_DOT)        printf(". : no constraint at all\n");
+  if(option & VRNA_CONSTRAINT_DB_X)          printf("x : base must not pair\n");
+  if(option & VRNA_CONSTRAINT_DB_ANG_BRACK)  printf("< : base i is paired with a base j<i\n> : base i is paired with a base j>i\n");
+  if(option & VRNA_CONSTRAINT_DB_RND_BRACK)  printf("matching brackets ( ): base i pairs base j\n");
+}
+
+PUBLIC  void
+vrna_hc_init(vrna_fold_compound_t *vc){
+
+  unsigned int  n;
+  vrna_hc_t     *hc;
+
+  n           = vc->length;
+
+  /* free previous hard constraints */
+  vrna_hc_free(vc->hc);
+
+  /* allocate memory new hard constraints data structure */
+  hc          = (vrna_hc_t *)vrna_alloc(sizeof(vrna_hc_t));
+  hc->matrix  = (char *)vrna_alloc(sizeof(char)*((n*(n+1))/2+2));
+  hc->up_ext  = (int *)vrna_alloc(sizeof(int)*(n+2));
+  hc->up_hp   = (int *)vrna_alloc(sizeof(int)*(n+2));
+  hc->up_int  = (int *)vrna_alloc(sizeof(int)*(n+2));
+  hc->up_ml   = (int *)vrna_alloc(sizeof(int)*(n+2));
+
+  /* set new hard constraints */
+  vc->hc = hc;
+
+  /* prefill default values  */
+  hc_reset_to_default(vc);
+
+  /* add null pointers for the generalized hard constraint feature */
+  hc->f           = NULL;
+  hc->data        = NULL;
+  hc->free_data   = NULL;
+
+  /* update */
+  hc_update_up(vc);
+}
+
+PUBLIC void
+vrna_hc_add_up( vrna_fold_compound_t *vc,
+                int i,
+                char option){
+
+  int j;
+
+  if(vc)
+    if(vc->hc){
+      if((i <= 0) || (i > vc->length)){
+        vrna_message_warning("vrna_hc_add_up: position out of range, not doing anything");
+        return;
+      }
+
+      hc_add_up(vc, i, option);
+
+      hc_update_up(vc);
+    }
+}
+
+PUBLIC int
+vrna_hc_add_up_batch( vrna_fold_compound_t *vc,
+                      vrna_hc_up_t *constraints){
+
+  int i, ret;
+
+  ret = 0; /* failure */
+
+  if(vc)
+    if(vc->hc && constraints){
+      for(i = 0; constraints[i].position != 0; i++){
+        int pos       = constraints[i].position;
+        char options  = constraints[i].options;
+        if((pos <= 0) || (pos > vc->length)){
+          vrna_message_warning("vrna_hc_add_up_batch: position out of range, application of hard constraints stops here!");
+          return ret;
+        }
+        hc_add_up(vc, pos, options);
+      }
+
+      hc_update_up(vc);
+      ret = 1; /* success */
+    }
+
+  return ret;
+}
+
+PRIVATE void
+hc_add_up(vrna_fold_compound_t *vc,
+          int i,
+          char option){
+
+  int   j;
+  char  type = (char)0;
+
+  if(option & VRNA_CONSTRAINT_CONTEXT_ENFORCE){ /* force nucleotide to appear unpaired within a certain type of loop */
+    /* do not allow i to be paired with any other nucleotide */
+    if(!(option & VRNA_CONSTRAINT_CONTEXT_NO_REMOVE)){
+      for(j = 1; j < i; j++)
+        vc->hc->matrix[vc->jindx[i] + j] = (char)0;
+      for(j = i+1; j <= vc->length; j++)
+        vc->hc->matrix[vc->jindx[j] + i] = (char)0;
+    }
+
+    type = option & (char)( VRNA_CONSTRAINT_CONTEXT_EXT_LOOP
+                            | VRNA_CONSTRAINT_CONTEXT_HP_LOOP
+                            | VRNA_CONSTRAINT_CONTEXT_INT_LOOP
+                            | VRNA_CONSTRAINT_CONTEXT_MB_LOOP);
+
+    vc->hc->matrix[vc->jindx[i] + i] = type;
+  } else {
+    type = option & VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS;
+
+    /* do not allow i to be paired with any other nucleotide (in context type) */
+    if(!(option & VRNA_CONSTRAINT_CONTEXT_NO_REMOVE)){
+      for(j = 1; j < i; j++)
+        vc->hc->matrix[vc->jindx[i] + j] &= ~type;
+      for(j = i+1; j <= vc->length; j++)
+        vc->hc->matrix[vc->jindx[j] + i] &= ~type;
+    }
+
+    vc->hc->matrix[vc->jindx[i] + i] = (char)(  VRNA_CONSTRAINT_CONTEXT_EXT_LOOP
+                                              | VRNA_CONSTRAINT_CONTEXT_HP_LOOP
+                                              | VRNA_CONSTRAINT_CONTEXT_INT_LOOP
+                                              | VRNA_CONSTRAINT_CONTEXT_MB_LOOP);
+  }
+}
+
+PUBLIC void
+vrna_hc_add_bp_nonspecific( vrna_fold_compound_t *vc,
+                            int i,
+                            int d,
+                            char option){
+  int   p;
+  char  type, t1, t2;
+
+  if(vc)
+    if(vc->hc){
+      if((i <= 0) || (i > vc->length)){
+        vrna_message_warning("vrna_hc_add_bp_nonspecific: position out of range, not doing anything");
+        return;
+      }
+
+      /* position i may pair in provided contexts */
+      type  = option & VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS;
+      /* acknowledge pairing direction */
+      t1    = (d <= 0) ? type : (char)0;
+      t2    = (d >= 0) ? type : (char)0;
+
+      if(option & VRNA_CONSTRAINT_CONTEXT_NO_REMOVE){
+        /* only allow for possibly non-canonical pairs, do not enforce them */
+        for(p = 1; p < i; p++)
+          vc->hc->matrix[vc->jindx[i] + p] |= t1;
+        for(p = i+1; p <= vc->length; p++)
+          vc->hc->matrix[vc->jindx[p] + i] |= t2;
+      } else {
+        /* force pairing direction */
+        for(p = 1; p < i; p++)
+          vc->hc->matrix[vc->jindx[i] + p] &= t1;
+        for(p = i+1; p <= vc->length; p++)
+          vc->hc->matrix[vc->jindx[p] + i] &= t2;
+        /* nucleotide mustn't be unpaired */
+        vc->hc->matrix[vc->jindx[i] + i] = (char)0;
+      }
+
+      hc_update_up(vc);
+    }
+
+}
+
+PUBLIC void
+vrna_hc_add_bp( vrna_fold_compound_t *vc,
+                int i,
+                int j,
+                char option){
+
+  int   k, l;
+  char  type;
+
+  if(vc)
+    if(vc->hc){
+      if((i <= 0) || (j <= i) || (j > vc->length)){
+        vrna_message_warning("vrna_hc_add_bp: position out of range, not doing anything");
+        return;
+      }
+
+      /* reset ptype in case (i,j) is a non-canonical pair */
+      if(option & VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS){
+        if(vc->hc->matrix[vc->jindx[j] + i])
+          if(vc->ptype[vc->jindx[j] + i] == 0)
+            vc->ptype[vc->jindx[j] + i] = 7;
+      }
+
+      vc->hc->matrix[vc->jindx[j] + i] = option & VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS;
+
+      if(!(option & VRNA_CONSTRAINT_CONTEXT_NO_REMOVE)){
+        /*
+          remove all conflicting base pairs, i.e. do not allow i,j to pair
+          with any other nucleotide k
+        */
+        for(k = 1; k < i; k++){
+          vc->hc->matrix[vc->jindx[i] + k] = (char)0;
+          vc->hc->matrix[vc->jindx[j] + k] = (char)0;
+          for(l = i+1; l < j; l++)
+            vc->hc->matrix[vc->jindx[l] + k] = (char)0;
+        }
+        for(k = i+1; k < j; k++){
+          vc->hc->matrix[vc->jindx[k] + i] = (char)0;
+          vc->hc->matrix[vc->jindx[j] + k] = (char)0;
+          for(l = j + 1; l <= vc->length; l++)
+            vc->hc->matrix[vc->jindx[l] + k] = (char)0;
+        }
+        for(k = j+1; k <= vc->length; k++){
+          vc->hc->matrix[vc->jindx[k] + i] = (char)0;
+          vc->hc->matrix[vc->jindx[k] + j] = (char)0;
+        }
+      }
+
+      if(option & VRNA_CONSTRAINT_CONTEXT_ENFORCE){
+
+        /* do not allow i,j to be unpaired */
+        vc->hc->matrix[vc->jindx[i] + i] = (char)0;
+        vc->hc->matrix[vc->jindx[j] + j] = (char)0;
+
+        hc_update_up(vc);
+      }
+    }
+}
+
+PUBLIC void
+vrna_hc_free(vrna_hc_t *hc){
+
+  if(hc){
+    free(hc->matrix);
+    free(hc->up_ext);
+    free(hc->up_hp);
+    free(hc->up_int);
+    free(hc->up_ml);
+
+    if(hc->free_data)
+      hc->free_data(hc->data);
+
+    free(hc);
+  }
+}
+
+
+PUBLIC void
+vrna_hc_add_f(vrna_fold_compound_t *vc,
+              vrna_callback_hc_evaluate *f)
+{
+  if (vc && f) {
+    if (vc->type == VRNA_FC_TYPE_SINGLE) {
+      if (!vc->hc)
+        vrna_hc_init(vc);
+
+      vc->hc->f = f;
+    }
+  }
+}
+
+
+PUBLIC void
+vrna_hc_add_data( vrna_fold_compound_t *vc,
+                  void *data,
+                  vrna_callback_free_auxdata *f)
+{
+  if (vc && data) {
+    if (vc->type == VRNA_FC_TYPE_SINGLE) {
+      if (!vc->hc)
+        vrna_hc_init(vc);
+
+      vc->hc->data        = data;
+      vc->hc->free_data   = f;
+    }
+  }
+}
+
+
+PUBLIC  int
+vrna_hc_add_from_db(vrna_fold_compound_t *vc,
+                    const char *constraint,
+                    unsigned int options){
+
+  int         i, d, ret;
+  vrna_md_t   *md;
+
+  ret = 0; /* Failure */
+
+  if(vc){
+    if(vc->params)
+      md = &(vc->params->model_details);
+    else if(vc->exp_params)
+      md = &(vc->exp_params->model_details);
+    else
+      return ret;
+
+    if(!vc->hc)
+      vrna_hc_init(vc);
+
+    /* apply hard constraints from dot-bracket notation */
+    apply_DB_constraint(constraint,
+                        vc->hc->matrix,
+                        vc->length,
+                        md->min_loop_size,
+                        -1,
+                        options);
+    hc_update_up(vc);
+    ret = 1; /* Success */
+  }
+
+  return ret;
+}
+
+
+PRIVATE void
+apply_DB_constraint(const char *constraint,
+                    char *hc,
+                    unsigned int length,
+                    unsigned int min_loop_size,
+                    int cut,
+                    unsigned int options){
+
+  int n,i,j;
+  int hx, *stack;
+  int *index;
+  char c_option;
+
+  if(constraint == NULL) return;
+
+  n         = (int)strlen(constraint);
+  stack     = (int *) vrna_alloc(sizeof(int)*(n+1));
+  index     = vrna_idx_col_wise(length);
+  c_option  =   VRNA_CONSTRAINT_CONTEXT_EXT_LOOP
+              | VRNA_CONSTRAINT_CONTEXT_HP_LOOP
+              | VRNA_CONSTRAINT_CONTEXT_INT_LOOP
+              | VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC
+              | VRNA_CONSTRAINT_CONTEXT_MB_LOOP
+              | VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC;
+
+  for(hx=0, j=1; j<=n; j++) {
+    switch (constraint[j-1]) {
+       /* can't pair */
+       case 'x':  if(options & VRNA_CONSTRAINT_DB_X){
+                    hc_cant_pair(j, c_option, hc, length, min_loop_size, index);
+                  }
+                  break;
+
+      /* must pair, i.e. may not be unpaired */
+      case '|':   if(options & VRNA_CONSTRAINT_DB_PIPE){
+                    if(options & VRNA_CONSTRAINT_DB_ENFORCE_BP)
+                      hc_must_pair(j, c_option, hc, index);
+                  }
+                  break;
+
+      /* weak enforced pair 'open' */
+      case '(':   if(options & VRNA_CONSTRAINT_DB_RND_BRACK){
+                    stack[hx++]=j;
+                  }
+                  break;
+
+      /* weak enforced pair 'close' */
+      case ')':   if(options & VRNA_CONSTRAINT_DB_RND_BRACK){
+                    if (hx<=0) {
+                      vrna_message_error("%s\nunbalanced brackets in constraints", constraint);
+                    }
+                    i = stack[--hx];
+                    if(options & VRNA_CONSTRAINT_DB_ENFORCE_BP)
+                      hc_enforce_pair(i, j, c_option, hc, length, min_loop_size, index);
+                    else
+                      hc_weak_enforce_pair(i, j, c_option, hc, length, min_loop_size, index);
+                  }
+                  break;
+
+      /* pairs upstream */
+      case '<':   if(options & VRNA_CONSTRAINT_DB_ANG_BRACK){
+                    hc_pairs_downstream(j, c_option, hc, length, index);
+                    if(options & VRNA_CONSTRAINT_DB_ENFORCE_BP)
+                      hc_must_pair(j, c_option, hc, index);
+                  }
+                  break;
+
+      /* pairs downstream */
+      case '>':   if(options & VRNA_CONSTRAINT_DB_ANG_BRACK){
+                    hc_pairs_upstream(j, c_option, hc, length, index);
+                    if(options & VRNA_CONSTRAINT_DB_ENFORCE_BP)
+                      hc_must_pair(j, c_option, hc, index);
+                  }
+                  break;
+
+      /* only intramolecular basepairing */
+      case 'l':   if(options & VRNA_CONSTRAINT_DB_INTRAMOL){
+                    hc_intramolecular_only(j, c_option, hc, length, min_loop_size, cut, index);
+                  }
+                  break;
+
+      /* only intermolecular bp */
+      case 'e':   if(options & VRNA_CONSTRAINT_DB_INTERMOL){
+                    hc_intermolecular_only(j, c_option, hc, length, min_loop_size, cut, index);
+                  }
+                  break;
+
+      case '.':   break;
+
+      default:    vrna_message_warning("Unrecognized character '%c' in pseudo dot-bracket notation constraint string",
+                                              constraint[j-1]);
+                  break;
+    }
+  }
+
+  if (hx!=0) {
+    vrna_message_error("%s\nunbalanced brackets in constraint string", constraint);
+  }
+  /* clean up */
+  free(index);
+  free(stack);
+}
+
+PRIVATE INLINE  void
+hc_intramolecular_only( unsigned int i,
+                        char c_option,
+                        char *hc,
+                        unsigned int length,
+                        unsigned int min_loop_size,
+                        int cut,
+                        int *index){
+
+  unsigned int l;
+
+  if(cut > 1){
+    if(i < cut)
+      for(l = MAX2(i+min_loop_size, cut); l <= length; l++)
+        hc[index[l] + i] &= ~c_option;
+    else
+      for(l = 1; l < MIN2(cut, i-min_loop_size); l++)
+        hc[index[i] + l] &= ~c_option;
+  }
+}
+
+PRIVATE INLINE  void
+hc_intermolecular_only( unsigned int i,
+                        char c_option,
+                        char *hc,
+                        unsigned int length,
+                        unsigned int min_loop_size,
+                        int cut,
+                        int *index){
+
+  unsigned int l;
+
+  if(cut > 1){
+    if(i < cut){
+      for(l = 1; l < i; l++)
+        hc[index[i] + l] &= ~c_option;
+      for(l = i + 1; l < cut; l++)
+        hc[index[l] + i] &= ~c_option;
+    } else {
+      for(l = cut; l < i; l++)
+        hc[index[i] + l] &= ~c_option;
+      for(l = i + 1; l <= length; l++)
+        hc[index[l] + i] &= ~c_option;
+    }
+  }
+}
+
+PRIVATE INLINE  void
+hc_cant_pair( unsigned int i,
+              char c_option,
+              char *hc,
+              unsigned int length,
+              unsigned int min_loop_size,
+              int *index){
+
+  hc_pairs_upstream(i, c_option, hc, length, index);
+  hc_pairs_downstream(i, c_option, hc, length, index);
+}
+
+PRIVATE INLINE  void
+hc_must_pair( unsigned int i,
+              char c_option,
+              char *hc,
+              int *index){
+
+  hc[index[i]+i] &= ~c_option;
+}
+
+PRIVATE INLINE  void
+hc_pairs_upstream(unsigned int i,
+                  char c_option,
+                  char *hc,
+                  unsigned int length,
+                  int *index){
+
+  unsigned int l;
+
+  /* prohibit downstream pairs */
+  for(l = length; l > i; l--)
+    hc[index[l] + i] = (char)0;
+  /* allow upstream pairs of given type */
+  for(l = i - 1; l >= 1; l--)
+    hc[index[i] + l] &= c_option;
+}
+
+PRIVATE INLINE  void
+hc_pairs_downstream(unsigned int i,
+                    char c_option,
+                    char *hc,
+                    unsigned int length,
+                    int *index){
+
+  unsigned int l;
+  /* allow downstream pairs of given type */
+  for(l = length; l > i; l--)
+    hc[index[l] + i] &= c_option;
+  /* forbid upstream pairs */
+  for(l = i - 1; l >= 1; l--)
+    hc[index[i] + l] = (char)0;
+}
+
+PRIVATE INLINE  void
+hc_allow_pair(unsigned int i,
+              unsigned int j,
+              char c_option,
+              char *hc,
+              int *index){
+
+  hc[index[j] + i] |= c_option;
+}
+
+PRIVATE INLINE  void
+hc_weak_enforce_pair( unsigned int i,
+                      unsigned int j,
+                      char c_option,
+                      char *hc,
+                      unsigned int length,
+                      unsigned int min_loop_size,
+                      int *index){
+
+  unsigned int k, l;
+
+  /* don't allow pairs (k,i) 1 <= k < i */
+  /* don't allow pairs (i,k) i < k <= n */ 
+  hc_pairs_upstream(i, (char)0, hc, length, index);
+  /* don't allow pairs (k,j) 1 <= k < j */
+  /* don't allow pairs (j,k) j < k <= n */ 
+  hc_pairs_upstream(j, (char)0, hc, length, index);
+
+  /* don't allow pairs i < k < j < l */
+  for(k = i+1; k < j; k++)
+    for(l = j+1; l <= length; l++){
+      hc[index[l] + k] = 0;
+    }
+  /* don't allow pairs k<i<l<j */
+  for(k = 1; k < i; k++)
+    for(l = i+1; l < j; l++){
+      hc[index[l] + k] = 0;
+    }
+  /* allow base pair (i,j) */
+  hc[index[j] + i] |= c_option;
+}
+
+PRIVATE INLINE  void
+hc_enforce_pair(unsigned int i,
+                unsigned int j,
+                char c_option,
+                char *hc,
+                unsigned int length,
+                unsigned int min_loop_size,
+                int *index){
+
+  hc_weak_enforce_pair( i,
+                        j,
+                        c_option,
+                        hc,
+                        length,
+                        min_loop_size,
+                        index);
+
+  /* forbid i and j to be unpaired */
+  hc[index[i] + i] = 0;
+  hc[index[j] + j] = 0;
+}
+
+PRIVATE void
+hc_reset_to_default(vrna_fold_compound_t *vc){
+
+  unsigned int      i, j, ij, min_loop_size, n;
+  int               max_span, *idx;
+  vrna_md_t         *md;
+  vrna_hc_t         *hc;
+  short             *S;
+
+  md  = NULL;
+  n   = vc->length;
+  hc  = vc->hc;
+  idx = vc->jindx;
+  S   = vc->sequence_encoding;
+
+  if(vc->params)
+    md  = &(vc->params->model_details);
+  else if(vc->exp_params)
+    md  = &(vc->exp_params->model_details);
+  else
+    vrna_message_error("missing model_details in fold_compound");
+
+  min_loop_size = md->min_loop_size;
+  max_span      = md->max_bp_span;
+
+  if((max_span < 5) || (max_span > n))
+    max_span  = n;
+
+  /* ######################### */
+  /* fill with default values  */
+  /* ######################### */
+
+  /* 1. unpaired nucleotides are allowed in all contexts */
+  for(i = 1; i <= n; i++)
+    hc->matrix[idx[i] + i]  =   VRNA_CONSTRAINT_CONTEXT_EXT_LOOP
+                              | VRNA_CONSTRAINT_CONTEXT_HP_LOOP
+                              | VRNA_CONSTRAINT_CONTEXT_INT_LOOP
+                              | VRNA_CONSTRAINT_CONTEXT_MB_LOOP;
+
+  /* 2. all base pairs with pscore above threshold are allowed in all contexts */
+  switch(vc->type){
+    case VRNA_FC_TYPE_COMPARATIVE:  for(j = n; j > min_loop_size + 1; j--){
+                                    ij = idx[j]+1;
+                                    for(i=1; i < j - min_loop_size; i++, ij++){
+                                      char opt = (char)0;
+                                      if((j-i+1) <= max_span){
+                                        if(vc->pscore[idx[j]+i] >= md->cv_fact*MINPSCORE)
+                                          opt = VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS;
+                                      }
+                                      hc->matrix[ij] = opt;
+                                    }
+                                  }
+                                  break;
+
+    case VRNA_FC_TYPE_SINGLE:     for(j = n; j > min_loop_size + 1; j--){
+                                    ij = idx[j]+1;
+                                    for(i=1; i < j - min_loop_size; i++, ij++){
+                                      char opt = (char)0;
+                                      if((j-i+1) <= max_span){
+                                        int t = md->pair[S[i]][S[j]];
+                                        switch(t){
+                                          case 0:   break;
+                                          case 3:   /* fallthrough */
+                                          case 4:   if(md->noGU){
+                                                      break;
+                                                    } else if(md->noGUclosure){
+                                                      opt = VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS;
+                                                      opt &= ~(VRNA_CONSTRAINT_CONTEXT_HP_LOOP | VRNA_CONSTRAINT_CONTEXT_MB_LOOP);
+                                                      break;
+                                                    } /* else fallthrough */
+                                          default:  opt = VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS;
+                                                    break;
+                                        }
+                                      }
+                                      hc->matrix[ij] = opt;
+                                    }
+                                  }
+
+                                  /* correct for no lonely pairs (assuming that ptypes already incorporate noLP status) */
+                                  /* this should be fixed such that ij loses its hard constraint type if it does not
+                                     allow for enclosing an interior loop, etc.
+                                  */
+                                  /*  ???????
+                                      Is this necessary? We could leave the noLP option somewhere else, i.e. do not enforce it
+                                      on the level of ptype/constraints, but an the level of recursions...
+                                      ???????
+                                  */
+                                  if(md->noLP){
+                                    if(!vc->ptype)
+                                      vc->ptype = vrna_ptypes(vc->sequence_encoding2, md);
+                                    for(i = 1; i < n; i++)
+                                      for(j = i + min_loop_size + 1; j <= n; j++){
+                                        if(hc->matrix[idx[j] +i]){
+                                          if(!vc->ptype[idx[j] + i]){
+                                            hc->matrix[idx[j] + i] = (char)0;
+                                          }
+                                        }
+                                      }
+                                  }
+                                  break;
+
+    default:                      break;
+  }
+
+  /* should we reset the generalized hard constraint feature here? */
+  if(hc->f || hc->data){
+    if(hc->free_data)
+      hc->free_data(hc->data);
+
+    hc->f           = NULL;
+    hc->data        = NULL;
+    hc->free_data   = NULL;
+  }
+
+}
+
+PRIVATE void
+hc_update_up(vrna_fold_compound_t *vc){
+
+  unsigned int      i, n;
+  int               *idx;
+  vrna_hc_t         *hc;
+
+  n   = vc->length;
+  idx = vc->jindx;
+  hc  = vc->hc;
+
+  for(hc->up_ext[n+1] = 0, i = n; i > 0; i--) /* unpaired stretch in exterior loop */
+    hc->up_ext[i] = (hc->matrix[idx[i]+i] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) ? 1 + hc->up_ext[i+1] : 0;
+
+  for(hc->up_hp[n+1] = 0, i = n; i > 0; i--)  /* unpaired stretch in hairpin loop */
+    hc->up_hp[i] = (hc->matrix[idx[i]+i] & VRNA_CONSTRAINT_CONTEXT_HP_LOOP) ? 1 + hc->up_hp[i+1] : 0;
+
+  for(hc->up_int[n+1] = 0, i = n; i > 0; i--) /* unpaired stretch in interior loop */
+    hc->up_int[i] = (hc->matrix[idx[i]+i] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP) ? 1 + hc->up_int[i+1] : 0;
+
+  for(hc->up_ml[n+1] = 0, i = n; i > 0; i--)  /* unpaired stretch in multibranch loop */
+    hc->up_ml[i] = (hc->matrix[idx[i]+i] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP) ? 1 + hc->up_ml[i+1] : 0;
+
+  /*
+   *  loop arround once more until we find a nucleotide that mustn't
+   *  be unpaired (needed for circular folding)
+   */
+
+  if(hc->matrix[idx[1]+1] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+    hc->up_ext[n+1] = hc->up_ext[1];
+    for(i = n; i > 0; i--){
+      if(hc->matrix[idx[i]+i] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+        hc->up_ext[i] = MIN2(n, 1 + hc->up_ext[i+1]);
+      } else
+        break;
+    }
+  }
+
+  if(hc->matrix[idx[1]+1] & VRNA_CONSTRAINT_CONTEXT_HP_LOOP){
+    hc->up_hp[n+1] = hc->up_hp[1];
+    for(i = n; i > 0; i--){
+      if(hc->matrix[idx[i]+i] & VRNA_CONSTRAINT_CONTEXT_HP_LOOP){
+        hc->up_hp[i] = MIN2(n, 1 + hc->up_hp[i+1]);
+      } else
+        break;
+    }
+  }
+
+  if(hc->matrix[idx[1]+1] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){
+    hc->up_int[n+1] = hc->up_int[1];
+    for(i = n; i > 0; i--){
+      if(hc->matrix[idx[i]+i] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){
+        hc->up_int[i] = MIN2(n, 1 + hc->up_int[i+1]);
+      } else
+        break;
+    }
+  }
+
+  if(hc->matrix[idx[1]+1] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+    hc->up_ml[n+1] = hc->up_ml[1];
+    for(i = n; i > 0; i--){
+      if(hc->matrix[idx[i]+i] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+        hc->up_ml[i] = MIN2(n, 1 + hc->up_ml[i+1]);
+      } else
+        break;
+    }
+  }
+
+}
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC  void
+print_tty_constraint_full(void){
+
+  vrna_message_constraint_options_all();
+}
+
+PUBLIC  void
+print_tty_constraint(unsigned int option){
+
+  vrna_message_constraint_options(option);
+}
+
+PUBLIC void
+constrain_ptypes( const char *constraint,
+                  unsigned int length,
+                  char *ptype,
+                  int *BP,
+                  int min_loop_size,
+                  unsigned int idx_type){
+
+  int n,i,j,k,l;
+  int hx, *stack;
+  char type;
+  int *index;
+
+  if(constraint == NULL) return;
+
+  n = (int)strlen(constraint);
+
+  stack = vrna_alloc(sizeof(int)*(n+1));
+
+  if(!idx_type){ /* index allows access in energy matrices at pos (i,j) via index[j]+i */
+    index = vrna_idx_col_wise(length);
+
+    for(hx=0, j=1; j<=n; j++){
+      switch(constraint[j-1]){
+        case '|':   if(BP) BP[j] = -1;
+                    break;
+        case 'x':   /* can't pair */
+                    for (l=1; l<j-min_loop_size; l++)
+                      ptype[index[j]+l] = 0;
+                    for (l=j+min_loop_size+1; l<=(int)length; l++)
+                      ptype[index[l]+j] = 0;
+                    break;
+        case '(':   stack[hx++]=j;
+                    /* fallthrough */
+        case '<':   /* pairs upstream */
+                    for (l=1; l<j-min_loop_size; l++)
+                      ptype[index[j]+l] = 0;
+                    break;
+        case ')':   if (hx<=0) {
+                      vrna_message_error("%s\nunbalanced brackets in constraint", constraint);
+                    }
+                    i = stack[--hx];
+                    type = ptype[index[j]+i];
+                    for (k=i+1; k<=(int)length; k++)
+                      ptype[index[k]+i] = 0;
+                    /* don't allow pairs i<k<j<l */
+                    for (l=j; l<=(int)length; l++)
+                      for (k=i+1; k<=j; k++)
+                        ptype[index[l]+k] = 0;
+                    /* don't allow pairs k<i<l<j */
+                    for (l=i; l<=j; l++)
+                      for (k=1; k<=i; k++)
+                        ptype[index[l]+k] = 0;
+                    for (k=1; k<j; k++)
+                      ptype[index[j]+k] = 0;
+                    ptype[index[j]+i] = (type==0) ? 7 : type;
+                    /* fallthrough */
+        case '>':   /* pairs downstream */
+                    for (l=j+min_loop_size+1; l<=(int)length; l++)
+                      ptype[index[l]+j] = 0;
+                    break;
+      }
+    }
+  }
+  else{ /* index allows access in energy matrices at pos (i,j) via index[i]-j */
+    index = vrna_idx_row_wise(length);
+
+    for(hx=0, j=1; j<=n; j++) {
+      switch (constraint[j-1]) {
+        case 'x':   /* can't pair */
+                    for (l=1; l<j-min_loop_size; l++)
+                      ptype[index[l]-j] = 0;
+                    for (l=j+min_loop_size+1; l<=(int)length; l++)
+                      ptype[index[j]-l] = 0;
+                    break;
+        case '(':   stack[hx++]=j;
+                    /* fallthrough */
+        case '<':   /* pairs upstream */
+                    for (l=1; l<j-min_loop_size; l++)
+                      ptype[index[l]-j] = 0;
+                    break;
+        case ')':   if (hx<=0) {
+                      vrna_message_error("%s\nunbalanced brackets in constraints", constraint);
+                    }
+                    i = stack[--hx];
+                    type = ptype[index[i]-j];
+                    /* don't allow pairs i<k<j<l */
+                    for (k=i; k<=j; k++)
+                      for (l=j; l<=(int)length; l++)
+                        ptype[index[k]-l] = 0;
+                    /* don't allow pairs k<i<l<j */
+                    for (k=1; k<=i; k++)
+                      for (l=i; l<=j; l++)
+                        ptype[index[k]-l] = 0;
+                    ptype[index[i]-j] = (type==0) ? 7 : type;
+                    /* fallthrough */
+        case '>':   /* pairs downstream */
+                    for (l=j+min_loop_size+1; l<=(int)length; l++)
+                      ptype[index[j]-l] = 0;
+                    break;
+      }
+    }
+  }
+  if (hx!=0) {
+    vrna_message_error("%s\nunbalanced brackets in constraint string", constraint);
+  }
+  free(index);
+  free(stack);
+}
+
+#endif
diff --git a/C/ViennaRNA/constraints_hard.h b/C/ViennaRNA/constraints_hard.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/constraints_hard.h
@@ -0,0 +1,575 @@
+#ifndef VIENNA_RNA_PACKAGE_CONSTRAINTS_HARD_H
+#define VIENNA_RNA_PACKAGE_CONSTRAINTS_HARD_H
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file       constraints_hard.h
+ *  @ingroup    hard_constraints
+ *  @brief      Functions and data structures for handling of secondary structure hard constraints
+ */
+#include <ViennaRNA/data_structures.h>
+
+/**
+ *  @addtogroup hard_constraints
+ *
+ *  @brief  This module covers all functionality for hard constraints in secondary
+ *          structure prediction
+ */
+
+/**
+ *  @brief Typename for the hard constraints data structure #vrna_hc_s
+ *  @ingroup  hard_constraints
+ */
+typedef struct  vrna_hc_s vrna_hc_t;
+
+/**
+ *  @brief Typename for the single nucleotide hard constraint data structure #vrna_hc_up_s
+ *  @ingroup  hard_constraints
+ */
+typedef struct vrna_hc_up_s vrna_hc_up_t;
+
+/**
+ * @brief Callback to evaluate whether or not a particular decomposition step is contributing to the solution space
+ *
+ * @ingroup hard_constraints
+ *
+ * This is the prototype for callback functions used by the folding recursions to evaluate generic
+ * hard constraints. The first four parameters passed indicate the delimiting nucleotide positions
+ * of the decomposition, and the parameter @p denotes the decomposition step. The last parameter
+ * @p data is the auxiliary data structure associated to the hard constraints via vrna_hc_add_data(),
+ * or NULL if no auxiliary data was added.
+ *
+ * @see #VRNA_DECOMP_PAIR_HP, #VRNA_DECOMP_PAIR_IL, #VRNA_DECOMP_PAIR_ML, #VRNA_DECOMP_ML_ML_ML,
+ *      #VRNA_DECOMP_ML_STEM, #VRNA_DECOMP_ML_ML, #VRNA_DECOMP_ML_UP, #VRNA_DECOMP_ML_ML_STEM,
+ *      #VRNA_DECOMP_ML_COAXIAL, #VRNA_DECOMP_EXT_EXT, #VRNA_DECOMP_EXT_UP, #VRNA_DECOMP_EXT_STEM,
+ *      #VRNA_DECOMP_EXT_EXT_EXT, #VRNA_DECOMP_EXT_STEM_EXT, #VRNA_DECOMP_EXT_EXT_STEM,
+ *      #VRNA_DECOMP_EXT_EXT_STEM1, vrna_hc_add_f(), vrna_hc_add_data()
+ *
+ * @param i         Left (5') delimiter position of substructure
+ * @param j         Right (3') delimiter position of substructure
+ * @param k         Left delimiter of decomposition
+ * @param l         Right delimiter of decomposition
+ * @param d         Decomposition step indicator
+ * @param data      Auxiliary data
+ * @return          Pseudo energy contribution in deka-kalories per mol
+ */
+typedef char (vrna_callback_hc_evaluate)(int i, int j, int k, int l, char d, void *data);
+
+/**
+ *  @brief  do not print the header information line
+ *  @deprecated   This mode is not supported anymore!
+ *
+ */
+#define VRNA_CONSTRAINT_NO_HEADER         0
+
+/**
+ *  @brief  Flag for vrna_constraints_add() to indicate that constraint is passed in pseudo dot-bracket notation
+ *
+ *  @see vrna_constraints_add(), vrna_message_constraint_options(), vrna_message_constraint_options_all()
+ *
+ *  @ingroup  hard_constraints
+ *
+ */
+#define VRNA_CONSTRAINT_DB                16384U
+
+/**
+ *  @brief Switch for dot-bracket structure constraint to enforce base pairs
+ *
+ *  This flag should be used to really enforce base pairs given in dot-bracket constraint rather than
+ *  just weakly-enforcing them.
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_from_db(), vrna_constraints_add(), vrna_message_constraint_options(),
+ *        vrna_message_constraint_options_all()
+ */
+#define VRNA_CONSTRAINT_DB_ENFORCE_BP           32768U
+
+/**
+ *  @brief  Flag that is used to indicate the pipe '|' sign in pseudo dot-bracket
+ *  notation of hard constraints.
+ *
+ *  Use this definition to indicate the pipe sign '|' (paired with another base)
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_from_db(), vrna_constraints_add(), vrna_message_constraint_options(),
+ *        vrna_message_constraint_options_all()
+ */
+#define VRNA_CONSTRAINT_DB_PIPE              65536U
+
+/**
+ *  @brief  dot '.' switch for structure constraints (no constraint at all)
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_from_db(), vrna_constraints_add(), vrna_message_constraint_options(),
+ *        vrna_message_constraint_options_all()
+ */
+#define VRNA_CONSTRAINT_DB_DOT               131072U
+/**
+ *  @brief  'x' switch for structure constraint (base must not pair)
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_from_db(), vrna_constraints_add(), vrna_message_constraint_options(),
+ *        vrna_message_constraint_options_all()
+ */
+#define VRNA_CONSTRAINT_DB_X                 262144U
+/**
+ *  @brief  angle brackets '<', '>' switch for structure constraint (paired downstream/upstream)
+ *
+ *  @see  vrna_hc_add_from_db(), vrna_constraints_add(), vrna_message_constraint_options(),
+ *        vrna_message_constraint_options_all()
+ */
+#define VRNA_CONSTRAINT_DB_ANG_BRACK         524288U
+/**
+ *  @brief  round brackets '(',')' switch for structure constraint (base i pairs base j)
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_from_db(), vrna_constraints_add(), vrna_message_constraint_options(),
+ *        vrna_message_constraint_options_all()
+ */
+#define VRNA_CONSTRAINT_DB_RND_BRACK         1048576U
+
+/**
+ *  @brief  Flag that is used to indicate the character 'l' in pseudo dot-bracket
+ *  notation of hard constraints.
+ *
+ *  Use this definition to indicate the usage of 'l' character (intramolecular pairs only)
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_from_db(), vrna_constraints_add(), vrna_message_constraint_options(),
+ *        vrna_message_constraint_options_all()
+ */
+#define VRNA_CONSTRAINT_DB_INTRAMOL    2097152U
+
+/**
+ *  @brief  Flag that is used to indicate the character 'e' in pseudo dot-bracket
+ *  notation of hard constraints.
+ *
+ *  Use this definition to indicate the usage of 'e' character (intermolecular pairs only)
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_from_db(), vrna_constraints_add(), vrna_message_constraint_options(),
+ *        vrna_message_constraint_options_all()
+ */
+#define VRNA_CONSTRAINT_DB_INTERMOL    4194304U
+
+/**
+ *  @brief '+' switch for structure constraint (base is involved in a gquad)
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_from_db(), vrna_constraints_add(), vrna_message_constraint_options(),
+ *        vrna_message_constraint_options_all()
+ *
+ *  @warning  This flag is for future purposes only! No implementation recognizes it yet.
+ */
+#define VRNA_CONSTRAINT_DB_GQUAD                8388608U
+
+/**
+ *  @brief Switch for dot-bracket structure constraint with default symbols
+ *
+ *  This flag conveniently combines all possible symbols in dot-bracket notation
+ *  for hard constraints and #VRNA_CONSTRAINT_DB
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_from_db(), vrna_constraints_add(), vrna_message_constraint_options(),
+ *        vrna_message_constraint_options_all()
+ */
+#define VRNA_CONSTRAINT_DB_DEFAULT \
+    (   VRNA_CONSTRAINT_DB \
+      | VRNA_CONSTRAINT_DB_PIPE \
+      | VRNA_CONSTRAINT_DB_DOT \
+      | VRNA_CONSTRAINT_DB_X \
+      | VRNA_CONSTRAINT_DB_ANG_BRACK \
+      | VRNA_CONSTRAINT_DB_RND_BRACK \
+      | VRNA_CONSTRAINT_DB_INTRAMOL \
+      | VRNA_CONSTRAINT_DB_INTERMOL \
+      | VRNA_CONSTRAINT_DB_GQUAD \
+    )
+
+/**
+ *  @brief  Hard constraints flag, base pair in the exterior loop
+ *
+ *  @ingroup  hard_constraints
+ *
+ */
+#define VRNA_CONSTRAINT_CONTEXT_EXT_LOOP      (char)0x01
+
+/**
+ *  @brief  Hard constraints flag, base pair encloses hairpin loop
+ *
+ *  @ingroup  hard_constraints
+ *
+ */
+#define VRNA_CONSTRAINT_CONTEXT_HP_LOOP       (char)0x02
+
+/**
+ *  @brief  Hard constraints flag, base pair encloses an interior loop
+ *
+ *  @ingroup  hard_constraints
+ *
+ */
+#define VRNA_CONSTRAINT_CONTEXT_INT_LOOP      (char)0x04
+
+/**
+ *  @brief  Hard constraints flag, base pair encloses a multi branch loop
+ *
+ *  @ingroup  hard_constraints
+ *
+ */
+#define VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC  (char)0x08
+
+/**
+ *  @brief  Hard constraints flag, base pair is enclosed in an interior loop
+ *
+ *  @ingroup  hard_constraints
+ *
+ */
+#define VRNA_CONSTRAINT_CONTEXT_MB_LOOP       (char)0x10
+
+/**
+ *  @brief  Hard constraints flag, base pair is enclosed in a multi branch loop
+ *
+ *  @ingroup  hard_constraints
+ *
+ */
+#define VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC   (char)0x20
+
+/**
+ *  @brief  Hard constraint flag to indicate enforcement of constraints
+ */
+#define VRNA_CONSTRAINT_CONTEXT_ENFORCE       (char)0x40
+
+/**
+ *  @brief  Hard constraint flag to indicate not to remove base pairs that conflict with a given constraint
+ */
+#define VRNA_CONSTRAINT_CONTEXT_NO_REMOVE     (char)0x80
+
+/**
+ * @brief  Hard constraints flag, shortcut for all base pairs
+ *
+ *  @ingroup  hard_constraints
+ *
+ */
+#define VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS     (char)(   VRNA_CONSTRAINT_CONTEXT_EXT_LOOP \
+                                                      | VRNA_CONSTRAINT_CONTEXT_HP_LOOP \
+                                                      | VRNA_CONSTRAINT_CONTEXT_INT_LOOP \
+                                                      | VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC \
+                                                      | VRNA_CONSTRAINT_CONTEXT_MB_LOOP \
+                                                      | VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC)
+
+/**
+ *  @brief  The hard constraints data structure
+ *
+ *  The content of this data structure determines the decomposition pattern
+ *  used in the folding recursions. Attribute 'matrix' is used as source for
+ *  the branching pattern of the decompositions during all folding recursions.
+ *  Any entry in matrix[i,j] consists of the 6 LSB that allows one to distinguish the
+ *  following types of base pairs:
+ *  - in the exterior loop (#VRNA_CONSTRAINT_CONTEXT_EXT_LOOP)
+ *  - enclosing a hairpin (#VRNA_CONSTRAINT_CONTEXT_HP_LOOP)
+ *  - enclosing an interior loop (#VRNA_CONSTRAINT_CONTEXT_INT_LOOP)  
+ *  - enclosed by an exterior loop (#VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC)
+ *  - enclosing a multi branch loop (#VRNA_CONSTRAINT_CONTEXT_MB_LOOP)
+ *  - enclosed by a multi branch loop (#VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC)
+ *
+ *  The four linear arrays 'up_xxx' provide the number of available unpaired
+ *  nucleotides (including position i) 3' of each position in the sequence.
+ *
+ *  @see  vrna_hc_init(), vrna_hc_free(), #VRNA_CONSTRAINT_CONTEXT_EXT_LOOP,
+ *        #VRNA_CONSTRAINT_CONTEXT_HP_LOOP, #VRNA_CONSTRAINT_CONTEXT_INT_LOOP,
+ *        #VRNA_CONSTRAINT_CONTEXT_MB_LOOP, #VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC
+ *
+ *  @ingroup hard_constraints
+ */
+struct vrna_hc_s {
+  char    *matrix;  /**<  @brief  Upper triangular matrix that encodes where a
+                                  base pair or unpaired nucleotide is allowed
+                    */
+  int     *up_ext;  /**<  @brief  A linear array that holds the number of allowed
+                                  unpaired nucleotides in an exterior loop
+                    */
+  int     *up_hp;   /**<  @brief  A linear array that holds the number of allowed
+                                  unpaired nucleotides in a hairpin loop
+                    */
+  int     *up_int;  /**<  @brief  A linear array that holds the number of allowed
+                                  unpaired nucleotides in an interior loop
+                    */
+  int     *up_ml;   /**<  @brief  A linear array that holds the number of allowed
+                                  unpaired nucleotides in a multi branched loop
+                    */
+
+  vrna_callback_hc_evaluate *f; /**<  @brief  A function pointer that returns whether or
+                                              not a certain decomposition may be evaluated
+                                */
+
+  void *data;                         /**<  @brief  A pointer to some structure where the user
+                                                    may store necessary data to evaluate its
+                                                    generic hard constraint function
+                                      */
+
+  vrna_callback_free_auxdata *free_data;  /**<  @brief  A pointer to a function to free memory
+                                                        occupied by auxiliary data
+
+                                                The function this pointer is pointing to will be
+                                                called upon destruction of the #vrna_hc_s, and
+                                                provided with the vrna_hc_s.data pointer that
+                                                may hold auxiliary data. Hence, to avoid leaking
+                                                memory, the user may use this pointer to free
+                                                memory occupied by auxiliary data.
+                                          */
+};
+
+/**
+ *  @brief  A single hard constraint for a single nucleotide
+ *
+ *  @ingroup hard_constraints
+ */
+struct vrna_hc_up_s {
+  int   position; /**<  @brief The sequence position (1-based)  */
+  char  options;  /**<  @brief The hard constraint option       */
+};
+
+/**
+ *  @brief Print a help message for pseudo dot-bracket structure constraint characters to stdout.
+ *  (constraint support is specified by option parameter)
+ *
+ *  Currently available options are:\n
+ *  #VRNA_CONSTRAINT_DB_PIPE (paired with another base)\n
+ *  #VRNA_CONSTRAINT_DB_DOT (no constraint at all)\n
+ *  #VRNA_CONSTRAINT_DB_X (base must not pair)\n
+ *  #VRNA_CONSTRAINT_DB_ANG_BRACK (paired downstream/upstream)\n
+ *  #VRNA_CONSTRAINT_DB_RND_BRACK (base i pairs base j)\n
+ *
+ *  pass a collection of options as one value like this:
+ *  @verbatim vrna_message_constraints(option_1 | option_2 | option_n) @endverbatim
+ *
+ *  @ingroup  constraints
+ *
+ *  @see  vrna_message_constraint_options_all(), vrna_constraints_add(), #VRNA_CONSTRAINT_DB,
+ *        #VRNA_CONSTRAINT_DB_PIPE, #VRNA_CONSTRAINT_DB_DOT, #VRNA_CONSTRAINT_DB_X, #VRNA_CONSTRAINT_DB_ANG_BRACK,
+ *        #VRNA_CONSTRAINT_DB_RND_BRACK, #VRNA_CONSTRAINT_DB_INTERMOL, #VRNA_CONSTRAINT_DB_INTRAMOL
+ *
+ *  @param option Option switch that tells which constraint help will be printed
+ */
+void vrna_message_constraint_options(unsigned int option);
+
+/**
+ *  @brief Print structure constraint characters to stdout
+ *  (full constraint support)
+ *
+ *  @ingroup  constraints
+ *
+ *  @see  vrna_message_constraint_options(), vrna_constraints_add(), #VRNA_CONSTRAINT_DB,
+ *        #VRNA_CONSTRAINT_DB_PIPE, #VRNA_CONSTRAINT_DB_DOT, #VRNA_CONSTRAINT_DB_X, #VRNA_CONSTRAINT_DB_ANG_BRACK,
+ *        #VRNA_CONSTRAINT_DB_RND_BRACK, #VRNA_CONSTRAINT_DB_INTERMOL, #VRNA_CONSTRAINT_DB_INTRAMOL
+ */
+void vrna_message_constraint_options_all(void);
+
+/**
+ *  @brief  Initialize/Reset hard constraints to default values
+ *
+ *  This function resets the hard constraints to their default values, i.e.
+ *  all positions may be unpaired in all contexts, and base pairs are
+ *  allowed in all contexts, if they resemble canonical pairs.
+ *  Previously set hard constraints will be removed vefore initialization.
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_bp(), vrna_hc_add_bp_nonspecific(), vrna_hc_add_up()
+ *
+ *  @param  vc  The fold compound
+ */
+void vrna_hc_init(vrna_fold_compound_t *vc);
+
+/**
+ *  @brief  Make a certain nucleotide unpaired
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_bp(), vrna_hc_add_bp_nonspecific(), vrna_hc_init(),
+ *        #VRNA_CONSTRAINT_CONTEXT_EXT_LOOP, #VRNA_CONSTRAINT_CONTEXT_HP_LOOP,
+ *        #VRNA_CONSTRAINT_CONTEXT_INT_LOOP, #VRNA_CONSTRAINT_CONTEXT_MB_LOOP,
+ *        #VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS
+ *
+ *  @param  vc      The #vrna_fold_compound_t the hard constraints are associated with
+ *  @param  i       The position that needs to stay unpaired (1-based)
+ *  @param  option  The options flag indicating how/where to store the hard constraints
+ */
+void vrna_hc_add_up(vrna_fold_compound_t *vc,
+                    int i,
+                    char option);
+
+/**
+ *  @brief Apply a list of hard constraints for single nucleotides
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @param  vc          The #vrna_fold_compound_t the hard constraints are associated with
+ *  @param  constraints The list off constraints to apply, last entry must have position
+ *                      attribute set to 0
+ */
+int
+vrna_hc_add_up_batch( vrna_fold_compound_t *vc,
+                      vrna_hc_up_t *constraints);
+
+/**
+ *  @brief  Favorize/Enforce  a certain base pair (i,j)
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_bp_nonspecific(), vrna_hc_add_up(), vrna_hc_init(),
+ *        #VRNA_CONSTRAINT_CONTEXT_EXT_LOOP, #VRNA_CONSTRAINT_CONTEXT_HP_LOOP,
+ *        #VRNA_CONSTRAINT_CONTEXT_INT_LOOP, #VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC,
+ *        #VRNA_CONSTRAINT_CONTEXT_MB_LOOP, #VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC,
+ *        #VRNA_CONSTRAINT_CONTEXT_ENFORCE, #VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS
+ *
+ *  @param  vc      The #vrna_fold_compound_t the hard constraints are associated with
+ *  @param  i       The 5' located nucleotide position of the base pair (1-based)
+ *  @param  j       The 3' located nucleotide position of the base pair (1-based)
+ *  @param  option  The options flag indicating how/where to store the hard constraints
+ */
+void vrna_hc_add_bp(vrna_fold_compound_t *vc,
+                    int i,
+                    int j,
+                    char option);
+
+/**
+ *  @brief  Enforce a nucleotide to be paired (upstream/downstream)
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  vrna_hc_add_bp(), vrna_hc_add_up(), vrna_hc_init(),
+ *        #VRNA_CONSTRAINT_CONTEXT_EXT_LOOP, #VRNA_CONSTRAINT_CONTEXT_HP_LOOP,
+ *        #VRNA_CONSTRAINT_CONTEXT_INT_LOOP, #VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC,
+ *        #VRNA_CONSTRAINT_CONTEXT_MB_LOOP, #VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC,
+ *        #VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS
+ *
+ *  @param  vc      The #vrna_fold_compound_t the hard constraints are associated with
+ *  @param  i       The position that needs to stay unpaired (1-based)
+ *  @param  d       The direction of base pairing (@f$ d < 0 @f$: pairs upstream,
+ *                  @f$ d > 0 @f$: pairs downstream, @f$ d == 0 @f$: no direction)
+ *  @param  option  The options flag indicating in which loop type context the pairs may appear
+ */
+void vrna_hc_add_bp_nonspecific(vrna_fold_compound_t *vc,
+                                int i,
+                                int d,
+                                char option);
+
+/**
+ *  @brief  Free the memory allocated by a #vrna_hc_t data structure
+ *
+ *  Use this function to free all memory that was allocated for a data structure
+ *  of type #vrna_hc_t .
+ *
+ *  @see get_hard_constraints(), #vrna_hc_t
+ *
+ *  @ingroup  hard_constraints
+ *
+ */
+void vrna_hc_free(vrna_hc_t *hc);
+
+
+/**
+ *  @brief  Add a function pointer pointer for the generic hard constraint
+ *          feature
+ */
+void vrna_hc_add_f( vrna_fold_compound_t *vc,
+                    vrna_callback_hc_evaluate *f);
+
+/**
+ *  @brief Add an auxiliary data structure for the generic hard constraints callback function
+ *
+ *  @ingroup generic_hc
+ *
+ *  @see vrna_hc_add_f()
+ *
+ *  @param  vc        The fold compound the generic hard constraint function should be bound to
+ *  @param  data      A pointer to the data structure that holds required data for function 'f'
+ *  @param  free_data A pointer to a function that free's the memory occupied by @data (Maybe NULL)
+ */
+void vrna_hc_add_data(vrna_fold_compound_t *vc,
+                      void *data,
+                      vrna_callback_free_auxdata *f);
+
+
+/**
+ *  @brief Add hard constraints from pseudo dot-bracket notation
+ *
+ *  This function allows one to apply hard constraints from a pseudo dot-bracket
+ *  notation. The @p options parameter controls, which characters are recognized
+ *  by the parser. Use the #VRNA_CONSTRAINT_DB_DEFAULT convenience macro, if you
+ *  want to allow all known characters
+ *
+ *  @ingroup  hard_constraints
+ *
+ *  @see  #VRNA_CONSTRAINT_DB_PIPE, #VRNA_CONSTRAINT_DB_DOT, #VRNA_CONSTRAINT_DB_X,
+ *        #VRNA_CONSTRAINT_DB_ANG_BRACK, #VRNA_CONSTRAINT_DB_RND_BRACK, #VRNA_CONSTRAINT_DB_INTRAMOL,
+ *        #VRNA_CONSTRAINT_DB_INTERMOL, #VRNA_CONSTRAINT_DB_GQUAD
+ *
+ *  @param  vc            The fold compound
+ *  @param  constraint    A pseudo dot-bracket notation of the hard constraint.
+ *  @param  options       The option flags
+ */
+int
+vrna_hc_add_from_db(vrna_fold_compound_t *vc,
+                    const char *constraint,
+                    unsigned int options);
+
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief Print structure constraint characters to stdout.
+ *  (constraint support is specified by option parameter)
+ *
+ *  @deprecated Use vrna_message_constraints() instead!
+ *  @param option Option switch that tells which constraint help will be printed
+ */
+DEPRECATED(void print_tty_constraint(unsigned int option));
+
+/**
+ *  @brief Print structure constraint characters to stdout
+ *  (full constraint support)
+ *
+ *  @deprecated Use vrna_message_constraint_options_all() instead!
+ */
+DEPRECATED(void print_tty_constraint_full(void));
+
+/**
+ *  @brief Insert constraining pair types according to constraint structure string
+ *
+ *  @deprecated   Do not use this function anymore! Structure constraints are now handled through #vrna_hc_t and related functions.
+ *
+ *  @param constraint     The structure constraint string
+ *  @param length         The actual length of the sequence (constraint may be shorter)
+ *  @param ptype          A pointer to the basepair type array
+ *  @param BP             (not used anymore)
+ *  @param min_loop_size  The minimal loop size (usually #TURN )
+ *  @param idx_type       Define the access type for base pair type array (0 = indx, 1 = iindx)
+ */
+DEPRECATED(void constrain_ptypes(const char *constraint, unsigned int length, char *ptype, int *BP, int min_loop_size, unsigned int idx_type));
+
+#endif
+
+#endif
diff --git a/C/ViennaRNA/constraints_ligand.c b/C/ViennaRNA/constraints_ligand.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/constraints_ligand.c
@@ -0,0 +1,761 @@
+/*
+ * Reference implementation for including ligand binding to hairpins, or
+ * interior loops, with known sequence and/or structure motif, and
+ * binding free energy utilizing generic soft constraint feature
+ *
+ * (c) 2015 Ronny Lorenz - ViennaRNA Package
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/model.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/eval.h"
+#include "ViennaRNA/constraints_ligand.h"
+
+
+/*
+#################################
+# PRIVATE DATA STRUCTURES       #
+#################################
+*/
+
+typedef struct{
+  int i;
+  int j;
+  int k;
+  int l;
+} quadruple_position;
+
+typedef struct{
+  char  *seq_motif_5;
+  char  *seq_motif_3;
+  char  *struct_motif_5;
+  char  *struct_motif_3;
+  int   energy;
+  int   energy_alt;
+  int   pair_count;
+  vrna_basepair_t *pairs;
+
+  quadruple_position *positions;
+} ligand_data;
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+static void
+split_sequence( const char *string,
+                      char **seq1,
+                      char **seq2,
+                      int cp);
+
+static void
+correctMotifContribution( const char *seq,
+                          const char *struct_motif,
+                          const char *struct_motif_alt,
+                          int *contribution,
+                          int *contribution_alt,
+                          vrna_md_t *md);
+
+static void
+delete_ligand_data(void *data);
+
+static int
+AptamerContrib(int i, int j, int k, int l, char d, void *data);
+
+static int
+AptamerContribHairpin(int i, int j, int k, int l, char d, void *data);
+
+static FLT_OR_DBL
+expAptamerContrib(int i, int j, int k, int l, char d, void *data);
+
+static FLT_OR_DBL
+expAptamerContribHairpin(int i, int j, int k, int l, char d, void *data);
+
+static vrna_basepair_t *
+backtrack_int_motif(int i, int j, int k, int l, char d, void *data);
+
+static vrna_basepair_t *
+backtrack_hp_motif(int i, int j, int k, int l, char d, void *data);
+
+static quadruple_position *
+scanForMotif( const char *seq,
+              const char *motif1,
+              const char *motif2);
+
+static vrna_basepair_t *
+scanForPairs( const char  *motif5,
+              const char  *motif3,
+              int         *pair_count);
+
+static int
+vrna_sc_detect_hi_motif(vrna_fold_compound_t *vc,
+                        const char *structure,
+                        int *i,
+                        int *j,
+                        int *k,
+                        int *l);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC vrna_sc_motif_t *
+vrna_sc_ligand_detect_motifs( vrna_fold_compound_t *vc,
+                              const char *structure){
+
+  int             a, b, c, d, motif_count, motif_list_size;
+  vrna_sc_motif_t *motif_list;
+  
+  motif_list = NULL;
+  
+  if(vc && structure){
+    a               = 1;
+    motif_count     = 0;
+    motif_list_size = 10;
+
+    motif_list = (vrna_sc_motif_t *)vrna_alloc(sizeof(vrna_sc_motif_t) * motif_list_size);
+
+    while(vrna_sc_detect_hi_motif(vc, structure, &a, &b, &c, &d)){
+      if(motif_count == motif_list_size){
+        motif_list_size *= 1.2;
+        motif_list = (vrna_sc_motif_t *)vrna_realloc(motif_list, sizeof(vrna_sc_motif_t) * motif_list_size);
+      }
+
+      motif_list[motif_count].number  = 0;
+
+      if(c != 0){ /* interior loop motif */
+        motif_list[motif_count].i = a;
+        motif_list[motif_count].j = b;
+        motif_list[motif_count].k = c;
+        motif_list[motif_count].l = d;
+        a = c;
+      } else { /* hairpin loop motif */
+        motif_list[motif_count].i = a;
+        motif_list[motif_count].j = b;
+        motif_list[motif_count].k = a;
+        motif_list[motif_count].l = b;
+        a = b;
+      }
+      motif_count++;
+    }
+
+    motif_list = (vrna_sc_motif_t *)vrna_realloc(motif_list, sizeof(vrna_sc_motif_t) * (motif_count + 1));
+    motif_list[motif_count].i       = 0;
+    motif_list[motif_count].j       = 0;
+    motif_list[motif_count].k       = 0;
+    motif_list[motif_count].l       = 0;
+  }
+
+  return motif_list;
+}
+
+PRIVATE int
+vrna_sc_detect_hi_motif(vrna_fold_compound_t *vc,
+                        const char *structure,
+                        int *i,
+                        int *j,
+                        int *k,
+                        int *l){
+
+  int p, q, n;
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+
+  if(vc && vc->sc && vc->sc->data){
+    n = vc->length;
+    ldata = (ligand_data *)vc->sc->data;
+
+    for(p = *i; p < n; p++){
+      for(pos = ldata->positions; pos->i; pos++){
+        if(pos->i == p){
+          /* check whether we find the motif in the provided structure */
+          int i_m, j_m, k_m, l_m;
+          i_m = pos->i;
+          j_m = pos->j;
+          k_m = pos->k;
+          l_m = pos->l;
+          for(q = 0; q < strlen(ldata->struct_motif_5); q++){
+            if(ldata->struct_motif_5[q] != structure[i_m+q-1])
+              break;
+          }
+          if(q == strlen(ldata->struct_motif_5)){ /* 5' motif detected */
+            if(k_m > 0){
+              for(q = 0; q < strlen(ldata->struct_motif_3); q++){
+                if(ldata->struct_motif_3[q] != structure[l_m+q-1])
+                  break;
+              }
+              if(q == strlen(ldata->struct_motif_3)){ /* 3' motif detected */
+                *i = i_m;
+                *j = j_m;
+                *k = k_m;
+                *l = l_m;
+                return 1;
+              }
+            } else {
+                *i = i_m;
+                *j = j_m;
+                *k = k_m;
+                *l = l_m;
+                return 1;
+            }
+          }
+        }
+      }
+    }
+      
+  }
+  return 0;
+}
+
+PUBLIC int
+vrna_sc_get_hi_motif( vrna_fold_compound_t *vc,
+                      int *i,
+                      int *j,
+                      int *k,
+                      int *l){
+
+  int p, n;
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+
+  if(vc && vc->sc && vc->sc->data){
+    n = vc->length;
+    ldata = (ligand_data *)vc->sc->data;
+
+    for(p = *i; p < n; p++){
+      for(pos = ldata->positions; pos->i; pos++){
+        if(pos->i == p){
+          *i = pos->i;
+          *j = pos->j;
+          *k = pos->k;
+          *l = pos->l;
+          return 1;
+        }
+      }
+    }
+  }
+  return 0;
+}
+
+PUBLIC int
+vrna_sc_add_hi_motif( vrna_fold_compound_t *vc,
+                      const char *seq,
+                      const char *structure,
+                      FLT_OR_DBL energy,
+                      unsigned int options){
+
+    int                   i, cp, cp2;
+    char                  *sequence, *motif, *motif_alt;
+    vrna_md_t             *md_p;
+    ligand_data           *ldata;
+
+    sequence              = NULL;
+    motif                 = NULL;
+    motif_alt             = NULL;
+    ldata                 = NULL;
+    md_p                  = NULL;
+
+    sequence  = vrna_cut_point_remove(seq, &cp);                /* ligand sequence motif  */
+    motif     = vrna_cut_point_remove(structure, &cp2);         /* ligand structure motif */
+
+    /* check for obvious inconsistencies in input sequence/structure motif */
+    if(cp != cp2){
+      vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: Cutpoint in sequence and structure motif differ!");
+      goto hi_motif_error;
+    } else if(strlen(seq) != strlen(structure)){
+      vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: length of sequence and structure motif differ!");
+      goto hi_motif_error;
+    }
+
+    /* create auxiliary soft constraints data structure */
+    ldata                 = vrna_alloc(sizeof(ligand_data));
+    ldata->seq_motif_5    = NULL;
+    ldata->seq_motif_3    = NULL;
+    ldata->struct_motif_5 = NULL;
+    ldata->struct_motif_3 = NULL;
+    ldata->positions      = NULL;
+    ldata->energy         = (int)(energy * 100.);
+
+    split_sequence(sequence, &(ldata->seq_motif_5), &(ldata->seq_motif_3), cp);
+    split_sequence(motif, &(ldata->struct_motif_5), &(ldata->struct_motif_3), cp);
+
+    motif_alt = vrna_alloc(sizeof(char) * (strlen(motif) + 1)); /* alternative structure motif */
+    memset(motif_alt, '.', strlen(motif) - 1);
+
+    if(cp > 0){
+      if((motif[0] != '(') || (motif[strlen(motif) - 1] != ')') || (motif[cp-2] != '(') || (motif[cp-1] != ')')){
+        vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: No closing and/or enclosed pair in interior loop motif!");
+        goto hi_motif_error;
+      }
+      /* construct corresponding alternative interior loop motif (....(&)...) */
+      motif_alt[0] = '(';
+      motif_alt[cp-2] = '(';
+      motif_alt[cp-1] = ')';
+      motif_alt[strlen(motif) - 1] = ')';
+      motif_alt[strlen(motif)] = '\0';
+
+      vrna_sc_add_bt(vc, &backtrack_int_motif);
+      vrna_sc_add_f(vc, &AptamerContrib);
+      vrna_sc_add_exp_f(vc, &expAptamerContrib);
+
+    } else {
+      if((motif[0] != '(') || (motif[strlen(motif) - 1] != ')')){
+        vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: No closing pair in hairpin motif!");
+        goto hi_motif_error;
+      }
+
+      /* construct corresponding alternative hairpin motif (....) */
+      motif_alt[0] = '(';
+      motif_alt[strlen(motif) - 1] = ')';
+      motif_alt[strlen(motif)] = '\0';
+
+      vrna_sc_add_bt(vc, &backtrack_hp_motif);
+      vrna_sc_add_f(vc, &AptamerContribHairpin);
+      vrna_sc_add_exp_f(vc, &expAptamerContribHairpin);
+    }
+
+    /* correct motif contributions */
+    if(vc->params)
+      md_p = &(vc->params->model_details);
+    else
+      md_p = &(vc->exp_params->model_details);
+
+    correctMotifContribution(seq, motif, motif_alt, &(ldata->energy), &(ldata->energy_alt), md_p);
+
+    /* scan for sequence motif positions */
+    ldata->positions = scanForMotif(vc->sequence, ldata->seq_motif_5, ldata->seq_motif_3);
+
+    /* scan for additional base pairs in the structure motif */
+    int pair_count = 0;
+    vrna_basepair_t *pairs = scanForPairs(ldata->struct_motif_5, ldata->struct_motif_3, &pair_count);
+    if((pair_count > 0) && (pairs == NULL)){ /* error while parsing structure motif */
+      vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: Error while parsing additional pairs in structure motif");
+      goto hi_motif_error;
+    }
+
+    ldata->pairs      = pairs;
+    ldata->pair_count = pair_count;
+
+    /* add generalized soft-constraint data structure and corresponding 'delete' function */
+    vrna_sc_add_data(vc, (void *)ldata, &delete_ligand_data);
+
+    free(sequence);
+    free(motif);
+    free(motif_alt);
+
+    return 1; /* success */
+
+/* exit with error */
+hi_motif_error:
+
+    free(sequence);
+    free(motif);
+    free(motif_alt);
+    delete_ligand_data(ldata);
+
+    return 0;
+}
+
+static void
+split_sequence( const char *string,
+                      char **seq1,
+                      char **seq2,
+                      int cp){
+
+  int l = (int)strlen(string);
+  *seq1 = NULL;
+  *seq2 = NULL;
+
+  if(cp > 0){
+    if(cp < l){
+      *seq1 = vrna_alloc(sizeof(char) * cp);
+      strncpy(*seq1, string, cp - 1);
+      (*seq1)[cp - 1] = '\0';
+      *seq2 = vrna_alloc(sizeof(char) * (l - cp + 2));
+      strncpy(*seq2, string + cp - 1, (l - cp + 1));
+      (*seq2)[l - cp + 1] = '\0';
+    }
+  } else {
+    *seq1 = vrna_alloc(sizeof(char) * (l+1));
+    strncpy(*seq1, string, l);
+    (*seq1)[l] = '\0';
+  }
+}
+
+static void
+correctMotifContribution( const char *seq,
+                          const char *struct_motif,
+                          const char *struct_motif_alt,
+                          int *contribution,
+                          int *contribution_alt,
+                          vrna_md_t *md){
+
+  float                 alt, corr, energy;
+  vrna_fold_compound_t  *tmp_vc;
+
+  tmp_vc  = vrna_fold_compound(seq, md, VRNA_OPTION_EVAL_ONLY);
+  alt     = vrna_eval_structure(tmp_vc, struct_motif_alt);
+  corr    = vrna_eval_structure(tmp_vc, struct_motif);
+  energy  = corr - alt;
+
+  *contribution     += (int)(energy * 100.);
+  *contribution_alt  = (int)(alt    * 100.);
+
+  vrna_fold_compound_free(tmp_vc);
+}
+
+static void
+delete_ligand_data(void *data){
+
+  ligand_data *ldata = (ligand_data *)data;
+
+  free(ldata->seq_motif_5);
+  free(ldata->seq_motif_3);
+  free(ldata->struct_motif_5);
+  free(ldata->struct_motif_3);
+  free(ldata->positions);
+  free(ldata->pairs);
+
+  free(data);
+}
+
+static int
+AptamerContrib(int i, int j, int k, int l, char d, void *data){
+
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+
+  if(d == VRNA_DECOMP_PAIR_IL){
+    ldata = (ligand_data *)data;
+    for(pos = ((ligand_data *)data)->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j) && (pos->k == k) && (pos->l == l)){
+        return ldata->energy;
+      }
+    }
+  }
+
+  return 0;
+}
+
+static int
+AptamerContribHairpin(int i, int j, int k, int l, char d, void *data){
+
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+
+  if(d == VRNA_DECOMP_PAIR_HP){
+    ldata = (ligand_data *)data;
+    for(pos = ((ligand_data *)data)->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j)){
+        return ldata->energy;
+      }
+    }
+  }
+
+  return 0;
+}
+
+static FLT_OR_DBL
+expAptamerContrib(int i, int j, int k, int l, char d, void *data){
+
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+  FLT_OR_DBL          exp_e;
+  double              kT;
+
+  exp_e = 1.;
+
+  if(d == VRNA_DECOMP_PAIR_IL){
+    ldata = (ligand_data *)data;
+    kT    = (37. + K0) * GASCONST;
+
+    for(pos = ldata->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j) && (pos->k == k) && (pos->l == l)){
+        exp_e =   (FLT_OR_DBL)exp((double) (-ldata->energy) * 10./kT);
+        exp_e +=  (FLT_OR_DBL)exp((double) (-ldata->energy_alt) * 10./kT); /* add alternative, i.e. unbound ligand */
+        break;
+      }
+    }
+  }
+
+  return exp_e;
+}
+
+static FLT_OR_DBL
+expAptamerContribHairpin(int i, int j, int k, int l, char d, void *data){
+
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+  FLT_OR_DBL          exp_e;
+  double              kT;
+
+  exp_e = 1.;
+
+  if(d == VRNA_DECOMP_PAIR_HP){
+    ldata = (ligand_data *)data;
+    kT    = (37. + K0) * GASCONST;
+
+    for(pos = ldata->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j)){
+        exp_e =   (FLT_OR_DBL)exp((double) (-ldata->energy) * 10./kT);
+        exp_e +=  (FLT_OR_DBL)exp((double) (-ldata->energy_alt) * 10./kT); /* add alternative, i.e. unbound ligand */
+        break;
+      }
+    }
+  }
+
+  return exp_e;
+}
+
+static vrna_basepair_t *
+backtrack_int_motif(int i, int j, int k, int l, char d, void *data){
+
+  int                 bp_size = 15;
+  vrna_basepair_t     *pairs = NULL;
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+
+  if(d == VRNA_DECOMP_PAIR_IL){
+    ldata = (ligand_data *)data;
+    for(pos = ldata->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j) && (pos->k == k) && (pos->l == l)){
+        /* found motif in our list, lets create pairs */
+        char  *ptr;
+#if 0
+        int   actual_size = 0;
+        pairs = vrna_alloc(sizeof(vrna_basepair_t) * bp_size);
+
+        for(ptr=ldata->struct_motif_5; *ptr != '\0'; ptr++, i++){
+          if(*ptr == '.'){
+            pairs[actual_size].i = pairs[actual_size].j = i;
+            actual_size++;
+            if(actual_size == bp_size){
+              bp_size *= 2;
+              pairs = vrna_realloc(pairs, sizeof(vrna_basepair_t) * bp_size);
+            }
+          }
+        }
+        for(ptr=ldata->struct_motif_3; *ptr != '\0'; ptr++, l++){
+          if(*ptr == '.'){
+            pairs[actual_size].i = pairs[actual_size].j = l;
+            actual_size++;
+            if(actual_size == bp_size){
+              bp_size *= 2;
+              pairs = vrna_realloc(pairs, sizeof(vrna_basepair_t) * bp_size);
+            }
+          }
+        }
+        pairs = vrna_realloc(pairs, sizeof(vrna_basepair_t) * (actual_size + 1));
+        pairs[actual_size].i = pairs[actual_size].j = -1;
+#else
+        pairs = vrna_alloc(sizeof(vrna_basepair_t) * (ldata->pair_count + 1));
+        vrna_basepair_t *pptr;
+        int             count;
+        for(count = 0,pptr = ldata->pairs; pptr && (pptr->i != 0); pptr++, count++){
+          pairs[count].i = (pptr->i < 0) ? j + pptr->i : i + pptr->i - 1;
+          pairs[count].j = (pptr->j < 0) ? j + pptr->j : i + pptr->j - 1;
+        }
+        pairs[count].i = pairs[count].j = 0;
+#endif
+
+        return pairs;
+      }
+    }
+  }
+
+  return pairs;
+}
+
+static vrna_basepair_t *
+backtrack_hp_motif(int i, int j, int k, int l, char d, void *data){
+
+  int                 count;
+  vrna_basepair_t     *pairs = NULL;
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+  vrna_basepair_t     *pptr;
+
+  if(d == VRNA_DECOMP_PAIR_HP){
+    ldata = (ligand_data *)data;
+    for(pos = ldata->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j)){
+        /* found motif in our list, lets create pairs */
+        pairs = vrna_alloc(sizeof(vrna_basepair_t) * (ldata->pair_count + 1));
+        for(count = 0,pptr = ldata->pairs; pptr && (pptr->i != 0); pptr++, count++){
+          pairs[count].i = i + pptr->i - 1;
+          pairs[count].j = i + pptr->j - 1;
+        }
+        pairs[count].i = pairs[count].j = 0;
+        return pairs;
+      }
+    }
+  }
+
+  return pairs;
+}
+
+static quadruple_position *
+scanForMotif( const char *seq,
+              const char *motif1,
+              const char *motif2){
+
+  int   i, j, k, l, l1, l2, n, cnt, cnt2;
+  char  *ptr;
+  quadruple_position *pos;
+  
+  n     = (int) strlen(seq);
+  l1    = (int) strlen(motif1);
+  l2    = (motif2) ? (int) strlen(motif2) : 0;
+  cnt   = 0;
+  cnt2  = 5; /* initial guess how many matching motifs we might encounter */
+
+  pos = (quadruple_position *)vrna_alloc(sizeof(quadruple_position) * cnt2);
+
+  for(i = 0; i <= n - l1 - l2; i++){
+    if(seq[i] == motif1[0]){
+      for(j = i+1; j < i + l1; j++){
+        if(seq[j] == motif1[j-i]){
+          continue;
+        }
+        else goto next_i;
+      }
+      /* found 5' motif */
+      if(motif2){
+        for(k = j + 1; k <= n - l2; k++){
+          if(seq[k] == motif2[0]){
+            for(l = k + 1; l < k + l2; l++){
+              if(seq[l] == motif2[l-k]){
+                continue;
+              }
+              else goto next_k;
+            }
+            /* we found a quadruple, so store it */
+            pos[cnt].i   = i + 1;
+            pos[cnt].j   = l;
+            pos[cnt].k   = j;
+            pos[cnt++].l = k + 1;
+
+            /* allocate more memory if necessary */
+            if(cnt == cnt2){
+              cnt2 *= 2;
+              pos = (quadruple_position *)vrna_realloc(pos, sizeof(quadruple_position) * cnt2);
+            }
+          }
+/* early exit from l loop */
+next_k: continue;
+        }
+      } else { /* hairpin loop motif */
+        /* store it */
+        pos[cnt].i   = i + 1;
+        pos[cnt].j   = j;
+        pos[cnt].k   = 0;
+        pos[cnt++].l = 0;
+
+        /* allocate more memory if necessary */
+        if(cnt == cnt2){
+          cnt2 *= 2;
+          pos = (quadruple_position *)vrna_realloc(pos, sizeof(quadruple_position) * cnt2);
+        }
+      }
+    }
+/* early exit from j loop */
+next_i: continue;
+  }
+
+  /* reallocate to actual size */
+  pos = (quadruple_position *)vrna_realloc(pos, sizeof(quadruple_position) * (cnt + 1));
+
+  /* set end marker */
+  pos[cnt].i = pos[cnt].j = pos[cnt].k = pos[cnt].l = 0;
+
+  return pos;
+}
+
+static vrna_basepair_t *
+scanForPairs( const char  *motif5,
+              const char  *motif3,
+              int         *pair_count){
+
+  int             i, l5, l3, stack_size, stack_count, *stack;
+  vrna_basepair_t *pairs;
+
+  l5          = (motif5) ? strlen(motif5) : 0;
+  l3          = (motif3) ? strlen(motif3) : 0;
+  stack_count = 0;
+  stack_size  = l5 + l3 + 1;
+  *pair_count = 0;
+  stack       = vrna_alloc(sizeof(int)              * stack_size);
+  pairs       = vrna_alloc(sizeof(vrna_basepair_t)  * stack_size);
+
+  /* go through 5' side of structure motif */
+  for(i = 2; i < l5; i++){
+    if(motif5[i - 1] == '('){
+      stack[stack_count++] = i;
+    } else if(motif5[i - 1] == ')'){
+      pairs[*pair_count].i = stack[--stack_count];
+      pairs[*pair_count].j = i;
+      /* printf("5' p[%d, %d]\n", pairs[*pair_count].i, pairs[*pair_count].j); */
+      (*pair_count)++;
+      if(stack_count < 0){
+        vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: 5' structure motif contains unbalanced brackets");
+        free(stack);
+        free(pairs);
+        return NULL;
+      }
+    }
+  }
+
+  if(motif3){
+    for(i = 2; i < l3; i++){ /* go through 3' side of motif */
+      if(motif3[i-1] == '('){
+        stack[stack_count++] = -(l3 - i);
+      } else if(motif3[i-1] == ')'){
+        pairs[*pair_count].i = stack[--stack_count];
+        pairs[*pair_count].j = -(l3 - i);
+        /* printf("3' p[%d, %d]\n", pairs[*pair_count].i, pairs[*pair_count].j); */
+        (*pair_count)++;
+        if(stack_count < 0){
+          vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: 3' structure motif contains unbalanced brackets");
+          free(stack);
+          free(pairs);
+          return NULL;
+        }
+      }
+    }
+  }
+
+  if(stack_count != 0){
+    vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: structure motif contains unbalanced brackets");
+    (*pair_count)++;
+    free(stack);
+    free(pairs);
+    return NULL;
+  }
+
+  if(*pair_count > 0){
+    pairs = vrna_realloc(pairs, sizeof(vrna_basepair_t) * (*pair_count + 1));
+    pairs[*pair_count].i = pairs[*pair_count].j = 0;
+  } else {
+    free(pairs);
+    pairs = NULL;
+  }
+
+  free(stack);
+
+  return pairs;
+}
+
diff --git a/C/ViennaRNA/constraints_ligand.h b/C/ViennaRNA/constraints_ligand.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/constraints_ligand.h
@@ -0,0 +1,53 @@
+#ifndef VIENNA_RNA_PACKAGE_LIGAND_H
+#define VIENNA_RNA_PACKAGE_LIGAND_H
+
+/**
+ *  @file     constraints_ligand.h
+ *  @ingroup  ligand_binding
+ *  @brief    Functions for incorporation of ligands binding to hairpin and interior loop motifs using the soft constraints framework
+ */
+typedef struct vrna_sc_motif_s  vrna_sc_motif_t;
+
+#include <ViennaRNA/data_structures.h>
+
+struct vrna_sc_motif_s {
+  int i;
+  int j;
+  int k;
+  int l;
+  int number;
+};
+
+
+/**
+ *  @brief  Add soft constraints for hairpin or interior loop binding motif
+ *
+ *  @ingroup  constraints_ligand
+ *
+ *  @param  vc        The #vrna_fold_compound_t the motif is applied to
+ *  @param  seq       The sequence motif (may be interspaced by '&' character
+ *  @param  structure The structure motif (may be interspaced by '&' character
+ *  @param  energy    The free energy of the motif (e.g. binding free energy)
+ *  @param  options   Options
+ *  @return           non-zero value if application of the motif using soft constraints was successful
+ *  
+ */
+int
+vrna_sc_add_hi_motif( vrna_fold_compound_t *vc,
+                      const char *seq,
+                      const char *structure,
+                      FLT_OR_DBL energy,
+                      unsigned int options);
+
+vrna_sc_motif_t *
+vrna_sc_ligand_detect_motifs( vrna_fold_compound_t *vc,
+                              const char *structure);
+
+int
+vrna_sc_get_hi_motif( vrna_fold_compound_t *vc,
+                      int *i,
+                      int *j,
+                      int *k,
+                      int *l);
+
+#endif
diff --git a/C/ViennaRNA/constraints_soft.c b/C/ViennaRNA/constraints_soft.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/constraints_soft.c
@@ -0,0 +1,520 @@
+/* constraints handling */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <assert.h>
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/energy_const.h" /* defines MINPSCORE */
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/aln_util.h"
+#include "ViennaRNA/file_formats.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/constraints_soft.h"
+
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE void
+sc_add_up(vrna_fold_compound_t *vc,
+          const FLT_OR_DBL *constraints);
+
+PRIVATE void
+sc_add_bp(vrna_fold_compound_t *vc,
+          const FLT_OR_DBL **constraints);
+
+PRIVATE void
+sc_really_add_up( vrna_fold_compound_t *vc,
+                  int i,
+                  FLT_OR_DBL energy);
+
+PRIVATE void
+sc_really_add_bp( vrna_fold_compound_t *vc,
+                  int i,
+                  int j,
+                  FLT_OR_DBL energy);
+
+PRIVATE void
+prepare_Boltzmann_weights_up( vrna_fold_compound_t *vc);
+
+PRIVATE void
+prepare_Boltzmann_weights_bp(vrna_fold_compound_t *vc);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC void
+vrna_sc_init(vrna_fold_compound_t *vc){
+
+  unsigned int s;
+  vrna_sc_t    *sc;
+
+  if(vc){
+    vrna_sc_remove(vc);
+
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     sc                    = (vrna_sc_t *)vrna_alloc(sizeof(vrna_sc_t));
+                                    sc->energy_up         = NULL;
+                                    sc->energy_bp         = NULL;
+                                    sc->energy_stack      = NULL;
+                                    sc->exp_energy_stack  = NULL;
+                                    sc->exp_energy_up     = NULL;
+                                    sc->exp_energy_bp     = NULL;
+                                    sc->f                 = NULL;
+                                    sc->exp_f             = NULL;
+                                    sc->data              = NULL;
+                                    sc->free_data         = NULL;
+
+                                    vc->sc  = sc;
+                                    break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:  vc->scs = (vrna_sc_t **)vrna_alloc(sizeof(vrna_sc_t*) * (vc->n_seq + 1));
+                                    for(s = 0; s < vc->n_seq; s++){
+                                      sc                    = (vrna_sc_t *)vrna_alloc(sizeof(vrna_sc_t));
+                                      sc->energy_up         = NULL;
+                                      sc->energy_bp         = NULL;
+                                      sc->energy_stack      = NULL;
+                                      sc->exp_energy_stack  = NULL;
+                                      sc->exp_energy_up     = NULL;
+                                      sc->exp_energy_bp     = NULL;
+                                      sc->f                 = NULL;
+                                      sc->exp_f             = NULL;
+                                      sc->data              = NULL;
+                                      sc->free_data         = NULL;
+
+                                      vc->scs[s]  = sc;
+                                    }
+                                    break;
+      default:                      /* do nothing */
+                                    break;
+    }
+  }
+}
+
+PUBLIC void
+vrna_sc_remove(vrna_fold_compound_t *vc){
+
+  int s;
+
+  if(vc){
+    switch(vc->type){
+      case  VRNA_FC_TYPE_SINGLE:    vrna_sc_free(vc->sc);
+                                    vc->sc = NULL;
+                                    break;
+      case  VRNA_FC_TYPE_COMPARATIVE: if(vc->scs){
+                                      for(s = 0; s < vc->n_seq; s++)
+                                        vrna_sc_free(vc->scs[s]);
+                                      free(vc->scs);
+                                    }
+                                    vc->scs = NULL;
+                                    break;
+      default:                      /* do nothing */
+                                    break;
+    }
+  }
+}
+
+PUBLIC void
+vrna_sc_free(vrna_sc_t *sc){
+
+  int i;
+  if(sc){
+    if(sc->energy_up){
+      for(i = 0; sc->energy_up[i]; free(sc->energy_up[i++]));
+      free(sc->energy_up);
+    }
+    if(sc->exp_energy_up){
+      for(i = 0; sc->exp_energy_up[i]; free(sc->exp_energy_up[i++]));
+      free(sc->exp_energy_up);
+    }
+    
+    free(sc->energy_bp);
+    free(sc->exp_energy_bp);
+    free(sc->energy_stack);
+    free(sc->exp_energy_stack);
+
+    if(sc->free_data)
+      sc->free_data(sc->data);
+
+    free(sc);
+  }
+}
+
+PUBLIC void
+vrna_sc_set_bp( vrna_fold_compound_t *vc,
+                const FLT_OR_DBL **constraints,
+                unsigned int options){
+
+  if(vc && (vc->type == VRNA_FC_TYPE_SINGLE)){
+    if(constraints){
+      /* always add (pure) soft constraints */
+      sc_add_bp(vc, constraints);
+    }
+
+    if(options & VRNA_OPTION_PF) /* prepare Boltzmann factors for the BP soft constraints */
+      prepare_Boltzmann_weights_bp(vc);
+  }
+}
+
+PUBLIC void
+vrna_sc_add_bp(vrna_fold_compound_t *vc,
+                      int i,
+                      int j,
+                      FLT_OR_DBL energy,
+                      unsigned int options){
+
+  if(vc && (vc->type == VRNA_FC_TYPE_SINGLE)){
+    sc_really_add_bp(vc, i, j, energy);
+
+    if(options & VRNA_OPTION_PF) /* prepare Boltzmann factors for the BP soft constraints */
+      prepare_Boltzmann_weights_bp(vc);
+  }
+}
+
+PUBLIC void
+vrna_sc_set_up( vrna_fold_compound_t *vc,
+                const FLT_OR_DBL *constraints,
+                unsigned int options){
+
+  if(vc && (vc->type == VRNA_FC_TYPE_SINGLE)){
+    if(constraints){
+      /* always add (pure) soft constraints */
+      sc_add_up(vc, constraints);
+    }
+
+    if(options & VRNA_OPTION_PF)
+      prepare_Boltzmann_weights_up(vc);
+  }
+}
+
+PUBLIC void
+vrna_sc_add_up(vrna_fold_compound_t *vc,
+                      int i,
+                      FLT_OR_DBL energy,
+                      unsigned int options){
+
+  if(vc && (vc->type == VRNA_FC_TYPE_SINGLE)){
+    if((i < 1) || (i > vc->length)){
+      vrna_message_warning( "vrna_sc_add_up(): Nucleotide position %d out of range!"
+                            " (Sequence length: %d)",
+                            i, vc->length);
+    } else {
+      sc_really_add_up(vc, i, energy);
+
+      if(options & VRNA_OPTION_PF)
+        prepare_Boltzmann_weights_up(vc);
+    }
+  }
+}
+
+PUBLIC void
+vrna_sc_add_data( vrna_fold_compound_t *vc,
+                  void *data,
+                  vrna_callback_free_auxdata *free_data){
+
+  if(vc){
+    if(vc->type == VRNA_FC_TYPE_SINGLE){
+      if(!vc->sc)
+        vrna_sc_init(vc);
+
+      vc->sc->data        = data;
+      vc->sc->free_data   = free_data;
+    }
+  }
+}
+
+PUBLIC void
+vrna_sc_add_f(vrna_fold_compound_t *vc,
+              vrna_callback_sc_energy *f){
+
+  if(vc && f){
+    if(vc->type == VRNA_FC_TYPE_SINGLE){
+      if(!vc->sc)
+        vrna_sc_init(vc);
+
+      vc->sc->f       = f;
+    }
+  }
+}
+
+PUBLIC void
+vrna_sc_add_bt( vrna_fold_compound_t *vc,
+                vrna_callback_sc_backtrack *f){
+
+  if(vc && f){
+    if(vc->type == VRNA_FC_TYPE_SINGLE){
+      if(!vc->sc)
+        vrna_sc_init(vc);
+
+      vc->sc->bt      = f;
+    }
+  }
+}
+
+PUBLIC void
+vrna_sc_add_exp_f(vrna_fold_compound_t *vc,
+                  vrna_callback_sc_exp_energy *exp_f){
+
+  if(vc && exp_f){
+    if(vc->type == VRNA_FC_TYPE_SINGLE){
+      if(!vc->sc)
+        vrna_sc_init(vc);
+
+      vc->sc->exp_f   = exp_f;
+    }
+  }
+}
+
+PRIVATE void
+sc_add_bp(vrna_fold_compound_t *vc,
+          const FLT_OR_DBL **constraints){
+
+  unsigned int  i, j, n;
+  vrna_sc_t     *sc;
+  int           *idx;
+
+  n   = vc->length;
+
+  if(!vc->sc)
+    vrna_sc_init(vc);
+
+  sc              = vc->sc;
+
+  if(sc->energy_bp)
+    free(sc->energy_bp);
+
+  sc->energy_bp = (int *)vrna_alloc(sizeof(int) * (((n + 1) * (n + 2)) / 2));
+
+  idx = vc->jindx;
+  for(i = 1; i < n; i++)
+    for(j=i+1; j<=n; j++)
+      sc->energy_bp[idx[j]+i] = (int)roundf(constraints[i][j] * 100.);
+
+}
+
+PRIVATE void
+sc_really_add_bp( vrna_fold_compound_t *vc,
+                  int i,
+                  int j,
+                  FLT_OR_DBL energy){
+
+  unsigned int  n;
+  vrna_sc_t     *sc;
+  int           *idx;
+
+  n   = vc->length;
+
+  if(!vc->sc)
+    vrna_sc_init(vc);
+
+  sc              = vc->sc;
+
+  if(!sc->energy_bp)
+    sc->energy_bp = (int *)vrna_alloc(sizeof(int) * (((n + 1) * (n + 2)) / 2));
+
+  idx = vc->jindx;
+  sc->energy_bp[idx[j]+i] += (int)roundf(energy * 100.);
+}
+
+
+PRIVATE void
+sc_add_up(vrna_fold_compound_t *vc,
+          const FLT_OR_DBL *constraints){
+
+  unsigned int  i, j, n;
+  vrna_sc_t     *sc;
+
+  if(vc && constraints){
+    n   = vc->length;
+
+    if(!vc->sc)
+      vrna_sc_init(vc);
+
+    sc  = vc->sc;
+    /*  allocate memory such that we can access the soft constraint
+        energies of a subsequence of length j starting at position i
+        via sc->energy_up[i][j]
+    */
+    if(sc->energy_up){
+      for(i = 0; i <= n; i++)
+        if(sc->energy_up[i])
+          free(sc->energy_up[i]);
+      free(sc->energy_up);
+    }
+
+    sc->energy_up = (int **)vrna_alloc(sizeof(int *) * (n + 2));
+    for(i = 0; i <= n; i++)
+      sc->energy_up[i] = (int *)vrna_alloc(sizeof(int) * (n - i + 2));
+
+    sc->energy_up[n+1] = NULL;
+
+    for(i = 1; i <= n; i++){
+      for(j = 1; j <= (n - i + 1); j++){
+        sc->energy_up[i][j] =   sc->energy_up[i][j-1]
+                                  + (int)roundf(constraints[i+j-1] * 100.); /* convert to 10kal/mol */
+      }
+    }
+  }
+}
+
+PRIVATE void
+sc_really_add_up( vrna_fold_compound_t *vc,
+                  int i,
+                  FLT_OR_DBL energy){
+
+  unsigned int  j, u, n;
+  vrna_sc_t     *sc;
+
+  n   = vc->length;
+
+  if(!vc->sc)
+    vrna_sc_init(vc);
+
+  sc  = vc->sc;
+  /*
+      Prepare memory:
+      allocate memory such that we can access the soft constraint
+      energies of a subsequence of length j starting at position i
+      via sc->energy_up[i][j]
+  */
+  if(!(sc->energy_up)){
+    sc->energy_up = (int **)vrna_alloc(sizeof(int *) * (n + 2));
+  }
+
+  for(j = 0; j <= n; j++){
+    if(!(sc->energy_up[j]))
+      sc->energy_up[j] = (int *)vrna_alloc(sizeof(int) * (n - j + 2));
+  }
+
+  sc->energy_up[n+1] = NULL;
+
+  /* update soft constraints for subsequences starting at some position */
+  for(j = 1; j <= i; j++){
+    int u_max   = n - j + 1;
+    int u_start = i - j + 1;
+
+    sc->energy_up[j][u_start] += (int)roundf(energy * 100.); /* convert to 10kal/mol */
+
+    for(u = u_start + 1; u <= u_max; u++){
+      sc->energy_up[j][u] = sc->energy_up[j][u-1]
+                            + sc->energy_up[j + u - 1][1];
+    }
+  }
+}
+
+
+/* compute Boltzmann factors for BP soft constraints from stored free energies */
+PRIVATE void
+prepare_Boltzmann_weights_bp(vrna_fold_compound_t *vc){
+
+  unsigned int  i, j, n;
+  vrna_sc_t     *sc;
+  int           *idx, *jidx;
+
+  if(vc->sc && vc->sc->energy_bp){
+    n   = vc->length;
+    sc  = vc->sc;
+
+    vrna_exp_param_t  *exp_params = vc->exp_params;
+    double            GT          = 0.;
+    double            temperature = exp_params->temperature;
+    double            kT          = exp_params->kT;
+    double            TT          = (temperature+K0)/(Tmeasure);
+
+    if(sc->exp_energy_bp)
+      free(sc->exp_energy_bp);
+    sc->exp_energy_bp     = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (((n + 1) * (n + 2)) / 2));
+
+    idx   = vc->iindx;
+    jidx  = vc->jindx;
+
+    for(i = 1; i < n; i++)
+      for(j = i + 1; j <= n; j++){
+        GT = sc->energy_bp[jidx[j] + i] * 10.;
+        sc->exp_energy_bp[idx[i]-j] = (FLT_OR_DBL)exp( -GT / kT);
+      }
+  }
+}
+
+PRIVATE void
+prepare_Boltzmann_weights_up(vrna_fold_compound_t *vc){
+
+  unsigned int  i, j, n;
+  vrna_sc_t     *sc;
+
+  n   = vc->length;
+
+  sc  = vc->sc;
+
+  vrna_exp_param_t   *exp_params = vc->exp_params;
+  double             GT          = 0.;
+  double             temperature = exp_params->temperature;
+  double             kT          = exp_params->kT;
+  double             TT          = (temperature+K0)/(Tmeasure);
+
+  /* #################################### */
+  /* # single nucleotide contributions  # */
+  /* #################################### */
+
+  if(sc && sc->energy_up){
+    /*  allocate memory such that we can access the soft constraint
+        energies of a subsequence of length j starting at position i
+        via sc->exp_energy_up[i][j]
+    */
+
+    /* free previous unpaired nucleotide constraints */
+    if(sc->exp_energy_up){
+      for(i = 0; i <= n; i++)
+        if(sc->exp_energy_up[i])
+          free(sc->exp_energy_up[i]);
+      free(sc->exp_energy_up);
+    }
+
+    /* allocate memory and create Boltzmann factors from stored contributions */
+    sc->exp_energy_up = (FLT_OR_DBL **)vrna_alloc(sizeof(FLT_OR_DBL *) * (n + 2));
+    sc->exp_energy_up[0] = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 2));
+    for(j = 0; j <= (n + 1); j++)
+        sc->exp_energy_up[0][j] = 1.;
+
+    for(i = 1; i <= n; i++){
+      sc->exp_energy_up[i] = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n - i + 2));
+
+      sc->exp_energy_up[i][0] = 1.;
+
+      for(j = 1; j <= (n - i + 1); j++){
+        GT  = (double)sc->energy_up[i][j] * 10.; /* convert to cal/mol */
+        sc->exp_energy_up[i][j] = (FLT_OR_DBL)exp( -GT / kT);
+      }
+    }
+
+    sc->exp_energy_up[n+1] = NULL;
+  }
+}
diff --git a/C/ViennaRNA/constraints_soft.h b/C/ViennaRNA/constraints_soft.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/constraints_soft.h
@@ -0,0 +1,317 @@
+#ifndef VIENNA_RNA_PACKAGE_CONSTRAINTS_SOFT_H
+#define VIENNA_RNA_PACKAGE_CONSTRAINTS_SOFT_H
+
+#include <ViennaRNA/data_structures.h>
+
+/**
+ *  @file     constraints_soft.h
+ *  @brief    Functions and data structures for secondary structure soft constraints
+ *  @ingroup  soft_constraints
+ */
+
+
+/** @brief Typename for the soft constraints data structure #vrna_sc_s
+ *  @ingroup  soft_constraints
+ */
+typedef struct  vrna_sc_s vrna_sc_t;
+
+/**
+ * @brief Callback to retrieve pseudo energy contribution for soft constraint feature
+ *
+ * @ingroup soft_constraints
+ *
+ * This is the prototype for callback functions used by the folding recursions to evaluate generic
+ * soft constraints. The first four parameters passed indicate the delimiting nucleotide positions
+ * of the decomposition, and the parameter @p denotes the decomposition step. The last parameter
+ * @p data is the auxiliary data structure associated to the hard constraints via vrna_sc_add_data(),
+ * or NULL if no auxiliary data was added.
+ *
+ * @see #VRNA_DECOMP_PAIR_HP, #VRNA_DECOMP_PAIR_IL, #VRNA_DECOMP_PAIR_ML, #VRNA_DECOMP_ML_ML_ML,
+ *      #VRNA_DECOMP_ML_STEM, #VRNA_DECOMP_ML_ML, #VRNA_DECOMP_ML_UP, #VRNA_DECOMP_ML_ML_STEM,
+ *      #VRNA_DECOMP_ML_COAXIAL, #VRNA_DECOMP_EXT_EXT, #VRNA_DECOMP_EXT_UP, #VRNA_DECOMP_EXT_STEM,
+ *      #VRNA_DECOMP_EXT_EXT_EXT, #VRNA_DECOMP_EXT_STEM_EXT, #VRNA_DECOMP_EXT_EXT_STEM,
+ *      #VRNA_DECOMP_EXT_EXT_STEM1, vrna_sc_add_f(), vrna_sc_add_exp_f(), vrna_sc_add_bt(),
+ *      vrna_sc_add_data()
+ *
+ * @param i         Left (5') delimiter position of substructure
+ * @param j         Right (3') delimiter position of substructure
+ * @param k         Left delimiter of decomposition
+ * @param l         Right delimiter of decomposition
+ * @param d         Decomposition step indicator
+ * @param data      Auxiliary data
+ * @return          Pseudo energy contribution in deka-kalories per mol
+ */
+typedef int (vrna_callback_sc_energy)(int i, int j, int k, int l, char d, void *data);
+
+/**
+ * @brief Callback to retrieve pseudo energy contribution as Boltzmann Factors for soft constraint feature
+ *
+ * @ingroup soft_constraints
+ *
+ * This is the prototype for callback functions used by the partition function recursions to evaluate generic
+ * soft constraints. The first four parameters passed indicate the delimiting nucleotide positions
+ * of the decomposition, and the parameter @p denotes the decomposition step. The last parameter
+ * @p data is the auxiliary data structure associated to the hard constraints via vrna_sc_add_data(),
+ * or NULL if no auxiliary data was added.
+ *
+ * @see #VRNA_DECOMP_PAIR_HP, #VRNA_DECOMP_PAIR_IL, #VRNA_DECOMP_PAIR_ML, #VRNA_DECOMP_ML_ML_ML,
+ *      #VRNA_DECOMP_ML_STEM, #VRNA_DECOMP_ML_ML, #VRNA_DECOMP_ML_UP, #VRNA_DECOMP_ML_ML_STEM,
+ *      #VRNA_DECOMP_ML_COAXIAL, #VRNA_DECOMP_EXT_EXT, #VRNA_DECOMP_EXT_UP, #VRNA_DECOMP_EXT_STEM,
+ *      #VRNA_DECOMP_EXT_EXT_EXT, #VRNA_DECOMP_EXT_STEM_EXT, #VRNA_DECOMP_EXT_EXT_STEM,
+ *      #VRNA_DECOMP_EXT_EXT_STEM1, vrna_sc_add_exp_f(), vrna_sc_add_f(), vrna_sc_add_bt(),
+ *      vrna_sc_add_data()
+ *
+ * @param i         Left (5') delimiter position of substructure
+ * @param j         Right (3') delimiter position of substructure
+ * @param k         Left delimiter of decomposition
+ * @param l         Right delimiter of decomposition
+ * @param d         Decomposition step indicator
+ * @param data      Auxiliary data
+ * @return          Pseudo energy contribution in deka-kalories per mol
+ */
+typedef FLT_OR_DBL (vrna_callback_sc_exp_energy)(int i, int j, int k, int l, char d, void *data);
+
+/**
+ * @brief Callback to retrieve auxiliary base pairs for soft constraint feature
+ *
+ * @ingroup soft_constraints
+ *
+ * @see #VRNA_DECOMP_PAIR_HP, #VRNA_DECOMP_PAIR_IL, #VRNA_DECOMP_PAIR_ML, #VRNA_DECOMP_ML_ML_ML,
+ *      #VRNA_DECOMP_ML_STEM, #VRNA_DECOMP_ML_ML, #VRNA_DECOMP_ML_UP, #VRNA_DECOMP_ML_ML_STEM,
+ *      #VRNA_DECOMP_ML_COAXIAL, #VRNA_DECOMP_EXT_EXT, #VRNA_DECOMP_EXT_UP, #VRNA_DECOMP_EXT_STEM,
+ *      #VRNA_DECOMP_EXT_EXT_EXT, #VRNA_DECOMP_EXT_STEM_EXT, #VRNA_DECOMP_EXT_EXT_STEM,
+ *      #VRNA_DECOMP_EXT_EXT_STEM1, vrna_sc_add_bt(), vrna_sc_add_f(), vrna_sc_add_exp_f(),
+ *      vrna_sc_add_data()
+ *
+ * @param i         Left (5') delimiter position of substructure
+ * @param j         Right (3') delimiter position of substructure
+ * @param k         Left delimiter of decomposition
+ * @param l         Right delimiter of decomposition
+ * @param d         Decomposition step indicator
+ * @param data      Auxiliary data
+ * @return          List of additional base pairs
+ */
+typedef vrna_basepair_t *(vrna_callback_sc_backtrack)(int i, int j, int k, int l, char d, void *data);
+
+/**
+ *  @brief  The soft constraints data structure
+ *
+ *  @ingroup soft_constraints
+ */
+struct vrna_sc_s {
+  int         **energy_up;            /**<  @brief Energy contribution for stretches of unpaired nucleotides */
+  int         *energy_bp;             /**<  @brief Energy contribution for base pairs */
+  FLT_OR_DBL  **exp_energy_up;        /**<  @brief Boltzmann Factors of the energy contributions for unpaired sequence stretches */
+  FLT_OR_DBL  *exp_energy_bp;         /**<  @brief Boltzmann Factors of the energy contribution for base pairs */
+
+  int         *energy_stack;          /**<  @brief Pseudo Energy contribution per base pair involved in a stack */
+  FLT_OR_DBL  *exp_energy_stack;      /**<  @brief Boltzmann weighted pseudo energy contribution per nucleotide involved in a stack */
+
+  /* generic soft contraints below */
+  vrna_callback_sc_energy *f;         /**<  @brief  A function pointer used for pseudo
+                                                    energy contribution in MFE calculations
+                                            @see    vrna_sc_add_f()
+                                      */
+
+  vrna_callback_sc_backtrack *bt;     /**<  @brief  A function pointer used to obtain backtraced
+                                                    base pairs in loop regions that were altered
+                                                    by soft constrained pseudo energy contributions
+                                            @see    vrna_sc_add_bt()
+                                      */
+
+  vrna_callback_sc_exp_energy *exp_f; /**<  @brief  A function pointer used for pseudo energy
+                                                    contribution boltzmann factors in PF
+                                                    calculations
+                                            @see    vrna_sc_add_exp_f()
+                                      */
+
+  void *data;                         /**<  @brief  A pointer to the data object provided for
+                                                    for pseudo energy contribution functions of the
+                                                    generic soft constraints feature
+                                      */
+  vrna_callback_free_auxdata *free_data;
+};
+
+/**
+ *  @brief Initialize an empty soft constraints data structure within a #vrna_fold_compound_t
+ *
+ *  This function adds a proper soft constraints data structure
+ *  to the #vrna_fold_compound_t data structure.
+ *  If soft constraints already exist within the fold compound, they are removed.
+ *
+ *  \note Accepts vrna_fold_compound_t of type #VRNA_FC_TYPE_SINGLE and #VRNA_FC_TYPE_COMPARATIVE
+ *
+ *  @ingroup  soft_constraints
+ *
+ *  @see  vrna_sc_set_bp(), vrna_sc_set_up(), vrna_sc_add_SHAPE_deigan(),
+ *        vrna_sc_add_SHAPE_zarringhalam(), vrna_sc_remove(), vrna_sc_add_f(),
+ *        vrna_sc_add_exp_f(), vrna_sc_add_pre(), vrna_sc_add_post()
+ *  @param  vc  The #vrna_fold_compound_t where an empty soft constraint feature is to be added to
+ */
+void vrna_sc_init(vrna_fold_compound_t *vc);
+
+/**
+ *  @brief  Set soft constraints for paired nucleotides
+ *
+ *  @note     This function replaces any pre-exisitng soft constraints with the ones supplied
+ *            in @p constraints.
+ *
+ *  @ingroup  soft_constraints
+ *
+ *  @see      vrna_sc_add_bp(), vrna_sc_set_up(), vrna_sc_add_up()
+ *
+ *  @param  vc          The #vrna_fold_compound_t the soft constraints are associated with
+ *  @param  constraints A two-dimensional array of pseudo free energies in @f$ kcal / mol @f$
+ *  @param  options     The options flag indicating how/where to store the soft constraints
+ */
+void vrna_sc_set_bp(vrna_fold_compound_t *vc,
+                    const FLT_OR_DBL **constraints,
+                    unsigned int options);
+
+/**
+ *  @brief  Add soft constraints for paired nucleotides
+ *
+ *  @ingroup  soft_constraints
+ *
+ *  @see      vrna_sc_set_bp(), vrna_sc_set_up(), vrna_sc_add_up()
+ *
+ *  @param  vc          The #vrna_fold_compound_t the soft constraints are associated with
+ *  @param  i           The 5' position of the base pair the soft constraint is added for
+ *  @param  j           The 3' position of the base pair the soft constraint is added for
+ *  @param  energy      The free energy (soft-constraint) in @f$ kcal / mol @f$
+ *  @param  options     The options flag indicating how/where to store the soft constraints
+ */
+void vrna_sc_add_bp(vrna_fold_compound_t *vc,
+                   int i,
+                   int j,
+                   FLT_OR_DBL energy,
+                   unsigned int options);
+
+/**
+ *  @brief  Set soft constraints for unpaired nucleotides
+ *
+ *  @note     This function replaces any pre-exisitng soft constraints with the ones supplied
+ *            in @p constraints.
+ *
+ *  @ingroup  soft_constraints
+ *
+ *  @see      vrna_sc_add_up(), vrna_sc_set_bp(), vrna_sc_add_bp()
+ *
+ *  @param  vc          The #vrna_fold_compound_t the soft constraints are associated with
+ *  @param  constraints A vector of pseudo free energies in @f$ kcal / mol @f$
+ *  @param  options     The options flag indicating how/where to store the soft constraints
+ */
+void vrna_sc_set_up(vrna_fold_compound_t *vc,
+                    const FLT_OR_DBL *constraints,
+                    unsigned int options);
+
+/**
+ *  @brief  Add soft constraints for unpaired nucleotides
+ *
+ *  @ingroup  soft_constraints
+ *
+ *  @see      vrna_sc_set_up(), vrna_sc_add_bp(), vrna_sc_set_bp()
+ *
+ *  @param  vc          The #vrna_fold_compound_t the soft constraints are associated with
+ *  @param  i           The nucleotide position the soft constraint is added for
+ *  @param  energy      The free energy (soft-constraint) in @f$ kcal / mol @f$
+ *  @param  options     The options flag indicating how/where to store the soft constraints
+ */
+void vrna_sc_add_up( vrna_fold_compound_t *vc,
+                            int i,
+                            FLT_OR_DBL energy,
+                            unsigned int options);
+
+/**
+ *  @brief  Remove soft constraints from #vrna_fold_compound_t
+ *
+ *  \note Accepts vrna_fold_compound_t of type #VRNA_FC_TYPE_SINGLE and #VRNA_FC_TYPE_COMPARATIVE
+ *
+ *  @ingroup  soft_constraints
+ *
+ *  @param  vc  The #vrna_fold_compound_t possibly containing soft constraints
+ */
+void vrna_sc_remove(vrna_fold_compound_t *vc);
+
+/**
+ *  @brief  Free memory occupied by a #vrna_sc_t data structure
+ *
+ *  @ingroup  soft_constraints
+ *
+ *  @param  sc  The data structure to free from memory
+ */
+void vrna_sc_free(vrna_sc_t *sc);
+
+/**
+ *  @brief Add an auxiliary data structure for the generic soft constraints callback function
+ *
+ *  @ingroup soft_constraints
+ *
+ *  @see vrna_sc_add_f(), vrna_sc_add_exp_f(), vrna_sc_add_bt()
+ *
+ *  @param  vc        The fold compound the generic soft constraint function should be bound to
+ *  @param  data      A pointer to the data structure that holds required data for function 'f'
+ *  @param  free_data A pointer to a function that free's the memory occupied by @p data (Maybe NULL)
+ */
+void vrna_sc_add_data(vrna_fold_compound_t *vc,
+                      void *data,
+                      vrna_callback_free_auxdata *free_data);
+
+/**
+ *  @brief  Bind a function pointer for generic soft constraint feature (MFE version)
+ *
+ *  This function allows one to easily bind a function pointer and corresponding data structure
+ *  to the soft constraint part #vrna_sc_t of the #vrna_fold_compound_t.
+ *  The function for evaluating the generic soft constraint feature has to return
+ *  a pseudo free energy @f$ \hat{E} @f$ in @f$ dacal/mol @f$, where @f$ 1 dacal/mol = 10 cal/mol @f$.
+ *
+ *  @ingroup soft_constraints
+ *
+ *  @see vrna_sc_add_data(), vrna_sc_add_bt(), vrna_sc_add_exp_f()
+ *
+ *  @param  vc    The fold compound the generic soft constraint function should be bound to
+ *  @param  f     A pointer to the function that evaluates the generic soft constraint feature
+ */
+void vrna_sc_add_f( vrna_fold_compound_t *vc,
+                    vrna_callback_sc_energy *f);
+
+/**
+ *  @brief  Bind a backtracking function pointer for generic soft constraint feature
+ *
+ *  This function allows one to easily bind a function pointer to the soft constraint part
+ *  #vrna_sc_t of the #vrna_fold_compound_t.
+ *  The provided function should be used for backtracking purposes in loop regions
+ *  that were altered via the generic soft constraint feature. It has to return
+ *  an array of #vrna_basepair_t data structures, were the last element in the list is indicated
+ *  by a value of -1 in it's i position.
+ *
+ *  @ingroup soft_constraints
+ *
+ *  @see vrna_sc_add_data(), vrna_sc_add_f(), vrna_sc_add_exp_f()
+ *
+ *  @param  vc    The fold compound the generic soft constraint function should be bound to
+ *  @param  f     A pointer to the function that returns additional base pairs
+ */
+void vrna_sc_add_bt(vrna_fold_compound_t *vc,
+                    vrna_callback_sc_backtrack *f);
+
+/**
+ *  @brief  Bind a function pointer for generic soft constraint feature (PF version)
+ *
+ *  This function allows one to easily bind a function pointer and corresponding data structure
+ *  to the soft constraint part #vrna_sc_t of the #vrna_fold_compound_t.
+ *  The function for evaluating the generic soft constraint feature has to return
+ *  a pseudo free energy @f$ \hat{E} @f$ as Boltzmann factor, i.e. @f$ exp(- \hat{E} / kT) @f$.
+ *  The required unit for @f$ E @f$ is @f$ cal/mol @f$.
+ *
+ *  @ingroup soft_constraints
+ *
+ *  @see vrna_sc_add_bt(), vrna_sc_add_f(), vrna_sc_add_data()
+ *
+ *  @param  vc    The fold compound the generic soft constraint function should be bound to
+ *  @param  exp_f A pointer to the function that evaluates the generic soft constraint feature
+ */
+void vrna_sc_add_exp_f( vrna_fold_compound_t *vc,
+                        vrna_callback_sc_exp_energy *exp_f);
+
+#endif
diff --git a/C/ViennaRNA/convert_epars.c b/C/ViennaRNA/convert_epars.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/convert_epars.c
@@ -0,0 +1,954 @@
+/*
+###################################
+# convert energy parameter files  #
+# from ViennaRNAPackage 1.8.4 to  #
+# 2.0 format                      #
+#                                 #
+# Ronny Lorenz                    #
+###################################
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <math.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/read_epars.h"
+#include "ViennaRNA/pair_mat.h"
+
+#include "1.8.4_epars.h"
+#include "1.8.4_intloops.h"
+
+#include "ViennaRNA/convert_epars.h"
+
+enum parset_184 {UNKNOWN_184= -1, QUIT_184, S_184, SH_184, HP_184, B_184, IL_184, MMI_184, MMH_184, MMM_184, MM_H_184,
+             DE5_184, DE3_184, DE5_H_184, DE3_H_184, ML_184, TL_184, TRI_184, TE_184, NIN_184, MISC_184,
+             INT11_184, INT11_H_184, INT21_184, INT21_H_184, INT22_184, INT22_H_184};
+
+
+PRIVATE unsigned int  read_old_parameter_file(FILE *ifile, int skip_header);
+PRIVATE void          write_new_parameter_file(FILE *ofile, unsigned int options);
+PRIVATE void          rd_stacks(int stack[NBPAIRS+1][NBPAIRS+1], FILE *fp);
+PRIVATE void          rd_loop(int looparray[31], FILE *fp);
+PRIVATE void          rd_mismatch(int mismatch[NBPAIRS+1][5][5], FILE *fp);
+PRIVATE void          rd_int11(int int11[NBPAIRS+1][NBPAIRS+1][5][5], FILE *fp);
+PRIVATE void          rd_int21(int int21[NBPAIRS+1][NBPAIRS+1][5][5][5], FILE *fp);
+PRIVATE void          rd_int22(int int22[NBPAIRS+1][NBPAIRS+1][5][5][5][5], FILE *fp);
+PRIVATE void          rd_dangle(int dangles[NBPAIRS+1][5], FILE *fp);
+PRIVATE void          rd_MLparams(FILE *fp);
+PRIVATE void          rd_misc(FILE *fp);
+PRIVATE void          rd_ninio(FILE *fp);
+PRIVATE void          rd_Tetra_loop(FILE *fp);
+PRIVATE void          rd_Tri_loop(FILE *fp);
+PRIVATE void          check_symmetry(void);
+PRIVATE enum          parset_184 gettype_184(char ident[]);
+PRIVATE char          *get_array1(int *arr, int size, FILE *fp);
+PRIVATE void          ignore_comment(char *line);
+PRIVATE void          display_array(int *p, int size, int line, FILE *fp);
+
+
+PUBLIC void convert_parameter_file(const char *iname, const char *oname, unsigned int options){
+  FILE          *ifile, *ofile;
+  unsigned int  old_options = 0;
+  int           skip_input_header = 0;
+
+  if(options & VRNA_CONVERT_OUTPUT_DUMP){
+    if(oname == NULL) oname = iname;
+    skip_input_header = 1;
+  }
+  else{
+    if(iname == NULL){
+      ifile = stdin;
+      skip_input_header = 1;
+    }
+    else if(!(ifile=fopen(iname,"r"))){
+      vrna_message_warning("convert_epars: can't open file %s", iname);
+      return;
+    }
+    /* read old (1.8.4 format) parameter file */
+    old_options = read_old_parameter_file(ifile, skip_input_header);
+    if(ifile != stdin) fclose(ifile);
+    check_symmetry();
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_VANILLA)
+    options = old_options;
+
+  if(oname == NULL) ofile = stdout;
+  else if(!(ofile=fopen(oname,"a+"))){
+    vrna_message_warning("convert_epars: can't open file %s for writing", oname);
+    return;
+  }
+  write_new_parameter_file(ofile, options);
+  if(ofile != stdout) fclose(ofile);
+}
+
+
+/*------------------------------------------------------------*/
+PRIVATE unsigned int read_old_parameter_file(FILE *ifile, int skip_header){
+  char                  *line, ident[32];
+  enum      parset_184  type;
+  int                   r, last;
+  unsigned  int         read_successfully = 0;
+
+  if (!(line = vrna_read_line(ifile))) {
+    vrna_message_warning("convert_epars: can't read input parameter file");
+    return 0;
+  }
+  if(!skip_header){
+    if (strncmp(line,"## RNAfold parameter file",25)!=0){
+      vrna_message_warning("convert_epars: Missing header line in input parameter file.\n"
+                "May be this file has incorrect format?");
+      free(line);
+      return 0;
+    }
+    free(line);
+    line = vrna_read_line(ifile);
+  }
+  last = 0;
+  do{
+    r = sscanf(line, "# %31s", ident);
+    if (r==1){
+      type = gettype_184(ident);
+      switch (type){
+        case QUIT_184:    if(ifile == stdin){
+                            vrna_message_info(stderr, "press ENTER to continue...");
+                            fflush(stderr);
+                          }
+                          last = 1;
+                          break;
+        case SH_184:      rd_stacks(enthalpies_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_STACK;
+                          break;
+        case S_184:       rd_stacks(stack37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_STACK;
+                          break;
+        case HP_184:      rd_loop(hairpin37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_HP;
+                          break;
+        case B_184:       rd_loop(bulge37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_BULGE;
+                          break;
+        case IL_184:      rd_loop(internal_loop37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_INT;
+                          break;
+        case MMH_184:     rd_mismatch(mismatchH37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_MM_HP;
+                          break;
+        case MMI_184:     rd_mismatch(mismatchI37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_MM_INT
+                                              |VRNA_CONVERT_OUTPUT_MM_INT_1N  /* since 1:n-interior loop mismatches are treated seperately in 2.0 */
+                                              |VRNA_CONVERT_OUTPUT_MM_INT_23; /* since 2:3-interior loop mismatches are treated seperately in 2.0 */
+                          break;
+        case MMM_184:     rd_mismatch(mismatchM37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_MM_MULTI;
+                          break;
+        case MM_H_184:    rd_mismatch(mism_H_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_MM_HP      /* since hairpin mismatches are treated seperately in 2.0 */
+                                              |VRNA_CONVERT_OUTPUT_MM_INT     /* since interior loop  mismatches are treated seperately in 2.0 */
+                                              |VRNA_CONVERT_OUTPUT_MM_INT_1N  /* since 1:n-interior loop mismatches are treated seperately in 2.0 */
+                                              |VRNA_CONVERT_OUTPUT_MM_INT_23  /* since 2:3-interior loop mismatches are treated seperately in 2.0 */
+                                              |VRNA_CONVERT_OUTPUT_MM_MULTI;  /* since multi loop mismatches are treated seperately in 2.0 */
+                          break;
+        case INT11_184:   rd_int11(int11_37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_INT_11;
+                          break;
+        case INT11_H_184: rd_int11(int11_H_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_INT_11;
+                          break;
+        case INT21_184:   rd_int21(int21_37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_INT_21;
+                          break;
+        case INT21_H_184: rd_int21(int21_H_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_INT_21;
+                          break;
+        case INT22_184:   rd_int22(int22_37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_INT_22;
+                          break;
+        case INT22_H_184: rd_int22(int22_H_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_INT_22;
+                          break;
+        case DE5_184:     rd_dangle(dangle5_37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_DANGLE5
+                                              |VRNA_CONVERT_OUTPUT_MM_MULTI /* since multi loop mismatches were treated as dangle contribution */
+                                              |VRNA_CONVERT_OUTPUT_MM_EXT;  /* since exterior loop mismatches were treated as dangle contribution */
+                          break;
+        case DE5_H_184:   rd_dangle(dangle5_H_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_DANGLE5
+                                              |VRNA_CONVERT_OUTPUT_MM_MULTI /* since multi loop mismatches were treated as dangle contribution */
+                                              |VRNA_CONVERT_OUTPUT_MM_EXT;  /* since exterior loop mismatches were treated as dangle contribution */
+                          break;
+        case DE3_184:     rd_dangle(dangle3_37_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_DANGLE3
+                                              |VRNA_CONVERT_OUTPUT_MM_MULTI /* since multi loop mismatches were treated as dangle contribution */
+                                              |VRNA_CONVERT_OUTPUT_MM_EXT;  /* since exterior loop mismatches were treated as dangle contribution */
+                          break;
+        case DE3_H_184:   rd_dangle(dangle3_H_184, ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_DANGLE3
+                                              |VRNA_CONVERT_OUTPUT_MM_MULTI /* since multi loop mismatches were treated as dangle contribution */
+                                              |VRNA_CONVERT_OUTPUT_MM_EXT;  /* since exterior loop mismatches were treated as dangle contribution */
+                          break;
+        case ML_184:      rd_MLparams(ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_ML
+                                              |VRNA_CONVERT_OUTPUT_MISC;    /* since TerminalAU went to "misc" section */
+                          break;
+        case NIN_184:     rd_ninio(ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_NINIO;
+                          break;
+        case TL_184:      rd_Tetra_loop(ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_SPECIAL_HP;
+                          break;
+        case TRI_184:     rd_Tri_loop(ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_SPECIAL_HP;
+                          break;
+        case MISC_184:    rd_misc(ifile);
+                          read_successfully |= VRNA_CONVERT_OUTPUT_MISC;
+                          break;
+        default:          /* do nothing but complain */
+                          vrna_message_warning("convert_parameter_file: Unknown field identifier in `%s'", line);
+      }
+    } /* else ignore line */
+    free(line);
+  } while((line=vrna_read_line(ifile)) && !last);
+  return read_successfully;
+}
+
+PRIVATE void display_array(int *p, int size, int nl, FILE *fp){
+  int i;
+  for (i=1; i<=size; i++, p++) {
+    switch(*p){
+      case  INF: fprintf(fp,"   INF");    break;
+      case -INF: fprintf(fp,"  -INf");    break;
+      case  DEF: fprintf(fp,"   DEF");    break;
+      default:   fprintf(fp,"%6d",  *p);  break;
+    }
+    if ((i%nl)==0) fprintf(fp,"\n");
+  }
+  if (size%nl) fprintf(fp,"\n");
+  return;
+}
+
+PRIVATE char *get_array1(int *arr, int size, FILE *fp){
+  int    i, p, pos, pp, r, last;
+  char  *line, buf[16];
+  i = last = 0;
+  while( i<size ) {
+    line = vrna_read_line(fp);
+    if (!line) vrna_message_error("convert_epars: unexpected end of file in get_array1");
+    ignore_comment(line);
+    pos=0;
+    while ((i<size)&&(sscanf(line+pos,"%15s%n", buf, &pp)==1)) {
+      pos += pp;
+      if (buf[0]=='*') {i++; continue;}
+      else if (buf[0]=='x') { /* should only be used for loop parameters */
+        if (i==0) vrna_message_error("convert_epars: can't extrapolate first value");
+        p = arr[last] + (int) (0.5+ lxc37_184*log(((double) i)/(double)(last)));
+      }
+      else if (strcmp(buf,"DEF") == 0) p = DEF;
+      else if (strcmp(buf,"INF") == 0) p = INF;
+      else if (strcmp(buf,"NST") == 0) p = NST;
+      else {
+        r=sscanf(buf,"%d", &p);
+        if (r!=1) {
+          return line+pos;
+          vrna_message_error("convert_epars: can't interpret `%s' in get_array1", buf);
+          exit(1);
+        }
+        last = i;
+      }
+      arr[i++]=p;
+    }
+    free(line);
+  }
+
+  return NULL;
+}
+/*------------------------------------------------------------*/
+
+PRIVATE void  rd_stacks(int stacks[NBPAIRS+1][NBPAIRS+1], FILE *fp)
+{
+  int    i;
+  char  *cp;
+  for (i=1; i<=NBPAIRS; i++) {
+    cp = get_array1(stacks[i]+1,NBPAIRS, fp);
+    if (cp) {
+      vrna_message_error("convert_epars: \nrd_stacks: %s", cp);
+      exit(1);
+    }
+  }
+  return;
+}
+/*------------------------------------------------------------*/
+
+PRIVATE void rd_loop(int loop[31], FILE *fp)
+{
+  char *cp;
+
+  cp   = get_array1(loop, 31, fp);
+
+  if (cp) {
+    vrna_message_error("convert_epars: \nrd_loop: %s", cp);
+    exit(1);
+  }
+  return;
+}
+/*------------------------------------------------------------*/
+
+PRIVATE void rd_mismatch(int mismatch[NBPAIRS+1][5][5], FILE *fp)
+{
+  char  *cp;
+  int    i;
+
+  for (i=1; i<NBPAIRS+1; i++) {
+    cp = get_array1(mismatch[i][0],5*5, fp);
+    if (cp) {
+      vrna_message_error("convert_epars: rd_mismatch: in field mismatch[%d]\n\t%s", i, cp);
+      exit(1);
+    }
+  }
+  return;
+}
+
+/*------------------------------------------------------------*/
+PRIVATE void rd_int11(int int11[NBPAIRS+1][NBPAIRS+1][5][5], FILE *fp)
+{
+  char  *cp;
+  int    i, j;
+
+  for (i=1; i<NBPAIRS+1; i++) {
+    for (j=1; j<NBPAIRS+1; j++) {
+      cp = get_array1(int11[i][j][0],5*5, fp);
+      if (cp) {
+        vrna_message_error("convert_epars: rd_int11: in field int11[%d][%d]\n\t%s", i, j, cp);
+        exit(1);
+      }
+    }
+  }
+  return;
+}
+
+/*------------------------------------------------------------*/
+PRIVATE void rd_int21(int int21[NBPAIRS+1][NBPAIRS+1][5][5][5], FILE *fp)
+{
+  char  *cp;
+  int    i, j, k;
+
+  for (i=1; i<NBPAIRS+1; i++) {
+    for (j=1; j<NBPAIRS+1; j++) {
+      for (k=0; k<5; k++) {
+        cp = get_array1(int21[i][j][k][0],5*5, fp);
+        if (cp) {
+          vrna_message_error("convert_epars: rd_int21: in field int21[%d][%d][%d]\n\t%s",
+                                    i, j, k, cp);
+          exit(1);
+        }
+      }
+    }
+  }
+  return;
+}
+
+/*------------------------------------------------------------*/
+PRIVATE void rd_int22(int int22[NBPAIRS+1][NBPAIRS+1][5][5][5][5], FILE *fp)
+{
+  char  *cp;
+  int    i, j, k, l, m;
+
+  for (i=1; i<NBPAIRS+1; i++)
+    for (j=1; j<NBPAIRS+1; j++)
+      for (k=1; k<5; k++)
+        for (l=1; l<5; l++)
+          for (m=1; m<5; m++) {
+            cp = get_array1(int22[i][j][k][l][m]+1,4, fp);
+            if (cp) {
+              vrna_message_error("convert_epars: rd_int22: in field "
+                                        "int22[%d][%d][%d][%d][%d]\n\t%s",
+                                        i, j, k, l, m, cp);
+              exit(1);
+            }
+          }
+
+  return;
+}
+
+/*------------------------------------------------------------*/
+PRIVATE void  rd_dangle(int dangle[NBPAIRS+1][5], FILE *fp)
+{
+  int   i;
+  char *cp;
+
+  for (i=0; i< NBPAIRS+1; i++) {
+    cp = get_array1(dangle[i],5, fp);
+    if (cp) {
+      vrna_message_error("convert_epars: \nrd_dangle: %s", cp);
+      exit(1);
+    }
+  }
+  return;
+}
+
+/*------------------------------------------------------------*/
+PRIVATE void  rd_MLparams(FILE *fp)
+{
+  char *cp;
+  int values[4];
+
+  cp   = get_array1(values,4, fp);
+  if (cp) {
+    vrna_message_error("convert_epars: rd_MLparams: %s", cp);
+    exit(1);
+  }
+
+  ML_BASE37_184     = values[0];
+  ML_closing37_184  = values[1];
+  ML_intern37_184   = values[2];
+  TerminalAU_184    = values[3];
+
+  return;
+}
+
+/*------------------------------------------------------------*/
+
+PRIVATE void  rd_misc(FILE *fp)
+{
+  char *cp;
+  int values[1]; /* so far just one */
+
+  cp   = get_array1(values,1, fp);
+  if (cp) {
+    vrna_message_error("convert_epars: rd_misc: %s", cp);
+    exit(1);
+  }
+
+  DuplexInit_184 = values[0];
+
+  return;
+}
+
+/*------------------------------------------------------------*/
+
+PRIVATE void  rd_ninio(FILE *fp)
+{
+  char  *cp;
+  int temp[2];
+
+  cp = get_array1(temp, 2, fp);
+
+  if (cp) {
+    vrna_message_error("convert_epars: rd_F_ninio: %s", cp);
+    exit(1);
+  }
+  F_ninio37_184[2] = temp[0];
+  MAX_NINIO_184  = temp[1];
+  return;
+}
+
+/*------------------------------------------------------------*/
+PRIVATE void  rd_Tetra_loop(FILE *fp)
+{
+  int    i, r;
+  char   *buf;
+
+  i=0;
+  memset(&Tetraloops_184, 0, 1400);
+  memset(&TETRA_ENERGY37_184, 0, sizeof(int)*200);
+  do {
+    buf = vrna_read_line(fp);
+    if (buf==NULL) break;
+    r = sscanf(buf,"%6s %d", &Tetraloops_184[7*i], &TETRA_ENERGY37_184[i]);
+    strcat(Tetraloops_184, " ");
+    free(buf);
+    i++;
+  } while((r==2)&&(i<200));
+  return;
+}
+
+/*------------------------------------------------------------*/
+PRIVATE void  rd_Tri_loop(FILE *fp)
+{
+  int    i, r;
+  char   *buf;
+
+  i=0;
+  memset(&Triloops_184, 0, 241);
+  memset(&Triloop_E37_184, 0, sizeof(int)*40);
+  do {
+    buf = vrna_read_line(fp);
+    if (buf==NULL) break;
+    r = sscanf(buf,"%5s %d", &Triloops_184[6*i], &Triloop_E37_184[i]);
+    Triloops_184[6*i+5]=' ';
+    free(buf);
+    i++;
+  } while((r==2)&&(i<40));
+  return;
+}
+
+/*------------------------------------------------------------*/
+
+
+PRIVATE void ignore_comment(char * line)
+{
+  /* excise C style comments */
+  /* only one comment per line, no multiline comments */
+  char *cp1, *cp2;
+
+  if ((cp1=strstr(line, "/*"))) {
+    cp2 = strstr(cp1, "*/");
+    if (cp2==NULL)
+      vrna_message_error("convert_epars: unclosed comment in parameter file");
+    /* can't use strcpy for overlapping strings */
+    for (cp2+=2; *cp2!='\0'; cp2++, cp1++)
+      *cp1 = *cp2;
+    *cp1 = '\0';
+  }
+
+  return;
+}
+
+PRIVATE enum parset_184 gettype_184(char ident[]){
+  if (strcmp(ident,"stack_enthalpies") == 0)          return SH_184;
+  else if (strcmp(ident,"stack_energies") == 0)       return S_184;
+  else if (strcmp(ident,"hairpin" ) == 0)             return HP_184;
+  else if (strcmp(ident,"bulge") == 0)                return B_184;
+  else if (strcmp(ident,"internal_loop") == 0)        return IL_184;
+  else if (strcmp(ident,"mismatch_hairpin") == 0)     return MMH_184;
+  else if (strcmp(ident,"mismatch_interior") == 0)    return MMI_184;
+  else if (strcmp(ident,"mismatch_multi") == 0)       return MMM_184;
+  else if (strcmp(ident,"mismatch_enthalpies") == 0)  return MM_H_184;
+  else if (strcmp(ident,"int11_energies") == 0)       return INT11_184;
+  else if (strcmp(ident,"int11_enthalpies") == 0)     return INT11_H_184;
+  else if (strcmp(ident,"int21_energies") == 0)       return INT21_184;
+  else if (strcmp(ident,"int21_enthalpies") == 0)     return INT21_H_184;
+  else if (strcmp(ident,"int22_energies") == 0)       return INT22_184;
+  else if (strcmp(ident,"int22_enthalpies") == 0)     return INT22_H_184;
+  else if (strcmp(ident,"dangle5")== 0)               return DE5_184;
+  else if (strcmp(ident,"dangle3")== 0)               return DE3_184;
+  else if (strcmp(ident,"dangle5_enthalpies")== 0)    return DE5_H_184;
+  else if (strcmp(ident,"dangle3_enthalpies")== 0)    return DE3_H_184;
+  else if (strcmp(ident,"ML_params")== 0)             return ML_184;
+  else if (strcmp(ident,"NINIO") == 0)                return NIN_184;
+  else if (strcmp(ident,"Tetraloops") == 0)           return TL_184;
+  else if (strcmp(ident,"Triloops") == 0)             return TRI_184;
+  else if (strcmp(ident,"END") == 0)                  return QUIT_184;
+  else return UNKNOWN_184;
+}
+
+PRIVATE void write_new_parameter_file(FILE *ofile, unsigned int option_bits){
+  int           c;
+  char          *pnames[] = {"NP", "CG", "GC", "GU", "UG", "AU", "UA", " @"};
+  char          bnames[]  = "@ACGU";
+  unsigned  int options   = 0;
+
+  options = (option_bits & VRNA_CONVERT_OUTPUT_ALL) ?
+              VRNA_CONVERT_OUTPUT_HP
+            | VRNA_CONVERT_OUTPUT_STACK
+            | VRNA_CONVERT_OUTPUT_MM_HP
+            | VRNA_CONVERT_OUTPUT_MM_INT
+            | VRNA_CONVERT_OUTPUT_MM_INT_1N
+            | VRNA_CONVERT_OUTPUT_MM_INT_23
+            | VRNA_CONVERT_OUTPUT_MM_MULTI
+            | VRNA_CONVERT_OUTPUT_MM_EXT
+            | VRNA_CONVERT_OUTPUT_DANGLE5
+            | VRNA_CONVERT_OUTPUT_DANGLE3
+            | VRNA_CONVERT_OUTPUT_INT_11
+            | VRNA_CONVERT_OUTPUT_INT_21
+            | VRNA_CONVERT_OUTPUT_INT_22
+            | VRNA_CONVERT_OUTPUT_BULGE
+            | VRNA_CONVERT_OUTPUT_INT
+            | VRNA_CONVERT_OUTPUT_ML
+            | VRNA_CONVERT_OUTPUT_MISC
+            | VRNA_CONVERT_OUTPUT_SPECIAL_HP
+            | VRNA_CONVERT_OUTPUT_NINIO
+            :
+              option_bits;
+
+  make_pair_matrix(); /* needed for special loop energy contributions */
+
+  fprintf(ofile,"## RNAfold parameter file v2.0\n");
+
+  if(options & VRNA_CONVERT_OUTPUT_STACK){
+    fprintf(ofile,"\n# %s\n", settype(S));
+    fprintf(ofile,"/*  CG    GC    GU    UG    AU    UA    @  */\n");
+    for (c=1; c<NBPAIRS+1; c++)
+      display_array(stack37_184[c]+1,NBPAIRS,NBPAIRS, ofile);
+    fprintf(ofile,"\n# %s\n", settype(S_H));
+    fprintf(ofile,"/*  CG    GC    GU    UG    AU    UA    @  */\n");
+    for (c=1; c<NBPAIRS+1; c++)
+      display_array(enthalpies_184[c]+1,NBPAIRS,NBPAIRS, ofile);
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_MM_HP){
+    fprintf(ofile,"\n# %s\n", settype(MMH));
+    { int i,k;
+      for (k=1; k<NBPAIRS+1; k++)
+        for (i=0; i<5; i++)
+          display_array(mismatchH37_184[k][i],5,5, ofile);
+    }
+    fprintf(ofile,"\n# %s\n", settype(MMH_H));
+    { int i,k;
+      for (k=1; k<NBPAIRS+1; k++)
+        for (i=0; i<5; i++)
+          display_array(mism_H_184[k][i],5,5, ofile);
+    }
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_MM_INT){
+    fprintf(ofile,"\n# %s\n", settype(MMI));
+    { int i,k;
+      for (k=1; k<NBPAIRS+1; k++)
+        for (i=0; i<5; i++)
+          display_array(mismatchI37_184[k][i],5,5, ofile);
+    }
+    fprintf(ofile,"\n# %s\n", settype(MMI_H));
+    { int i,k;
+      for (k=1; k<NBPAIRS+1; k++)
+        for (i=0; i<5; i++)
+          display_array(mism_H_184[k][i],5,5, ofile);
+    }
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_MM_INT_1N){
+    fprintf(ofile,"\n# %s\n", settype(MMI1N));
+    { int i,k;
+      for (k=1; k<NBPAIRS+1; k++)
+        for (i=0; i<5; i++)
+          display_array(mismatchI37_184[k][i],5,5, ofile);
+    }
+    fprintf(ofile,"\n# %s\n", settype(MMI1N_H));
+    { int i,k;
+    for (k=1; k<NBPAIRS+1; k++)
+      for (i=0; i<5; i++)
+        display_array(mism_H_184[k][i],5,5, ofile);
+    }
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_MM_INT_23){
+    fprintf(ofile,"\n# %s\n", settype(MMI23));
+    { int i,k;
+      for (k=1; k<NBPAIRS+1; k++)
+        for (i=0; i<5; i++)
+          display_array(mismatchI37_184[k][i],5,5, ofile);
+    }
+    fprintf(ofile,"\n# %s\n", settype(MMI23_H));
+    { int i,k;
+    for (k=1; k<NBPAIRS+1; k++)
+      for (i=0; i<5; i++)
+        display_array(mism_H_184[k][i],5,5, ofile);
+    }
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_MM_MULTI){
+    fprintf(ofile,"\n# %s\n", settype(MMM));
+    fprintf(ofile,"/*  @     A     C     G     U   */\n");
+    { int i,j,k;
+      int bla[5];
+      for (k=1; k<NBPAIRS+1; k++)
+        for (i=0; i<5; i++){
+          for(j=0;j<5; j++)
+            bla[j] = ((dangle5_37_184[k][i] == INF) ? 0 : dangle5_37_184[k][i]) + ((dangle3_37_184[k][j] == INF) ? 0 : dangle3_37_184[k][j]);
+          display_array(bla,5,5, ofile);
+        }
+    }
+    fprintf(ofile,"\n# %s\n", settype(MMM_H));
+    fprintf(ofile,"/*  @     A     C     G     U   */\n");
+    { int i,j,k,bla[5];
+      for (k=1; k<NBPAIRS+1; k++)
+        for (i=0; i<5; i++){
+          for(j=0;j<5; j++)
+            bla[j] = ((dangle5_H_184[k][i] == INF) ? 0 : dangle5_H_184[k][i]) + ((dangle3_H_184[k][j] == INF) ? 0 : dangle3_H_184[k][j]);
+          display_array(bla,5,5, ofile);
+        }
+    }
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_MM_EXT){
+    fprintf(ofile,"\n# %s\n", settype(MME));
+    fprintf(ofile,"/*  @     A     C     G     U   */\n");
+    { int i,j,k;
+      int bla[5];
+      for (k=1; k<NBPAIRS+1; k++)
+        for (i=0; i<5; i++){
+          for(j=0;j<5; j++)
+            bla[j] = ((dangle5_37_184[k][i] == INF) ? 0 : dangle5_37_184[k][i]) + ((dangle3_37_184[k][j] == INF) ? 0 : dangle3_37_184[k][j]);
+          display_array(bla,5,5, ofile);
+        }
+    }
+    fprintf(ofile,"\n# %s\n", settype(MME_H));
+    fprintf(ofile,"/*  @     A     C     G     U   */\n");
+    { int i,j,k,bla[5];
+      for (k=1; k<NBPAIRS+1; k++)
+        for (i=0; i<5; i++){
+          for(j=0;j<5; j++)
+            bla[j] = ((dangle5_37_184[k][i] == INF) ? 0 : dangle5_H_184[k][i]) + ((dangle3_H_184[k][j] == INF) ? 0 : dangle3_H_184[k][j]);
+          display_array(bla,5,5, ofile);
+        }
+    }
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_DANGLE5){
+    fprintf(ofile,"\n# %s\n", settype(D5));
+    fprintf(ofile,"/*  @     A     C     G     U   */\n");
+    for (c=1; c<NBPAIRS+1; c++)
+      display_array(dangle5_37_184[c], 5, 5, ofile);
+    fprintf(ofile,"\n# %s\n", settype(D5_H));
+    fprintf(ofile,"/*  @     A     C     G     U   */\n");
+    for (c=1; c<NBPAIRS+1; c++)
+      display_array(dangle5_H_184[c], 5, 5, ofile);
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_DANGLE3){
+    fprintf(ofile,"\n# %s\n", settype(D3));
+    fprintf(ofile,"/*  @     A     C     G     U   */\n");
+    for (c=1; c<NBPAIRS+1; c++)
+      display_array(dangle3_37_184[c], 5, 5, ofile);
+    fprintf(ofile,"\n# %s\n", settype(D3_H));
+    fprintf(ofile,"/*  @     A     C     G     U   */\n");
+    for (c=1; c<NBPAIRS+1; c++)
+      display_array(dangle3_H_184[c], 5, 5, ofile);
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_INT_11){
+    /* don't print "no pair" entries for interior loop arrays */
+    fprintf(ofile,"\n# %s\n", settype(INT11));
+    { int i,k,l;
+      for (k=1; k<NBPAIRS+1; k++)
+        for (l=1; l<NBPAIRS+1; l++){
+          fprintf(ofile, "/* %2s..%2s */\n", pnames[k], pnames[l]);
+          for (i=0; i<5; i++)
+            display_array(int11_37_184[k][l][i], 5, 5, ofile);
+        }
+    }
+    fprintf(ofile,"\n# %s\n", settype(INT11_H));
+    { int i,k,l;
+      for (k=1; k<NBPAIRS+1; k++)
+        for (l=1; l<NBPAIRS+1; l++){
+          fprintf(ofile, "/* %2s..%2s */\n", pnames[k], pnames[l]);
+          for (i=0; i<5; i++)
+            display_array(int11_H_184[k][l][i],5,5, ofile);
+        }
+    }
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_INT_21){
+    fprintf(ofile,"\n# %s\n", settype(INT21));
+    { int p1, p2, i, j;
+      for (p1=1; p1<NBPAIRS+1; p1++)
+        for (p2=1; p2<NBPAIRS+1; p2++)
+          for (i=0; i<5; i++){
+            fprintf(ofile, "/* %2s.%c..%2s */\n", pnames[p1], bnames[i], pnames[p2]);
+            for (j=0; j<5; j++)
+              display_array(int21_37_184[p1][p2][i][j],5,5, ofile);
+          }
+    }
+    fprintf(ofile,"\n# %s\n", settype(INT21_H));
+    { int p1, p2, i, j;
+      for (p1=1; p1<NBPAIRS+1; p1++)
+        for (p2=1; p2<NBPAIRS+1; p2++)
+          for (i=0; i<5; i++){
+            fprintf(ofile, "/* %2s.%c..%2s */\n", pnames[p1], bnames[i], pnames[p2]);
+            for (j=0; j<5; j++)
+              display_array(int21_H_184[p1][p2][i][j],5,5, ofile);
+          }
+    }
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_INT_22){
+    fprintf(ofile,"\n# %s\n", settype(INT22));
+    { int p1, p2, i, j, k;
+      for (p1=1; p1<NBPAIRS; p1++)
+        for (p2=1; p2<NBPAIRS; p2++)
+          for (i=1; i<5; i++)
+            for (j=1; j<5; j++){
+              fprintf(ofile, "/* %2s.%c%c..%2s */\n", pnames[p1], bnames[i], bnames[j], pnames[p2]);
+              for (k=1; k<5; k++)
+                display_array(int22_37_184[p1][p2][i][j][k]+1,4,5, ofile);
+            }
+    }
+    fprintf(ofile,"\n# %s\n", settype(INT22_H));
+    { int p1, p2, i, j, k;
+      for (p1=1; p1<NBPAIRS; p1++)
+        for (p2=1; p2<NBPAIRS; p2++)
+          for (i=1; i<5; i++)
+            for (j=1; j<5; j++){
+              fprintf(ofile, "/* %2s.%c%c..%2s */\n", pnames[p1], bnames[i], bnames[j], pnames[p2]);
+              for (k=1; k<5; k++)
+                display_array(int22_H_184[p1][p2][i][j][k]+1,4,5, ofile);
+            }
+    }
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_HP){
+    fprintf(ofile,"\n# %s\n", settype(HP));
+    display_array(hairpin37_184, 31, 10, ofile);
+    /* we had no hairpin enthalpies before, so
+    *  we just pretend to have had some with value 0
+    */
+    fprintf(ofile,"\n# %s\n", settype(HP_H));
+    {
+      fprintf(ofile, "   INF   INF   INF");
+      for(c=4;c<=31; c++){
+        fprintf(ofile, "%6d", 0);
+        if(c%10 == 0) fprintf(ofile, "\n");
+      }
+    }
+    fprintf(ofile,"\n");
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_BULGE){
+    fprintf(ofile,"\n# %s\n", settype(B));
+    display_array(bulge37_184, 31, 10, ofile);
+
+    /* we had no bulge enthalpies before, so
+    *  we just pretend to have had some with value 0
+    */
+    fprintf(ofile,"\n# %s\n", settype(B_H));
+    {
+      fprintf(ofile, "   INF");
+      for(c=2;c<=31; c++){
+        fprintf(ofile, "%6d", 0);
+        if(c%10 == 0) fprintf(ofile, "\n");
+      }
+    }
+    fprintf(ofile,"\n");
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_INT){
+    fprintf(ofile,"\n# %s\n", settype(IL));
+    display_array(internal_loop37_184, 31, 10, ofile);
+
+    /* we had no internal_loop enthalpies before, so
+    *  we just pretend to have had some with value 0
+    */
+    fprintf(ofile,"\n# %s\n", settype(IL_H));
+    {
+      fprintf(ofile, "   INF   INF   INF   INF");
+      for(c=5;c<=31; c++){
+        fprintf(ofile, "%6d", 0);
+        if(c%10 == 0) fprintf(ofile, "\n");
+      }
+    }
+    fprintf(ofile,"\n");
+    fprintf(ofile,"\n# %s\n"
+                  "/* Ninio = MIN(max, m*|n1-n2| */\n"
+                  "/*\t    m\t  m_dH     max  */\n"
+                  "\t%6d\t%6d\t%6d\n", settype(NIN), F_ninio37_184[2], 0, MAX_NINIO_184);
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_ML){
+    fprintf(ofile,"\n# %s\n", settype(ML));
+    fprintf(ofile,"/* F = cu*n_unpaired + cc + ci*loop_degree (+TermAU) */\n");
+    fprintf(ofile,"/*\t    cu\t cu_dH\t    cc\t cc_dH\t    ci\t ci_dH  */\n");
+    fprintf(ofile,"\t%6d\t%6d\t%6d\t%6d\t%6d\t%6d\n", ML_BASE37_184, 0, ML_closing37_184, 0, ML_intern37_184, 0);
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_MISC){
+    fprintf(ofile,"\n# %s\n", settype(MISC));
+    fprintf(ofile,"/* all parameters are pairs of 'energy enthalpy' */\n");
+    fprintf(ofile,"/*    DuplexInit     TerminalAU   LXC  */\n");
+    fprintf(ofile,"   %6d %6d %6d %6d   %3.6f %6d\n", DuplexInit_184, 0, TerminalAU_184, 0, lxc37_184, 0);
+  }
+
+  if(options & VRNA_CONVERT_OUTPUT_SPECIAL_HP){
+    fprintf(ofile,"\n# %s\n", settype(TRI));
+    {
+      int base_en = hairpin37_184[3];
+      int base_dH = TETRA_ENTH37_184;
+      for (c=0; c< (int)strlen(Triloops_184)/6; c++){
+        int en = base_en;
+        char bla[5];
+        strncpy(bla, Triloops_184+c*6, 5);
+        int type = pair[(short)encode_char(toupper(bla[0]))][(short)encode_char(toupper(bla[4]))];
+        if(type > 2) en += TerminalAU_184;
+        fprintf(ofile,"\t%.5s %6d %6d\n", Triloops_184+c*6, Triloop_E37_184[c] + en, base_dH);
+      }
+    }
+
+    /* since the old hairpin loop function treated the tabulated tetraloop energy as bonus
+    *  and the new one takes this tabulated energy as a total energy, we have to compute some
+    *  things now...
+    */
+    fprintf(ofile,"\n# %s\n", settype(TL));
+    {
+      int base_en = hairpin37_184[4];
+      int base_dH = TETRA_ENTH37_184;
+      for (c=0; c< (int)strlen(Tetraloops_184)/7; c++){
+        char bla[6];
+        int en = base_en;
+        int dH = base_dH;
+        strncpy(bla, Tetraloops_184+c*7, 6);
+        short si  = (short)encode_char(toupper(bla[1]));
+        short sj  = (short)encode_char(toupper(bla[4]));
+        int type  = pair[(short)encode_char(toupper(bla[0]))][(short)encode_char(toupper(bla[5]))];
+        en   += mismatchH37_184[type][si][sj];
+        dH   += mism_H_184[type][si][sj];
+        fprintf(ofile,"\t%.6s %6d %6d\n", Tetraloops_184+c*7, en + TETRA_ENERGY37_184[c], dH);
+      }
+    }
+    fprintf(ofile,"\n# %s\n", settype(HEX));
+    {
+      fprintf(ofile, "\n");
+    }
+  }
+
+  fprintf(ofile, "\n# %s\n", settype(QUIT));
+}
+
+PRIVATE void check_symmetry(void) {
+  int i,j,k,l;
+
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      if (stack37_184[i][j] != stack37_184[j][i])
+        vrna_message_warning("stacking energies not symmetric");
+
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      if (enthalpies_184[i][j] != enthalpies_184[j][i])
+        vrna_message_warning("stacking enthalpies not symmetric");
+
+
+  /* interior 1x1 loops */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++)
+          if (int11_37_184[i][j][k][l] != int11_37_184[j][i][l][k])
+            vrna_message_warning("int11 energies not symmetric");
+
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++)
+          if (int11_H_184[i][j][k][l] != int11_H_184[j][i][l][k])
+            vrna_message_warning("int11 enthalpies not symmetric");
+
+  /* interior 2x2 loops */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          int m,n;
+          for (m=0; m<5; m++)
+            for (n=0; n<5; n++)
+              if (int22_37_184[i][j][k][l][m][n] != int22_37_184[j][i][m][n][k][l])
+                vrna_message_warning("int22 energies not symmetric");
+        }
+
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          int m,n;
+          for (m=0; m<5; m++)
+            for (n=0; n<5; n++)
+              if (int22_H_184[i][j][k][l][m][n] != int22_H_184[j][i][m][n][k][l])
+                vrna_message_warning("int22 enthalpies not symmetric: %d %d %d %d %d %d", i,j,k,l,m,n);
+        }
+}
diff --git a/C/ViennaRNA/convert_epars.h b/C/ViennaRNA/convert_epars.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/convert_epars.h
@@ -0,0 +1,96 @@
+#ifndef VIENNA_RNA_PACKAGE_CONVERT_EPARS_H
+#define VIENNA_RNA_PACKAGE_CONVERT_EPARS_H
+
+/**
+ *  @file convert_epars.h
+ *  @ingroup energy_parameters
+ *  @brief Functions and definitions for energy parameter file format conversion
+ */
+
+/**
+ *  @addtogroup energy_parameters_convert
+ *  @brief      Convert energy parameter files into the latest format
+ *
+ *  To preserve some backward compatibility the RNAlib also provides
+ *  functions to convert energy parameter files from the format used
+ *  in version 1.4-1.8 into the new format used since version 2.0
+ *
+ *  @{
+ *  @ingroup energy_parameters_convert
+ */
+
+/** Flag to indicate printing of a complete parameter set */
+#define VRNA_CONVERT_OUTPUT_ALL           1U
+/** Flag to indicate printing of hairpin contributions */
+#define VRNA_CONVERT_OUTPUT_HP            2U
+/** Flag to indicate printing of base pair stack contributions */
+#define VRNA_CONVERT_OUTPUT_STACK         4U
+/** Flag to indicate printing of  hairpin mismatch contribution  */
+#define VRNA_CONVERT_OUTPUT_MM_HP         8U
+/** Flag to indicate printing of  interior loop mismatch contribution  */
+#define VRNA_CONVERT_OUTPUT_MM_INT        16U
+/** Flag to indicate printing of  1:n interior loop mismatch contribution  */
+#define VRNA_CONVERT_OUTPUT_MM_INT_1N     32U
+/** Flag to indicate printing of  2:3 interior loop mismatch contribution  */
+#define VRNA_CONVERT_OUTPUT_MM_INT_23     64U
+/** Flag to indicate printing of  multi loop mismatch contribution  */
+#define VRNA_CONVERT_OUTPUT_MM_MULTI      128U
+/** Flag to indicate printing of  exterior loop mismatch contribution  */
+#define VRNA_CONVERT_OUTPUT_MM_EXT        256U
+/** Flag to indicate printing of  5' dangle conctribution  */
+#define VRNA_CONVERT_OUTPUT_DANGLE5       512U
+/** Flag to indicate printing of  3' dangle contribution  */
+#define VRNA_CONVERT_OUTPUT_DANGLE3       1024U
+/** Flag to indicate printing of  1:1 interior loop contribution  */
+#define VRNA_CONVERT_OUTPUT_INT_11        2048U
+/** Flag to indicate printing of  2:1 interior loop contribution */
+#define VRNA_CONVERT_OUTPUT_INT_21        4096U
+/** Flag to indicate printing of  2:2 interior loop contribution  */
+#define VRNA_CONVERT_OUTPUT_INT_22        8192U
+/** Flag to indicate printing of  bulge loop contribution  */
+#define VRNA_CONVERT_OUTPUT_BULGE         16384U
+/** Flag to indicate printing of  interior loop contribution  */
+#define VRNA_CONVERT_OUTPUT_INT           32768U
+/** Flag to indicate printing of  multi loop contribution  */
+#define VRNA_CONVERT_OUTPUT_ML            65536U
+/** Flag to indicate printing of  misc contributions (such as terminalAU)  */
+#define VRNA_CONVERT_OUTPUT_MISC          131072U
+/** Flag to indicate printing of  special hairpin contributions (tri-, tetra-, hexa-loops)  */
+#define VRNA_CONVERT_OUTPUT_SPECIAL_HP    262144U
+/** Flag to indicate printing of  given parameters only\n\note This option overrides all other output options, except #VRNA_CONVERT_OUTPUT_DUMP ! */
+#define VRNA_CONVERT_OUTPUT_VANILLA       524288U
+/** Flag to indicate printing of  interior loop asymmetry contribution  */
+#define VRNA_CONVERT_OUTPUT_NINIO         1048576U
+/** Flag to indicate dumping the energy contributions from the library instead of an input file  */
+#define VRNA_CONVERT_OUTPUT_DUMP          2097152U
+
+/**
+ *  Convert/dump a Vienna 1.8.4 formatted energy parameter file
+ * 
+ *  The options argument allows one to control the different output modes.\n
+ *  Currently available options are:\n
+ *  #VRNA_CONVERT_OUTPUT_ALL, #VRNA_CONVERT_OUTPUT_HP, #VRNA_CONVERT_OUTPUT_STACK\n
+ *  #VRNA_CONVERT_OUTPUT_MM_HP, #VRNA_CONVERT_OUTPUT_MM_INT, #VRNA_CONVERT_OUTPUT_MM_INT_1N\n
+ *  #VRNA_CONVERT_OUTPUT_MM_INT_23, #VRNA_CONVERT_OUTPUT_MM_MULTI, #VRNA_CONVERT_OUTPUT_MM_EXT\n
+ *  #VRNA_CONVERT_OUTPUT_DANGLE5, #VRNA_CONVERT_OUTPUT_DANGLE3, #VRNA_CONVERT_OUTPUT_INT_11\n
+ *  #VRNA_CONVERT_OUTPUT_INT_21, #VRNA_CONVERT_OUTPUT_INT_22, #VRNA_CONVERT_OUTPUT_BULGE\n
+ *  #VRNA_CONVERT_OUTPUT_INT, #VRNA_CONVERT_OUTPUT_ML, #VRNA_CONVERT_OUTPUT_MISC\n
+ *  #VRNA_CONVERT_OUTPUT_SPECIAL_HP, #VRNA_CONVERT_OUTPUT_VANILLA, #VRNA_CONVERT_OUTPUT_NINIO\n
+ *  #VRNA_CONVERT_OUTPUT_DUMP
+ * 
+ *  The defined options are fine for bitwise compare- and assignment-operations,
+ *  e. g.: pass a collection of options as a single value like this:
+ *  @verbatim convert_parameter_file(ifile, ofile, option_1 | option_2 | option_n) @endverbatim
+ * 
+ *  @param iname    The input file name (If NULL input is read from stdin)
+ *  @param oname    The output file name (If NULL output is written to stdout)
+ *  @param options  The options (as described above)
+ */
+void convert_parameter_file(const char *iname,
+                            const char *oname,
+                            unsigned int options);
+
+/**
+ *  @}
+ */
+#endif
diff --git a/C/ViennaRNA/data_structures.c b/C/ViennaRNA/data_structures.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/data_structures.c
@@ -0,0 +1,787 @@
+/** \file data_structures.c **/
+
+/*
+                  Data structure creation/destruction
+
+                  This file contains everything which is necessary to
+                  obtain and destroy datastructures used in the folding
+                  recurrences throughout the VienneRNA paclage
+
+                  c Ronny Lorenx
+
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/structure_utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/data_structures.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/aln_util.h"
+#include "ViennaRNA/ribo.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/part_func.h"
+#include "ViennaRNA/cofold.h"
+#include "ViennaRNA/mm.h"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+/*
+#################################
+# PRIVATE MACROS                #
+#################################
+*/
+
+#define WITH_PTYPE          1L    /* passed to set_fold_compound() to indicate that we need to set vc->ptype */
+#define WITH_PTYPE_COMPAT   2L    /* passed to set_fold_compound() to indicate that we need to set vc->ptype_compat */
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE void  set_fold_compound(vrna_fold_compound_t *vc, vrna_md_t *md_p, unsigned int options, unsigned int aux);
+PRIVATE void  make_pscores(vrna_fold_compound_t *vc);
+PRIVATE void  add_params(vrna_fold_compound_t *vc, vrna_md_t *md_p, unsigned int options);
+
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC  void
+vrna_fold_compound_free(vrna_fold_compound_t *vc){
+
+  int s;
+
+  if(vc){
+
+    /* first destroy common attributes */
+    vrna_mx_mfe_free(vc);
+    vrna_mx_pf_free(vc);
+    free(vc->iindx);
+    free(vc->jindx);
+    free(vc->params);
+    free(vc->exp_params);
+    free(vc->strand_number);
+    vrna_hc_free(vc->hc);
+    vrna_ud_remove(vc);
+
+    /* now distinguish the vc type */
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     free(vc->sequence);
+                                    free(vc->sequence_encoding);
+                                    free(vc->sequence_encoding2);
+                                    free(vc->ptype);
+                                    free(vc->ptype_pf_compat);
+                                    vrna_sc_free(vc->sc);
+                                    break;
+      case VRNA_FC_TYPE_COMPARATIVE:  for(s=0;s<vc->n_seq;s++){
+                                      free(vc->sequences[s]);
+                                      free(vc->S[s]);
+                                      free(vc->S5[s]);
+                                      free(vc->S3[s]);
+                                      free(vc->Ss[s]);
+                                      free(vc->a2s[s]);
+                                    }
+                                    free(vc->sequences);
+                                    free(vc->cons_seq);
+                                    free(vc->S_cons);
+                                    free(vc->S);
+                                    free(vc->S5);
+                                    free(vc->S3);
+                                    free(vc->Ss);
+                                    free(vc->a2s);
+                                    free(vc->pscore);
+                                    free(vc->pscore_pf_compat);
+                                    if(vc->scs){
+                                      for(s=0;s<vc->n_seq;s++)
+                                        vrna_sc_free(vc->scs[s]);
+                                      free(vc->scs);
+                                    }
+                                    break;
+      default:                      /* do nothing */
+                                    break;
+    }
+
+    /* free Distance Class Partitioning stuff (should be NULL if not used) */
+    free(vc->reference_pt1);
+    free(vc->reference_pt2);
+    free(vc->referenceBPs1);
+    free(vc->referenceBPs2);
+    free(vc->bpdist);
+    free(vc->mm1);
+    free(vc->mm2);
+
+    /* free local folding related stuff (should be NULL if not used) */
+    if(vc->ptype_local){
+      for (s=0; (s < vc->window_size + 5) && (s <= vc->length); s++){
+        free(vc->ptype_local[s]);
+      }
+      free(vc->ptype_local);
+    }
+
+    if(vc->free_auxdata)
+      vc->free_auxdata(vc->auxdata);
+
+    free(vc);
+  }
+}
+
+
+PUBLIC vrna_fold_compound_t *
+vrna_fold_compound( const char *sequence,
+                    vrna_md_t *md_p,
+                    unsigned int options){
+
+  int i;
+  unsigned int        length, aux_options;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t           md;
+
+  if(sequence == NULL) return NULL;
+
+  /* sanity check */
+  length = strlen(sequence);
+  if(length == 0)
+    vrna_message_error("vrna_fold_compound@data_structures.c: sequence length must be greater 0");
+
+  if(length > vrna_sequence_length_max(options))
+    vrna_message_error("vrna_fold_compound@data_structures.c: sequence length of %d exceeds addressable range", length);
+
+  vc            = vrna_alloc(sizeof(vrna_fold_compound_t));
+  vc->type      = VRNA_FC_TYPE_SINGLE;
+  vc->length    = length;
+  vc->sequence  = strdup(sequence);
+  aux_options   = 0L;
+
+
+  /* get a copy of the model details */
+  if(md_p)
+    md = *md_p;
+  else
+    vrna_md_set_default(&md);
+
+  if(options & VRNA_OPTION_WINDOW){ /* sliding window structure prediction */
+    if(md.window_size <= 0)
+      md.window_size = (int)vc->length;
+    else if(md.window_size > (int)vc->length)
+      md.window_size = (int)vc->length;
+
+    vc->window_size = md.window_size;
+
+    if((md.max_bp_span <= 0) || (md.max_bp_span > md.window_size))
+      md.max_bp_span = md.window_size;
+
+    set_fold_compound(vc, &md, options, aux_options);
+
+    vc->ptype_local = vrna_alloc(sizeof(char *)*(vc->length+1));
+    for (i = (int)vc->length; ( i > (int)vc->length - vc->window_size - 5) && (i >= 0); i--){
+      vc->ptype_local[i] = vrna_alloc(sizeof(char)*(vc->window_size+5));
+    }
+
+    if(!(options & VRNA_OPTION_EVAL_ONLY)){
+      /* add default hard constraints */
+      /* vrna_hc_init(vc); */ /* no hard constraints in Lfold, yet! */
+
+      /* add DP matrices */
+      vrna_mx_add(vc, VRNA_MX_WINDOW, options);
+    }
+  } else { /* regular global structure prediction */
+
+    /* set window size to entire sequence */
+    md.window_size = (int)vc->length;
+
+    aux_options |= WITH_PTYPE;
+
+    if(options & VRNA_OPTION_PF)
+      aux_options |= WITH_PTYPE_COMPAT;
+
+    set_fold_compound(vc, &md, options, aux_options);
+
+    if(!(options & VRNA_OPTION_EVAL_ONLY)){
+      /* add default hard constraints */
+      vrna_hc_init(vc);
+
+      /* add DP matrices (if required) */
+      vrna_mx_add(vc, VRNA_MX_DEFAULT, options);
+    }
+  }
+
+  return vc;
+}
+
+PUBLIC vrna_fold_compound_t *
+vrna_fold_compound_comparative( const char **sequences,
+                                vrna_md_t *md_p,
+                                unsigned int options){
+
+  int s, n_seq, length;
+  vrna_fold_compound_t *vc;
+  vrna_md_t           md;
+  unsigned int        aux_options;
+
+  aux_options = 0U;
+ 
+  if(sequences == NULL) return NULL;
+
+  for(s=0;sequences[s];s++); /* count the sequences */
+
+  n_seq = s;
+
+  length = strlen(sequences[0]);
+  /* sanity check */
+  if(length == 0)
+    vrna_message_error("vrna_fold_compound_comparative@data_structures.c: sequence length must be greater 0");
+  else if(length > vrna_sequence_length_max(options))
+    vrna_message_error("vrna_fold_compound_comparative@data_structures.c: sequence length of %d exceeds addressable range", length);
+
+  for(s = 0; s < n_seq; s++)
+    if(strlen(sequences[s]) != length)
+      vrna_message_error("vrna_fold_compound_comparative@data_structures.c: uneqal sequence lengths in alignment");
+
+  vc            = vrna_alloc(sizeof(vrna_fold_compound_t));
+  vc->type      = VRNA_FC_TYPE_COMPARATIVE;
+
+  vc->n_seq     = n_seq;
+  vc->length    = length;
+  vc->sequences = vrna_alloc(sizeof(char *) * (vc->n_seq + 1));
+  for(s = 0; sequences[s]; s++)
+    vc->sequences[s] = strdup(sequences[s]);
+
+  /* get a copy of the model details */
+  if(md_p)
+    md = *md_p;
+  else /* this fallback relies on global parameters and thus is not threadsafe */
+    vrna_md_set_default(&md);
+
+
+  aux_options |= WITH_PTYPE;
+
+  if(options & VRNA_OPTION_PF)
+    aux_options |= WITH_PTYPE_COMPAT;
+
+  set_fold_compound(vc, &md, options, aux_options);
+
+  make_pscores(vc);
+
+  if(!(options & VRNA_OPTION_EVAL_ONLY)){
+    /* add default hard constraints */
+    vrna_hc_init(vc);
+
+    /* add DP matrices (if required) */
+    vrna_mx_add(vc, VRNA_MX_DEFAULT, options);
+  }
+
+  return vc;
+}
+
+PUBLIC vrna_fold_compound_t *
+vrna_fold_compound_TwoD(const char *sequence,
+                      const char *s1,
+                      const char *s2,
+                      vrna_md_t *md_p,
+                      unsigned int options){
+
+  int                 length, l, turn;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t           md;
+
+
+  if(sequence == NULL) return NULL;
+
+  /* sanity check */
+  length = strlen(sequence);
+  if(length == 0)
+    vrna_message_error("vrna_fold_compound_TwoD: sequence length must be greater 0");
+  else if(length > vrna_sequence_length_max(options))
+    vrna_message_error("vrna_fold_compound_TwoD@data_structures.c: sequence length of %d exceeds addressable range", length);
+
+  l = strlen(s1);
+  if(l != length)
+    vrna_message_error("vrna_fold_compound_TwoD: sequence and s1 differ in length");
+
+  l = strlen(s2);
+  if(l != length)
+    vrna_message_error("vrna_fold_compound_TwoD: sequence and s2 differ in length");
+
+  vc                = vrna_alloc(sizeof(vrna_fold_compound_t));
+  vc->type          = VRNA_FC_TYPE_SINGLE;
+  vc->length        = length;
+  vc->sequence      = strdup(sequence);
+
+  /* get a copy of the model details */
+  if(md_p)
+    md = *md_p;
+  else /* this fallback relies on global parameters and thus is not threadsafe */
+    vrna_md_set_default(&md);
+
+  /* always make uniq ML decomposition ! */
+  md.uniq_ML      = 1;
+  md.compute_bpp  = 0;
+
+  set_fold_compound(vc, &md, options, WITH_PTYPE | WITH_PTYPE_COMPAT);
+
+  if(!(options & VRNA_OPTION_EVAL_ONLY)){
+    vrna_hc_init(vc); /* add default hard constraints */
+
+    /* add DP matrices */
+    vrna_mx_add(vc, VRNA_MX_2DFOLD, options);
+  }
+
+  /* set all fields that are unique to Distance class partitioning... */
+  turn  = vc->params->model_details.min_loop_size;
+  vc->reference_pt1 = vrna_ptable(s1);
+  vc->reference_pt2 = vrna_ptable(s2);
+  vc->referenceBPs1 = vrna_refBPcnt_matrix(vc->reference_pt1, turn);
+  vc->referenceBPs2 = vrna_refBPcnt_matrix(vc->reference_pt2, turn);
+  vc->bpdist        = vrna_refBPdist_matrix(vc->reference_pt1, vc->reference_pt2, turn);
+  /* compute maximum matching with reference structure 1 disallowed */
+  vc->mm1           = maximumMatchingConstraint(vc->sequence, vc->reference_pt1);
+  /* compute maximum matching with reference structure 2 disallowed */
+  vc->mm2           = maximumMatchingConstraint(vc->sequence, vc->reference_pt2);
+
+  vc->maxD1         = vc->mm1[vc->iindx[1]-length] + vc->referenceBPs1[vc->iindx[1]-length];
+  vc->maxD2         = vc->mm2[vc->iindx[1]-length] + vc->referenceBPs2[vc->iindx[1]-length];
+
+  return vc;
+}
+
+PUBLIC void
+vrna_fold_compound_add_auxdata( vrna_fold_compound_t *vc,
+                                void *data,
+                                vrna_callback_free_auxdata *f){
+
+  if(vc && data){
+
+    if(vc->free_auxdata) /* free pre-existing auxdata */
+      vc->free_auxdata(vc->auxdata);
+
+    vc->auxdata       = data;
+    vc->free_auxdata  = f;
+  }
+}
+
+PUBLIC void
+vrna_fold_compound_add_callback(vrna_fold_compound_t *vc,
+                                vrna_callback_recursion_status *f){
+
+  if(vc && f){
+    vc->stat_cb       = f;
+  }
+}
+
+PUBLIC int
+vrna_fold_compound_prepare( vrna_fold_compound_t *vc,
+                            unsigned int options){
+  int ret = 1; /* success */
+
+  /* check maximum sequence length restrictions */
+  if(vc->length > vrna_sequence_length_max(options)){
+    vrna_message_warning("vrna_fold_compound_prepare@data_structures.c: sequence length of %d exceeds addressable range", vc->length);
+    return 0;
+  }
+
+  if(options & VRNA_OPTION_MFE){   /* prepare for MFE computation */
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     if(!vc->ptype)
+                                      if(!(options & VRNA_OPTION_WINDOW))
+                                        vc->ptype = vrna_ptypes(vc->sequence_encoding2,
+                                                                &(vc->params->model_details));
+                                    break;
+      case VRNA_FC_TYPE_COMPARATIVE:  break;
+      default:                      break;
+    }
+
+
+  }
+
+  if(options & VRNA_OPTION_PF){   /* prepare for partition function computation */
+
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     /* get pre-computed Boltzmann factors if not present*/
+                                    if(!vc->exp_params)
+                                      vc->exp_params      = vrna_exp_params(&(vc->params->model_details));
+
+                                    if(!vc->ptype)
+                                      vc->ptype           = vrna_ptypes(vc->sequence_encoding2, &(vc->exp_params->model_details));
+#ifdef VRNA_BACKWARD_COMPAT
+                                    /* backward compatibility ptypes */
+                                    if(!vc->ptype_pf_compat)
+                                      vc->ptype_pf_compat = get_ptypes(vc->sequence_encoding2, &(vc->exp_params->model_details), 1);
+#endif
+                                    /* get precomputed Boltzmann factors for soft-constraints (if any) */
+                                    if(vc->sc){
+                                      if(!vc->sc->exp_energy_up)
+                                        vrna_sc_set_up(vc, NULL, VRNA_OPTION_PF);
+                                      if(!vc->sc->exp_energy_bp)
+                                        vrna_sc_set_bp(vc, NULL, VRNA_OPTION_PF);
+                                      if(!vc->sc->exp_energy_stack)
+                                        vrna_sc_add_SHAPE_deigan(vc, NULL, 0, 0, VRNA_OPTION_PF);
+                                    }
+
+                                    if(vc->domains_up) /* turn on unique ML decomposition with qm1 array */
+                                      vc->exp_params->model_details.uniq_ML = 1;
+
+                                    break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:  /* get pre-computed Boltzmann factors if not present*/
+                                    if(!vc->exp_params)
+                                      vc->exp_params  = vrna_exp_params_comparative(vc->n_seq, &(vc->params->model_details));
+                                    break;
+
+      default:                      break;
+    }
+  }
+
+  /* Add DP matrices, if not they are not present or do not fit current settings */
+  vrna_mx_prepare(vc, options);
+
+  return ret;
+}
+
+
+#ifndef VRNA_DISABLE_C11_FEATURES
+PUBLIC void
+vrna_C11_features(void){
+
+  __asm("nop");
+}
+#endif
+
+/*
+#####################################
+# BEGIN OF STATIC HELPER FUNCTIONS  #
+#####################################
+*/
+
+PRIVATE void
+add_params( vrna_fold_compound_t *vc,
+            vrna_md_t *md_p,
+            unsigned int options){
+
+  /* ALWAYS add regular energy parameters */
+  vc->params = vrna_params(md_p);
+
+  if(options & VRNA_OPTION_PF){
+    vc->exp_params  = (vc->type == VRNA_FC_TYPE_SINGLE) ? \
+                        vrna_exp_params(md_p) : \
+                        vrna_exp_params_comparative(vc->n_seq, md_p);
+  }
+
+}
+
+PRIVATE void
+set_fold_compound(vrna_fold_compound_t *vc,
+                  vrna_md_t *md_p,
+                  unsigned int options,
+                  unsigned int aux){
+
+
+  char *sequence, **sequences;
+  unsigned int        length, s, i;
+  int                 cp;                     /* cut point for cofold */
+  char                *seq, *seq2;
+
+  sequence          = NULL;
+  sequences         = NULL;
+  cp                = -1;
+
+  /* some default init values */
+  vc->params        = NULL;
+  vc->exp_params    = NULL;
+  vc->matrices      = NULL;
+  vc->exp_matrices  = NULL;
+  vc->hc            = NULL;
+  vc->auxdata       = NULL;
+  vc->free_auxdata  = NULL;
+
+  vc->strand_number = NULL;
+  vc->domains_struc = NULL;
+  vc->domains_up    = NULL;
+  vc->aux_grammar   = NULL;
+
+  switch(vc->type){
+    case VRNA_FC_TYPE_SINGLE:     sequence  = vc->sequence;
+
+                                  seq2 = strdup(sequence);
+                                  seq = vrna_cut_point_remove(seq2, &cp); /*  splice out the '&' if concatenated sequences and
+                                                                        reset cp... this should also be safe for
+                                                                        single sequences */
+                                  vc->cutpoint            = cp;
+
+                                  if((cp > 0) && (md_p->min_loop_size == TURN))
+                                    md_p->min_loop_size = 0;  /* is it safe to set this here? */
+
+                                  free(vc->sequence);
+                                  vc->sequence            = seq;
+                                  vc->length              = length = strlen(seq);
+                                  vc->sequence_encoding   = vrna_seq_encode(seq, md_p);
+                                  vc->sequence_encoding2  = vrna_seq_encode_simple(seq, md_p);
+
+                                  vc->strand_number       = (unsigned int *)vrna_alloc(sizeof(unsigned int) * (vc->length + 1));
+                                  if (cp > 0)
+                                    for (s = i = 0; i <= vc->length; i++) {
+                                      if (i == vc->cutpoint)
+                                        s++;
+                                      vc->strand_number[i] = s;
+                                    }
+
+                                  if(!(options & VRNA_OPTION_EVAL_ONLY)){
+                                    vc->ptype               = (aux & WITH_PTYPE) ? vrna_ptypes(vc->sequence_encoding2, md_p) : NULL;
+                                    /* backward compatibility ptypes */
+                                    vc->ptype_pf_compat     = (aux & WITH_PTYPE_COMPAT) ? get_ptypes(vc->sequence_encoding2, md_p, 1) : NULL;
+                                  } else {
+                                    vc->ptype           = NULL;
+                                    vc->ptype_pf_compat = NULL;
+                                  }
+                                  vc->sc                  = NULL;
+                                  free(seq2);
+                                  break;
+
+    case VRNA_FC_TYPE_COMPARATIVE:  sequences     = vc->sequences;
+
+                                  vc->length    = length = vc->length;
+
+                                  vc->strand_number       = (unsigned int *)vrna_alloc(sizeof(unsigned int) * (vc->length + 1));
+
+                                  vc->cons_seq  = consensus((const char **)sequences);
+                                  vc->S_cons    = vrna_seq_encode_simple(vc->cons_seq, md_p);
+
+                                  vc->pscore    = vrna_alloc(sizeof(int)*((length*(length+1))/2+2));
+                                  /* backward compatibility ptypes */
+                                  vc->pscore_pf_compat = (aux & WITH_PTYPE_COMPAT) ? vrna_alloc(sizeof(int)*((length*(length+1))/2+2)) : NULL;
+
+                                  oldAliEn = vc->oldAliEn  = md_p->oldAliEn;
+
+                                  vc->S   = vrna_alloc((vc->n_seq+1) * sizeof(short *));
+                                  vc->S5  = vrna_alloc((vc->n_seq+1) * sizeof(short *));
+                                  vc->S3  = vrna_alloc((vc->n_seq+1) * sizeof(short *));
+                                  vc->a2s = vrna_alloc((vc->n_seq+1) * sizeof(unsigned short *));
+                                  vc->Ss  = vrna_alloc((vc->n_seq+1) * sizeof(char *));
+
+                                  for (s = 0; s < vc->n_seq; s++) {
+                                    vrna_aln_encode(vc->sequences[s],
+                                                    &(vc->S[s]),
+                                                    &(vc->S5[s]),
+                                                    &(vc->S3[s]),
+                                                    &(vc->Ss[s]),
+                                                    &(vc->a2s[s]),
+                                                    md_p);
+                                  }
+                                  vc->S5[vc->n_seq]  = NULL;
+                                  vc->S3[vc->n_seq]  = NULL;
+                                  vc->a2s[vc->n_seq] = NULL;
+                                  vc->Ss[vc->n_seq]  = NULL;
+                                  vc->S[vc->n_seq]   = NULL;
+
+                                  vc->scs       = NULL;
+                                  break;
+
+    default:                      /* do nothing ? */
+                                  break;
+  }
+
+  if(vc->length <= vrna_sequence_length_max(options)){
+    vc->iindx = vrna_idx_row_wise(vc->length);
+    vc->jindx = vrna_idx_col_wise(vc->length);
+  } else {
+    vc->iindx = NULL;
+    vc->jindx = NULL;
+  }
+
+  /* now come the energy parameters */
+  add_params(vc, md_p, options);
+
+}
+
+PRIVATE void
+make_pscores(vrna_fold_compound_t *vc){
+
+  /* calculate co-variance bonus for each pair depending on  */
+  /* compensatory/consistent mutations and incompatible seqs */
+  /* should be 0 for conserved pairs, >0 for good pairs      */
+
+#define NONE -10000 /* score for forbidden pairs */
+
+  char *structure = NULL;
+  int i,j,k,l,s, max_span, turn;
+  float **dm;
+  int olddm[7][7]={{0,0,0,0,0,0,0}, /* hamming distance between pairs */
+                  {0,0,2,2,1,2,2} /* CG */,
+                  {0,2,0,1,2,2,2} /* GC */,
+                  {0,2,1,0,2,1,2} /* GU */,
+                  {0,1,2,2,0,2,1} /* UG */,
+                  {0,2,2,1,2,0,2} /* AU */,
+                  {0,2,2,2,1,2,0} /* UA */};
+
+  short           **S         = vc->S;
+  char            **AS        = vc->sequences;
+  int             n_seq       = vc->n_seq;
+  vrna_md_t       *md         = (vc->params) ? &(vc->params->model_details) : &(vc->exp_params->model_details);
+  int             *pscore     = vc->pscore;     /* precomputed array of pair types */             
+  int             *indx       = vc->jindx;                                             
+  int             *my_iindx   = vc->iindx;                                             
+  int             n           = vc->length;                                            
+
+  turn    = md->min_loop_size;
+
+  if (md->ribo) {
+    if (RibosumFile !=NULL) dm=readribosum(RibosumFile);
+    else dm=get_ribosum((const char **)AS, n_seq, n);
+  }
+  else { /*use usual matrix*/
+    dm = vrna_alloc(7*sizeof(float*));
+    for (i=0; i<7;i++) {
+      dm[i] = vrna_alloc(7*sizeof(float));
+      for (j=0; j<7; j++)
+        dm[i][j] = (float) olddm[i][j];
+    }
+  }
+
+  max_span = md->max_bp_span;
+  if((max_span < turn+2) || (max_span > n))
+    max_span = n;
+  for (i=1; i<n; i++) {
+    for (j=i+1; (j<i+turn+1) && (j<=n); j++)
+      pscore[indx[j]+i] = NONE;
+    for (j=i+turn+1; j<=n; j++) {
+      int pfreq[8]={0,0,0,0,0,0,0,0};
+      double score;
+      for (s=0; s<n_seq; s++) {
+        int type;
+        if (S[s][i]==0 && S[s][j]==0) type = 7; /* gap-gap  */
+        else {
+          if ((AS[s][i] == '~')||(AS[s][j] == '~')) type = 7;
+          else type = md->pair[S[s][i]][S[s][j]];
+        }
+        pfreq[type]++;
+      }
+      if (pfreq[0]*2+pfreq[7]>n_seq) { pscore[indx[j]+i] = NONE; continue;}
+      for (k=1,score=0; k<=6; k++) /* ignore pairtype 7 (gap-gap) */
+        for (l=k; l<=6; l++)
+          score += pfreq[k]*pfreq[l]*dm[k][l];
+      /* counter examples score -1, gap-gap scores -0.25   */
+      pscore[indx[j]+i] = md->cv_fact *
+        ((UNIT*score)/n_seq - md->nc_fact*UNIT*(pfreq[0] + pfreq[7]*0.25));
+
+      if((j - i + 1) > max_span){
+        pscore[indx[j]+i] = NONE;
+      }
+    }
+  }
+
+  if (md->noLP) /* remove unwanted pairs */
+    for (k=1; k<n-turn-1; k++)
+      for (l=1; l<=2; l++) {
+        int type,ntype=0,otype=0;
+        i=k; j = i+turn+l;
+        type = pscore[indx[j]+i];
+        while ((i>=1)&&(j<=n)) {
+          if ((i>1)&&(j<n)) ntype = pscore[indx[j+1]+i-1];
+          if ((otype<md->cv_fact*MINPSCORE)&&(ntype<md->cv_fact*MINPSCORE))  /* too many counterexamples */
+            pscore[indx[j]+i] = NONE; /* i.j can only form isolated pairs */
+          otype =  type;
+          type  = ntype;
+          i--; j++;
+        }
+      }
+
+
+  if (fold_constrained&&(structure!=NULL)) {
+    int psij, hx, hx2, *stack, *stack2;
+    stack = vrna_alloc(sizeof(int)*(n+1));
+    stack2 = vrna_alloc(sizeof(int)*(n+1));
+
+    for(hx=hx2=0, j=1; j<=n; j++) {
+      switch (structure[j-1]) {
+      case 'x': /* can't pair */
+        for (l=1; l<j-turn; l++) pscore[indx[j]+l] = NONE;
+        for (l=j+turn+1; l<=n; l++) pscore[indx[l]+j] = NONE;
+        break;
+      case '(':
+        stack[hx++]=j;
+        /* fallthrough */
+      case '[':
+        stack2[hx2++]=j;
+        /* fallthrough */
+      case '<': /* pairs upstream */
+        for (l=1; l<j-turn; l++) pscore[indx[j]+l] = NONE;
+        break;
+      case ']':
+        if (hx2<=0) {
+          vrna_message_error("unbalanced brackets in constraints\n%s", structure);
+        }
+        i = stack2[--hx2];
+        pscore[indx[j]+i]=NONE;
+        break;
+      case ')':
+        if (hx<=0) {
+          vrna_message_error("unbalanced brackets in constraints\n%s", structure);
+        }
+        i = stack[--hx];
+        psij = pscore[indx[j]+i]; /* store for later */
+        for (k=j; k<=n; k++)
+          for (l=i; l<=j; l++)
+            pscore[indx[k]+l] = NONE;
+        for (l=i; l<=j; l++)
+          for (k=1; k<=i; k++)
+            pscore[indx[l]+k] = NONE;
+        for (k=i+1; k<j; k++)
+          pscore[indx[k]+i] = pscore[indx[j]+k] = NONE;
+        pscore[indx[j]+i] = (psij>0) ? psij : 0;
+        /* fallthrough */
+      case '>': /* pairs downstream */
+        for (l=j+turn+1; l<=n; l++) pscore[indx[l]+j] = NONE;
+        break;
+      }
+    }
+    if (hx!=0) {
+      vrna_message_error("unbalanced brackets in constraint string\n%s", structure);
+    }
+    free(stack); free(stack2);
+  }
+  /*free dm */
+  for (i=0; i<7;i++) {
+    free(dm[i]);
+  }
+  free(dm);
+
+  /* copy over pscores for backward compatibility */
+  if(vc->pscore_pf_compat){
+    for(i = 1; i < n; i++)
+      for(j = i; j <= n; j++){
+        vc->pscore_pf_compat[my_iindx[i] - j] = (short)pscore[indx[j] + i];
+      }
+  }
+
+}
diff --git a/C/ViennaRNA/data_structures.h b/C/ViennaRNA/data_structures.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/data_structures.h
@@ -0,0 +1,850 @@
+#ifndef VIENNA_RNA_PACKAGE_DATA_STRUCTURES_H
+#define VIENNA_RNA_PACKAGE_DATA_STRUCTURES_H
+
+/**
+ *  @file     data_structures.h
+ *  @ingroup  data_structures
+ *  @brief    Various data structures and pre-processor macros
+ */
+
+/**
+ *  @addtogroup   data_structures
+ *  @brief All datastructures and typedefs shared among the Vienna RNA Package can be found here
+ *
+ *  @{
+ *  @ingroup data_structures
+ */
+
+/* below are several convenience typedef's we use throughout the ViennaRNA library */
+
+/** @brief Typename for the fold_compound data structure #vrna_fc_s
+ *  @ingroup fold_compound
+ */
+typedef struct vrna_fc_s        vrna_fold_compound_t;
+
+/** @brief Typename for the base pair repesenting data structure #vrna_basepair_s */
+typedef struct vrna_basepair_s  vrna_basepair_t;
+
+/** @brief Typename for the base pair list repesenting data structure #vrna_plist_s */
+typedef struct vrna_plist_s     vrna_plist_t;
+
+/** @brief Typename for the base pair stack repesenting data structure #vrna_bp_stack_s */
+typedef struct vrna_bp_stack_s  vrna_bp_stack_t;
+
+/** @brief Typename for data structure #vrna_cpair_s */
+typedef struct vrna_cpair_s  vrna_cpair_t;
+
+/** @brief Typename for stack of partial structures #vrna_sect_s */
+typedef struct vrna_sect_s  vrna_sect_t;
+
+typedef struct vrna_data_linear_s vrna_data_lin_t;
+
+typedef struct vrna_color_s vrna_color_t;
+
+/** @brief Typename for floating point number in partition function computations */
+#ifdef  USE_FLOAT_PF
+typedef float FLT_OR_DBL;
+#else
+typedef double  FLT_OR_DBL;
+#endif
+
+/**
+ *  @brief Callback to free memory allocated for auxiliary user-provided data
+ *
+ *  @ingroup fold_compound
+ *  This type of user-implemented function usually deletes auxiliary data structures.
+ *  The user must take care to free all the memory occupied by the data structure passed.
+ * 
+ *  @param data    The data that needs to be free'd
+ */
+typedef void (vrna_callback_free_auxdata)(void *data);
+
+/**
+ *  @brief Callback to perform specific user-defined actions before, or after recursive computations
+ *
+ *  @ingroup fold_compound
+ *  @see #VRNA_STATUS_MFE_PRE, #VRNA_STATUS_MFE_POST, #VRNA_STATUS_PF_PRE, #VRNA_STATUS_PF_POST
+ *  @param status   The status indicator
+ *  @param data     The data structure that was assigned with vrna_fold_compound_add_auxdata()
+ *  @param status   The status indicator
+ */
+typedef void (vrna_callback_recursion_status)(unsigned char status, void *data);
+
+/**
+ *  @brief  Status message indicating that MFE computations are about to begin
+ *
+ *  @ingroup fold_compound
+ *  @see  #vrna_fold_compound_t.stat_cb, vrna_callback_recursion_status(), vrna_mfe(), vrna_fold(), vrna_circfold(),
+ *        vrna_alifold(), vrna_circalifold(), vrna_cofold()
+ */
+#define VRNA_STATUS_MFE_PRE     (unsigned char)1
+
+/**
+ *  @brief  Status message indicating that MFE computations are finished
+ *
+ *  @ingroup fold_compound
+ *  @see  #vrna_fold_compound_t.stat_cb, vrna_callback_recursion_status(), vrna_mfe(), vrna_fold(), vrna_circfold(),
+ *        vrna_alifold(), vrna_circalifold(), vrna_cofold()
+ */
+#define VRNA_STATUS_MFE_POST    (unsigned char)2
+
+/**
+ *  @brief  Status message indicating that Partition function computations are about to begin
+ *
+ *  @ingroup fold_compound
+ *  @see  #vrna_fold_compound_t.stat_cb, vrna_callback_recursion_status(), vrna_pf()
+ */
+#define VRNA_STATUS_PF_PRE      (unsigned char)3
+
+/**
+ *  @brief  Status message indicating that Partition function computations are finished
+ *
+ *  @ingroup fold_compound
+ *  @see  #vrna_fold_compound_t.stat_cb, vrna_callback_recursion_status(), vrna_pf()
+ */
+#define VRNA_STATUS_PF_POST     (unsigned char)4
+
+
+#define VRNA_PLIST_TYPE_BASEPAIR      0
+#define VRNA_PLIST_TYPE_GQUAD         1
+#define VRNA_PLIST_TYPE_H_MOTIF       2
+#define VRNA_PLIST_TYPE_I_MOTIF       3
+#define VRNA_PLIST_TYPE_UD_MOTIF      4
+
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/* the following typedefs are for backward compatibility only */
+
+/**
+ *  @brief Old typename of #vrna_basepair_s
+ *  @deprecated Use #vrna_basepair_t instead!
+ */
+typedef struct vrna_basepair_s  PAIR;
+
+/**
+ *  @brief Old typename of #vrna_plist_s
+ *  @deprecated Use #vrna_plist_t instead!
+ */
+typedef struct vrna_plist_s     plist;
+
+/**
+ *  @brief Old typename of #vrna_cpair_s
+ *  @deprecated Use #vrna_cpair_t instead!
+ */
+typedef struct vrna_cpair_s     cpair;
+
+/**
+ *  @brief Old typename of #vrna_sect_s
+ *  @deprecated Use #vrna_sect_t instead!
+ */
+typedef struct vrna_sect_s      sect;
+
+/**
+ *  @brief Old typename of #vrna_bp_stack_s
+ *  @deprecated Use #vrna_bp_stack_t instead!
+ */
+typedef struct vrna_bp_stack_s  bondT;
+
+#endif
+
+#include <ViennaRNA/energy_const.h>
+#include <ViennaRNA/model.h>
+#include <ViennaRNA/params.h>
+#include <ViennaRNA/dp_matrices.h>
+#include <ViennaRNA/constraints.h>
+#include <ViennaRNA/grammar.h>
+#include "ViennaRNA/structured_domains.h"
+#include "ViennaRNA/unstructured_domains.h"
+
+/*
+* ############################################################
+* Here are the type definitions of various datastructures
+* shared among the Vienna RNA Package
+* ############################################################
+*/
+
+/**
+ *  @brief  Base pair data structure used in subopt.c
+ */
+struct vrna_basepair_s {
+  int i;
+  int j;
+};
+
+/**
+ *  @brief this datastructure is used as input parameter in functions of PS_dot.h and others
+ */
+struct vrna_plist_s {
+  int i;
+  int j;
+  float p;
+  int type;
+};
+
+/**
+ *  @brief this datastructure is used as input parameter in functions of PS_dot.c
+ */
+struct vrna_cpair_s {
+  int i,j,mfe;
+  float p, hue, sat;
+};
+
+struct vrna_color_s {
+  float hue;
+  float sat;
+  float bri;
+};
+
+struct vrna_data_linear_s {
+  unsigned int  position;
+  float         value;
+  vrna_color_t  color;
+};
+
+
+/**
+ *  @brief  Stack of partial structures for backtracking
+ */
+struct vrna_sect_s {
+  int  i;
+  int  j;
+  int ml;
+};
+
+/**
+ *  @brief  Base pair stack element
+ */
+struct vrna_bp_stack_s {
+   unsigned int i;
+   unsigned int j;
+};
+
+
+/*
+* ############################################################
+* RNAup data structures
+* ############################################################
+*/
+
+/**
+ *  @brief contributions to p_u
+ */
+typedef struct pu_contrib {
+  double **H; /**<  @brief  hairpin loops */
+  double **I; /**<  @brief  interior loops */
+  double **M; /**<  @brief  multi loops */
+  double **E; /**<  @brief  exterior loop */
+  int length; /**<  @brief  length of the input sequence */
+  int w;      /**<  @brief  longest unpaired region */
+} pu_contrib;
+
+/**
+ *  @brief  interaction data structure for RNAup
+ */
+typedef struct interact {
+  double *Pi;       /**<  @brief  probabilities of interaction */
+  double *Gi;       /**<  @brief  free energies of interaction */
+  double Gikjl;     /**<  @brief  full free energy for interaction between [k,i] k<i
+                                  in longer seq and [j,l] j<l in shorter seq */
+  double Gikjl_wo;  /**<  @brief  Gikjl without contributions for prob_unpaired */
+  int i;            /**<  @brief  k<i in longer seq */
+  int k;            /**<  @brief  k<i in longer seq */
+  int j;            /**<  @brief  j<l in shorter seq */
+  int l;            /**<  @brief  j<l in shorter seq */
+  int length;       /**<  @brief  length of longer sequence */
+} interact;
+
+/**
+ *  @brief  Collection of all free_energy of beeing unpaired values for output
+ */
+typedef struct pu_out {
+  int len;            /**<  @brief  sequence length */
+  int u_vals;         /**<  @brief  number of different -u values */
+  int contribs;       /**<  @brief  [-c "SHIME"] */
+  char **header;      /**<  @brief  header line */
+  double **u_values;  /**<  @brief  (the -u values * [-c "SHIME"]) * seq len */
+} pu_out;
+
+/**
+ *  @brief  constraints for cofolding
+ */
+typedef struct constrain{
+  int *indx;
+  char *ptype;
+} constrain;
+
+/*
+* ############################################################
+* RNAduplex data structures
+* ############################################################
+*/
+
+/**
+ *  @brief  Data structure for RNAduplex
+ */
+typedef struct {
+  int i;
+  int j;
+  int end;
+  char *structure;
+  double energy;
+  double energy_backtrack;
+  double opening_backtrack_x;
+  double opening_backtrack_y;
+  int offset;
+  double dG1;
+  double dG2;
+  double ddG;
+  int tb;
+  int te;
+  int qb;
+  int qe;
+} duplexT;
+
+/*
+* ############################################################
+* RNAsnoop data structures
+* ############################################################
+*/
+
+/**
+ *  @brief  Data structure for RNAsnoop (fold energy list)
+ */
+typedef struct node {
+  int k;
+  int energy;
+  struct node *next;
+} folden;
+
+/**
+ *  @brief  Data structure for RNAsnoop
+ */
+typedef struct {
+  int i;
+  int j;
+  int u;
+  char *structure;
+  float energy;
+  float Duplex_El;
+  float Duplex_Er;
+  float Loop_E;
+  float Loop_D;
+  float pscd;
+  float psct;
+  float pscg;
+  float Duplex_Ol;
+  float Duplex_Or;
+  float Duplex_Ot;
+  float fullStemEnergy;
+} snoopT;
+
+
+/*
+* ############################################################
+* PKplex data structures
+* ############################################################
+*/
+
+/**
+ *  @brief  Data structure used in RNApkplex
+ */
+typedef struct dupVar{
+  int i;
+  int j;
+  int end;
+  char *pk_helix;
+  char *structure;
+  double energy;
+  int offset;
+  double dG1;
+  double dG2;
+  double ddG;
+  int tb;
+  int te;
+  int qb;
+  int qe;
+  int inactive;
+  int processed;
+} dupVar;
+
+/**
+ *  @brief  Dummy symbol to check whether the library was build using C11/C++11 features
+ *
+ *  By default, several data structures of our new v3.0 API use C11/C++11 features, such
+ *  as unnamed unions, unnamed structs. However, these features can be deactivated at
+ *  compile time to allow building the library and executables with compilers that do not
+ *  support these features.
+ *
+ *  Now, the problem arises that once our static library is compiled and a third-party
+ *  application is supposed to link against it, it needs to know, at compile time, how to
+ *  correctly address particular data structures. This is usually implicitely taken care of
+ *  through the API exposed in our header files. Unfortunately, we had some preprocessor directives
+ *  in our header files that changed the API depending on the capabilities of the compiler
+ *  the third-party application is build with. This in turn prohibited the use of an RNAlib
+ *  compiled without C11/C++11 support in a program that compiles/links with enabled C11/C++11
+ *  support and vice-versa.
+ *
+ *  Therefore, we introduce this dummy symbol which can be used to check, whether the
+ *  static library was build with C11/C++11 features.
+ *
+ *  @note If the symbol is present, the library was build with enabled C11/C++11 features support
+ *  and no action is required. However, if the symbol is missing in RNAlib >= 2.2.9, programs
+ *  that link to RNAlib must define a pre-processor identifier @em VRNA_DISABLE_C11_FEATURES before
+ *  including any ViennaRNA Package header file, for instance by adding a @em CPPFLAG
+ *  @code
+CPPFLAGS+=-DVRNA_DISABLE_C11_FEATURES
+ *  @endcode
+ *
+ *  @since v2.2.9
+ */
+#ifndef VRNA_DISABLE_C11_FEATURES
+void vrna_C11_features(void);
+#endif
+
+/**
+ * @}
+ */
+
+
+/*
+* ############################################################
+* VRNA fold compound related functions
+* ############################################################
+*/
+
+/**
+ *  @addtogroup   fold_compound   The Fold Compound
+ *  @{
+ *
+ *  @brief  This module provides interfaces that deal with the most basic data structure used
+ *          in structure predicting and energy evaluating function of the RNAlib.
+ *
+ *          Throughout the entire RNAlib, the #vrna_fold_compound_t, is used to group
+ *          information and data that is required for structure prediction and energy evaluation.
+ *          Here, you'll find interface functions to create, modify, and delete #vrna_fold_compound_t
+ *          data structures.
+ */
+
+/**
+ *  @brief  An enumerator that is used to specify the type of a #vrna_fold_compound_t
+ */
+typedef enum {
+  VRNA_FC_TYPE_SINGLE,      /**< Type is suitable for single, and hybridizing sequences */
+  VRNA_FC_TYPE_COMPARATIVE  /**< Type is suitable for sequence alignments (consensus structure prediction) */
+} vrna_fc_type_e;
+
+
+/**
+ *  @brief  The most basic data structure required by many functions throughout the RNAlib
+ *
+ *  @note   Please read the documentation of this data structure carefully! Some attributes are only available for
+ *  specific types this data structure can adopt.
+ *
+ *  @warning  Reading/Writing from/to attributes that are not within the scope of the current type usually result
+ *  in undefined behavior!
+ *
+ *  @see  #vrna_fold_compound_t.type, vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_fold_compound_free(),
+ *        #VRNA_FC_TYPE_SINGLE, #VRNA_FC_TYPE_COMPARATIVE
+ */
+struct vrna_fc_s{
+
+  /**
+      @name Common data fields
+      @{
+   */
+  vrna_fc_type_e    type;           /**<  @brief  The type of the #vrna_fold_compound_t.
+                                      @details Currently possible values are #VRNA_FC_TYPE_SINGLE, and #VRNA_FC_TYPE_COMPARATIVE
+                                      @warning Do not edit this attribute, it will be automagically set by
+                                            the corresponding get() methods for the #vrna_fold_compound_t.
+                                            The value specified in this attribute dictates the set of other
+                                            attributes to use within this data structure.
+                                    */
+  unsigned int      length;         /**<  @brief  The length of the sequence (or sequence alignment) */
+  int               cutpoint;       /**<  @brief  The position of the (cofold) cutpoint within the provided sequence.
+                                      If there is no cutpoint, this field will be set to -1
+                                    */
+
+  unsigned int      *strand_number; /**<  @brief  The strand number a particular nucleotide is associated with */
+
+  vrna_hc_t         *hc;            /**<  @brief  The hard constraints data structure used for structure prediction */
+
+  vrna_mx_mfe_t     *matrices;      /**<  @brief  The MFE DP matrices */
+  vrna_mx_pf_t      *exp_matrices;  /**<  @brief  The PF DP matrices  */
+
+  vrna_param_t      *params;        /**<  @brief  The precomputed free energy contributions for each type of loop */
+  vrna_exp_param_t  *exp_params;    /**<  @brief  The precomputed free energy contributions as Boltzmann factors  */
+
+  int               *iindx;         /**<  @brief  DP matrix accessor  */
+  int               *jindx;         /**<  @brief  DP matrix accessor  */
+
+  /**
+      @}
+
+      @name User-defined data fields
+      @{
+   */
+  vrna_callback_recursion_status *stat_cb;  /**<  @brief  Recursion status callback (usually called just before, and
+                                                          after recursive computations in the library
+                                                  @see    vrna_callback_recursion_status(), vrna_fold_compound_add_callback()
+                                            */
+
+  void              *auxdata;               /**<  @brief  A pointer to auxiliary, user-defined data
+                                                  @see vrna_fold_compound_add_auxdata(), #vrna_fold_compound_t.free_auxdata
+                                            */
+
+  vrna_callback_free_auxdata *free_auxdata; /**<  @brief A callback to free auxiliary user data whenever the fold_compound itself is free'd
+                                                  @see  #vrna_fold_compound_t.auxdata, vrna_callback_free_auxdata()
+                                            */
+
+  /**
+      @}
+
+      @name Secondary Structure Decomposition (grammar) related data fields
+      @{
+   */
+
+  /* data structure to adjust additional structural domains, such as G-quadruplexes */
+  vrna_sd_t         *domains_struc;         /**<  @brief  Additional structured domains */
+
+  /* data structure to adjust additional contributions to unpaired stretches, e.g. due to protein binding */
+  vrna_ud_t         *domains_up;            /**<  @brief  Additional unstructured domains */
+
+  /* auxiliary (user-defined) extension to the folding grammar */
+  vrna_gr_aux_t     *aux_grammar;
+
+  /**
+      @}
+   */
+
+#ifndef VRNA_DISABLE_C11_FEATURES
+    /* C11 support for unnamed unions/structs */
+  union {
+    struct {
+#endif
+
+  /**
+      @name Data fields available for single/hybrid structure prediction
+      @{
+   */
+      char  *sequence;              /**<  @brief  The input sequence string
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_SINGLE @endverbatim
+                                    */
+      short *sequence_encoding;     /**<  @brief  Numerical encoding of the input sequence
+                                          @see    vrna_sequence_encode()
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_SINGLE @endverbatim
+                                    */
+      short *sequence_encoding2;
+      char  *ptype;                 /**<  @brief  Pair type array
+                                     
+                                          Contains the numerical encoding of the pair type for each pair (i,j) used
+                                          in MFE, Partition function and Evaluation computations.
+                                          @note This array is always indexed via jindx, in contrast to previously
+                                          different indexing between mfe and pf variants!
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_SINGLE @endverbatim
+                                          @see    vrna_idx_col_wise(), vrna_ptypes()
+                                    */
+      char  *ptype_pf_compat;       /**<  @brief  ptype array indexed via iindx
+                                          @deprecated  This attribute will vanish in the future!
+                                          It's meant for backward compatibility only!
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_SINGLE @endverbatim
+                                    */
+      vrna_sc_t *sc;                /**<  @brief  The soft constraints for usage in structure prediction and evaluation
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_SINGLE @endverbatim
+                                    */
+
+  /**
+      @}
+   */
+
+#ifndef VRNA_DISABLE_C11_FEATURES
+    /* C11 support for unnamed unions/structs */
+    };
+    struct {
+#endif
+
+  /**
+      @name Data fields for consensus structure prediction
+      @{
+   */
+      char  **sequences;            /**<  @brief  The aligned sequences
+                                          @note   The end of the alignment is indicated by a NULL pointer in the second dimension
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
+                                    */
+      unsigned int    n_seq;        /**<  @brief  The number of sequences in the alignment
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
+                                    */
+      char            *cons_seq;    /**<  @brief  The consensus sequence of the aligned sequences
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
+                                    */
+      short           *S_cons;      /**<  @brief  Numerical encoding of the consensus sequence
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
+                                    */
+      short           **S;          /**<  @brief  Numerical encoding of the sequences in the alignment
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
+                                    */
+      short           **S5;         /**<  @brief    S5[s][i] holds next base 5' of i in sequence s
+                                          @warning  Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
+                                    */
+      short           **S3;         /**<  @brief    Sl[s][i] holds next base 3' of i in sequence s
+                                          @warning  Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
+                                    */
+      char            **Ss;
+      unsigned short  **a2s;
+      int             *pscore;      /**<  @brief  Precomputed array of pair types expressed as pairing scores
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
+                                    */
+      short           *pscore_pf_compat;  /**<  @brief  Precomputed array of pair types expressed as pairing scores indexed via iindx
+                                                @deprecated  This attribute will vanish in the future!
+                                                @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
+                                    */
+      vrna_sc_t       **scs;        /**<  @brief  A set of soft constraints (for each sequence in the alignment)
+                                          @warning   Only available if @verbatim type==VRNA_FC_TYPE_COMPARATIVE @endverbatim
+                                    */
+      int             oldAliEn;
+
+  /**
+      @}
+   */
+#ifndef VRNA_DISABLE_C11_FEATURES
+    };
+  };
+#endif
+
+  /**
+   *  @name Additional data fields for Distance Class Partitioning
+   *
+   *  These data fields are typically populated with meaningful data only if used in the context of Distance Class Partitioning
+   *  @{
+   */
+  unsigned int    maxD1;          /**<  @brief  Maximum allowed base pair distance to first reference */
+  unsigned int    maxD2;          /**<  @brief  Maximum allowed base pair distance to second reference */
+  short           *reference_pt1; /**<  @brief  A pairtable of the first reference structure */
+  short           *reference_pt2; /**<  @brief  A pairtable of the second reference structure */
+
+  unsigned int    *referenceBPs1; /**<  @brief  Matrix containing number of basepairs of reference structure1 in interval [i,j] */
+  unsigned int    *referenceBPs2; /**<  @brief  Matrix containing number of basepairs of reference structure2 in interval [i,j] */
+  unsigned int    *bpdist;        /**<  @brief  Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j] */
+
+  unsigned int    *mm1;           /**<  @brief  Maximum matching matrix, reference struct 1 disallowed */
+  unsigned int    *mm2;           /**<  @brief  Maximum matching matrix, reference struct 2 disallowed */
+  
+  /**
+      @}
+   */
+
+  /**
+   *  @name Additional data fields for local folding
+   *
+   *  These data fields are typically populated with meaningful data only if used in the context of local folding
+   *  @{
+   */
+  int             window_size;    /**<  @brief  window size for local folding sliding window approach */
+  char            **ptype_local;  /**<  @brief  Pair type array (for local folding) */
+  /**
+      @}
+   */
+
+};
+
+
+/* the definitions below should be used for functions that return/receive/destroy fold compound data structures */
+
+/**
+ *  @brief  Option flag to specify default settings/requirements
+ */
+#define VRNA_OPTION_DEFAULT         0U
+
+/**
+ *  @brief  Option flag to specify requirement of Minimum Free Energy (MFE) DP matrices
+ *          and corresponding set of energy parameters
+ *
+ *  @see vrna_fold_compound(), vrna_fold_compound_comparative(), #VRNA_OPTION_EVAL_ONLY
+ */
+#define VRNA_OPTION_MFE             1U
+
+/**
+ *  @brief  Option flag to specify requirement of Partition Function (PF) DP matrices
+ *          and corresponding set of Boltzmann factors
+ *
+ *  @see vrna_fold_compound(), vrna_fold_compound_comparative(), #VRNA_OPTION_EVAL_ONLY
+ */
+#define VRNA_OPTION_PF              2U
+
+/**
+ *  @brief  Option flag to specify requirement of dimer DP matrices
+ */
+#define VRNA_OPTION_HYBRID          4U
+
+/**
+ *  @brief  Option flag to specify that neither MFE, nor PF DP matrices are required
+ *
+ *  Use this flag in conjuntion with #VRNA_OPTION_MFE, and #VRNA_OPTION_PF to save
+ *  memory for a #vrna_fold_compound_t obtained from vrna_fold_compound(), or vrna_fold_compound_comparative()
+ *  in cases where only energy evaluation but no structure prediction is required.
+ *
+ *  @see vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_eval_structure()
+ */
+#define VRNA_OPTION_EVAL_ONLY       8U
+
+/**
+ *  @brief  Option flag to specify requirement of DP matrices for local folding approaches
+ */
+#define VRNA_OPTION_WINDOW          16U
+
+/**
+ *  @brief  Retrieve a #vrna_fold_compound_t data structure for single sequences and hybridizing sequences
+ *
+ *  This function provides an easy interface to obtain a prefilled #vrna_fold_compound_t by passing a single
+ *  sequence, or two contatenated sequences as input. For the latter, sequences need to be seperated by
+ *  an '&' character like this: @verbatim char *sequence = "GGGG&CCCC"; @endverbatim
+ *
+ *  The optional parameter @p md_p can be used to specify the model details for successive computations
+ *  based on the content of the generated #vrna_fold_compound_t. Passing NULL will instruct the function
+ *  to use default model details.
+ *  The third parameter @p options may be used to specify dynamic programming (DP) matrix requirements.
+ *  Use the macros:
+ *
+ *  - #VRNA_OPTION_MFE
+ *  - #VRNA_OPTION_PF
+ *  - #VRNA_OPTION_WINDOW
+ *  - #VRNA_OPTION_EVAL_ONLY
+ *  - #VRNA_OPTION_DEFAULT
+ *
+ *  to specify the required type of computations that will be performed with the #vrna_fold_compound_t.
+ *
+ *  If you just need the folding compound serving as a container for your data, you can simply pass
+ *  #VRNA_OPTION_DEFAULT to the @p option parameter. This creates a #vrna_fold_compound_t without DP
+ *  matrices, thus saving memory. Subsequent calls of any structure prediction function will then take
+ *  care of allocating the memory required for the DP matrices.
+ *  If you only intend to evaluate structures instead of actually predicting them, you may use the
+ *  #VRNA_OPTION_EVAL_ONLY macro. This will seriously speedup the creation of the #vrna_fold_compound_t.
+ *
+ *  @note The sequence string must be uppercase, and should contain only RNA (resp. DNA) alphabet depending
+ *        on what energy parameter set is used
+ *
+ *  @see  vrna_fold_compound_free(), vrna_fold_compound_comparative(), #vrna_md_t, #VRNA_OPTION_MFE,
+ *        #VRNA_OPTION_PF, #VRNA_OPTION_EVAL_ONLY, #VRNA_OPTION_WINDOW
+ *
+ *  @param    sequence    A single sequence, or two concatenated sequences seperated by an '&' character
+ *  @param    md_p        An optional set of model details
+ *  @param    options     The options for DP matrices memory allocation
+ *  @return               A prefilled vrna_fold_compound_t that can be readily used for computations
+ */
+vrna_fold_compound_t *
+vrna_fold_compound( const char *sequence,
+                    vrna_md_t *md_p,
+                    unsigned int options);
+
+/**
+ *  @brief  Retrieve a #vrna_fold_compound_t data structure for sequence alignments
+ *
+ *  This function provides an easy interface to obtain a prefilled #vrna_fold_compound_t by passing an
+ *  alignment of sequences.
+ *
+ *  The optional parameter @p md_p can be used to specify the model details for successive computations
+ *  based on the content of the generated #vrna_fold_compound_t. Passing NULL will instruct the function
+ *  to use default model details.
+ *  The third parameter @p options may be used to specify dynamic programming (DP) matrix requirements.
+ *  Use the macros:
+ *
+ *  - #VRNA_OPTION_MFE
+ *  - #VRNA_OPTION_PF
+ *  - #VRNA_OPTION_EVAL_ONLY
+ *  - #VRNA_OPTION_DEFAULT
+ *
+ *  to specify the required type of computations that will be performed with the #vrna_fold_compound_t.
+ *
+ *  If you just need the folding compound serving as a container for your data, you can simply pass
+ *  #VRNA_OPTION_DEFAULT to the @p option parameter. This creates a #vrna_fold_compound_t without DP
+ *  matrices, thus saving memory. Subsequent calls of any structure prediction function will then take
+ *  care of allocating the memory required for the DP matrices.
+ *  If you only intend to evaluate structures instead of actually predicting them, you may use the
+ *  #VRNA_OPTION_EVAL_ONLY macro. This will seriously speedup the creation of the #vrna_fold_compound_t.
+ *
+ *  @note The sequence strings must be uppercase, and should contain only RNA (resp. DNA) alphabet including
+ *        gap characters depending on what energy parameter set is used.
+ *
+ *  @see  vrna_fold_compound_free(), vrna_fold_compound(), #vrna_md_t, #VRNA_OPTION_MFE, #VRNA_OPTION_PF,
+ *        #VRNA_OPTION_EVAL_ONLY, read_clustal()
+ *
+ *  @param    sequences   A sequence alignment including 'gap' characters
+ *  @param    md_p        An optional set of model details
+ *  @param    options     The options for DP matrices memory allocation
+ *  @return               A prefilled vrna_fold_compound_t that can be readily used for computations
+ */
+vrna_fold_compound_t *
+vrna_fold_compound_comparative( const char **sequences,
+                                vrna_md_t *md_p,
+                                unsigned int options);
+
+vrna_fold_compound_t *
+vrna_fold_compound_TwoD(const char *sequence,
+                        const char *s1,
+                        const char *s2,
+                        vrna_md_t *md_p,
+                        unsigned int options);
+
+int
+vrna_fold_compound_prepare( vrna_fold_compound_t *vc,
+                            unsigned int options);
+
+/**
+ *  @brief  Free memory occupied by a #vrna_fold_compound_t
+ *
+ *  @see vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_mx_mfe_free(), vrna_mx_pf_free()
+ *
+ *  @param  vc  The #vrna_fold_compound_t that is to be erased from memory
+ */
+void
+vrna_fold_compound_free(vrna_fold_compound_t *vc);
+
+/**
+ *  @brief  Add auxiliary data to the #vrna_fold_compound_t
+ *
+ *  This function allows one to bind arbitrary data to a #vrna_fold_compound_t which may later on be used
+ *  by one of the callback functions, e.g. vrna_callback_recursion_status(). To allow for proper cleanup
+ *  of the memory occupied by this auxiliary data, the user may also provide a pointer to a cleanup function
+ *  that free's the corresponding memory. This function will be called automatically when the #vrna_fold_compound_t
+ *  is free'd with vrna_fold_compound_free().
+ *
+ *  @note Before attaching the arbitrary data pointer, this function will call the vrna_callback_free_auxdata()
+ *        on any pre-existing data that is already attached.
+ *
+ *  @see vrna_callback_free_auxdata()
+ *  @param  vc    The fold_compound the arbitrary data pointer should be associated with
+ *  @param  data  A pointer to an arbitrary data structure
+ *  @param  f     A pointer to function that free's memory occupied by the arbitrary data (May be NULL)
+ */
+void vrna_fold_compound_add_auxdata(vrna_fold_compound_t *vc,
+                                    void *data,
+                                    vrna_callback_free_auxdata *f);
+
+/**
+ *  @brief  Add a recursion status callback to the #vrna_fold_compound_t
+ *
+ *  Binding a recursion status callback function to a #vrna_fold_compound_t allows one to perform
+ *  arbitrary operations just before, or after an actual recursive computations, e.g. MFE prediction,
+ *  is performed by the RNAlib. The callback function will be provided with a pointer to its
+ *  #vrna_fold_compound_t, and a status message. Hence, it has complete access to all variables that
+ *  incluence the recursive computations.
+ *
+ *  @see  vrna_callback_recursion_status(), #vrna_fold_compound_t,
+ *        #VRNA_STATUS_MFE_PRE, #VRNA_STATUS_MFE_POST, #VRNA_STATUS_PF_PRE, #VRNA_STATUS_PF_POST
+ *
+ *  @param  vc    The fold_compound the callback function should be attached to
+ *  @param  f     The pointer to the recursion status callback function
+ */
+void vrna_fold_compound_add_callback( vrna_fold_compound_t *vc,
+                                      vrna_callback_recursion_status *f);
+
+
+/**
+ *  @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/dist_vars.c b/C/ViennaRNA/dist_vars.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/dist_vars.c
@@ -0,0 +1,8 @@
+/*             Global variables for Distance-Package */
+
+int  edit_backtrack = 0;  /* calculate aligned representation */
+
+char *aligned_line[4];    /* containes the aligned string representations */
+
+int  cost_matrix = 0;     /* 0 for usual costs, 1 for Shapiro's costs */
+
diff --git a/C/ViennaRNA/dist_vars.h b/C/ViennaRNA/dist_vars.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/dist_vars.h
@@ -0,0 +1,60 @@
+#ifndef VIENNA_RNA_PACKAGE_DIST_VARS_H
+#define VIENNA_RNA_PACKAGE_DIST_VARS_H
+
+/**
+ *  @file dist_vars.h
+ *  @brief Global variables for Distance-Package
+ */
+
+/**
+ *  @brief Produce an alignment of the two structures being compared by
+ *  tracing the editing path giving the minimum distance.
+ * 
+ *  set to 1 if you want backtracking
+ */
+extern int   edit_backtrack;
+
+/**
+ *  @brief Contains the two aligned structures after a call to one of the distance
+ *  functions with #edit_backtrack set to 1.
+ */
+extern char *aligned_line[4];
+
+/**
+ *  @brief Specify the cost matrix to be used for distance calculations
+ * 
+ *  if 0, use the default cost matrix (upper matrix in example), otherwise
+ *  use Shapiro's costs (lower matrix).
+ */
+extern int  cost_matrix;
+
+/*  Global type defs for Distance-Package */
+
+/**
+ *  @brief Postorder data structure
+ */
+typedef struct {
+                 int  type;
+                 int  weight;
+                 int  father;
+                 int  sons;
+                 int  leftmostleaf;
+               } Postorder_list;
+
+/**
+ *  @brief  Tree data structure
+ */
+typedef struct {
+                 Postorder_list *postorder_list;
+                 int            *keyroots;
+               } Tree;
+
+/**
+ *  @brief  Some other data structure
+ */
+typedef struct {
+                 int    type;
+                 int    sign;
+                 float  weight;
+               } swString;
+#endif
diff --git a/C/ViennaRNA/dp_matrices.c b/C/ViennaRNA/dp_matrices.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/dp_matrices.c
@@ -0,0 +1,1453 @@
+/** \file dp_matrices.c **/
+
+/*
+                  Dynamic Programming matrix related functions
+
+                  This file contains everything necessary to
+                  obtain and destroy data structures representing
+                  dynamic programming (DP) matrices used in the folding
+                  recurrences throughout the VienneRNA paclage
+
+                  c Ronny Lorenz
+
+                  ViennaRNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <math.h>
+
+#include "data_structures.h"
+#include "model.h"
+#include "utils.h"
+#include "gquad.h"
+#include "dp_matrices.h"
+
+/*
+#################################
+# PRIVATE MACROS                #
+#################################
+*/
+
+/* the definitions below indicate which arrays should be allocated upon retrieval of a matrices data structure */
+#define ALLOC_NOTHING     0
+#define ALLOC_F           1
+#define ALLOC_F5          2
+#define ALLOC_F3          4
+#define ALLOC_FC          8
+#define ALLOC_C           16
+#define ALLOC_FML         32
+#define ALLOC_PROBS       256
+#define ALLOC_AUX         512
+
+#define ALLOC_CIRC        1024
+#define ALLOC_HYBRID      2048
+#define ALLOC_UNIQ        4096
+
+
+#define ALLOC_MFE_DEFAULT         (ALLOC_F5 | ALLOC_C | ALLOC_FML)
+#define ALLOC_MFE_LOCAL           (ALLOC_F3 | ALLOC_C | ALLOC_FML)
+
+#define ALLOC_PF_WO_PROBS         (ALLOC_F | ALLOC_C | ALLOC_FML)
+#define ALLOC_PF_DEFAULT          (ALLOC_PF_WO_PROBS | ALLOC_PROBS | ALLOC_AUX)
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE unsigned int    get_mx_alloc_vector(vrna_md_t *md_p, vrna_mx_type_e type, unsigned int options);
+PRIVATE unsigned int    get_mx_mfe_alloc_vector_current(vrna_mx_mfe_t *mx, vrna_mx_type_e mx_type);
+PRIVATE unsigned int    get_mx_pf_alloc_vector_current(vrna_mx_pf_t *mx, vrna_mx_type_e mx_type);
+PRIVATE void            mfe_matrices_alloc_default(vrna_mx_mfe_t *vars, unsigned int m, unsigned int alloc_vector);
+PRIVATE void            mfe_matrices_free_default(vrna_mx_mfe_t *self);
+PRIVATE void            mfe_matrices_alloc_window(vrna_mx_mfe_t *vars, unsigned int m, unsigned int alloc_vector);
+PRIVATE void            mfe_matrices_free_window(vrna_mx_mfe_t *self, unsigned int length, unsigned int window_size);
+PRIVATE void            mfe_matrices_alloc_2Dfold(vrna_mx_mfe_t *vars, unsigned int m, unsigned int alloc_vector);
+PRIVATE void            mfe_matrices_free_2Dfold( vrna_mx_mfe_t *self, unsigned int length, int *indx);
+PRIVATE void            pf_matrices_alloc_default(vrna_mx_pf_t *vars, unsigned int m, unsigned int alloc_vector);
+PRIVATE void            pf_matrices_free_default(vrna_mx_pf_t *self);
+PRIVATE void            pf_matrices_alloc_2Dfold(vrna_mx_pf_t *vars, unsigned int m, unsigned int alloc_vector);
+PRIVATE void            pf_matrices_free_2Dfold(vrna_mx_pf_t *self, unsigned int length, int *indx, int *jindx);
+PRIVATE vrna_mx_mfe_t   *get_mfe_matrices_alloc(unsigned int n, unsigned int m, vrna_mx_type_e type, unsigned int alloc_vector);
+PRIVATE vrna_mx_pf_t    *get_pf_matrices_alloc(unsigned int n, vrna_mx_type_e type, unsigned int alloc_vector);
+PRIVATE void            add_pf_matrices( vrna_fold_compound_t *vc, vrna_mx_type_e type, unsigned int alloc_vector);
+PRIVATE void            add_mfe_matrices(vrna_fold_compound_t *vc, vrna_mx_type_e type, unsigned int alloc_vector);
+
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC void
+vrna_mx_mfe_free(vrna_fold_compound_t *vc){
+
+  if(vc){
+    vrna_mx_mfe_t *self = vc->matrices;
+    if(self){
+      switch(self->type){
+        case VRNA_MX_DEFAULT:   mfe_matrices_free_default(self);
+                                break;
+
+        case VRNA_MX_WINDOW:    mfe_matrices_free_window(self, vc->length, vc->window_size);
+                                break;
+
+        case VRNA_MX_2DFOLD:    mfe_matrices_free_2Dfold(self, vc->length, vc->iindx);
+                                break;
+
+        default:                /* do nothing */
+                                break;
+      }
+      free(self);
+      vc->matrices = NULL;
+    }
+  }
+}
+
+PUBLIC void
+vrna_mx_pf_free(vrna_fold_compound_t *vc){
+
+  if(vc){
+    vrna_mx_pf_t  *self = vc->exp_matrices;
+    if(self){
+      switch(self->type){
+        case VRNA_MX_DEFAULT:   pf_matrices_free_default(self);
+                                break;
+
+        case VRNA_MX_2DFOLD:    pf_matrices_free_2Dfold(self, vc->length, vc->iindx, vc->jindx);
+                                break;
+
+        default:                /* do nothing */
+                                break;
+      }
+
+      free(self->expMLbase);
+      free(self->scale);
+
+      free(self);
+      vc->exp_matrices = NULL;
+    }
+  }
+}
+
+PUBLIC int
+vrna_mx_add(vrna_fold_compound_t *vc,
+            vrna_mx_type_e mx_type,
+            unsigned int options){
+
+  int ret;
+
+  ret = 1;
+
+  if(options & VRNA_OPTION_MFE){
+    ret &= vrna_mx_mfe_add(vc, mx_type, options);
+  }
+
+  if(options & VRNA_OPTION_PF){
+    ret &= vrna_mx_pf_add(vc, mx_type, options);
+  }
+
+  return ret;
+}
+
+PUBLIC int
+vrna_mx_mfe_add(vrna_fold_compound_t *vc,
+                vrna_mx_type_e mx_type,
+                unsigned int options){
+
+  unsigned int mx_alloc_vector;
+
+  if(vc->params){
+    options |= VRNA_OPTION_MFE;
+    if(vc->cutpoint > 0)
+      options |= VRNA_OPTION_HYBRID;
+
+    mx_alloc_vector = get_mx_alloc_vector(&(vc->params->model_details), mx_type, options);
+    vrna_mx_mfe_free(vc);
+    add_mfe_matrices(vc, mx_type, mx_alloc_vector);
+  } else {
+    return 0;
+  }
+
+  return 1;
+}
+
+PUBLIC int
+vrna_mx_pf_add( vrna_fold_compound_t *vc,
+                vrna_mx_type_e mx_type,
+                unsigned int options){
+
+  unsigned int mx_alloc_vector;
+  if(vc->exp_params){
+    mx_alloc_vector = get_mx_alloc_vector(&(vc->exp_params->model_details), mx_type, options | VRNA_OPTION_PF);
+    vrna_mx_pf_free(vc);
+    add_pf_matrices(vc, mx_type, mx_alloc_vector);
+  } else {
+    return 0;
+  }
+
+  return 1;
+}
+
+PUBLIC int
+vrna_mx_prepare(vrna_fold_compound_t *vc,
+                unsigned int options){
+
+  int             ret, realloc;
+  unsigned int    mx_alloc_vector, mx_alloc_vector_current;
+  vrna_mx_type_e  mx_type;
+
+  ret = 1;
+
+  if(vc){
+    /*  check whether we have the correct DP matrices attached, and if there is
+        enough memory allocated
+    */
+    if(options & VRNA_OPTION_MFE){  /* prepare for MFE computation */
+      if(options & VRNA_OPTION_WINDOW){ /* Windowing approach, a.k.a. locally optimal */
+        mx_type = VRNA_MX_WINDOW;
+      } else {                          /* default is regular MFE */
+        mx_type = VRNA_MX_DEFAULT;
+      }
+
+      if(vc->cutpoint > 0)
+        options |= VRNA_OPTION_HYBRID;
+
+      realloc = 0;
+
+      if(!vc->matrices || (vc->matrices->type != mx_type) || (vc->matrices->length < vc->length)){
+        realloc = 1;
+      } else {
+        mx_alloc_vector         = get_mx_alloc_vector(&(vc->params->model_details), mx_type, options);
+        mx_alloc_vector_current = get_mx_mfe_alloc_vector_current(vc->matrices, mx_type);
+        if((mx_alloc_vector & mx_alloc_vector_current) != mx_alloc_vector)
+          realloc = 1;
+      }
+
+      if(realloc) /* Add DP matrices, if not they are not present */
+        ret &= vrna_mx_mfe_add(vc, mx_type, options);
+
+    }
+
+    if(options & VRNA_OPTION_PF){   /* prepare for partition function computations */
+      if(!vc->exp_params) /* return failure if exp_params data is not present */
+        return 0;
+
+      mx_type = VRNA_MX_DEFAULT;  /* for now, we only check default matrices */
+
+      if(vc->cutpoint > 0)
+        options |= VRNA_OPTION_HYBRID;
+
+      realloc = 0;
+
+      /*  Add DP matrices, if not they are not present */
+      if(!vc->exp_matrices || (vc->exp_matrices->type != mx_type) || (vc->exp_matrices->length < vc->length)){
+        realloc = 1;
+      } else {
+        mx_alloc_vector         = get_mx_alloc_vector(&(vc->exp_params->model_details), mx_type, options);
+        mx_alloc_vector_current = get_mx_pf_alloc_vector_current(vc->exp_matrices, mx_type);
+        if((mx_alloc_vector & mx_alloc_vector_current) != mx_alloc_vector)
+          realloc = 1;
+      }
+      
+      if(realloc){ /* Add DP matrices, if not they are not present */
+        ret &= vrna_mx_pf_add(vc, mx_type, options);
+      }
+#ifdef VRNA_BACKWARD_COMPAT
+      else { /* re-compute pf_scale and MLbase contributions (for RNAup)*/
+        vrna_exp_params_rescale(vc, NULL);
+      }
+#endif
+  
+    }
+  } else {
+    ret = 0;
+  }
+
+  return ret;
+}
+/*
+#####################################
+# BEGIN OF STATIC HELPER FUNCTIONS  #
+#####################################
+*/
+PRIVATE unsigned int
+get_mx_mfe_alloc_vector_current(vrna_mx_mfe_t *mx,
+                                vrna_mx_type_e mx_type){
+
+  unsigned int mx_alloc_vector = ALLOC_NOTHING;
+
+  if(mx){
+    switch(mx_type){
+      case VRNA_MX_DEFAULT: if(mx->f5)
+                              mx_alloc_vector |= ALLOC_F5;
+                            if(mx->f3)
+                              mx_alloc_vector |= ALLOC_F3;
+                            if(mx->fc)
+                              mx_alloc_vector |= ALLOC_HYBRID;
+                            if(mx->c)
+                              mx_alloc_vector |= ALLOC_C;
+                            if(mx->fML)
+                              mx_alloc_vector |= ALLOC_FML;
+                            if(mx->fM1)
+                              mx_alloc_vector |= ALLOC_UNIQ;
+                            if(mx->fM2)
+                              mx_alloc_vector |= ALLOC_CIRC;
+                            break;
+
+      default:              break;
+    }
+  }
+  
+  return mx_alloc_vector;
+}
+
+PRIVATE unsigned int
+get_mx_pf_alloc_vector_current( vrna_mx_pf_t *mx,
+                                vrna_mx_type_e mx_type){
+
+  unsigned int mx_alloc_vector = ALLOC_NOTHING;
+
+  if(mx){
+    switch(mx_type){
+      case VRNA_MX_DEFAULT: if(mx->q)
+                              mx_alloc_vector |= ALLOC_F;
+                            if(mx->qb)
+                              mx_alloc_vector |= ALLOC_C;
+                            if(mx->qm)
+                              mx_alloc_vector |= ALLOC_FML;
+                            if(mx->qm1)
+                              mx_alloc_vector |= ALLOC_UNIQ;
+                            if(mx->qm2)
+                              mx_alloc_vector |= ALLOC_CIRC;
+                            if(mx->probs)
+                              mx_alloc_vector |= ALLOC_PROBS;
+                            if(mx->q1k && mx->qln)
+                              mx_alloc_vector |= ALLOC_AUX;
+                            break;
+
+      default:              break;
+    }
+  }
+
+  return mx_alloc_vector;
+}
+PRIVATE void
+add_pf_matrices(vrna_fold_compound_t *vc,
+                vrna_mx_type_e type,
+                unsigned int alloc_vector){
+
+  if(vc){
+    vc->exp_matrices  = get_pf_matrices_alloc(vc->length, type, alloc_vector);
+    if(vc->exp_params->model_details.gquad){
+      switch(vc->type){
+        case VRNA_FC_TYPE_SINGLE:   vc->exp_matrices->G = NULL;
+                                    /* can't do that here, since scale[] is not filled yet :( 
+                                      vc->exp_matrices->G = get_gquad_pf_matrix(vc->sequence_encoding2, vc->exp_matrices->scale, vc->exp_params);
+                                    */
+                                    break;
+        default:                    /* do nothing */
+                                    break;
+      }
+    }
+    vrna_exp_params_rescale(vc, NULL);
+  }
+}
+
+PRIVATE void
+add_mfe_matrices( vrna_fold_compound_t *vc,
+                  vrna_mx_type_e mx_type,
+                  unsigned int alloc_vector){
+
+  if(vc){
+    switch(mx_type){
+      case VRNA_MX_WINDOW:  vc->matrices = get_mfe_matrices_alloc(vc->length, vc->window_size, mx_type, alloc_vector);
+                            break;
+      default:              vc->matrices = get_mfe_matrices_alloc(vc->length, vc->length, mx_type, alloc_vector);
+                            break;
+    }
+
+    if(vc->params->model_details.gquad){
+      switch(vc->type){
+        case VRNA_FC_TYPE_SINGLE:     switch(mx_type){
+                                        case VRNA_MX_WINDOW:  /* do nothing, since we handle memory somewhere else */
+                                                              break;
+                                        default:              vc->matrices->ggg = get_gquad_matrix(vc->sequence_encoding2, vc->params);
+                                                              break;
+                                      }
+                                      break;
+        case VRNA_FC_TYPE_COMPARATIVE:  vc->matrices->ggg = get_gquad_ali_matrix(vc->S_cons, vc->S, vc->n_seq,  vc->params);
+                                      break;
+        default:                      /* do nothing */
+                                      break;
+      }
+    }
+  }
+}
+
+PRIVATE vrna_mx_mfe_t  *
+get_mfe_matrices_alloc( unsigned int n,
+                        unsigned int m,
+                        vrna_mx_type_e type,
+                        unsigned int alloc_vector){
+
+  vrna_mx_mfe_t *vars;
+
+  if((int)(n * m) >= (int)INT_MAX)
+    vrna_message_error("get_mfe_matrices_alloc@data_structures.c: sequence length exceeds addressable range");
+
+  vars          = (vrna_mx_mfe_t *)vrna_alloc(sizeof(vrna_mx_mfe_t));
+  vars->length  = n;
+  vars->type    = type;
+
+  switch(type){
+    case VRNA_MX_DEFAULT:   mfe_matrices_alloc_default(vars, m, alloc_vector);
+                            break;
+
+    case VRNA_MX_WINDOW:    mfe_matrices_alloc_window(vars, m, alloc_vector);
+                            break;
+
+    case VRNA_MX_2DFOLD:    mfe_matrices_alloc_2Dfold(vars, m, alloc_vector);
+                            break;
+
+    default:                /* do nothing */
+                            break;
+  }
+
+  return vars;
+}
+
+PRIVATE vrna_mx_pf_t  *
+get_pf_matrices_alloc(unsigned int n,
+                      vrna_mx_type_e type,
+                      unsigned int alloc_vector){
+
+  unsigned int  lin_size;
+  vrna_mx_pf_t  *vars;
+
+  if(n >= (unsigned int)sqrt((double)INT_MAX))
+    vrna_message_error("get_pf_matrices_alloc@data_structures.c: sequence length exceeds addressable range");
+
+  lin_size      = n + 2;
+  vars          = (vrna_mx_pf_t *)vrna_alloc(sizeof(vrna_mx_pf_t));
+  vars->length  = n;
+  vars->type    = type;
+
+
+  switch(type){
+    case VRNA_MX_DEFAULT:   pf_matrices_alloc_default(vars, n, alloc_vector);
+                            break;
+
+    case VRNA_MX_2DFOLD:    pf_matrices_alloc_2Dfold(vars, n, alloc_vector);
+                            break;
+
+    default:                /* do nothing */
+                            break;
+  }
+
+  /*
+      always alloc the helper arrays for unpaired nucleotides in multi-
+      branch loops and scaling
+  */
+  vars->scale     = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * lin_size);
+  vars->expMLbase = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * lin_size);
+
+  return vars;
+}
+
+PRIVATE unsigned int
+get_mx_alloc_vector(vrna_md_t *md_p,
+                    vrna_mx_type_e mx_type,
+                    unsigned int options){
+
+  unsigned int  v;
+
+  v = ALLOC_NOTHING;
+
+  /* default MFE matrices ? */
+  if(options & VRNA_OPTION_MFE)
+    v |= (mx_type == VRNA_MX_WINDOW) ? ALLOC_MFE_LOCAL : ALLOC_MFE_DEFAULT;
+
+  /* default PF matrices ? */
+  if(options & VRNA_OPTION_PF)
+    v |= (md_p->compute_bpp) ? ALLOC_PF_DEFAULT : ALLOC_PF_WO_PROBS;
+
+  if(options & VRNA_OPTION_HYBRID)
+    v |= ALLOC_HYBRID;
+
+  /* matrices for circular folding ? */
+  if(md_p->circ){
+    md_p->uniq_ML = 1; /* we need unique ML arrays for circular folding */
+    v |= ALLOC_CIRC;
+  }
+
+  /* unique ML decomposition ? */
+  if(md_p->uniq_ML)
+    v |= ALLOC_UNIQ;
+
+  return v;
+}
+
+
+PRIVATE void
+mfe_matrices_alloc_default( vrna_mx_mfe_t *vars,
+                            unsigned int m,
+                            unsigned int alloc_vector){
+
+  unsigned int  n, size, lin_size;
+
+  n             = vars->length;
+  size          = ((n + 1) * (m + 2)) / 2;
+  lin_size      = n + 2;
+
+  vars->f5  = NULL;
+  vars->f3  = NULL;
+  vars->fc  = NULL;
+  vars->c   = NULL;
+  vars->fML = NULL;
+  vars->fM1 = NULL;
+  vars->fM2 = NULL;
+  vars->ggg = NULL;
+
+  if(alloc_vector & ALLOC_F5)
+    vars->f5  = (int *) vrna_alloc(sizeof(int) * lin_size);
+
+  if(alloc_vector & ALLOC_F3)
+    vars->f3  = (int *) vrna_alloc(sizeof(int) * lin_size);
+
+  if(alloc_vector & ALLOC_HYBRID)
+    vars->fc  = (int *) vrna_alloc(sizeof(int) * lin_size);
+
+  if(alloc_vector & ALLOC_C)
+    vars->c   = (int *) vrna_alloc(sizeof(int) * size);
+
+  if(alloc_vector & ALLOC_FML)
+    vars->fML = (int *) vrna_alloc(sizeof(int) * size);
+
+  if(alloc_vector & ALLOC_UNIQ)
+    vars->fM1 = (int *) vrna_alloc(sizeof(int) * size);
+
+  if(alloc_vector & ALLOC_CIRC)
+    vars->fM2 = (int *) vrna_alloc(sizeof(int) * lin_size);
+
+  /* setting exterior loop energies for circular case to INF is always safe */
+  vars->FcH = vars->FcI = vars->FcM = vars->Fc = INF;
+
+}
+
+PRIVATE void
+mfe_matrices_free_default(vrna_mx_mfe_t *self){
+
+  free(self->f5);
+  free(self->f3);
+  free(self->fc);
+  free(self->c);
+  free(self->fML);
+  free(self->fM1);
+  free(self->fM2);
+  free(self->ggg);
+}
+
+PRIVATE void
+mfe_matrices_alloc_window(vrna_mx_mfe_t *vars,
+                          unsigned int m,
+                          unsigned int alloc_vector){
+
+  int i;
+  unsigned int  n, lin_size;
+
+  n             = vars->length;
+  lin_size      = n + 2;
+
+  vars->f3_local = NULL;
+  vars->c_local = NULL;
+  vars->fML_local = NULL;
+  vars->ggg_local = NULL;
+
+  if(alloc_vector & ALLOC_F3)
+    vars->f3_local = (int *) vrna_alloc(sizeof(int) * lin_size);
+
+  if(alloc_vector & ALLOC_C){
+    vars->c_local = (int **) vrna_alloc(sizeof(int *) * lin_size);
+    for (i = (int)n; ( i > ((int)n - (int)m - 5)) && (i>=0); i--){
+      vars->c_local[i] = (int *) vrna_alloc(sizeof(int)*(m + 5));
+    }
+  }
+
+  if(alloc_vector & ALLOC_FML){
+    vars->fML_local = (int **) vrna_alloc(sizeof(int *) * lin_size);
+    for (i = (int)n; ( i > ((int)n - (int)m - 5)) && (i>=0); i--){
+      vars->fML_local[i] = (int *) vrna_alloc(sizeof(int)*(m + 5));
+    }
+  }
+}
+
+PRIVATE void
+mfe_matrices_free_window( vrna_mx_mfe_t *self,
+                          unsigned int length,
+                          unsigned int window_size){
+
+  unsigned int  i;
+
+  if(self->c_local)
+    for (i=0; (i < window_size + 5) && (i <= length); i++){
+      free(self->c_local[i]);
+    }
+  free(self->c_local);
+
+  if(self->fML_local)
+    for (i=0; (i < window_size + 5) && (i <= length); i++){
+      free(self->fML_local[i]);
+    }
+  free(self->fML_local);
+
+  if(self->ggg_local)
+    for (i=0; (i < window_size + 5) && (i <= length); i++){
+      free(self->ggg_local[i]);
+    }
+  free(self->ggg_local);
+
+  free(self->f3_local);
+}
+
+PRIVATE void
+mfe_matrices_alloc_2Dfold(vrna_mx_mfe_t *vars,
+                          unsigned int m,
+                          unsigned int alloc_vector){
+
+  unsigned int  n, i, size, lin_size;
+
+  n               = vars->length;
+  size            = ((n + 1) * (m + 2)) / 2;
+  lin_size        = n + 2;
+
+  vars->E_F5      = NULL;
+  vars->l_min_F5  = NULL;
+  vars->l_max_F5  = NULL;
+  vars->k_min_F5  = NULL;
+  vars->k_max_F5  = NULL;
+  vars->E_F5_rem  = NULL;
+
+  vars->E_F3      = NULL;
+  vars->l_min_F3  = NULL;
+  vars->l_max_F3  = NULL;
+  vars->k_min_F3  = NULL;
+  vars->k_max_F3  = NULL;
+  vars->E_F3_rem  = NULL;
+
+  vars->E_C       = NULL;
+  vars->l_min_C   = NULL;
+  vars->l_max_C   = NULL;
+  vars->k_min_C   = NULL;
+  vars->k_max_C   = NULL;
+  vars->E_C_rem   = NULL;
+
+  vars->E_M       = NULL;
+  vars->l_min_M   = NULL;
+  vars->l_max_M   = NULL;
+  vars->k_min_M   = NULL;
+  vars->k_max_M   = NULL;
+  vars->E_M_rem   = NULL;
+
+  vars->E_M1      = NULL;
+  vars->l_min_M1  = NULL;
+  vars->l_max_M1  = NULL;
+  vars->k_min_M1  = NULL;
+  vars->k_max_M1  = NULL;
+  vars->E_M1_rem  = NULL;
+
+  vars->E_M2      = NULL;
+  vars->l_min_M2  = NULL;
+  vars->l_max_M2  = NULL;
+  vars->k_min_M2  = NULL;
+  vars->k_max_M2  = NULL;
+  vars->E_M2_rem  = NULL;
+
+  /* setting exterior loop energies for circular case to INF is always safe */
+  vars->E_Fc      = NULL;
+  vars->E_FcH     = NULL;
+  vars->E_FcI     = NULL;
+  vars->E_FcM     = NULL;
+  vars->E_Fc_rem  = INF;
+  vars->E_FcH_rem = INF;
+  vars->E_FcI_rem = INF;
+  vars->E_FcM_rem = INF;
+
+  if(alloc_vector & ALLOC_F5){
+    vars->E_F5      = (int ***) vrna_alloc(sizeof(int **) * lin_size);
+    vars->l_min_F5  = (int **)  vrna_alloc(sizeof(int *)  * lin_size);
+    vars->l_max_F5  = (int **)  vrna_alloc(sizeof(int *)  * lin_size);
+    vars->k_min_F5  = (int *)   vrna_alloc(sizeof(int)    * lin_size);
+    vars->k_max_F5  = (int *)   vrna_alloc(sizeof(int)    * lin_size);
+    vars->E_F5_rem  = (int *)   vrna_alloc(sizeof(int)    * lin_size);
+    for(i = 0; i <= n; i++)
+      vars->E_F5_rem[i] = INF;
+  }
+
+  if(alloc_vector & ALLOC_F3){
+    vars->E_F3      = (int ***) vrna_alloc(sizeof(int **)  * lin_size);
+    vars->l_min_F3  = (int **)  vrna_alloc(sizeof(int *)   * lin_size);
+    vars->l_max_F3  = (int **)  vrna_alloc(sizeof(int *)   * lin_size);
+    vars->k_min_F3  = (int *)   vrna_alloc(sizeof(int)     * lin_size);
+    vars->k_max_F3  = (int *)   vrna_alloc(sizeof(int)     * lin_size);
+    vars->E_F3_rem  = (int *)   vrna_alloc(sizeof(int)    * lin_size);
+    for(i = 0; i <= n; i++)
+      vars->E_F3_rem[i] = INF;
+  }
+
+  if(alloc_vector & ALLOC_C){
+    vars->E_C     = (int ***) vrna_alloc(sizeof(int **) * size);
+    vars->l_min_C = (int **)  vrna_alloc(sizeof(int *)  * size);
+    vars->l_max_C = (int **)  vrna_alloc(sizeof(int *)  * size);
+    vars->k_min_C = (int *)   vrna_alloc(sizeof(int)    * size);
+    vars->k_max_C = (int *)   vrna_alloc(sizeof(int)    * size);
+    vars->E_C_rem = (int *)   vrna_alloc(sizeof(int)    * size);
+    for(i = 0; i < size; i++)
+      vars->E_C_rem[i] = INF;
+  }
+
+  if(alloc_vector & ALLOC_FML){
+    vars->E_M     = (int ***) vrna_alloc(sizeof(int **) * size);
+    vars->l_min_M = (int **)  vrna_alloc(sizeof(int *)  * size);
+    vars->l_max_M = (int **)  vrna_alloc(sizeof(int *)  * size);
+    vars->k_min_M = (int *)   vrna_alloc(sizeof(int)    * size);
+    vars->k_max_M = (int *)   vrna_alloc(sizeof(int)    * size);
+    vars->E_M_rem = (int *)   vrna_alloc(sizeof(int)    * size);
+    for(i = 0; i < size; i++)
+      vars->E_M_rem[i] = INF;
+  }
+
+  if(alloc_vector & ALLOC_UNIQ){
+    vars->E_M1      = (int ***) vrna_alloc(sizeof(int **) * size);
+    vars->l_min_M1  = (int **)  vrna_alloc(sizeof(int *)  * size);
+    vars->l_max_M1  = (int **)  vrna_alloc(sizeof(int *)  * size);
+    vars->k_min_M1  = (int *)   vrna_alloc(sizeof(int)    * size);
+    vars->k_max_M1  = (int *)   vrna_alloc(sizeof(int)    * size);
+    vars->E_M1_rem  = (int *)   vrna_alloc(sizeof(int)    * size);
+    for(i = 0; i < size; i++)
+      vars->E_M1_rem[i] = INF;
+  }
+
+  if(alloc_vector & ALLOC_CIRC){
+    vars->E_M2      = (int ***) vrna_alloc(sizeof(int **)  * lin_size);
+    vars->l_min_M2  = (int **)  vrna_alloc(sizeof(int *)   * lin_size);
+    vars->l_max_M2  = (int **)  vrna_alloc(sizeof(int *)   * lin_size);
+    vars->k_min_M2  = (int *)   vrna_alloc(sizeof(int)     * lin_size);
+    vars->k_max_M2  = (int *)   vrna_alloc(sizeof(int)     * lin_size);
+    vars->E_M2_rem  = (int *)   vrna_alloc(sizeof(int)     * lin_size);
+    for(i = 0; i <= n; i++)
+      vars->E_M2_rem[i] = INF;
+  }
+
+#ifdef COUNT_STATES
+  vars->N_C   = (unsigned long ***) vrna_alloc(sizeof(unsigned long **)  * size);
+  vars->N_F5  = (unsigned long ***) vrna_alloc(sizeof(unsigned long **)  * lin_size);
+  vars->N_M   = (unsigned long ***) vrna_alloc(sizeof(unsigned long **)  * size);
+  vars->N_M1  = (unsigned long ***) vrna_alloc(sizeof(unsigned long **)  * size);
+#endif
+}
+
+PRIVATE void
+mfe_matrices_free_2Dfold( vrna_mx_mfe_t *self,
+                          unsigned int length,
+                          int *indx){
+
+  unsigned int  i, j, ij;
+  int           cnt1;
+
+  /* This will be some fun... */
+#ifdef COUNT_STATES
+  if(self->N_F5 != NULL){
+    for(i = 1; i <= length; i++){
+      if(!self->N_F5[i]) continue;
+      for(cnt1 = self->k_min_F5[i]; cnt1 <= vars->k_max_F5[i]; cnt1++)
+        if(vars->l_min_F5[i][cnt1] < INF){
+          vars->N_F5[i][cnt1] += vars->l_min_F5[i][cnt1]/2;
+          free(vars->N_F5[i][cnt1]);
+        }
+      if(vars->k_min_F5[i] < INF){
+        vars->N_F5[i] += vars->k_min_F5[i];
+        free(vars->N_F5[i]);
+      }
+    }
+    free(vars->N_F5);
+  }
+#endif
+
+  if(self->E_F5 != NULL){
+    for(i = 1; i <= length; i++){
+      if(!self->E_F5[i]) continue;
+      for(cnt1 = self->k_min_F5[i]; cnt1 <= self->k_max_F5[i]; cnt1++)
+        if(self->l_min_F5[i][cnt1] < INF){
+          self->E_F5[i][cnt1] += self->l_min_F5[i][cnt1]/2;
+          free(self->E_F5[i][cnt1]);
+        }
+      if(self->k_min_F5[i] < INF){
+        self->E_F5[i] += self->k_min_F5[i];
+        free(self->E_F5[i]);
+        self->l_min_F5[i] += self->k_min_F5[i];
+        self->l_max_F5[i] += self->k_min_F5[i];
+        free(self->l_min_F5[i]);
+        free(self->l_max_F5[i]);
+      }
+    }
+    free(self->E_F5);
+    free(self->l_min_F5);
+    free(self->l_max_F5);
+    free(self->k_min_F5);
+    free(self->k_max_F5);
+  }
+
+  if(self->E_F3 != NULL){
+    for(i = 1; i <= length; i++){
+      if(!self->E_F3[i]) continue;
+      for(cnt1 = self->k_min_F3[i]; cnt1 <= self->k_max_F3[i]; cnt1++)
+        if(self->l_min_F3[i][cnt1] < INF){
+          self->E_F3[i][cnt1] += self->l_min_F3[i][cnt1]/2;
+          free(self->E_F3[i][cnt1]);
+        }
+      if(self->k_min_F3[i] < INF){
+        self->E_F3[i] += self->k_min_F3[i];
+        free(self->E_F3[i]);
+        self->l_min_F3[i] += self->k_min_F3[i];
+        self->l_max_F3[i] += self->k_min_F3[i];
+        free(self->l_min_F3[i]);
+        free(self->l_max_F3[i]);
+      }
+    }
+    free(self->E_F3);
+    free(self->l_min_F3);
+    free(self->l_max_F3);
+    free(self->k_min_F3);
+    free(self->k_max_F3);
+  }
+
+#ifdef COUNT_STATES
+  if(self->N_C != NULL){
+    for(i = 1; i < length; i++){
+      for(j = i; j <= length; j++){
+        ij = indx[i] - j;
+        if(!self->N_C[ij]) continue;
+        for(cnt1 = self->k_min_C[ij]; cnt1 <= self->k_max_C[ij]; cnt1++)
+          if(self->l_min_C[ij][cnt1] < INF){
+            self->N_C[ij][cnt1] += self->l_min_C[ij][cnt1]/2;
+            free(self->N_C[ij][cnt1]);
+          }
+        if(self->k_min_C[ij] < INF){
+          self->N_C[ij] += self->k_min_C[ij];
+          free(self->N_C[ij]);
+        }
+      }
+    }
+    free(self->N_C);
+  }
+#endif
+
+  if(self->E_C != NULL){
+    for(i = 1; i < length; i++){
+      for(j = i; j <= length; j++){
+        ij = indx[i] - j;
+        if(!self->E_C[ij]) continue;
+        for(cnt1 = self->k_min_C[ij]; cnt1 <= self->k_max_C[ij]; cnt1++)
+          if(self->l_min_C[ij][cnt1] < INF){
+            self->E_C[ij][cnt1] += self->l_min_C[ij][cnt1]/2;
+            free(self->E_C[ij][cnt1]);
+          }
+        if(self->k_min_C[ij] < INF){
+          self->E_C[ij] += self->k_min_C[ij];
+          free(self->E_C[ij]);
+          self->l_min_C[ij] += self->k_min_C[ij];
+          self->l_max_C[ij] += self->k_min_C[ij];
+          free(self->l_min_C[ij]);
+          free(self->l_max_C[ij]);
+        }
+      }
+    }
+    free(self->E_C);
+    free(self->l_min_C);
+    free(self->l_max_C);
+    free(self->k_min_C);
+    free(self->k_max_C);
+  }
+
+#ifdef COUNT_STATES
+  if(self->N_M != NULL){
+    for(i = 1; i < length; i++){
+      for(j = i; j <= length; j++){
+        ij = indx[i] - j;
+        if(!self->N_M[ij]) continue;
+        for(cnt1 = self->k_min_M[ij]; cnt1 <= self->k_max_M[ij]; cnt1++)
+          if(self->l_min_M[ij][cnt1] < INF){
+            self->N_M[ij][cnt1] += self->l_min_M[ij][cnt1]/2;
+            free(self->N_M[ij][cnt1]);
+          }
+        if(self->k_min_M[ij] < INF){
+          self->N_M[ij] += self->k_min_M[ij];
+          free(self->N_M[ij]);
+        }
+      }
+    }
+    free(self->N_M);
+  }
+#endif
+
+  if(self->E_M != NULL){
+    for(i = 1; i < length; i++){
+      for(j = i; j <= length; j++){
+        ij = indx[i] - j;
+        if(!self->E_M[ij]) continue;
+        for(cnt1 = self->k_min_M[ij]; cnt1 <= self->k_max_M[ij]; cnt1++)
+          if(self->l_min_M[ij][cnt1] < INF){
+            self->E_M[ij][cnt1] += self->l_min_M[ij][cnt1]/2;
+            free(self->E_M[ij][cnt1]);
+          }
+        if(self->k_min_M[ij] < INF){
+          self->E_M[ij] += self->k_min_M[ij];
+          free(self->E_M[ij]);
+          self->l_min_M[ij] += self->k_min_M[ij];
+          self->l_max_M[ij] += self->k_min_M[ij];
+          free(self->l_min_M[ij]);
+          free(self->l_max_M[ij]);
+        }
+      }
+    }
+    free(self->E_M);
+    free(self->l_min_M);
+    free(self->l_max_M);
+    free(self->k_min_M);
+    free(self->k_max_M);
+  }
+
+#ifdef COUNT_STATES
+  if(self->N_M1 != NULL){
+    for(i = 1; i < length; i++){
+      for(j = i; j <= length; j++){
+        ij = indx[i] - j;
+        if(!self->N_M1[ij]) continue;
+        for(cnt1 = self->k_min_M1[ij]; cnt1 <= self->k_max_M1[ij]; cnt1++)
+          if(self->l_min_M1[ij][cnt1] < INF){
+            self->N_M1[ij][cnt1] += self->l_min_M1[ij][cnt1]/2;
+            free(self->N_M1[ij][cnt1]);
+          }
+        if(self->k_min_M1[ij] < INF){
+          self->N_M1[ij] += self->k_min_M1[ij];
+          free(self->N_M1[ij]);
+        }
+      }
+    }
+    free(self->N_M1);
+  }
+#endif
+
+  if(self->E_M1 != NULL){
+    for(i = 1; i < length; i++){
+      for(j = i; j <= length; j++){
+        ij = indx[i] - j;
+        if(!self->E_M1[ij]) continue;
+        for(cnt1 = self->k_min_M1[ij]; cnt1 <= self->k_max_M1[ij]; cnt1++)
+          if(self->l_min_M1[ij][cnt1] < INF){
+            self->E_M1[ij][cnt1] += self->l_min_M1[ij][cnt1]/2;
+            free(self->E_M1[ij][cnt1]);
+          }
+        if(self->k_min_M1[ij] < INF){
+          self->E_M1[ij] += self->k_min_M1[ij];
+          free(self->E_M1[ij]);
+          self->l_min_M1[ij] += self->k_min_M1[ij];
+          self->l_max_M1[ij] += self->k_min_M1[ij];
+          free(self->l_min_M1[ij]);
+          free(self->l_max_M1[ij]);
+        }
+      }
+    }
+    free(self->E_M1);
+    free(self->l_min_M1);
+    free(self->l_max_M1);
+    free(self->k_min_M1);
+    free(self->k_max_M1);
+  }
+
+  if(self->E_M2 != NULL){
+    for(i = 1; i < length-TURN-1; i++){
+      if(!self->E_M2[i]) continue;
+      for(cnt1 = self->k_min_M2[i]; cnt1 <= self->k_max_M2[i]; cnt1++)
+        if(self->l_min_M2[i][cnt1] < INF){
+          self->E_M2[i][cnt1] += self->l_min_M2[i][cnt1]/2;
+          free(self->E_M2[i][cnt1]);
+        }
+      if(self->k_min_M2[i] < INF){
+        self->E_M2[i] += self->k_min_M2[i];
+        free(self->E_M2[i]);
+        self->l_min_M2[i] += self->k_min_M2[i];
+        self->l_max_M2[i] += self->k_min_M2[i];
+        free(self->l_min_M2[i]);
+        free(self->l_max_M2[i]);
+      }
+    }
+    free(self->E_M2);
+    free(self->l_min_M2);
+    free(self->l_max_M2);
+    free(self->k_min_M2);
+    free(self->k_max_M2);
+  }
+
+  if(self->E_Fc != NULL){
+    for(cnt1 = self->k_min_Fc; cnt1 <= self->k_max_Fc; cnt1++)
+      if(self->l_min_Fc[cnt1] < INF){
+        self->E_Fc[cnt1] += self->l_min_Fc[cnt1]/2;
+        free(self->E_Fc[cnt1]);
+      }
+    if(self->k_min_Fc < INF){
+      self->E_Fc += self->k_min_Fc;
+      free(self->E_Fc);
+      self->l_min_Fc += self->k_min_Fc;
+      self->l_max_Fc += self->k_min_Fc;
+      free(self->l_min_Fc);
+      free(self->l_max_Fc);
+    }
+  }
+
+  if(self->E_FcI != NULL){
+    for(cnt1 = self->k_min_FcI; cnt1 <= self->k_max_FcI; cnt1++)
+      if(self->l_min_FcI[cnt1] < INF){
+        self->E_FcI[cnt1] += self->l_min_FcI[cnt1]/2;
+        free(self->E_FcI[cnt1]);
+      }
+    if(self->k_min_FcI < INF){
+      self->E_FcI += self->k_min_FcI;
+      free(self->E_FcI);
+      self->l_min_FcI += self->k_min_FcI;
+      self->l_max_FcI += self->k_min_FcI;
+      free(self->l_min_FcI);
+      free(self->l_max_FcI);
+    }
+  }
+
+  if(self->E_FcH != NULL){
+    for(cnt1 = self->k_min_FcH; cnt1 <= self->k_max_FcH; cnt1++)
+      if(self->l_min_FcH[cnt1] < INF){
+        self->E_FcH[cnt1] += self->l_min_FcH[cnt1]/2;
+        free(self->E_FcH[cnt1]);
+      }
+    if(self->k_min_FcH < INF){
+      self->E_FcH += self->k_min_FcH;
+      free(self->E_FcH);
+      self->l_min_FcH += self->k_min_FcH;
+      self->l_max_FcH += self->k_min_FcH;
+      free(self->l_min_FcH);
+      free(self->l_max_FcH);
+    }
+  }
+
+  if(self->E_FcM != NULL){
+    for(cnt1 = self->k_min_FcM; cnt1 <= self->k_max_FcM; cnt1++)
+      if(self->l_min_FcM[cnt1] < INF){
+        self->E_FcM[cnt1] += self->l_min_FcM[cnt1]/2;
+        free(self->E_FcM[cnt1]);
+      }
+    if(self->k_min_FcM < INF){
+      self->E_FcM += self->k_min_FcM;
+      free(self->E_FcM);
+      self->l_min_FcM += self->k_min_FcM;
+      self->l_max_FcM += self->k_min_FcM;
+      free(self->l_min_FcM);
+      free(self->l_max_FcM);
+    }
+  }
+
+  free(self->E_F5_rem);
+  free(self->E_F3_rem);
+  free(self->E_C_rem);
+  free(self->E_M_rem);
+  free(self->E_M1_rem);
+  free(self->E_M2_rem);
+}
+
+PRIVATE void
+pf_matrices_alloc_default(vrna_mx_pf_t *vars,
+                          unsigned int m,
+                          unsigned int alloc_vector){
+
+  unsigned int  n, size, lin_size;
+
+  n             = vars->length;
+  size          = ((n + 1) * (n + 2)) / 2;
+  lin_size      = n + 2;
+
+  vars->q       = NULL;
+  vars->qb      = NULL;
+  vars->qm      = NULL;
+  vars->qm1     = NULL;
+  vars->qm2     = NULL;
+  vars->probs   = NULL;
+  vars->q1k     = NULL;
+  vars->qln     = NULL;
+
+  if(alloc_vector & ALLOC_F)
+    vars->q     = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * size);
+
+  if(alloc_vector & ALLOC_C)
+    vars->qb    = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * size);
+
+  if(alloc_vector & ALLOC_FML)
+    vars->qm    = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * size);
+
+  if(alloc_vector & ALLOC_UNIQ)
+    vars->qm1   = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * size);
+
+  if(alloc_vector & ALLOC_CIRC)
+    vars->qm2   = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * lin_size);
+
+  if(alloc_vector & ALLOC_PROBS)
+    vars->probs = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * size);
+
+  if(alloc_vector & ALLOC_AUX){
+    vars->q1k   = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * lin_size);
+    vars->qln   = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * lin_size);
+  }
+}
+
+PRIVATE void
+pf_matrices_free_default( vrna_mx_pf_t *self){
+
+  free(self->q);
+  free(self->qb);
+  free(self->qm);
+  free(self->qm1);
+  free(self->qm2);
+  free(self->probs);
+  free(self->G);
+  free(self->q1k);
+  free(self->qln);
+}
+
+PRIVATE void
+pf_matrices_alloc_2Dfold( vrna_mx_pf_t *vars,
+                          unsigned int m,
+                          unsigned int alloc_vector){
+
+  unsigned int  n, size, lin_size;
+
+  n             = vars->length;
+  size          = ((n + 1) * (n + 2)) / 2;
+  lin_size      = n + 2;
+
+  vars->Q           = NULL;
+  vars->l_min_Q     = NULL;
+  vars->l_max_Q     = NULL;
+  vars->k_min_Q     = NULL;
+  vars->k_max_Q     = NULL;
+  vars->Q_rem       = NULL;
+
+  vars->Q_B         = NULL;
+  vars->l_min_Q_B   = NULL;
+  vars->l_max_Q_B   = NULL;
+  vars->k_min_Q_B   = NULL;
+  vars->k_max_Q_B   = NULL;
+  vars->Q_B_rem     = NULL;
+
+  vars->Q_M         = NULL;
+  vars->l_min_Q_M   = NULL;
+  vars->l_max_Q_M   = NULL;
+  vars->k_min_Q_M   = NULL;
+  vars->k_max_Q_M   = NULL;
+  vars->Q_M_rem     = NULL;
+
+  vars->Q_M1        = NULL;
+  vars->l_min_Q_M1  = NULL;
+  vars->l_max_Q_M1  = NULL;
+  vars->k_min_Q_M1  = NULL;
+  vars->k_max_Q_M1  = NULL;
+  vars->Q_M1_rem    = NULL;
+
+  vars->Q_M2        = NULL;
+  vars->l_min_Q_M2  = NULL;
+  vars->l_max_Q_M2  = NULL;
+  vars->k_min_Q_M2  = NULL;
+  vars->k_max_Q_M2  = NULL;
+  vars->Q_M2_rem    = NULL;
+
+  vars->Q_c         = NULL;
+  vars->Q_cH        = NULL;
+  vars->Q_cI        = NULL;
+  vars->Q_cM        = NULL;
+  vars->Q_c_rem     = 0.;
+  vars->Q_cH_rem    = 0.;
+  vars->Q_cI_rem    = 0.;
+  vars->Q_cM_rem    = 0.;
+
+  if(alloc_vector & ALLOC_F){
+    vars->Q       = (FLT_OR_DBL ***)vrna_alloc(sizeof(FLT_OR_DBL **)  * size);
+    vars->l_min_Q = (int **)        vrna_alloc(sizeof(int *)          * size);
+    vars->l_max_Q = (int **)        vrna_alloc(sizeof(int *)          * size);
+    vars->k_min_Q = (int *)         vrna_alloc(sizeof(int)            * size);
+    vars->k_max_Q = (int *)         vrna_alloc(sizeof(int)            * size);
+    vars->Q_rem   = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)     * size);
+  }
+
+  if(alloc_vector & ALLOC_C){
+    vars->Q_B       = (FLT_OR_DBL ***)vrna_alloc(sizeof(FLT_OR_DBL **)  * size);
+    vars->l_min_Q_B = (int **)        vrna_alloc(sizeof(int *)          * size);
+    vars->l_max_Q_B = (int **)        vrna_alloc(sizeof(int *)          * size);
+    vars->k_min_Q_B = (int *)         vrna_alloc(sizeof(int)            * size);
+    vars->k_max_Q_B = (int *)         vrna_alloc(sizeof(int)            * size);
+    vars->Q_B_rem   = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)     * size);
+  }
+
+  if(alloc_vector & ALLOC_FML){
+    vars->Q_M       = (FLT_OR_DBL ***)vrna_alloc(sizeof(FLT_OR_DBL **)  * size);
+    vars->l_min_Q_M = (int **)        vrna_alloc(sizeof(int *)          * size);
+    vars->l_max_Q_M = (int **)        vrna_alloc(sizeof(int *)          * size);
+    vars->k_min_Q_M = (int *)         vrna_alloc(sizeof(int)            * size);
+    vars->k_max_Q_M = (int *)         vrna_alloc(sizeof(int)            * size);
+    vars->Q_M_rem   = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)      * size);
+  }
+
+  if(alloc_vector & ALLOC_UNIQ){
+    vars->Q_M1        = (FLT_OR_DBL ***)vrna_alloc(sizeof(FLT_OR_DBL **)  * size);
+    vars->l_min_Q_M1  = (int **)        vrna_alloc(sizeof(int *)          * size);
+    vars->l_max_Q_M1  = (int **)        vrna_alloc(sizeof(int *)          * size);
+    vars->k_min_Q_M1  = (int *)         vrna_alloc(sizeof(int)            * size);
+    vars->k_max_Q_M1  = (int *)         vrna_alloc(sizeof(int)            * size);
+    vars->Q_M1_rem    = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)     * size);
+  }
+
+  if(alloc_vector & ALLOC_CIRC){
+    vars->Q_M2        = (FLT_OR_DBL ***)vrna_alloc(sizeof(FLT_OR_DBL **)  * lin_size);
+    vars->l_min_Q_M2  = (int **)        vrna_alloc(sizeof(int *)          * lin_size);
+    vars->l_max_Q_M2  = (int **)        vrna_alloc(sizeof(int *)          * lin_size);
+    vars->k_min_Q_M2  = (int *)         vrna_alloc(sizeof(int)            * lin_size);
+    vars->k_max_Q_M2  = (int *)         vrna_alloc(sizeof(int)            * lin_size);
+    vars->Q_M2_rem    = (FLT_OR_DBL *)  vrna_alloc(sizeof(FLT_OR_DBL)     * lin_size);
+  }
+}
+
+PRIVATE void
+pf_matrices_free_2Dfold(vrna_mx_pf_t *self,
+                        unsigned int length,
+                        int *indx,
+                        int *jindx){
+
+  unsigned int  i, j, ij;
+  int           cnt1;
+
+  /* This will be some fun... */
+  if(self->Q != NULL){
+    for(i = 1; i <= length; i++){
+      for(j = i; j <= length; j++){
+        ij = indx[i] - j;
+        if(!self->Q[ij]) continue;
+        for(cnt1 = self->k_min_Q[ij]; cnt1 <= self->k_max_Q[ij]; cnt1++)
+          if(self->l_min_Q[ij][cnt1] < INF){
+            self->Q[ij][cnt1] += self->l_min_Q[ij][cnt1]/2;
+            free(self->Q[ij][cnt1]);
+          }
+        if(self->k_min_Q[ij] < INF){
+          self->Q[ij] += self->k_min_Q[ij];
+          free(self->Q[ij]);
+          self->l_min_Q[ij] += self->k_min_Q[ij];
+          self->l_max_Q[ij] += self->k_min_Q[ij];
+          free(self->l_min_Q[ij]);
+          free(self->l_max_Q[ij]);
+        }
+      }
+    }
+  }
+  free(self->Q);
+  free(self->l_min_Q);
+  free(self->l_max_Q);
+  free(self->k_min_Q);
+  free(self->k_max_Q);
+
+  if(self->Q_B != NULL){
+    for(i = 1; i < length; i++){
+      for(j = i; j <= length; j++){
+        ij = indx[i] - j;
+        if(!self->Q_B[ij]) continue;
+        for(cnt1 = self->k_min_Q_B[ij]; cnt1 <= self->k_max_Q_B[ij]; cnt1++)
+          if(self->l_min_Q_B[ij][cnt1] < INF){
+            self->Q_B[ij][cnt1] += self->l_min_Q_B[ij][cnt1]/2;
+            free(self->Q_B[ij][cnt1]);
+          }
+        if(self->k_min_Q_B[ij] < INF){
+          self->Q_B[ij] += self->k_min_Q_B[ij];
+          free(self->Q_B[ij]);
+          self->l_min_Q_B[ij] += self->k_min_Q_B[ij];
+          self->l_max_Q_B[ij] += self->k_min_Q_B[ij];
+          free(self->l_min_Q_B[ij]);
+          free(self->l_max_Q_B[ij]);
+        }
+      }
+    }
+  }
+  free(self->Q_B);
+  free(self->l_min_Q_B);
+  free(self->l_max_Q_B);
+  free(self->k_min_Q_B);
+  free(self->k_max_Q_B);
+
+  if(self->Q_M != NULL){
+    for(i = 1; i < length; i++){
+      for(j = i; j <= length; j++){
+        ij = indx[i] - j;
+        if(!self->Q_M[ij]) continue;
+        for(cnt1 = self->k_min_Q_M[ij]; cnt1 <= self->k_max_Q_M[ij]; cnt1++)
+          if(self->l_min_Q_M[ij][cnt1] < INF){
+            self->Q_M[ij][cnt1] += self->l_min_Q_M[ij][cnt1]/2;
+            free(self->Q_M[ij][cnt1]);
+          }
+        if(self->k_min_Q_M[ij] < INF){
+          self->Q_M[ij] += self->k_min_Q_M[ij];
+          free(self->Q_M[ij]);
+          self->l_min_Q_M[ij] += self->k_min_Q_M[ij];
+          self->l_max_Q_M[ij] += self->k_min_Q_M[ij];
+          free(self->l_min_Q_M[ij]);
+          free(self->l_max_Q_M[ij]);
+        }
+      }
+    }
+  }
+  free(self->Q_M);
+  free(self->l_min_Q_M);
+  free(self->l_max_Q_M);
+  free(self->k_min_Q_M);
+  free(self->k_max_Q_M);
+
+  if(self->Q_M1 != NULL){
+    for(i = 1; i < length; i++){
+      for(j = i; j <= length; j++){
+        ij = jindx[j] + i;
+        if(!self->Q_M1[ij]) continue;
+        for(cnt1 = self->k_min_Q_M1[ij]; cnt1 <= self->k_max_Q_M1[ij]; cnt1++)
+          if(self->l_min_Q_M1[ij][cnt1] < INF){
+            self->Q_M1[ij][cnt1] += self->l_min_Q_M1[ij][cnt1]/2;
+            free(self->Q_M1[ij][cnt1]);
+          }
+        if(self->k_min_Q_M1[ij] < INF){
+          self->Q_M1[ij] += self->k_min_Q_M1[ij];
+          free(self->Q_M1[ij]);
+          self->l_min_Q_M1[ij] += self->k_min_Q_M1[ij];
+          self->l_max_Q_M1[ij] += self->k_min_Q_M1[ij];
+          free(self->l_min_Q_M1[ij]);
+          free(self->l_max_Q_M1[ij]);
+        }
+      }
+    }
+  }
+  free(self->Q_M1);
+  free(self->l_min_Q_M1);
+  free(self->l_max_Q_M1);
+  free(self->k_min_Q_M1);
+  free(self->k_max_Q_M1);
+
+  if(self->Q_M2 != NULL){
+    for(i = 1; i < length-TURN-1; i++){
+      if(!self->Q_M2[i]) continue;
+      for(cnt1 = self->k_min_Q_M2[i]; cnt1 <= self->k_max_Q_M2[i]; cnt1++)
+        if(self->l_min_Q_M2[i][cnt1] < INF){
+          self->Q_M2[i][cnt1] += self->l_min_Q_M2[i][cnt1]/2;
+          free(self->Q_M2[i][cnt1]);
+        }
+      if(self->k_min_Q_M2[i] < INF){
+        self->Q_M2[i] += self->k_min_Q_M2[i];
+        free(self->Q_M2[i]);
+        self->l_min_Q_M2[i] += self->k_min_Q_M2[i];
+        self->l_max_Q_M2[i] += self->k_min_Q_M2[i];
+        free(self->l_min_Q_M2[i]);
+        free(self->l_max_Q_M2[i]);
+      }
+    }
+  }
+  free(self->Q_M2);
+  free(self->l_min_Q_M2);
+  free(self->l_max_Q_M2);
+  free(self->k_min_Q_M2);
+  free(self->k_max_Q_M2);
+
+  if(self->Q_c != NULL){
+    for(cnt1 = self->k_min_Q_c; cnt1 <= self->k_max_Q_c; cnt1++)
+      if(self->l_min_Q_c[cnt1] < INF){
+        self->Q_c[cnt1] += self->l_min_Q_c[cnt1]/2;
+        free(self->Q_c[cnt1]);
+      }
+    if(self->k_min_Q_c < INF){
+      self->Q_c += self->k_min_Q_c;
+      free(self->Q_c);
+      self->l_min_Q_c += self->k_min_Q_c;
+      self->l_max_Q_c += self->k_min_Q_c;
+      free(self->l_min_Q_c);
+      free(self->l_max_Q_c);
+    }
+  }
+
+  if(self->Q_cI != NULL){
+    for(cnt1 = self->k_min_Q_cI; cnt1 <= self->k_max_Q_cI; cnt1++)
+      if(self->l_min_Q_cI[cnt1] < INF){
+        self->Q_cI[cnt1] += self->l_min_Q_cI[cnt1]/2;
+        free(self->Q_cI[cnt1]);
+      }
+    if(self->k_min_Q_cI < INF){
+      self->Q_cI += self->k_min_Q_cI;
+      free(self->Q_cI);
+      self->l_min_Q_cI += self->k_min_Q_cI;
+      self->l_max_Q_cI += self->k_min_Q_cI;
+      free(self->l_min_Q_cI);
+      free(self->l_max_Q_cI);
+    }
+  }
+
+  if(self->Q_cH != NULL){
+    for(cnt1 = self->k_min_Q_cH; cnt1 <= self->k_max_Q_cH; cnt1++)
+      if(self->l_min_Q_cH[cnt1] < INF){
+        self->Q_cH[cnt1] += self->l_min_Q_cH[cnt1]/2;
+        free(self->Q_cH[cnt1]);
+      }
+    if(self->k_min_Q_cH < INF){
+      self->Q_cH += self->k_min_Q_cH;
+      free(self->Q_cH);
+      self->l_min_Q_cH += self->k_min_Q_cH;
+      self->l_max_Q_cH += self->k_min_Q_cH;
+      free(self->l_min_Q_cH);
+      free(self->l_max_Q_cH);
+    }
+  }
+
+  if(self->Q_cM != NULL){
+    for(cnt1 = self->k_min_Q_cM; cnt1 <= self->k_max_Q_cM; cnt1++)
+      if(self->l_min_Q_cM[cnt1] < INF){
+        self->Q_cM[cnt1] += self->l_min_Q_cM[cnt1]/2;
+        free(self->Q_cM[cnt1]);
+      }
+    if(self->k_min_Q_cM < INF){
+      self->Q_cM += self->k_min_Q_cM;
+      free(self->Q_cM);
+      self->l_min_Q_cM += self->k_min_Q_cM;
+      self->l_max_Q_cM += self->k_min_Q_cM;
+      free(self->l_min_Q_cM);
+      free(self->l_max_Q_cM);
+    }
+  }
+
+  free(self->Q_rem);
+  free(self->Q_B_rem);
+  free(self->Q_M_rem);
+  free(self->Q_M1_rem);
+  free(self->Q_M2_rem);
+}
+
diff --git a/C/ViennaRNA/dp_matrices.h b/C/ViennaRNA/dp_matrices.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/dp_matrices.h
@@ -0,0 +1,407 @@
+#ifndef VIENNA_RNA_PACKAGE_DP_MATRICES_H
+#define VIENNA_RNA_PACKAGE_DP_MATRICES_H
+
+/**
+ *  @file     dp_matrices.h
+ *  @ingroup  data_structures
+ *  @brief    Functions to deal with standard dynamic programming (DP) matrices
+ */
+
+/**
+ *  @addtogroup dp_matrices   The Dynamic Programming Matrices
+ *  @brief  This module provides interfaces that deal with creation and destruction of
+ *          dynamic programming matrices used within the RNAlib.
+ *
+ *  @{
+ *  @ingroup  dp_matrices
+ */
+
+/** @brief Typename for the Minimum Free Energy (MFE) DP matrices data structure #vrna_mx_mfe_s */
+typedef struct  vrna_mx_mfe_s vrna_mx_mfe_t;
+/** @brief Typename for the Partition Function (PF) DP matrices data structure #vrna_mx_pf_s */
+typedef struct  vrna_mx_pf_s  vrna_mx_pf_t;
+
+#include <ViennaRNA/data_structures.h>
+
+/**
+ *  @brief  An enumerator that is used to specify the type of a polymorphic Dynamic Programming (DP)
+ *  matrix data structure
+ *  @see #vrna_mx_mfe_t, #vrna_mx_pf_t
+ */
+typedef enum {
+  VRNA_MX_DEFAULT,  /**<  @brief  Default DP matrices */
+  VRNA_MX_WINDOW,   /**<  @brief  DP matrices suitable for local structure prediction using
+                          window approach.
+                          @see    vrna_mfe_window(), vrna_mfe_window_zscore(), pfl_fold()
+                    */
+  VRNA_MX_2DFOLD    /**<  @brief  DP matrices suitable for distance class partitioned structure prediction
+                          @see  vrna_mfe_TwoD(), vrna_pf_TwoD()
+                    */
+} vrna_mx_type_e;
+
+/**
+ *  @brief  Minimum Free Energy (MFE) Dynamic Programming (DP) matrices data structure required within the #vrna_fold_compound_t
+ */
+struct vrna_mx_mfe_s {
+  /** @name Common fields for MFE matrices
+      @{
+   */
+  vrna_mx_type_e     type;
+  unsigned int  length;    /**<  @brief  Length of the sequence, therefore an indicator of the size of the DP matrices */
+  /**
+      @}
+   */
+
+#ifndef VRNA_DISABLE_C11_FEATURES
+    /* C11 support for unnamed unions/structs */
+  union {
+    struct {
+#endif
+      /** @name Default DP matrices
+          @note These data fields are available if
+                @code vrna_mx_mfe_t.type == VRNA_MX_DEFAULT @endcode
+        @{
+       */
+      int     *c;   /**<  @brief  Energy array, given that i-j pair */
+      int     *f5;  /**<  @brief  Energy of 5' end */
+      int     *f3;  /**<  @brief  Energy of 3' end */
+      int     *fc;  /**<  @brief  Energy from i to cutpoint (and vice versa if i>cut) */
+      int     *fML; /**<  @brief  Multi-loop auxiliary energy array */
+      int     *fM1; /**<  @brief  Second ML array, only for unique multibrnach loop decomposition */
+      int     *fM2; /**<  @brief  Energy for a multibranch loop region with exactly two stems, extending to 3' end */
+      int     *ggg; /**<  @brief  Energies of g-quadruplexes */
+      int     Fc;   /**<  @brief  Minimum Free Energy of entire circular RNA */
+      int     FcH;
+      int     FcI;
+      int     FcM;
+      /**
+        @}
+       */
+
+#ifndef VRNA_DISABLE_C11_FEATURES
+    /* C11 support for unnamed unions/structs */
+    };
+    struct {
+#endif
+      /** @name Local Folding DP matrices using window approach
+          @note These data fields are available if
+                @code vrna_mx_mfe_t.type == VRNA_MX_WINDOW @endcode
+        @{
+       */
+      int     **c_local;    /**<  @brief  Energy array, given that i-j pair */
+      int     *f3_local;    /**<  @brief  Energy of 5' end */
+      int     **fML_local;  /**<  @brief  Multi-loop auxiliary energy array */
+      int     **ggg_local;  /**<  @brief  Energies of g-quadruplexes */
+      /**
+        @}
+       */
+#ifndef VRNA_DISABLE_C11_FEATURES
+    /* C11 support for unnamed unions/structs */
+    };
+    struct {
+#endif
+
+      /** @name Distance Class DP matrices
+          @note These data fields are available if
+                @code vrna_mx_mfe_t.type == VRNA_MX_2DFOLD @endcode
+        @{
+      */
+      int             ***E_F5;
+      int             **l_min_F5;
+      int             **l_max_F5;
+      int             *k_min_F5;
+      int             *k_max_F5;
+
+      int             ***E_F3;
+      int             **l_min_F3;
+      int             **l_max_F3;
+      int             *k_min_F3;
+      int             *k_max_F3;
+
+      int             ***E_C;
+      int             **l_min_C;
+      int             **l_max_C;
+      int             *k_min_C;
+      int             *k_max_C;
+
+      int             ***E_M;
+      int             **l_min_M;
+      int             **l_max_M;
+      int             *k_min_M;
+      int             *k_max_M;
+
+      int             ***E_M1;
+      int             **l_min_M1;
+      int             **l_max_M1;
+      int             *k_min_M1;
+      int             *k_max_M1;
+
+      int             ***E_M2;
+      int             **l_min_M2;
+      int             **l_max_M2;
+      int             *k_min_M2;
+      int             *k_max_M2;
+
+      int             **E_Fc;
+      int             *l_min_Fc;
+      int             *l_max_Fc;
+      int             k_min_Fc;
+      int             k_max_Fc;
+
+      int             **E_FcH;
+      int             *l_min_FcH;
+      int             *l_max_FcH;
+      int             k_min_FcH;
+      int             k_max_FcH;
+
+      int             **E_FcI;
+      int             *l_min_FcI;
+      int             *l_max_FcI;
+      int             k_min_FcI;
+      int             k_max_FcI;
+
+      int             **E_FcM;
+      int             *l_min_FcM;
+      int             *l_max_FcM;
+      int             k_min_FcM;
+      int             k_max_FcM;
+
+      /* auxilary arrays for remaining set of coarse graining (k,l) > (k_max, l_max) */
+      int             *E_F5_rem;
+      int             *E_F3_rem;
+      int             *E_C_rem;
+      int             *E_M_rem;
+      int             *E_M1_rem;
+      int             *E_M2_rem;
+
+      int             E_Fc_rem;
+      int             E_FcH_rem;
+      int             E_FcI_rem;
+      int             E_FcM_rem;
+
+#ifdef COUNT_STATES
+      unsigned long   ***N_F5;
+      unsigned long   ***N_C;
+      unsigned long   ***N_M;
+      unsigned long   ***N_M1;
+#endif
+
+      /**
+        @}
+       */
+
+#ifndef VRNA_DISABLE_C11_FEATURES
+    /* C11 support for unnamed unions/structs */
+    };
+  };
+#endif
+};
+
+/**
+ *  @brief  Partition function (PF) Dynamic Programming (DP) matrices data structure required within the #vrna_fold_compound_t
+ */
+struct vrna_mx_pf_s {
+  /** @name Common fields for DP matrices
+      @{
+   */
+  vrna_mx_type_e  type;
+  unsigned int    length;
+  FLT_OR_DBL      *scale;
+  FLT_OR_DBL      *expMLbase;
+
+
+  /**
+      @}
+   */
+
+#ifndef VRNA_DISABLE_C11_FEATURES
+    /* C11 support for unnamed unions/structs */
+  union {
+    struct {
+#endif
+
+  /** @name Default PF matrices
+      @note These data fields are available if
+            @code vrna_mx_pf_t.type == VRNA_MX_DEFAULT @endcode
+      @{
+   */
+      FLT_OR_DBL  *q;
+      FLT_OR_DBL  *qb;
+      FLT_OR_DBL  *qm;
+      FLT_OR_DBL  *qm1;
+      FLT_OR_DBL  *probs;
+      FLT_OR_DBL  *q1k;
+      FLT_OR_DBL  *qln;
+      FLT_OR_DBL  *G;
+
+      FLT_OR_DBL  qo;
+      FLT_OR_DBL  *qm2;
+      FLT_OR_DBL  qho;
+      FLT_OR_DBL  qio;
+      FLT_OR_DBL  qmo;
+
+  /**
+      @}
+   */
+
+#ifndef VRNA_DISABLE_C11_FEATURES
+    /* C11 support for unnamed unions/structs */
+    };
+    struct {
+#endif
+
+  /** @name Distance Class DP matrices
+      @note These data fields are available if
+            @code vrna_mx_pf_t.type == VRNA_MX_2DFOLD @endcode
+      @{
+   */
+      FLT_OR_DBL      ***Q;
+      int             **l_min_Q;
+      int             **l_max_Q;
+      int             *k_min_Q;
+      int             *k_max_Q;
+
+
+      FLT_OR_DBL      ***Q_B;
+      int             **l_min_Q_B;
+      int             **l_max_Q_B;
+      int             *k_min_Q_B;
+      int             *k_max_Q_B;
+
+      FLT_OR_DBL      ***Q_M;
+      int             **l_min_Q_M;
+      int             **l_max_Q_M;
+      int             *k_min_Q_M;
+      int             *k_max_Q_M;
+
+      FLT_OR_DBL      ***Q_M1;
+      int             **l_min_Q_M1;
+      int             **l_max_Q_M1;
+      int             *k_min_Q_M1;
+      int             *k_max_Q_M1;
+
+      FLT_OR_DBL      ***Q_M2;
+      int             **l_min_Q_M2;
+      int             **l_max_Q_M2;
+      int             *k_min_Q_M2;
+      int             *k_max_Q_M2;
+
+      FLT_OR_DBL      **Q_c;
+      int             *l_min_Q_c;
+      int             *l_max_Q_c;
+      int             k_min_Q_c;
+      int             k_max_Q_c;
+
+      FLT_OR_DBL      **Q_cH;
+      int             *l_min_Q_cH;
+      int             *l_max_Q_cH;
+      int             k_min_Q_cH;
+      int             k_max_Q_cH;
+
+      FLT_OR_DBL      **Q_cI;
+      int             *l_min_Q_cI;
+      int             *l_max_Q_cI;
+      int             k_min_Q_cI;
+      int             k_max_Q_cI;
+
+      FLT_OR_DBL      **Q_cM;
+      int             *l_min_Q_cM;
+      int             *l_max_Q_cM;
+      int             k_min_Q_cM;
+      int             k_max_Q_cM;
+
+      /* auxilary arrays for remaining set of coarse graining (k,l) > (k_max, l_max) */
+      FLT_OR_DBL      *Q_rem;
+      FLT_OR_DBL      *Q_B_rem;
+      FLT_OR_DBL      *Q_M_rem;
+      FLT_OR_DBL      *Q_M1_rem;
+      FLT_OR_DBL      *Q_M2_rem;
+
+      FLT_OR_DBL      Q_c_rem;
+      FLT_OR_DBL      Q_cH_rem;
+      FLT_OR_DBL      Q_cI_rem;
+      FLT_OR_DBL      Q_cM_rem;
+  /**
+      @}
+   */
+
+#ifndef VRNA_DISABLE_C11_FEATURES
+    /* C11 support for unnamed unions/structs */
+    };
+  };
+#endif
+};
+
+/**
+ *  @brief  Add Dynamic Programming (DP) matrices (allocate memory)
+ *
+ *  This function adds DP matrices of a specific type to the provided
+ *  #vrna_fold_compound_t, such that successive DP recursion can be applied.
+ *  The function caller has to specify which type of DP matrix is requested,
+ *  see #vrna_mx_type_e, and what kind of recursive algorithm will be applied
+ *  later on, using the parameters type, and options, respectively. For the
+ *  latter, Minimum free energy (MFE), and Partition function (PF)
+ *  computations are distinguished. A third option that may be passed
+ *  is #VRNA_OPTION_HYBRID, indicating that auxiliary DP arrays are
+ *  required for RNA-RNA interaction prediction.
+ *
+ *  @note Usually, there is no need to call this function, since
+ *  the constructors of #vrna_fold_compound_t are handling all the DP
+ *  matrix memory allocation.
+ *
+ *  @see vrna_mx_mfe_add(), vrna_mx_pf_add(), vrna_fold_compound(),
+ *  vrna_fold_compound_comparative(), vrna_fold_compound_free(),
+ *  vrna_mx_pf_free(), vrna_mx_mfe_free(), #vrna_mx_type_e,
+ *  #VRNA_OPTION_MFE, #VRNA_OPTION_PF, #VRNA_OPTION_HYBRID, #VRNA_OPTION_EVAL_ONLY
+ *
+ *  @param  vc      The #vrna_fold_compound_t that holds pointers to the DP matrices
+ *  @param  type    The type of DP matrices requested
+ *  @param  options Option flags that specify the kind of DP matrices, such
+ *                  as MFE or PF arrays, and auxiliary requirements
+ *  @returns        1 if DP matrices were properly allocated and attached,
+ *                  0 otherwise
+ */
+int
+vrna_mx_add(vrna_fold_compound_t *vc,
+            vrna_mx_type_e type,
+            unsigned int options);
+
+int
+vrna_mx_mfe_add(vrna_fold_compound_t *vc,
+                vrna_mx_type_e mx_type,
+                unsigned int options);
+
+int
+vrna_mx_pf_add( vrna_fold_compound_t *vc,
+                vrna_mx_type_e mx_type,
+                unsigned int options);
+
+int
+vrna_mx_prepare(vrna_fold_compound_t *vc,
+                unsigned int options);
+
+/**
+ *  @brief  Free memory occupied by the Minimum Free Energy (MFE) Dynamic Programming (DP) matrices
+ *
+ *  @see vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_fold_compound_free(), vrna_mx_pf_free()
+ *
+ *  @param  vc  The #vrna_fold_compound_t storing the MFE DP matrices that are to be erased from memory
+ */
+void
+vrna_mx_mfe_free(vrna_fold_compound_t *vc);
+
+/**
+ *  @brief  Free memory occupied by the Partition Function (PF) Dynamic Programming (DP) matrices
+ *
+ *  @see vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_fold_compound_free(), vrna_mx_mfe_free()
+ *
+ *  @param  vc  The #vrna_fold_compound_t storing the PF DP matrices that are to be erased from memory
+ */
+void
+vrna_mx_pf_free(vrna_fold_compound_t *vc);
+
+/**
+ *  @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/duplex.c b/C/ViennaRNA/duplex.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/duplex.c
@@ -0,0 +1,564 @@
+/*
+           compute the duplex structure of two RNA strands,
+                allowing only inter-strand base pairs.
+         see cofold() for computing hybrid structures without
+                             restriction.
+
+                             Ivo Hofacker
+                          Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/alifold.h"
+#include "ViennaRNA/subopt.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/duplex.h"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#define STACK_BULGE1  1     /* stacking energies for bulges of size 1 */
+#define NEW_NINIO     1     /* new asymetry penalty */
+#define MAXSECTORS    500   /* dimension for a backtrack array */
+#define LOCALITY      0.    /* locality parameter for base-pairs */
+#define UNIT 100
+#define MINPSCORE -2 * UNIT
+#define NONE -10000         /* score for forbidden pairs */
+
+
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+PRIVATE vrna_param_t  *P  = NULL;
+PRIVATE int     **c = NULL;                  /* energy array, given that i-j pair */
+PRIVATE short   *S1 = NULL, *SS1 = NULL, *S2 = NULL, *SS2 = NULL;
+PRIVATE int     n1,n2;                /* sequence lengths */
+
+#ifdef _OPENMP
+
+/* NOTE: all variables are assumed to be uninitialized if they are declared as threadprivate
+*/
+#pragma omp threadprivate(P, c, S1, SS1, S2, SS2, n1, n2)
+
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE duplexT duplexfold_cu(const char *s1, const char *s2, int clean_up);
+PRIVATE duplexT aliduplexfold_cu(const char *s1[], const char *s2[], int clean_up);
+PRIVATE char    *backtrack(int i, int j);
+PRIVATE char    *alibacktrack(int i, int j, const short **S1, const short **S2);
+PRIVATE int     compare(const void *sub1, const void *sub2);
+PRIVATE int     covscore(const int *types, int n_seq);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC duplexT duplexfold(const char *s1, const char *s2){
+  return duplexfold_cu(s1, s2, 1);
+}
+
+PRIVATE duplexT duplexfold_cu(const char *s1, const char *s2, int clean_up){
+  int i, j, Emin=INF, i_min=0, j_min=0;
+  char *struc;
+  duplexT mfe;
+  vrna_md_t md;
+
+  n1 = (int) strlen(s1);
+  n2 = (int) strlen(s2);
+
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+
+  c = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+  for (i=1; i<=n1; i++) c[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+
+  S1  = encode_sequence(s1, 0);
+  S2  = encode_sequence(s2, 0);
+  SS1 = encode_sequence(s1, 1);
+  SS2 = encode_sequence(s2, 1);
+
+  for (i=1; i<=n1; i++) {
+    for (j=n2; j>0; j--) {
+      int type, type2, E, k,l;
+      type = pair[S1[i]][S2[j]];
+      c[i][j] = type ? P->DuplexInit : INF;
+      if (!type) continue;
+      c[i][j] += E_ExtLoop(type, (i>1) ? SS1[i-1] : -1, (j<n2) ? SS2[j+1] : -1, P);
+      for (k=i-1; k>0 && k>i-MAXLOOP-2; k--) {
+        for (l=j+1; l<=n2; l++) {
+          if (i-k+l-j-2>MAXLOOP) break;
+          type2 = pair[S1[k]][S2[l]];
+          if (!type2) continue;
+          E = E_IntLoop(i-k-1, l-j-1, type2, rtype[type],
+                            SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1], P);
+          c[i][j] = MIN2(c[i][j], c[k][l]+E);
+        }
+      }
+      E = c[i][j];
+      E += E_ExtLoop(rtype[type], (j > 1) ? SS2[j-1] : -1, (i<n1) ? SS1[i+1] : -1, P);
+      if (E<Emin) {
+        Emin=E; i_min=i; j_min=j;
+      }
+    }
+  }
+
+  struc = backtrack(i_min, j_min);
+  if (i_min<n1) i_min++;
+  if (j_min>1 ) j_min--;
+
+  mfe.i = i_min;
+  mfe.j = j_min;
+  mfe.energy = (float) Emin/100.;
+  mfe.structure = struc;
+  if(clean_up) {
+    for (i=1; i<=n1; i++) free(c[i]);
+    free(c);
+    free(S1);
+    free(S2);
+    free(SS1);
+    free(SS2);
+  }
+  return mfe;
+}
+
+PUBLIC duplexT *duplex_subopt(const char *s1, const char *s2, int delta, int w) {
+  int i,j, n1, n2, thresh, E, n_subopt=0, n_max;
+  char *struc;
+  duplexT mfe;
+  duplexT *subopt;
+
+  n_max=16;
+  subopt = (duplexT *) vrna_alloc(n_max*sizeof(duplexT));
+  mfe = duplexfold_cu(s1, s2, 0);
+  free(mfe.structure);
+
+  thresh = (int) mfe.energy*100+0.1 + delta;
+  n1 = strlen(s1); n2=strlen(s2);
+  for (i=n1; i>0; i--) {
+    for (j=1; j<=n2; j++) {
+      int type, ii,jj, Ed;
+      type = pair[S2[j]][S1[i]];
+      if (!type) continue;
+      E = Ed = c[i][j];
+      Ed += E_ExtLoop(type, (j>1) ? SS2[j-1] : -1, (i<n1) ? SS1[i+1] : -1, P);
+      if (Ed>thresh) continue;
+      /* too keep output small, remove hits that are dominated by a
+         better one close (w) by. For simplicity we do test without
+         adding dangles, which is slightly inaccurate.
+      */
+      for (ii=MAX2(i-w,1); (ii<=MIN2(i+w,n1)) && type; ii++) {
+        for (jj=MAX2(j-w,1); jj<=MIN2(j+w,n2); jj++)
+          if (c[ii][jj]<E) {type=0; break;}
+      }
+      if (!type) continue;
+
+      struc = backtrack(i,j);
+      vrna_message_info(stderr, "%d %d %d", i,j,E);
+      if (n_subopt+1>=n_max) {
+        n_max *= 2;
+        subopt = (duplexT *) vrna_realloc(subopt, n_max*sizeof(duplexT));
+      }
+      subopt[n_subopt].i = MIN2(i+1,n1);
+      subopt[n_subopt].j = MAX2(j-1,1);
+      subopt[n_subopt].energy = Ed * 0.01;
+      subopt[n_subopt++].structure = struc;
+    }
+  }
+  /* free all static globals */
+  for (i=1; i<=n1; i++) free(c[i]);
+  free(c);
+  free(S1); free(S2); free(SS1); free(SS2);
+
+  if (subopt_sorted) qsort(subopt, n_subopt, sizeof(duplexT), compare);
+  subopt[n_subopt].i =0;
+  subopt[n_subopt].j =0;
+  subopt[n_subopt].structure = NULL;
+  return subopt;
+}
+
+PRIVATE char *backtrack(int i, int j) {
+  /* backtrack structure going backwards from i, and forwards from j
+     return structure in bracket notation with & as separator */
+  int k, l, type, type2, E, traced, i0, j0;
+  char *st1, *st2, *struc;
+
+  st1 = (char *) vrna_alloc(sizeof(char)*(n1+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n2+1));
+
+  i0=MIN2(i+1,n1); j0=MAX2(j-1,1);
+
+  while (i>0 && j<=n2) {
+    E = c[i][j]; traced=0;
+    st1[i-1] = '(';
+    st2[j-1] = ')';
+    type = pair[S1[i]][S2[j]];
+    if (!type) vrna_message_error("backtrack failed in fold duplex");
+    for (k=i-1; k>0 && k>i-MAXLOOP-2; k--) {
+      for (l=j+1; l<=n2; l++) {
+        int LE;
+        if (i-k+l-j-2>MAXLOOP) break;
+        type2 = pair[S1[k]][S2[l]];
+        if (!type2) continue;
+        LE = E_IntLoop(i-k-1, l-j-1, type2, rtype[type],
+                       SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1], P);
+        if (E == c[k][l]+LE) {
+          traced=1;
+          i=k; j=l;
+          break;
+        }
+      }
+      if (traced) break;
+    }
+    if (!traced) {
+      E -= E_ExtLoop(type, (i>1) ? SS1[i-1] : -1, (j<n2) ? SS2[j+1] : -1, P);
+      if (E != P->DuplexInit) {
+        vrna_message_error("backtrack failed in fold duplex");
+      } else break;
+    }
+  }
+  if (i>1)  i--;
+  if (j<n2) j++;
+
+  struc = (char *) vrna_alloc(i0-i+1+j-j0+1+2);
+  for (k=MAX2(i,1); k<=i0; k++) if (!st1[k-1]) st1[k-1] = '.';
+  for (k=j0; k<=j; k++) if (!st2[k-1]) st2[k-1] = '.';
+  strcpy(struc, st1+MAX2(i-1,0)); strcat(struc, "&");
+  strcat(struc, st2+j0-1);
+
+  /* printf("%s %3d,%-3d : %3d,%-3d\n", struc, i,i0,j0,j);  */
+  free(st1); free(st2);
+
+  return struc;
+}
+
+/*------------------------------------------------------------------------*/
+
+PRIVATE int compare(const void *sub1, const void *sub2) {
+  int d;
+  if (((duplexT *) sub1)->energy > ((duplexT *) sub2)->energy)
+    return 1;
+  if (((duplexT *) sub1)->energy < ((duplexT *) sub2)->energy)
+    return -1;
+  d = ((duplexT *) sub1)->i - ((duplexT *) sub2)->i;
+  if (d!=0) return d;
+  return  ((duplexT *) sub1)->j - ((duplexT *) sub2)->j;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC duplexT aliduplexfold(const char *s1[], const char *s2[]){
+  return aliduplexfold_cu(s1, s2, 1);
+}
+
+PRIVATE duplexT aliduplexfold_cu(const char *s1[], const char *s2[], int clean_up) {
+  int i, j, s, n_seq, Emin=INF, i_min=0, j_min=0;
+  char *struc;
+  duplexT mfe;
+  short **S1, **S2;
+  int *type;
+  vrna_md_t md;
+  n1 = (int) strlen(s1[0]);
+  n2 = (int) strlen(s2[0]);
+
+  for (s=0; s1[s]!=NULL; s++);
+  n_seq = s;
+  for (s=0; s2[s]!=NULL; s++);
+  if (n_seq != s) vrna_message_error("unequal number of sequences in aliduplexfold()\n");
+
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+
+  c = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+  for (i=1; i<=n1; i++) c[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+
+  S1 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  S2 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  for (s=0; s<n_seq; s++) {
+    if (strlen(s1[s]) != n1) vrna_message_error("uneqal seqence lengths");
+    if (strlen(s2[s]) != n2) vrna_message_error("uneqal seqence lengths");
+    S1[s] = encode_sequence(s1[s], 0);
+    S2[s] = encode_sequence(s2[s], 0);
+  }
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+
+  for (i=1; i<=n1; i++) {
+    for (j=n2; j>0; j--) {
+      int k,l,E,psc;
+      for (s=0; s<n_seq; s++) {
+        type[s] = pair[S1[s][i]][S2[s][j]];
+      }
+      psc = covscore(type, n_seq);
+      for (s=0; s<n_seq; s++) if (type[s]==0) type[s]=7;
+      c[i][j] = (psc>=MINPSCORE) ? (n_seq*P->DuplexInit) : INF;
+      if (psc<MINPSCORE) continue;
+      for(s=0; s<n_seq;s++){
+        c[i][j] += E_ExtLoop(type[s], (i>1) ? S1[s][i-1] : -1, (j<n2) ? S2[s][j+1] : -1, P);
+      }
+      for (k=i-1; k>0 && k>i-MAXLOOP-2; k--) {
+        for (l=j+1; l<=n2; l++) {
+          int type2;
+          if (i-k+l-j-2>MAXLOOP) break;
+          if (c[k][l]>INF/2) continue;
+          for (E=s=0; s<n_seq; s++) {
+            type2 = pair[S1[s][k]][S2[s][l]];
+            if (type2==0) type2=7;
+            E += E_IntLoop(i-k-1, l-j-1, type2, rtype[type[s]],
+                           S1[s][k+1], S2[s][l-1], S1[s][i-1], S2[s][j+1], P);
+          }
+          c[i][j] = MIN2(c[i][j], c[k][l]+E);
+        }
+      }
+      c[i][j] -= psc;
+      E = c[i][j];
+      for (s=0; s<n_seq; s++) {
+        E += E_ExtLoop(rtype[type[s]], (j>1) ? S2[s][j-1] : -1, (i<n1) ? S1[s][i+1] : -1, P);
+      }
+      if (E<Emin) {
+        Emin=E; i_min=i; j_min=j;
+      }
+    }
+  }
+
+  struc = alibacktrack(i_min, j_min, (const short **)S1,(const short **)S2);
+  if (i_min<n1) i_min++;
+  if (j_min>1 ) j_min--;
+
+  mfe.i = i_min;
+  mfe.j = j_min;
+  mfe.energy = (float) (Emin/(100.*n_seq));
+  mfe.structure = struc;
+  if (clean_up){
+    for (i=1; i<=n1; i++) free(c[i]);
+    free(c);
+  }
+  for (s=0; s<n_seq; s++) {
+    free(S1[s]); free(S2[s]);
+  }
+  free(S1);
+  free(S2);
+  free(type);
+  return mfe;
+}
+
+PUBLIC duplexT *aliduplex_subopt(const char *s1[], const char *s2[], int delta, int w) {
+  int i,j, n1, n2, thresh, E, n_subopt=0, n_max, s, n_seq, *type;
+  char *struc;
+  duplexT mfe;
+  duplexT *subopt;
+  short **S1, **S2;
+
+  n_max=16;
+  subopt = (duplexT *) vrna_alloc(n_max*sizeof(duplexT));
+  mfe = aliduplexfold_cu(s1, s2, 0);
+  free(mfe.structure);
+
+  for (s=0; s1[s]!=NULL; s++);
+  n_seq = s;
+
+  thresh =  (int) ((mfe.energy*100. + delta)*n_seq +0.1);
+  n1 = strlen(s1[0]); n2=strlen(s2[0]);
+  S1 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  S2 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  for (s=0; s<n_seq; s++) {
+    if (strlen(s1[s]) != n1) vrna_message_error("uneqal seqence lengths");
+    if (strlen(s2[s]) != n2) vrna_message_error("uneqal seqence lengths");
+    S1[s] = encode_sequence(s1[s], 0);
+    S2[s] = encode_sequence(s2[s], 0);
+  }
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+
+  for (i=n1; i>0; i--) {
+    for (j=1; j<=n2; j++) {
+      int ii, jj, skip, Ed, psc;
+
+      for (s=0; s<n_seq; s++) {
+        type[s] = pair[S2[s][j]][S1[s][i]];
+      }
+      psc = covscore(type, n_seq);
+      for (s=0; s<n_seq; s++) if (type[s]==0) type[s]=7;
+      if (psc<MINPSCORE) continue;
+      E = Ed = c[i][j];
+      for  (s=0; s<n_seq; s++) {
+        Ed += E_ExtLoop(type[s], (j>1) ? S2[s][j-1] : -1, (i<n1) ? S1[s][i+1] : -1, P);
+      }
+      if (Ed>thresh) continue;
+      /* too keep output small, skip hits that are dominated by a
+         better one close (w) by. For simplicity we don't take dangels
+         into account here, thus the heuristic is somewhat inaccurate.
+      */
+      for (skip=0, ii=MAX2(i-w,1); (ii<=MIN2(i+w,n1)) && type; ii++) {
+        for (jj=MAX2(j-w,1); jj<=MIN2(j+w,n2); jj++)
+          if (c[ii][jj]<E) {skip=1; break;}
+      }
+      if (skip) continue;
+      struc = alibacktrack(i,j,(const short **)S1, (const short **)S2);
+      vrna_message_info(stderr, "%d %d %d", i,j,E);
+      if (n_subopt+1>=n_max) {
+        n_max *= 2;
+        subopt = (duplexT *) vrna_realloc(subopt, n_max*sizeof(duplexT));
+      }
+      subopt[n_subopt].i = MIN2(i+1,n1);
+      subopt[n_subopt].j = MAX2(j-1,1);
+      subopt[n_subopt].energy = Ed * 0.01/n_seq;
+      subopt[n_subopt++].structure = struc;
+    }
+  }
+
+  for (i=1; i<=n1; i++) free(c[i]);
+  free(c);
+  for (s=0; s<n_seq; s++) {
+    free(S1[s]); free(S2[s]);
+  }
+  free(S1); free(S2); free(type);
+
+  if (subopt_sorted) qsort(subopt, n_subopt, sizeof(duplexT), compare);
+  subopt[n_subopt].i =0;
+  subopt[n_subopt].j =0;
+  subopt[n_subopt].structure = NULL;
+  return subopt;
+}
+
+PRIVATE char *alibacktrack(int i, int j, const short **S1, const short **S2) {
+  /* backtrack structure going backwards from i, and forwards from j
+     return structure in bracket notation with & as separator */
+  int k, l, *type, type2, E, traced, i0, j0, s, n_seq;
+  char *st1, *st2, *struc;
+
+  n1 = (int) S1[0][0];
+  n2 = (int) S2[0][0];
+
+  for (s=0; S1[s]!=NULL; s++);
+  n_seq = s;
+  for (s=0; S2[s]!=NULL; s++);
+  if (n_seq != s) vrna_message_error("unequal number of sequences in alibacktrack()\n");
+
+  st1 = (char *) vrna_alloc(sizeof(char)*(n1+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n2+1));
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+
+  i0=MIN2(i+1,n1); j0=MAX2(j-1,1);
+
+  while (i>0 && j<=n2) {
+    int psc;
+    E = c[i][j]; traced=0;
+    st1[i-1] = '(';
+    st2[j-1] = ')';
+    for (s=0; s<n_seq; s++) {
+      type[s] = pair[S1[s][i]][S2[s][j]];
+    }
+    psc = covscore(type, n_seq);
+    for (s=0; s<n_seq; s++) if (type[s]==0) type[s] = 7;
+    E += psc;
+    for (k=i-1; k>0 && k>i-MAXLOOP-2; k--) {
+      for (l=j+1; l<=n2; l++) {
+        int LE;
+        if (i-k+l-j-2>MAXLOOP) break;
+        if (c[k][l]>INF/2) continue;
+        for (s=LE=0; s<n_seq; s++) {
+          type2 = pair[S1[s][k]][S2[s][l]];
+          if (type2==0) type2=7;
+          LE += E_IntLoop(i-k-1, l-j-1, type2, rtype[type[s]],
+                           S1[s][k+1], S2[s][l-1], S1[s][i-1], S2[s][j+1], P);
+        }
+        if (E == c[k][l]+LE) {
+          traced=1;
+          i=k; j=l;
+          break;
+        }
+      }
+      if (traced) break;
+    }
+    if (!traced) {
+      for (s=0; s<n_seq; s++) {
+        E -= E_ExtLoop(type[s], (i>1) ? S1[s][i-1] : -1, (j<n2) ? S2[s][j+1] : -1, P);
+      }
+      if (E != n_seq*P->DuplexInit) {
+        vrna_message_error("backtrack failed in aliduplex");
+      } else break;
+    }
+  }
+  if (i>1)  i--;
+  if (j<n2) j++;
+
+  struc = (char *) vrna_alloc(i0-i+1+j-j0+1+2);
+  for (k=MAX2(i,1); k<=i0; k++) if (!st1[k-1]) st1[k-1] = '.';
+  for (k=j0; k<=j; k++) if (!st2[k-1]) st2[k-1] = '.';
+  strcpy(struc, st1+MAX2(i-1,0)); strcat(struc, "&");
+  strcat(struc, st2+j0-1);
+
+  /* printf("%s %3d,%-3d : %3d,%-3d\n", struc, i,i0,j0,j);  */
+  free(st1); free(st2); free(type);
+
+  return struc;
+}
+
+
+PRIVATE int covscore(const int *types, int n_seq) {
+  /* calculate co-variance bonus for a pair depending on  */
+  /* compensatory/consistent mutations and incompatible seqs */
+  /* should be 0 for conserved pairs, >0 for good pairs      */
+  int k,l,s,score, pscore;
+  int dm[7][7]={{0,0,0,0,0,0,0}, /* hamming distance between pairs */
+                {0,0,2,2,1,2,2} /* CG */,
+                {0,2,0,1,2,2,2} /* GC */,
+                {0,2,1,0,2,1,2} /* GU */,
+                {0,1,2,2,0,2,1} /* UG */,
+                {0,2,2,1,2,0,2} /* AU */,
+                {0,2,2,2,1,2,0} /* UA */};
+
+  int pfreq[8]={0,0,0,0,0,0,0,0};
+  for (s=0; s<n_seq; s++)
+    pfreq[types[s]]++;
+
+  if (pfreq[0]*2>n_seq) return NONE;
+  for (k=1,score=0; k<=6; k++) /* ignore pairtype 7 (gap-gap) */
+    for (l=k+1; l<=6; l++)
+      /* scores for replacements between pairtypes    */
+      /* consistent or compensatory mutations score 1 or 2  */
+      score += pfreq[k]*pfreq[l]*dm[k][l];
+
+  /* counter examples score -1, gap-gap scores -0.25   */
+  pscore = cv_fact *
+    ((UNIT*score)/n_seq - nc_fact*UNIT*(pfreq[0] + pfreq[7]*0.25));
+  return pscore;
+}
diff --git a/C/ViennaRNA/duplex.h b/C/ViennaRNA/duplex.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/duplex.h
@@ -0,0 +1,29 @@
+#ifndef VIENNA_RNA_PACKAGE_DUPLEX_H
+#define VIENNA_RNA_PACKAGE_DUPLEX_H
+
+#include <ViennaRNA/data_structures.h>
+
+/**
+ *  @file     duplex.h
+ *  @ingroup  cofold
+ *  @brief    Functions for simple RNA-RNA duplex interactions
+ */
+
+
+duplexT duplexfold( const char *s1,
+                    const char *s2);
+
+duplexT *duplex_subopt( const char *s1,
+                        const char *s2,
+                        int delta,
+                        int w);
+
+duplexT aliduplexfold(const char *s1[],
+                      const char *s2[]);
+
+duplexT *aliduplex_subopt(const char *s1[],
+                          const char *s2[],
+                          int delta,
+                          int w);
+
+#endif
diff --git a/C/ViennaRNA/edit_cost.h b/C/ViennaRNA/edit_cost.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/edit_cost.h
@@ -0,0 +1,53 @@
+/**
+ *  \file edit_cost.h
+ *  \brief global variables for Edit Costs included by treedist.c and stringdist.c
+ */
+
+#define PRIVATE static
+
+PRIVATE char   sep    = ':';
+PRIVATE char  *coding = "Null:U:P:H:B:I:M:S:E:R";
+
+#define DIST_INF 10000  /* infinity */
+
+typedef int CostMatrix[10][10];
+
+PRIVATE CostMatrix *EditCost;  /* will point to UsualCost or ShapiroCost */
+
+PRIVATE CostMatrix  UsualCost =
+{
+
+/*    Null,       U,        P,        H,        B,        I,        M,        S,        E,        R     */
+
+   {        0,        1,        2,        2,        2,        2,        2,        1,        1, DIST_INF},   /* Null replaced */
+   {        1,        0,        1, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF},   /* U    replaced */
+   {        2,        1,        0, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF},   /* P    replaced */
+   {        2, DIST_INF, DIST_INF,        0,        2,        2,        2, DIST_INF, DIST_INF, DIST_INF},   /* H    replaced */
+   {        2, DIST_INF, DIST_INF,        2,        0,        1,        2, DIST_INF, DIST_INF, DIST_INF},   /* B    replaced */
+   {        2, DIST_INF, DIST_INF,        2,        1,        0,        2, DIST_INF, DIST_INF, DIST_INF},   /* I    replaced */
+   {        2, DIST_INF, DIST_INF,        2,        2,        2,        0, DIST_INF, DIST_INF, DIST_INF},   /* M    replaced */
+   {        1, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF,        0, DIST_INF, DIST_INF},   /* S    replaced */
+   {        1, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF,        0, DIST_INF},   /* E    replaced */
+   { DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF,        0},   /* R    replaced */
+
+};
+
+
+PRIVATE CostMatrix ShapiroCost =
+{
+
+/*    Null,       U,        P,        H,        B,        I,        M,        S,        E,        R     */
+
+   {        0,        1,        2,      100,        5,        5,       75,        5,        5, DIST_INF},   /* Null replaced */
+   {        1,        0,        1, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF},   /* U    replaced */
+   {        2,        1,        0, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF},   /* P    replaced */
+   {      100, DIST_INF, DIST_INF,        0,        8,        8,        8, DIST_INF, DIST_INF, DIST_INF},   /* H    replaced */
+   {        5, DIST_INF, DIST_INF,        8,        0,        3,        8, DIST_INF, DIST_INF, DIST_INF},   /* B    replaced */
+   {        5, DIST_INF, DIST_INF,        8,        3,        0,        8, DIST_INF, DIST_INF, DIST_INF},   /* I    replaced */
+   {       75, DIST_INF, DIST_INF,        8,        8,        8,        0, DIST_INF, DIST_INF, DIST_INF},   /* M    replaced */
+   {        5, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF,        0, DIST_INF, DIST_INF},   /* S    replaced */
+   {        5, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF,        0, DIST_INF},   /* E    replaced */
+   { DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF, DIST_INF,        0},   /* R    replaced */
+
+};
+
diff --git a/C/ViennaRNA/energy_const.h b/C/ViennaRNA/energy_const.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/energy_const.h
@@ -0,0 +1,39 @@
+#ifndef VIENNA_RNA_PACKAGE_ENERGY_CONST_H
+#define VIENNA_RNA_PACKAGE_ENERGY_CONST_H
+
+#include <limits.h>
+
+/**
+ *  @file     energy_const.h
+ *  @ingroup  energy_parameters
+ *  @brief    Energy parameter constants
+ */
+
+/** The gas constant */
+#define GASCONST 1.98717  /* in [cal/K] */
+/** 0 deg Celsius in Kelvin */
+#define K0  273.15
+/** Infinity as used in minimization routines */
+#define INF 10000000 /* (INT_MAX/10) */
+
+#define EMAX (INF/10)
+/** forbidden */
+#define FORBIDDEN 9999
+/** bonus contribution */
+#define BONUS 10000
+/** The number of distinguishable base pairs */
+#define NBPAIRS 7
+/** The minimum loop length */
+#define TURN 3
+/** The maximum loop length */
+#define MAXLOOP 30
+
+#define UNIT 100
+
+#define MINPSCORE -2 * UNIT
+
+
+#define   VRNA_GQUAD_MISMATCH_PENALTY   300   /* penalty for incompatible nucleotides in an alignment that destruct a gquad layer */
+#define   VRNA_GQUAD_MISMATCH_NUM_ALI   1   /* maximum number of mismatching sequences in the alignment when gquad should be formed */
+
+#endif
diff --git a/C/ViennaRNA/energy_par.c b/C/ViennaRNA/energy_par.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/energy_par.c
@@ -0,0 +1,843 @@
+
+
+/*
+    Automatically generated using the TurnerParser
+    TurnerParser (c) 2008,2009,2010
+      Christian Hoener zu Siederdissen, TBI Vienna
+      choener (at) tbi.univie.ac.at
+
+    The library enabling this can be found at:
+    http://hackage.haskell.org/package/BiobaseVienna
+    the program can be found at:
+    (sorry, not yet)
+    install using cabal: cabal install (sorry, not yet)
+*/
+
+/*
+     Current free energy parameters are summarized in:
+
+     D.H.Mathews, J. Sabina, M. ZUker, D.H. Turner
+     "Expanded sequence dependence of thermodynamic parameters improves
+     prediction of RNA secondary structure"
+     JMB, 288, pp 911-940, 1999
+
+     Enthalpies taken from:
+
+     A. Walter, D Turner, J Kim, M Lyttle, P M"uller, D Mathews, M Zuker
+     "Coaxial stacking of helices enhances binding of oligoribonucleotides.."
+     PNAS, 91, pp 9218-9222, 1994
+
+     D.H. Turner, N. Sugimoto, and S.M. Freier.
+     "RNA Structure Prediction",
+     Ann. Rev. Biophys. Biophys. Chem. 17, 167-192, 1988.
+
+     John A.Jaeger, Douglas H.Turner, and Michael Zuker.
+     "Improved predictions of secondary structures for RNA",
+     PNAS, 86, 7706-7710, October 1989.
+
+     L. He, R. Kierzek, J. SantaLucia, A.E. Walter, D.H. Turner
+     "Nearest-Neighbor Parameters for GU Mismatches...."
+     Biochemistry 1991, 30 11124-11132
+
+     A.E. Peritz, R. Kierzek, N, Sugimoto, D.H. Turner
+     "Thermodynamic Study of Internal Loops in Oligoribonucleotides..."
+     Biochemistry 1991, 30, 6428--6435
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "ViennaRNA/energy_const.h"
+
+#define NST 0     /* Energy for nonstandard stacked pairs */
+#define DEF -50   /* Default terminal mismatch, used for I */
+                  /* and any non_pairing bases */
+#define NSM 0     /* terminal mismatch for non standard pairs */
+
+#define PUBLIC
+
+PUBLIC double Tmeasure = 37+K0;  /* temperature of param measurements */
+
+
+/* PUBLIC double lxc37=107.9; */
+PUBLIC double lxc37=107.856;
+PUBLIC int ML_intern37=-90;
+PUBLIC int ML_interndH=-220;
+PUBLIC int ML_closing37=930;
+PUBLIC int ML_closingdH=3000;
+PUBLIC int ML_BASE37=0;
+PUBLIC int ML_BASEdH=0;
+PUBLIC int MAX_NINIO=300;
+PUBLIC int ninio37=60;
+PUBLIC int niniodH=320;
+PUBLIC int TerminalAU37=50;
+PUBLIC int TerminalAUdH=370;
+PUBLIC int DuplexInit37=410;
+PUBLIC int DuplexInitdH=360;
+PUBLIC int TripleC37=100;
+PUBLIC int TripleCdH=1860;
+PUBLIC int MultipleCA37=30;
+PUBLIC int MultipleCAdH=340;
+PUBLIC int MultipleCB37=160;
+PUBLIC int MultipleCBdH=760;
+
+PUBLIC int GQuadAlpha37 = -1800;
+PUBLIC int GQuadAlphadH = -11934;
+PUBLIC int GQuadBeta37 = 1200;
+PUBLIC int GQuadBetadH = 0;
+
+PUBLIC int stack37[NBPAIRS+1][NBPAIRS+1] =
+{{   INF,   INF,   INF,   INF,   INF,   INF,   INF,   INF}
+,{   INF,  -240,  -330,  -210,  -140,  -210,  -210,  -140}
+,{   INF,  -330,  -340,  -250,  -150,  -220,  -240,  -150}
+,{   INF,  -210,  -250,   130,   -50,  -140,  -130,   130}
+,{   INF,  -140,  -150,   -50,    30,   -60,  -100,    30}
+,{   INF,  -210,  -220,  -140,   -60,  -110,   -90,   -60}
+,{   INF,  -210,  -240,  -130,  -100,   -90,  -130,   -90}
+,{   INF,  -140,  -150,   130,    30,   -60,   -90,   130}};
+PUBLIC int stackdH[NBPAIRS+1][NBPAIRS+1] =
+{{   INF,   INF,   INF,   INF,   INF,   INF,   INF,   INF}
+,{   INF, -1060, -1340, -1210,  -560, -1050, -1040,  -560}
+,{   INF, -1340, -1490, -1260,  -830, -1140, -1240,  -830}
+,{   INF, -1210, -1260, -1460, -1350,  -880, -1280,  -880}
+,{   INF,  -560,  -830, -1350,  -930,  -320,  -700,  -320}
+,{   INF, -1050, -1140,  -880,  -320,  -940,  -680,  -320}
+,{   INF, -1040, -1240, -1280,  -700,  -680,  -770,  -680}
+,{   INF,  -560,  -830,  -880,  -320,  -320,  -680,  -320}};
+
+PUBLIC int hairpin37[31] = {   INF,   INF,   INF,   540,   560,   570,   540,   600,   550,   640,   650,   660,   670,   680,   690,   690,   700,   710,   710,   720,   720,   730,   730,   740,   740,   750,   750,   750,   760,   760,   770};
+PUBLIC int hairpindH[31] = {   INF,   INF,   INF,   130,   480,   360,  -290,   130,  -290,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500};
+PUBLIC int bulge37[31] = {   INF,   380,   280,   320,   360,   400,   440,   460,   470,   480,   490,   500,   510,   520,   530,   540,   540,   550,   550,   560,   570,   570,   580,   580,   580,   590,   590,   600,   600,   600,   610};
+PUBLIC int bulgedH[31] = {   INF,  1060,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710};
+PUBLIC int internal_loop37[31] = {   INF,   INF,   100,   100,   110,   200,   200,   210,   230,   240,   250,   260,   270,   280,   290,   290,   300,   310,   310,   320,   330,   330,   340,   340,   350,   350,   350,   360,   360,   370,   370};
+PUBLIC int internal_loopdH[31] = {   INF,   INF,   -720,   -720,  -720,  -680,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130};
+
+PUBLIC int mismatchI37[NBPAIRS+1][5][5] =
+{{{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ }
+,{{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,   -80,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,  -100,     0,  -100,     0}
+ ,{     0,     0,     0,     0,   -60}
+ }
+,{{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,   -80,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,  -100,     0,  -100,     0}
+ ,{     0,     0,     0,     0,   -60}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,   -10,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,   -30,    70,   -30,    70}
+ ,{    70,    70,    70,    70,    10}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,   -10,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,   -30,    70,   -30,    70}
+ ,{    70,    70,    70,    70,    10}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,   -10,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,   -30,    70,   -30,    70}
+ ,{    70,    70,    70,    70,    10}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,   -10,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,   -30,    70,   -30,    70}
+ ,{    70,    70,    70,    70,    10}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,   -10,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,   -30,    70,   -30,    70}
+ ,{    70,    70,    70,    70,    10}
+ }};
+PUBLIC int mismatchIdH[NBPAIRS+1][5][5] =
+{{{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ }
+,{{   280,     0,     0,   280,     0}
+ ,{     0,     0,     0,  -340,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{   280,  -760,     0,   280,     0}
+ ,{     0,     0,     0,     0,  -580}
+ }
+,{{   280,     0,     0,   280,     0}
+ ,{     0,     0,     0,  -340,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{   280,  -760,     0,   280,     0}
+ ,{     0,     0,     0,     0,  -580}
+ }
+,{{   790,   500,   500,   790,   500}
+ ,{   500,   500,   500,   170,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   790,  -260,   500,   790,   500}
+ ,{   500,   500,   500,   500,   -80}
+ }
+,{{   790,   500,   500,   790,   500}
+ ,{   500,   500,   500,   170,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   790,  -260,   500,   790,   500}
+ ,{   500,   500,   500,   500,   -80}
+ }
+,{{   790,   500,   500,   790,   500}
+ ,{   500,   500,   500,   170,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   790,  -260,   500,   790,   500}
+ ,{   500,   500,   500,   500,   -80}
+ }
+,{{   790,   500,   500,   790,   500}
+ ,{   500,   500,   500,   170,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   790,  -260,   500,   790,   500}
+ ,{   500,   500,   500,   500,   -80}
+ }
+,{{   790,   500,   500,   790,   500}
+ ,{   500,   500,   500,   170,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   790,  -260,   500,   790,   500}
+ ,{   500,   500,   500,   500,   -80}
+ }};
+
+PUBLIC int mismatchH37[NBPAIRS+1][5][5] =
+{{{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ }
+,{{   -80,  -100,  -110,  -100,   -80}
+ ,{  -140,  -150,  -150,  -140,  -150}
+ ,{   -80,  -100,  -110,  -100,   -80}
+ ,{  -150,  -230,  -150,  -240,  -150}
+ ,{  -100,  -100,  -140,  -100,  -210}
+ }
+,{{   -50,  -110,   -70,  -110,   -50}
+ ,{  -110,  -110,  -150,  -130,  -150}
+ ,{   -50,  -110,   -70,  -110,   -50}
+ ,{  -150,  -250,  -150,  -220,  -150}
+ ,{  -100,  -110,  -100,  -110,  -160}
+ }
+,{{    20,    20,   -20,   -10,   -20}
+ ,{    20,    20,   -50,   -30,   -50}
+ ,{   -10,   -10,   -20,   -10,   -20}
+ ,{   -50,  -100,   -50,  -110,   -50}
+ ,{   -10,   -10,   -30,   -10,  -100}
+ }
+,{{     0,   -20,   -10,   -20,     0}
+ ,{   -30,   -50,   -30,   -60,   -30}
+ ,{     0,   -20,   -10,   -20,     0}
+ ,{   -30,   -90,   -30,  -110,   -30}
+ ,{   -10,   -20,   -10,   -20,   -90}
+ }
+,{{   -10,   -10,   -20,   -10,   -20}
+ ,{   -30,   -30,   -50,   -30,   -50}
+ ,{   -10,   -10,   -20,   -10,   -20}
+ ,{   -50,  -120,   -50,  -110,   -50}
+ ,{   -10,   -10,   -30,   -10,  -120}
+ }
+,{{     0,   -20,   -10,   -20,     0}
+ ,{   -30,   -50,   -30,   -50,   -30}
+ ,{     0,   -20,   -10,   -20,     0}
+ ,{   -30,  -150,   -30,  -150,   -30}
+ ,{   -10,   -20,   -10,   -20,   -90}
+ }
+,{{    20,    20,   -10,   -10,     0}
+ ,{    20,    20,   -30,   -30,   -30}
+ ,{     0,   -10,   -10,   -10,     0}
+ ,{   -30,   -90,   -30,  -110,   -30}
+ ,{   -10,   -10,   -10,   -10,   -90}
+ }};
+PUBLIC int mismatchHdH[NBPAIRS+1][5][5] =
+{{{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ }
+,{{   560,  -570,   560,  -560,  -270}
+ ,{  -560,  -910,  -560,  -560,  -560}
+ ,{  -270,  -570,  -340,  -570,  -270}
+ ,{   560, -1400,   560,  -920,  -560}
+ ,{  -530,  -570,  -530,  -570, -1440}
+ }
+,{{    50,  -520,    50,  -560,  -400}
+ ,{  -400,  -520,  -400,  -560,  -400}
+ ,{    50,  -720,    50,  -720,  -420}
+ ,{  -400, -1290,  -400,  -620,  -400}
+ ,{   -30,  -720,   -30,  -720, -1080}
+ }
+,{{   970,   140,   970,   140,   570}
+ ,{   570,    30,   570,    20,   570}
+ ,{   970,   140,   970,   140,   340}
+ ,{   570,  -270,   570,    20,   570}
+ ,{   830,   140,   830,   140,   -50}
+ }
+,{{   230,   100,   230,   220,   190}
+ ,{  -110,  -110,  -260,  -520,  -260}
+ ,{   190,   -60,  -140,   -60,   190}
+ ,{   220,   100,  -260,   220,  -260}
+ ,{   230,   -60,   230,   -60,   -70}
+ }
+,{{   970,   140,   970,   140,   570}
+ ,{   570,   -20,   570,    20,   570}
+ ,{   970,   140,   970,   140,   340}
+ ,{   570,  -520,   570,    20,   570}
+ ,{   830,   140,   830,   140,  -380}
+ }
+,{{   230,   -30,   230,   -60,   190}
+ ,{   -30,   -30,  -260,  -520,  -260}
+ ,{   190,   -60,  -140,   -60,   190}
+ ,{  -260,  -590,  -260,  -520,  -260}
+ ,{   230,   -60,   230,   -60,   -70}
+ }
+,{{   970,   140,   970,   220,   570}
+ ,{   570,    30,   570,    20,   570}
+ ,{   970,   140,   970,   140,   340}
+ ,{   570,   100,   570,   220,   570}
+ ,{   830,   140,   830,   140,   -50}
+ }};
+
+/* mismatch_multi */
+PUBLIC int mismatchM37[NBPAIRS+1][5][5] =
+{{ /* NP.. */
+  {   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ },
+ { /* CG.. */
+  {   -50,  -110,   -50,  -140,   -70}
+ ,{  -110,  -110,  -110,  -160,  -110}
+ ,{   -70,  -150,   -70,  -150,  -100}
+ ,{  -110,  -130,  -110,  -140,  -110}
+ ,{   -50,  -150,   -50,  -150,   -70}
+ },
+ { /* GC.. */
+  {   -80,  -140,   -80,  -140,  -100}
+ ,{  -100,  -150,  -100,  -140,  -100}
+ ,{  -110,  -150,  -110,  -150,  -140}
+ ,{  -100,  -140,  -100,  -160,  -100}
+ ,{   -80,  -150,   -80,  -150,  -120}
+ },
+ { /* GU.. */
+  {   -50,   -80,   -50,   -50,   -50}
+ ,{   -50,  -100,   -70,   -50,   -70}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -70,  -110,   -70,   -80,   -70}
+ ,{   -50,   -80,   -50,   -80,   -50}
+ },
+ { /* UG.. */
+  {   -30,   -30,   -60,   -60,   -60}
+ ,{   -30,   -30,   -60,   -60,   -60}
+ ,{   -70,  -100,   -70,  -100,   -80}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -60,  -100,   -70,  -100,   -60}
+ },
+ { /* AU.. */
+  {   -50,   -80,   -50,   -80,   -50}
+ ,{   -70,  -100,   -70,  -110,   -70}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -70,  -110,   -70,  -120,   -70}
+ ,{   -50,   -80,   -50,   -80,   -50}
+ },
+ { /* UA.. */
+  {   -60,   -80,   -60,   -80,   -60}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -70,  -100,   -70,  -100,   -80}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -70,  -100,   -70,  -100,   -80}
+ },
+ { /* NN.. */
+  {   -30,   -30,   -50,   -50,   -50}
+ ,{   -30,   -30,   -60,   -50,   -60}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -50,   -80,   -50,   -80,   -50}
+ }};
+
+/* mismatch_multi_enthalpies */
+PUBLIC int mismatchMdH[NBPAIRS+1][5][5] =
+{{ /* NP.. */
+  {   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ },
+ { /* CG.. */
+  {    50,  -400,    50,  -400,   -30}
+ ,{  -520,  -520,  -720,  -710,  -720}
+ ,{    50,  -400,    50,  -400,   -30}
+ ,{  -560,  -560,  -720,  -620,  -720}
+ ,{  -400,  -400,  -420,  -400,  -500}
+ },
+ { /* GC.. */
+  {  -270,  -560,  -270,  -560,  -530}
+ ,{  -570,  -910,  -570,  -820,  -570}
+ ,{  -340,  -560,  -340,  -560,  -530}
+ ,{  -560,  -560,  -570,  -920,  -570}
+ ,{  -270,  -560,  -270,  -560,  -860}
+ },
+ { /* GU.. */
+  {   310,  -480,  -180,   310,   140}
+ ,{   310,  -480,  -430,   310,  -430}
+ ,{  -140,  -630,  -510,  -630,  -140}
+ ,{  -150,  -890,  -430,  -150,  -430}
+ ,{   140,  -630,  -180,  -630,   140}
+ },
+ { /* UG.. */
+  {   600,   200,   600,   200,   460}
+ ,{   -60,  -340,  -230,   -60,  -230}
+ ,{   600,   200,   600,   200,   460}
+ ,{  -230,  -350,  -230,  -350,  -230}
+ ,{   200,   200,   -30,   200,   160}
+ },
+ { /* AU.. */
+  {   140,  -400,  -180,  -380,   140}
+ ,{  -380,  -400,  -430,  -380,  -430}
+ ,{  -140,  -630,  -510,  -630,  -140}
+ ,{  -430,  -890,  -430,  -890,  -430}
+ ,{   140,  -630,  -180,  -630,   140}
+ },
+ { /* UA.. */
+  {   600,   200,   600,   200,   460}
+ ,{  -230,  -390,  -230,  -310,  -230}
+ ,{   600,   200,   600,   200,   460}
+ ,{  -230,  -350,  -230,  -350,  -230}
+ ,{   200,   200,   -30,   200,  -170}
+ },
+ { /* NN.. */
+  {   600,   200,   600,   310,   460}
+ ,{   310,  -340,  -230,   310,  -230}
+ ,{   600,   200,   600,   200,   460}
+ ,{  -150,  -350,  -230,  -150,  -230}
+ ,{   200,   200,   -30,   200,   160}
+ }};
+
+PUBLIC int mismatch1nI37[NBPAIRS+1][5][5] =
+{{{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ }
+,{{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ }
+,{{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ }};
+PUBLIC int mismatch1nIdH[NBPAIRS+1][5][5] =
+{{{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ }
+,{{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ }
+,{{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ }
+,{{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ }
+,{{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ }
+,{{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ }
+,{{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ }
+,{{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ }};
+
+PUBLIC int mismatch23I37[NBPAIRS+1][5][5] =
+{{{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ }
+,{{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,   -50,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,  -110,     0,   -70,     0}
+ ,{     0,     0,     0,     0,   -30}
+ }
+,{{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,  -120,     0,   -70,     0}
+ ,{     0,     0,     0,     0,   -30}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,   -40,    70,     0,    70}
+ ,{    70,    70,    70,    70,    40}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    20,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,   -40,    70,     0,    70}
+ ,{    70,    70,    70,    70,    40}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,   -40,    70,     0,    70}
+ ,{    70,    70,    70,    70,    40}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    20,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,   -40,    70,     0,    70}
+ ,{    70,    70,    70,    70,    40}
+ }
+,{{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,    70,    70,    70,    70}
+ ,{    70,   -40,    70,     0,    70}
+ ,{    70,    70,    70,    70,    40}
+ }};
+PUBLIC int mismatch23IdH[NBPAIRS+1][5][5] =
+{{{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ }
+,{{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,  -570,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,  -860,     0,  -900,     0}
+ ,{     0,     0,     0,     0,  -640}
+ }
+,{{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0,     0,     0,     0,     0}
+ ,{     0, -1090,     0,  -900,     0}
+ ,{     0,     0,     0,     0,  -640}
+ }
+,{{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,  -580,   500,  -400,   500}
+ ,{   500,   500,   500,   500,  -140}
+ }
+,{{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   -60,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,  -360,   500,  -400,   500}
+ ,{   500,   500,   500,   500,  -140}
+ }
+,{{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,  -580,   500,  -400,   500}
+ ,{   500,   500,   500,   500,  -140}
+ }
+,{{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   -60,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,  -360,   500,  -400,   500}
+ ,{   500,   500,   500,   500,  -140}
+ }
+,{{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,   500,   500,   500,   500}
+ ,{   500,  -360,   500,  -400,   500}
+ ,{   500,   500,   500,   500,  -140}
+ }};
+
+/* mismatch_exterior */
+PUBLIC int mismatchExt37[NBPAIRS+1][5][5] =
+{{ /* NP.. */
+  {   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ },
+ { /* CG.. */
+  {   -50,  -110,   -50,  -140,   -70}
+ ,{  -110,  -110,  -110,  -160,  -110}
+ ,{   -70,  -150,   -70,  -150,  -100}
+ ,{  -110,  -130,  -110,  -140,  -110}
+ ,{   -50,  -150,   -50,  -150,   -70}
+ },
+ { /* GC.. */
+  {   -80,  -140,   -80,  -140,  -100}
+ ,{  -100,  -150,  -100,  -140,  -100}
+ ,{  -110,  -150,  -110,  -150,  -140}
+ ,{  -100,  -140,  -100,  -160,  -100}
+ ,{   -80,  -150,   -80,  -150,  -120}
+ },
+ { /* GU.. */
+  {   -50,   -80,   -50,   -50,   -50}
+ ,{   -50,  -100,   -70,   -50,   -70}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -70,  -110,   -70,   -80,   -70}
+ ,{   -50,   -80,   -50,   -80,   -50}
+ },
+ { /* UG.. */
+  {   -30,   -30,   -60,   -60,   -60}
+ ,{   -30,   -30,   -60,   -60,   -60}
+ ,{   -70,  -100,   -70,  -100,   -80}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -60,  -100,   -70,  -100,   -60}
+ },
+ { /* AU.. */
+  {   -50,   -80,   -50,   -80,   -50}
+ ,{   -70,  -100,   -70,  -110,   -70}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -70,  -110,   -70,  -120,   -70}
+ ,{   -50,   -80,   -50,   -80,   -50}
+ },
+ { /* UA.. */
+  {   -60,   -80,   -60,   -80,   -60}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -70,  -100,   -70,  -100,   -80}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -70,  -100,   -70,  -100,   -80}
+ },
+ { /* NN.. */
+  {   -30,   -30,   -50,   -50,   -50}
+ ,{   -30,   -30,   -60,   -50,   -60}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -60,   -80,   -60,   -80,   -60}
+ ,{   -50,   -80,   -50,   -80,   -50}
+ }};
+
+/* mismatch_exterior_enthalpies */
+PUBLIC int mismatchExtdH[NBPAIRS+1][5][5] =
+{{ /* NP.. */
+  {   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ ,{   INF,   INF,   INF,   INF,   INF}
+ },
+ { /* CG.. */
+  {    50,  -400,    50,  -400,   -30}
+ ,{  -520,  -520,  -720,  -710,  -720}
+ ,{    50,  -400,    50,  -400,   -30}
+ ,{  -560,  -560,  -720,  -620,  -720}
+ ,{  -400,  -400,  -420,  -400,  -500}
+ },
+ { /* GC.. */
+  {  -270,  -560,  -270,  -560,  -530}
+ ,{  -570,  -910,  -570,  -820,  -570}
+ ,{  -340,  -560,  -340,  -560,  -530}
+ ,{  -560,  -560,  -570,  -920,  -570}
+ ,{  -270,  -560,  -270,  -560,  -860}
+ },
+ { /* GU.. */
+  {   310,  -480,  -180,   310,   140}
+ ,{   310,  -480,  -430,   310,  -430}
+ ,{  -140,  -630,  -510,  -630,  -140}
+ ,{  -150,  -890,  -430,  -150,  -430}
+ ,{   140,  -630,  -180,  -630,   140}
+ },
+ { /* UG.. */
+  {   600,   200,   600,   200,   460}
+ ,{   -60,  -340,  -230,   -60,  -230}
+ ,{   600,   200,   600,   200,   460}
+ ,{  -230,  -350,  -230,  -350,  -230}
+ ,{   200,   200,   -30,   200,   160}
+ },
+ { /* AU.. */
+  {   140,  -400,  -180,  -380,   140}
+ ,{  -380,  -400,  -430,  -380,  -430}
+ ,{  -140,  -630,  -510,  -630,  -140}
+ ,{  -430,  -890,  -430,  -890,  -430}
+ ,{   140,  -630,  -180,  -630,   140}
+ },
+ { /* UA.. */
+  {   600,   200,   600,   200,   460}
+ ,{  -230,  -390,  -230,  -310,  -230}
+ ,{   600,   200,   600,   200,   460}
+ ,{  -230,  -350,  -230,  -350,  -230}
+ ,{   200,   200,   -30,   200,  -170}
+ },
+ { /* NN.. */
+  {   600,   200,   600,   310,   460}
+ ,{   310,  -340,  -230,   310,  -230}
+ ,{   600,   200,   600,   200,   460}
+ ,{  -150,  -350,  -230,  -150,  -230}
+ ,{   200,   200,   -30,   200,   160}
+ }};
+
+/* dangle5 */
+PUBLIC int dangle5_37[NBPAIRS+1][5] =
+{ /*           N      A      C      G      U */
+/* NP */ {   INF,   INF,   INF,   INF,   INF},
+/* CG */ {   -10,   -50,   -30,   -20,   -10},
+/* GC */ {    -0,   -20,   -30,    -0,    -0},
+/* GU */ {   -20,   -30,   -30,   -40,   -20},
+/* UG */ {   -10,   -30,   -10,   -20,   -20},
+/* AU */ {   -20,   -30,   -30,   -40,   -20},
+/* UA */ {   -10,   -30,   -10,   -20,   -20},
+/* NN */ {    -0,   -20,   -10,    -0,    -0}
+};
+
+/* dangle3 */
+PUBLIC int dangle3_37[NBPAIRS+1][5] =
+{ /*           N      A      C      G      U */
+/* NP */ {   INF,   INF,   INF,   INF,   INF},
+/* CG */ {   -40,  -110,   -40,  -130,   -60},
+/* GC */ {   -80,  -170,   -80,  -170,  -120},
+/* GU */ {   -10,   -70,   -10,   -70,   -10},
+/* UG */ {   -50,   -80,   -50,   -80,   -60},
+/* AU */ {   -10,   -70,   -10,   -70,   -10},
+/* UA */ {   -50,   -80,   -50,   -80,   -60},
+/* NN */ {   -10,   -70,   -10,   -70,   -10}
+};
+
+/* dangle5_enthalpies */
+PUBLIC int dangle5_dH[NBPAIRS+1][5] =
+{ /*           N      A      C      G      U */
+/* NP */ {   INF,   INF,   INF,   INF,   INF},
+/* CG */ {   330,  -240,   330,    80,  -140},
+/* GC */ {    70,  -160,    70,  -460,   -40},
+/* GU */ {   310,   160,   220,    70,   310},
+/* UG */ {   690,   -50,   690,    60,    60},
+/* AU */ {   310,   160,   220,    70,   310},
+/* UA */ {   690,   -50,   690,    60,    60},
+/* NN */ {   690,   160,   690,    80,   310}
+};
+
+/* dangle3_enthalpies */
+PUBLIC int dangle3_dH[NBPAIRS+1][5] =
+{ /*           N      A      C      G      U */
+/* NP */ {   INF,   INF,   INF,   INF,   INF},
+/* CG */ {  -280,  -740,  -280,  -640,  -360},
+/* GC */ {  -410,  -900,  -410,  -860,  -750},
+/* GU */ {   -70,  -570,   -70,  -580,  -220},
+/* UG */ {   -90,  -490,   -90,  -550,  -230},
+/* AU */ {   -70,  -570,   -70,  -580,  -220},
+/* UA */ {   -90,  -490,   -90,  -550,  -230},
+/* NN */ {   -70,  -490,   -70,  -550,  -220}
+};
+
+PUBLIC char Triloops[241] =
+  "CAACG "
+  "GUUAC "
+;
+PUBLIC int Triloop37[40] = {   680,   690};
+PUBLIC int TriloopdH[40] = {  2370,  1080};
+
+PUBLIC char Tetraloops[281] =
+  "CAACGG "
+  "CCAAGG "
+  "CCACGG "
+  "CCCAGG "
+  "CCGAGG "
+  "CCGCGG "
+  "CCUAGG "
+  "CCUCGG "
+  "CUAAGG "
+  "CUACGG "
+  "CUCAGG "
+  "CUCCGG "
+  "CUGCGG "
+  "CUUAGG "
+  "CUUCGG "
+  "CUUUGG "
+;
+PUBLIC int Tetraloop37[40] = {   550,   330,   370,   340,   350,   360,   370,   250,   360,   280,   370,   270,   280,   350,   370,   370};
+PUBLIC int TetraloopdH[40] = {   690, -1030,  -330,  -890,  -660,  -750,  -350, -1390,  -760, -1070,  -660, -1290, -1070,  -620, -1530,  -680};
+
+PUBLIC char Hexaloops[361] =
+  "ACAGUACU "
+  "ACAGUGAU "
+  "ACAGUGCU "
+  "ACAGUGUU "
+;
+PUBLIC int Hexaloop37[40] = {   280,   360,   290,   180};
+PUBLIC int HexaloopdH[40] = { -1680, -1140, -1280, -1540};
+
+#include "intl11.h"
+#include "intl11dH.h"
+#include "intl21.h"
+#include "intl21dH.h"
+#include "intl22.h"
+#include "intl22dH.h"
+
diff --git a/C/ViennaRNA/energy_par.h b/C/ViennaRNA/energy_par.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/energy_par.h
@@ -0,0 +1,100 @@
+/*
+   prototypes for energy_par.c
+*/
+
+#ifndef VIENNA_RNA_PACKAGE_ENERGY_PAR_H
+#define VIENNA_RNA_PACKAGE_ENERGY_PAR_H
+
+#include <ViennaRNA/energy_const.h>
+
+#define PUBLIC
+
+
+extern double lxc37;   /* parameter for logarithmic loop
+			  energy extrapolation            */
+
+extern int stack37[NBPAIRS+1][NBPAIRS+1];
+extern int stackdH[NBPAIRS+1][NBPAIRS+1]; /* stack enthalpies */
+extern int entropies[NBPAIRS+1][NBPAIRS+1];  /* not used anymore */
+
+extern int hairpin37[31];
+extern int hairpindH[31];
+extern int bulge37[31];
+extern int bulgedH[31];
+extern int internal_loop37[31];
+extern int internal_loopdH[31];
+extern int internal2_energy;
+extern int old_mismatch_37[NBPAIRS+1][5][5];
+extern int mismatchI37[NBPAIRS+1][5][5];  /* interior loop mismatches */
+extern int mismatchIdH[NBPAIRS+1][5][5];  /* interior loop mismatches */
+extern int mismatch1nI37[NBPAIRS+1][5][5];  /* interior loop mismatches */
+extern int mismatch23I37[NBPAIRS+1][5][5];  /* interior loop mismatches */
+extern int mismatch1nIdH[NBPAIRS+1][5][5];  /* interior loop mismatches */
+extern int mismatch23IdH[NBPAIRS+1][5][5];  /* interior loop mismatches */
+extern int mismatchH37[NBPAIRS+1][5][5];  /* same for hairpins */
+extern int mismatchM37[NBPAIRS+1][5][5];  /* same for multiloops */
+extern int mismatchHdH[NBPAIRS+1][5][5];  /* same for hairpins */
+extern int mismatchMdH[NBPAIRS+1][5][5];  /* same for multiloops */
+extern int mismatchExt37[NBPAIRS+1][5][5];
+extern int mismatchExtdH[NBPAIRS+1][5][5];
+
+extern int dangle5_37[NBPAIRS+1][5];      /* 5' dangle exterior of pair */
+extern int dangle3_37[NBPAIRS+1][5];      /* 3' dangle */
+extern int dangle3_dH[NBPAIRS+1][5];       /* corresponding enthalpies */
+extern int dangle5_dH[NBPAIRS+1][5];
+
+extern int int11_37[NBPAIRS+1][NBPAIRS+1][5][5]; /* 1x1 interior loops */
+extern int int11_dH[NBPAIRS+1][NBPAIRS+1][5][5];
+
+extern int int21_37[NBPAIRS+1][NBPAIRS+1][5][5][5]; /* 2x1 interior loops */
+extern int int21_dH[NBPAIRS+1][NBPAIRS+1][5][5][5];
+
+extern int int22_37[NBPAIRS+1][NBPAIRS+1][5][5][5][5]; /* 2x2 interior loops */
+extern int int22_dH[NBPAIRS+1][NBPAIRS+1][5][5][5][5];
+
+/* constants for linearly destabilizing contributions for multi-loops
+   F = ML_closing + ML_intern*(k-1) + ML_BASE*u  */
+extern int ML_BASE37;
+extern int ML_BASEdH;
+extern int ML_closing37;
+extern int ML_closingdH;
+extern int ML_intern37;
+extern int ML_interndH;
+
+extern int TripleC37;
+extern int TripleCdH;
+extern int MultipleCA37;
+extern int MultipleCAdH;
+extern int MultipleCB37;
+extern int MultipleCBdH;
+
+/* Ninio-correction for asymmetric internal loops with branches n1 and n2 */
+/*    ninio_energy = min{max_ninio, |n1-n2|*F_ninio[min{4.0, n1, n2}] } */
+extern int  MAX_NINIO;                   /* maximum correction */
+extern int ninio37;
+extern int niniodH;
+/* penalty for helices terminated by AU (actually not GC) */
+extern int TerminalAU37;
+extern int TerminalAUdH;
+/* penalty for forming bi-molecular duplex */
+extern int DuplexInit37;
+extern int DuplexInitdH;
+/* stabilizing contribution due to special hairpins of size 4 (tetraloops) */
+extern char Tetraloops[];  /* string containing the special tetraloops */
+extern int  Tetraloop37[];  /* Bonus energy for special tetraloops */
+extern int  TetraloopdH[];
+extern char Triloops[];    /* string containing the special triloops */
+extern int  Triloop37[]; /* Bonus energy for special Triloops */
+extern int  TriloopdH[]; /* Bonus energy for special Triloops */
+extern char Hexaloops[];    /* string containing the special triloops */
+extern int  Hexaloop37[]; /* Bonus energy for special Triloops */
+extern int  HexaloopdH[]; /* Bonus energy for special Triloops */
+
+extern int GQuadAlpha37;
+extern int GQuadAlphadH;
+extern int GQuadBeta37;
+extern int GQuadBetadH;
+
+extern double Tmeasure;       /* temperature of param measurements */
+
+#endif
diff --git a/C/ViennaRNA/equilibrium_probs.c b/C/ViennaRNA/equilibrium_probs.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/equilibrium_probs.c
@@ -0,0 +1,2775 @@
+/*
+                  partiton function for RNA secondary structures
+
+                  Ivo L Hofacker + Ronny Lorenz
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <float.h>    /* #defines FLT_MAX ... */
+#include <limits.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/mfe.h"
+#include "ViennaRNA/part_func.h"
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE void  pf_create_bppm(vrna_fold_compound_t *vc, char *structure);
+PRIVATE void  alipf_create_bppm(vrna_fold_compound_t *vc, char *structure);
+PRIVATE INLINE void bppm_circ(vrna_fold_compound_t *vc);
+
+PRIVATE INLINE void ud_outside_ext_loops(vrna_fold_compound_t *vc);
+PRIVATE INLINE void ud_outside_hp_loops(vrna_fold_compound_t *vc);
+PRIVATE INLINE void ud_outside_int_loops(vrna_fold_compound_t *vc);
+PRIVATE INLINE void ud_outside_mb_loops(vrna_fold_compound_t *vc);
+PRIVATE INLINE void ud_outside_hp_loops2(vrna_fold_compound_t *vc);
+PRIVATE INLINE void ud_outside_int_loops2(vrna_fold_compound_t *vc);
+PRIVATE INLINE void ud_outside_mb_loops2(vrna_fold_compound_t *vc);
+
+
+PRIVATE FLT_OR_DBL  numerator_single(vrna_fold_compound_t *vc, int i, int j);
+PRIVATE FLT_OR_DBL  numerator_comparative(vrna_fold_compound_t *vc, int i, int j);
+
+
+PRIVATE double
+wrap_mean_bp_distance(FLT_OR_DBL *p,
+                      int length,
+                      int *index,
+                      int turn);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+void
+vrna_pairing_probs( vrna_fold_compound_t *vc,
+                    char *structure){
+
+  if(vc){
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     pf_create_bppm(vc, structure);
+                                    break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:  alipf_create_bppm(vc, structure);
+                                    break;
+
+      default:                      vrna_message_warning("vrna_pf@part_func.c: Unrecognized fold compound type");
+                                    break;
+    }
+  }
+}
+
+/* calculate base pairing probs */
+PRIVATE void
+pf_create_bppm( vrna_fold_compound_t *vc,
+                char *structure){
+
+  int n, i,j,k,l, ij, kl, ii, u, u1, u2, cnt, ov=0;
+  unsigned char type, type_2, tt;
+  FLT_OR_DBL  temp, Qmax=0, prm_MLb;
+  FLT_OR_DBL  prmt, prmt1;
+  FLT_OR_DBL  *tmp;
+  FLT_OR_DBL  tmp2, tmp_ud;
+  FLT_OR_DBL  expMLclosing;
+  FLT_OR_DBL  *qb, *qm, *G, *probs, *scale, *expMLbase;
+  FLT_OR_DBL  *q1k, *qln;
+
+  char              *ptype;
+
+  double            max_real;
+  int               *rtype, with_gquad;
+  short             *S, *S1;
+  vrna_hc_t         *hc;
+  vrna_sc_t         *sc;
+  int               *my_iindx, *jindx;
+  int               circular, turn, with_ud, with_ud_outside;
+  vrna_exp_param_t  *pf_params;
+  vrna_mx_pf_t      *matrices;
+  vrna_md_t         *md;
+  vrna_ud_t         *domains_up;
+
+  n                 = vc->length;
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  S                 = vc->sequence_encoding2;
+  S1                = vc->sequence_encoding;
+  my_iindx          = vc->iindx;
+  jindx             = vc->jindx;
+  ptype             = vc->ptype;
+
+  circular          = md->circ;
+  with_gquad        = md->gquad;
+  turn              = md->min_loop_size;
+
+  hc                = vc->hc;
+  sc                = vc->sc;
+
+  domains_up        = vc->domains_up;
+  matrices          = vc->exp_matrices;
+
+  qb                = matrices->qb;
+  qm                = matrices->qm;
+  G                 = matrices->G;
+  probs             = matrices->probs;
+  q1k               = matrices->q1k;
+  qln               = matrices->qln;
+  scale             = matrices->scale;
+  expMLbase         = matrices->expMLbase;
+
+  with_ud           = (domains_up && domains_up->exp_energy_cb) ? 1 : 0;
+  with_ud_outside   = (with_ud && domains_up->probs_add) ? 1 : 0;
+
+  FLT_OR_DBL  expMLstem         = (with_gquad) ? exp_E_MLstem(0, -1, -1, pf_params) : 0;
+  char        *hard_constraints = hc->matrix;
+  int         *hc_up_int        = hc->up_int;
+
+  int           corr_size       = 5;
+  int           corr_cnt        = 0;
+  vrna_plist_t  *bp_correction  = vrna_alloc(sizeof(vrna_plist_t) * corr_size);
+
+  max_real      = (sizeof(FLT_OR_DBL) == sizeof(float)) ? FLT_MAX : DBL_MAX;
+
+  /*
+    the following is a crude check whether the partition function forward recursion
+    has already been taken place
+  */
+  if(qb && probs && ( circular ? matrices->qm2 != NULL : (q1k != NULL && qln != NULL))){
+
+    expMLclosing  = pf_params->expMLclosing;
+    with_gquad    = pf_params->model_details.gquad;
+    rtype         = &(pf_params->model_details.rtype[0]);
+
+    /*
+      The hc_local array provides row-wise access to hc->matrix, i.e.
+      my_iindx. Using this in the cubic order loop for multiloops below
+      results in way faster computation due to fewer cache misses. Also,
+      it introduces only little memory overhead, e.g. ~450MB for
+      sequences of length 30,000
+    */
+    char *hc_local = (char *)vrna_alloc(sizeof(char) * (((n + 1) * (n + 2)) /2 + 2));
+    for(i = 1; i <= n; i++)
+      for(j = i; j <= n; j++)
+        hc_local[my_iindx[i] - j] = hard_constraints[jindx[j] + i];
+
+    FLT_OR_DBL *prm_l  = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+    FLT_OR_DBL *prm_l1 = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+    FLT_OR_DBL *prml   = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+
+    int         ud_max_size = 0;
+    FLT_OR_DBL  **pmlu      = NULL;
+    FLT_OR_DBL  *prm_MLbu   = NULL;
+
+    if(with_ud){
+      /* find out maximum size of any unstructured domain */
+      for(u = 0; u < domains_up->uniq_motif_count; u++)
+        if(ud_max_size < domains_up->uniq_motif_size[u])
+          ud_max_size = domains_up->uniq_motif_size[u];
+
+      pmlu  = (FLT_OR_DBL **) vrna_alloc(sizeof(FLT_OR_DBL *) * (ud_max_size + 1)); /* maximum motif size */
+
+      for(u = 0; u <= ud_max_size; u++)
+        pmlu[u] = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * (n + 2));
+
+      prm_MLbu = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * (ud_max_size + 1));
+    }
+
+    Qmax=0;
+
+    /* 1. exterior pair i,j and initialization of pr array */
+    if(circular){
+      bppm_circ(vc);
+    } else {
+      for (i=1; i<=n; i++) {
+        for (j=i; j<=MIN2(i+turn,n); j++)
+          probs[my_iindx[i]-j] = 0.;
+
+        for (j=i+turn+1; j<=n; j++) {
+          ij = my_iindx[i]-j;
+          if((hc_local[ij] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) && (qb[ij] > 0.)){
+            type      = (unsigned char)ptype[jindx[j] + i];
+
+            if(type == 0)
+              type = 7;
+
+            probs[ij] = q1k[i-1]*qln[j+1]/q1k[n];
+            probs[ij] *= exp_E_ExtLoop(type, (i>1) ? S1[i-1] : -1, (j<n) ? S1[j+1] : -1, pf_params);
+            if(sc){
+              if(sc->exp_f){
+                probs[ij] *= sc->exp_f(1, n, i, j, VRNA_DECOMP_EXT_STEM_OUTSIDE, sc->data);
+              }
+            }
+          } else
+            probs[ij] = 0.;
+        }
+      }
+    } /* end if(!circular)  */
+
+    for (l = n; l > turn + 1; l--) {
+
+      /* 2. bonding k,l as substem of 2:loop enclosed by i,j */
+      for(k = 1; k < l - turn; k++){
+        kl      = my_iindx[k]-l;
+        type_2  = (unsigned char)ptype[jindx[l] + k];
+        type_2  = rtype[type_2];
+
+        if(type_2 == 0)
+          type_2 = 7;
+
+        if (qb[kl]==0.) continue;
+
+        if(hc_local[kl] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC){
+          for(i = MAX2(1, k - MAXLOOP - 1); i <= k - 1; i++){
+            u1 = k - i - 1;
+            if(hc_up_int[i+1] < u1) continue;
+
+            for(j = l + 1; j <= MIN2(l + MAXLOOP - k + i + 2, n); j++){
+              u2 = j-l-1;
+              if(hc_up_int[l+1] < u2) break;
+
+              ij = my_iindx[i] - j;
+              if(hc_local[ij] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){
+                type = (unsigned char)ptype[jindx[j] + i];
+
+                if(type == 0)
+                  type = 7;
+
+                if(probs[ij] > 0){
+                  tmp2 =  probs[ij]
+                          * scale[u1 + u2 + 2]
+                          * exp_E_IntLoop(u1, u2, type, type_2, S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params);
+
+                  if(sc){
+                    if(sc->exp_energy_up)
+                      tmp2 *=   sc->exp_energy_up[i+1][u1]
+                              * sc->exp_energy_up[l+1][u2];
+
+                    if(sc->exp_energy_bp)
+                      tmp2 *=   sc->exp_energy_bp[ij];
+
+                    if(sc->exp_energy_stack){
+                      if((i+1 == k) && (j-1 == l)){
+                        tmp2 *=   sc->exp_energy_stack[i]
+                                * sc->exp_energy_stack[k]
+                                * sc->exp_energy_stack[l]
+                                * sc->exp_energy_stack[j];
+                      }
+                    }
+
+                    if(sc->exp_f)
+                      tmp2 *= sc->exp_f(i, j, k, l, VRNA_DECOMP_PAIR_IL, sc->data);
+                  }
+
+                  if(with_ud){
+                    FLT_OR_DBL qql, qqr;
+
+                    qql = qqr = 0.;
+
+                    if(u1 > 0)
+                      qql = domains_up->exp_energy_cb(vc,
+                                                      i+1, k-1,
+                                                      VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                                      domains_up->data);
+                    if(u2 > 0)
+                      qqr = domains_up->exp_energy_cb(vc,
+                                                      l+1, j-1,
+                                                      VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                                      domains_up->data);
+                    temp  = tmp2;
+                    tmp2 += temp * qql;
+                    tmp2 += temp * qqr;
+                    tmp2 += temp * qql * qqr;
+                  }
+
+                  if(sc && sc->exp_f && sc->bt){ /* store probability correction for auxiliary pairs in interior loop motif */
+                    vrna_basepair_t *ptr, *aux_bps;
+                    aux_bps = sc->bt(i, j, k, l, VRNA_DECOMP_PAIR_IL, sc->data);
+                    for(ptr = aux_bps; ptr && ptr->i != 0; ptr++){
+                      bp_correction[corr_cnt].i = ptr->i;
+                      bp_correction[corr_cnt].j = ptr->j;
+                      bp_correction[corr_cnt++].p = tmp2 * qb[kl];
+                      if(corr_cnt == corr_size){
+                        corr_size += 5;
+                        bp_correction = vrna_realloc(bp_correction, sizeof(vrna_plist_t) * corr_size);
+                      }
+                    }
+                    free(aux_bps);
+                  }
+
+                  probs[kl] += tmp2;
+                }
+              }
+            }
+          }
+        }
+      }
+
+      if(with_gquad){
+        /* 2.5. bonding k,l as gquad enclosed by i,j */
+        double *expintern = &(pf_params->expinternal[0]);
+        FLT_OR_DBL qe;
+
+        if(l < n - 3){
+          for(k = 2; k <= l - VRNA_GQUAD_MIN_BOX_SIZE; k++){
+            kl = my_iindx[k]-l;
+            if (G[kl]==0.) continue;
+            tmp2 = 0.;
+            i = k - 1;
+            for(j = MIN2(l + MAXLOOP + 1, n); j > l + 3; j--){
+              ij = my_iindx[i] - j;
+              type = (unsigned char)ptype[jindx[j] + i];
+              if(!type) continue;
+              qe = (type > 2) ? pf_params->expTermAU : 1.;
+              tmp2 +=   probs[ij]
+                      * qe
+                      * (FLT_OR_DBL)expintern[j-l-1]
+                      * pf_params->expmismatchI[type][S1[i+1]][S1[j-1]]
+                      * scale[2];
+            }
+            probs[kl] += tmp2 * G[kl];
+          }
+        }
+
+        if (l < n - 1){
+          for (k=3; k<=l-VRNA_GQUAD_MIN_BOX_SIZE; k++) {
+            kl = my_iindx[k]-l;
+            if (G[kl]==0.) continue;
+            tmp2 = 0.;
+            for (i=MAX2(1,k-MAXLOOP-1); i<=k-2; i++){
+              u1 = k - i - 1;
+              for (j=l+2; j<=MIN2(l + MAXLOOP - u1 + 1,n); j++) {
+                ij = my_iindx[i] - j;
+                type = (unsigned char)ptype[jindx[j] + i];
+                if(!type) continue;
+                qe = (type > 2) ? pf_params->expTermAU : 1.;
+                tmp2 +=   probs[ij]
+                        * qe
+                        * (FLT_OR_DBL)expintern[u1+j-l-1]
+                        * pf_params->expmismatchI[type][S1[i+1]][S1[j-1]]
+                        * scale[2];
+              }
+            }
+            probs[kl] += tmp2 * G[kl];
+          }
+        }
+
+        if(l < n){
+          for(k = 4; k <= l - VRNA_GQUAD_MIN_BOX_SIZE; k++){
+            kl = my_iindx[k]-l;
+            if (G[kl]==0.) continue;
+            tmp2 = 0.;
+            j = l + 1;
+            for (i=MAX2(1,k-MAXLOOP-1); i < k - 3; i++){
+              ij = my_iindx[i] - j;
+              type = (unsigned char)ptype[jindx[j] + i];
+              if(!type) continue;
+              qe = (type > 2) ? pf_params->expTermAU : 1.;
+              tmp2 +=   probs[ij]
+                      * qe
+                      * (FLT_OR_DBL)expintern[k - i - 1]
+                      * pf_params->expmismatchI[type][S1[i+1]][S1[j-1]]
+                      * scale[2];
+            }
+            probs[kl] += tmp2 * G[kl];
+          }
+        }
+      }
+
+      /* 3. bonding k,l as substem of multi-loop enclosed by i,j */
+      prm_MLb = 0.;
+
+      if(with_ud){
+        for(u = 0; u <= ud_max_size; u++)
+          prm_MLbu[u] = 0.;
+      }
+
+      if (l<n)
+        for (k = 2; k < l - turn; k++) {
+          kl    = my_iindx[k] - l;
+          i     = k - 1;
+          prmt  = prmt1 = 0.0;
+
+          int lj;
+          short s3;
+          FLT_OR_DBL ppp;
+          ij = my_iindx[i] - (l+2);
+          lj = my_iindx[l+1]-(l+1);
+          s3 = S1[i+1];
+          for (j = l + 2; j<=n; j++, ij--, lj--){
+            if(hc_local[ij] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+              tt = (unsigned char)md->pair[S1[j]][S1[i]];
+
+              if(tt == 0)
+                tt = 7;
+
+              /* which decomposition is covered here? =>
+                i + 1 = k < l < j:
+                (i,j)       -> enclosing pair
+                (k, l)      -> enclosed pair
+                (l+1, j-1)  -> multiloop part with at least one stem
+                a.k.a. (k,l) is left-most stem in multiloop closed by (k-1, j)
+              */
+              ppp = probs[ij]
+                    * exp_E_MLstem(tt, S1[j-1], s3, pf_params)
+                    * qm[lj];
+
+              if(sc){
+                if(sc->exp_energy_bp)
+                  ppp *= sc->exp_energy_bp[ij];
+/*
+                if(sc->exp_f)
+                  ppp *= sc->exp_f(i, j, l+1, j-1, , sc->data);
+*/
+              }
+              prmt += ppp;
+            }
+          }
+          prmt *= expMLclosing;
+
+
+          prml[ i]  =   prmt;
+
+          ii = my_iindx[i];     /* ii-j=[i,j]     */
+          tt = (unsigned char)ptype[jindx[l+1] + i];
+          tt = rtype[tt];
+          if(hc_local[ii - (l + 1)] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+
+            if(tt == 0)
+              tt = 7;
+
+            prmt1 = probs[ii-(l+1)]
+                    * expMLclosing
+                    * exp_E_MLstem(tt, S1[l], S1[i+1], pf_params);
+
+            if(sc){
+              /* which decompositions are covered here? => (i, l+1) -> enclosing pair */
+              if(sc->exp_energy_bp)
+                prmt1 *= sc->exp_energy_bp[ii - (l+1)];
+
+/*
+              if(sc->exp_f)
+                prmt1 *= sc->exp_f(i, l+1, k, l, , sc->data);
+*/
+            }
+          }
+
+          /* l+1 is unpaired */
+          if(hc->up_ml[l+1]){
+            ppp = prm_l1[i] * expMLbase[1];
+            if(sc){
+              if(sc->exp_energy_up)
+                ppp *= sc->exp_energy_up[l+1][1];
+
+/*
+              if(sc_exp_f)
+                ppp *= sc->exp_f(, sc->data);
+*/
+            }
+
+            /* add contributions of MB loops where any unstructured domain starts at l+1 */
+            if(with_ud){
+              int cnt;
+              for(cnt = 0; cnt < domains_up->uniq_motif_count; cnt++){
+                u = domains_up->uniq_motif_size[cnt];
+                if(hc->up_ml[l+1] >= u){
+                  if(l + u < n){
+                    temp =    domains_up->exp_energy_cb(vc,
+                                                        l+1, l+u,
+                                                        VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                                        domains_up->data)
+                            * pmlu[u][i]
+                            * expMLbase[u];
+
+                    if(sc){
+                      if(sc->exp_energy_up)
+                        temp *= sc->exp_energy_up[l+1][u];
+                    }
+
+                    ppp += temp;
+                  }
+                }
+              }
+              pmlu[0][i] = ppp + prmt1;
+            }
+
+            prm_l[i] = ppp + prmt1;
+          } else { /* skip configuration where l+1 is unpaired */
+            prm_l[i] = prmt1;
+
+            if(with_ud)
+              pmlu[0][i] = prmt1;
+          }
+
+          /* i is unpaired */
+          if(hc->up_ml[i]){
+            ppp = prm_MLb * expMLbase[1];
+            if(sc){
+              if(sc->exp_energy_up)
+                ppp *= sc->exp_energy_up[i][1];
+
+/*
+              if(sc->exp_f)
+                ppp *= sc->exp_f(, sc->data);
+*/
+            }
+
+            if(with_ud){
+              int cnt;
+              for(cnt = 0; cnt < domains_up->uniq_motif_count; cnt++){
+                u = domains_up->uniq_motif_size[cnt];
+                if(hc->up_ml[i] >= u){
+                  temp =    prm_MLbu[u]
+                          * expMLbase[u]
+                          * domains_up->exp_energy_cb(vc,
+                                                      i, i+u,
+                                                      VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                                      domains_up->data);
+
+                  if(sc){
+                    if(sc->exp_energy_up)
+                      temp *= sc->exp_energy_up[i][u];
+                  }
+                  ppp += temp;
+                }
+              }
+              prm_MLbu[0] = ppp + prml[i];
+            }
+
+            prm_MLb = ppp + prml[i];
+            /* same as:    prm_MLb = 0;
+               for (i=1; i<=k-1; i++) prm_MLb += prml[i]*expMLbase[k-i-1]; */
+
+          } else { /* skip all configurations where i is unpaired */
+            prm_MLb = prml[i];
+
+            if(with_ud)
+              prm_MLbu[0] = prml[i];
+          }
+
+          prml[i] = prml[i] + prm_l[i];
+
+          tt = ptype[jindx[l] + k];
+
+          if(with_gquad){
+            if ((!tt) && (G[kl] == 0.)) continue;
+          } else {
+            if (qb[kl] == 0.) continue;
+          }
+
+          if(hc_local[kl] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC){
+
+            temp = prm_MLb;
+
+            for (i=1;i<=k-2; i++)
+              temp += prml[i]*qm[my_iindx[i+1] - (k-1)];
+
+            if(with_gquad){
+              if(tt)
+                temp    *= exp_E_MLstem(tt, (k>1) ? S1[k-1] : -1, (l<n) ? S1[l+1] : -1, pf_params) * scale[2];
+              else
+                temp    *= G[kl] * expMLstem * scale[2];
+            } else {
+
+              if(tt == 0)
+                tt = 7;
+
+              temp    *= exp_E_MLstem(tt, (k>1) ? S1[k-1] : -1, (l<n) ? S1[l+1] : -1, pf_params) * scale[2];
+            }
+
+            probs[kl]  += temp;
+
+            if (probs[kl]>Qmax) {
+              Qmax = probs[kl];
+              if (Qmax>max_real/10.)
+                vrna_message_warning("P close to overflow: %d %d %g %g\n",
+                                            k, l, probs[kl], qb[kl]);
+            }
+            if (probs[kl]>=max_real) {
+              ov++;
+              probs[kl]=FLT_MAX;
+            }
+          }
+
+          /* rotate prm_MLbu entries required for unstructured domain feature */
+          if(with_ud){
+            for(u = ud_max_size; u > 0; u--)
+              prm_MLbu[u] = prm_MLbu[u - 1];
+          }
+        } /* end for (k=..) */
+
+      /* rotate prm_l and prm_l1 arrays */
+      tmp = prm_l1; prm_l1=prm_l; prm_l=tmp;
+
+      /* rotate pmlu entries required for unstructured domain feature */
+      if(with_ud){
+        tmp = pmlu[ud_max_size];
+        for(u = ud_max_size; u > 0; u--)
+          pmlu[u] = pmlu[u - 1];
+        pmlu[0] = tmp;
+      }
+    }  /* end for (l=..)   */
+
+    if(with_ud_outside){
+      /*
+          The above recursions only deal with base pairs, and how they might be
+          enclosed by other pairs. However, for unstructrued domains, we have
+          unpaired stretches, and require information about how these are enclosed
+          by base pairs.
+      */
+
+      /* 1. Exterior loops */
+      ud_outside_ext_loops(vc);
+
+      /* 2. Hairpin loops */
+      ud_outside_hp_loops(vc);
+
+      /* 3. Interior loops */
+      ud_outside_int_loops(vc);
+
+      /* 4. Multi branch loops */
+      ud_outside_mb_loops(vc);
+    }
+
+    if(sc && sc->f && sc->bt){
+      for (i=1; i<=n; i++)
+        for (j=i+turn+1; j<=n; j++) {
+          ij = my_iindx[i]-j;
+          /*  search for possible auxiliary base pairs in hairpin loop motifs to store
+              the corresponding probability corrections
+          */ 
+          if(hc_local[ij] & VRNA_CONSTRAINT_CONTEXT_HP_LOOP){
+            vrna_basepair_t *ptr, *aux_bps;
+            aux_bps = sc->bt(i, j, i, j, VRNA_DECOMP_PAIR_HP, sc->data);
+            if(aux_bps){
+              FLT_OR_DBL qhp = vrna_exp_E_hp_loop(vc, i, j);
+              for(ptr = aux_bps; ptr && ptr->i != 0; ptr++){
+                bp_correction[corr_cnt].i = ptr->i;
+                bp_correction[corr_cnt].j = ptr->j;
+                bp_correction[corr_cnt++].p = probs[ij] * qhp;
+                if(corr_cnt == corr_size){
+                  corr_size += 5;
+                  bp_correction = vrna_realloc(bp_correction, sizeof(vrna_plist_t) * corr_size);
+                }
+              }
+            }
+            free(aux_bps);
+          }
+        }
+
+      /*  correct pairing probabilities for auxiliary base pairs from hairpin-, or interior loop motifs
+          as augmented by the generalized soft constraints feature
+      */
+      for(i = 0; i < corr_cnt; i++){
+        ij = my_iindx[bp_correction[i].i] - bp_correction[i].j;
+        /* printf("correcting pair %d, %d by %f\n", bp_correction[i].i, bp_correction[i].j, bp_correction[i].p); */
+        probs[ij] += bp_correction[i].p / qb[ij];
+      }
+    }
+    free(bp_correction);
+
+    for (i=1; i<=n; i++)
+      for (j=i+turn+1; j<=n; j++) {
+        ij = my_iindx[i]-j;
+
+        if(with_gquad){
+          if (qb[ij] > 0.)
+            probs[ij] *= qb[ij];
+
+          if (G[ij] > 0.){
+            probs[ij] += q1k[i-1] * G[ij] * qln[j+1]/q1k[n];
+          }
+        } else {
+          if (qb[ij] > 0.)
+            probs[ij] *= qb[ij];
+        }
+      }
+
+    if (structure!=NULL){
+      char *s = vrna_db_from_probs(probs, (unsigned int)n);
+      memcpy(structure, s, n);
+      structure[n] = '\0';
+      free(s);
+    }
+    if(ov > 0)
+      vrna_message_warning("%d overflows occurred while backtracking;\n"
+                                  "you might try a smaller pf_scale than %g\n",
+                                  ov, pf_params->pf_scale);
+
+    /* clean up */
+    free(prm_l);
+    free(prm_l1);
+    free(prml);
+
+    if(with_ud){
+      for(u = 0; u <= ud_max_size; u++)
+        free(pmlu[u]);
+      free(pmlu);
+      free(prm_MLbu);
+    }
+
+    free(hc_local);
+  } /* end if 'check for forward recursion' */
+  else
+    vrna_message_error("bppm calculations have to be done after calling forward recursion\n");
+
+#if 0
+  if(with_ud_outside){
+    for(i = 1; i <= n; i++)
+      for(j = i; j <= n; j++){
+        FLT_OR_DBL p, pp;
+        pp = 0.;
+        p = domains_up->probs_get(vc, i, j, VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP, 0, domains_up->data);
+        if(p > 0.)
+          printf("p_ext[0][%d,%d] = %g\n", i, j, p);
+        pp += p;
+        p = domains_up->probs_get(vc, i, j, VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP, 0, domains_up->data);
+        pp += p;
+        if(p > 0.)
+          printf("p_hp[0][%d,%d] = %g\n", i, j, p);
+        p = domains_up->probs_get(vc, i, j, VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP, 0, domains_up->data);
+        pp += p;
+        if(p > 0.)
+          printf("p_int[0][%d,%d] = %g\n", i, j, p);
+        p = domains_up->probs_get(vc, i, j, VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP, 0, domains_up->data);
+        pp += p;
+        if(p > 0.)
+          printf("p_ml[0][%d,%d] = %g\n", i, j, p);
+        if(pp > 0.)
+          printf("p[0][%d,%d] = %g\n", i, j, pp);
+      }
+  }
+#endif
+
+  return;
+}
+
+
+PRIVATE INLINE void
+ud_outside_ext_loops( vrna_fold_compound_t *vc){
+
+  int         i, j, u, n, cnt, *motif_list, *hc_up;
+  FLT_OR_DBL  *q1k, *qln, temp, *scale;
+  vrna_sc_t   *sc;
+  vrna_ud_t   *domains_up;
+
+  n           = vc->length;
+  q1k         = vc->exp_matrices->q1k;
+  qln         = vc->exp_matrices->qln;
+  scale       = vc->exp_matrices->scale;
+  hc_up       = vc->hc->up_ext;
+  domains_up  = vc->domains_up;
+  sc          = vc->sc;
+
+  for(i = 1; i <= n; i++){
+    motif_list = vrna_ud_get_motif_size_at(vc, i, VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP);
+
+    /* 1. Exterior loops */
+    if(motif_list){
+      cnt = 0;
+      while(-1 != (u = motif_list[cnt])){
+        j = i + u - 1;
+        if(j <= n){
+          if(hc_up[i] >= u){
+            temp = q1k[i-1] * qln[j + 1]/q1k[n];
+            temp *= domains_up->exp_energy_cb(vc,
+                                              i, j,
+                                              VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                              domains_up->data);
+
+            if(sc){
+              if(sc->exp_energy_up)
+                temp *= sc->exp_energy_up[i][u];
+            }
+            temp *= scale[u];
+
+            if(temp > 0.)
+              domains_up->probs_add(vc,
+                                    i, j,
+                                    VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                    temp,
+                                    domains_up->data);
+          }
+        }
+        cnt++;
+      }
+    }
+    free(motif_list);
+  }
+}
+
+PRIVATE INLINE void
+ud_outside_hp_loops( vrna_fold_compound_t *vc){
+
+
+  int         i, j, k, l, kl, *my_iindx, u, n, cnt, *motif_list, *hc_up;
+  FLT_OR_DBL  *q1k, *qln, temp, *scale, outside, exp_motif_en, *probs, q1, q2;
+
+  vrna_sc_t   *sc;
+  vrna_ud_t   *domains_up, *ud_bak;
+
+  n           = vc->length;
+  my_iindx    = vc->iindx;
+  q1k         = vc->exp_matrices->q1k;
+  qln         = vc->exp_matrices->qln;
+  probs       = vc->exp_matrices->probs;
+  scale       = vc->exp_matrices->scale;
+  hc_up       = vc->hc->up_hp;
+  domains_up  = vc->domains_up;
+  sc          = vc->sc;
+
+  for(i = 1; i <= n; i++){
+    motif_list = vrna_ud_get_motif_size_at(vc, i, VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP);
+
+    /* 2. Hairpin loops */
+    if(motif_list){
+      cnt = 0;
+      while(-1 != (u = motif_list[cnt])){
+        outside = 0.;
+        j       = i + u - 1;
+        if(j < n){
+          if(hc_up[i] >= u){
+            exp_motif_en = domains_up->exp_energy_cb( vc,
+                                                      i, j,
+                                                      VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                                      domains_up->data);
+
+            /*
+              compute the contribution of all hairpins with
+              bound motif
+            */
+            for(k = 1; k < i; k++)
+              for(l = j + 1; l <= n; l++){
+                kl = my_iindx[k] - l;
+                if(probs[kl] > 0.){
+                  ud_bak          = vc->domains_up;
+                  vc->domains_up  = NULL;
+                  temp            = vrna_exp_E_hp_loop(vc, k, l);
+                  vc->domains_up  = ud_bak;
+
+                  /* add contribution of motif */
+                  if(temp > 0.){
+                    temp *= exp_motif_en * probs[kl];
+
+                    q1 = q2 = 0.;
+                    /* add contributions of other motifs in remaining unpaired segments */
+                    if((i - k - 1) > 0)
+                      q1 = domains_up->exp_energy_cb( vc,
+                                                      k + 1, i - 1,
+                                                      VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+                                                      domains_up->data);
+                    if((l - j - 1) > 0)
+                      q2 = domains_up->exp_energy_cb( vc,
+                                                      j + 1, l - 1,
+                                                      VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+                                                      domains_up->data);
+
+                    outside += temp;
+                    outside += temp * q1;
+                    outside += temp * q1 * q2;
+                    outside += temp * q2;
+                  }
+                }
+              }
+          }
+        }
+
+        if(outside > 0.)
+          domains_up->probs_add(vc,
+                                i, j,
+                                VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                outside,
+                                domains_up->data);
+
+        cnt++;
+      }
+    }
+    free(motif_list);
+  }
+
+}
+
+PRIVATE INLINE void
+ud_outside_hp_loops2( vrna_fold_compound_t *vc){
+
+
+  int         i, j, k, l, kl, *my_iindx, u, u1, u2, n, cnt, *motif_list, *hc_up, turn, m;
+  FLT_OR_DBL  *q1k, *qln, temp, *scale, outside, exp_motif_en, *probs, q1, q2, **qq_ud, **pp_ud;
+
+  vrna_sc_t   *sc;
+  vrna_ud_t   *domains_up, *ud_bak;
+
+  n           = vc->length;
+  my_iindx    = vc->iindx;
+  q1k         = vc->exp_matrices->q1k;
+  qln         = vc->exp_matrices->qln;
+  probs       = vc->exp_matrices->probs;
+  scale       = vc->exp_matrices->scale;
+  hc_up       = vc->hc->up_hp;
+  domains_up  = vc->domains_up;
+  sc          = vc->sc;
+  turn        = vc->exp_params->model_details.min_loop_size;
+
+  qq_ud = (FLT_OR_DBL **)vrna_alloc(sizeof(FLT_OR_DBL *) * (n + 1));
+  for(k = 0; k < domains_up->uniq_motif_count; k++){
+    qq_ud[k] = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+    u = domains_up->uniq_motif_size[k];
+    for(i = 1; i <= n - u + 1; i++){
+      qq_ud[k][i] = domains_up->exp_energy_cb(vc,
+                                              i, i + u - 1,
+                                              VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                              domains_up->data);
+    }
+  }
+
+  pp_ud = (FLT_OR_DBL **)vrna_alloc(sizeof(FLT_OR_DBL *) * (n + 1));
+  for(k = 0; k < domains_up->uniq_motif_count; k++){
+    pp_ud[k] = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+  }
+
+  for(k = 1; k < n; k++){
+    for(l = k + turn + 1; l <= n; l++){
+      kl = my_iindx[k] - l;
+      if(probs[kl] > 0.){
+        ud_bak          = vc->domains_up;
+        vc->domains_up  = NULL;
+        temp            = vrna_exp_E_hp_loop(vc, k, l);
+        vc->domains_up  = ud_bak;
+        temp           *= probs[kl];
+
+        if(temp > 0.){
+          for(m = 0; m < domains_up->uniq_motif_count; m++){
+            u = domains_up->uniq_motif_size[m];
+            for(u1 = 0, u2 = l - k - u - 1, i = k + 1, j = k + u; j < l; i++, j++, u1++, u2--){
+              exp_motif_en = qq_ud[m][i];
+              q1 = q2 = 1.;
+              if(u1 > 0)
+                q1 += domains_up->exp_energy_cb(vc,
+                                                k + 1, i - 1,
+                                                VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+                                                domains_up->data);
+              if(u2 > 0)
+                q2 += domains_up->exp_energy_cb(vc,
+                                                j + 1, l - 1,
+                                                VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+                                                domains_up->data);
+              outside = temp * q1 * q2 * exp_motif_en;
+              pp_ud[m][i] += outside;
+            }
+          }
+        }
+      }
+    }
+  }
+
+  for(k = 0; k < domains_up->uniq_motif_count; k++){
+    u = domains_up->uniq_motif_size[k];
+    /* actually store the results */
+    for(i = 1; i <= n - u + 1; i++){
+      if(pp_ud[k][i] > 0.)
+        domains_up->probs_add(vc,
+                              i, i + u - 1,
+                              VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                              pp_ud[k][i],
+                              domains_up->data);
+    }
+    free(qq_ud[k]);
+    free(pp_ud[k]);
+  }
+  free(qq_ud);
+  free(pp_ud);
+}
+
+
+PRIVATE INLINE void
+ud_outside_int_loops( vrna_fold_compound_t *vc){
+
+  int         i, j, k, l, p, q, pq, kl, u, n, cnt, *motif_list, *my_iindx,
+              *hc_up, kmin, pmax, qmin, lmax, turn;
+  FLT_OR_DBL  *q1k, *qln, temp, *scale, q1, q2, q3, exp_motif_en, outside,
+              *probs, *qb;
+  vrna_sc_t   *sc;
+  vrna_ud_t   *domains_up, *ud_bak;
+
+  n           = vc->length;
+  my_iindx    = vc->iindx;
+  q1k         = vc->exp_matrices->q1k;
+  qln         = vc->exp_matrices->qln;
+  qb          = vc->exp_matrices->qb;
+  probs       = vc->exp_matrices->probs;
+  scale       = vc->exp_matrices->scale;
+  hc_up       = vc->hc->up_int;
+  domains_up  = vc->domains_up;
+  sc          = vc->sc;
+  turn        = vc->exp_params->model_details.min_loop_size;
+
+  for(i = 2; i <= n; i++){
+    motif_list = vrna_ud_get_motif_size_at(vc, i, VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP);
+
+    /* 3. Interior loops */
+    if(motif_list){
+      cnt = 0;
+      while(-1 != (u = motif_list[cnt])){
+        outside = 0.;
+        j       = i + u - 1;
+
+        if(j < n){
+          if(hc_up[i] >= u){
+            exp_motif_en = domains_up->exp_energy_cb( vc,
+                                                      i, j,
+                                                      VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                                      domains_up->data);
+
+            /* 3.1 motif is within 5' loop */
+            kmin  = j - MAXLOOP - 1;
+            kmin  = MAX2(kmin, 1);
+            for(k = kmin; k < i; k++){
+              pmax = k + MAXLOOP + 1;
+              pmax = MIN2(pmax, n);
+              for(p = j + 1; p < n; p++)
+                for(q = p + turn + 1; q < n; q++){
+                  pq    = my_iindx[p] - q;
+                  if(qb[pq] == 0)
+                    continue;
+                  lmax  =  k + MAXLOOP + q - p + 2;
+                  lmax  = MIN2(lmax, n);
+                  for(l = q + 1; l <= lmax; l++){
+                    kl = my_iindx[k] - l;
+                    if(probs[kl] > 0.){
+                      ud_bak          = vc->domains_up;
+                      vc->domains_up  = NULL;
+                      temp            = vrna_exp_E_interior_loop(vc, k, l, p, q);
+                      vc->domains_up  = ud_bak;
+
+                      if(temp > 0.){
+                        temp *= probs[kl] * qb[pq] * exp_motif_en;
+
+                        q1 = q2 = q3 = 0.;
+                        if((l - q - 1) > 0)
+                          q1 = domains_up->exp_energy_cb( vc,
+                                                          q + 1, l - 1,
+                                                          VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                                          domains_up->data);
+                        if((i - k - 1) > 0)
+                          q2 = domains_up->exp_energy_cb( vc,
+                                                          k + 1, i - 1,
+                                                          VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                                          domains_up->data);
+                        if((p - j - 1) > 0)
+                          q3 = domains_up->exp_energy_cb( vc,
+                                                          j + 1, p - 1,
+                                                          VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                                          domains_up->data);
+
+                        outside += temp;
+                        outside += temp * q1;
+                        outside += temp * q1 * q2;
+                        outside += temp * q1 * q2 * q3;
+                        outside += temp * q2;
+                        outside += temp * q2 * q3;
+                        outside += temp * q3;
+                      }
+                    }
+                  }
+                }
+            }
+
+            /* 3.2 motif is within 3' loop */
+            for(k = 1; k < i - turn - 2; k++){
+              pmax = k + i + MAXLOOP - j;
+              pmax = MIN2(pmax, n);
+              for(p = k + 1; p <= pmax; p++){
+                qmin = p + j - k - MAXLOOP - 1;
+                qmin = MAX2(qmin, p + turn + 1);
+                for(q = i - 1; q >= qmin; q--){
+                  pq    = my_iindx[p] - q;
+                  if(qb[pq] == 0.)
+                    continue;
+                  lmax  = k + q - p + MAXLOOP + 2;
+                  lmax  = MIN2(lmax, n);
+                  for(l = j + 1; l < lmax; l++){
+                    kl = my_iindx[k] - l;
+                    if(probs[kl] > 0.){
+                      ud_bak          = vc->domains_up;
+                      vc->domains_up  = NULL;
+                      temp            = vrna_exp_E_interior_loop(vc, k, l, p, q);
+                      vc->domains_up  = ud_bak;
+
+                      if(temp > 0.){
+                        FLT_OR_DBL q1, q2, q3;
+                        temp *= probs[kl] * qb[pq] * exp_motif_en;
+
+                        q1 = q2 = q3 = 0.;
+                        if((l - j - 1) > 0)
+                          q1 = domains_up->exp_energy_cb( vc,
+                                                          j + 1, l - 1,
+                                                          VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                                          domains_up->data);
+                        if((i - q - 1) > 0)
+                          q2 = domains_up->exp_energy_cb( vc,
+                                                          q + 1,
+                                                          i - 1,
+                                                          VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                                          domains_up->data);
+                        if((p - k - 1) > 0)
+                          q3 = domains_up->exp_energy_cb( vc,
+                                                          k + 1,
+                                                          p - 1,
+                                                          VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                                          domains_up->data);
+
+                        outside += temp;
+                        outside += temp * q1;
+                        outside += temp * q1 * q2;
+                        outside += temp * q1 * q2 * q3;
+                        outside += temp * q2;
+                        outside += temp * q2 * q3;
+                        outside += temp * q3;
+                      }
+                    }
+                  }
+                }
+              }
+            }
+
+          }
+        }
+
+        if(outside > 0.)
+          domains_up->probs_add(vc,
+                                i, j,
+                                VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                outside,
+                                domains_up->data);
+
+        cnt++;
+      }
+    }
+    free(motif_list);
+  }
+}
+
+PRIVATE INLINE void
+ud_outside_int_loops2( vrna_fold_compound_t *vc){
+
+  char        *hard_constraints, *hc_local;
+  int         i, j, k, l, p, q, pq, kl, u, n, cnt, *motif_list, *my_iindx,
+              *hc_up, kmin, pmax, qmin, lmax, turn, *jindx, u1, u2, uu1, uu2,
+              u2_max, m;
+  FLT_OR_DBL  *q1k, *qln, temp, *scale, q1, q2, q5, q3, exp_motif_en, outside,
+              *probs, *qb, qq1, qq2, *qqk, *qql, *qqp, **qq_ud, **pp_ud, temp5,
+              temp3;
+  vrna_sc_t   *sc;
+  vrna_ud_t   *domains_up, *ud_bak;
+
+  n           = vc->length;
+  my_iindx    = vc->iindx;
+  jindx       = vc->jindx;
+  q1k         = vc->exp_matrices->q1k;
+  qln         = vc->exp_matrices->qln;
+  qb          = vc->exp_matrices->qb;
+  probs       = vc->exp_matrices->probs;
+  scale       = vc->exp_matrices->scale;
+  hc_up       = vc->hc->up_int;
+  hard_constraints = vc->hc->matrix;
+  domains_up  = vc->domains_up;
+  sc          = vc->sc;
+  turn        = vc->exp_params->model_details.min_loop_size;
+
+  hc_local = (char *)vrna_alloc(sizeof(char) * (((n + 1) * (n + 2)) /2 + 2));
+  for(i = 1; i <= n; i++)
+    for(j = i; j <= n; j++)
+      hc_local[my_iindx[i] - j] = hard_constraints[jindx[j] + i];
+
+  qqk = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+  qql = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+  qqp = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+
+  qq_ud = (FLT_OR_DBL **)vrna_alloc(sizeof(FLT_OR_DBL *) * (n + 1));
+  for(k = 0; k < domains_up->uniq_motif_count; k++){
+    qq_ud[k] = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+    u = domains_up->uniq_motif_size[k];
+    for(i = 1; i <= n - u + 1; i++){
+      qq_ud[k][i] = domains_up->exp_energy_cb(vc,
+                                              i, i + u - 1,
+                                              VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                              domains_up->data);
+    }
+  }
+
+  pp_ud = (FLT_OR_DBL **)vrna_alloc(sizeof(FLT_OR_DBL *) * (n + 1));
+  for(k = 0; k < domains_up->uniq_motif_count; k++){
+    pp_ud[k] = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+  }
+
+  for(k = 1; k < n; k++){
+    for(l = k + 1; l <= MIN2(k + MAXLOOP, n); l++){
+      qqk[l] = domains_up->exp_energy_cb(vc,
+                                         k + 1, l,
+                                         VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                        domains_up->data);
+    }
+    for(l = k + turn + 1 + 3; l <= n; l++){
+      kl = my_iindx[k] - l;
+      if(probs[kl] == 0.)
+        continue;
+      if(hc_local[kl] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){
+
+        for(i = l - 1; i > MAX2(k, l - MAXLOOP - 1); i--){
+          qql[i] = domains_up->exp_energy_cb( vc,
+                                              i, l - 1,
+                                              VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                              domains_up->data);
+        }
+
+        pmax = k + MAXLOOP + 1;
+        pmax = MIN2(pmax, l - turn);
+        for(p = k + 1; p < pmax; p++){
+          u1      = p - k - 1;
+          u2_max  = MAXLOOP - u1;
+          qmin    = l - 1 - u2_max;
+          qmin    = MAX2(qmin, p + turn + 1);
+          for(i = p - 1; i > k; i--){
+            qqp[i] = domains_up->exp_energy_cb( vc,
+                                                i, p - 1,
+                                                VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                                domains_up->data);
+          }
+
+          q5 = 1.;
+          if(u1 > 0)
+            q5 += qqk[p - 1];
+
+          for(q = qmin; q < l; q++){
+            pq = my_iindx[p] - q;
+
+            if(hc_local[pq] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC){
+              u2 = l - q - 1;
+              ud_bak          = vc->domains_up;
+              vc->domains_up  = NULL;
+              temp            = vrna_exp_E_interior_loop(vc, k, l, p, q);
+              vc->domains_up  = ud_bak;
+              temp           *= probs[kl] * qb[pq];
+
+              q3 = 1.;
+              if(u2 > 0)
+                q3 += qql[q+1];
+
+              temp5           = temp * q3;
+              temp3           = temp * q5;
+
+              /* loop over all available motifs */
+              for(m = 0; m < domains_up->uniq_motif_count; m++){
+                u = domains_up->uniq_motif_size[m];
+                for(i = k + 1, j = k + u; j < p; i++, j++){ /* ud in 5' loop */
+                  exp_motif_en = qq_ud[m][i];
+                  uu1 = i - k - 1;
+                  uu2 = p - j - 1;
+                  qq1 = 1.;
+                  qq2 = 1.;
+                  if(uu1 > 0)
+                    qq1 += qqk[i - 1];
+                  if(uu2 > 0)
+                    qq2 += qqp[j + 1];
+
+                  outside = temp5 * qq1 * qq2 * exp_motif_en;
+                  pp_ud[m][i] += outside;
+                }
+
+                for(i = q + 1, j = q + u; j < l; i++, j++){ /* ud in 3' loop */
+                  exp_motif_en = qq_ud[m][i];
+                  uu1 = i - q - 1;
+                  uu2 = l - j - 1;
+                  qq1 = 1.;
+                  qq2 = 1.;
+                  if(uu1 > 0)
+                    qq1 += domains_up->exp_energy_cb( vc,
+                                                      q + 1, i - 1,
+                                                      VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                                      domains_up->data);
+                  if(uu2 > 0)
+                    qq2 += qql[j + 1];
+
+                  outside = temp3 * qq1 * qq2 * exp_motif_en;
+                  pp_ud[m][i] += outside;
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  free(hc_local);
+  free(qqk);
+  free(qql);
+  free(qqp);
+  for(k = 0; k < domains_up->uniq_motif_count; k++){
+    u = domains_up->uniq_motif_size[k];
+    /* actually store the results */
+    for(i = 1; i <= n - u + 1; i++){
+      if(pp_ud[k][i] > 0.)
+        domains_up->probs_add(vc,
+                              i, i + u - 1,
+                              VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                              pp_ud[k][i],
+                              domains_up->data);
+    }
+    free(qq_ud[k]);
+    free(pp_ud[k]);
+  }
+  free(qq_ud);
+  free(pp_ud);
+}
+
+PRIVATE INLINE void
+ud_outside_mb_loops(vrna_fold_compound_t *vc){
+
+
+  char              *hc, *ptype;
+  short             *S;
+  int               i, j, k, l, kl, jkl, *my_iindx, u, n, cnt, *motif_list,
+                    *hc_up, turn, tt, *jindx, *rtype, up, ud_max_size;
+  FLT_OR_DBL        *q1k, *qln, temp, *scale, outside, exp_motif_en, *probs,
+                    *qb, *qm, q1, q2, expMLclosing, *expMLbase, *qmli,
+                    exp_motif_ml_left, exp_motif_ml_right;
+  vrna_exp_param_t  *pf_params;
+  vrna_md_t         *md;
+  vrna_sc_t         *sc;
+  vrna_ud_t         *domains_up, *ud_bak;
+
+  n             = vc->length;
+  S             = vc->sequence_encoding;
+  my_iindx      = vc->iindx;
+  jindx         = vc->jindx;
+  ptype         = vc->ptype;
+  pf_params     = vc->exp_params;
+  md            = &(vc->exp_params->model_details);
+  q1k           = vc->exp_matrices->q1k;
+  qln           = vc->exp_matrices->qln;
+  qb            = vc->exp_matrices->qb;
+  qm            = vc->exp_matrices->qm;
+  probs         = vc->exp_matrices->probs;
+  scale         = vc->exp_matrices->scale;
+  hc_up         = vc->hc->up_ml;
+  hc            = vc->hc->matrix;
+  domains_up    = vc->domains_up;
+  sc            = vc->sc;
+  turn          = md->min_loop_size;
+  rtype         = &(md->rtype[0]);
+  expMLbase     = vc->exp_matrices->expMLbase;
+  expMLclosing  = pf_params->expMLclosing;
+
+  for(ud_max_size = u = 0; u < domains_up->uniq_motif_count; u++)
+    if(ud_max_size < domains_up->uniq_motif_size[u])
+      ud_max_size = domains_up->uniq_motif_size[u];
+
+  for(i = 1; i <= n; i++){
+    motif_list = vrna_ud_get_motif_size_at(vc, i, VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP);
+
+    /* 4. Multibranch loops */
+    if(motif_list){
+      cnt = 0;
+      while(-1 != (u = motif_list[cnt])){
+        outside = 0.;
+        j       = i + u - 1;
+        if(j < n){
+          if(hc_up[i] >= u){
+            exp_motif_en = domains_up->exp_energy_cb( vc,
+                                                      i, j,
+                                                      VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                                      domains_up->data);
+
+            exp_motif_en *= expMLbase[u];
+
+            if(sc){
+              if(sc->exp_energy_up)
+                exp_motif_en *= sc->exp_energy_up[i][u];
+            }
+
+            temp = 0;
+
+            /* 4.1 Motif [i:j] is somewhere in between branching stems */
+            for(l = j + turn + 1; l <= n; l++){
+              for(k = i - turn - 1; k > 0; k--){
+                kl = my_iindx[k] - l;
+                if(probs[kl] > 0.){
+                  jkl = jindx[l] + k;
+                  if(hc[jkl] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){ /* respect hard constraints */
+                    FLT_OR_DBL qqq;
+                    tt = ptype[jkl];
+                    tt = rtype[tt];
+                    qqq =   probs[kl]
+                          * qm[my_iindx[k+1] - (i - 1)]
+                          * qm[my_iindx[j+1] - (l - 1)]
+                          * exp_E_MLstem(tt, S[l-1], S[k+1], pf_params)
+                          * expMLclosing
+                          * scale[2];
+
+                    if(sc){
+                      if(sc->exp_energy_bp)
+                        qqq *= sc->exp_energy_bp[kl];
+                    }
+
+                    temp += qqq;
+                  }
+                }
+              }
+            }
+
+            outside +=    temp
+                        * exp_motif_en;
+
+            /* 4.2 Motif is in left-most unpaired stretch of multiloop */
+            FLT_OR_DBL **qm1ui = (FLT_OR_DBL **)vrna_alloc(sizeof(FLT_OR_DBL *) * (ud_max_size + 1));
+
+            for(l = 0; l <= ud_max_size; l++)
+              qm1ui[l] = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * (n + 2));
+
+            exp_motif_ml_left = 0.;
+            for(l = j + turn + 1; l <= n; l++){
+              FLT_OR_DBL lqq = 0.;
+              FLT_OR_DBL rqq = 0.;
+              for(k = i - 1; k > 0; k--){
+                up = i - k - 1;
+                kl = my_iindx[k] - l;
+                if((hc[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP) && (probs[kl] > 0.) && (hc_up[k+1] >= up)){
+                  tt = ptype[jindx[l] + k];
+                  tt = rtype[tt];
+                  temp =    probs[kl]
+                          * expMLbase[up]
+                          * exp_E_MLstem(tt, S[l-1], S[k+1], pf_params)
+                          * expMLclosing
+                          * scale[2];
+                  if(sc){
+                    if(sc->exp_energy_bp)
+                      temp *= sc->exp_energy_bp[kl];
+                    if(sc->exp_energy_up)
+                      temp *= sc->exp_energy_up[k+1][up];
+                  }
+
+                  lqq +=  temp;
+                  lqq +=    temp
+                          * domains_up->exp_energy_cb(vc,
+                                                      k + 1, i - 1,
+                                                      VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP,
+                                                      domains_up->data);
+                }
+              }
+
+              for(u = j + turn + 1; u < l - turn; u++){
+
+                /* 1st, l-1 is unpaired */
+                if(hc_up[l - 1]){
+                  temp = qm1ui[1][u] * expMLbase[1];
+                  if(sc){
+                    if(sc->exp_energy_up)
+                      temp *= sc->exp_energy_up[l - 1][1];
+                  }
+                  qm1ui[0][u] = temp;
+                } else {
+                  qm1ui[0][u] = 0.;
+                }
+
+                /* 2nd, l-1 is the final position of another motif [p:l-1] */
+                for(cnt = 0; cnt < domains_up->uniq_motif_count; cnt++){
+                  int size = domains_up->uniq_motif_size[cnt];
+                  if((u < l - size) && (hc_up[l - size] >= size)){
+                    temp  =   qm1ui[size][u]
+                            * expMLbase[size]
+                            * domains_up->exp_energy_cb(vc,
+                                                        l - size, l - 1,
+                                                        VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                                        domains_up->data);
+                    if(sc){
+                      if(sc->exp_energy_up)
+                        temp *= sc->exp_energy_up[l - size][size];
+                    }
+                    qm1ui[0][u] += temp;
+                  }
+                }
+
+                /* 3rd, l - 1 pairs with u */
+                if(hc[jindx[l - 1] + u] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC){
+                  tt    = ptype[jindx[l - 1] + u];
+                  temp  =   qb[my_iindx[u] - (l - 1)]
+                          * exp_E_MLstem(tt, S[u - 1], S[l], pf_params);
+
+                  qm1ui[0][u] += temp;
+                }
+
+                rqq += qm[my_iindx[j+1] - (u - 1)] * qm1ui[0][u];
+              }
+
+              /* finally, compose contribution */
+              exp_motif_ml_left += lqq * rqq;
+
+              /* rotate auxiliary arrays */
+              FLT_OR_DBL *tmp = qm1ui[ud_max_size];
+              for(cnt = ud_max_size; cnt > 0; cnt--)
+                qm1ui[cnt] = qm1ui[cnt - 1];
+              qm1ui[0] = tmp;
+            }
+
+            /* cleanup memory */
+            for(l = 0; l <= ud_max_size; l++)
+              free(qm1ui[l]);
+            free(qm1ui);
+
+            outside +=    exp_motif_ml_left
+                        * exp_motif_en;
+
+            /* 4.3 Motif is in right-most unpaired stretch of multiloop */
+            qmli = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * n);
+            exp_motif_ml_right = 0.;
+            for(k = i - turn - 1; k > 0; k--){
+              FLT_OR_DBL lqq = 0.;
+              FLT_OR_DBL rqq = 0;
+
+              /* update qmli[k] = qm1[k,i-1] */
+              for(qmli[k] = 0., u = k + turn + 1; u < i; u++){
+                /* respect hard constraints */
+                if(hc[jindx[u] + k] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC){
+                  up = (i - 1) - (u + 1) + 1;
+                  if(hc_up[u+1] >= up){
+                    temp =    qb[my_iindx[k] - u]
+                            * expMLbase[up];
+
+                    /* add soft constraints */
+                    if(sc){
+                      if(sc->exp_energy_up)
+                        temp *= sc->exp_energy_up[u+1][up];
+                    }
+                    qmli[k] += temp;
+
+                    /* add contributions of other motifs within [u+1:i-1] */
+                    qmli[k] +=    temp
+                                * domains_up->exp_energy_cb(vc,
+                                                            u+1, i-1,
+                                                            VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP,
+                                                            domains_up->data);
+                  }
+                }
+              }
+
+              for(u = k + turn; u < i - turn; u++){
+                lqq +=    qm[my_iindx[k+1] - (u - 1)]
+                        * qmli[u];
+              }
+
+              for(l = j + 1; l <= n; l++){
+                kl = my_iindx[k] - l;
+                if(hc[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+                  int up;
+                  tt = ptype[jindx[l] + k];
+                  tt = rtype[tt];
+                  up = l - j - 1;
+                  if(hc_up[j + 1] >= up){
+                    temp =    probs[kl]
+                            * exp_E_MLstem(tt, S[l-1], S[k+1], pf_params)
+                            * expMLclosing
+                            * scale[2]
+                            * expMLbase[up];
+
+                    if(sc){
+                      if(sc->exp_energy_bp)
+                        temp *= sc->exp_energy_bp[kl];
+                      if(sc->exp_energy_up)
+                        temp *= sc->exp_energy_up[j+1][up];
+                    }
+
+                    rqq += temp;
+
+                    /* add contributions of other motifs within [j+1:l-1] */
+                    rqq  +=   temp
+                            * domains_up->exp_energy_cb(vc,
+                                                        j+1, l-1,
+                                                        VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP,
+                                                        domains_up->data);
+                  }
+                }
+              }
+              exp_motif_ml_right += rqq * lqq;
+            }
+            free(qmli);
+            qmli = NULL;
+
+            outside +=    exp_motif_ml_right
+                        * exp_motif_en;
+          }
+        }
+
+        if(outside > 0.)
+          domains_up->probs_add(vc,
+                                i, j,
+                                VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                outside,
+                                domains_up->data);
+
+        cnt++;
+      }
+    }
+    free(motif_list);
+  }
+
+}
+
+PRIVATE INLINE void
+ud_outside_mb_loops2(vrna_fold_compound_t *vc){
+
+
+  char              *hc, *ptype, *hc_local;
+  short             *S;
+  int               i, j, k, l, kl, jkl, *my_iindx, u, n, cnt, *motif_list,
+                    *hc_up, turn, tt, *jindx, *rtype, up, ud_max_size;
+  FLT_OR_DBL        *q1k, *qln, temp, *scale, outside, exp_motif_en, *probs,
+                    *qb, *qm, q1, q2, expMLclosing, *expMLbase, *qmli,
+                    exp_motif_ml_left, exp_motif_ml_right, *qqi, *qqj,
+                    *qqmi, *qqmj;
+  vrna_exp_param_t  *pf_params;
+  vrna_md_t         *md;
+  vrna_sc_t         *sc;
+  vrna_ud_t         *domains_up, *ud_bak;
+
+  n             = vc->length;
+  S             = vc->sequence_encoding;
+  my_iindx      = vc->iindx;
+  jindx         = vc->jindx;
+  ptype         = vc->ptype;
+  pf_params     = vc->exp_params;
+  md            = &(vc->exp_params->model_details);
+  q1k           = vc->exp_matrices->q1k;
+  qln           = vc->exp_matrices->qln;
+  qb            = vc->exp_matrices->qb;
+  qm            = vc->exp_matrices->qm;
+  probs         = vc->exp_matrices->probs;
+  scale         = vc->exp_matrices->scale;
+  hc_up         = vc->hc->up_ml;
+  hc            = vc->hc->matrix;
+  domains_up    = vc->domains_up;
+  sc            = vc->sc;
+  turn          = md->min_loop_size;
+  rtype         = &(md->rtype[0]);
+  expMLbase     = vc->exp_matrices->expMLbase;
+  expMLclosing  = pf_params->expMLclosing;
+
+  hc_local = (char *)vrna_alloc(sizeof(char) * (((n + 1) * (n + 2)) /2 + 2));
+  for(i = 1; i <= n; i++)
+    for(j = i; j <= n; j++)
+      hc_local[my_iindx[i] - j] = hc[jindx[j] + i];
+
+  for(ud_max_size = u = 0; u < domains_up->uniq_motif_count; u++)
+    if(ud_max_size < domains_up->uniq_motif_size[u])
+      ud_max_size = domains_up->uniq_motif_size[u];
+
+  qqi = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+  qqj = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+  qqmi = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+  qqmj = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 1));
+
+  for(i = 1; i <= n; i++){
+    motif_list = vrna_ud_get_motif_size_at(vc, i, VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP);
+
+    /* 4. Multibranch loops */
+    if(motif_list){
+      cnt = 0;
+      while(-1 != (u = motif_list[cnt])){
+        outside = 0.;
+        j       = i + u - 1;
+        if(j < n){
+          if(hc_up[i] >= u){
+            exp_motif_en = domains_up->exp_energy_cb( vc,
+                                                      i, j,
+                                                      VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                                      domains_up->data);
+            for(k = 1; k < i; k++){
+              qqi[k] = domains_up->exp_energy_cb( vc,
+                                                  k, i - 1,
+                                                  VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP,
+                                                  domains_up->data);
+              qqmi[k] = qm[my_iindx[k] - (i - 1)];
+            }
+            for(l = j + 1; l <= n; l++){
+              qqj[l] = domains_up->exp_energy_cb( vc,
+                                                  j + 1, l,
+                                                  VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP,
+                                                  domains_up->data);
+              qqmj[k] = qm[my_iindx[j + 1] - l];
+            }
+            exp_motif_en *= expMLbase[u];
+
+            if(sc){
+              if(sc->exp_energy_up)
+                exp_motif_en *= sc->exp_energy_up[i][u];
+            }
+
+            temp = 0;
+
+            /* 4.1 Motif [i:j] is somewhere in between branching stems */
+            for(l = j + turn + 1; l <= n; l++){
+              for(k = i - turn - 1; k > 0; k--){
+                kl = my_iindx[k] - l;
+                if(probs[kl] > 0.){
+                  jkl = jindx[l] + k;
+                  if(hc_local[kl] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){ /* respect hard constraints */
+                    FLT_OR_DBL qqq;
+                    tt = ptype[jkl];
+                    tt = rtype[tt];
+                    qqq =   probs[kl]
+                          * qqmi[k + 1]
+                          * qqmj[l - 1]
+                          * exp_E_MLstem(tt, S[l-1], S[k+1], pf_params)
+                          * expMLclosing
+                          * scale[2];
+
+                    if(sc){
+                      if(sc->exp_energy_bp)
+                        qqq *= sc->exp_energy_bp[kl];
+                    }
+
+                    temp += qqq;
+                  }
+                }
+              }
+            }
+
+            outside +=    temp
+                        * exp_motif_en;
+
+            /* 4.2 Motif is in left-most unpaired stretch of multiloop */
+            FLT_OR_DBL **qm1ui = (FLT_OR_DBL **)vrna_alloc(sizeof(FLT_OR_DBL *) * (ud_max_size + 1));
+
+            for(l = 0; l <= ud_max_size; l++)
+              qm1ui[l] = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * (n + 2));
+
+            exp_motif_ml_left = 0.;
+            for(l = j + turn + 1; l <= n; l++){
+              FLT_OR_DBL lqq = 0.;
+              FLT_OR_DBL rqq = 0.;
+              for(k = i - 1; k > 0; k--){
+                up = i - k - 1;
+                kl = my_iindx[k] - l;
+                if((hc_local[kl] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP) && (probs[kl] > 0.) && (hc_up[k+1] >= up)){
+                  tt = ptype[jindx[l] + k];
+                  tt = rtype[tt];
+                  temp =    probs[kl]
+                          * expMLbase[up]
+                          * exp_E_MLstem(tt, S[l-1], S[k+1], pf_params)
+                          * expMLclosing
+                          * scale[2];
+                  if(sc){
+                    if(sc->exp_energy_bp)
+                      temp *= sc->exp_energy_bp[kl];
+                    if(sc->exp_energy_up)
+                      temp *= sc->exp_energy_up[k+1][up];
+                  }
+
+                  lqq +=  temp;
+                  lqq +=    temp
+                          * qqi[k+1];
+                }
+              }
+
+              for(u = j + turn + 1; u < l - turn; u++){
+
+                /* 1st, l-1 is unpaired */
+                if(hc_up[l - 1]){
+                  temp = qm1ui[1][u] * expMLbase[1];
+                  if(sc){
+                    if(sc->exp_energy_up)
+                      temp *= sc->exp_energy_up[l - 1][1];
+                  }
+                  qm1ui[0][u] = temp;
+                } else {
+                  qm1ui[0][u] = 0.;
+                }
+
+                /* 2nd, l-1 is the final position of another motif [p:l-1] */
+                for(cnt = 0; cnt < domains_up->uniq_motif_count; cnt++){
+                  int size = domains_up->uniq_motif_size[cnt];
+                  if((u < l - size) && (hc_up[l - size] >= size)){
+                    temp  =   qm1ui[size][u]
+                            * expMLbase[size]
+                            * domains_up->exp_energy_cb(vc,
+                                                        l - size, l - 1,
+                                                        VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                                        domains_up->data);
+                    if(sc){
+                      if(sc->exp_energy_up)
+                        temp *= sc->exp_energy_up[l - size][size];
+                    }
+                    qm1ui[0][u] += temp;
+                  }
+                }
+
+                /* 3rd, l - 1 pairs with u */
+                int ul = my_iindx[u] - (l - 1);
+                if(hc_local[ul] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC){
+                  tt    = ptype[jindx[l - 1] + u];
+                  temp  =   qb[ul]
+                          * exp_E_MLstem(tt, S[u - 1], S[l], pf_params);
+
+                  qm1ui[0][u] += temp;
+                }
+
+                rqq += qqmj[u - 1] * qm1ui[0][u];
+              }
+
+              /* finally, compose contribution */
+              exp_motif_ml_left += lqq * rqq;
+
+              /* rotate auxiliary arrays */
+              FLT_OR_DBL *tmp = qm1ui[ud_max_size];
+              for(cnt = ud_max_size; cnt > 0; cnt--)
+                qm1ui[cnt] = qm1ui[cnt - 1];
+              qm1ui[0] = tmp;
+            }
+
+            /* cleanup memory */
+            for(l = 0; l <= ud_max_size; l++)
+              free(qm1ui[l]);
+            free(qm1ui);
+
+            outside +=    exp_motif_ml_left
+                        * exp_motif_en;
+
+            /* 4.3 Motif is in right-most unpaired stretch of multiloop */
+            qmli = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * n);
+            exp_motif_ml_right = 0.;
+            for(k = i - turn - 1; k > 0; k--){
+              FLT_OR_DBL lqq = 0.;
+              FLT_OR_DBL rqq = 0;
+
+              /* update qmli[k] = qm1[k,i-1] */
+              for(qmli[k] = 0., u = k + turn + 1; u < i; u++){
+                int ku = my_iindx[k] - u;
+                /* respect hard constraints */
+                if(hc_local[ku] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC){
+                  up = (i - 1) - (u + 1) + 1;
+                  if(hc_up[u+1] >= up){
+                    temp =    qb[ku]
+                            * expMLbase[up];
+
+                    /* add soft constraints */
+                    if(sc){
+                      if(sc->exp_energy_up)
+                        temp *= sc->exp_energy_up[u+1][up];
+                    }
+                    qmli[k] += temp;
+
+                    /* add contributions of other motifs within [u+1:i-1] */
+                    qmli[k] +=    temp
+                                * qqi[u + 1];
+                  }
+                }
+              }
+
+              for(u = k + turn; u < i - turn; u++){
+                lqq +=    qm[my_iindx[k+1] - (u - 1)]
+                        * qmli[u];
+              }
+
+              for(l = j + 1; l <= n; l++){
+                kl = my_iindx[k] - l;
+                if(hc_local[kl] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+                  int up;
+                  tt = ptype[jindx[l] + k];
+                  tt = rtype[tt];
+                  up = l - j - 1;
+                  if(hc_up[j + 1] >= up){
+                    temp =    probs[kl]
+                            * exp_E_MLstem(tt, S[l-1], S[k+1], pf_params)
+                            * expMLclosing
+                            * scale[2]
+                            * expMLbase[up];
+
+                    if(sc){
+                      if(sc->exp_energy_bp)
+                        temp *= sc->exp_energy_bp[kl];
+                      if(sc->exp_energy_up)
+                        temp *= sc->exp_energy_up[j+1][up];
+                    }
+
+                    rqq += temp;
+
+                    /* add contributions of other motifs within [j+1:l-1] */
+                    rqq  +=   temp
+                            * qqj[l - 1];
+                  }
+                }
+              }
+              exp_motif_ml_right += rqq * lqq;
+            }
+            free(qmli);
+            qmli = NULL;
+
+            outside +=    exp_motif_ml_right
+                        * exp_motif_en;
+          }
+        }
+
+        if(outside > 0.)
+          domains_up->probs_add(vc,
+                                i, j,
+                                VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                outside,
+                                domains_up->data);
+
+        cnt++;
+      }
+    }
+    free(motif_list);
+  }
+
+  free(qqi);
+  free(qqj);
+  free(qqmi);
+  free(qqmj);
+  free(hc_local);
+}
+
+
+PRIVATE FLT_OR_DBL
+numerator_single( vrna_fold_compound_t *vc,
+                  int i,
+                  int j){
+
+  return 1.;
+}
+
+PRIVATE FLT_OR_DBL
+numerator_comparative(vrna_fold_compound_t *vc,
+                      int i,
+                      int j){
+
+  int     *pscore = vc->pscore;             /* precomputed array of pair types */                      
+  double  kTn     = vc->exp_params->kT/10.; /* kT in cal/mol  */
+  int     *jindx  = vc->jindx;
+
+  return exp(pscore[jindx[j]+i]/kTn);
+}
+
+/* calculate base pairing probs */
+PRIVATE INLINE void
+bppm_circ(vrna_fold_compound_t *vc){
+
+  unsigned char     type;
+  char              *ptype, *sequence;
+  char              *hard_constraints;
+  short             *S, *S1;
+  int               n, i,j,k,l, ij, *rtype, *my_iindx, *jindx, turn;
+  FLT_OR_DBL        tmp2, expMLclosing, *qb, *qm, *qm1, *probs, *scale, *expMLbase, qo;
+  vrna_hc_t         *hc;
+  vrna_exp_param_t  *pf_params;
+  vrna_mx_pf_t      *matrices;
+  vrna_md_t         *md;
+  FLT_OR_DBL (*numerator_f)(vrna_fold_compound_t *vc, int i, int j);
+
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  S                 = vc->sequence_encoding2;
+  S1                = vc->sequence_encoding;
+  my_iindx          = vc->iindx;
+  jindx             = vc->jindx;
+  ptype             = vc->ptype;
+  turn              = md->min_loop_size;
+  hc                = vc->hc;
+  matrices          = vc->exp_matrices;
+  qb                = matrices->qb;
+  qm                = matrices->qm;
+  qm1               = matrices->qm1;
+  probs             = matrices->probs;
+  scale             = matrices->scale;
+  expMLbase         = matrices->expMLbase;
+  qo                = matrices->qo;
+  hard_constraints  = hc->matrix;
+  sequence          = vc->sequence;
+
+
+  expMLclosing  = pf_params->expMLclosing;
+  rtype         = &(pf_params->model_details.rtype[0]);
+  n             = S[0];
+
+  switch(vc->type){
+    case  VRNA_FC_TYPE_SINGLE:    numerator_f = numerator_single;
+                                  break;
+    case  VRNA_FC_TYPE_COMPARATIVE: numerator_f = numerator_comparative;
+                                  break;
+    default:                      numerator_f = NULL;
+                                  break;
+  }
+
+  /*
+    The hc_local array provides row-wise access to hc->matrix, i.e.
+    my_iindx. Using this in the cubic order loop for multiloops below
+    results in way faster computation due to fewer cache misses. Also,
+    it introduces only little memory overhead, e.g. ~450MB for
+    sequences of length 30,000
+  */
+  char *hc_local = (char *)vrna_alloc(sizeof(char) * (((n + 1) * (n + 2)) /2 + 2));
+  for(i = 1; i <= n; i++)
+    for(j = i; j <= n; j++)
+      hc_local[my_iindx[i] - j] = hard_constraints[jindx[j] + i];
+
+  /* 1. exterior pair i,j */
+  for (i=1; i<=n; i++) {
+    for (j=i; j<=MIN2(i+turn,n); j++)
+      probs[my_iindx[i]-j] = 0;
+    for (j=i+turn+1; j<=n; j++) {
+      ij = my_iindx[i]-j;
+      if(qb[ij] > 0.){
+        probs[ij] = numerator_f(vc, i, j)/qo;
+
+        type = (unsigned char)ptype[jindx[j] + i];
+
+        unsigned char rt = rtype[type];
+
+        /* 1.1. Exterior Hairpin Contribution */
+        tmp2 = vrna_exp_E_hp_loop(vc, j, i);
+
+        /* 1.2. Exterior Interior Loop Contribution                     */
+        /* 1.2.1. i,j  delimtis the "left" part of the interior loop    */
+        /* (j,i) is "outer pair"                                        */
+        for(k=1; k < i-turn-1; k++){
+          int ln1, lstart;
+          ln1 = k + n - j - 1;
+          if(ln1>MAXLOOP) break;
+          lstart = ln1+i-1-MAXLOOP;
+          if(lstart<k+turn+1) lstart = k + turn + 1;
+          for(l=lstart; l < i; l++){
+            int ln2, type_2;
+            type_2 = (unsigned char)ptype[jindx[l] + k];
+            if (type_2==0) continue;
+            ln2 = i - l - 1;
+            if(ln1+ln2>MAXLOOP) continue;
+            tmp2 += qb[my_iindx[k] - l]
+                    * exp_E_IntLoop(ln1,
+                                    ln2,
+                                    rt,
+                                    rtype[type_2],
+                                    S1[j+1],
+                                    S1[i-1],
+                                    S1[k-1],
+                                    S1[l+1],
+                                    pf_params)
+                    * scale[ln1 + ln2];
+          }
+        }
+        /* 1.2.2. i,j  delimtis the "right" part of the interior loop  */
+        for(k=j+1; k < n-turn; k++){
+          int ln1, lstart;
+          ln1 = k - j - 1;
+          if((ln1 + i - 1)>MAXLOOP) break;
+          lstart = ln1+i-1+n-MAXLOOP;
+          if(lstart<k+turn+1) lstart = k + turn + 1;
+          for(l=lstart; l <= n; l++){
+            int ln2, type_2;
+            type_2 = (unsigned char)ptype[jindx[l] + k];
+            if (type_2==0) continue;
+            ln2 = i - 1 + n - l;
+            if(ln1+ln2>MAXLOOP) continue;
+            tmp2 += qb[my_iindx[k] - l]
+                    * exp_E_IntLoop(ln2,
+                                    ln1,
+                                    rtype[type_2],
+                                    rt,
+                                    S1[l+1],
+                                    S1[k-1],
+                                    S1[i-1],
+                                    S1[j+1],
+                                    pf_params)
+                    * scale[ln1 + ln2];
+          }
+        }
+        /* 1.3 Exterior multiloop decomposition */
+        /* 1.3.1 Middle part                    */
+        if((i>turn+2) && (j<n-turn-1))
+          tmp2 += qm[my_iindx[1]-i+1]
+                  * qm[my_iindx[j+1]-n]
+                  * expMLclosing
+                  * exp_E_MLstem(type, S1[i-1], S1[j+1], pf_params);
+
+        /* 1.3.2 Left part  */
+        for(k=turn+2; k < i-turn-2; k++)
+          tmp2 += qm[my_iindx[1]-k]
+                  * qm1[jindx[i-1]+k+1]
+                  * expMLbase[n-j]
+                  * expMLclosing
+                  * exp_E_MLstem(type, S1[i-1], S1[j+1], pf_params);
+
+        /* 1.3.3 Right part */
+        for(k=j+turn+2; k < n-turn-1;k++)
+          tmp2 += qm[my_iindx[j+1]-k]
+                  * qm1[jindx[n]+k+1]
+                  * expMLbase[i-1]
+                  * expMLclosing
+                  * exp_E_MLstem(type, S1[i-1], S1[j+1], pf_params);
+
+        /* all exterior loop decompositions for pair i,j done  */
+        probs[ij] *= tmp2;
+
+      }
+      else probs[ij] = 0;
+    }
+  }
+}
+
+
+
+PRIVATE double
+wrap_mean_bp_distance(FLT_OR_DBL *p,
+                      int length,
+                      int *index,
+                      int turn){
+
+  int         i,j;
+  double      d = 0.;
+
+  /* compute the mean base pair distance in the thermodynamic ensemble */
+  /* <d> = \sum_{a,b} p_a p_b d(S_a,S_b)
+     this can be computed from the pair probs p_ij as
+     <d> = \sum_{ij} p_{ij}(1-p_{ij}) */
+
+  for (i=1; i<=length; i++)
+    for (j=i+turn+1; j<=length; j++)
+      d += p[index[i]-j] * (1-p[index[i]-j]);
+
+  return 2*d;
+}
+
+
+PUBLIC double
+vrna_mean_bp_distance_pr( int length,
+                          FLT_OR_DBL *p){
+
+  int *index = vrna_idx_row_wise((unsigned int) length);
+  double d;
+
+  if (p==NULL)
+    vrna_message_error("vrna_mean_bp_distance_pr: p==NULL. You need to supply a valid probability matrix");
+
+  d = wrap_mean_bp_distance(p, length, index, TURN);
+
+  free(index);
+  return d;
+}
+
+PUBLIC double
+vrna_mean_bp_distance(vrna_fold_compound_t *vc){
+
+  if(!vc){
+    vrna_message_error("vrna_mean_bp_distance: run vrna_pf_fold first!");
+  } else if(!vc->exp_matrices){
+    vrna_message_error("vrna_mean_bp_distance: exp_matrices==NULL!");
+  } else if( !vc->exp_matrices->probs){
+    vrna_message_error("vrna_mean_bp_distance: probs==NULL!");
+  }
+
+  return wrap_mean_bp_distance( vc->exp_matrices->probs,
+                                vc->length,
+                                vc->iindx,
+                                vc->exp_params->model_details.min_loop_size);
+}
+
+PUBLIC vrna_plist_t *
+vrna_stack_prob(vrna_fold_compound_t *vc, double cutoff){
+
+  vrna_plist_t             *pl;
+  int               i, j, plsize, turn, length, *index, *jindx, *rtype, num;
+  char              *ptype;
+  FLT_OR_DBL        *qb, *probs, *scale, p;
+  vrna_exp_param_t  *pf_params;
+  vrna_mx_pf_t      *matrices;
+
+  plsize  = 256;
+  pl      = NULL;
+  num     = 0;
+
+  if(vc){
+    pf_params = vc->exp_params;
+    length    = vc->length;
+    index     = vc->iindx;
+    jindx     = vc->jindx;
+    rtype     = &(pf_params->model_details.rtype[0]);
+    ptype     = vc->ptype;
+    matrices  = vc->exp_matrices;
+    qb        = matrices->qb;
+    probs     = matrices->probs;
+    scale     = matrices->scale;
+    turn      = pf_params->model_details.min_loop_size;
+
+    pl        = (vrna_plist_t *) vrna_alloc(plsize*sizeof(vrna_plist_t));
+
+    for (i=1; i<length; i++)
+      for (j=i+turn+3; j<=length; j++) {
+        if((p=probs[index[i]-j]) < cutoff) continue;
+        if (qb[index[i+1]-(j-1)]<FLT_MIN) continue;
+        p *= qb[index[i+1]-(j-1)]/qb[index[i]-j];
+        p *= exp_E_IntLoop(0,0,(unsigned char)ptype[jindx[j]+i],rtype[(unsigned char)ptype[jindx[j-1] + i+1]],
+                           0,0,0,0, pf_params)*scale[2];/* add *scale[u1+u2+2] */
+        if (p>cutoff) {
+          pl[num].i     = i;
+          pl[num].j     = j;
+          pl[num].type  = 0;
+          pl[num++].p   = p;
+          if (num>=plsize) {
+            plsize *= 2;
+            pl = vrna_realloc(pl, plsize*sizeof(vrna_plist_t));
+          }
+        }
+      }
+    pl[num].i=0;
+  }
+
+  return pl;
+}
+
+
+PRIVATE void
+alipf_create_bppm(vrna_fold_compound_t *vc,
+                  char *structure){
+
+  int s;
+  int i,j,k,l, ij, kl, ii, ll, tt, *type, ov=0;
+  FLT_OR_DBL temp, prm_MLb;
+#ifdef USE_FLOAT_PF
+  FLT_OR_DBL Qmax=0.;
+#endif
+  FLT_OR_DBL prmt,prmt1;
+  FLT_OR_DBL qbt1, *tmp, tmp2, tmp3;
+
+  int             n_seq         = vc->n_seq;
+  int             n             = vc->length;
+
+
+  short             **S           = vc->S;                                                                   
+  short             **S5          = vc->S5;     /*S5[s][i] holds next base 5' of i in sequence s*/            
+  short             **S3          = vc->S3;     /*Sl[s][i] holds next base 3' of i in sequence s*/            
+  char              **Ss          = vc->Ss;
+  unsigned short    **a2s         = vc->a2s;                                                                   
+  vrna_exp_param_t  *pf_params    = vc->exp_params;
+  vrna_mx_pf_t      *matrices     = vc->exp_matrices;
+  vrna_md_t         *md           = &(pf_params->model_details);
+  vrna_hc_t         *hc           = vc->hc;
+  vrna_sc_t         **sc          = vc->scs;
+  int               *my_iindx     = vc->iindx;
+  int               *jindx        = vc->jindx;
+  FLT_OR_DBL        *q            = matrices->q;
+  FLT_OR_DBL        *qb           = matrices->qb;
+  FLT_OR_DBL        *qm           = matrices->qm;
+  FLT_OR_DBL        *qm1          = matrices->qm1;
+  FLT_OR_DBL        qo            = matrices->qo;
+  int               *pscore       = vc->pscore;     /* precomputed array of pair types */                      
+  int               *rtype        = &(md->rtype[0]);
+  int               circular      = md->circ;
+  FLT_OR_DBL        *scale        = matrices->scale;
+  FLT_OR_DBL        *expMLbase    = matrices->expMLbase;
+  FLT_OR_DBL        expMLclosing  = pf_params->expMLclosing;
+  FLT_OR_DBL        *probs        = matrices->probs;
+  char              *hard_constraints = hc->matrix;
+
+  double kTn;
+  FLT_OR_DBL pp;
+
+  FLT_OR_DBL *prm_l   = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+  FLT_OR_DBL *prm_l1  = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+  FLT_OR_DBL *prml    = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+  type                = (int *)vrna_alloc(sizeof(int) * n_seq);
+
+  if((matrices->q1k == NULL) || (matrices->qln == NULL)){
+    free(matrices->q1k);
+    matrices->q1k = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+1));
+    free(matrices->qln);
+    matrices->qln = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+  }
+
+  FLT_OR_DBL *q1k    = matrices->q1k;
+  FLT_OR_DBL *qln    = matrices->qln;
+
+  for (k=1; k<=n; k++) {
+    q1k[k] = q[my_iindx[1] - k];
+    qln[k] = q[my_iindx[k] - n];
+  }
+  q1k[0] = 1.0;
+  qln[n+1] = 1.0;
+
+
+  kTn = pf_params->kT/10.;   /* kT in cal/mol  */
+
+  for (i=0; i<=n; i++)
+    prm_l[i]=prm_l1[i]=prml[i]=0;
+
+  /* 1. exterior pair i,j and initialization of pr array */
+  if(circular){
+    for (i=1; i<=n; i++) {
+      for (j=i; j<=MIN2(i+TURN,n); j++) probs[my_iindx[i]-j] = 0;
+      for (j=i+TURN+1; j<=n; j++) {
+        ij = my_iindx[i]-j;
+        if (qb[ij]>0.) {
+          probs[ij] =  exp(pscore[jindx[j]+i]/kTn)/qo;
+
+          /* get pair types  */
+          for (s=0; s<n_seq; s++) {
+            type[s] = md->pair[S[s][j]][S[s][i]];
+            if (type[s]==0) type[s]=7;
+          }
+
+          tmp2 = 0.;
+
+          /* 1.1. Exterior Hairpin Contribution */
+          tmp2 += vrna_exp_E_hp_loop(vc, j, i);
+
+          /* 1.2. Exterior Interior Loop Contribution */
+          /* recycling of k and l... */
+          if(hard_constraints[jindx[j] + i] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){
+
+            /* 1.2.1. first we calc exterior loop energy with constraint, that i,j  */
+            /* delimtis the "right" part of the interior loop                       */
+            /* (l,k) is "outer pair"                                                */
+            for(k=1; k < i-TURN-1; k++){
+              /* so first, lets calc the length of loop between j and k */
+              int ln1, lstart;
+              ln1 = k + n - j - 1;
+              if(ln1>MAXLOOP)
+                break;
+              if(hc->up_int[j+1] < ln1)
+                break;
+
+              lstart = ln1+i-1-MAXLOOP;
+              if(lstart<k+TURN+1) lstart = k + TURN + 1;
+              for(l=lstart; l < i; l++){
+                int ln2,ln2a,ln1a, type_2;
+                ln2 = i - l - 1;
+                if(ln1+ln2>MAXLOOP)
+                  continue;
+                if(hc->up_int[l+1] < ln2)
+                  continue;
+                if(!(hard_constraints[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP))
+                  continue;
+                
+                FLT_OR_DBL qloop=1.;
+                if(qb[my_iindx[k]-l]==0.){
+                  qloop=0.;
+                  continue;
+                }
+
+                for (s=0; s<n_seq; s++){
+                  ln2a= a2s[s][i-1];
+                  ln2a-=a2s[s][l];
+                  ln1a= a2s[s][n]-a2s[s][j];
+                  ln1a+=a2s[s][k-1];
+                  type_2 = md->pair[S[s][l]][S[s][k]];
+                  if (type_2 == 0) type_2 = 7;
+                  qloop *= exp_E_IntLoop(ln1a, ln2a, type[s], type_2,
+                              S[s][j+1],
+                              S[s][i-1],
+                              S[s][(k>1) ? k-1 : n],
+                              S[s][l+1], pf_params);
+                }
+                if(sc)
+                  for(s = 0; s < n_seq; s++){
+                    if(sc[s]){
+                      ln2a= a2s[s][i-1];
+                      ln2a-=a2s[s][l];
+                      ln1a= a2s[s][n]-a2s[s][j];
+                      ln1a+=a2s[s][k-1];
+
+                      if(sc[s]->exp_energy_up)
+                        qloop *=    sc[s]->exp_energy_up[a2s[s][l]+1][ln2a]
+                                  * ((j < n) ? sc[s]->exp_energy_up[a2s[s][j]+1][a2s[s][n] - a2s[s][j]] : 1.)
+                                  * ((k > 1) ? sc[s]->exp_energy_up[1][a2s[s][k]-1] : 1.);
+
+                      if((ln1a + ln2a == 0) && sc[s]->exp_energy_stack){
+                        if(S[s][i] && S[s][j] && S[s][k] && S[s][l]){ /* don't allow gaps in stack */
+                          qloop *=    sc[s]->exp_energy_stack[a2s[s][k]]
+                                    * sc[s]->exp_energy_stack[a2s[s][l]]
+                                    * sc[s]->exp_energy_stack[a2s[s][i]]
+                                    * sc[s]->exp_energy_stack[a2s[s][j]];
+                        }
+                      }
+                    }
+                  }
+                tmp2 += qb[my_iindx[k] - l] * qloop * scale[ln1+ln2];
+              }
+            }
+
+            /* 1.2.2. second we calc exterior loop energy with constraint, that i,j */
+            /* delimtis the "left" part of the interior loop                        */
+            /* (j,i) is "outer pair"                                                */
+            for(k=j+1; k < n-TURN; k++){
+              /* so first, lets calc the length of loop between l and i */
+              int ln1, lstart;
+              ln1 = k - j - 1;
+              if((ln1 + i - 1)>MAXLOOP)
+                break;
+              if(hc->up_int[j+1] < ln1)
+                break;
+
+              lstart = ln1+i-1+n-MAXLOOP;
+              if(lstart<k+TURN+1) lstart = k + TURN + 1;
+              for(l=lstart; l <= n; l++){
+                int ln2, type_2;
+                ln2 = i - 1 + n - l;
+                if(ln1+ln2>MAXLOOP)
+                  continue;
+                if(hc->up_int[l+1] < ln2)
+                  continue;
+                if(!(hard_constraints[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP))
+                  continue;
+
+                FLT_OR_DBL qloop=1.;
+                if(qb[my_iindx[k]-l]==0.){
+                  qloop=0.;
+                  continue;
+                }
+
+                for (s=0; s<n_seq; s++){
+                  ln1 = a2s[s][k] - a2s[s][j+1];
+                  ln2 = a2s[s][i-1] + a2s[s][n] - a2s[s][l];
+                  type_2 = md->pair[S[s][l]][S[s][k]];
+                  if (type_2 == 0) type_2 = 7;
+                  qloop *= exp_E_IntLoop(ln2, ln1, type_2, type[s],
+                          S3[s][l],
+                          S5[s][k],
+                          S5[s][i],
+                          S3[s][j], pf_params);
+                }
+                if(sc)
+                  for(s = 0; s < n_seq; s++){
+                    if(sc[s]){
+                      ln1 = a2s[s][k] - a2s[s][j+1];
+                      ln2 = a2s[s][i-1] + a2s[s][n] - a2s[s][l];
+
+                      if(sc[s]->exp_energy_up)
+                        qloop *=    sc[s]->exp_energy_up[a2s[s][j]+1][ln1]
+                                  * ((l < n) ? sc[s]->exp_energy_up[a2s[s][l]+1][a2s[s][n] - a2s[s][l]] : 1.)
+                                  * ((i > 1) ? sc[s]->exp_energy_up[1][a2s[s][i]-1] : 1.);
+
+                      if((ln1 + ln2 == 0) && sc[s]->exp_energy_stack){
+                        if(S[s][i] && S[s][j] && S[s][k] && S[s][l]){ /* don't allow gaps in stack */
+                          qloop *=    sc[s]->exp_energy_stack[a2s[s][k]]
+                                    * sc[s]->exp_energy_stack[a2s[s][l]]
+                                    * sc[s]->exp_energy_stack[a2s[s][i]]
+                                    * sc[s]->exp_energy_stack[a2s[s][j]];
+                        }
+                      }
+                    }
+                  }
+                tmp2 += qb[my_iindx[k] - l] * qloop * scale[ln1+ln2];
+              }
+            }
+          }
+          /* 1.3 Exterior multiloop decomposition */
+          if(hard_constraints[jindx[j] + i] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+            /* 1.3.1 Middle part                    */
+            if((i>TURN+2) && (j<n-TURN-1)){
+
+              for (tmp3=1, s=0; s<n_seq; s++){
+                tmp3 *= exp_E_MLstem(rtype[type[s]], S5[s][i], S3[s][j], pf_params);
+              }
+              tmp2 += qm[my_iindx[1]-i+1] * qm[my_iindx[j+1]-n] * tmp3 * pow(expMLclosing,n_seq);
+            }
+            /* 1.3.2 Left part    */
+            for(k=TURN+2; k < i-TURN-2; k++){
+              if(hc->up_ml[j+1] < n-j)
+                break;
+
+              for (tmp3=1, s=0; s<n_seq; s++){
+                tmp3 *= exp_E_MLstem(rtype[type[s]], S5[s][i], S3[s][j], pf_params);
+              }
+
+              if(sc)
+                for(s = 0; s < n_seq; s++){
+                  if(sc[s]){
+                    if(sc[s]->exp_energy_bp)
+                      tmp3 *= sc[s]->exp_energy_bp[jindx[j] + i];
+
+                    if(sc[s]->exp_energy_up)
+                      tmp3 *= sc[s]->exp_energy_up[a2s[s][j]+1][a2s[s][n]-a2s[s][j]];
+                  }
+                }
+
+              tmp2 += qm[my_iindx[1]-k] * qm1[jindx[i-1]+k+1] * tmp3 * expMLbase[n-j] * pow(expMLclosing,n_seq);
+            }
+            /* 1.3.3 Right part    */
+            for(k=j+TURN+2; k < n-TURN-1;k++){
+              if(hc->up_ml[1] < i-1)
+                break;
+
+              for (tmp3=1, s=0; s<n_seq; s++){
+                tmp3 *= exp_E_MLstem(rtype[type[s]], S5[s][i], S3[s][j], pf_params);
+              }
+
+              if(sc)
+                for(s = 0; s < n_seq; s++){
+                  if(sc[s]){
+                    if(sc[s]->exp_energy_bp)
+                      tmp3 *= sc[s]->exp_energy_bp[jindx[j] + i];
+
+                    if(sc[s]->exp_energy_up)
+                      tmp3 *= sc[s]->exp_energy_up[a2s[s][1]][a2s[s][i]-a2s[s][1]];
+                  }
+                }
+
+              tmp2 += qm[my_iindx[j+1]-k] * qm1[jindx[n]+k+1] * tmp3 * expMLbase[i-1] * pow(expMLclosing,n_seq);
+            }
+          }
+          probs[ij] *= tmp2;
+        }
+        else probs[ij] = 0;
+      }  /* end for j=..*/
+    }  /* end or i=...  */
+  } /* end if(circular)  */
+  else{
+    for (i=1; i<=n; i++) {
+      for (j=i; j<=MIN2(i+TURN,n); j++)
+        probs[my_iindx[i]-j] = 0;
+
+      for (j=i+TURN+1; j<=n; j++) {
+        ij = my_iindx[i]-j;
+        if ((qb[ij] > 0.) && (hard_constraints[jindx[j] + i] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP)){
+          probs[ij] = q1k[i-1] * qln[j+1]/q1k[n] * exp(pscore[jindx[j]+i]/kTn);
+          for (s=0; s<n_seq; s++) {
+            int typ;
+            typ = md->pair[S[s][i]][S[s][j]]; if (typ==0) typ=7;
+            probs[ij] *= exp_E_ExtLoop(typ, (i>1) ? S5[s][i] : -1, (j<n) ? S3[s][j] : -1, pf_params);
+          }
+        } else
+          probs[ij] = 0;
+      }
+    }
+  } /* end if(!circular)  */
+  for (l=n; l>TURN+1; l--) {
+
+    /* 2. bonding k,l as substem of 2:loop enclosed by i,j */
+    for (k=1; k<l-TURN; k++) {
+      pp = 0.;
+      kl = my_iindx[k]-l;
+      if (qb[kl] == 0.) continue;
+      if(!(hard_constraints[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC)) continue;
+
+      for (s=0; s<n_seq; s++) {
+        type[s] = md->pair[S[s][l]][S[s][k]];
+        if (type[s]==0) type[s]=7;
+      }
+
+      for (i=MAX2(1,k-MAXLOOP-1); i<=k-1; i++){
+        if(hc->up_int[i+1] < k - i - 1)
+          continue;
+
+        for (j=l+1; j<=MIN2(l+ MAXLOOP -k+i+2,n); j++) {
+          FLT_OR_DBL qloop=1;
+          ij = my_iindx[i] - j;
+
+          if(probs[ij] == 0.) continue;
+          if(!(hard_constraints[jindx[j] + i] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP)) continue;
+          if(hc->up_int[l+1] < j - l - 1) break;
+
+          for (s=0; s<n_seq; s++) {
+            int typ, u1, u2;
+            u1 = a2s[s][k-1] - a2s[s][i];
+            u2 = a2s[s][j-1] - a2s[s][l];
+            typ = md->pair[S[s][i]][S[s][j]]; if (typ==0) typ=7;
+            qloop *=  exp_E_IntLoop(u1, u2, typ, type[s], S3[s][i], S5[s][j], S5[s][k], S3[s][l], pf_params);
+          }
+
+          if(sc){
+            for(s = 0; s < n_seq; s++){
+              if(sc[s]){
+                int u1, u2;
+                u1 = a2s[s][k-1] - a2s[s][i];
+                u2 = a2s[s][j-1] - a2s[s][l];
+/*
+                u1 = k - i - 1;
+                u2 = j - l - 1;
+*/
+                if(sc[s]->exp_energy_bp)
+                  qloop *= sc[s]->exp_energy_bp[jindx[j] + i];
+
+                if(sc[s]->exp_energy_up)
+                  qloop *=    sc[s]->exp_energy_up[a2s[s][i]+1][u1]
+                              * sc[s]->exp_energy_up[a2s[s][l]+1][u2];
+
+                if(sc[s]->exp_energy_stack)
+                  if(u1 + u2 == 0){
+                    if(S[s][i] && S[s][j] && S[s][k] && S[s][l]){ /* don't allow gaps in stack */
+                      qloop *=    sc[s]->exp_energy_stack[i]
+                                * sc[s]->exp_energy_stack[k]
+                                * sc[s]->exp_energy_stack[l]
+                                * sc[s]->exp_energy_stack[j];
+                    }
+                  }
+              }
+            }
+          }
+          pp += probs[ij]*qloop*scale[k-i + j-l];
+        }
+      }
+      probs[kl] += pp * exp(pscore[jindx[l]+k]/kTn);
+    }
+    /* 3. bonding k,l as substem of multi-loop enclosed by i,j */
+    prm_MLb = 0.;
+    if (l<n)
+      for (k=2; k<l-TURN; k++) {
+      i = k-1;
+      prmt = prmt1 = 0.;
+
+      if(1 /* hard_constraints[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC */){
+        ii = my_iindx[i];     /* ii-j=[i,j]     */
+        ll = my_iindx[l+1];   /* ll-j=[l+1,j-1] */
+        if(hard_constraints[jindx[l+1] + i] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+          prmt1 = probs[ii-(l+1)];
+          for (s=0; s<n_seq; s++) {
+            tt = md->pair[S[s][l+1]][S[s][i]]; if (tt==0) tt=7;
+            prmt1 *= exp_E_MLstem(tt, S5[s][l+1], S3[s][i], pf_params) * expMLclosing;
+          }
+
+          if(sc)
+            for(s = 0; s < n_seq; s++){
+              if(sc[s]){
+                if(sc[s]->exp_energy_bp)
+                  prmt1 *= sc[s]->exp_energy_bp[jindx[l+1] + i];
+              }
+            }
+        }
+
+        for (j=l+2; j<=n; j++){
+          pp = 1.;
+          if(probs[ii-j]==0) continue;
+          if(!(hard_constraints[jindx[j] + i] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP)) continue;
+
+          for (s=0; s<n_seq; s++) {
+            tt = md->pair[S[s][j]][S[s][i]]; if (tt==0) tt=7;
+            pp *=  exp_E_MLstem(tt, S5[s][j], S3[s][i], pf_params) * expMLclosing;
+          }
+
+          if(sc)
+            for(s = 0; s < n_seq; s++){
+              if(sc[s]){
+                if(sc[s]->exp_energy_bp)
+                  pp *= sc[s]->exp_energy_bp[jindx[j] + i];
+              }
+            }
+
+          prmt +=  probs[ii-j] * pp * qm[ll-(j-1)];
+        }
+        kl = my_iindx[k]-l;
+
+        prml[ i] = prmt;
+
+        pp = 0.;
+        if(hc->up_ml[l+1]){
+          pp = prm_l1[i] * expMLbase[1];
+          if(sc)
+            for(s = 0; s < n_seq; s++){
+              if(sc[s]){
+                if(sc[s]->exp_energy_up)
+                  pp *= sc[s]->exp_energy_up[a2s[s][l+1]][1];
+              }
+            }
+        }
+        prm_l[i] = pp + prmt1; /* expMLbase[1]^n_seq */
+
+        pp = 0.;
+        if(hc->up_ml[i]){
+          pp = prm_MLb * expMLbase[1];
+          if(sc)
+            for(s = 0; s < n_seq; s++){
+              if(sc[s]){
+                if(sc[s]->exp_energy_up)
+                  pp *= sc[s]->exp_energy_up[a2s[s][i]][1];
+              }
+            }
+        }
+        prm_MLb = pp + prml[i];
+
+        /* same as:    prm_MLb = 0;
+           for (i=1; i<=k-1; i++) prm_MLb += prml[i]*expMLbase[k-i-1]; */
+
+        prml[i] = prml[ i] + prm_l[i];
+
+        if (qb[kl] == 0.) continue;
+
+        temp = prm_MLb;
+
+        for (i=1;i<=k-2; i++)
+          temp += prml[i]*qm[my_iindx[i+1] - (k-1)];
+
+        for (s=0; s<n_seq; s++) {
+          tt=md->pair[S[s][k]][S[s][l]]; if (tt==0) tt=7;
+          temp *= exp_E_MLstem(tt, S5[s][k], S3[s][l], pf_params);
+        }
+        probs[kl] += temp * scale[2] * exp(pscore[jindx[l]+k]/kTn);
+      } else { /* (k,l) not allowed to be substem of multiloop closed by (i,j) */
+        prml[i] = prm_l[i] = prm_l1[i] = 0.;
+      }
+
+#ifdef USE_FLOAT_PF
+      if (probs[kl]>Qmax) {
+        Qmax = probs[kl];
+        if (Qmax>FLT_MAX/10.)
+          vrna_message_warning("%d %d %g %g\n", i,j,probs[kl],qb[kl]);
+      }
+      if (probs[kl]>FLT_MAX) {
+        ov++;
+        probs[kl]=FLT_MAX;
+      }
+#endif
+    } /* end for (k=2..) */
+    tmp = prm_l1; prm_l1=prm_l; prm_l=tmp;
+
+  }  /* end for (l=..)   */
+
+  for (i=1; i<=n; i++)
+    for (j=i+TURN+1; j<=n; j++) {
+      ij = my_iindx[i]-j;
+      probs[ij] *= qb[ij] *exp(-pscore[jindx[j]+i]/kTn);
+    }
+
+  if (structure!=NULL){
+    char *s = vrna_db_from_probs(probs, (unsigned int)n);
+    memcpy(structure, s, n);
+    structure[n] = '\0';
+    free(s);
+  }
+
+  if(ov > 0)
+    vrna_message_warning("%d overflows occurred while backtracking;\n"
+                                "you might try a smaller pf_scale than %g\n",
+                                ov, pf_params->pf_scale);
+
+  free(type);
+  free(prm_l);
+  free(prm_l1);
+  free(prml);
+}
+
diff --git a/C/ViennaRNA/equilibrium_probs.h b/C/ViennaRNA/equilibrium_probs.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/equilibrium_probs.h
@@ -0,0 +1,81 @@
+#ifndef VIENNA_RNA_PACKAGE_EQUILIBRIUM_PROBS_H
+#define VIENNA_RNA_PACKAGE_EQUILIBRIUM_PROBS_H
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+#include <ViennaRNA/data_structures.h>
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file     equilibrium_probs.h
+ *  @ingroup  pf_fold
+ *  @brief    Equilibrium Probability implementations
+ * 
+ *  This file includes various implementations for equilibrium
+ *  probability computations based on the partition function
+ *  of an RNA sequence, two concatenated sequences, or a sequence
+ *  alignment.
+ */
+
+/*
+#################################################
+# BASE PAIR PROBABILITY RELATED FUNCTIONS       #
+#################################################
+*/
+
+void  vrna_pairing_probs(vrna_fold_compound_t *vc, char *structure);
+
+/**
+ *  @brief Get the mean base pair distance in the thermodynamic ensemble from a probability matrix
+ * 
+ *  @f$<d> = \sum_{a,b} p_a p_b d(S_a,S_b)@f$\n
+ *  this can be computed from the pair probs @f$p_ij@f$ as\n
+ *  @f$<d> = \sum_{ij} p_{ij}(1-p_{ij})@f$
+ * 
+ *  @ingroup pf_fold
+ *
+ *  @param length The length of the sequence
+ *  @param pr     The matrix containing the base pair probabilities
+ *  @return       The mean pair distance of the structure ensemble
+ */
+double vrna_mean_bp_distance_pr(int length, FLT_OR_DBL *pr);
+
+/**
+ *  @brief Get the mean base pair distance in the thermodynamic ensemble
+ * 
+ *  @f$<d> = \sum_{a,b} p_a p_b d(S_a,S_b)@f$\n
+ *  this can be computed from the pair probs @f$p_ij@f$ as\n
+ *  @f$<d> = \sum_{ij} p_{ij}(1-p_{ij})@f$
+ * 
+ *  @ingroup pf_fold
+ *
+ *  @param vc     The fold compound data structure
+ *  @return       The mean pair distance of the structure ensemble
+ */
+double vrna_mean_bp_distance(vrna_fold_compound_t *vc);
+
+/**
+ *  @brief  Compute stacking probabilities
+ *
+ *  For each possible base pair @f$(i,j)@f$, compute the probability of a stack
+ *  @f$(i,j)@f$, @f$(i+1, j-1)@f$.
+ *
+ *  @ingroup pf_fold
+ *
+ *  @param  vc      The fold compound data structure with precomputed base pair probabilities
+ *  @param  cutoff  A cutoff value that limits the output to stacks with @f$ p > \textrm{cutoff} @f$.
+ *  @return         A list of stacks with enclosing base pair @f$(i,j)@f$ and probabiltiy @f$ p @f$
+ */
+vrna_plist_t *vrna_stack_prob(vrna_fold_compound_t *vc, double cutoff);
+
+#endif
diff --git a/C/ViennaRNA/eval.c b/C/ViennaRNA/eval.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/eval.c
@@ -0,0 +1,2544 @@
+/** \file eval.c */
+
+
+/*
+                  Free energy evaluation
+
+                  c Ivo Hofacker, Chrisoph Flamm
+                  original implementation by
+                  Walter Fontana
+
+                  ViennaRNA Package >= v2.0 by Ronny Lorenz
+
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include <limits.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/structure_utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/model.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/cofold.h"
+#include "ViennaRNA/eval.h"
+
+#include "ViennaRNA/color_output.inc"
+
+#define ON_SAME_STRAND(I,J,C)  (((I)>=(C))||((J)<(C)))
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+PUBLIC  int cut_point = -1; /* set to first pos of second seq for cofolding */
+PUBLIC  int eos_debug = 0;  /* verbose info from energy_of_struct */
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+PRIVATE vrna_fold_compound_t  *backward_compat_compound = NULL;
+
+PRIVATE int verbosity_default = 1;  /* default verbosity level */
+PRIVATE int verbosity_quiet   = -1; /* verbosity level for quiet operations */
+
+#ifdef _OPENMP
+
+#pragma omp threadprivate(backward_compat_compound)
+
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE int
+stack_energy( vrna_fold_compound_t *vc,
+              int i,
+              const short *pt,
+              FILE *file,
+              int verbostiy_level);
+
+PRIVATE int
+energy_of_extLoop_pt( vrna_fold_compound_t *vc,
+                      int i,
+                      const short *pt);
+
+PRIVATE int
+energy_of_ml_pt(vrna_fold_compound_t *vc,
+                int i,
+                const short *pt);
+
+PRIVATE int
+cut_in_loop(int i,
+            const short *pt,
+            int cp);
+
+PRIVATE int
+eval_pt(vrna_fold_compound_t *vc,
+        const short *pt,
+        FILE *file,
+        int verbosity_level);
+
+PRIVATE int
+eval_circ_pt( vrna_fold_compound_t *vc,
+              const short *pt,
+              FILE *file,
+              int verbosity_level);
+
+PRIVATE int
+en_corr_of_loop_gquad(vrna_fold_compound_t *vc,
+                      int i,
+                      int j,
+                      const char *structure,
+                      const short *pt);
+
+PRIVATE vrna_param_t *
+get_updated_params( vrna_param_t *parameters,
+                    int compat);
+
+PRIVATE float
+wrap_eval_structure(vrna_fold_compound_t *vc,
+                    const char *structure,
+                    const short *pt,
+                    FILE *file,
+                    int verbosity);
+
+PRIVATE int
+wrap_eval_loop_pt(vrna_fold_compound_t *vc,
+                  int i,
+                  const short *pt,
+                  int verbosity);
+
+PRIVATE INLINE int
+eval_int_loop(vrna_fold_compound_t *vc,
+              int i,
+              int j,
+              int p,
+              int q);
+
+/* consensus structure variants below */
+PRIVATE int
+covar_energy_of_struct_pt(vrna_fold_compound_t *vc,
+                          const short *pt);
+
+PRIVATE int
+stack_energy_covar_pt(vrna_fold_compound_t *vc,
+                      int i,
+                      const short *ptable);
+
+PRIVATE int
+en_corr_of_loop_gquad_ali(vrna_fold_compound_t *vc,
+                          int i,
+                          int j,
+                          const char *structure,
+                          const short *pt,
+                          const int *loop_idx);
+
+PRIVATE int
+covar_en_corr_of_loop_gquad(vrna_fold_compound_t *vc,
+                            int i,
+                            int j,
+                            const char *structure,
+                            const short *pt,
+                            const int *loop_idx);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+
+PUBLIC float
+vrna_eval_structure_simple( const char *string,
+                            const char *structure){
+
+  return vrna_eval_structure_simple_v(string, structure, verbosity_quiet, NULL);
+}
+
+
+PUBLIC float
+vrna_eval_structure_simple_verbose( const char *string,
+                                    const char *structure,
+                                    FILE *file){
+
+  return vrna_eval_structure_simple_v(string, structure, verbosity_default, file);
+}
+
+
+PUBLIC float
+vrna_eval_structure_simple_v( const char *string,
+                              const char *structure,
+                              int verbosity_level,
+                              FILE *file){
+
+  float e;
+
+  /* create fold_compound with default parameters and without DP matrices */
+  vrna_fold_compound_t *vc = vrna_fold_compound(string, NULL, VRNA_OPTION_EVAL_ONLY);
+
+  /* evaluate structure */
+  e = vrna_eval_structure_v(vc, structure, verbosity_level, file);
+
+  /* free fold_compound */
+  vrna_fold_compound_free(vc);
+
+  return e;
+}
+
+
+PUBLIC int
+vrna_eval_structure_pt_simple(const char *string,
+                              const short *pt){
+
+  return vrna_eval_structure_pt_simple_v(string, pt, verbosity_quiet, NULL);
+}
+
+
+PUBLIC int
+vrna_eval_structure_pt_simple_verbose(const char *string,
+                                      const short *pt,
+                                      FILE *file){
+
+  return vrna_eval_structure_pt_simple_v(string, pt, verbosity_default, file);
+}
+
+
+PUBLIC int
+vrna_eval_structure_pt_simple_v(const char *string,
+                                const short *pt,
+                                int verbosity_level,
+                                FILE *file){
+
+  int e;
+
+  /* create fold_compound with default parameters and without DP matrices */
+  vrna_fold_compound_t *vc = vrna_fold_compound(string, NULL, VRNA_OPTION_EVAL_ONLY);
+
+  /* evaluate structure */
+  e = vrna_eval_structure_pt_v(vc, pt, verbosity_level, file);
+
+  /* free fold_compound */
+  vrna_fold_compound_free(vc);
+
+  return e;
+
+}
+
+
+PUBLIC int
+vrna_eval_move_pt_simple( const char *string,
+                          short *pt,
+                          int m1,
+                          int m2){
+
+  int e;
+
+  /* create fold_compound with default parameters and without DP matrices */
+  vrna_fold_compound_t *vc = vrna_fold_compound(string, NULL, VRNA_OPTION_EVAL_ONLY);
+
+  /* evaluate structure */
+  e = vrna_eval_move_pt(vc, pt, m1, m2);
+
+  /* free fold_compound */
+  vrna_fold_compound_free(vc);
+
+  return e;
+
+}
+
+
+PUBLIC  float
+vrna_eval_structure(vrna_fold_compound_t *vc,
+                    const char *structure){
+
+  return vrna_eval_structure_v(vc, structure, verbosity_quiet, NULL);
+}
+
+
+PUBLIC float
+vrna_eval_structure_verbose(vrna_fold_compound_t *vc,
+                            const char *structure,
+                            FILE *file){
+
+  return vrna_eval_structure_v(vc, structure, verbosity_default, file);
+}
+
+
+PUBLIC float
+vrna_eval_structure_v(vrna_fold_compound_t *vc,
+                      const char *structure,
+                      int verbosity_level,
+                      FILE *file){
+
+  short *pt = vrna_ptable(structure);
+  float en  = wrap_eval_structure(vc, structure, pt, file, verbosity_level);
+
+  free(pt);
+  return en;
+}
+
+
+PUBLIC float
+vrna_eval_covar_structure(vrna_fold_compound_t *vc,
+                          const char *structure){
+
+  int res, gq, *loop_idx;
+  short *pt;
+
+  pt                              = vrna_ptable(structure);
+  res                             = 0;
+  gq                              = vc->params->model_details.gquad;
+  vc->params->model_details.gquad = 0;
+
+  if(vc->type == VRNA_FC_TYPE_COMPARATIVE){
+    res = (int)((float)covar_energy_of_struct_pt(vc, pt) / (float)vc->n_seq);
+
+    vc->params->model_details.gquad = gq;
+
+    if(gq){
+      loop_idx  =   vrna_loopidx_from_ptable(pt);
+      res       +=  (int)((float)covar_en_corr_of_loop_gquad(vc, 1, vc->length, structure, pt, (const int *)loop_idx) / (float)vc->n_seq);
+      free(loop_idx);
+    }
+  }
+
+  free(pt);
+
+  return (float)res/100.;
+}
+
+
+PUBLIC int
+vrna_eval_structure_pt( vrna_fold_compound_t *vc,
+                        const short *pt){
+
+  return vrna_eval_structure_pt_v(vc, pt, verbosity_quiet, NULL);
+}
+
+
+PUBLIC int
+vrna_eval_structure_pt_verbose( vrna_fold_compound_t *vc,
+                                const short *pt,
+                                FILE *file){
+
+  return vrna_eval_structure_pt_v(vc, pt, verbosity_default, file);
+}
+
+
+PUBLIC int
+vrna_eval_structure_pt_v( vrna_fold_compound_t *vc,
+                          const short *pt,
+                          int verbosity_level,
+                          FILE *file){
+
+  if(pt && vc){
+    if(pt[0] != (short)vc->length)
+      vrna_message_error("vrna_eval_structure_*: string and structure have unequal length");
+
+    return eval_pt(vc, pt, file, verbosity_level);
+  } else
+    return INF;
+}
+
+
+PUBLIC int
+vrna_eval_loop_pt(vrna_fold_compound_t *vc,
+                  int i,
+                  const short *pt){
+
+  return wrap_eval_loop_pt(vc, i, pt, verbosity_quiet);
+}
+
+
+PUBLIC float
+vrna_eval_move( vrna_fold_compound_t *vc,
+                const char *structure,
+                int m1,
+                int m2){
+
+  short   *pt;
+  int     en;
+
+  if (strlen(structure) != vc->length)
+    vrna_message_error("vrna_eval_move: sequence and structure have unequal length");
+
+  pt = vrna_ptable(structure);
+  en = vrna_eval_move_pt(vc, pt, m1, m2);
+
+  free(pt);
+
+  return  (float)en/100.;
+}
+
+
+PUBLIC int
+vrna_eval_move_pt(vrna_fold_compound_t *vc,
+                  short *pt,
+                  int m1,
+                  int m2){
+
+  /*compute change in energy given by move (m1,m2)*/
+  int en_post, en_pre, i,j,k,l, len, cp;
+  vrna_param_t *P;
+  
+  len = vc->length;
+  cp  = vc->cutpoint;
+  P   = vc->params;
+
+  k = (m1>0)?m1:-m1;
+  l = (m2>0)?m2:-m2;
+  /* first find the enclosing pair i<k<l<j */
+  for (j=l+1; j<=len; j++) {
+    if (pt[j]<=0) continue; /* unpaired */
+    if (pt[j]<k) break;   /* found it */
+    if (pt[j]>j) j=pt[j]; /* skip substructure */
+    else {
+      vrna_message_error( "illegal move or broken pair table in vrna_eval_move_pt()\n"
+                          "%d %d %d %d ", m1, m2, j, pt[j]);
+    }
+  }
+  i = (j<=len) ? pt[j] : 0;
+  en_pre = vrna_eval_loop_pt(vc, i, (const short *)pt);
+  en_post = 0;
+  if (m1<0) { /*it's a delete move */
+    en_pre += vrna_eval_loop_pt(vc, k, (const short *)pt);
+    pt[k]=0;
+    pt[l]=0;
+  } else { /* insert move */
+    pt[k]=l;
+    pt[l]=k;
+    en_post += vrna_eval_loop_pt(vc, k, (const short *)pt);
+  }
+  en_post += vrna_eval_loop_pt(vc, i, (const short *)pt);
+  /*  restore pair table */
+  if (m1<0) {
+    pt[k]=l;
+    pt[l]=k;
+  } else {
+    pt[k]=0;
+    pt[l]=0;
+  }
+
+  /* Cofolding -- Check if move changes COFOLD-Penalty */
+  if (!ON_SAME_STRAND(k, l, cp)) {
+    int p, c; p=c=0;
+    for (p=1; p < cp; ) { /* Count basepairs between two strands */
+      if (pt[p] != 0) {
+        if (ON_SAME_STRAND(p, pt[p], cp)) /* Skip stuff */
+          p=pt[p];
+        else if (++c > 1) break; /* Count a basepair, break if we have more than one */
+      }
+      p++;
+    }
+    if (m1<0 && c==1) /* First and only inserted basepair */
+      return (en_post - en_pre - P->DuplexInit);
+    else
+      if (c==0) /* Must have been a delete move */
+        return (en_post - en_pre + P->DuplexInit);
+  }
+
+  return (en_post - en_pre);
+}
+
+/*
+#################################
+# STATIC helper functions below #
+#################################
+*/
+
+PRIVATE INLINE int
+eval_int_loop(vrna_fold_compound_t *vc,
+              int i,
+              int j,
+              int p,
+              int q){
+
+  int             ij, u1, u2, cp, *rtype, *indx;
+  unsigned char   type, type_2;
+  short           *S, si, sj, sp, sq;
+  vrna_param_t    *P;
+  vrna_md_t       *md;
+  vrna_sc_t       *sc;
+
+  cp      = vc->cutpoint;
+  indx    = vc->jindx;
+  P       = vc->params;
+  md      = &(P->model_details);
+  S       = vc->sequence_encoding;
+  si      = S[i+1];
+  sj      = S[j-1];
+  sp      = S[p-1];
+  sq      = S[q+1];
+  ij      = indx[j] + i;
+  rtype   = &(md->rtype[0]);
+  type    = (unsigned char)md->pair[S[i]][S[j]];
+  type_2  = rtype[(unsigned char)md->pair[S[p]][S[q]]];
+  u1      = p - i - 1;
+  u2      = j - q - 1;
+  sc      = vc->sc;
+
+  if(type == 0)
+    type = 7;
+  if(type_2 == 0)
+    type_2 = 7;
+
+  return ubf_eval_int_loop( i, j, p, q,
+                            i + 1, j - 1, p - 1, q + 1,
+                            si, sj, sp, sq,
+                            type, type_2, rtype,
+                            ij, cp,
+                            P, sc);
+}
+
+PRIVATE INLINE int
+eval_ext_int_loop(vrna_fold_compound_t *vc,
+                  int i,
+                  int j,
+                  int p,
+                  int q){
+
+  int             e, u1, u2, length;
+  unsigned int    s, n_seq;
+  short           **SS, **S5, **S3;
+  unsigned short  **a2s;
+  unsigned char   type, type_2;
+  short           *S, si, sj, sp, sq;
+  vrna_param_t    *P;
+  vrna_md_t       *md;
+  vrna_sc_t       *sc, **scs;
+
+  length  = vc->length;
+  P       = vc->params;
+  md      = &(P->model_details);
+  S       = vc->sequence_encoding;
+  e       = INF;
+
+  switch(vc->type){
+    case VRNA_FC_TYPE_SINGLE:     si      = S[j+1];
+                                  sj      = S[i-1];
+                                  sp      = S[p-1];
+                                  sq      = S[q+1];
+                                  type    = (unsigned char)md->pair[S[j]][S[i]];
+                                  type_2  = (unsigned char)md->pair[S[q]][S[p]];
+                                  sc      = vc->sc;
+
+                                  if(type == 0)
+                                    type = 7;
+                                  if(type_2 == 0)
+                                    type_2 = 7;
+
+                                  e = ubf_eval_ext_int_loop(i, j, p, q,
+                                                            i - 1, j + 1, p - 1, q + 1,
+                                                            si, sj, sp, sq,
+                                                            type, type_2,
+                                                            length,
+                                                            P, sc);
+                                  break;
+
+    case VRNA_FC_TYPE_COMPARATIVE:  n_seq = vc->n_seq;
+                                  SS      = vc->S;
+                                  S5      = vc->S5; /* S5[s][i] holds next base 5' of i in sequence s */
+                                  S3      = vc->S3; /* Sl[s][i] holds next base 3' of i in sequence s */
+                                  a2s     = vc->a2s;
+                                  n_seq   = vc->n_seq;
+                                  scs     = vc->scs;
+
+                                  for (e = 0, s = 0; s < n_seq; s++) {
+                                    type    = (unsigned char)md->pair[SS[s][j]][SS[s][i]];
+                                    if(type == 0)
+                                      type = 7;
+                                    type_2  = (unsigned char)md->pair[SS[s][q]][SS[s][p]]; /* q,p not p,q! */
+                                    if(type_2 == 0)
+                                      type_2 = 7;
+
+                                    sc = (scs && scs[s]) ? scs[s] : NULL;
+
+                                    e += ubf_eval_ext_int_loop(a2s[s][i], a2s[s][j], a2s[s][p], a2s[s][q],
+                                                                    a2s[s][i - 1], a2s[s][j + 1], a2s[s][p - 1], a2s[s][q + 1],
+                                                                    S3[s][j], S5[s][i], S5[s][p], S3[s][q],
+                                                                    type, type_2,
+                                                                    a2s[s][length],
+                                                                    P, sc);
+                                  }
+
+                                  break;
+  }
+
+  return e;
+}
+
+PRIVATE  vrna_param_t *
+get_updated_params(vrna_param_t *parameters, int compat){
+  vrna_param_t *P = NULL;
+  if(parameters){
+    P = vrna_params_copy(parameters);
+  } else {
+    vrna_md_t md;
+    if(compat)
+      set_model_details(&md);
+    else
+      vrna_md_set_default(&md);
+    md.temperature = temperature;
+    P = vrna_params(&md);
+  }
+  vrna_md_update(&(P->model_details));
+  return P;
+}
+
+PRIVATE int
+wrap_eval_loop_pt(vrna_fold_compound_t *vc,
+                  int i,
+                  const short *pt,
+                  int verbosity){
+
+  /* compute energy of a single loop closed by base pair (i,j) */
+  int               j, type, p,q, energy, cp;
+  short             *s;
+  vrna_param_t      *P;
+
+  P   = vc->params;
+  cp  = vc->cutpoint;
+  s   = vc->sequence_encoding2;
+
+  if (i==0) { /* evaluate exterior loop */
+    energy = energy_of_extLoop_pt(vc, 0, pt);
+    return energy;
+  }
+  j = pt[i];
+  if(j < i)
+    vrna_message_error("i is unpaired in loop_energy()");
+  type = P->model_details.pair[s[i]][s[j]];
+  if (type==0) {
+    type=7;
+    if (verbosity > verbosity_quiet)
+      vrna_message_warning( "bases %d and %d (%c%c) can't pair!",
+                            i, j,
+                            vrna_nucleotide_decode(s[i], &(P->model_details)),
+                            vrna_nucleotide_decode(s[j], &(P->model_details)));
+  }
+  p=i; q=j;
+
+
+  while (pt[++p]==0);
+  while (pt[--q]==0);
+  if (p>q) { /* Hairpin */
+    energy = vrna_eval_hp_loop(vc, i, j);
+  }
+  else if (pt[q]!=(short)p) { /* multi-loop */
+    int ii;
+    ii = cut_in_loop(i, (const short *)pt, cp);
+    energy = (ii==0) ? energy_of_ml_pt(vc, i, (const short *)pt) : energy_of_extLoop_pt(vc, ii, (const short *)pt);
+  }
+  else { /* found interior loop */
+    int type_2;
+    type_2 = P->model_details.pair[s[q]][s[p]];
+    if (type_2==0) {
+      type_2=7;
+      if (verbosity > verbosity_quiet)
+        vrna_message_warning( "bases %d and %d (%c%c) can't pair!",
+                              p, q,
+                              vrna_nucleotide_decode(s[p], &(P->model_details)),
+                              vrna_nucleotide_decode(s[q], &(P->model_details)));
+    }
+
+    energy = eval_int_loop(vc, i, j, p, q);
+
+  }
+
+  return energy;
+}
+
+PRIVATE float
+wrap_eval_structure(vrna_fold_compound_t *vc,
+                    const char *structure,
+                    const short *pt,
+                    FILE *file,
+                    int verbosity){
+
+  int res;
+  int gq;
+
+  res                             = INF;
+  gq                              = vc->params->model_details.gquad;
+  vc->params->model_details.gquad = 0;
+
+  switch(vc->type){
+    case VRNA_FC_TYPE_SINGLE:     if(vc->params->model_details.circ){
+                                    res = eval_circ_pt(vc, pt, file, verbosity);
+                                  } else {
+                                    res = eval_pt(vc, pt, file, verbosity);
+                                  }
+                                  vc->params->model_details.gquad = gq;
+
+                                  if(gq){
+                                    res += en_corr_of_loop_gquad(vc, 1, vc->length, structure, pt);
+                                  }
+                                  break;
+
+    case VRNA_FC_TYPE_COMPARATIVE:  if(vc->params->model_details.circ){
+                                    res = (int)((float)eval_circ_pt(vc, pt, file, verbosity) / (float)vc->n_seq);
+                                  } else {
+                                    res = (int)((float)eval_pt(vc, pt, file, verbosity) / (float)vc->n_seq);
+                                  }
+                                  vc->params->model_details.gquad = gq;
+
+                                  if(gq){
+                                    int *loop_idx = vrna_loopidx_from_ptable(pt);
+                                    res += (int)((float)en_corr_of_loop_gquad_ali(vc, 1, vc->length, structure, pt, (const int *)loop_idx) / (float)vc->n_seq);
+                                    free(loop_idx);
+                                  }
+                                  break;
+
+    default:                      /* do nothing */
+                                  break;
+  }
+  return (float)res/100.;
+}
+
+PRIVATE int
+eval_pt(vrna_fold_compound_t *vc,
+        const short *pt,
+        FILE *file,
+        int verbosity_level){
+
+  int   i, length, energy, cp;
+  FILE  *out;
+
+  out     = (file) ? file : stdout;
+  length  = vc->length;
+  cp      = vc->cutpoint;
+
+  if(vc->params->model_details.gquad)
+    vrna_message_warning( "vrna_eval_*_pt: No gquadruplex support!\n"
+                          "Ignoring potential gquads in structure!\n"
+                          "Use e.g. vrna_eval_structure() instead!");
+
+  energy = vc->params->model_details.backtrack_type=='M' ? energy_of_ml_pt(vc, 0, pt) : energy_of_extLoop_pt(vc, 0, pt);
+
+  if (verbosity_level>0)
+    print_eval_ext_loop(out, energy);
+  for (i=1; i<=length; i++) {
+    if (pt[i]==0) continue;
+    energy += stack_energy(vc, i, pt, out, verbosity_level);
+    i=pt[i];
+  }
+  for (i=1; !ON_SAME_STRAND(i,length, cp); i++) {
+    if (!ON_SAME_STRAND(i,pt[i], cp)) {
+      energy += vc->params->DuplexInit;
+      break;
+    }
+  }
+
+  return energy;
+}
+
+PRIVATE int
+eval_circ_pt( vrna_fold_compound_t *vc,
+              const short *pt,
+              FILE *file,
+              int verbosity_level){
+
+  unsigned int      s, n_seq;
+  int               i, j, length, energy, en0, degree;
+  unsigned short    **a2s;
+  vrna_param_t      *P;
+  vrna_sc_t         *sc, **scs;
+  FILE              *out;
+
+  energy        = 0;
+  en0           = 0;
+  degree        = 0;
+  length        = vc->length;
+  P             = vc->params;
+  sc            = (vc->type == VRNA_FC_TYPE_SINGLE) ? vc->sc : NULL;
+  scs           = (vc->type == VRNA_FC_TYPE_COMPARATIVE) ? vc->scs : NULL;
+  out           = (file) ? file : stdout;
+
+  if(P->model_details.gquad)
+    vrna_message_warning( "vrna_eval_*_pt: No gquadruplex support!\n"
+                          "Ignoring potential gquads in structure!\n"
+                          "Use e.g. vrna_eval_structure() instead!");
+
+  /* evaluate all stems in exterior loop */
+  for (i=1; i<=length; i++) {
+    if (pt[i]==0) continue;
+    degree++;
+    energy += stack_energy(vc, i, (const short *)pt, out, verbosity_level);
+    i=pt[i];
+  }
+
+  /* find first stem */
+  for (i=1; pt[i]==0; i++);
+  j = pt[i];
+
+  /* evaluate exterior loop itself */
+  switch(degree){
+    case 0:   /* unstructured */
+              switch(vc->type){
+                case VRNA_FC_TYPE_SINGLE:     if(sc){
+                                                if(sc->energy_up)
+                                                  en0 += sc->energy_up[1][length];
+                                              }
+                                              break;
+
+                case VRNA_FC_TYPE_COMPARATIVE:  n_seq = vc->n_seq;
+                                              a2s   = vc->a2s;
+                                              if(scs)
+                                                for(s = 0; s < n_seq; s++){
+                                                  if(scs[s] && scs[s]->energy_up)
+                                                    en0 += scs[s]->energy_up[1][a2s[s][length]];
+                                                }
+                                              break;
+              }
+              break;
+    case 1:   /* hairpin loop */
+              en0 = vrna_eval_ext_hp_loop(vc, i, j);
+              break;
+
+    case 2:   /* interior loop */
+              {
+                int p,q;
+                /* seek to next pair */
+                for (p=j+1; pt[p]==0; p++);
+                q=pt[p];
+
+                en0 = eval_ext_int_loop(vc, i, j, p, q);
+              }
+              break;
+
+    default:  /* multibranch loop */
+              en0 = energy_of_ml_pt(vc, 0, (const short *)pt);
+
+              if(vc->type == VRNA_FC_TYPE_SINGLE)
+                en0 -= E_MLstem(0, -1, -1, P); /* remove virtual closing pair */
+              break;
+  }
+
+  if (verbosity_level>0)
+    print_eval_ext_loop(out, en0);
+
+  energy += en0;
+
+  return energy;
+}
+
+
+
+/*---------------------------------------------------------------------------*/
+/*  returns a correction term that may be added to the energy retrieved
+    from energy_of_struct_par() to correct misinterpreted loops. This
+    correction is necessary since energy_of_struct_par() will forget
+    about the existance of gquadruplexes and just treat them as unpaired
+    regions.
+
+    recursive variant
+*/
+PRIVATE int
+en_corr_of_loop_gquad(vrna_fold_compound_t *vc,
+                      int i,
+                      int j,
+                      const char *structure,
+                      const short *pt){
+
+  int               pos, energy, p, q, r, s, u, type, type2, L, l[3], *rtype, *loop_idx;
+  int               num_elem, num_g, elem_i, elem_j, up_mis;
+  short             *s1;
+  vrna_param_t      *P;
+  vrna_md_t         *md;
+
+  loop_idx  = vrna_loopidx_from_ptable(pt);
+  s1        = vc->sequence_encoding;
+  P         = vc->params;
+  md        = &(P->model_details);
+  rtype     = &(md->rtype[0]);
+
+  energy = 0;
+  q = i;
+  while((pos = parse_gquad(structure + q-1, &L, l)) > 0){
+    q += pos-1;
+    p = q - 4*L - l[0] - l[1] - l[2] + 1;
+    if(q > j) break;
+    /* we've found the first g-quadruplex at position [p,q] */
+    energy += E_gquad(L, l, P);
+    /* check if it's enclosed in a base pair */
+    if(loop_idx[p] == 0){ q++; continue; /* g-quad in exterior loop */}
+    else{
+      energy += E_MLstem(0, -1, -1, P); /*  do not forget to remove this energy if
+                                            the gquad is the only one surrounded by
+                                            the enclosing pair
+                                        */
+
+      /*  find its enclosing pair */
+      num_elem  = 0;
+      num_g     = 1;
+      r         = p - 1;
+      up_mis    = q - p + 1;
+
+      /* seek for first pairing base located 5' of the g-quad */
+      for(r = p - 1; !pt[r] && (r >= i); r--);
+      if(r < i)
+        vrna_message_error("this should not happen");
+
+      if(r < pt[r]){ /* found the enclosing pair */
+        s = pt[r];
+      } else {
+        num_elem++;
+        elem_i = pt[r];
+        elem_j = r;
+        r = pt[r]-1 ;
+        /* seek for next pairing base 5' of r */
+        for(; !pt[r] && (r >= i); r--);
+        if(r < i)
+          vrna_message_error("so nich");
+        if(r < pt[r]){ /* found the enclosing pair */
+          s = pt[r];
+        } else {
+          /* hop over stems and unpaired nucleotides */
+          while((r > pt[r]) && (r >= i)){
+            if(pt[r]){ r = pt[r]; num_elem++;}
+            r--;
+          }
+          if(r < i)
+            vrna_message_error("so nich");
+          s = pt[r]; /* found the enclosing pair */
+        }
+      }
+      /* now we have the enclosing pair (r,s) */
+
+      u = q+1;
+      /* we know everything about the 5' part of this loop so check the 3' part */
+      while(u<s){
+        if(structure[u-1] == '.') u++;
+        else if (structure[u-1] == '+'){ /* found another gquad */
+          pos = parse_gquad(structure + u - 1, &L, l);
+          if(pos > 0){
+            energy += E_gquad(L, l, P) + E_MLstem(0, -1, -1, P);
+            up_mis += pos;
+            u += pos;
+            num_g++;
+          }
+        } else { /* we must have found a stem */
+          if(!(u < pt[u]))
+            vrna_message_error("wtf!");
+          num_elem++; elem_i = u; elem_j = pt[u];
+          energy += en_corr_of_loop_gquad(vc, u, pt[u], structure, pt);
+          u = pt[u] + 1;
+        }
+      }
+      if(u!=s)
+        vrna_message_error("what the heck");
+      else{ /* we are done since we've found no other 3' structure element */
+        switch(num_elem){
+          /* g-quad was misinterpreted as hairpin closed by (r,s) */
+          case 0:   /* if(num_g == 1)
+                      if((p-r-1 == 0) || (s-q-1 == 0))
+                        vrna_message_error("too few unpaired bases");
+                    */
+                    type = md->pair[s1[r]][s1[s]];
+                    if(dangles == 2)
+                      energy += P->mismatchI[type][s1[r+1]][s1[s-1]];
+                    if(type > 2)
+                      energy += P->TerminalAU;
+                    energy += P->internal_loop[s - r - 1 - up_mis];
+                    energy -= E_MLstem(0, -1, -1, P);
+                    energy -= vrna_eval_hp_loop(vc, r, s);
+
+                    break;
+          /* g-quad was misinterpreted as interior loop closed by (r,s) with enclosed pair (elem_i, elem_j) */
+          case 1:   type = md->pair[s1[r]][s1[s]];
+                    type2 = md->pair[s1[elem_i]][s1[elem_j]];
+                    energy += P->MLclosing
+                              + E_MLstem(rtype[type], s1[s-1], s1[r+1], P)
+                              + (elem_i - r - 1 + s - elem_j - 1 - up_mis) * P->MLbase
+                              + E_MLstem(type2, s1[elem_i-1], s1[elem_j+1], P);
+                    energy -= eval_int_loop(vc, r, s, elem_i, elem_j);
+
+                    break;
+          /* gquad was misinterpreted as unpaired nucleotides in a multiloop */
+          default:  energy -= (up_mis) * P->MLbase;
+                    break;
+        }
+      }
+      q = s+1;
+    }
+  }
+
+  free(loop_idx);
+  return energy;
+}
+
+
+
+PRIVATE int
+stack_energy( vrna_fold_compound_t *vc,
+              int i,
+              const short *pt,
+              FILE *file,
+              int verbosity_level){
+
+  /* recursively calculate energy of substructure enclosed by (i,j) */
+
+  int               ee, energy, j, p, q, type, *rtype, *types, cp, ss, n_seq;
+  char              *string, **Ss;
+  short             *s, **S, **S5, **S3;
+  unsigned short    **a2s;
+  FILE              *out;
+  vrna_param_t      *P;
+  vrna_md_t         *md;
+
+  cp      = vc->cutpoint;
+  s       = vc->sequence_encoding2;
+  P       = vc->params;
+  md      = &(P->model_details);
+  rtype   = &(md->rtype[0]);
+  types   = NULL;
+  energy  = 0;
+  out     = (file) ? file : stdout;
+
+  j = pt[i];
+
+  switch(vc->type){
+    case VRNA_FC_TYPE_SINGLE:     string  = vc->sequence;
+                                  type    = md->pair[s[i]][s[j]];
+                                  if(type == 0){
+                                    type = 7;
+                                    if(verbosity_level > verbosity_quiet)
+                                      vrna_message_warning( "bases %d and %d (%c%c) can't pair!",
+                                                            i, j,
+                                                            string[i - 1],
+                                                            string[j - 1]);
+                                  }
+                                  break;
+
+    case VRNA_FC_TYPE_COMPARATIVE:  string  = vc->cons_seq;
+                                  S       = vc->S;
+                                  S5      = vc->S5; /* S5[s][i] holds next base 5' of i in sequence s */
+                                  S3      = vc->S3; /* Sl[s][i] holds next base 3' of i in sequence s */
+                                  Ss      = vc->Ss;
+                                  a2s     = vc->a2s;
+                                  n_seq   = vc->n_seq;
+                                  types   = (int *)vrna_alloc(n_seq * sizeof(int));
+
+                                  for(ss = 0; ss < n_seq; ss++){
+                                    types[ss] = md->pair[S[ss][i]][S[ss][j]];
+                                    if(types[ss] == 0){
+                                      types[ss] = 7;
+                                    }
+                                  }
+                                  break;
+
+    default:                      return INF;
+                                  break;
+  }
+
+  p = i;
+  q = j;
+
+  while(p < q){ /* process all stacks and interior loops */
+    int type_2;
+    while(pt[++p] == 0);
+    while(pt[--q] == 0);
+    if((pt[q] != (short)p) || (p > q))
+      break;
+    ee = 0;
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     type_2 = md->pair[s[q]][s[p]];
+                                    if(type_2 == 0){
+                                      type_2 = 7;
+                                      if(verbosity_level > verbosity_quiet)
+                                        vrna_message_warning( "bases %d and %d (%c%c) can't pair!",
+                                                              p, q,
+                                                              string[p - 1],
+                                                              string[q - 1]);
+                                    }
+                                    ee = eval_int_loop(vc, i, j, p, q);
+
+                                    type = rtype[type_2];
+                                    break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:  for(ss = 0; ss < n_seq; ss++){
+                                      type_2 = md->pair[S[ss][q]][S[ss][p]];
+                                      if(type_2 == 0){
+                                        type_2 = 7;
+                                      }
+                                      ee += E_IntLoop(a2s[ss][p - 1] - a2s[ss][i],
+                                                      a2s[ss][j - 1] - a2s[ss][q],
+                                                      types[ss],
+                                                      type_2,
+                                                      S3[ss][i],
+                                                      S5[ss][j],
+                                                      S5[ss][p],
+                                                      S3[ss][q],
+                                                      P);
+                                    }
+
+                                    for(ss = 0; ss < n_seq; ss++){
+                                      types[ss] = md->pair[S[ss][p]][S[ss][q]];
+                                      if(types[ss] == 0)
+                                        types[ss] = 7;
+                                    }
+                                    break;
+
+      default:                      break; /* this should never happen */
+    }
+
+    if(verbosity_level > 0)
+      print_eval_int_loop(out, i, j, string[i - 1], string[j - 1],
+                               p, q, string[p - 1], string[q - 1],
+                               ee);
+
+    energy += ee;
+    i = p;
+    j = q;
+  } /* end while */
+
+  /* p,q don't pair must have found hairpin or multiloop */
+
+  if(p > q){  /* hairpin */
+    ee      = vrna_eval_hp_loop(vc, i, j);
+    energy  += ee;
+
+    if(verbosity_level > 0)
+      print_eval_hp_loop(out, i, j, string[i - 1], string[j - 1], ee);
+
+    free(types);
+
+    return energy;
+  }
+
+  /* (i,j) is exterior pair of multiloop */
+  while(p < j){
+    /* add up the contributions of the substructures of the ML */
+    energy += stack_energy(vc, p, pt, out, verbosity_level);
+    p = pt[p];
+    /* search for next base pair in multiloop */
+    while(pt[++p] == 0);
+  }
+  
+  switch(vc->type){
+    case VRNA_FC_TYPE_SINGLE:     {
+                                    int ii = cut_in_loop(i, pt, cp);
+                                    ee = (ii==0) ? energy_of_ml_pt(vc, i, pt) : energy_of_extLoop_pt(vc, ii, pt);
+                                  }
+                                  break;
+
+    case VRNA_FC_TYPE_COMPARATIVE:  ee = energy_of_ml_pt(vc, i, pt);
+                                  break;
+
+    default:                      break; /* this should never happen */
+  }
+
+  energy += ee;
+  if(verbosity_level > 0)
+    print_eval_mb_loop(out, i, j, string[i - 1], string[j - 1], ee);
+
+  free(types);
+
+  return energy;
+}
+
+/*---------------------------------------------------------------------------*/
+
+
+
+/**
+*** Calculate the energy contribution of
+*** stabilizing dangling-ends/mismatches
+*** for all stems branching off the exterior
+*** loop
+**/
+PRIVATE int
+energy_of_extLoop_pt( vrna_fold_compound_t *vc,
+                      int i,
+                      const short *pt){
+
+  int               energy, mm5, mm3, bonus, p, q, q_prev, length, dangle_model, n_seq, cp, ss, u, start;
+  short             *s, *s1, **S, **S5, **S3;
+  unsigned short    **a2s;
+  vrna_param_t      *P;
+  vrna_md_t         *md;
+  vrna_sc_t         *sc, **scs;
+
+
+  /* helper variables for dangles == 1 case */
+  int E3_available;  /* energy of 5' part where 5' mismatch is available for current stem */
+  int E3_occupied;   /* energy of 5' part where 5' mismatch is unavailable for current stem */
+
+
+  /* initialize vars */
+  length        = vc->length;
+  cp            = vc->cutpoint;
+  P             = vc->params;
+  md            = &(P->model_details);
+  dangle_model  = md->dangles;
+
+  energy        = 0;
+  bonus         = 0;
+  p = start     = (i==0) ? 1 : i;
+  q_prev        = -1;
+
+  if(dangle_model % 2 == 1){
+    E3_available = INF;
+    E3_occupied  = 0;
+  }
+
+  /* seek to opening base of first stem */
+  while(p <= length && !pt[p]) p++;
+
+  switch(vc->type){
+    case VRNA_FC_TYPE_SINGLE:     s  = vc->sequence_encoding2;
+                                  s1 = vc->sequence_encoding;
+                                  sc = vc->sc;
+
+                                  /* add soft constraints for first unpaired nucleotides */
+                                  if(sc){
+                                    if(sc->energy_up)
+                                      bonus += sc->energy_up[start][p - start];
+                                    /* how do we handle generalized soft constraints here ? */
+                                  }
+                                  break;
+
+    case VRNA_FC_TYPE_COMPARATIVE:  S     = vc->S;
+                                  S5    = vc->S5;     /* S5[s][i] holds next base 5' of i in sequence s */
+                                  S3    = vc->S3;     /* Sl[s][i] holds next base 3' of i in sequence s */
+                                  a2s   = vc->a2s;
+                                  n_seq = vc->n_seq;
+                                  scs   = vc->scs;
+
+                                  /* add soft constraints for first unpaired nucleotides */
+                                  if(scs){
+                                    for(ss = 0; ss < n_seq; ss++){
+                                      if(scs[ss]){
+                                        if(scs[ss]->energy_up){
+                                          u      = a2s[ss][p] - a2s[ss][start];
+                                          bonus += scs[ss]->energy_up[a2s[ss][start]][u];
+                                        }
+                                        /* how do we handle generalized soft constraints here ? */
+                                      }
+                                    }
+                                  }
+                                  break;
+
+    default:                      return INF;
+                                  break;
+  }
+
+  while(p < length){
+    int tt;
+    /* p must have a pairing partner */
+    q  = (int)pt[p];
+    
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     /* get type of base pair (p,q) */
+                                    tt = md->pair[s[p]][s[q]];
+                                    if(tt == 0)
+                                      tt = 7;
+
+                                    switch(dangle_model){
+                                      /* no dangles */
+                                      case 0:   energy += E_ExtLoop(tt, -1, -1, P);
+                                                break;
+
+                                      /* the beloved double dangles */
+                                      case 2:   mm5 = ((ON_SAME_STRAND(p - 1, p, cp)) && (p>1))       ? s1[p-1] : -1;
+                                                mm3 = ((ON_SAME_STRAND(q, q + 1, cp)) && (q<length))  ? s1[q+1] : -1;
+                                                energy += E_ExtLoop(tt, mm5, mm3, P);
+                                                break;
+
+                                      default:  {
+                                                  int tmp;
+                                                  if(q_prev + 2 < p){
+                                                    E3_available = MIN2(E3_available, E3_occupied);
+                                                    E3_occupied  = E3_available;
+                                                  }
+                                                  mm5 = ((ON_SAME_STRAND(p - 1, p, cp)) && (p>1) && !pt[p-1])       ? s1[p-1] : -1;
+                                                  mm3 = ((ON_SAME_STRAND(q, q + 1, cp)) && (q<length) && !pt[q+1])  ? s1[q+1] : -1;
+                                                  tmp = MIN2(
+                                                                                E3_occupied  + E_ExtLoop(tt, -1, mm3, P),
+                                                                                E3_available + E_ExtLoop(tt, mm5, mm3, P)
+                                                                              );
+                                                  E3_available =       MIN2(
+                                                                                E3_occupied  + E_ExtLoop(tt, -1, -1, P),
+                                                                                E3_available + E_ExtLoop(tt, mm5, -1, P)
+                                                                              );
+                                                  E3_occupied = tmp;
+                                                }
+                                                break;
+
+                                    } /* end switch dangle_model */
+                                    break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:  for(ss = 0; ss < n_seq; ss++){
+                                      /* get type of base pair (p,q) */
+                                      tt = md->pair[S[ss][p]][S[ss][q]];
+                                      if(tt == 0)
+                                        tt = 7;
+
+                                      switch(dangle_model){
+                                        case 0:   energy += E_ExtLoop(tt, -1, -1, P);
+                                                  break;
+                                        
+                                        case 2:   mm5 = (a2s[ss][p] > 1) && (tt != 0) ? S5[ss][p] : -1;
+                                                  mm3 = (a2s[ss][q] < a2s[ss][S[0][0]]) ? S3[ss][q] : -1; /* why S[0][0] ??? */
+                                                  energy += E_ExtLoop(tt, mm5, mm3, P);
+                                                  break;
+
+                                        default:  break; /* odd dangles not implemented yet */
+                                      }
+                                    }
+                                    break;
+
+      default:                      break; /* this should never happen */
+    }
+
+    /* seek to the next stem */
+    p = q + 1;
+    q_prev = q;
+    while (p <= length && !pt[p]) p++;
+
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     /* add soft constraints for unpaired region */
+                                    if(sc && (q_prev + 1 <= length)){
+                                      if(sc->energy_up){
+                                        bonus += sc->energy_up[q_prev + 1][p - q_prev - 1];
+                                      }
+                                      /* how do we handle generalized soft constraints here ? */
+                                    }
+                                    break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:  if(scs){
+                                      for(ss = 0; ss < n_seq; ss++){
+                                        if(scs[ss]){
+                                          if(scs[ss]->energy_up){
+                                            u = a2s[ss][p] - a2s[ss][q_prev + 1];
+                                            bonus += scs[ss]->energy_up[a2s[ss][q_prev + 1]][u];
+                                          }
+                                        }
+                                      }
+                                    }
+                                    break;
+
+      default:                      break; /* this should never happen */
+    }
+
+    if(p == i)
+      break; /* cut was in loop */
+  }
+
+  if(dangle_model % 2 == 1)
+    energy = MIN2(E3_occupied, E3_available);
+
+  return energy + bonus;
+}
+
+/**
+*** i is the 5'-base of the closing pair
+***
+*** since each helix can coaxially stack with at most one of its
+*** neighbors we need an auxiliarry variable  cx_energy
+*** which contains the best energy given that the last two pairs stack.
+*** energy  holds the best energy given the previous two pairs do not
+*** stack (i.e. the two current helices may stack)
+*** We don't allow the last helix to stack with the first, thus we have to
+*** walk around the Loop twice with two starting points and take the minimum
+***/
+PRIVATE int
+energy_of_ml_pt(vrna_fold_compound_t *vc,
+                int i,
+                const short *pt){
+
+  int               energy, cx_energy, tmp, tmp2, best_energy=INF, bonus, *idx, cp, dangle_model, logML, circular, *rtype, ss, n, n_seq;
+  int               i1, j, p, q, q_prev, q_prev2, u, uu, x, type, count, mm5, mm3, tt, ld5, new_cx, dang5, dang3, dang;
+  int               e_stem, e_stem5, e_stem3, e_stem53;
+  int               mlintern[NBPAIRS+1];
+  short             *s, *s1, **S, **S5, **S3;
+  unsigned short    **a2s;
+  vrna_param_t      *P;
+  vrna_md_t         *md;
+  vrna_sc_t         *sc, **scs;
+
+  /* helper variables for dangles == 1|5 case */
+  int E_mm5_available;  /* energy of 5' part where 5' mismatch of current stem is available */
+  int E_mm5_occupied;   /* energy of 5' part where 5' mismatch of current stem is unavailable */
+  int E2_mm5_available; /* energy of 5' part where 5' mismatch of current stem is available with possible 3' dangle for enclosing pair (i,j) */
+  int E2_mm5_occupied;  /* energy of 5' part where 5' mismatch of current stem is unavailable with possible 3' dangle for enclosing pair (i,j) */
+
+  n   = vc->length;
+  cp  = vc->cutpoint;
+  P   = vc->params;
+  md  = &(P->model_details);
+  idx = vc->jindx;
+
+  circular      = md->circ;
+  dangle_model  = md->dangles;
+  logML         = md->logML;
+  rtype         = &(md->rtype[0]);
+
+  bonus = 0;
+
+  if(i >= pt[i]){
+    vrna_message_warning("energy_of_ml_pt: i is not 5' base of a closing pair!");
+    return INF;
+  }
+
+  j = (i == 0) ? n + 1 : (int)pt[i];
+
+  switch(vc->type){
+    case VRNA_FC_TYPE_SINGLE:     s   = vc->sequence_encoding2;
+                                  s1  = vc->sequence_encoding;
+                                  sc  = vc->sc;
+
+                                  if(i != 0){ /* (i,j) is closing pair of multibranch loop, add soft constraints */
+                                    if(sc){
+                                      if(sc->energy_bp)
+                                        bonus += sc->energy_bp[idx[j] + i];
+                                    }
+                                  }
+                                  break;
+
+    case VRNA_FC_TYPE_COMPARATIVE:  S     = vc->S;
+                                  S5    = vc->S5;
+                                  S3    = vc->S3;
+                                  a2s   = vc->a2s;
+                                  n_seq = vc->n_seq;
+                                  scs   = vc->scs;
+
+                                  if((dangle_model % 2) || (dangle_model > 2) || (dangle_model < 0)){
+                                    vrna_message_warning("consensus structure evaluation for odd dangle models not implemented (yet)!");
+                                    return INF;
+                                  }
+
+                                  if(i != 0){ /* (i,j) is closing pair of multibranch loop, add soft constraints */
+                                    if(scs){
+                                      for(ss = 0; ss < n_seq; ss++){
+                                        if(scs[ss] && scs[ss]->energy_bp)
+                                          bonus += scs[ss]->energy_bp[idx[j] + i];
+                                      }
+                                    }
+                                  }
+                                  break;
+
+    default:                      return INF;
+                                  break;
+  }
+
+  /* init the variables */
+  energy      = 0;
+  u           = 0; /* the total number of unpaired nucleotides */
+  p           = i+1;
+  q_prev      = i-1;
+  q_prev2     = i;
+
+
+  for (x = 0; x <= NBPAIRS; x++)
+    mlintern[x] = P->MLintern[x];
+
+  /* seek to opening base of first stem */
+  while(p <= j && !pt[p])
+    p++;
+
+  /* add bonus energies for first stretch of unpaired nucleotides */
+  switch(vc->type){
+    case VRNA_FC_TYPE_SINGLE:     u += p - i - 1;
+                                  if(sc){
+                                    if(sc->energy_up)
+                                      bonus += sc->energy_up[i + 1][u];
+                                  }
+                                  break;
+
+    case VRNA_FC_TYPE_COMPARATIVE:  if(scs){
+                                    for(ss = 0; ss < n_seq; ss++){
+                                      uu = a2s[ss][p] - a2s[ss][i + 1];
+                                      if(scs[ss] && scs[ss]->energy_up){
+                                        bonus += scs[ss]->energy_up[a2s[ss][i + 1]][uu];
+                                      }
+                                      u += uu;
+                                    }
+                                  } else {
+                                    for(ss = 0; ss < n_seq; ss++){
+                                      u += a2s[ss][p] - a2s[ss][i + 1];
+                                    }
+                                  }
+                                  break;
+
+    default:                      break; /* this should never happen */
+  }
+
+  switch(dangle_model){
+    case 0:   switch(vc->type){
+                case VRNA_FC_TYPE_SINGLE:     while(p < j){
+                                                /* p must have a pairing partner */
+                                                q  = (int)pt[p];
+                                                /* get type of base pair (p,q) */
+                                                tt = md->pair[s[p]][s[q]];
+                                                if(tt==0) tt=7;
+                                                energy += E_MLstem(tt, -1, -1, P);
+
+                                                /* seek to the next stem */
+                                                p = q + 1;
+                                                q_prev = q_prev2 = q;
+                                                while (p <= j && !pt[p]) p++;
+                                                u += p - q - 1; /* add unpaired nucleotides */
+
+                                                if(sc){
+                                                  if(sc->energy_up)
+                                                    bonus += sc->energy_up[q+1][p-q-1];
+                                                }
+                                              }
+
+                                              /* now lets get the energy of the enclosing stem */
+                                              if(i > 0){  /* actual closing pair */
+                                                tt = md->pair[s[j]][s[i]];
+                                                if(tt == 0)
+                                                  tt = 7;
+                                                energy += E_MLstem(tt, -1, -1, P);
+
+                                              } else {  /* virtual closing pair */
+                                                energy += E_MLstem(0, -1, -1, P);
+                                              }
+                                              break;
+
+                case VRNA_FC_TYPE_COMPARATIVE:  while(p < j){
+                                                /* p must have a pairing partner */
+                                                q  = (int)pt[p];
+                                                for(ss = 0; ss < n_seq; ss++){
+                                                  /* get type of base pair (p,q) */
+                                                  tt = md->pair[S[ss][p]][S[ss][q]];
+                                                  if(tt == 0)
+                                                    tt = 7;
+                                                  energy += E_MLstem(tt, -1, -1, P);
+                                                }
+
+                                                /* seek to the next stem */
+                                                p = q + 1;
+                                                q_prev = q_prev2 = q;
+                                                while (p <= j && !pt[p]) p++;
+                                                
+                                                /* add unpaired nucleotides and possible soft constraints */
+                                                if(scs){
+                                                  for(ss = 0; ss < n_seq; ss++){
+                                                    uu = a2s[ss][p] - a2s[ss][q + 1]; 
+                                                    if(scs[ss] && scs[ss]->energy_up){
+                                                      bonus += sc->energy_up[a2s[ss][q + 1]][uu];
+                                                    }
+                                                    u += uu;
+                                                  }
+                                                } else {
+                                                  for(ss = 0; ss < n_seq; ss++){
+                                                    u += a2s[ss][p] - a2s[ss][q + 1];
+                                                  }
+                                                }
+                                              }
+
+                                              /* now lets get the energy of the enclosing stem */
+                                              if(i > 0){  /* actual closing pair */
+                                                for(ss = 0; ss < n_seq; ss++){
+                                                  tt = md->pair[S[ss][j]][S[ss][i]];
+                                                  if(tt == 0)
+                                                    tt = 7;
+                                                  energy += E_MLstem(tt, -1, -1, P);
+                                                }
+                                              }
+                                              break;
+
+                default:                      break; /* this should never happen */
+              }
+              break;
+
+    case 2:   switch(vc->type){
+                case VRNA_FC_TYPE_SINGLE:     while(p < j){
+                                                /* p must have a pairing partner */
+                                                q  = (int)pt[p];
+                                                /* get type of base pair (p,q) */
+                                                tt = md->pair[s[p]][s[q]];
+                                                if(tt == 0)
+                                                  tt = 7;
+                                                mm5 = ON_SAME_STRAND(p - 1, p, cp) ? s1[p-1] : -1;
+                                                mm3 = ON_SAME_STRAND(q, q + 1, cp) ? s1[q+1] : -1;
+                                                energy += E_MLstem(tt, mm5, mm3, P);
+
+                                                /* seek to the next stem */
+                                                p = q + 1;
+                                                q_prev = q_prev2 = q;
+                                                while (p <= j && !pt[p]) p++;
+                                                u += p - q - 1; /* add unpaired nucleotides */
+
+                                                if(sc){
+                                                  if(sc->energy_up)
+                                                    bonus += sc->energy_up[q+1][p-q-1];
+                                                }
+                                              }
+                                              if(i > 0){  /* actual closing pair */
+                                                tt = md->pair[s[j]][s[i]];
+                                                if(tt == 0)
+                                                  tt = 7;
+                                                mm5 = ON_SAME_STRAND(j - 1, j, cp) ? s1[j-1] : -1;
+                                                mm3 = ON_SAME_STRAND(i, i + 1, cp) ? s1[i+1] : -1;
+                                                energy += E_MLstem(tt, mm5, mm3, P);
+
+                                              } else {  /* virtual closing pair */
+                                                energy += E_MLstem(0, -1, -1, P);
+                                              }
+                                              break;
+
+                case VRNA_FC_TYPE_COMPARATIVE:  while(p < j){
+                                                /* p must have a pairing partner */
+                                                q  = (int)pt[p];
+                                                
+                                                for(ss = 0; ss < n_seq; ss++){
+                                                  /* get type of base pair (p,q) */
+                                                  tt = md->pair[S[ss][p]][S[ss][q]];
+                                                  if(tt == 0)
+                                                    tt = 7;
+
+                                                  mm5 = ((a2s[ss][p] > 1) || circular) ? S5[ss][p] : -1;
+                                                  mm3 = ((a2s[ss][q] < a2s[ss][S[0][0]]) || circular) ? S3[ss][q] : -1;
+                                                  energy += E_MLstem(tt, mm5, mm3, P);
+                                                }
+
+                                                /* seek to the next stem */
+                                                p = q + 1;
+                                                q_prev = q_prev2 = q;
+                                                while (p <= j && !pt[p]) p++;
+
+                                                /* add unpaired nucleotides and possible soft constraints */
+                                                if(scs){
+                                                  for(ss = 0; ss < n_seq; ss++){
+                                                    uu = a2s[ss][p] - a2s[ss][q + 1]; 
+                                                    if(scs[ss] && scs[ss]->energy_up){
+                                                      bonus += sc->energy_up[a2s[ss][q + 1]][uu];
+                                                    }
+                                                    u += uu;
+                                                  }
+                                                } else {
+                                                  for(ss = 0; ss < n_seq; ss++){
+                                                    u += a2s[ss][p] - a2s[ss][q + 1];
+                                                  }
+                                                }
+                                              }
+
+                                              if(i > 0){  /* actual closing pair */
+                                                for(ss = 0; ss < n_seq; ss++){
+                                                  tt = md->pair[S[ss][j]][S[ss][i]];
+                                                  if(tt == 0)
+                                                    tt = 7;
+
+                                                  mm5 = S5[ss][j];
+                                                  mm3 = S3[ss][i];
+                                                  energy += E_MLstem(tt, mm5, mm3, P);
+                                                }
+                                              }
+                                              break;
+
+                default:                      break; /* this should never happen */
+              }
+              break;
+
+    case 3:   /* we treat helix stacking different */
+              for (count=0; count<2; count++) { /* do it twice */
+                ld5 = 0; /* 5' dangle energy on prev pair (type) */
+                if ( i==0 ) {
+                  j = (unsigned int)pt[0]+1;
+                  type = 0;  /* no pair */
+                }
+                else {
+                  j = (unsigned int)pt[i];
+                  type = P->model_details.pair[s[j]][s[i]]; if (type==0) type=7;
+                  /* prime the ld5 variable */
+                  if (ON_SAME_STRAND(j - 1, j, cp)) {
+                    ld5 = P->dangle5[type][s1[j-1]];
+                    if ((p=(unsigned int)pt[j-2]) && ON_SAME_STRAND(j - 2, j - 1, cp))
+                    if (P->dangle3[P->model_details.pair[s[p]][s[j-2]]][s1[j-1]]<ld5) ld5 = 0;
+                  }
+                }
+                i1=i; p = i+1; u=0;
+                energy = 0; cx_energy=INF;
+                do { /* walk around the multi-loop */
+                  new_cx = INF;
+
+                  /* hop over unpaired positions */
+                  while (p <= (unsigned int)pt[0] && pt[p]==0) p++;
+
+                  /* memorize number of unpaired positions */
+                  u += p-i1-1;
+
+                  if(sc){
+                    if(sc->energy_up)
+                      bonus += sc->energy_up[i1+1][p-i1-1];
+                  }
+
+                  /* get position of pairing partner */
+                  if ( p == (unsigned int)pt[0]+1 ){
+                    q = 0;tt = 0; /* virtual root pair */
+                  } else {
+                    q  = (unsigned int)pt[p];
+                    /* get type of base pair P->q */
+                    tt = P->model_details.pair[s[p]][s[q]]; if (tt==0) tt=7;
+                  }
+
+                  energy += mlintern[tt];
+                  cx_energy += mlintern[tt];
+
+                  dang5=dang3=0;
+                  if ((ON_SAME_STRAND(p - 1, p, cp))&&(p>1))
+                    dang5=P->dangle5[tt][s1[p-1]];      /* 5'dangle of pq pair */
+                  if ((ON_SAME_STRAND(i1, i1 + 1, cp))&&(i1<(unsigned int)s[0]))
+                    dang3 = P->dangle3[type][s1[i1+1]]; /* 3'dangle of previous pair */
+
+                  switch (p-i1-1) {
+                    case 0:   /* adjacent helices */
+                              if (i1!=0){
+                                if (ON_SAME_STRAND(i1, p, cp)) {
+                                  new_cx = energy + P->stack[rtype[type]][rtype[tt]];
+                                  /* subtract 5'dangle and TerminalAU penalty */
+                                  new_cx += -ld5 - mlintern[tt]-mlintern[type]+2*mlintern[1];
+                                }
+                                ld5=0;
+                                energy = MIN2(energy, cx_energy);
+                              }
+                              break;
+                    case 1:   /* 1 unpaired base between helices */
+                              dang = MIN2(dang3, dang5);
+                              energy = energy +dang; ld5 = dang - dang3;
+                              /* may be problem here: Suppose
+                                cx_energy>energy, cx_energy+dang5<energy
+                                and the following helices are also stacked (i.e.
+                                we'll subtract the dang5 again */
+                              if (cx_energy+dang5 < energy) {
+                                energy = cx_energy+dang5;
+                                ld5 = dang5;
+                              }
+                              new_cx = INF;  /* no coax stacking with mismatch for now */
+                              break;
+                    default:  /* many unpaired base between helices */
+                              energy += dang5 +dang3;
+                              energy = MIN2(energy, cx_energy + dang5);
+                              new_cx = INF;  /* no coax stacking possible */
+                              ld5 = dang5;
+                              break;
+                  }
+                  type = tt;
+                  cx_energy = new_cx;
+                  i1 = q; p=q+1;
+                } while (q!=i);
+                best_energy = MIN2(energy, best_energy); /* don't use cx_energy here */
+                /* skip a helix and start again */
+                while (pt[p]==0) p++;
+                if (i == (unsigned int)pt[p]) break;
+                i = (unsigned int)pt[p];
+              } /* end doing it twice */
+              energy = best_energy;
+              break;
+
+    default:  E_mm5_available = E2_mm5_available  = INF;
+              E_mm5_occupied  = E2_mm5_occupied   = 0;
+              while(p < j){
+                /* p must have a pairing partner */
+                q  = (int)pt[p];
+                /* get type of base pair (p,q) */
+                tt = P->model_details.pair[s[p]][s[q]];
+                if(tt==0) tt=7;
+                if(q_prev + 2 < p){
+                  E_mm5_available = MIN2(E_mm5_available, E_mm5_occupied);
+                  E_mm5_occupied  = E_mm5_available;
+                }
+                if(q_prev2 + 2 < p){
+                  E2_mm5_available  = MIN2(E2_mm5_available, E2_mm5_occupied);
+                  E2_mm5_occupied   = E2_mm5_available;
+                }
+                mm5 = ((ON_SAME_STRAND(p - 1, p, cp)) && !pt[p-1])  ? s1[p-1] : -1;
+                mm3 = ((ON_SAME_STRAND(q, q + 1, cp)) && !pt[q+1])  ? s1[q+1] : -1;
+                e_stem    = E_MLstem(tt, -1, -1, P);
+                e_stem5   = E_MLstem(tt, mm5, -1, P);
+                e_stem3   = E_MLstem(tt, -1, mm3, P);
+                e_stem53  = E_MLstem(tt, mm5, mm3, P);
+
+                tmp   = E_mm5_occupied + e_stem3;
+                tmp   = MIN2(tmp, E_mm5_available + e_stem53);
+                tmp   = MIN2(tmp, E_mm5_available + e_stem3);
+                tmp2  = E_mm5_occupied + e_stem;
+                tmp2  = MIN2(tmp2, E_mm5_available + e_stem5);
+                tmp2  = MIN2(tmp2, E_mm5_available + e_stem);
+
+                E_mm5_occupied  = tmp;
+                E_mm5_available = tmp2;
+
+                tmp   = E2_mm5_occupied + e_stem3;
+                tmp   = MIN2(tmp, E2_mm5_available + e_stem53);
+                tmp   = MIN2(tmp, E2_mm5_available + e_stem3);
+                tmp2  = E2_mm5_occupied + e_stem;
+                tmp2  = MIN2(tmp2, E2_mm5_available + e_stem5);
+                tmp2  = MIN2(tmp2, E2_mm5_available + e_stem);
+
+                E2_mm5_occupied   = tmp;
+                E2_mm5_available  = tmp2;
+
+                /* seek to the next stem */
+                p = q + 1;
+                q_prev = q_prev2 = q;
+                while (p <= j && !pt[p]) p++;
+                u += p - q - 1; /* add unpaired nucleotides */
+
+                if(sc){
+                  if(sc->energy_up)
+                    bonus += sc->energy_up[q+1][p-q-1];
+                }
+              }
+              if(i > 0){  /* actual closing pair */
+                type = P->model_details.pair[s[j]][s[i]]; if (type==0) type=7;
+                mm5 = ((ON_SAME_STRAND(j - 1, j, cp)) && !pt[j-1])  ? s1[j-1] : -1;
+                mm3 = ((ON_SAME_STRAND(i, i + 1, cp)) && !pt[i+1])  ? s1[i+1] : -1;
+                if(q_prev + 2 < p){
+                  E_mm5_available = MIN2(E_mm5_available, E_mm5_occupied);
+                  E_mm5_occupied  = E_mm5_available;
+                }
+                if(q_prev2 + 2 < p){
+                  E2_mm5_available  = MIN2(E2_mm5_available, E2_mm5_occupied);
+                  E2_mm5_occupied   = E2_mm5_available;
+                }
+                e_stem    = E_MLstem(type, -1, -1, P);
+                e_stem5   = E_MLstem(type, mm5, -1, P);
+                e_stem3   = E_MLstem(type, -1, mm3, P);
+                e_stem53  = E_MLstem(type, mm5, mm3, P);
+              } else {  /* virtual closing pair */
+                e_stem = e_stem5 = e_stem3 = e_stem53 = E_MLstem(0, -1, -1, P);
+              }
+              /* now lets see how we get the minimum including the enclosing stem */
+              energy = E_mm5_occupied  + e_stem;
+              energy = MIN2(energy, E_mm5_available   + e_stem5);
+              energy = MIN2(energy, E_mm5_available   + e_stem);
+              energy = MIN2(energy, E2_mm5_occupied   + e_stem3);
+              energy = MIN2(energy, E2_mm5_occupied   + e_stem);
+              energy = MIN2(energy, E2_mm5_available  + e_stem53);
+              energy = MIN2(energy, E2_mm5_available  + e_stem3);
+              energy = MIN2(energy, E2_mm5_available  + e_stem5);
+              energy = MIN2(energy, E2_mm5_available  + e_stem);
+              break;
+  }/* end switch dangle_model */
+
+  switch(vc->type){
+    case VRNA_FC_TYPE_SINGLE:     energy += P->MLclosing;
+                                  break;
+
+    case VRNA_FC_TYPE_COMPARATIVE:  energy += P->MLclosing * n_seq;
+                                  break;
+
+    default:                      break;
+  }
+
+  /* logarithmic ML loop energy if logML */
+  /* does this work for comparative predictions as well? */
+  if(logML && (u>6))
+    energy += 6*P->MLbase+(int)(P->lxc*log((double)u/6.));
+  else
+    energy += (u*P->MLbase);
+
+  return energy + bonus;
+}
+
+
+
+PRIVATE int
+cut_in_loop(int i, const short *pt, int cp){
+
+  /* walk around the loop;  return j pos of pair after cut if
+     cut_point in loop else 0 */
+  int  p, j;
+  p = j = pt[i];
+  do {
+    i  = pt[p];  p = i+1;
+    while ( pt[p]==0 ) p++;
+  } while (p!=j && ON_SAME_STRAND(i, p, cp));
+  return ON_SAME_STRAND(i, p, cp) ? 0 : j;
+}
+
+/* below are the consensus structure evaluation functions */
+
+PRIVATE int
+covar_energy_of_struct_pt(vrna_fold_compound_t *vc,
+                              const short *pt){
+
+  int e       = 0;
+  int length  = vc->length;
+  int i;
+
+  for (i=1; i<=length; i++) {
+    if (pt[i]==0) continue;
+    e += stack_energy_covar_pt(vc, i, pt);
+    i=pt[i];
+  }
+
+  return e;
+}
+
+
+PRIVATE int
+en_corr_of_loop_gquad_ali(vrna_fold_compound_t *vc,
+                      int i,
+                      int j,
+                      const char *structure,
+                      const short *pt,
+                      const int *loop_idx){
+
+  int pos, energy, p, q, r, s, u, type, type2, gq_en[2];
+  int num_elem, num_g, elem_i, elem_j, up_mis;
+  int L, l[3];
+
+  short           **S           = vc->S;
+  short           **S5          = vc->S5;     /*S5[s][i] holds next base 5' of i in sequence s*/
+  short           **S3          = vc->S3;     /*Sl[s][i] holds next base 3' of i in sequence s*/
+  char            **Ss          = vc->Ss;
+  unsigned short  **a2s         = vc->a2s;
+  vrna_param_t    *P            = vc->params;
+  vrna_md_t       *md           = &(P->model_details);
+  int             n_seq         = vc->n_seq;
+  int             dangle_model  = md->dangles;
+
+  energy = 0;
+  q = i;
+  while((pos = parse_gquad(structure + q-1, &L, l)) > 0){
+    q += pos-1;
+    p = q - 4*L - l[0] - l[1] - l[2] + 1;
+    if(q > j) break;
+    /* we've found the first g-quadruplex at position [p,q] */
+    E_gquad_ali_en(p, L, l, (const short **)S, n_seq, gq_en, P);
+    energy    += gq_en[0];
+    /* check if it's enclosed in a base pair */
+    if(loop_idx[p] == 0){ q++; continue; /* g-quad in exterior loop */}
+    else{
+      energy += E_MLstem(0, -1, -1, P) * n_seq;
+      /*  find its enclosing pair */
+      num_elem  = 0;
+      num_g     = 1;
+      r         = p - 1;
+      up_mis    = q - p + 1;
+
+      /* seek for first pairing base located 5' of the g-quad */
+      for(r = p - 1; !pt[r] && (r >= i); r--);
+      if(r < i)
+        vrna_message_error("this should not happen");
+
+      if(r < pt[r]){ /* found the enclosing pair */
+        s = pt[r];
+      } else {
+        num_elem++;
+        elem_i = pt[r];
+        elem_j = r;
+        r = pt[r]-1 ;
+        /* seek for next pairing base 5' of r */
+        for(; !pt[r] && (r >= i); r--);
+        if(r < i)
+          vrna_message_error("so nich");
+        if(r < pt[r]){ /* found the enclosing pair */
+          s = pt[r];
+        } else {
+          /* hop over stems and unpaired nucleotides */
+          while((r > pt[r]) && (r >= i)){
+            if(pt[r]){ r = pt[r]; num_elem++;}
+            r--;
+          }
+          if(r < i)
+            vrna_message_error("so nich");
+          s = pt[r]; /* found the enclosing pair */
+        }
+      }
+      /* now we have the enclosing pair (r,s) */
+
+      u = q+1;
+      /* we know everything about the 5' part of this loop so check the 3' part */
+      while(u<s){
+        if(structure[u-1] == '.') u++;
+        else if (structure[u-1] == '+'){ /* found another gquad */
+          pos = parse_gquad(structure + u - 1, &L, l);
+          if(pos > 0){
+            E_gquad_ali_en(u, L, l, (const short **)S, n_seq, gq_en, P);
+            energy += gq_en[0] + E_MLstem(0, -1, -1, P) * n_seq;
+            up_mis += pos;
+            u += pos;
+            num_g++;
+          }
+        } else { /* we must have found a stem */
+          if(!(u < pt[u]))
+            vrna_message_error("wtf!");
+          num_elem++;
+          elem_i = u;
+          elem_j = pt[u];
+          energy += en_corr_of_loop_gquad_ali(vc,
+                                u,
+                                pt[u],
+                                structure,
+                                pt,
+                                loop_idx);
+          u = pt[u] + 1;
+        }
+      }
+      if(u!=s)
+        vrna_message_error("what the ...");
+      else{ /* we are done since we've found no other 3' structure element */
+        switch(num_elem){
+          /* g-quad was misinterpreted as hairpin closed by (r,s) */
+          case 0:   /*if(num_g == 1)
+                      if((p-r-1 == 0) || (s-q-1 == 0))
+                        vrna_message_error("too few unpaired bases");
+                    */
+                    {
+                      int ee = 0;
+                      int cnt;
+                      for(cnt=0;cnt<n_seq;cnt++){
+                        type = md->pair[S[cnt][r]][S[cnt][s]];
+                        if(type == 0) type = 7;
+                        if ((a2s[cnt][s-1]-a2s[cnt][r])<3) ee+=600;
+                        else ee += E_Hairpin( a2s[cnt][s-1] - a2s[cnt][r],
+                                              type,
+                                              S3[cnt][r],
+                                              S5[cnt][s],
+                                              Ss[cnt] + a2s[cnt][r-1],
+                                              P);
+                      }
+                      energy -= ee;
+                      ee = 0;
+                      for(cnt=0;cnt < n_seq; cnt++){
+                        type = md->pair[S[cnt][r]][S[cnt][s]];
+                        if(type == 0) type = 7;
+                        if(dangle_model == 2)
+                          ee += P->mismatchI[type][S3[cnt][r]][S5[cnt][s]];
+                        if(type > 2)
+                          ee += P->TerminalAU;
+                      }
+                      energy += ee;
+                    }
+                    energy += n_seq * P->internal_loop[s-r-1-up_mis];
+                    break;
+          /* g-quad was misinterpreted as interior loop closed by (r,s) with enclosed pair (elem_i, elem_j) */
+          case 1:   {
+                      int ee = 0;
+                      int cnt;
+                      for(cnt = 0; cnt<n_seq;cnt++){
+                        type = md->pair[S[cnt][r]][S[cnt][s]];
+                        if(type == 0) type = 7;
+                        type2 = md->pair[S[cnt][elem_j]][S[cnt][elem_i]];
+                        if(type2 == 0) type2 = 7;
+                        ee += E_IntLoop(a2s[cnt][elem_i-1] - a2s[cnt][r],
+                                        a2s[cnt][s-1] - a2s[cnt][elem_j],
+                                        type,
+                                        type2,
+                                        S3[cnt][r],
+                                        S5[cnt][s],
+                                        S5[cnt][elem_i],
+                                        S3[cnt][elem_j],
+                                        P);
+                      }
+                      energy -= ee;
+                      ee = 0;
+                      for(cnt = 0; cnt < n_seq; cnt++){
+                        type = md->pair[S[cnt][s]][S[cnt][r]];
+                        if(type == 0) type = 7;
+                        ee += E_MLstem(type, S5[cnt][s], S3[cnt][r], P);
+                        type = md->pair[S[cnt][elem_i]][S[cnt][elem_j]];
+                        if(type == 0) type = 7;
+                        ee += E_MLstem(type, S5[cnt][elem_i], S3[cnt][elem_j], P);
+                      }
+                      energy += ee;
+                    }
+                    energy += (P->MLclosing + (elem_i-r-1+s-elem_j-1-up_mis) * P->MLbase) * n_seq;
+                    break;
+          /* gquad was misinterpreted as unpaired nucleotides in a multiloop */
+          default:  energy -= (up_mis) * P->MLbase * n_seq;
+                    break;
+        }
+      }
+      q = s+1;
+    }
+  }
+
+  return energy;
+
+}
+
+PRIVATE int
+covar_en_corr_of_loop_gquad(vrna_fold_compound_t *vc,
+                            int i,
+                            int j,
+                            const char *structure,
+                            const short *pt,
+                            const int *loop_idx){
+
+  int pos, en_covar, p, q, r, s, u, gq_en[2];
+  int num_elem, num_g, up_mis;
+  int L, l[3];
+
+  short           **S           = vc->S;
+  vrna_param_t    *P            = vc->params;
+  int             n_seq         = vc->n_seq;
+
+  en_covar = 0;
+  q = i;
+  while((pos = parse_gquad(structure + q-1, &L, l)) > 0){
+    q += pos-1;
+    p = q - 4*L - l[0] - l[1] - l[2] + 1;
+    if(q > j) break;
+    /* we've found the first g-quadruplex at position [p,q] */
+    E_gquad_ali_en(p, L, l, (const short **)S, n_seq, gq_en, P);
+    en_covar  += gq_en[1];
+    /* check if it's enclosed in a base pair */
+    if(loop_idx[p] == 0){ q++; continue; /* g-quad in exterior loop */}
+    else{
+      /*  find its enclosing pair */
+      num_elem  = 0;
+      num_g     = 1;
+      r         = p - 1;
+      up_mis    = q - p + 1;
+
+      /* seek for first pairing base located 5' of the g-quad */
+      for(r = p - 1; !pt[r] && (r >= i); r--);
+      if(r < i)
+        vrna_message_error("this should not happen");
+
+      if(r < pt[r]){ /* found the enclosing pair */
+        s = pt[r];
+      } else {
+        num_elem++;
+        r = pt[r]-1 ;
+        /* seek for next pairing base 5' of r */
+        for(; !pt[r] && (r >= i); r--);
+        if(r < i)
+          vrna_message_error("so nich");
+        if(r < pt[r]){ /* found the enclosing pair */
+          s = pt[r];
+        } else {
+          /* hop over stems and unpaired nucleotides */
+          while((r > pt[r]) && (r >= i)){
+            if(pt[r]){ r = pt[r]; num_elem++;}
+            r--;
+          }
+          if(r < i)
+            vrna_message_error("so nich");
+          s = pt[r]; /* found the enclosing pair */
+        }
+      }
+      /* now we have the enclosing pair (r,s) */
+
+      u = q+1;
+      /* we know everything about the 5' part of this loop so check the 3' part */
+      while(u<s){
+        if(structure[u-1] == '.') u++;
+        else if (structure[u-1] == '+'){ /* found another gquad */
+          pos = parse_gquad(structure + u - 1, &L, l);
+          if(pos > 0){
+            E_gquad_ali_en(u, L, l, (const short **)S, n_seq, gq_en, P);
+            en_covar += gq_en[1];
+            up_mis += pos;
+            u += pos;
+            num_g++;
+          }
+        } else { /* we must have found a stem */
+          if(!(u < pt[u]))
+            vrna_message_error("wtf!");
+          num_elem++;
+          en_covar += covar_en_corr_of_loop_gquad(vc,
+                                u,
+                                pt[u],
+                                structure,
+                                pt,
+                                loop_idx);
+          u = pt[u] + 1;
+        }
+      }
+      if(u!=s)
+        vrna_message_error("what the ...");
+      else{
+        /* we are done since we've found no other 3' structure element */
+      }
+      q = s+1;
+    }
+  }
+
+  return en_covar;
+}
+
+
+PRIVATE int
+stack_energy_covar_pt(vrna_fold_compound_t *vc,
+                      int i,
+                      const short *pt){
+
+  /* calculate energy of substructure enclosed by (i,j) */
+  int             *indx       = vc->jindx;     /* index for moving in the triangle matrices c[] and fMl[]*/
+  int             *pscore     = vc->pscore;     /* precomputed array of pair types */
+
+  int energy = 0;
+  int j, p, q;
+
+  j = pt[i];
+  p=i; q=j;
+  while (p<q) { /* process all stacks and interior loops */
+    while (pt[++p]==0);
+    while (pt[--q]==0);
+    if ((pt[q]!=(short)p)||(p>q)) break;
+    energy += pscore[indx[j]+i];
+    i=p; j=q;
+  }  /* end while */
+
+  /* p,q don't pair must have found hairpin or multiloop */
+
+  if (p>q) { /* hairpin case */
+    energy += pscore[indx[j]+i];
+    return energy;
+  }
+
+  /* (i,j) is exterior pair of multiloop */
+  energy += pscore[indx[j]+i];
+  while (p<j) {
+    /* add up the contributions of the substructures of the ML */
+    energy += stack_energy_covar_pt(vc, p, pt);
+    p = pt[p];
+    /* search for next base pair in multiloop */
+    while (pt[++p]==0);
+  }
+
+  return energy;
+}
+
+
+/*
+#################################
+# DEPRECATED functions below    #
+#################################
+*/
+
+PRIVATE vrna_fold_compound_t *
+recycle_last_call(const char *string,
+                  vrna_param_t *P){
+
+  vrna_fold_compound_t  *vc;
+  vrna_md_t           *md;
+  int                 cleanup;
+  char                *seq;
+
+  vc      = NULL;
+  cleanup = 0;
+
+  if(P){
+    md = &(P->model_details);
+  } else {
+    md = (vrna_md_t *)vrna_alloc(sizeof(vrna_md_t));
+    set_model_details(md);
+    cleanup = 1;
+  }
+
+  if(string){
+    if(backward_compat_compound){
+      if(!strcmp(string, backward_compat_compound->sequence)){ /* check if sequence is the same as before */
+        md->window_size = (int)backward_compat_compound->length;
+        if(!memcmp(md, &(backward_compat_compound->params->model_details), sizeof(vrna_md_t))){ /* check if model_details are the same as before */
+          vc = backward_compat_compound; /* re-use previous vrna_fold_compound_t */
+        }
+      }
+    }
+  }
+
+  /* prepare a new global vrna_fold_compound_t with current settings */
+  if(!vc){
+    vrna_fold_compound_free(backward_compat_compound);
+    seq = vrna_cut_point_insert(string, cut_point);
+    backward_compat_compound = vc = vrna_fold_compound(seq, md, VRNA_OPTION_EVAL_ONLY);
+    if(P){
+      free(vc->params);
+      vc->params = get_updated_params(P, 1);
+    }
+    free(seq);
+  }
+
+  if(cleanup)
+    free(md);
+
+  return vc;
+}
+
+
+PUBLIC float
+energy_of_struct( const char *string,
+                  const char *structure){
+
+  float               en;
+  vrna_fold_compound_t  *vc;
+
+  vc = recycle_last_call(string, NULL);
+
+  if(eos_debug > 0)
+    en = vrna_eval_structure_verbose(vc, structure, NULL);
+  else
+    en = vrna_eval_structure(vc, structure);
+
+  return en;
+}
+
+PUBLIC int
+energy_of_struct_pt(const char *string,
+                    short *pt,
+                    short *s,
+                    short *s1){
+
+  int                 en;
+  vrna_fold_compound_t  *vc;
+
+  if(pt && string){
+    if(pt[0] != (short)strlen(string))
+      vrna_message_error("energy_of_structure_pt: string and structure have unequal length");
+
+    vc  = recycle_last_call(string, NULL);
+    en  = eval_pt(vc, pt, NULL, eos_debug);
+
+    return en;
+  } else
+    return INF;
+}
+
+PUBLIC float
+energy_of_circ_struct(const char *string,
+                      const char *structure){
+
+  float               en;
+  vrna_fold_compound_t  *vc;
+
+  vc = recycle_last_call(string, NULL);
+
+  vc->params->model_details.circ = 1;
+
+  if(eos_debug > 0)
+    en = vrna_eval_structure_verbose(vc, structure, NULL);
+  else
+    en = vrna_eval_structure(vc, structure);
+
+  return en;
+}
+
+PUBLIC  float
+energy_of_structure(const char *string,
+                    const char *structure,
+                    int verbosity_level){
+
+  float               en;
+  vrna_fold_compound_t  *vc;
+
+  vc = recycle_last_call(string, NULL);
+
+  return vrna_eval_structure_v(vc, structure, verbosity_level, NULL);
+}
+
+PUBLIC float
+energy_of_struct_par( const char *string,
+                      const char *structure,
+                      vrna_param_t *parameters,
+                      int verbosity_level){
+
+  float               en;
+  vrna_fold_compound_t  *vc;
+
+  vc = recycle_last_call(string, parameters);
+
+  return vrna_eval_structure_v(vc, structure, verbosity_level, NULL);
+}
+
+
+PUBLIC float
+energy_of_gquad_structure(const char *string,
+                          const char *structure,
+                          int verbosity_level){
+
+  float               en;
+  vrna_fold_compound_t  *vc;
+
+  vc = recycle_last_call(string, NULL);
+
+  vc->params->model_details.gquad = 1;
+
+  return vrna_eval_structure_v(vc, structure, verbosity_level, NULL);
+}
+
+PUBLIC float
+energy_of_gquad_struct_par( const char *string,
+                            const char *structure,
+                            vrna_param_t *parameters,
+                            int verbosity_level){
+
+
+  float               en;
+  vrna_fold_compound_t  *vc;
+
+  vc = recycle_last_call(string, parameters);
+
+  vc->params->model_details.gquad = 1;
+
+  return vrna_eval_structure_v(vc, structure, verbosity_level, NULL);
+}
+
+PUBLIC int
+energy_of_structure_pt( const char *string,
+                        short *pt,
+                        short *s,
+                        short *s1,
+                        int verbosity_level){
+
+  int                 en;
+  vrna_fold_compound_t  *vc;
+
+  if(pt && string){
+    if(pt[0] != (short)strlen(string))
+      vrna_message_error("energy_of_structure_pt: string and structure have unequal length");
+
+    vc  = recycle_last_call(string, NULL);
+    en  = eval_pt(vc, pt, NULL, verbosity_level);
+
+    return en;
+  } else
+    return INF;
+}
+
+PUBLIC int
+energy_of_struct_pt_par(const char *string,
+                        short *pt,
+                        short *s,
+                        short *s1,
+                        vrna_param_t *parameters,
+                        int verbosity_level){
+
+  int en;
+  vrna_fold_compound_t *vc;
+
+  if(pt && string){
+    if(pt[0] != (short)strlen(string))
+      vrna_message_error("energy_of_structure_pt: string and structure have unequal length");
+
+    vc  = recycle_last_call(string, parameters);
+    en  = eval_pt(vc, pt, NULL, verbosity_level);
+
+    return en;
+  } else
+    return INF;
+}
+
+PUBLIC float
+energy_of_circ_structure( const char *string,
+                          const char *structure,
+                          int verbosity_level){
+
+  float               en;
+  vrna_fold_compound_t  *vc;
+
+  vc = recycle_last_call(string, NULL);
+
+  vc->params->model_details.circ = 1;
+
+  return vrna_eval_structure_v(vc, structure, verbosity_level, NULL);
+}
+
+PUBLIC float
+energy_of_circ_struct_par(const char *string,
+                          const char *structure,
+                          vrna_param_t *parameters,
+                          int verbosity_level){
+
+  float               en;
+  vrna_fold_compound_t  *vc;
+
+  vc = recycle_last_call(string, parameters);
+
+  vc->params->model_details.circ = 1;
+
+  return vrna_eval_structure_v(vc, structure, verbosity_level, NULL);
+}
+
+PUBLIC int
+loop_energy(short *pt,
+            short *s,
+            short *s1,
+            int i){
+
+  int                 en, u;
+  char                *seq;
+  vrna_md_t           md;
+  vrna_fold_compound_t  *vc;
+
+  set_model_details(&md);
+
+  /* convert encoded sequence back to actual string */
+  seq = (char *)vrna_alloc(sizeof(char) * (s[0]+1));
+  for(u = 1; u <= s[0]; u++){
+    seq[u-1] = vrna_nucleotide_decode(s[u], &md);
+  }
+  seq[u-1] = '\0';
+
+  vc  = recycle_last_call(seq, NULL);
+  en  = wrap_eval_loop_pt(vc, i, pt, eos_debug);
+
+  free(seq);
+
+  return en;
+}
+
+
+PUBLIC float
+energy_of_move( const char *string,
+                const char *structure,
+                int m1,
+                int m2){
+
+  float               en;
+  vrna_fold_compound_t  *vc;
+
+  vc  = recycle_last_call(string, NULL);
+  en  = vrna_eval_move(vc, structure, m1, m2);
+
+  return en;
+}
+
+PUBLIC int
+energy_of_move_pt(short *pt,
+                  short *s,
+                  short *s1,
+                  int m1,
+                  int m2){
+
+  int                 en, u;
+  char                *seq;
+  vrna_md_t           md;
+  vrna_fold_compound_t  *vc;
+
+  set_model_details(&md);
+
+  /* convert encoded sequence back to actual string */
+  seq = (char *)vrna_alloc(sizeof(char) * (s[0]+1));
+  for(u = 1; u <= s[0]; u++){
+    seq[u-1] = vrna_nucleotide_decode(s[u], &md);
+  }
+  seq[u-1] = '\0';
+
+  vc  = recycle_last_call(seq, NULL);
+  en  = vrna_eval_move_pt(vc, pt, m1, m2);
+
+  free(seq);
+
+  return en;
+}
+
diff --git a/C/ViennaRNA/eval.h b/C/ViennaRNA/eval.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/eval.h
@@ -0,0 +1,663 @@
+#ifndef VIENNA_RNA_PACKAGE_EVAL_H
+#define VIENNA_RNA_PACKAGE_EVAL_H
+
+#include <stdio.h>
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>   /* for deprecated functions */
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file     eval.h
+ *  @ingroup  eval
+ *  @brief    Functions and variables related to energy evaluation of sequence/structure pairs.
+ */
+
+
+/**
+ *  @addtogroup eval
+ *  @brief Functions and variables related to free energy evaluation of sequence/structure pairs.
+ *
+ *  @{
+ *  @ingroup  eval
+ */
+
+/** @brief set to first pos of second seq for cofolding  */
+extern  int cut_point;
+
+/**
+ *  @brief verbose info from energy_of_struct
+ */
+extern  int eos_debug;
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA
+ *
+ *  This function allows for energy evaluation of a given pair of structure
+ *  and sequence (alignment).
+ *  Model details, energy parameters, and possibly soft constraints are used as provided
+ *  via the parameter 'vc'. The #vrna_fold_compound_t does not need to contain any DP matrices,
+ *  but requires all most basic init values as one would get from a call like this:
+ *  @code{.c}
+ vc = vrna_fold_compound(sequence, NULL, VRNA_OPTION_EVAL_ONLY);
+    @endcode
+ *
+ *  @note Accepts vrna_fold_compound_t of type #VRNA_FC_TYPE_SINGLE and #VRNA_FC_TYPE_COMPARATIVE
+ *
+ *  @see  vrna_eval_structure_pt(), vrna_eval_structure_verbose(), vrna_eval_structure_pt_verbose(),
+ *        vrna_fold_compound(), vrna_fold_compound_comparative(), vrna_eval_covar_structure()
+ *
+ *  @param vc               A vrna_fold_compound_t containing the energy parameters and model details
+ *  @param structure        Secondary structure in dot-bracket notation
+ *  @return                 The free energy of the input structure given the input sequence in kcal/mol
+ */
+float vrna_eval_structure(vrna_fold_compound_t *vc,
+                          const char *structure);
+
+/**
+ *  @brief Calculate the pseudo energy derived by the covariance scores of a set of aligned sequences
+ *
+ *  Consensus structure prediction is driven by covariance scores of base pairs in rows of the
+ *  provided alignment. This function allows one to retrieve the total amount of this covariance pseudo
+ *  energy scores.
+ *  The #vrna_fold_compound_t does not need to contain any DP matrices, but requires all most basic
+ *  init values as one would get from a call like this:
+ *  @code{.c}
+ vc = vrna_fold_compound_comparative(alignment, NULL, VRNA_OPTION_EVAL_ONLY);
+    @endcode
+ *
+ *  @note Accepts vrna_fold_compound_t of type #VRNA_FC_TYPE_COMPARATIVE only!
+ *
+ *  @see  vrna_fold_compound_comparative(), vrna_eval_structure()
+ *
+ *  @param vc               A vrna_fold_compound_t containing the energy parameters and model details
+ *  @param structure        Secondary (consensus) structure in dot-bracket notation
+ *  @return                 The covariance pseudo energy score of the input structure given the input sequence alignment in kcal/mol
+ */
+float vrna_eval_covar_structure(vrna_fold_compound_t *vc,
+                                const char *structure);
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA
+ *
+ *  This function allows for energy evaluation of a given sequence/structure pair.
+ *  In contrast to vrna_eval_structure() this function assumes default model details
+ *  and default energy parameters in order to evaluate the free energy of the secondary
+ *  structure. Therefore, it serves as a simple interface function for energy evaluation
+ *  for situations where no changes on the energy model are required.
+ *
+ *  @see vrna_eval_structure(), vrna_eval_structure_pt(), vrna_eval_structure_verbose(), vrna_eval_structure_pt_verbose(),
+ *
+ *  @param string           RNA sequence in uppercase letters
+ *  @param structure        Secondary structure in dot-bracket notation
+ *  @return                 The free energy of the input structure given the input sequence in kcal/mol
+ */
+float vrna_eval_structure_simple( const char *string,
+                                  const char *structure);
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA and print contributions on a per-loop base.
+ *
+ *  This function is a simplyfied version of vrna_eval_structure_v() that uses the @em default
+ *  verbosity level.
+ (
+ *  @see vrna_eval_structure_pt(), vrna_eval_structure_verbose(), vrna_eval_structure_pt_verbose(),
+ *
+ *  @param vc               A vrna_fold_compound_t containing the energy parameters and model details
+ *  @param structure        Secondary structure in dot-bracket notation
+ *  @param file             A file handle where this function should print to (may be NULL).
+ *  @return                 The free energy of the input structure given the input sequence in kcal/mol
+ */
+float vrna_eval_structure_verbose(vrna_fold_compound_t *vc,
+                                  const char *structure,
+                                  FILE *file);
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA and print contributions on a per-loop base.
+ *
+ *  This function allows for detailed energy evaluation of a given sequence/structure pair.
+ *  In contrast to vrna_eval_structure() this function prints detailed energy contributions
+ *  based on individual loops to a file handle. If NULL is passed as file handle, this function
+ *  defaults to print to stdout. Any positive @p verbosity_level activates potential warning message
+ *  of the energy evaluting functions, while values @f$ \ge 1 @f$ allow for detailed control of what
+ *  data is printed. A negative parameter @p verbosity_level turns off printing all together.
+ *
+ *  Model details, energy parameters, and possibly soft constraints are used as provided
+ *  via the parameter 'vc'. The fold_compound does not need to contain any DP matrices,
+ *  but all the most basic init values as one would get from a call like this:
+ *  @code{.c}
+ vc = vrna_fold_compound(sequence, NULL, VRNA_OPTION_EVAL_ONLY);
+    @endcode
+ *
+ *  @see vrna_eval_structure_pt(), vrna_eval_structure_verbose(), vrna_eval_structure_pt_verbose(),
+ *
+ *  @param vc               A vrna_fold_compound_t containing the energy parameters and model details
+ *  @param structure        Secondary structure in dot-bracket notation
+ *  @param verbosity_level  The level of verbosity of this function
+ *  @param file             A file handle where this function should print to (may be NULL).
+ *  @return                 The free energy of the input structure given the input sequence in kcal/mol
+ */
+float vrna_eval_structure_v(vrna_fold_compound_t *vc,
+                            const char *structure,
+                            int verbosity_level,
+                            FILE *file);
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA and print contributions per loop.
+ *
+ *  This function is a simplyfied version of vrna_eval_structure_simple_v() that uses the @em default
+ *  verbosity level.
+ *
+ *  @see  vrna_eval_structure_simple_v(), vrna_eval_structure_verbose(), vrna_eval_structure_pt(),
+ *        vrna_eval_structure_verbose(), vrna_eval_structure_pt_verbose()
+ *
+ *  @param string           RNA sequence in uppercase letters
+ *  @param structure        Secondary structure in dot-bracket notation
+ *  @param file             A file handle where this function should print to (may be NULL).
+ *  @return                 The free energy of the input structure given the input sequence in kcal/mol
+ */
+float vrna_eval_structure_simple_verbose( const char *string,
+                                          const char *structure,
+                                          FILE *file);
+
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA and print contributions per loop.
+ *
+ *  This function allows for detailed energy evaluation of a given sequence/structure pair.
+ *  In contrast to vrna_eval_structure() this function prints detailed energy contributions
+ *  based on individual loops to a file handle. If NULL is passed as file handle, this function
+ *  defaults to print to stdout. Any positive @p verbosity_level activates potential warning message
+ *  of the energy evaluting functions, while values @f$ \ge 1 @f$ allow for detailed control of what
+ *  data is printed. A negative parameter @p verbosity_level turns off printing all together.
+ *
+ *  In contrast to vrna_eval_structure_verbose() this function assumes default model details
+ *  and default energy parameters in order to evaluate the free energy of the secondary
+ *  structure. Threefore, it serves as a simple interface function for energy evaluation
+ *  for situations where no changes on the energy model are required.
+ *
+ *  @see vrna_eval_structure_verbose(), vrna_eval_structure_pt(), vrna_eval_structure_verbose(), vrna_eval_structure_pt_verbose(),
+ *
+ *  @param string           RNA sequence in uppercase letters
+ *  @param structure        Secondary structure in dot-bracket notation
+ *  @param verbosity_level  The level of verbosity of this function
+ *  @param file             A file handle where this function should print to (may be NULL).
+ *  @return                 The free energy of the input structure given the input sequence in kcal/mol
+ */
+float vrna_eval_structure_simple_v( const char *string,
+                                    const char *structure,
+                                    int verbosity_level,
+                                    FILE *file);
+
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA
+ *
+ *  This function allows for energy evaluation of a given sequence/structure pair where
+ *  the structure is provided in pair_table format as obtained from vrna_ptable().
+ *  Model details, energy parameters, and possibly soft constraints are used as provided
+ *  via the parameter 'vc'. The fold_compound does not need to contain any DP matrices,
+ *  but all the most basic init values as one would get from a call like this:
+ *  @code{.c}
+ vc = vrna_fold_compound(sequence, NULL, VRNA_OPTION_EVAL_ONLY);
+    @endcode
+ *
+ *  @see vrna_ptable(), vrna_eval_structure(), vrna_eval_structure_pt_verbose()
+ *
+ *  @param vc               A vrna_fold_compound_t containing the energy parameters and model details
+ *  @param pt               Secondary structure as pair_table
+ *  @return                 The free energy of the input structure given the input sequence in 10cal/mol
+ */
+int vrna_eval_structure_pt( vrna_fold_compound_t *vc,
+                            const short *pt);
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA
+ *
+ *  In contrast to vrna_eval_structure_pt() this function assumes default model details
+ *  and default energy parameters in order to evaluate the free energy of the secondary
+ *  structure. Threefore, it serves as a simple interface function for energy evaluation
+ *  for situations where no changes on the energy model are required.
+ *
+ *  @see vrna_ptable(), vrna_eval_structure_simple(), vrna_eval_structure_pt()
+ *
+ *  @param string           RNA sequence in uppercase letters
+ *  @param pt               Secondary structure as pair_table
+ *  @return                 The free energy of the input structure given the input sequence in 10cal/mol
+ */
+int vrna_eval_structure_pt_simple(const char *string,
+                                  const short *pt);
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA
+ *
+ *  This function is a simplyfied version of vrna_eval_structure_simple_v() that uses the @em default
+ *  verbosity level.
+ *
+ *  @see vrna_eval_structure_pt_v(), vrna_ptable(), vrna_eval_structure_pt(), vrna_eval_structure_verbose()
+ *
+ *  @param vc               A vrna_fold_compound_t containing the energy parameters and model details
+ *  @param pt               Secondary structure as pair_table
+ *  @param file             A file handle where this function should print to (may be NULL).
+ *  @return                 The free energy of the input structure given the input sequence in 10cal/mol
+ */
+int vrna_eval_structure_pt_verbose( vrna_fold_compound_t *vc,
+                                    const short *pt,
+                                    FILE *file);
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA
+ *
+ *  This function allows for energy evaluation of a given sequence/structure pair where
+ *  the structure is provided in pair_table format as obtained from vrna_ptable().
+ *  Model details, energy parameters, and possibly soft constraints are used as provided
+ *  via the parameter 'vc'. The fold_compound does not need to contain any DP matrices,
+ *  but all the most basic init values as one would get from a call like this:
+ *  @code{.c}
+ vc = vrna_fold_compound(sequence, NULL, VRNA_OPTION_EVAL_ONLY);
+    @endcode
+ *  In contrast to vrna_eval_structure_pt() this function prints detailed energy contributions
+ *  based on individual loops to a file handle. If NULL is passed as file handle, this function
+ *  defaults to print to stdout. Any positive @p verbosity_level activates potential warning message
+ *  of the energy evaluting functions, while values @f$ \ge 1 @f$ allow for detailed control of what
+ *  data is printed. A negative parameter @p verbosity_level turns off printing all together.
+ *
+ *  @see vrna_ptable(), vrna_eval_structure_pt(), vrna_eval_structure_verbose()
+ *
+ *  @param vc               A vrna_fold_compound_t containing the energy parameters and model details
+ *  @param pt               Secondary structure as pair_table
+ *  @param verbosity_level  The level of verbosity of this function
+ *  @param file             A file handle where this function should print to (may be NULL).
+ *  @return                 The free energy of the input structure given the input sequence in 10cal/mol
+ */
+int vrna_eval_structure_pt_v( vrna_fold_compound_t *vc,
+                              const short *pt,
+                              int verbosity_level,
+                              FILE *file);
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA
+ *
+ *  This function is a simplyfied version of vrna_eval_structure_pt_simple_v() that uses the @em default
+ *  verbosity level.
+ *
+ *  @see vrna_eval_structure_pt_simple_v(), vrna_ptable(), vrna_eval_structure_pt_verbose(), vrna_eval_structure_simple()
+ *
+ *  @param string           RNA sequence in uppercase letters
+ *  @param pt               Secondary structure as pair_table
+ *  @param file             A file handle where this function should print to (may be NULL).
+ *  @return                 The free energy of the input structure given the input sequence in 10cal/mol
+ */
+int vrna_eval_structure_pt_simple_verbose(const char *string,
+                                          const short *pt,
+                                          FILE *file);
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA
+ *
+ *  This function allows for energy evaluation of a given sequence/structure pair where
+ *  the structure is provided in pair_table format as obtained from vrna_ptable().
+ *  Model details, energy parameters, and possibly soft constraints are used as provided
+ *  via the parameter 'vc'. The fold_compound does not need to contain any DP matrices,
+ *  but all the most basic init values as one would get from a call like this:
+ *  @code{.c}
+ vc = vrna_fold_compound(sequence, NULL, VRNA_OPTION_EVAL_ONLY);
+    @endcode
+ *  In contrast to vrna_eval_structure_pt_verbose() this function assumes default model details
+ *  and default energy parameters in order to evaluate the free energy of the secondary
+ *  structure. Threefore, it serves as a simple interface function for energy evaluation
+ *  for situations where no changes on the energy model are required.
+ *
+ *  @see vrna_ptable(), vrna_eval_structure_pt_v(), vrna_eval_structure_simple()
+ *
+ *  @param string           RNA sequence in uppercase letters
+ *  @param pt               Secondary structure as pair_table
+ *  @param verbosity_level  The level of verbosity of this function
+ *  @param file             A file handle where this function should print to (may be NULL).
+ *  @return                 The free energy of the input structure given the input sequence in 10cal/mol
+ */
+int vrna_eval_structure_pt_simple_v(const char *string,
+                                    const short *pt,
+                                    int verbosity_level,
+                                    FILE *file);
+
+/**
+ * @brief Calculate energy of a loop
+ *
+ *  @param vc         A vrna_fold_compound_t containing the energy parameters and model details
+ *  @param i          position of covering base pair
+ *  @param pt         the pair table of the secondary structure
+ *  @returns          free energy of the loop in 10cal/mol
+ */
+int vrna_eval_loop_pt(vrna_fold_compound_t *vc,
+                      int i,
+                      const short *pt);
+
+/** 
+ * @brief Calculate energy of a move (closing or opening of a base pair)
+ *
+ *  If the parameters m1 and m2 are negative, it is deletion (opening)
+ *  of a base pair, otherwise it is insertion (opening).
+ *
+ *  @see              vrna_eval_move_pt()
+ *  @param vc         A vrna_fold_compound_t containing the energy parameters and model details
+ *  @param structure  secondary structure in dot-bracket notation
+ *  @param m1         first coordinate of base pair
+ *  @param m2         second coordinate of base pair
+ *  @returns          energy change of the move in kcal/mol
+ */
+float vrna_eval_move( vrna_fold_compound_t *vc,
+                      const char *structure,
+                      int m1,
+                      int m2);
+
+/**
+ * 
+ * @brief Calculate energy of a move (closing or opening of a base pair)
+ *
+ *  If the parameters m1 and m2 are negative, it is deletion (opening)
+ *  of a base pair, otherwise it is insertion (opening).
+ *
+ *  @see              vrna_eval_move()
+ *  @param vc         A vrna_fold_compound_t containing the energy parameters and model details
+ *  @param pt         the pair table of the secondary structure
+ *  @param m1         first coordinate of base pair
+ *  @param m2         second coordinate of base pair
+ *  @returns          energy change of the move in 10cal/mol
+ */
+int vrna_eval_move_pt(vrna_fold_compound_t *vc,
+                      short *pt,
+                      int m1,
+                      int m2);
+
+int vrna_eval_move_pt_simple( const char *string,
+                              short *pt,
+                              int m1,
+                              int m2);
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA using global model detail settings
+ *
+ *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
+ *
+ *  @note OpenMP: This function relies on several global model settings variables and thus is
+ *        not to be considered threadsafe. See energy_of_struct_par() for a completely threadsafe
+ *        implementation.
+ *
+ *  @deprecated Use vrna_eval_structure() or vrna_eval_structure_verbose() instead!
+ *
+ *  @see vrna_eval_structure()
+ *
+ *  @param string     RNA sequence
+ *  @param structure  secondary structure in dot-bracket notation
+ *  @param verbosity_level a flag to turn verbose output on/off
+ *  @return          the free energy of the input structure given the input sequence in kcal/mol
+ */
+DEPRECATED(float energy_of_structure(const char *string,
+                          const char *structure,
+                          int verbosity_level));
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA
+ *
+ *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
+ *
+ *  @deprecated Use vrna_eval_structure() or vrna_eval_structure_verbose() instead!
+ *
+ *  @see vrna_eval_structure()
+ *
+ *  @param string           RNA sequence in uppercase letters
+ *  @param structure        Secondary structure in dot-bracket notation
+ *  @param parameters       A data structure containing the prescaled energy contributions and the model details.
+ *  @param verbosity_level  A flag to turn verbose output on/off
+ *  @return                The free energy of the input structure given the input sequence in kcal/mol
+ */
+DEPRECATED(float energy_of_struct_par( const char *string,
+                            const char *structure,
+                            vrna_param_t *parameters,
+                            int verbosity_level));
+
+/**
+ *  @brief Calculate the free energy of an already folded  circular RNA
+ *
+ *  @note OpenMP: This function relies on several global model settings variables and thus is
+ *        not to be considered threadsafe. See energy_of_circ_struct_par() for a completely threadsafe
+ *        implementation.
+ *
+ *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
+ *
+ *  @deprecated Use vrna_eval_structure() or vrna_eval_structure_verbose() instead!
+ *
+ *  @see vrna_eval_structure()
+ *
+ *  @param string           RNA sequence
+ *  @param structure        Secondary structure in dot-bracket notation
+ *  @param verbosity_level  A flag to turn verbose output on/off
+ *  @return                The free energy of the input structure given the input sequence in kcal/mol
+ */
+DEPRECATED(float energy_of_circ_structure( const char *string,
+                                const char *structure,
+                                int verbosity_level));
+
+/**
+ *  @brief Calculate the free energy of an already folded circular RNA
+ *
+ *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
+ *
+ *  @deprecated Use vrna_eval_structure() or vrna_eval_structure_verbose() instead!
+ *
+ *  @see vrna_eval_structure()
+ *
+ *  @param string           RNA sequence
+ *  @param structure        Secondary structure in dot-bracket notation
+ *  @param parameters       A data structure containing the prescaled energy contributions and the model details.
+ *  @param verbosity_level  A flag to turn verbose output on/off
+ *  @return                The free energy of the input structure given the input sequence in kcal/mol
+ */
+DEPRECATED(float energy_of_circ_struct_par(const char *string,
+                                const char *structure,
+                                vrna_param_t *parameters,
+                                int verbosity_level));
+
+
+DEPRECATED(float energy_of_gquad_structure(const char *string,
+                                const char *structure,
+                                int verbosity_level));
+
+DEPRECATED(float energy_of_gquad_struct_par( const char *string,
+                                  const char *structure,
+                                  vrna_param_t *parameters,
+                                  int verbosity_level));
+
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA
+ *
+ *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
+ *
+ *  @note OpenMP: This function relies on several global model settings variables and thus is
+ *        not to be considered threadsafe. See energy_of_struct_pt_par() for a completely threadsafe
+ *        implementation.
+ *
+ *  @deprecated Use vrna_eval_structure_pt() or vrna_eval_structure_pt_verbose() instead!
+ *
+ *  @see vrna_eval_structure_pt()
+ *
+ *  @param string     RNA sequence
+ *  @param ptable     the pair table of the secondary structure
+ *  @param s          encoded RNA sequence
+ *  @param s1         encoded RNA sequence
+ *  @param verbosity_level a flag to turn verbose output on/off
+ *  @return          the free energy of the input structure given the input sequence in 10kcal/mol
+ */
+DEPRECATED(int energy_of_structure_pt( const char *string,
+                            short *ptable,
+                            short *s,
+                            short *s1,
+                            int verbosity_level));
+
+/**
+ *  @brief Calculate the free energy of an already folded RNA
+ *
+ *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
+ *
+ *  @deprecated Use vrna_eval_structure_pt() or vrna_eval_structure_pt_verbose() instead!
+ *
+ *  @see vrna_eval_structure_pt()
+ *
+ *  @param string           RNA sequence in uppercase letters
+ *  @param ptable           The pair table of the secondary structure
+ *  @param s                Encoded RNA sequence
+ *  @param s1               Encoded RNA sequence
+ *  @param parameters       A data structure containing the prescaled energy contributions and the model details.
+ *  @param verbosity_level  A flag to turn verbose output on/off
+ *  @return                The free energy of the input structure given the input sequence in 10kcal/mol
+ */
+DEPRECATED(int energy_of_struct_pt_par(const char *string,
+                            short *ptable,
+                            short *s,
+                            short *s1,
+                            vrna_param_t *parameters,
+                            int verbosity_level));
+
+
+
+/** 
+ * @brief Calculate energy of a move (closing or opening of a base pair)
+ *
+ *  If the parameters m1 and m2 are negative, it is deletion (opening)
+ *  of a base pair, otherwise it is insertion (opening).
+ *
+ *  @deprecated Use vrna_eval_move() instead!
+ *
+ *  @see vrna_eval_move()
+ *
+ *  @param string     RNA sequence
+ *  @param structure  secondary structure in dot-bracket notation
+ *  @param m1         first coordinate of base pair
+ *  @param m2         second coordinate of base pair
+ *  @returns          energy change of the move in kcal/mol
+ */
+DEPRECATED(float energy_of_move( const char *string,
+                      const char *structure,
+                      int m1,
+                      int m2));
+
+
+/**
+ * 
+ * @brief Calculate energy of a move (closing or opening of a base pair)
+ *
+ *  If the parameters m1 and m2 are negative, it is deletion (opening)
+ *  of a base pair, otherwise it is insertion (opening).
+ *
+ *  @deprecated Use vrna_eval_move_pt() instead!
+ *
+ *  @see vrna_eval_move_pt()
+ *
+ *  @param pt         the pair table of the secondary structure
+ *  @param s          encoded RNA sequence
+ *  @param s1         encoded RNA sequence
+ *  @param m1         first coordinate of base pair
+ *  @param m2         second coordinate of base pair
+ *  @returns          energy change of the move in 10cal/mol
+ */
+DEPRECATED(int energy_of_move_pt(short *pt,
+                   short *s,
+                   short *s1,
+                   int m1,
+                   int m2));
+
+/**
+ * @brief Calculate energy of a loop
+ *
+ *  @deprecated Use vrna_eval_loop_pt() instead!
+ *
+ *  @see vrna_eval_loop_pt()
+ *
+ *  @param ptable     the pair table of the secondary structure
+ *  @param s          encoded RNA sequence
+ *  @param s1         encoded RNA sequence
+ *  @param i          position of covering base pair
+ *  @returns          free energy of the loop in 10cal/mol
+ */
+DEPRECATED(int   loop_energy(short *ptable,
+                  short *s,
+                  short *s1,
+                  int i));
+
+/**
+ *  Calculate the free energy of an already folded RNA
+ * 
+ *  @note This function is not entirely threadsafe! Depending on the state of the global
+ *  variable @ref eos_debug it prints energy information to stdout or not...\n
+ * 
+ *  @deprecated This function is deprecated and should not be used in future programs!
+ *  Use @ref energy_of_structure() instead!
+ * 
+ *  @see              energy_of_structure, energy_of_circ_struct(), energy_of_struct_pt()
+ *  @param string     RNA sequence
+ *  @param structure  secondary structure in dot-bracket notation
+ *  @return          the free energy of the input structure given the input sequence in kcal/mol
+ */
+DEPRECATED(float energy_of_struct(const char *string,
+                                  const char *structure));
+
+/**
+ *  Calculate the free energy of an already folded RNA
+ * 
+ *  @note This function is not entirely threadsafe! Depending on the state of the global
+ *  variable @ref eos_debug it prints energy information to stdout or not...\n
+ * 
+ *  @deprecated This function is deprecated and should not be used in future programs!
+ *  Use @ref energy_of_structure_pt() instead!
+ * 
+ *  @see              make_pair_table(), energy_of_structure()
+ *  @param string     RNA sequence
+ *  @param ptable     the pair table of the secondary structure
+ *  @param s          encoded RNA sequence
+ *  @param s1         encoded RNA sequence
+ *  @return          the free energy of the input structure given the input sequence in 10kcal/mol
+ */
+DEPRECATED(int energy_of_struct_pt( const char *string,
+                                    short *ptable,
+                                    short *s,
+                                    short *s1));
+
+/**
+ *  Calculate the free energy of an already folded  circular RNA
+ * 
+ *  @note This function is not entirely threadsafe! Depending on the state of the global
+ *  variable @ref eos_debug it prints energy information to stdout or not...\n
+ * 
+ *  @deprecated This function is deprecated and should not be used in future programs
+ *  Use @ref energy_of_circ_structure() instead!
+ * 
+ *  @see              energy_of_circ_structure(), energy_of_struct(), energy_of_struct_pt()
+ *  @param string     RNA sequence
+ *  @param structure  secondary structure in dot-bracket notation
+ *  @return          the free energy of the input structure given the input sequence in kcal/mol
+ */
+DEPRECATED(float energy_of_circ_struct( const char *string,
+                                        const char *structure));
+
+#endif
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/exterior_loops.c b/C/ViennaRNA/exterior_loops.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/exterior_loops.c
@@ -0,0 +1,1785 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/structured_domains.h"
+#include "ViennaRNA/unstructured_domains.h"
+#include "ViennaRNA/exterior_loops.h"
+
+#ifdef __GNUC__
+# define INLINE inline
+#else
+# define INLINE
+#endif
+
+struct default_data {
+  int                       *idx;
+  char                      *mx;
+  int                       cp;
+  int                       *hc_up;
+  void                      *hc_dat;
+  vrna_callback_hc_evaluate *hc_f;
+};
+
+
+/*
+ #################################
+ # PRIVATE FUNCTION DECLARATIONS #
+ #################################
+ */
+
+PRIVATE FLT_OR_DBL
+exp_E_ext_fast(vrna_fold_compound_t *vc,
+               int                  i,
+               int                  j,
+               vrna_mx_pf_aux_el_t  *aux_mx);
+
+
+PRIVATE FLT_OR_DBL
+exp_E_ext_fast_comparative(vrna_fold_compound_t *vc,
+                           int                  i,
+                           int                  j,
+                           vrna_mx_pf_aux_el_t  *aux_mx);
+
+
+PRIVATE char
+hc_default(int  i,
+           int  j,
+           int  k,
+           int  l,
+           char d,
+           void *data);
+
+
+PRIVATE char
+hc_default_user(int   i,
+                int   j,
+                int   k,
+                int   l,
+                char  d,
+                void  *data);
+
+
+/*
+ #################################
+ # BEGIN OF FUNCTION DEFINITIONS #
+ #################################
+ */
+PUBLIC int
+E_ext_loop(int                  i,
+           int                  j,
+           vrna_fold_compound_t *vc)
+{
+  char                      *ptype, *hard_constraints;
+  short                     *S;
+  int                       ij, en, e, type, cp, *idx;
+  vrna_param_t              *P;
+  vrna_md_t                 *md;
+  vrna_sc_t                 *sc;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  cp                = vc->cutpoint;
+  S                 = vc->sequence_encoding;
+  idx               = vc->jindx;
+  ptype             = vc->ptype;
+  P                 = vc->params;
+  md                = &(P->model_details);
+  hard_constraints  = vc->hc->matrix;
+  sc                = vc->sc;
+
+  hc_dat_local.idx  = idx;
+  hc_dat_local.mx   = hard_constraints;
+  hc_dat_local.cp   = cp;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+
+  e     = INF;
+  ij    = idx[j] + i;
+  type  = ptype[ij];
+
+  if ((cp < 0) || (((i) >= cp) || ((j) < cp))) {
+    /* regular exterior loop */
+    if (evaluate(i, j, i, j, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+      if (type == 0)
+        type = 7;
+
+      switch (md->dangles) {
+        case 2:
+          e = E_ExtLoop(type, S[i - 1], S[j + 1], P);
+          break;
+
+        case 0:
+        /* fall through */
+
+        default:
+          e = E_ExtLoop(type, -1, -1, P);
+          break;
+      }
+      if (sc)
+        if (sc->f)
+          e += sc->f(i, j, i, j, VRNA_DECOMP_EXT_STEM, sc->data);
+    }
+
+    if (md->dangles % 2) {
+      ij = idx[j - 1] + i;
+      if (evaluate(i, j, i, j - 1, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+        type = vc->ptype[ij];
+
+        if (type == 0)
+          type = 7;
+
+        en = E_ExtLoop(type, -1, S[j], P);
+        if (sc)
+          if (sc->f)
+            en += sc->f(i, j, i, j - 1, VRNA_DECOMP_EXT_STEM, sc->data);
+        e = MIN2(e, en);
+      }
+
+      ij = idx[j] + i + 1;
+      if (evaluate(i, j, i + 1, j, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+        type = vc->ptype[ij];
+
+        if (type == 0)
+          type = 7;
+
+        en = E_ExtLoop(type, S[i], -1, P);
+        if (sc)
+          if (sc->f)
+            en += sc->f(i, j, i + 1, j, VRNA_DECOMP_EXT_STEM, sc->data);
+        e = MIN2(e, en);
+      }
+    }
+  }
+
+  return e;
+}
+
+
+PUBLIC void
+E_ext_loop_5(vrna_fold_compound_t *vc)
+{
+  char                      *ptype, *hc;
+  short                     *S;
+  int                       en, i, j, ij, type, length, *indx, *hc_up, *f5, *c, dangle_model,
+                            *ggg, with_gquad, turn, k, u, with_ud;
+  vrna_sc_t                 *sc;
+  vrna_param_t              *P;
+  vrna_ud_t                 *domains_up;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  length        = (int)vc->length;
+  ptype         = vc->ptype;
+  S             = vc->sequence_encoding;
+  indx          = vc->jindx;
+  hc            = vc->hc->matrix;
+  hc_up         = vc->hc->up_ext;
+  sc            = vc->sc;
+  f5            = vc->matrices->f5;
+  c             = vc->matrices->c;
+  P             = vc->params;
+  dangle_model  = P->model_details.dangles;
+  ggg           = vc->matrices->ggg;
+  with_gquad    = P->model_details.gquad;
+  turn          = P->model_details.min_loop_size;
+  domains_up    = vc->domains_up;
+  with_ud       = (domains_up && domains_up->energy_cb) ? 1 : 0;
+
+  hc_dat_local.idx    = indx;
+  hc_dat_local.mx     = hc;
+  hc_dat_local.hc_up  = hc_up;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  f5[0] = 0;
+  for (i = 1; i <= turn + 1; i++) {
+    if (f5[i - 1] != INF) {
+      if (evaluate(1, i, 1, i - 1, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+        f5[i] = f5[i - 1];
+        if (sc) {
+          if (sc->energy_up)
+            f5[i] += sc->energy_up[i][1];
+          if (sc->f)
+            f5[i] += sc->f(1, i, 1, i - 1, VRNA_DECOMP_EXT_EXT, sc->data);
+        }
+      } else {
+        f5[i] = INF;
+      }
+    } else {
+      f5[i] = INF;
+    }
+  }
+
+  if (with_ud) {
+    /* do we include ligand binding? */
+    /*  construct all possible combinations of
+     *  f[i-1] + L[i,j] with j <= turn + 1
+     */
+    for (i = 1; i <= turn + 1; i++) {
+      if (f5[i - 1] != INF) {
+        for (k = 0; k < domains_up->uniq_motif_count; k++) {
+          u = domains_up->uniq_motif_size[k];
+          j = i + u - 1;
+          if (j <= turn + 1) {
+            if (evaluate(1, j, i - 1, i, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+              en = f5[i - 1]
+                   + domains_up->energy_cb(vc,
+                                           i, j,
+                                           VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP,
+                                           domains_up->data);
+              if (sc) {
+                if (sc->energy_up)
+                  en += sc->energy_up[i][u];
+                if (sc->f)
+                  en += sc->f(1, j, 1, j - u, VRNA_DECOMP_EXT_EXT, sc->data);
+              }
+              f5[j] = MIN2(f5[j], en);
+            }
+          }
+        }
+      }
+    }
+  }
+
+  /* duplicated code may be faster than conditions inside loop ;) */
+  switch (dangle_model) {
+    /* dont use dangling end and mismatch contributions at all */
+    case 0:
+      for (j = turn + 2; j <= length; j++) {
+        /* initialize with INF */
+        f5[j] = INF;
+
+        /* check for 3' extension with one unpaired nucleotide */
+        if (f5[j - 1] != INF) {
+          if (evaluate(1, j, 1, j - 1, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+            f5[j] = f5[j - 1];
+            if (sc) {
+              if (sc->energy_up)
+                f5[j] += sc->energy_up[j][1];
+              if (sc->f)
+                f5[j] += sc->f(1, j, 1, j - 1, VRNA_DECOMP_EXT_EXT, sc->data);
+            }
+          }
+        }
+
+        if (with_ud) {
+          for (k = 0; k < domains_up->uniq_motif_count; k++) {
+            u = domains_up->uniq_motif_size[k];
+            if ((j - u >= 0) && (f5[j - u] != INF)) {
+              if (evaluate(1, j, 1, j - u, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+                en = f5[j - u]
+                     + domains_up->energy_cb(vc,
+                                             j - u + 1, j,
+                                             VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                             domains_up->data);
+                if (sc) {
+                  if (sc->energy_up)
+                    en += sc->energy_up[j - u + 1][u];
+                  if (sc->f)
+                    en += sc->f(1, j, 1, j - u, VRNA_DECOMP_EXT_EXT, sc->data);
+                }
+
+                f5[j] = MIN2(f5[j], en);
+              }
+            }
+          }
+        }
+
+        /* check for possible stems branching off the exterior loop */
+        if (sc && sc->f) {
+          for (i = j - turn - 1; i > 1; i--) {
+            if (f5[i - 1] != INF) {
+              ij = indx[j] + i;
+
+              if (with_gquad)
+                f5[j] = MIN2(f5[j], f5[i - 1] + ggg[ij]);
+
+              if (c[ij] != INF) {
+                if (evaluate(1, j, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+                  type = ptype[ij];
+
+                  if (type == 0)
+                    type = 7;
+
+                  en    = f5[i - 1] + c[ij] + E_ExtLoop(type, -1, -1, P);
+                  en    += sc->f(1, j, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM, sc->data);
+                  f5[j] = MIN2(f5[j], en);
+                }
+              }
+            }
+          }
+        } else {
+          for (i = j - turn - 1; i > 1; i--) {
+            if (f5[i - 1] != INF) {
+              ij = indx[j] + i;
+
+              if (with_gquad)
+                f5[j] = MIN2(f5[j], f5[i - 1] + ggg[ij]);
+
+              if (c[ij] != INF) {
+                if (evaluate(1, j, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+                  type = ptype[ij];
+
+                  if (type == 0)
+                    type = 7;
+
+                  en    = f5[i - 1] + c[ij] + E_ExtLoop(type, -1, -1, P);
+                  f5[j] = MIN2(f5[j], en);
+                }
+              }
+            }
+          }
+        }
+        ij = indx[j] + 1;
+
+        if (with_gquad)
+          f5[j] = MIN2(f5[j], ggg[ij]);
+
+        if (c[ij] != INF) {
+          if (evaluate(1, j, 1, j, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+            type = ptype[ij];
+
+            if (type == 0)
+              type = 7;
+
+            en = c[ij] + E_ExtLoop(type, -1, -1, P);
+            if (sc)
+              if (sc->f)
+                en += sc->f(1, j, 1, j, VRNA_DECOMP_EXT_STEM, sc->data);
+            f5[j] = MIN2(f5[j], en);
+          }
+        }
+      }
+      break;
+
+    /* always use dangles on both sides */
+    case 2:
+      for (j = turn + 2; j < length; j++) {
+        f5[j] = INF;
+
+        if (f5[j - 1] != INF) {
+          if (evaluate(1, j, 1, j - 1, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+            f5[j] = f5[j - 1];
+            if (sc) {
+              if (sc->energy_up)
+                f5[j] += sc->energy_up[j][1];
+              if (sc->f)
+                f5[j] += sc->f(1, j, 1, j - 1, VRNA_DECOMP_EXT_EXT, sc->data);
+            }
+          }
+        }
+
+        if (with_ud) {
+          for (k = 0; k < domains_up->uniq_motif_count; k++) {
+            u = domains_up->uniq_motif_size[k];
+            if ((j - u >= 0) && (f5[j - u] != INF)) {
+              if (evaluate(1, j, 1, j - u, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+                en = f5[j - u]
+                     + domains_up->energy_cb(vc,
+                                             j - u + 1, j,
+                                             VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                             domains_up->data);
+                if (sc) {
+                  if (sc->energy_up)
+                    en += sc->energy_up[j - u + 1][u];
+                  if (sc->f)
+                    en += sc->f(1, j, 1, j - u, VRNA_DECOMP_EXT_EXT, sc->data);
+                }
+
+                f5[j] = MIN2(f5[j], en);
+              }
+            }
+          }
+        }
+
+        if (sc && sc->f) {
+          for (i = j - turn - 1; i > 1; i--) {
+            if (f5[i - 1] != INF) {
+              ij = indx[j] + i;
+
+              if (with_gquad)
+                f5[j] = MIN2(f5[j], f5[i - 1] + ggg[ij]);
+
+              if (c[ij] != INF) {
+                if (evaluate(1, j, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+                  type = ptype[ij];
+
+                  if (type == 0)
+                    type = 7;
+
+                  en    = f5[i - 1] + c[ij] + E_ExtLoop(type, S[i - 1], S[j + 1], P);
+                  en    += sc->f(1, j, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM, sc->data);
+                  f5[j] = MIN2(f5[j], en);
+                }
+              }
+            }
+          }
+        } else {
+          for (i = j - turn - 1; i > 1; i--) {
+            if (f5[i - 1] != INF) {
+              ij = indx[j] + i;
+
+              if (with_gquad)
+                f5[j] = MIN2(f5[j], f5[i - 1] + ggg[ij]);
+
+              if (c[ij] != INF) {
+                if (evaluate(1, j, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+                  type = ptype[ij];
+
+                  if (type == 0)
+                    type = 7;
+
+                  en    = f5[i - 1] + c[ij] + E_ExtLoop(type, S[i - 1], S[j + 1], P);
+                  f5[j] = MIN2(f5[j], en);
+                }
+              }
+            }
+          }
+        }
+        ij = indx[j] + 1;
+
+        if (with_gquad)
+          f5[j] = MIN2(f5[j], ggg[ij]);
+
+        if (c[ij] != INF) {
+          if (evaluate(1, j, 1, j, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+            type = ptype[ij];
+
+            if (type == 0)
+              type = 7;
+
+            en = c[ij] + E_ExtLoop(type, -1, S[j + 1], P);
+            if (sc)
+              if (sc->f)
+                en += sc->f(1, j, 1, j, VRNA_DECOMP_EXT_STEM, sc->data);
+            f5[j] = MIN2(f5[j], en);
+          }
+        }
+      }
+
+      f5[length] = INF;
+      if (f5[length - 1] != INF) {
+        if (evaluate(1, length, 1, length - 1, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+          f5[length] = f5[length - 1];
+          if (sc) {
+            if (sc->energy_up)
+              f5[length] += sc->energy_up[length][1];
+            if (sc->f)
+              f5[length] += sc->f(1, length, 1, length - 1, VRNA_DECOMP_EXT_EXT, sc->data);
+          }
+        }
+      }
+
+      if (with_ud) {
+        for (k = 0; k < domains_up->uniq_motif_count; k++) {
+          u = domains_up->uniq_motif_size[k];
+          if ((length - u >= 0) && (f5[length - u] != INF)) {
+            if (evaluate(1, length, 1, length - u, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+              en = f5[length - u]
+                   + domains_up->energy_cb(vc,
+                                           length - u + 1, length,
+                                           VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                           domains_up->data);
+              if (sc) {
+                if (sc->energy_up)
+                  en += sc->energy_up[length - u + 1][u];
+                if (sc->f)
+                  en += sc->f(1, length, 1, length - u, VRNA_DECOMP_EXT_EXT, sc->data);
+              }
+
+              f5[length] = MIN2(f5[length], en);
+            }
+          }
+        }
+      }
+
+      if (sc && sc->f) {
+        for (i = length - turn - 1; i > 1; i--) {
+          if (f5[i - 1] != INF) {
+            ij = indx[length] + i;
+
+            if (with_gquad)
+              f5[length] = MIN2(f5[length], f5[i - 1] + ggg[ij]);
+
+            if (c[ij] != INF) {
+              if (evaluate(1, length, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+                type = ptype[ij];
+
+                if (type == 0)
+                  type = 7;
+
+                en          = f5[i - 1] + c[ij] + E_ExtLoop(type, S[i - 1], -1, P);
+                en          += sc->f(1, length, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM, sc->data);
+                f5[length]  = MIN2(f5[length], en);
+              }
+            }
+          }
+        }
+      } else {
+        for (i = length - turn - 1; i > 1; i--) {
+          if (f5[i - 1] != INF) {
+            ij = indx[length] + i;
+
+            if (with_gquad)
+              f5[length] = MIN2(f5[length], f5[i - 1] + ggg[ij]);
+
+            if (c[ij] != INF) {
+              if (evaluate(1, length, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+                type = ptype[ij];
+
+                if (type == 0)
+                  type = 7;
+
+                en          = f5[i - 1] + c[ij] + E_ExtLoop(type, S[i - 1], -1, P);
+                f5[length]  = MIN2(f5[length], en);
+              }
+            }
+          }
+        }
+      }
+      ij = indx[length] + 1;
+
+      if (with_gquad)
+        f5[length] = MIN2(f5[length], ggg[ij]);
+
+      if (c[ij] != INF) {
+        if (evaluate(1, length, 1, length, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+          type = ptype[ij];
+
+          if (type == 0)
+            type = 7;
+
+          en = c[ij] + E_ExtLoop(type, -1, -1, P);
+          if (sc)
+            if (sc->f)
+              en += sc->f(1, length, 1, length, VRNA_DECOMP_EXT_STEM, sc->data);
+          f5[length] = MIN2(f5[length], en);
+        }
+      }
+      break;
+
+    /* normal dangles, aka dangle_model = 1 || 3 */
+    default:
+      for (j = turn + 2; j <= length; j++) {
+        f5[j] = INF;
+        if (f5[j - 1] != INF) {
+          if (evaluate(1, j, 1, j - 1, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+            f5[j] = f5[j - 1];
+            if (sc) {
+              if (sc->energy_up)
+                f5[j] += sc->energy_up[j][1];
+              if (sc->f)
+                f5[j] += sc->f(1, j, 1, j - 1, VRNA_DECOMP_EXT_EXT, sc->data);
+            }
+          }
+        }
+
+        if (with_ud) {
+          for (k = 0; k < domains_up->uniq_motif_count; k++) {
+            u = domains_up->uniq_motif_size[k];
+            if ((j - u >= 0) && (f5[j - u] != INF)) {
+              if (evaluate(1, j, 1, j - u, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+                en = f5[j - u]
+                     + domains_up->energy_cb(vc,
+                                             j - u + 1, j,
+                                             VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                             domains_up->data);
+                if (sc) {
+                  if (sc->energy_up)
+                    en += sc->energy_up[j - u + 1][u];
+                  if (sc->f)
+                    en += sc->f(1, j, 1, j - u, VRNA_DECOMP_EXT_EXT, sc->data);
+                }
+
+                f5[j] = MIN2(f5[j], en);
+              }
+            }
+          }
+        }
+
+        for (i = j - turn - 1; i > 1; i--) {
+          ij = indx[j] + i;
+          if (f5[i - 1] != INF) {
+            if (with_gquad)
+              f5[j] = MIN2(f5[j], f5[i - 1] + ggg[ij]);
+
+            if (c[ij] != INF) {
+              if (evaluate(1, j, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+                type = ptype[ij];
+
+                if (type == 0)
+                  type = 7;
+
+                en = f5[i - 1] + c[ij] + E_ExtLoop(type, -1, -1, P);
+                if (sc)
+                  if (sc->f)
+                    en += sc->f(1, j, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM, sc->data);
+                f5[j] = MIN2(f5[j], en);
+              }
+            }
+          }
+
+          if ((f5[i - 2] != INF) && c[ij] != INF) {
+            if (evaluate(1, j, i - 2, i, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+              type = ptype[ij];
+
+              if (type == 0)
+                type = 7;
+
+              en = f5[i - 2] + c[ij] + E_ExtLoop(type, S[i - 1], -1, P);
+
+              if (sc) {
+                if (sc->energy_up)
+                  en += sc->energy_up[i - 1][1];
+                if (sc->f)
+                  en += sc->f(1, j, i - 2, i, VRNA_DECOMP_EXT_EXT_STEM, sc->data);
+              }
+              f5[j] = MIN2(f5[j], en);
+            }
+          }
+
+          ij = indx[j - 1] + i;
+          if (c[ij] != INF) {
+            if (f5[i - 1] != INF) {
+              if (evaluate(1, j, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM1, &hc_dat_local)) {
+                type = ptype[ij];
+
+                if (type == 0)
+                  type = 7;
+
+                en = f5[i - 1] + c[ij] + E_ExtLoop(type, -1, S[j], P);
+
+                if (sc) {
+                  if (sc->energy_up)
+                    en += sc->energy_up[j][1];
+                  if (sc->f)
+                    en += sc->f(1, j, i - 1, i, VRNA_DECOMP_EXT_EXT_STEM1, sc->data);
+                }
+                f5[j] = MIN2(f5[j], en);
+              }
+            }
+
+            if (f5[i - 2] != INF) {
+              if (evaluate(1, j, i - 2, i, VRNA_DECOMP_EXT_EXT_STEM1, &hc_dat_local)) {
+                type = ptype[ij];
+
+                if (type == 0)
+                  type = 7;
+
+                en = f5[i - 2] + c[ij] + E_ExtLoop(type, S[i - 1], S[j], P);
+
+                if (sc) {
+                  if (sc->energy_up)
+                    en += sc->energy_up[i - 1][1] + sc->energy_up[j][1];
+                  if (sc->f)
+                    en += sc->f(1, j, i - 2, i, VRNA_DECOMP_EXT_EXT_STEM1, sc->data);
+                }
+                f5[j] = MIN2(f5[j], en);
+              }
+            }
+          }
+        }
+
+        ij = indx[j] + 1;
+
+        if (with_gquad)
+          f5[j] = MIN2(f5[j], ggg[ij]);
+
+        if (c[ij] != INF) {
+          if (evaluate(1, j, 1, j, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+            type = ptype[ij];
+
+            if (type == 0)
+              type = 7;
+
+            en = c[ij] + E_ExtLoop(type, -1, -1, P);
+            if (sc)
+              if (sc->f)
+                en += sc->f(1, j, 1, j, VRNA_DECOMP_EXT_STEM, sc->data);
+            f5[j] = MIN2(f5[j], en);
+          }
+        }
+        ij = indx[j - 1] + 1;
+        if (c[ij] != INF) {
+          if (evaluate(1, j, 1, j - 1, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+            type = ptype[ij];
+
+            if (type == 0)
+              type = 7;
+
+            en = c[ij] + E_ExtLoop(type, -1, S[j], P);
+
+            if (sc) {
+              if (sc->energy_up)
+                en += sc->energy_up[j][1];
+              if (sc->f)
+                en += sc->f(1, j, 1, j - 1, VRNA_DECOMP_EXT_STEM, sc->data);
+            }
+            f5[j] = MIN2(f5[j], en);
+          }
+        }
+      }         /* end for j... */
+      break;
+  }
+}
+
+
+PUBLIC int
+E_Stem(int          type,
+       int          si1,
+       int          sj1,
+       int          extLoop,
+       vrna_param_t *P)
+{
+  int energy  = 0;
+  int d5      = (si1 >= 0) ? P->dangle5[type][si1] : 0;
+  int d3      = (sj1 >= 0) ? P->dangle3[type][sj1] : 0;
+
+  if (type > 2)
+    energy += P->TerminalAU;
+
+  if (si1 >= 0 && sj1 >= 0)
+    energy += (extLoop) ? P->mismatchExt[type][si1][sj1] : P->mismatchM[type][si1][sj1];
+  else
+    energy += d5 + d3;
+
+  if (!extLoop)
+    energy += P->MLintern[type];
+
+  return energy;
+}
+
+
+PUBLIC int
+E_ExtLoop(int           type,
+          int           si1,
+          int           sj1,
+          vrna_param_t  *P)
+{
+  int energy = 0;
+
+  if (si1 >= 0 && sj1 >= 0)
+    energy += P->mismatchExt[type][si1][sj1];
+  else if (si1 >= 0)
+    energy += P->dangle5[type][si1];
+  else if (sj1 >= 0)
+    energy += P->dangle3[type][sj1];
+
+  if (type > 2)
+    energy += P->TerminalAU;
+
+  return energy;
+}
+
+
+PUBLIC FLT_OR_DBL
+exp_E_Stem(int              type,
+           int              si1,
+           int              sj1,
+           int              extLoop,
+           vrna_exp_param_t *P)
+{
+  double  energy  = 1.0;
+  double  d5      = (si1 >= 0) ? P->expdangle5[type][si1] : 1.;
+  double  d3      = (sj1 >= 0) ? P->expdangle3[type][sj1] : 1.;
+
+  if (si1 >= 0 && sj1 >= 0)
+    energy = (extLoop) ? P->expmismatchExt[type][si1][sj1] : P->expmismatchM[type][si1][sj1];
+  else
+    energy = d5 * d3;
+
+  if (type > 2)
+    energy *= P->expTermAU;
+
+  if (!extLoop)
+    energy *= P->expMLintern[type];
+
+  return (FLT_OR_DBL)energy;
+}
+
+
+PUBLIC FLT_OR_DBL
+exp_E_ExtLoop(int               type,
+              int               si1,
+              int               sj1,
+              vrna_exp_param_t  *P)
+{
+  double energy = 1.0;
+
+  if (si1 >= 0 && sj1 >= 0)
+    energy = P->expmismatchExt[type][si1][sj1];
+  else if (si1 >= 0)
+    energy = P->expdangle5[type][si1];
+  else if (sj1 >= 0)
+    energy = P->expdangle3[type][sj1];
+
+  if (type > 2)
+    energy *= P->expTermAU;
+
+  return (FLT_OR_DBL)energy;
+}
+
+
+PUBLIC int
+vrna_BT_ext_loop_f5(vrna_fold_compound_t  *vc,
+                    int                   *k,
+                    int                   *i,
+                    int                   *j,
+                    vrna_bp_stack_t       *bp_stack,
+                    int                   *stack_count)
+{
+  unsigned char             type;
+  char                      *ptype;
+  short                     mm5, mm3, *S1;
+  unsigned int              *sn;
+  int                       length, fij, fi, jj, u, en, e, *my_f5, *my_c, *my_ggg, *idx,
+                            dangle_model, turn, with_gquad, cnt, ii, with_ud;
+  vrna_param_t              *P;
+  vrna_md_t                 *md;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_ud_t                 *domains_up;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  length        = vc->length;
+  P             = vc->params;
+  md            = &(P->model_details);
+  sn            = vc->strand_number;
+  hc            = vc->hc;
+  sc            = vc->sc;
+  my_f5         = vc->matrices->f5;
+  my_c          = vc->matrices->c;
+  my_ggg        = vc->matrices->ggg;
+  domains_up    = vc->domains_up;
+  idx           = vc->jindx;
+  ptype         = vc->ptype;
+  S1            = vc->sequence_encoding;
+  dangle_model  = md->dangles;
+  turn          = md->min_loop_size;
+  with_gquad    = md->gquad;
+  with_ud       = (domains_up && domains_up->energy_cb) ? 1 : 0;
+
+  hc_dat_local.idx    = idx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ext;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  jj = *k;
+
+  /* nibble off unpaired 3' stretches harboring bound ligands (interspersed with unpaired nucleotides) */
+  if (with_ud) {
+    do {
+      fij = my_f5[jj];
+      fi  = INF;
+
+      /* try nibble off one unpaired nucleotide first */
+      if (evaluate(1, jj, 1, jj - 1, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+        fi = my_f5[jj - 1];
+
+        if (sc) {
+          if (sc->energy_up)
+            fi += sc->energy_up[jj][1];
+          if (sc->f)
+            fi += sc->f(1, jj, 1, jj - 1, VRNA_DECOMP_EXT_EXT, sc->data);
+        }
+
+        if (jj == 1) {
+          /* no more pairs */
+          *i  = *j = -1;
+          *k  = 0;
+          return 1;
+        }
+
+        if (fij == fi) {
+          jj--;
+          continue;
+        }
+      }
+
+      /* next, try nibble off a ligand */
+      for (cnt = 0; cnt < domains_up->uniq_motif_count; cnt++) {
+        u   = domains_up->uniq_motif_size[cnt];
+        ii  = jj - u + 1;
+        if ((ii > 0) && evaluate(1, jj, 1, jj - u, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+          en = domains_up->energy_cb(vc,
+                                     ii, jj,
+                                     VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                     domains_up->data);
+          if (sc) {
+            if (sc->energy_up)
+              en += sc->energy_up[ii][u];
+            if (sc->f)
+              en += sc->f(1, jj, 1, jj - u, VRNA_DECOMP_EXT_EXT, sc->data);
+          }
+          fi  = my_f5[ii - 1];
+          fi  += en;
+
+          if (fij == fi) {
+            /* skip remaining motifs after first hit */
+            jj = ii - 1;
+            break;
+          }
+        }
+      }
+
+      if (jj == 0) {
+        /* no more pairs */
+        *i  = *j = -1;
+        *k  = 0;
+        return 1;
+      }
+    } while (fij == fi);
+  } else {
+    /* nibble off unpaired 3' bases */
+    do {
+      fij = my_f5[jj];
+      fi  = INF;
+
+      if (evaluate(1, jj, 1, jj - 1, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+        fi = my_f5[jj - 1];
+
+        if (sc) {
+          if (sc->energy_up)
+            fi += sc->energy_up[jj][1];
+          if (sc->f)
+            fi += sc->f(1, jj, 1, jj - 1, VRNA_DECOMP_EXT_EXT, sc->data);
+        }
+      }
+
+      if (--jj == 0)
+        break;
+    } while (fij == fi);
+    jj++;
+  }
+
+  if (jj < turn + 2) {
+    /* no more pairs */
+    *i  = *j = -1;
+    *k  = 0;
+    return 1;
+  }
+
+  /* must have found a decomposition */
+  switch (dangle_model) {
+    case 0:   /* j is paired. Find pairing partner */
+      for (u = jj - turn - 1; u >= 1; u--) {
+        if (with_gquad) {
+          if (fij == my_f5[u - 1] + my_ggg[idx[jj] + u]) {
+            *i  = *j = -1;
+            *k  = u - 1;
+            vrna_BT_gquad_mfe(vc, u, jj, bp_stack, stack_count);
+            return 1;
+          }
+        }
+
+        if (evaluate(1, jj, u - 1, u, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+          type = (unsigned char)ptype[idx[jj] + u];
+
+          if (type == 0)
+            type = 7;
+
+          en = my_c[idx[jj] + u];
+          if (sc)
+            if (sc->f)
+              en += sc->f(1, jj, u - 1, u, VRNA_DECOMP_EXT_EXT_STEM, sc->data);
+          if (sn[jj] != sn[u])
+            en += P->DuplexInit;
+          if (fij == E_ExtLoop(type, -1, -1, P) + en + my_f5[u - 1]) {
+            *i                            = u;
+            *j                            = jj;
+            *k                            = u - 1;
+            bp_stack[++(*stack_count)].i  = u;
+            bp_stack[(*stack_count)].j    = jj;
+            return 1;
+          }
+        }
+      }
+      break;
+
+    case 2:
+      mm3 = ((jj < length) && (sn[jj + 1] == sn[jj])) ? S1[jj + 1] : -1;
+      for (u = jj - turn - 1; u >= 1; u--) {
+        if (with_gquad) {
+          if (fij == my_f5[u - 1] + my_ggg[idx[jj] + u]) {
+            *i  = *j = -1;
+            *k  = u - 1;
+            vrna_BT_gquad_mfe(vc, u, jj, bp_stack, stack_count);
+            return 1;
+          }
+        }
+
+        if (evaluate(1, jj, u - 1, u, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+          mm5   = ((u > 1) && (sn[u] == sn[u - 1])) ? S1[u - 1] : -1;
+          type  = (unsigned char)ptype[idx[jj] + u];
+
+          if (type == 0)
+            type = 7;
+
+          en = my_c[idx[jj] + u];
+          if (sc)
+            if (sc->f)
+              en += sc->f(1, jj, u - 1, u, VRNA_DECOMP_EXT_EXT_STEM, sc->data);
+          if (sn[jj] != sn[u])
+            en += P->DuplexInit;
+          if (fij == E_ExtLoop(type, mm5, mm3, P) + en + my_f5[u - 1]) {
+            *i                            = u;
+            *j                            = jj;
+            *k                            = u - 1;
+            bp_stack[++(*stack_count)].i  = u;
+            bp_stack[(*stack_count)].j    = jj;
+            return 1;
+          }
+        }
+      }
+      break;
+
+    default:
+      if (with_gquad) {
+        if (fij == my_ggg[idx[jj] + 1]) {
+          *i  = *j = -1;
+          *k  = 0;
+          vrna_BT_gquad_mfe(vc, 1, jj, bp_stack, stack_count);
+          return 1;
+        }
+      }
+
+      if (evaluate(1, jj, 1, jj, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+        type = (unsigned char)ptype[idx[jj] + 1];
+
+        if (type == 0)
+          type = 7;
+
+        en = my_c[idx[jj] + 1];
+        if (sc)
+          if (sc->f)
+            en += sc->f(1, jj, 1, jj, VRNA_DECOMP_EXT_STEM, sc->data);
+        if (sn[jj] != sn[1])
+          en += P->DuplexInit;
+        if (fij == en + E_ExtLoop(type, -1, -1, P)) {
+          *i                            = 1;
+          *j                            = jj;
+          *k                            = 0;
+          bp_stack[++(*stack_count)].i  = 1;
+          bp_stack[(*stack_count)].j    = jj;
+          return 1;
+        }
+      }
+
+      if (evaluate(1, jj, 1, jj - 1, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+        if (sn[jj] == sn[jj - 1]) {
+          mm3   = S1[jj];
+          type  = (unsigned char)ptype[idx[jj - 1] + 1];
+
+          if (type == 0)
+            type = 7;
+
+          en = my_c[idx[jj - 1] + 1];
+          if (sc) {
+            if (sc->energy_up)
+              en += sc->energy_up[jj][1];
+            if (sc->f)
+              en += sc->f(1, jj, 1, jj - 1, VRNA_DECOMP_EXT_STEM, sc->data);
+          }
+          if (sn[jj - 1] != sn[1])
+            en += P->DuplexInit;
+
+          if (fij == en + E_ExtLoop(type, -1, mm3, P)) {
+            *i                            = 1;
+            *j                            = jj - 1;
+            *k                            = 0;
+            bp_stack[++(*stack_count)].i  = 1;
+            bp_stack[(*stack_count)].j    = jj - 1;
+            return 1;
+          }
+        }
+      }
+
+      for (u = jj - turn - 1; u > 1; u--) {
+        if (with_gquad) {
+          if (fij == my_f5[u - 1] + my_ggg[idx[jj] + u]) {
+            *i  = *j = -1;
+            *k  = u - 1;
+            vrna_BT_gquad_mfe(vc, u, jj, bp_stack, stack_count);
+            return 1;
+          }
+        }
+
+        type = (unsigned char)ptype[idx[jj] + u];
+        if (type == 0)
+          type = 7;
+
+        en = my_c[idx[jj] + u];
+        if (sn[jj] != sn[u])
+          en += P->DuplexInit;
+
+        if (evaluate(1, jj, u - 1, u, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+          e = my_f5[u - 1] + en + E_ExtLoop(type, -1, -1, P);
+          if (sc)
+            if (sc->f)
+              e += sc->f(1, jj, u - 1, u, VRNA_DECOMP_EXT_EXT_STEM, sc->data);
+          if (fij == e) {
+            *i                            = u;
+            *j                            = jj;
+            *k                            = u - 1;
+            bp_stack[++(*stack_count)].i  = u;
+            bp_stack[(*stack_count)].j    = jj;
+            return 1;
+          }
+        }
+
+        if (evaluate(1, jj, u - 2, u, VRNA_DECOMP_EXT_EXT_STEM, &hc_dat_local)) {
+          if (sn[u] == sn[u - 1]) {
+            mm5 = S1[u - 1];
+            e   = my_f5[u - 2] + en + E_ExtLoop(type, mm5, -1, P);
+            if (sc) {
+              if (sc->energy_up)
+                e += sc->energy_up[u - 1][1];
+              if (sc->f)
+                e += sc->f(1, jj, u - 2, u, VRNA_DECOMP_EXT_EXT_STEM, sc->data);
+            }
+            if (fij == e) {
+              *i                            = u;
+              *j                            = jj;
+              *k                            = u - 2;
+              bp_stack[++(*stack_count)].i  = u;
+              bp_stack[(*stack_count)].j    = jj;
+              return 1;
+            }
+          }
+        }
+
+        type = (unsigned char)ptype[idx[jj - 1] + u];
+        if (type == 0)
+          type = 7;
+
+        en = my_c[idx[jj - 1] + u];
+        if (sn[jj - 1] != sn[u])
+          en += P->DuplexInit;
+
+        mm5 = (sn[u] == sn[u - 1]) ? S1[u - 1] : -1;
+        mm3 = (sn[jj] == sn[jj - 1]) ? S1[jj] : -1;
+
+        if (evaluate(1, jj, u - 1, u, VRNA_DECOMP_EXT_EXT_STEM1, &hc_dat_local)) {
+          e = my_f5[u - 1] + en + E_ExtLoop(type, -1, mm3, P);
+
+          if (sc) {
+            if (sc->energy_up)
+              e += sc->energy_up[jj][1];
+            if (sc->f)
+              e += sc->f(1, jj, u - 1, u, VRNA_DECOMP_EXT_EXT_STEM1, sc->data);
+          }
+
+          if (fij == e) {
+            *i                            = u;
+            *j                            = jj - 1;
+            *k                            = u - 1;
+            bp_stack[++(*stack_count)].i  = u;
+            bp_stack[(*stack_count)].j    = jj - 1;
+            return 1;
+          }
+        }
+
+        if (evaluate(1, jj, u - 2, u, VRNA_DECOMP_EXT_EXT_STEM1, &hc_dat_local)) {
+          e = my_f5[u - 2] + en + E_ExtLoop(type, mm5, mm3, P);
+          if (sc) {
+            if (sc->energy_up)
+              e += sc->energy_up[jj][1]
+                   + sc->energy_up[u - 1][1];
+            if (sc->f)
+              e += sc->f(1, jj, u - 2, u, VRNA_DECOMP_EXT_EXT_STEM1, sc->data);
+          }
+          if (fij == e) {
+            *i                            = u;
+            *j                            = jj - 1;
+            *k                            = u - 2;
+            bp_stack[++(*stack_count)].i  = u;
+            bp_stack[(*stack_count)].j    = jj - 1;
+            return 1;
+          }
+        }
+      }
+      break;
+  }
+
+  return 0;
+}
+
+
+PUBLIC vrna_mx_pf_aux_el_t *
+vrna_exp_E_ext_fast_init(vrna_fold_compound_t *vc)
+{
+  vrna_mx_pf_aux_el_t *aux_mx = NULL;
+
+  if (vc) {
+    char                      *hc;
+    unsigned int              u, s;
+    int                       i, j, d, n, turn, ij, *idx, *iidx, *hc_up;
+    FLT_OR_DBL                *q, *scale;
+    vrna_callback_hc_evaluate *evaluate;
+    struct default_data       hc_dat_local;
+
+    n     = (int)vc->length;
+    idx   = vc->jindx;
+    iidx  = vc->iindx;
+    turn  = vc->exp_params->model_details.min_loop_size;
+    q     = vc->exp_matrices->q;
+    scale = vc->exp_matrices->scale;
+    hc    = vc->hc->matrix;
+    hc_up = vc->hc->up_ext;
+
+    hc_dat_local.idx    = idx;
+    hc_dat_local.mx     = hc;
+    hc_dat_local.hc_up  = hc_up;
+    hc_dat_local.cp     = vc->cutpoint;
+
+    if (vc->hc->f) {
+      evaluate            = &hc_default_user;
+      hc_dat_local.hc_f   = vc->hc->f;
+      hc_dat_local.hc_dat = vc->hc->data;
+    } else {
+      evaluate = &hc_default;
+    }
+
+
+    /* allocate memory for helper arrays */
+    aux_mx            = (vrna_mx_pf_aux_el_t *)vrna_alloc(sizeof(vrna_mx_pf_aux_el_t));
+    aux_mx->qq        = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 2));
+    aux_mx->qq1       = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 2));
+    aux_mx->qqu_size  = 0;
+    aux_mx->qqu       = NULL;
+
+    if (vc->type == VRNA_FC_TYPE_SINGLE) {
+      vrna_sc_t *sc         = vc->sc;
+      vrna_ud_t *domains_up = vc->domains_up;
+      int       with_ud     = (domains_up && domains_up->exp_energy_cb);
+
+      /* pre-processing ligand binding production rule(s) and auxiliary memory */
+      if (with_ud) {
+        int ud_max_size = 0;
+        for (u = 0; u < domains_up->uniq_motif_count; u++)
+          if (ud_max_size < domains_up->uniq_motif_size[u])
+            ud_max_size = domains_up->uniq_motif_size[u];
+
+        aux_mx->qqu_size  = ud_max_size;
+        aux_mx->qqu       = (FLT_OR_DBL **)vrna_alloc(sizeof(FLT_OR_DBL *) * (ud_max_size + 1));
+
+        for (u = 0; u <= ud_max_size; u++)
+          aux_mx->qqu[u] = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 2));
+      }
+
+      for (d = 0; d <= turn; d++)
+        for (i = 1; i <= n - d; i++) {
+          j   = i + d;
+          ij  = iidx[i] - j;
+
+          if (j > n)
+            continue;
+
+          if (evaluate(i, j, i, j, VRNA_DECOMP_EXT_UP, &hc_dat_local)) {
+            q[ij] = 1.0 * scale[d + 1];
+
+            if (sc) {
+              if (sc->exp_energy_up)
+                q[ij] *= sc->exp_energy_up[i][d + 1];
+              if (sc->exp_f)
+                q[ij] *= sc->exp_f(i, j, i, j, VRNA_DECOMP_EXT_UP, sc->data);
+            }
+
+            if (with_ud) {
+              q[ij] += q[ij] * domains_up->exp_energy_cb(vc,
+                                                         i, j,
+                                                         VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP,
+                                                         domains_up->data);
+            }
+          } else {
+            q[ij] = 0.;
+          }
+        }
+    } else if (vc->type == VRNA_FC_TYPE_COMPARATIVE) {
+      vrna_sc_t       **scs = vc->scs;
+      unsigned short  **a2s = vc->a2s;
+      for (d = 0; d <= turn; d++)
+        for (i = 1; i <= n - d; i++) {
+          j   = i + d;
+          ij  = iidx[i] - j;
+          if (evaluate(i, j, i, j, VRNA_DECOMP_EXT_UP, &hc_dat_local)) {
+            q[ij] = 1.0 * scale[d + 1];
+
+            if (scs) {
+              for (s = 0; s < vc->n_seq; s++)
+                if (scs[s]) {
+                  u = d + 1 /* a2s[s][j] - a2s[s][i] + 1 */;
+                  if (scs[s]->exp_energy_up)
+                    q[ij] *= scs[s]->exp_energy_up[a2s[s][i]][u];
+                }
+            }
+          } else {
+            q[ij] = 0.;
+          }
+        }
+    }
+  }
+
+  return aux_mx;
+}
+
+
+PUBLIC void
+vrna_exp_E_ext_fast_rotate(vrna_fold_compound_t *vc,
+                           vrna_mx_pf_aux_el_t  *aux_mx)
+{
+  if (vc && aux_mx) {
+    int         u;
+    FLT_OR_DBL  *tmp;
+
+    tmp         = aux_mx->qq1;
+    aux_mx->qq1 = aux_mx->qq;
+    aux_mx->qq  = tmp;
+
+    /* rotate auxiliary arrays for unstructured domains */
+    if (aux_mx->qqu) {
+      tmp = aux_mx->qqu[aux_mx->qqu_size];
+      for (u = aux_mx->qqu_size; u > 0; u--)
+        aux_mx->qqu[u] = aux_mx->qqu[u - 1];
+      aux_mx->qqu[0] = tmp;
+    }
+  }
+}
+
+
+PUBLIC void
+vrna_exp_E_ext_fast_free(vrna_fold_compound_t *vc,
+                         vrna_mx_pf_aux_el_t  *aux_mx)
+{
+  if (vc && aux_mx) {
+    int u;
+
+    free(aux_mx->qq);
+    free(aux_mx->qq1);
+
+    if (aux_mx->qqu) {
+      for (u = 0; u <= aux_mx->qqu_size; u++)
+        free(aux_mx->qqu[u]);
+
+      free(aux_mx->qqu);
+    }
+    free(aux_mx);
+  }
+}
+
+
+PUBLIC FLT_OR_DBL
+vrna_exp_E_ext_fast(vrna_fold_compound_t  *vc,
+                    int                   i,
+                    int                   j,
+                    vrna_mx_pf_aux_el_t   *aux_mx)
+{
+  if (vc) {
+    switch (vc->type) {
+      case VRNA_FC_TYPE_SINGLE:
+        return exp_E_ext_fast(vc, i, j, aux_mx);
+        break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:
+        return exp_E_ext_fast_comparative(vc, i, j, aux_mx);
+        break;
+
+      default:
+        vrna_message_warning("vrna_exp_E_ext_fast@exterior_loops.c: Unknown fold_compound type");
+        return 0.;
+        break;
+    }
+  } else {
+    return 0.;
+  }
+}
+
+
+PRIVATE FLT_OR_DBL
+exp_E_ext_fast(vrna_fold_compound_t *vc,
+               int                  i,
+               int                  j,
+               vrna_mx_pf_aux_el_t  *aux_mx)
+{
+  short                     *S1;
+  unsigned char             type;
+  int                       n, *iidx, k, ij, kl, with_ud, u, circular, with_gquad;
+  FLT_OR_DBL                qbt1, *q, *qb, *qq, *qq1, **qqu, q_temp, *scale, q_temp2, *G;
+  vrna_md_t                 *md;
+  vrna_exp_param_t          *pf_params;
+  vrna_ud_t                 *domains_up;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  n                   = (int)vc->length;
+  iidx                = vc->iindx;
+  ij                  = iidx[i] - j;
+  qq                  = aux_mx->qq;
+  qq1                 = aux_mx->qq1;
+  qqu                 = aux_mx->qqu;
+  q                   = vc->exp_matrices->q;
+  qb                  = vc->exp_matrices->qb;
+  G                   = vc->exp_matrices->G;
+  scale               = vc->exp_matrices->scale;
+  pf_params           = vc->exp_params;
+  md                  = &(pf_params->model_details);
+  hc                  = vc->hc;
+  sc                  = vc->sc;
+  domains_up          = vc->domains_up;
+  circular            = md->circ;
+  with_gquad          = md->gquad;
+  with_ud             = (domains_up && domains_up->exp_energy_cb);
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ext;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  qbt1 = 0.;
+
+  /* all exterior loop parts [i, j] with exactly one stem (i, u) i < u < j */
+  if (evaluate(i, j, i, j - 1, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+    q_temp = qq1[i] * scale[1];
+
+    if (sc) {
+      if (sc->exp_energy_up)
+        q_temp *= sc->exp_energy_up[j][1];
+
+      if (sc->exp_f)
+        q_temp *= sc->exp_f(i, j, i, j - 1, VRNA_DECOMP_EXT_EXT, sc->data);
+    }
+
+    if (with_ud) {
+      int cnt;
+      for (cnt = 0; cnt < domains_up->uniq_motif_count; cnt++) {
+        u = domains_up->uniq_motif_size[cnt];
+        if (j - u >= i) {
+          if (evaluate(i, j, i, j - u, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+            q_temp2 = qqu[u][i]
+                      * domains_up->exp_energy_cb(vc,
+                                                  j - u + 1, j,
+                                                  VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                                  domains_up->data)
+                      * scale[u];
+
+            if (sc) {
+              if (sc->exp_energy_up)
+                q_temp2 *= sc->exp_energy_up[j - u + 1][u];
+              if (sc->exp_f)
+                q_temp2 *= sc->exp_f(i, j, i, j - u, VRNA_DECOMP_EXT_EXT, sc->data);
+            }
+
+            q_temp += q_temp2;
+          }
+        }
+      }
+    }
+
+    qbt1 += q_temp;
+  }
+
+  /* exterior loop part with stem (i, j) */
+  if (evaluate(i, j, i, j, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+    S1    = vc->sequence_encoding;
+    type  = md->pair[S1[i]][S1[j]];
+    if (type == 0)
+      type = 7;
+
+    q_temp = qb[ij]
+             * exp_E_ExtLoop(type, ((i > 1) || circular) ? S1[i - 1] : -1, ((j < n) || circular) ? S1[j + 1] : -1, pf_params);
+
+    if (sc)
+      if (sc->exp_f)
+        q_temp *= sc->exp_f(i, j, i, j, VRNA_DECOMP_EXT_STEM, sc->data);
+    qbt1 += q_temp;
+  }
+
+  if (with_gquad)
+    qbt1 += G[ij];
+
+  qq[i] = qbt1;
+
+  if (with_ud)
+    qqu[0][i] = qbt1;
+
+  /* the entire stretch [i,j] is unpaired */
+  if (evaluate(i, j, i, j, VRNA_DECOMP_EXT_UP, &hc_dat_local)) {
+    u       = j - i + 1;
+    q_temp  = 1.0 * scale[u];
+
+    if (sc) {
+      if (sc->exp_energy_up)
+        q_temp *= sc->exp_energy_up[i][u];
+
+      if (sc->exp_f)
+        q_temp *= sc->exp_f(i, j, i, j, VRNA_DECOMP_EXT_UP, sc->data);
+    }
+
+    qbt1 += q_temp;
+
+    if (with_ud) {
+      qbt1 += q_temp * domains_up->exp_energy_cb(vc,
+                                                 i, j,
+                                                 VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP,
+                                                 domains_up->data);
+    }
+  }
+
+  kl = iidx[i] - j + 1;
+  if (sc && sc->exp_f) {
+    for (k = j; k > i; k--, kl++) {
+      q_temp  = q[kl] * qq[k];
+      q_temp  *= sc->exp_f(i, j, k - 1, k, VRNA_DECOMP_EXT_EXT_EXT, sc->data);
+      qbt1    += q_temp;
+    }
+  } else {
+    for (k = j; k > i; k--, kl++)
+      qbt1 += q[kl] * qq[k];
+  }
+
+  return qbt1;
+}
+
+
+PRIVATE FLT_OR_DBL
+exp_E_ext_fast_comparative(vrna_fold_compound_t *vc,
+                           int                  i,
+                           int                  j,
+                           vrna_mx_pf_aux_el_t  *aux_mx)
+{
+  int                       n, s, n_seq, *iidx, k, ij, kl, u, circular, type;
+  unsigned short            **a2s;
+  short                     **S, **S5, **S3;
+  FLT_OR_DBL                qbt1, *q, *qb, *qq, *qq1, q_temp, *scale;
+  vrna_md_t                 *md;
+  vrna_exp_param_t          *pf_params;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 **scs;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  n                   = (int)vc->length;
+  n_seq               = vc->n_seq;
+  iidx                = vc->iindx;
+  ij                  = iidx[i] - j;
+  S                   = vc->S;
+  S5                  = vc->S5;     /* S5[s][i] holds next base 5' of i in sequence s */
+  S3                  = vc->S3;     /* Sl[s][i] holds next base 3' of i in sequence s */
+  a2s                 = vc->a2s;
+  qq                  = aux_mx->qq;
+  qq1                 = aux_mx->qq1;
+  q                   = vc->exp_matrices->q;
+  qb                  = vc->exp_matrices->qb;
+  scale               = vc->exp_matrices->scale;
+  pf_params           = vc->exp_params;
+  md                  = &(pf_params->model_details);
+  hc                  = vc->hc;
+  scs                 = vc->scs;
+  circular            = md->circ;
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ext;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  qbt1 = 0.;
+
+  /* all exterior loop parts [i, j] with exactly one stem (i, u) i < u < j */
+  if (evaluate(i, j, i, j - 1, VRNA_DECOMP_EXT_EXT, &hc_dat_local)) {
+    q_temp = qq1[i] * scale[1];
+
+    if (scs) {
+      for (s = 0; s < n_seq; s++) {
+        if (scs[s])
+          if (scs[s]->exp_energy_up)
+            q_temp *= scs[s]->exp_energy_up[a2s[s][j]][1];
+      }
+    }
+
+    qbt1 += q_temp;
+  }
+
+  /* exterior loop part with stem (i, j) */
+  if (evaluate(i, j, i, j, VRNA_DECOMP_EXT_STEM, &hc_dat_local)) {
+    q_temp = qb[ij];
+
+    for (s = 0; s < n_seq; s++) {
+      type = md->pair[S[s][i]][S[s][j]];
+      if (type == 0)
+        type = 7;
+
+      q_temp *= exp_E_ExtLoop(type, ((i > 1) || circular) ? S5[s][i] : -1, ((j < n) || circular) ? S3[s][j] : -1, pf_params);
+    }
+
+    qbt1 += q_temp;
+  }
+
+  qq[i] = qbt1;
+
+  /* the entire stretch [i,j] is unpaired */
+  if (evaluate(i, j, i, j, VRNA_DECOMP_EXT_UP, &hc_dat_local)) {
+    u       = j - i + 1;
+    q_temp  = 1.0 * scale[u];
+
+    if (scs) {
+      for (s = 0; s < n_seq; s++) {
+        if (scs[s])
+          if (scs[s]->exp_energy_up)
+            q_temp *= scs[s]->exp_energy_up[a2s[s][i]][a2s[s][j] - a2s[s][i] + 1];
+      }
+    }
+
+    qbt1 += q_temp;
+  }
+
+  kl = iidx[i] - j + 1;
+  for (k = j; k > i; k--, kl++)
+    qbt1 += q[kl] * qq[k];
+
+  return qbt1;
+}
+
+
+PRIVATE char
+hc_default(int  i,
+           int  j,
+           int  k,
+           int  l,
+           char d,
+           void *data)
+{
+  int                 kl, di, dj;
+  char                eval;
+  struct default_data *dat = (struct default_data *)data;
+
+  eval  = (char)0;
+  di    = k - i;
+  dj    = j - l;
+  switch (d) {
+    case VRNA_DECOMP_EXT_EXT_STEM:
+      kl = dat->idx[j] + l;
+      if (dat->mx[kl] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+        eval = (char)1;
+        if (i != l) {
+          /* otherwise, stem spans from i to j */
+          di = l - k + 1;
+          if ((di != 0) && (dat->hc_up[k + 1] < di))
+            eval = (char)0;
+        }
+      }
+      break;
+
+    case VRNA_DECOMP_EXT_EXT_STEM1:
+      kl = dat->idx[j - 1] + l;
+      if (dat->mx[kl] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+        eval = (char)1;
+        if (i != l) {
+          /* otherwise, stem spans from i to j - 1 */
+          di = l - k + 1;
+          if (dat->hc_up[j] == 0)
+            eval = (char)0;
+          if ((di != 0) && (dat->hc_up[k + 1] < di))
+            eval = (char)0;
+        }
+      }
+      break;
+
+    case VRNA_DECOMP_EXT_STEM:
+      kl = dat->idx[l] + k;
+      if (dat->mx[kl] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+        eval = (char)1;
+        if ((di != 0) && (dat->hc_up[i] < di))
+          eval = (char)0;
+        if ((dj != 0) && (dat->hc_up[l + 1] < dj))
+          eval = (char)0;
+      }
+      break;
+
+    case VRNA_DECOMP_EXT_EXT:
+      eval = (char)1;
+      if ((di != 0) && (dat->hc_up[i] < di))
+        eval = (char)0;
+      if ((dj != 0) && (dat->hc_up[l + 1] < dj))
+        eval = (char)0;
+      break;
+
+    case VRNA_DECOMP_EXT_UP:
+      di    = j - i + 1;
+      eval  = (dat->hc_up[i] >= di) ? (char)1 : (char)0;
+      break;
+
+    default:
+      nrerror("wtf");
+  }
+  return eval;
+}
+
+
+PRIVATE char
+hc_default_user(int   i,
+                int   j,
+                int   k,
+                int   l,
+                char  d,
+                void  *data)
+{
+  char                eval;
+  struct default_data *dat = (struct default_data *)data;
+
+  eval  = hc_default(i, j, k, l, d, data);
+  eval  = (dat->hc_f(i, j, k, l, d, dat->hc_dat)) ? eval : (char)0;
+
+  return eval;
+}
diff --git a/C/ViennaRNA/exterior_loops.h b/C/ViennaRNA/exterior_loops.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/exterior_loops.h
@@ -0,0 +1,175 @@
+#ifndef VIENNA_RNA_PACKAGE_EXTERIOR_LOOPS_H
+#define VIENNA_RNA_PACKAGE_EXTERIOR_LOOPS_H
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+
+/**
+ *  @file     exterior_loops.h
+ *  @ingroup  loops
+ *  @brief    Energy evaluation of exterior loops for MFE and partition function calculations
+ */
+
+/**
+ *  @{
+ *  @ingroup   loops
+ *
+ */
+
+/**
+ *  @brief  Auxiliary helper arrays for fast exterior loop computations
+ *
+ *  @see vrna_exp_E_ext_fast_init(), vrna_exp_E_ext_fast_rotate(),
+ *  vrna_exp_E_ext_fast_free(), vrna_exp_E_ext_fast()
+ */
+typedef struct {
+  FLT_OR_DBL  *qq;
+  FLT_OR_DBL  *qq1;
+
+  int         qqu_size;
+  FLT_OR_DBL  **qqu;
+} vrna_mx_pf_aux_el_t;
+
+
+/**
+ *  <H2>Compute the Energy contribution of an Exterior loop stem</H2>
+ *  This definition is a wrapper for the E_Stem() function.
+ *  It is substituted by an E_Stem() function call with argument
+ *  extLoop=1, so the energy contribution returned reflects a
+ *  stem introduced in an exterior-loop.<BR>
+ *  As for the parameters si1 and sj1 of the substituted
+ *  E_Stem() function, you can inhibit to take 5'-, 3'-dangles
+ *  or mismatch contributions to be taken into account by passing
+ *  -1 to these parameters.
+ * 
+ *  @see    E_Stem()
+ *  @param  type  The pair type of the stem-closing pair
+ *  @param  si1   The 5'-mismatching nucleotide
+ *  @param  sj1   The 3'-mismatching nucleotide
+ *  @param  P     The data structure containing scaled energy parameters
+ *  @return       The energy contribution of the introduced exterior-loop stem
+ */
+int E_ExtLoop(int type,
+              int si1,
+              int sj1,
+              vrna_param_t *P);
+
+/**
+ *  This is the partition function variant of @ref E_ExtLoop()
+ *  @see E_ExtLoop()
+ *  @return The Boltzmann weighted energy contribution of the introduced exterior-loop stem
+ */
+FLT_OR_DBL exp_E_ExtLoop( int type,
+                      int si1,
+                      int sj1,
+                      vrna_exp_param_t *P);
+
+/**
+ *  <H2>Compute the energy contribution of a stem branching off a loop-region</H2>
+ *  This function computes the energy contribution of a stem that branches off
+ *  a loop region. This can be the case in multiloops, when a stem branching off
+ *  increases the degree of the loop but also <I>immediately interior base pairs</I>
+ *  of an exterior loop contribute free energy.
+ *  To switch the behavior of the function according to the evaluation of a multiloop-
+ *  or exterior-loop-stem, you pass the flag 'extLoop'.
+ *  The returned energy contribution consists of a TerminalAU penalty if the pair type
+ *  is greater than 2, dangling end contributions of mismatching nucleotides adjacent to
+ *  the stem if only one of the si1, sj1 parameters is greater than 0 and mismatch energies
+ *  if both mismatching nucleotides are positive values.
+ *  Thus, to avoid incorporating dangling end or mismatch energies just pass a negative number,
+ *  e.g. -1 to the mismatch argument.
+ * 
+ *  This is an illustration of how the energy contribution is assembled:
+ *  <PRE>
+ *        3'  5'
+ *        |   |
+ *        X - Y
+ *  5'-si1     sj1-3'
+ *  </PRE>
+ * 
+ *  Here, (X,Y) is the base pair that closes the stem that branches off a loop region.
+ *  The nucleotides si1 and sj1 are the 5'- and 3'- mismatches, respectively. If the base pair
+ *  type of (X,Y) is greater than 2 (i.e. an A-U or G-U pair, the TerminalAU penalty will be
+ *  included in the energy contribution returned. If si1 and sj1 are both nonnegative numbers,
+ *  mismatch energies will also be included. If one of si1 or sj1 is a negative value, only
+ *  5' or 3' dangling end contributions are taken into account. To prohibit any of these mismatch
+ *  contributions to be incorporated, just pass a negative number to both, si1 and sj1.
+ *  In case the argument extLoop is 0, the returned energy contribution also includes
+ *  the <I>internal-loop-penalty</I> of a multiloop stem with closing pair type.
+ * 
+ *  @see    E_MLstem()
+ *  @see    E_ExtLoop()
+ *  @note   This function is threadsafe
+ * 
+ *  @param  type    The pair type of the first base pair un the stem
+ *  @param  si1     The 5'-mismatching nucleotide
+ *  @param  sj1     The 3'-mismatching nucleotide
+ *  @param  extLoop A flag that indicates whether the contribution reflects the one of an exterior loop or not
+ *  @param  P       The data structure containing scaled energy parameters
+ *  @return         The Free energy of the branch off the loop in dcal/mol
+ * 
+ */
+int E_Stem( int type,
+            int si1,
+            int sj1,
+            int extLoop,
+            vrna_param_t *P);
+
+/**
+ *  <H2>Compute the Boltzmann weighted energy contribution of a stem branching off a loop-region</H2>
+ *  This is the partition function variant of @ref E_Stem()
+ *  @see E_Stem()
+ *  @note This function is threadsafe
+ * 
+ *  @return The Boltzmann weighted energy contribution of the branch off the loop
+ */
+FLT_OR_DBL exp_E_Stem(int type,
+                  int si1,
+                  int sj1,
+                  int extLoop,
+                  vrna_exp_param_t *P);
+
+
+int
+E_ext_loop( int i,
+            int j,
+            vrna_fold_compound_t *vc);
+
+void
+E_ext_loop_5( vrna_fold_compound_t *vc);
+
+int
+vrna_BT_ext_loop_f5(vrna_fold_compound_t *vc,
+                    int *k,
+                    int *i,
+                    int *j,
+                    vrna_bp_stack_t *bp_stack,
+                    int *stack_count);
+
+
+vrna_mx_pf_aux_el_t *
+vrna_exp_E_ext_fast_init(vrna_fold_compound_t *vc);
+
+
+void
+vrna_exp_E_ext_fast_rotate( vrna_fold_compound_t  *vc,
+                            vrna_mx_pf_aux_el_t   *aux_mx);
+
+
+void
+vrna_exp_E_ext_fast_free( vrna_fold_compound_t  *vc,
+                          vrna_mx_pf_aux_el_t   *aux_mx);
+
+
+FLT_OR_DBL
+vrna_exp_E_ext_fast(vrna_fold_compound_t  *vc,
+                    int                   i,
+                    int                   j,
+                    vrna_mx_pf_aux_el_t   *aux_mx);
+
+/**
+ * @}
+ */
+
+
+#endif
diff --git a/C/ViennaRNA/file_formats.c b/C/ViennaRNA/file_formats.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/file_formats.c
@@ -0,0 +1,593 @@
+/*
+    file_formats.c
+
+    Various functions dealing with file formats for RNA sequences, structures, and alignments
+
+    (c) 2014 Ronny Lorenz
+
+    Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <ctype.h>
+
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/file_utils.h"
+#include "ViennaRNA/constraints.h"
+#if WITH_JSON_SUPPORT
+# include <json/json.h>
+#endif
+#include "ViennaRNA/file_formats.h"
+
+#define DEBUG
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+PRIVATE char          *inbuf  = NULL;
+PRIVATE char          *inbuf2 = NULL;
+PRIVATE unsigned int  typebuf = 0;
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+PRIVATE unsigned int
+read_multiple_input_lines(char **string, FILE *file, unsigned int option);
+
+PRIVATE void
+elim_trailing_ws(char *string);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PRIVATE void
+elim_trailing_ws(char *string){    /* eliminate whitespaces at the end of a character string */
+
+  int i, l = strlen(string);
+
+  for(i = l-1; i >= 0; i--){
+    if      (string[i] == ' ')  continue;
+    else if (string[i] == '\t') continue;
+    else                        break;
+  }
+  string[(i >= 0) ? (i+1) : 0] = '\0';
+}
+
+PUBLIC void
+vrna_file_helixlist(const char *seq,
+                    const char *db,
+                    float energy,
+                    FILE *file){
+
+  int         s;
+  short       *pt;
+  vrna_hx_t   *list;
+  FILE *out;
+
+  if(strlen(seq) != strlen(db))
+    vrna_message_error("vrna_file_helixlist: sequence and structure have unequal length!");
+
+  out   = (file) ? file : stdout;
+  pt    = vrna_ptable(db);
+  list  = vrna_hx_from_ptable(pt);
+
+  fprintf(out, "%s\t%6.2f\n", seq, energy);
+  for(s = 0; list[s].length > 0; s++){
+    fprintf(out, "%d\t%d\t%d\n", list[s].start, list[s].end, list[s].length);
+  }
+
+  free(pt);
+  free(list);
+}
+
+PUBLIC void
+vrna_file_connect(const char *seq,
+                  const char *db,
+                  float energy,
+                  const char *identifier,
+                  FILE *file){
+
+  int i, power_d;
+  FILE *out = (file) ? file : stdout;
+
+  if(strlen(seq) != strlen(db))
+    vrna_message_error("vrna_file_connect: sequence and structure have unequal length!");
+
+  short *pt = vrna_ptable(db);
+
+  for(power_d=0;pow(10,power_d) <= (int)strlen(seq);power_d++);
+
+  /*
+    Connect table file format looks like this:
+
+    300  ENERGY = 7.0  example
+      1 G       0    2   22    1
+      2 G       1    3   21    2
+
+    where the headerline is followed by 6 columns with:
+    1. Base number: index n
+    2. Base (A, C, G, T, U, X)
+    3. Index n-1  (0 if first nucleotide)
+    4. Index n+1  (0 if last nucleotide)
+    5. Number of the base to which n is paired. No pairing is indicated by 0 (zero).
+    6. Natural numbering.
+  */
+
+  /* print header */
+  fprintf(out, "%d  ENERGY = %6.2f", (int)strlen(seq), energy);
+  if(identifier)
+    fprintf(out, "  %s\n", identifier);
+
+  /* print structure information except for last line */
+  /* TODO: modify the structure information for cofold */
+  for(i = 0; i < strlen(seq) - 1; i++){
+    fprintf(out, "%*d %c %*d %*d %*d %*d\n",
+                  power_d, i+1,           /* nucleotide index */
+                  (char)toupper(seq[i]),  /* nucleotide char */
+                  power_d, i,             /* nucleotide predecessor index */
+                  power_d, i+2,           /* nucleotide successor index */
+                  power_d, pt[i+1],       /* pairing partner index */
+                  power_d, i+1);          /* nucleotide natural numbering */
+  }
+  /* print last line */
+  fprintf(out, "%*d %c %*d %*d %*d %*d\n",
+                power_d, i+1,
+                (char)toupper(seq[i]),
+                power_d, i,
+                power_d, 0,
+                power_d, pt[i+1],
+                power_d, i+1);
+
+  /* clean up */
+  free(pt);
+  fflush(out);
+}
+
+PUBLIC void
+vrna_file_bpseq(const char *seq,
+                const char *db,
+                FILE *file){
+
+  int i;
+  FILE *out = (file) ? file : stdout;
+
+  if(strlen(seq) != strlen(db))
+    vrna_message_error("vrna_file_bpseq: sequence and structure have unequal length!");
+
+  short *pt = vrna_ptable(db);
+
+  for(i = 1; i <= pt[0]; i++){
+    fprintf(out, "%d %c %d\n", i, (char)toupper(seq[i-1]), pt[i]);
+  }
+
+  /* clean up */
+  free(pt);
+  fflush(out);
+}
+
+#if WITH_JSON_SUPPORT
+
+PUBLIC void
+vrna_file_json( const char *seq,
+                const char *db,
+                double energy,
+                const char *identifier,
+                FILE *file){
+
+  FILE *out = (file) ? file : stdout;
+
+  JsonNode *data  = json_mkobject();
+  JsonNode *value;
+
+  if(identifier){
+    value = json_mkstring(identifier);
+    json_append_member(data, "id", value);
+  }
+
+  value = json_mkstring(seq);
+  json_append_member(data, "sequence", value);
+
+  value = json_mknumber(energy);
+  json_append_member(data, "mfe", value);
+
+  value = json_mkstring(db);
+  json_append_member(data, "structure", value);
+
+  
+  fprintf(out, "%s\n", json_stringify(data, "\t"));
+
+  fflush(out);
+}
+
+#endif
+
+PRIVATE  unsigned int
+read_multiple_input_lines(char **string,
+                          FILE *file,
+                          unsigned int option){
+
+  char  *line;
+  int   i, l;
+  int   state = 0;
+  int   str_length = 0;
+  FILE  *in = (file) ? file : stdin;
+
+  line = (inbuf2) ? inbuf2 : vrna_read_line(in);
+  inbuf2 = NULL;
+  do{
+
+    /*
+    * read lines until informative data appears or
+    * report an error if anything goes wrong
+    */
+    if(!line) return VRNA_INPUT_ERROR;
+
+    l = (int)strlen(line);
+
+    /* eliminate whitespaces at the end of the line read */
+    if(!(option & VRNA_INPUT_NO_TRUNCATION))
+      elim_trailing_ws(line);
+
+    l           = (int)strlen(line);
+    str_length  = (*string) ? (int) strlen(*string) : 0;
+
+    switch(*line){
+      case  '@':    /* user abort */
+                    if(state) inbuf2 = line;
+                    else      free(line);
+                    return (state==2) ? VRNA_INPUT_CONSTRAINT : (state==1) ? VRNA_INPUT_SEQUENCE : VRNA_INPUT_QUIT;
+
+      case  '\0':   /* empty line */
+                    if(option & VRNA_INPUT_NOSKIP_BLANK_LINES){
+                      if(state) inbuf2 = line;
+                      else      free(line);
+                      return (state==2) ? VRNA_INPUT_CONSTRAINT : (state==1) ? VRNA_INPUT_SEQUENCE : VRNA_INPUT_BLANK_LINE;
+                    }
+                    break;
+
+      case  '#': case  '%': case  ';': case  '/': case  '*': case ' ':
+                    /* comments */
+                    if(option & VRNA_INPUT_NOSKIP_COMMENTS){
+                      if(state) inbuf2   = line;
+                      else      *string = line;
+                      return (state == 2) ? VRNA_INPUT_CONSTRAINT : (state==1) ? VRNA_INPUT_SEQUENCE : VRNA_INPUT_COMMENT;
+                    }
+                    break;
+
+      case  '>':    /* fasta header */
+                    if(state) inbuf2   = line;
+                    else      *string = line;
+                    return (state==2) ? VRNA_INPUT_CONSTRAINT : (state==1) ? VRNA_INPUT_SEQUENCE : VRNA_INPUT_FASTA_HEADER;
+
+      case  'x': case 'e': case 'l': case '&':   /* seems to be a constraint or line starting with second sequence for dimer calculations */
+                    i = 1;
+                    /* lets see if this assumption holds for the complete line */
+                    while((line[i] == 'x') || (line[i] == 'e') || (line[i] == 'l')) i++;
+                    /* lines solely consisting of 'x's, 'e's or 'l's will be considered as structure constraint */
+                    
+                    if(
+                            ((line[i]>64) && (line[i]<91))  /* A-Z */
+                        ||  ((line[i]>96) && (line[i]<123)) /* a-z */
+                      ){
+                      if(option & VRNA_INPUT_FASTA_HEADER){
+                        /* are we in structure mode? Then we remember this line for the next round */
+                        if(state == 2){ inbuf2 = line; return VRNA_INPUT_CONSTRAINT;}
+                        else{
+                          *string = (char *)vrna_realloc(*string, sizeof(char) * (str_length + l + 1));
+                          strcpy(*string + str_length, line);
+                          state = 1;
+                        }
+                        break;
+                      }
+                      /* otherwise return line read */
+                      else{ *string = line; return VRNA_INPUT_SEQUENCE;}
+                    }
+                    /* mmmh? it really seems to be a constraint */
+                    /* fallthrough */
+      case  '<': case  '.': case  '|': case  '(': case ')': case '[': case ']': case '{': case '}': case ',': case '+':
+                    /* seems to be a structure or a constraint */
+                    /* either we concatenate this line to one that we read previously */
+                    if(option & VRNA_INPUT_FASTA_HEADER){
+                      if(state == 1){
+                        inbuf2 = line;
+                        return VRNA_INPUT_SEQUENCE;
+                      }
+                      else{
+                        *string = (char *)vrna_realloc(*string, sizeof(char) * (str_length + l + 1));
+                        strcpy(*string + str_length, line);
+                        state = 2;
+                      }
+                    }
+                    /* or we return it as it is */
+                    else{
+                      *string = line;
+                      return VRNA_INPUT_CONSTRAINT;
+                    }
+                    break;
+      default:      if(option & VRNA_INPUT_FASTA_HEADER){
+                      /* are we already in sequence mode? */
+                      if(state == 2){
+                        inbuf2 = line;
+                        return VRNA_INPUT_CONSTRAINT;
+                      }
+                      else{
+                        *string = (char *)vrna_realloc(*string, sizeof(char) * (str_length + l + 1));
+                        strcpy(*string + str_length, line);
+                        state = 1;
+                      }
+                    }
+                    /* otherwise return line read */
+                    else{
+                      *string = line;
+                      return VRNA_INPUT_SEQUENCE;
+                    }
+    }
+    free(line);
+    line = vrna_read_line(in);
+  }while(line);
+
+  return (state==2) ? VRNA_INPUT_CONSTRAINT : (state==1) ? VRNA_INPUT_SEQUENCE : VRNA_INPUT_ERROR;
+}
+
+PUBLIC  unsigned int
+vrna_file_fasta_read_record( char **header,
+                        char **sequence,
+                        char ***rest,
+                        FILE *file,
+                        unsigned int options){
+
+  unsigned int  input_type, return_type, tmp_type;
+  int           rest_count;
+  char          *input_string;
+
+  rest_count    = 0;
+  return_type   = tmp_type = 0;
+  input_string  = *header = *sequence = NULL;
+  *rest         = (char **)vrna_alloc(sizeof(char *));
+
+  /* remove unnecessary option flags from options variable... */
+  options &= ~VRNA_INPUT_FASTA_HEADER;
+
+  /* read first input or last buffered input */
+  if(typebuf){
+    input_type    = typebuf;
+    input_string  = inbuf;
+    typebuf       = 0;
+    inbuf         = NULL;
+  }
+  else input_type  = read_multiple_input_lines(&input_string, file, options);
+
+  if(input_type & (VRNA_INPUT_QUIT | VRNA_INPUT_ERROR)) return input_type;
+
+  /* skip everything until we read either a fasta header or a sequence */
+  while(input_type & (VRNA_INPUT_MISC | VRNA_INPUT_CONSTRAINT | VRNA_INPUT_BLANK_LINE)){
+    free(input_string); input_string = NULL;
+    input_type    = read_multiple_input_lines(&input_string, file, options);
+    if(input_type & (VRNA_INPUT_QUIT | VRNA_INPUT_ERROR)) return input_type;
+  }
+
+  if(input_type & VRNA_INPUT_FASTA_HEADER){
+    return_type  |= VRNA_INPUT_FASTA_HEADER; /* remember that we've read a fasta header */
+    *header       = input_string;
+    input_string  = NULL;
+    /* get next data-block with fasta support if not explicitely forbidden by VRNA_INPUT_NO_SPAN */
+    input_type  = read_multiple_input_lines(
+                    &input_string,
+                    file,
+                    ((options & VRNA_INPUT_NO_SPAN) ? 0 : VRNA_INPUT_FASTA_HEADER) | options
+                  );
+    if(input_type & (VRNA_INPUT_QUIT | VRNA_INPUT_ERROR)) return (return_type | input_type);
+  }
+
+  if(input_type & VRNA_INPUT_SEQUENCE){
+    return_type  |= VRNA_INPUT_SEQUENCE; /* remember that we've read a sequence */
+    *sequence     = input_string;
+    input_string  = NULL;
+  } else vrna_message_error("sequence input missing");
+
+  /* read the rest until we find user abort, EOF, new sequence or new fasta header */
+  if(!(options & VRNA_INPUT_NO_REST)){
+    options |= VRNA_INPUT_NOSKIP_COMMENTS; /* allow commetns to appear in rest output */
+    tmp_type = VRNA_INPUT_QUIT | VRNA_INPUT_ERROR | VRNA_INPUT_SEQUENCE | VRNA_INPUT_FASTA_HEADER;
+    if(options & VRNA_INPUT_NOSKIP_BLANK_LINES) tmp_type |= VRNA_INPUT_BLANK_LINE;
+    while(!((input_type = read_multiple_input_lines(&input_string, file, options)) & tmp_type)){
+      *rest = vrna_realloc(*rest, sizeof(char **)*(++rest_count + 1));
+      (*rest)[rest_count-1] = input_string;
+      input_string = NULL;
+    }
+    /*
+    if(input_type & (VRNA_INPUT_QUIT | VRNA_INPUT_ERROR)) return input_type;
+    */
+
+    /*  finished reading everything...
+    *   we now put the last line into the buffer if necessary
+    *   since it should belong to the next record
+    */
+    inbuf = input_string;
+    typebuf = input_type;
+  }
+  (*rest)[rest_count] = NULL;
+  return (return_type);
+}
+
+PUBLIC char *
+vrna_extract_record_rest_structure( const char **lines,
+                                    unsigned int length,
+                                    unsigned int options){
+
+  char *structure = NULL;
+  int r, i, l, cl, stop;
+  char *c;
+
+  if(lines){
+    for(r = i = stop = 0; lines[i]; i++){
+      l   = (int)strlen(lines[i]);
+      c   = (char *) vrna_alloc(sizeof(char) * (l+1));
+      (void) sscanf(lines[i], "%s", c);
+      cl  = (int)strlen(c);
+
+      /* line commented out ? */
+      if((*c == '#') || (*c == '%') || (*c == ';') || (*c == '/') || (*c == '*' || (*c == '\0'))){
+        /* skip leading comments only, i.e. do not allow comments inside the constraint */
+        if(!r)  continue;
+        else    break;
+      }
+
+      /* append the structure part to the output */
+      r += cl+1;
+      structure = (char *)vrna_realloc(structure, r*sizeof(char));
+      strcat(structure, c);
+      free(c);
+      /* stop if the assumed structure length has been reached */
+      if((length > 0) && (r-1 == length)) break;
+      /* stop if not allowed to read from multiple lines */
+      if(!(options & VRNA_OPTION_MULTILINE)) break;
+    }
+  }
+  return structure;
+}
+
+PUBLIC void
+vrna_extract_record_rest_constraint(char **cstruc,
+                                    const char **lines,
+                                    unsigned int option){
+
+  *cstruc = vrna_extract_record_rest_structure(lines, 0, option | (option & VRNA_CONSTRAINT_MULTILINE) ? VRNA_OPTION_MULTILINE : 0);
+  
+}
+
+PUBLIC int
+vrna_file_SHAPE_read( const char *file_name,
+                      int length,
+                      double default_value,
+                      char *sequence,
+                      double *values){
+
+  FILE *fp;
+  char *line;
+  int i;
+  int count = 0;
+
+  if(!file_name)
+    return 0;
+
+  if(!(fp = fopen(file_name, "r"))){
+    vrna_message_warning("SHAPE data file could not be opened");
+    return 0;
+  }
+
+  for (i = 0; i < length; ++i)
+  {
+    sequence[i] = 'N';
+    values[i + 1] = default_value;
+  }
+
+  sequence[length] = '\0';
+
+  while((line=vrna_read_line(fp))){
+    int position;
+    unsigned char nucleotide = 'N';
+    double reactivity = default_value;
+    char *second_entry = 0;
+    char *third_entry = 0;
+    char *c;
+
+    if(sscanf(line, "%d", &position) != 1)
+    {
+      free(line);
+      continue;
+    }
+
+    if(position <= 0 || position > length)
+    {
+      vrna_message_warning("Provided SHAPE data outside of sequence scope");
+      fclose(fp);
+      free(line);
+      return 0;
+    }
+
+    for(c = line + 1; *c; ++c){
+      if(isspace(*(c-1)) && !isspace(*c)) {
+        if(!second_entry){
+          second_entry = c;
+        }else{
+          third_entry = c;
+          break;
+        }
+      }
+    }
+
+    if(second_entry){
+      if(third_entry){
+        sscanf(second_entry, "%c", &nucleotide);
+        sscanf(third_entry, "%lf", &reactivity);
+      }else if(sscanf(second_entry, "%lf", &reactivity) != 1)
+        sscanf(second_entry, "%c", &nucleotide);
+    }
+
+    sequence[position-1] = nucleotide;
+    values[position] = reactivity;
+    ++count;
+
+    free(line);
+  }
+
+  fclose(fp);
+
+  if(!count)
+  {
+      vrna_message_warning("SHAPE data file is empty");
+      return 0;
+  }
+
+  return 1;
+}
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC unsigned int
+get_multi_input_line( char **string,
+                      unsigned int option){
+
+  return read_multiple_input_lines(string, NULL, option);
+}
+
+PUBLIC unsigned int
+read_record(char **header,
+            char **sequence,
+            char  ***rest,
+            unsigned int options){
+
+  return vrna_file_fasta_read_record(header, sequence, rest, NULL, options);
+}
+
+PUBLIC char *
+extract_record_rest_structure(const char **lines,
+                              unsigned int length,
+                              unsigned int options){
+
+  return vrna_extract_record_rest_structure(lines, length, options);
+}
+
+
+#endif
diff --git a/C/ViennaRNA/file_formats.h b/C/ViennaRNA/file_formats.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/file_formats.h
@@ -0,0 +1,278 @@
+#ifndef VIENNA_RNA_PACKAGE_FILE_FORMATS_H
+#define VIENNA_RNA_PACKAGE_FILE_FORMATS_H
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file     file_formats.h
+ *  @ingroup  file_utils
+ *  @brief    Read and write different file formats for RNA sequences, structures
+ */
+
+/**
+ *  @{
+ *  @ingroup  file_utils
+ */
+
+#include <stdio.h>
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/file_formats_msa.h>
+
+/**
+ *  @brief Print a secondary structure as helix list
+ *
+ *  @param  seq     The RNA sequence
+ *  @param  db      The structure in dot-bracket format
+ *  @param  energy  Free energy of the structure in kcal/mol
+ *  @param  file    The file handle used to print to (print defaults to 'stdout' if(file == NULL) )
+ */
+void vrna_file_helixlist( const char *seq,
+                          const char *db,
+                          float energy,
+                          FILE *file);
+
+/**
+ *  @brief Print a secondary structure as connect table
+ *
+ *  Connect table file format looks like this:
+@verbatim
+300  ENERGY = 7.0  example
+  1 G       0    2   22    1
+  2 G       1    3   21    2
+@endverbatim
+ *  where the headerline is followed by 6 columns with:
+ *  1. Base number: index n
+ *  2. Base (A, C, G, T, U, X)
+ *  3. Index n-1  (0 if first nucleotide)
+ *  4. Index n+1  (0 if last nucleotide)
+ *  5. Number of the base to which n is paired. No pairing is indicated by 0 (zero).
+ *  6. Natural numbering.
+ *
+ *  @param  seq         The RNA sequence
+ *  @param  db          The structure in dot-bracket format
+ *  @param  energy      The free energy of the structure
+ *  @param  identifier  An optional identifier for the sequence
+ *  @param  file  The file handle used to print to (print defaults to 'stdout' if(file == NULL) )
+ */
+void vrna_file_connect( const char *seq,
+                        const char *db,
+                        float energy,
+                        const char *identifier,
+                        FILE *file);
+
+/**
+ *  @brief Print a secondary structure in bpseq format
+ *
+ *  @param  seq         The RNA sequence
+ *  @param  db          The structure in dot-bracket format
+ *  @param  file  The file handle used to print to (print defaults to 'stdout' if(file == NULL) )
+ */
+void vrna_file_bpseq( const char *seq,
+                      const char *db,
+                      FILE *file);
+
+#if WITH_JSON_SUPPORT
+
+/**
+ *  @brief Print a secondary structure in jsonformat
+ *
+ *  @param  seq         The RNA sequence
+ *  @param  db          The structure in dot-bracket format
+ *  @param  energy      The free energy
+ *  @param  identifier  An identifier for the sequence
+ *  @param  file  The file handle used to print to (print defaults to 'stdout' if(file == NULL) )
+ */
+void vrna_file_json(const char *seq,
+                    const char *db,
+                    double energy,
+                    const char *identifier,
+                    FILE *file);
+
+#endif
+
+/**
+ *  @brief  Tell a function that an input is assumed to span several lines
+ *
+ *  If used as input-option a function might also be returning this state telling
+ *  that it has read data from multiple lines.
+ *
+ *  @see vrna_extract_record_rest_structure(), vrna_file_fasta_read_record()
+ *
+ */
+#define VRNA_OPTION_MULTILINE             32U
+/**
+ *  @brief parse multiline constraint
+ *  @deprecated see vrna_extract_record_rest_structure()
+ */
+#define VRNA_CONSTRAINT_MULTILINE         32U
+
+/**
+ *  @brief  Get a (fasta) data set from a file or stdin
+ * 
+ *  This function may be used to obtain complete datasets from a filehandle or stdin.
+ *  A dataset is always defined to contain at least a sequence. If data starts with a
+ *  fasta header, i.e. a line like
+ *  @verbatim >some header info @endverbatim
+ *  then vrna_file_fasta_read_record() will assume that the sequence that follows the header may span
+ *  over several lines. To disable this behavior and to assign a single line to the argument
+ *  'sequence' one can pass #VRNA_INPUT_NO_SPAN in the 'options' argument.
+ *  If no fasta header is read in the beginning of a data block, a sequence must not span over
+ *  multiple lines!\n
+ *  Unless the options #VRNA_INPUT_NOSKIP_COMMENTS or #VRNA_INPUT_NOSKIP_BLANK_LINES are passed,
+ *  a sequence may be interrupted by lines starting with a comment character or empty lines.\n
+ *  A sequence is regarded as completely read if it was either assumed to not span over multiple
+ *  lines, a secondary structure or structure constraint follows the sequence on the next line,
+ *  or a new header marks the beginning of a new sequence...\n
+ *  All lines following the sequence (this includes comments) that do not initiate a new dataset
+ *  according to the above definition are available through the line-array 'rest'.
+ *  Here one can usually find the structure constraint or other information belonging to the
+ *  current dataset. Filling of 'rest' may be prevented by passing #VRNA_INPUT_NO_REST to the
+ *  options argument.\n
+ * 
+ *  @note This function will exit any program with an error message if no sequence could be read!
+ *  @note This function is NOT threadsafe! It uses a global variable to store information about
+ *  the next data block.
+ * 
+ *  The main purpose of this function is to be able to easily parse blocks of data
+ *  in the header of a loop where all calculations for the appropriate data is done inside the
+ *  loop. The loop may be then left on certain return values, e.g.:
+ *  @code
+char *id, *seq, **rest;
+int  i;
+id = seq = NULL;
+rest = NULL;
+while(!(vrna_file_fasta_read_record(&id, &seq, &rest, NULL, 0) & (VRNA_INPUT_ERROR | VRNA_INPUT_QUIT))){
+  if(id) printf("%s\n", id);
+  printf("%s\n", seq);
+  if(rest)
+    for(i=0;rest[i];i++){
+      printf("%s\n", rest[i]);
+      free(rest[i]);
+    }
+  free(rest);
+  free(seq);
+  free(id);
+}
+ *  @endcode
+ *  In the example above, the while loop will be terminated when vrna_file_fasta_read_record() returns
+ *  either an error, EOF, or a user initiated quit request.\n
+ *  As long as data is read from stdin (we are passing NULL as the file pointer), the id is
+ *  printed if it is available for the current block of data. The sequence will be printed in
+ *  any case and if some more lines belong to the current block of data each line will be printed
+ *  as well.
+ * 
+ *  @note Do not forget to free the memory occupied by header, sequence and rest!
+ * 
+ *  @param  header    A pointer which will be set such that it points to the header of the record
+ *  @param  sequence  A pointer which will be set such that it points to the sequence of the record
+ *  @param  rest      A pointer which will be set such that it points to an array of lines which also belong to the record
+ *  @param  file      A file handle to read from (if NULL, this function reads from stdin)
+ *  @param  options   Some options which may be passed to alter the behavior of the function, use 0 for no options
+ *  @return           A flag with information about what the function actually did read
+ */
+unsigned int vrna_file_fasta_read_record(char **header,
+                                    char **sequence,
+                                    char  ***rest,
+                                    FILE *file,
+                                    unsigned int options);
+
+/** @brief Extract a dot-bracket structure string from (multiline)character array
+ *
+ * This function extracts a dot-bracket structure string from the 'rest' array as
+ * returned by vrna_file_fasta_read_record() and returns it. All occurences of comments within the
+ * 'lines' array will be skipped as long as they do not break the structure string.
+ * If no structure could be read, this function returns NULL.
+ *
+ * @pre      The argument 'lines' has to be a 2-dimensional character array as obtained
+ *            by vrna_file_fasta_read_record()
+ * @see vrna_file_fasta_read_record()
+ *
+ * @param lines   The (multiline) character array to be parsed
+ * @param length  The assumed length of the dot-bracket string (passing a value < 1 results in no length limit)
+ * @param option  Some options which may be passed to alter the behavior of the function, use 0 for no options
+ * @return        The dot-bracket string read from lines or NULL
+ */
+char *vrna_extract_record_rest_structure( const char **lines,
+                                          unsigned int length,
+                                          unsigned int option);
+
+/**
+  * @brief Read data from a given SHAPE reactivity input file
+  *
+  * This function parses the informations from a given file and stores the result
+  * in the preallocated string sequence and the double array values.
+  *
+  * @param file_name     Path to the constraints file
+  * @param length        Length of the sequence (file entries exceeding this limit will cause an error)
+  * @param default_value Value for missing indices
+  * @param sequence      Pointer to an array used for storing the sequence obtained from the SHAPE reactivity file
+  * @param values        Pointer to an array used for storing the values obtained from the SHAPE reactivity file
+  */
+int vrna_file_SHAPE_read( const char *file_name,
+                          int length,
+                          double default_value,
+                          char *sequence,
+                          double *values);
+
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief  Extract a hard constraint encoded as pseudo dot-bracket string
+ *
+ *  @deprecated     Use vrna_extract_record_rest_structure() instead!
+ *  @pre      The argument 'lines' has to be a 2-dimensional character array as obtained
+ *            by vrna_file_fasta_read_record()
+ *  @see      vrna_file_fasta_read_record(), #VRNA_CONSTRAINT_DB_PIPE, #VRNA_CONSTRAINT_DB_DOT, #VRNA_CONSTRAINT_DB_X
+ *            #VRNA_CONSTRAINT_DB_ANG_BRACK, #VRNA_CONSTRAINT_DB_RND_BRACK
+ *
+ *  @param  cstruc  A pointer to a character array that is used as pseudo dot-bracket
+ *                  output
+ *  @param  lines   A 2-dimensional character array with the extension lines from the FASTA
+ *                  input
+ *  @param  option  The option flags that define the behavior and recognition pattern of
+ *                  this function
+ */
+DEPRECATED(void vrna_extract_record_rest_constraint( char **cstruc, const char **lines, unsigned int option));
+
+/** @brief Extract a dot-bracket structure string from (multiline)character array
+ *
+ * @deprecated This function is deprecated! Use \fn vrna_extract_record_rest_structure() as a replacment.
+ */
+DEPRECATED(char *extract_record_rest_structure( const char **lines,
+                                                unsigned int length,
+                                                unsigned int option));
+
+/**
+ *  @brief  Get a data record from stdin
+ * 
+ *  @deprecated This function is deprecated! Use vrna_file_fasta_read_record() as a replacment.
+ *
+ */
+DEPRECATED(unsigned int read_record(char **header,
+                                    char **sequence,
+                                    char  ***rest,
+                                    unsigned int options));
+
+
+DEPRECATED(unsigned int get_multi_input_line(char **string, unsigned int options));
+
+#endif
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/file_formats_msa.c b/C/ViennaRNA/file_formats_msa.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/file_formats_msa.c
@@ -0,0 +1,897 @@
+/*
+    file_formats_msa.c
+
+    Various functions dealing with file formats for Multiple Sequence Alignments (MSA)
+
+    (c) 2016 Ronny Lorenz
+
+    ViennaRNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <ctype.h>
+
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/aln_util.h"
+#include "ViennaRNA/file_utils.h"
+#include "ViennaRNA/file_formats.h"
+#include "ViennaRNA/file_formats_msa.h"
+
+/*
+#################################
+# STATIC DECLARATIONS           #
+#################################
+*/
+
+typedef int (aln_parser_function)(FILE *fp, char ***names, char ***aln, char **id, char **structure, int verbosity);
+
+typedef struct {
+  unsigned int        code;
+  aln_parser_function *parser;
+  const char          *name;
+} parsable;
+
+PRIVATE aln_parser_function parse_aln_stockholm;
+
+PRIVATE aln_parser_function parse_aln_clustal;
+
+PRIVATE aln_parser_function parse_aln_fasta;
+
+PRIVATE aln_parser_function parse_aln_maf;
+
+PRIVATE int
+parse_fasta_alignment(FILE *fp,
+                      char ***names,
+                      char ***aln,
+                      int verbosity);
+
+PRIVATE int
+parse_clustal_alignment(FILE *clust,
+                        char ***names,
+                        char ***aln,
+                        int verbosity);
+
+PRIVATE int
+parse_stockholm_alignment(FILE *fp,
+                          char ***aln,
+                          char ***names,
+                          char  **id,
+                          char  **structure,
+                          int   verbosity);
+
+PRIVATE int
+parse_maf_alignment(FILE *fp,
+                    char ***aln,
+                    char ***names,
+                    int   verbosity);
+
+PRIVATE int
+check_alignment(const char **names,
+                const char **aln,
+                int seq_num);
+
+PRIVATE void
+free_msa_record(char ***names,
+                char ***aln,
+                char **id,
+                char **structure);
+
+PRIVATE void
+add_sequence( const char  *id,
+              const char  *seq,
+              char        ***names,
+              char        ***aln,
+              int         seq_num);
+
+PRIVATE void
+endmarker_msa_record( char ***names,
+                      char ***aln,
+                      int   seq_num);
+
+/*
+#################################
+# STATIC VARIABLES              #
+#################################
+*/
+
+/* number of known alignment parsers */
+#define NUM_PARSERS 4
+
+static parsable known_parsers[NUM_PARSERS] = {
+  /* option, parser, name */
+  { VRNA_FILE_FORMAT_MSA_STOCKHOLM, parse_aln_stockholm,  "Stockholm 1.0 format" },
+  { VRNA_FILE_FORMAT_MSA_CLUSTAL,   parse_aln_clustal,    "ClustalW format" },
+  { VRNA_FILE_FORMAT_MSA_FASTA,     parse_aln_fasta,      "FASTA format" },
+  { VRNA_FILE_FORMAT_MSA_MAF,       parse_aln_maf,        "MAF format" }
+};
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+PUBLIC unsigned int
+vrna_file_msa_detect_format(const char *filename,
+                            unsigned int options){
+
+  FILE          *fp;
+  char          **names, **aln;
+  unsigned int  format;
+  int           i, r;
+  long int      fp_position;
+
+  names     = NULL;
+  aln       = NULL;
+  format    = VRNA_FILE_FORMAT_MSA_UNKNOWN;
+
+  /* if no alignment file format(s) were specified we probe for all of them */
+  if(options == 0)
+    options = VRNA_FILE_FORMAT_MSA_DEFAULT;
+
+  if(!(fp = fopen(filename, "r"))){
+    vrna_message_warning("Alignment file could not be opened!");
+    return format;
+  }
+
+  r           = -1;
+  fp_position = ftell(fp);
+
+  for(i = 0; i < NUM_PARSERS; i++){
+    if((options & known_parsers[i].code) && (known_parsers[i].parser)){
+      /* go back to beginning of file */
+      if(!fseek(fp, fp_position, SEEK_SET)){
+        r = known_parsers[i].parser(fp, &names, &aln, NULL, NULL, -1);
+        free_msa_record(&names, &aln, NULL, NULL);
+        if(r > 0){
+          format = known_parsers[i].code;
+          break;
+        }
+      } else {
+        vrna_message_error("Something unexpected happened while parsing the alignment file");
+      }
+    }
+  }
+
+  fclose(fp);
+
+  return format;
+}
+
+
+PUBLIC int
+vrna_file_msa_read( const char *filename,
+                    char ***names,
+                    char ***aln,
+                    char  **id,
+                    char  **structure,
+                    unsigned int options){
+
+  FILE  *fp;
+  char  *line = NULL;
+  int   i, n, seq_num;
+  seq_num   = 0;
+
+  if(!(fp = fopen(filename, "r"))){
+    vrna_message_warning("Alignment file could not be opened!");
+    return seq_num;
+  }
+
+  if(names && aln){
+    *names  = NULL;
+    *aln    = NULL;
+  } else {
+    return seq_num;
+  }
+
+  if(id)
+    *id = NULL;
+
+  if(structure)
+    *structure = NULL;
+
+  /* if no alignment file format was specified, lets try to guess it */
+  if(options == 0)
+    options = VRNA_FILE_FORMAT_MSA_DEFAULT;
+
+  int r = -1;
+  long int fp_position = ftell(fp);
+
+  for(i = 0; i < NUM_PARSERS; i++){
+    if((options & known_parsers[i].code) && (known_parsers[i].parser)){
+      /* go back to beginning of file */
+      if(!fseek(fp, fp_position, SEEK_SET)){
+        r = known_parsers[i].parser(fp, names, aln, id, structure, 0);
+        if(r > 0)
+          break;
+      } else {
+        vrna_message_error("Something unexpected happened while parsing the alignment file");
+      }
+    }
+  }
+
+  fclose(fp);
+
+  if(r == -1){
+    vrna_message_warning("Alignment file parser is unknown (or not specified?)");
+  } else {
+    seq_num = r;
+
+    if((seq_num > 0) && (!(options & VRNA_FILE_FORMAT_MSA_NOCHECK))){
+      if(!check_alignment((const char **)(*names), (const char **)(*aln), seq_num)){
+        vrna_message_warning("Alignment did not pass sanity checks!");
+
+        /* discard the data we've read! */
+        free_msa_record(names, aln, id, structure);
+
+        seq_num = 0;
+      }
+    }
+  }
+
+  return seq_num;
+}
+
+
+PUBLIC int
+vrna_file_msa_read_record(FILE *fp,
+                          char ***names,
+                          char ***aln,
+                          char  **id,
+                          char  **structure,
+                          unsigned int options){
+
+  const char          *parser_name;
+  int                 i, r, n, seq_num;
+  aln_parser_function *parser;
+
+  seq_num     = 0;
+  parser_name = NULL;
+  parser      = NULL;
+
+  if(!fp){
+    vrna_message_warning("Can't read alignment from file pointer!");
+    return seq_num;
+  }
+
+  if(names && aln){
+    *names  = NULL;
+    *aln    = NULL;
+  } else {
+    return seq_num;
+  }
+
+  if(id)
+    *id = NULL;
+
+  if(structure)
+    *structure = NULL;
+
+  for(r = i = 0; i < NUM_PARSERS; i++){
+    if((options & known_parsers[i].code) && (known_parsers[i].parser)){
+      if(!parser){
+        parser      = known_parsers[i].parser;
+        parser_name = known_parsers[i].name;
+      }
+      r++;
+    }
+  }
+
+  if(r == 0){
+    vrna_message_warning("Did not find parser for specified MSA format!");
+  } else {
+    if(r > 1) { 
+      vrna_message_warning("More than one MSA format parser specified!\n"
+                                  "Using parser for %s", parser_name);
+    }
+
+    seq_num = parser(fp, names, aln, id, structure, 0);
+
+    if((seq_num > 0) && (!(options & VRNA_FILE_FORMAT_MSA_NOCHECK))){
+      if(!check_alignment((const char **)(*names), (const char **)(*aln), seq_num)){
+        vrna_message_warning("Alignment did not pass sanity checks!");
+
+        /* discard the data we've read! */
+        free_msa_record(names, aln, id, structure);
+
+        seq_num = -1;
+      }
+    }
+  }
+
+  return seq_num;
+}
+
+
+PRIVATE int
+parse_stockholm_alignment(FILE  *fp,
+                          char  ***names,
+                          char  ***aln,
+                          char  **id,
+                          char  **structure,
+                          int   verbosity){
+
+  char  *line = NULL;
+  int   i, n, seq_num, seq_length, has_record;
+
+  seq_num     = 0;
+  seq_length  = 0;
+
+  if(!fp){
+    if(verbosity >= 0)
+      vrna_message_warning("Can't read from filepointer while parsing Stockholm formatted sequence alignment!");
+    return -1;
+  }
+
+  if(names && aln){
+    *names  = NULL;
+    *aln    = NULL;
+  } else {
+    return -1;
+  }
+
+  if(id)
+    *id = NULL;
+
+  if(structure)
+    *structure = NULL;
+
+  int inrecord = 0;
+  while((line = vrna_read_line(fp))){
+    if(strstr(line, "STOCKHOLM 1.0")){
+      inrecord    = 1;
+      has_record  = 1;
+      free(line);
+      break;
+    }
+    free(line);
+  }
+
+  if(inrecord){
+    while((line = vrna_read_line(fp))){
+
+      if(strncmp(line, "//", 2) == 0){
+        /* end of alignment */
+        free(line);
+        line = NULL;
+        break;
+      }
+
+      n = (int)strlen(line);
+
+      switch(*line){
+        /* we skip lines that start with whitespace */
+        case ' ': case '\0':
+          goto stockholm_next_line;
+
+        /* Stockholm markup, or comment */
+        case '#':
+          if(strstr(line, "STOCKHOLM 1.0")){
+            if(verbosity >= 0)
+              vrna_message_warning("Malformatted Stockholm record, missing // ?");
+
+            /* drop everything we've read so far and start new, blank record */
+            free_msa_record(names, aln, id, structure);
+
+            seq_num = 0;
+          } else if(strncmp(line, "#=GF", 4) == 0){
+            /* found feature markup */
+            if((id != NULL) && (strncmp(line, "#=GF ID", 7) == 0)){
+              *id = (char *)vrna_alloc(sizeof(char) * n);
+              if(sscanf(line, "#=GF ID %s", *id) == 1){
+                *id = (char *)vrna_realloc(*id, sizeof(char) * (strlen(*id) + 1));
+              } else {
+                free(*id);
+                *id = NULL;
+              }
+            }
+          } else if(strncmp(line, "#=GC", 4) == 0){
+            /* found per-column annotation */
+            if((structure != NULL) && (strncmp(line, "#=GC SS_cons", 12) == 0)){
+              char *ss = (char *)vrna_alloc(sizeof(char) * n);
+              if(sscanf(line, "#=GC SS_cons %s", ss) == 1){
+                *structure = (char *)vrna_realloc(*structure, sizeof(char) * (strlen(ss) + 1));
+                strcpy(*structure, ss);
+              }
+              free(ss);
+            }
+          } else if(strncmp(line, "#=GS", 4) == 0){
+            /* found generic per-sequence annotation */
+          } else if(strncmp(line, "#=GR", 4) == 0){
+            /* found generic per-Residue annotation */
+          } else {
+            /* may be comment? */
+          }
+          break;
+
+        /* should be sequence */
+        default:
+          {
+            int tmp_l;
+            char *tmp_name  = (char *)vrna_alloc(sizeof(char) * (n + 1));
+            char *tmp_seq   = (char *)vrna_alloc(sizeof(char) * (n + 1));
+            if(sscanf(line, "%s %s", tmp_name, tmp_seq) == 2){
+              seq_num++;
+              tmp_l = (int)strlen(tmp_seq);
+
+              if(seq_num == 1){
+                seq_length = tmp_l;
+              } else {  /* check sequence length against first */
+                if(seq_length != tmp_l){
+                  if(verbosity >= 0)
+                    vrna_message_warning("Discarding Stockholm record! Sequence lengths do not match.");
+
+                  /* drop everything we've read so far and abort parsing */
+                  free_msa_record(names, aln, id, structure);
+
+                  seq_num = 0;
+
+                  free(tmp_name);
+                  free(tmp_seq);
+                  free(line);
+                  line = NULL;
+
+                  goto stockholm_exit;
+                }
+              }
+
+              add_sequence( tmp_name, tmp_seq,
+                            names, aln,
+                            seq_num);
+            }
+            free(tmp_name);
+            free(tmp_seq);
+          }
+          break;
+      }
+
+stockholm_next_line:
+
+      free(line);
+    }
+  } else {
+    if(verbosity > 0)
+      vrna_message_warning("Did not find any Stockholm 1.0 formatted record!");
+    return -1;
+  }
+
+stockholm_exit:
+
+  free(line);
+
+  endmarker_msa_record(names, aln, seq_num);
+
+  if((seq_num > 0) && (verbosity >= 0))
+    vrna_message_info(stderr, "%d sequences; length of alignment %d.", seq_num, (int)strlen((*aln)[0]));
+
+  return seq_num;
+}
+
+
+PRIVATE int
+parse_fasta_alignment(FILE *fp,
+                      char ***names,
+                      char ***aln,
+                      int verbosity){
+
+  unsigned int  read_opt, rec_type;
+  int           seq_num;
+  char          *rec_id, *rec_sequence, **rec_rest;
+
+  rec_id        = NULL;
+  rec_sequence  = NULL;
+  rec_rest      = NULL;
+  seq_num       = 0;
+  read_opt      = VRNA_INPUT_NO_REST; /* read sequence and header information only */
+
+  /* read until EOF or user abort */
+  while(
+    !((rec_type = vrna_file_fasta_read_record(&rec_id, &rec_sequence, &rec_rest, fp, read_opt))
+        & (VRNA_INPUT_ERROR | VRNA_INPUT_QUIT))){
+
+    if(rec_id){ /* valid FASTA entry */
+      seq_num++;
+
+      char *id = (char *)vrna_alloc(sizeof(char) * strlen(rec_id));
+      (void) sscanf(rec_id, ">%s", id);
+      vrna_seq_toupper(rec_sequence);
+
+      add_sequence( id, rec_sequence,
+                    names, aln,
+                    seq_num);
+
+      free(id);
+    }
+
+    free(rec_id);
+    free(rec_sequence);
+    free(rec_rest);
+  }
+
+  free(rec_id);
+  free(rec_sequence);
+  free(rec_rest);
+
+  endmarker_msa_record(names, aln, seq_num);
+
+  if((seq_num > 0) && (verbosity >= 0)){
+    vrna_message_info(stderr, "%d sequences; length of alignment %d.", seq_num, (int)strlen((*aln)[0]));
+  } else {
+    if(verbosity > 0)
+      vrna_message_warning("Did not find any FASTA formatted record!");
+    return -1;
+  }
+
+  return seq_num;
+}
+
+
+PRIVATE int
+parse_clustal_alignment(FILE *clust,
+                        char ***names,
+                        char ***aln,
+                        int verbosity){
+
+  char *line, *name, *seq;
+  int  n, r, nn=0, seq_num = 0, i;
+
+  if((line = vrna_read_line(clust)) == NULL){
+    return -1;
+  }
+
+  if(strncmp(line,"CLUSTAL", 7) != 0){
+    if(verbosity > 0)
+      vrna_message_warning("This doesn't look like a CLUSTALW file, sorry");
+
+    free(line);
+    return -1;
+  }
+
+  free(line);
+  line = vrna_read_line(clust);
+
+  while (line!=NULL) {
+    n = strlen(line);
+
+    if((n < 4) || isspace((int)line[0])) {
+      /* skip non-sequence line */
+      free(line);
+      line = vrna_read_line(clust);
+      nn    = 0;  /* reset sequence number */
+      continue;
+    }
+
+    /* skip comments */
+    if(line[0] == '#'){
+      free(line);
+      line = vrna_read_line(clust);
+      continue;
+    }
+
+    seq   = (char *)vrna_alloc(sizeof(char) * (n + 1));
+    name  = (char *)vrna_alloc(sizeof(char) * (n + 1));
+    if(sscanf(line, "%s %s", name, seq) == 2){
+      /* realloc to actual sizes */
+      seq   = (char *)vrna_realloc(seq, sizeof(char) * (strlen(seq) + 1));
+      name  = (char *)vrna_realloc(name, sizeof(char) * (strlen(name) + 1));
+      for(i = 0; i < strlen(seq); i++){
+        if(seq[i] == '.')
+          seq[i] = '-'; /* replace '.' gaps with '-' */
+      }
+
+      /* convert sequence to uppercase letters */
+      vrna_seq_toupper(seq);
+
+      if(nn == seq_num){ /* first time */
+            add_sequence( name, seq,
+                          names, aln,
+                          nn + 1);
+      } else {
+        if (strcmp(name, (*names)[nn]) != 0) {
+          /* name doesn't match */
+           vrna_message_warning("Sorry, your file is messed up (inconsitent seq-names)");
+           free(line); free(seq);
+           return 0;
+        }
+        (*aln)[nn] = (char *)vrna_realloc((*aln)[nn], strlen(seq) + strlen((*aln)[nn])+1);
+        strcat((*aln)[nn], seq);
+      }
+      nn++;
+      if(nn > seq_num)
+        seq_num = nn;
+
+      free(seq);
+      free(name);
+    }
+    free(line);
+
+    line = vrna_read_line(clust);
+  }
+
+  endmarker_msa_record(names, aln, seq_num);
+
+  if((seq_num > 0) && (verbosity >= 0))
+    vrna_message_info(stderr, "%d sequences; length of alignment %d.", seq_num, (int)strlen((*aln)[0]));
+
+  return seq_num;
+}
+
+
+PRIVATE int
+parse_maf_alignment(FILE  *fp,
+                    char  ***names,
+                    char  ***aln,
+                    int   verbosity){
+
+  char  *line = NULL, *tmp_name, *tmp_sequence, strand;
+  int   i, n, seq_num, seq_length, start, length, src_length;
+
+  seq_num     = 0;
+  seq_length  = 0;
+
+  if(!fp){
+    if(verbosity >= 0)
+      vrna_message_warning("Can't read from filepointer while parsing MAF formatted sequence alignment!");
+    return -1;
+  }
+
+  if(names && aln){
+    *names  = NULL;
+    *aln    = NULL;
+  } else {
+    return -1;
+  }
+
+  int inrecord = 0;
+  while((line = vrna_read_line(fp))){
+    if(*line == 'a'){
+      if((line[1] == '\0') || isspace(line[1])){
+        inrecord = 1;
+        free(line);
+        break;
+      }
+    }
+    free(line);
+  }
+
+  if(inrecord){
+    while((line = vrna_read_line(fp))){
+      n = (int)strlen(line);
+
+      switch(*line){
+        case '#': /* comment */
+          break;
+
+        case 's': /* a sequence within the alignment block */
+          tmp_name      = (char *)vrna_alloc(sizeof(char) * n);
+          tmp_sequence  = (char *)vrna_alloc(sizeof(char) * n);
+          if(sscanf(line, "s %s %d %d %c %d %s",
+                tmp_name,
+                &start,
+                &length,
+                &strand,
+                &src_length,
+                tmp_sequence) == 6){
+
+            seq_num++;
+            tmp_name      = (char *)vrna_realloc(tmp_name, sizeof(char) * (strlen(tmp_name) + 1));
+            tmp_sequence  = (char *)vrna_realloc(tmp_sequence, sizeof(char) * (strlen(tmp_sequence) + 1));
+
+            vrna_seq_toupper(tmp_sequence);
+
+            add_sequence( tmp_name, tmp_sequence,
+                          names, aln,
+                          seq_num);
+
+            free(tmp_name);
+            free(tmp_sequence);
+            break;
+          }
+          free(tmp_name);
+          free(tmp_sequence);
+          /* all through */
+
+        default: /* something else that ends the block */
+          free(line);
+          goto maf_exit;
+      }
+
+      free(line);
+    }
+  } else {
+    if(verbosity > 0)
+      vrna_message_warning("Did not find any MAF formatted record!");
+    return -1;
+  }
+
+maf_exit:
+
+  endmarker_msa_record(names, aln, seq_num);
+
+  if((seq_num > 0) && (verbosity >= 0))
+    vrna_message_info(stderr, "%d sequences; length of alignment %d.", seq_num, (int)strlen((*aln)[0]));
+
+  return seq_num;
+}
+
+
+PRIVATE void
+free_msa_record(char ***names,
+                char ***aln,
+                char **id,
+                char **structure){
+
+  int s, i;
+
+  s = 0;
+  if(aln && (*aln))
+    for(; (*aln)[s]; s++);
+
+  if(id != NULL){
+    free(*id);
+    *id = NULL;
+  }
+
+  if(structure != NULL){
+    free(*structure);
+    *structure = NULL;
+  }
+
+  for(i = 0; i < s; i++){
+    free((*names)[i]);
+    free((*aln)[i]);
+  }
+
+  if(names && (*names)){
+    free(*names);
+    *names = NULL;
+  }
+
+  if(aln && (*aln)){
+    free(*aln);
+    *aln = NULL;
+  }
+}
+
+
+PRIVATE int
+parse_aln_stockholm(FILE *fp,
+                    char ***names,
+                    char ***aln,
+                    char **id,
+                    char **structure,
+                    int  verbosity){
+
+  return parse_stockholm_alignment(fp, names, aln, id, structure, verbosity);
+}
+
+
+PRIVATE int
+parse_aln_clustal(FILE *fp,
+                  char ***names,
+                  char ***aln,
+                  char **id,
+                  char **structure,
+                  int  verbosity){
+
+  /* clustal format doesn't contain id's or structure information */
+  if(id)
+    *id = NULL;
+  if(structure)
+    *structure = NULL;
+
+  return parse_clustal_alignment(fp, names, aln, verbosity);
+}
+
+
+PRIVATE int
+parse_aln_fasta(FILE *fp,
+                char ***names,
+                char ***aln,
+                char **id,
+                char **structure,
+                int  verbosity){
+
+  /* fasta alignments do not contain an id, or structure information */
+  if(id)
+    *id = NULL;
+  if(structure)
+    *structure = NULL;
+
+  return parse_fasta_alignment(fp, names, aln, verbosity);
+}
+
+
+PRIVATE int
+parse_aln_maf(FILE *fp,
+              char ***names,
+              char ***aln,
+              char **id,
+              char **structure,
+              int  verbosity){
+
+  /* MAF alignments do not contain an id, or structure information */
+  if(id)
+    *id = NULL;
+  if(structure)
+    *structure = NULL;
+
+  return parse_maf_alignment(fp, names, aln, verbosity);
+}
+
+
+PRIVATE void
+add_sequence( const char  *id,
+              const char  *seq,
+              char        ***names,
+              char        ***aln,
+              int         seq_num){
+
+  (*names)              = (char **)vrna_realloc(*names, sizeof(char *) * (seq_num));
+  (*names)[seq_num - 1] = strdup(id);
+  (*aln)                = (char **)vrna_realloc(*aln, sizeof(char *) * (seq_num));
+  (*aln)[seq_num - 1]   = strdup(seq);
+}
+
+
+PRIVATE void
+append_sequence(char *seq,
+                char  **aln,
+                int   seq_num){
+
+
+}
+
+
+PRIVATE void
+endmarker_msa_record( char ***names,
+                      char ***aln,
+                      int   seq_num){
+
+  /*
+    append additional entry in 'aln' and 'names' pointing to NULL (this may be
+    used as an indication for the end of the sequence list)
+  */
+  if(seq_num > 0){
+    (*aln)            = (char **)vrna_realloc(*aln, sizeof(char *) * (seq_num + 1));
+    (*names)          = (char **)vrna_realloc(*names, sizeof(char *) * (seq_num + 1));
+    (*aln)[seq_num]   = NULL;
+    (*names)[seq_num] = NULL;
+  }
+}
+
+
+PRIVATE int
+check_alignment(const char **names,
+                const char **aln,
+                int seq_num){
+
+  int i, j, l, pass = 1;
+
+  /* check for unique names */
+  for(i = 0; i < seq_num; i++){
+    for(j = i + 1; j < seq_num; j++){
+      if(!strcmp(names[i], names[j])){
+        vrna_message_warning("Sequence IDs in input alignment are not unique!");
+        pass = 0;
+      }
+    }
+  }
+
+  /* check for equal lengths of sequences */
+  l = (int)strlen(aln[0]);
+  for(i = 1; i < seq_num; i++)
+    if((int)strlen(aln[i]) != l){
+      vrna_message_warning("Sequence lengths in input alignment do not match!");
+      pass = 0;
+    }
+
+  return pass;
+}
diff --git a/C/ViennaRNA/file_formats_msa.h b/C/ViennaRNA/file_formats_msa.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/file_formats_msa.h
@@ -0,0 +1,208 @@
+#ifndef VIENNA_RNA_PACKAGE_FILE_FORMATS_MSA_H
+#define VIENNA_RNA_PACKAGE_FILE_FORMATS_MSA_H
+
+/**
+ *  @addtogroup   file_utils
+ *
+ *  @{
+ *
+ *  @file file_formats_msa.h
+ *  @brief Functions dealing with file formats for Multiple Sequence Alignments (MSA)
+ *
+ */
+
+#include <stdio.h>
+
+/**
+ *  @brief  Option flag indicating ClustalW formatted files
+ *  @see vrna_file_msa_read(), vrna_file_msa_read_record(), vrna_file_msa_detect_format()
+ */
+#define VRNA_FILE_FORMAT_MSA_CLUSTAL      1U
+
+/**
+ *  @brief Option flag indicating Stockholm 1.0 formatted files
+ *  @see vrna_file_msa_read(), vrna_file_msa_read_record(), vrna_file_msa_detect_format()
+ */
+#define VRNA_FILE_FORMAT_MSA_STOCKHOLM    2U
+
+/**
+ *  @brief Option flag indicating FASTA (Pearson) formatted files
+ *  @see vrna_file_msa_read(), vrna_file_msa_read_record(), vrna_file_msa_detect_format()
+ */
+#define VRNA_FILE_FORMAT_MSA_FASTA        4U
+
+/**
+ *  @brief Option flag indicating MAF formatted files
+ *  @see vrna_file_msa_read(), vrna_file_msa_read_record(), vrna_file_msa_detect_format()
+ */
+#define VRNA_FILE_FORMAT_MSA_MAF          8U
+
+/**
+ *  @brief Option flag indicating the set of default file formats
+ *  @see vrna_file_msa_read(), vrna_file_msa_read_record(), vrna_file_msa_detect_format()
+ */
+#define VRNA_FILE_FORMAT_MSA_DEFAULT      ( \
+                                              VRNA_FILE_FORMAT_MSA_CLUSTAL \
+                                            | VRNA_FILE_FORMAT_MSA_STOCKHOLM \
+                                            | VRNA_FILE_FORMAT_MSA_FASTA \
+                                            | VRNA_FILE_FORMAT_MSA_MAF \
+                                          )
+
+/**
+ *  @brief Option flag to disable validation of the alignment
+ *  @see  vrna_file_msa_read(), vrna_file_msa_read_record()
+ */
+#define VRNA_FILE_FORMAT_MSA_NOCHECK      4096U
+
+/**
+ *  @brief Return flag of vrna_file_msa_detect_format() to indicate unknown or malformatted alignment
+ *  @see vrna_file_msa_detect_format()
+ */
+#define VRNA_FILE_FORMAT_MSA_UNKNOWN      8192U
+
+/**
+ *  @brief Read a multiple sequence alignment from file
+ *
+ *  This function reads the (first) multiple sequence alignment from
+ *  an input file. The read alignment is split into the sequence id/name
+ *  part and the actual sequence information and stored in memory as
+ *  arrays of ids/names and sequences. If the alignment file format
+ *  allows for additional information, such as an ID of the entire alignment
+ *  or consensus structure information, this data is retrieved as well
+ *  and made available. The @p options parameter allows to specify the
+ *  set of alignment file formats that should be used to retrieve the data.
+ *  If 0 is passed as option, the list of alignment file formats defaults to
+ *  #VRNA_FILE_FORMAT_MSA_DEFAULT.
+ *
+ *  Currently, the list of parsable multiple sequence alignment file formats
+ *  consists of:
+ *  - @ref msa-formats-clustal
+ *  - @ref msa-formats-stockholm
+ *  - @ref msa-formats-fasta
+ *  - @ref msa-formats-maf
+ *  .
+ *
+ *  @note After successfully reading an alignment, this function performs
+ *        a validation of the data that includes uniqueness of the sequence
+ *        identifiers, and equal sequence lengths. This check can be
+ *        deactivated by passing #VRNA_FILE_FORMAT_MSA_NOCHECK in the
+ *        @p options parameter.
+ *
+ *  @see  vrna_file_msa_read_record(), #VRNA_FILE_FORMAT_MSA_CLUSTAL,
+ *        #VRNA_FILE_FORMAT_MSA_STOCKHOLM, #VRNA_FILE_FORMAT_MSA_FASTA,
+ *        #VRNA_FILE_FORMAT_MSA_MAF, #VRNA_FILE_FORMAT_MSA_DEFAULT,
+ *        #VRNA_FILE_FORMAT_MSA_NOCHECK
+ *
+ *  @param  filename    The name of input file that contains the alignment
+ *  @param  names       An address to the pointer where sequence identifiers
+ *                      should be written to
+ *  @param  aln         An address to the pointer where aligned sequences should
+ *                      be written to
+ *  @param  id          An address to the pointer where the alignment ID should
+ *                      be written to (Maybe NULL)
+ *  @param  structure   An address to the pointer where consensus structure
+ *                      information should be written to (Maybe NULL)
+ *  @param  options     Options to manipulate the behavior of this function
+ *  @return             The number of sequences in the alignment, or -1 if
+ *                      no alignment record could be found
+ */
+int
+vrna_file_msa_read( const char *filename,
+                    char ***names,
+                    char ***aln,
+                    char  **id,
+                    char  **structure,
+                    unsigned int options);
+
+/**
+ *  @brief Read a multiple sequence alignment from file handle
+ *
+ *  Similar to vrna_file_msa_read(), this function reads a multiple
+ *  sequence alignment from an input file handle. Since using a file
+ *  handle, this function is not limited to the first alignment record,
+ *  but allows for looping over all alignments within the input.
+ *
+ *  The read alignment is split into the sequence id/name
+ *  part and the actual sequence information and stored in memory as
+ *  arrays of ids/names and sequences. If the alignment file format
+ *  allows for additional information, such as an ID of the entire alignment
+ *  or consensus structure information, this data is retrieved as well
+ *  and made available. The @p options parameter allows to specify the
+ *  alignment file format used to retrieve the data. A single format
+ *  must be specified here, see vrna_file_msa_detect_format() for helping
+ *  to determine the correct MSA file format.
+ *
+ *  Currently, the list of parsable multiple sequence alignment file formats
+ *  consists of:
+ *  - @ref msa-formats-clustal
+ *  - @ref msa-formats-stockholm
+ *  - @ref msa-formats-fasta
+ *  - @ref msa-formats-maf
+ *  .
+ *
+ *  @note After successfully reading an alignment, this function performs
+ *        a validation of the data that includes uniqueness of the sequence
+ *        identifiers, and equal sequence lengths. This check can be
+ *        deactivated by passing #VRNA_FILE_FORMAT_MSA_NOCHECK in the
+ *        @p options parameter.
+ *
+ *  @see  vrna_file_msa_read(), vrna_file_msa_detect_format(),
+ *        #VRNA_FILE_FORMAT_MSA_CLUSTAL, #VRNA_FILE_FORMAT_MSA_STOCKHOLM,
+ *        #VRNA_FILE_FORMAT_MSA_FASTA, #VRNA_FILE_FORMAT_MSA_MAF,
+ *        #VRNA_FILE_FORMAT_MSA_DEFAULT, #VRNA_FILE_FORMAT_MSA_NOCHECK
+ *
+ *  @param  fp          The file pointer the data will be retrieved from
+ *  @param  names       An address to the pointer where sequence identifiers
+ *                      should be written to
+ *  @param  aln         An address to the pointer where aligned sequences should
+ *                      be written to
+ *  @param  id          An address to the pointer where the alignment ID should
+ *                      be written to (Maybe NULL)
+ *  @param  structure   An address to the pointer where consensus structure
+ *                      information should be written to (Maybe NULL)
+ *  @param  options     Options to manipulate the behavior of this function
+ *  @return             The number of sequences in the alignment, or -1 if
+ *                      no alignment record could be found
+ */
+int
+vrna_file_msa_read_record(FILE *fp,
+                          char ***names,
+                          char ***aln,
+                          char  **id,
+                          char  **structure,
+                          unsigned int options);
+
+/**
+ *  @brief Detect the format of a multiple sequence alignment file
+ *
+ *  This function attempts to determine the format of a file that
+ *  supposedly contains a multiple sequence alignment (MSA). This is
+ *  useful in cases where a MSA file contains more than a single record
+ *  and therefore vrna_file_msa_read() can not be applied, since
+ *  it only retrieves the first.
+ *  Here, one can try to guess the correct file format using this
+ *  function and then loop over the file, record by record using one
+ *  of the low-level record retrieval functions for the corresponding
+ *  MSA file format.
+ *
+ *  @note This function parses the entire first record within the
+ *        specified file. As a result, it returns #VRNA_FILE_FORMAT_MSA_UNKNOWN
+ *        not only if it can't detect the file's format, but also
+ *        in cases where the file doesn't contain sequences!
+ *
+ *  @see  vrna_file_msa_read(), vrna_file_stockholm_read_record(),
+ *        vrna_file_clustal_read_record(), vrna_file_fasta_read_record()
+ *
+ *  @param  filename  The name of input file that contains the alignment
+ *  @param  options   Options to manipulate the behavior of this function
+ *  @return           The MSA file format, or #VRNA_FILE_FORMAT_MSA_UNKNOWN
+ */
+unsigned int
+vrna_file_msa_detect_format(const char *filename,
+                            unsigned int options);
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/file_utils.c b/C/ViennaRNA/file_utils.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/file_utils.c
@@ -0,0 +1,217 @@
+/*
+                               file_utils.c
+
+                 c  Ronny Lorenz
+                 Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <time.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdint.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <libgen.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/file_utils.h"
+
+#define PRIVATE  static
+#define PUBLIC
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+#ifdef _WIN32
+#ifdef __MINGW32__
+#include <direct.h>
+#endif
+#define DIRSEPC '\\'
+#define DIRSEPS "\\"
+#else
+#define DIRSEPC '/'
+#define DIRSEPS "/"
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE int is_absolute_path(const char *p);
+
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC void
+vrna_file_copy(FILE *from, FILE *to){
+
+  int c;
+
+  while ((c = getc(from)) != EOF) (void)putc(c, to);
+}
+
+
+PUBLIC char *
+vrna_read_line(FILE *fp){ /* reads lines of arbitrary length from fp */
+
+  char s[512], *line, *cp;
+  int len=0, size=0, l;
+  line=NULL;
+  do {
+    if (fgets(s, 512, fp)==NULL) break;
+    cp = strchr(s, '\n');
+    if (cp != NULL) *cp = '\0';
+    l = len + (int)strlen(s);
+    if (l+1>size) {
+      size = (int)((l+1)*1.2);
+      line = (char *) vrna_realloc(line, size*sizeof(char));
+    }
+    strcat(line+len, s);
+    len=l;
+  } while(cp==NULL);
+
+  return line;
+}
+
+
+PUBLIC int
+vrna_mkdir_p(const char *path){
+  struct stat sb;
+  char *slash, *ptr;
+  int done = 0;
+
+  if(!is_absolute_path(path))
+    ptr = vrna_strdup_printf(".%c%s", DIRSEPC, path);
+  else
+    ptr = strdup(path);
+
+  slash = ptr;
+
+  while (!done) {
+    slash += strspn(slash, DIRSEPS);
+    slash += strcspn(slash, DIRSEPS);
+
+    done = (*slash == '\0');
+    *slash = '\0';
+
+    if (stat(ptr, &sb)) {
+#ifdef _WIN32
+      if (errno != ENOENT || (_mkdir(ptr) &&
+          errno != EEXIST)) {
+#else
+      if (errno != ENOENT || (mkdir(ptr, 0777) &&
+          errno != EEXIST)) {
+#endif
+        vrna_message_warning("Can't create directory %s", ptr);
+        free(ptr);
+        return -1;
+      }
+    } else if (!S_ISDIR(sb.st_mode)) {
+      vrna_message_warning("File exists but is not a directory %s: %s", ptr, strerror(ENOTDIR));
+      free(ptr);
+      return -1;
+    }
+
+    *slash = DIRSEPC;
+  }
+
+  free(ptr);
+  return 0;
+}
+
+
+PUBLIC char *
+vrna_basename(const char *path){
+
+  char  *name, *p, *ptr;
+  int   pos;
+
+  name = NULL;
+
+  if(path){
+    ptr = strrchr(path, DIRSEPC);
+
+    if(ptr && (*(ptr + 1) != '\0'))
+      name = strdup(ptr + 1);
+    else if(!ptr)
+      name = strdup(path);
+  }
+
+  return name;
+}
+
+
+PUBLIC char *
+vrna_dirname(const char *path){
+
+  char  *name, *p, *ptr;
+  int   pos;
+
+  name = NULL;
+
+  if(path){
+    if(!is_absolute_path(path))
+      ptr = vrna_strdup_printf(".%c%s", DIRSEPC, path);
+    else
+      ptr = strdup(path);
+
+    pos = (int)strlen(ptr);
+    p   = ptr + pos;
+
+    do{ /* remove part after last separator */
+      *p = '\0';
+    } while((--p > ptr) && (*p != DIRSEPC));
+
+    if(p > ptr)
+      name = ptr;
+  }
+
+  return name;
+}
+
+
+#ifdef _WIN32
+PRIVATE int
+is_drive_char(const char c){
+
+  if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
+    return 1;
+  return 0;
+}
+#endif
+
+
+PRIVATE int
+is_absolute_path(const char *p){
+
+  if(*p == DIRSEPC)
+    return 1;
+#ifdef _WIN32
+  if(is_drive_char((const char)*p) && (strlen(p) > 3))
+    if((*(p + 1) == ':') && ((*(p + 2) == '\\') || (*(p + 2) == '/')))
+      return 1;
+#endif
+  return 0;
+}
diff --git a/C/ViennaRNA/file_utils.h b/C/ViennaRNA/file_utils.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/file_utils.h
@@ -0,0 +1,54 @@
+#ifndef VIENNA_RNA_PACKAGE_FILE_UTILS_H
+#define VIENNA_RNA_PACKAGE_FILE_UTILS_H
+
+/**
+ *  @file     file_utils.h
+ *  @ingroup  file_utils
+ *  @brief    Several utilities for file handling
+ */
+
+/**
+ *  @addtogroup file_utils
+ *  @brief      Functions dealing with file formats for RNA sequences, structures, and alignments
+ *
+ *  @{
+ *  @ingroup  file_utils
+ */
+
+/**
+ *  @brief Inefficient `cp'
+ */
+void vrna_file_copy(FILE *from, FILE *to);
+
+/**
+ *  @brief Read a line of arbitrary length from a stream
+ *
+ *  Returns a pointer to the resulting string. The necessary memory is
+ *  allocated and should be released using @e free() when the string is
+ *  no longer needed.
+ *
+ *  @param  fp  A file pointer to the stream where the function should read from
+ *  @return     A pointer to the resulting string
+ */
+char  *vrna_read_line(FILE *fp);
+
+/**
+ *  @brief  Recursivly create a directory tree
+ */
+int vrna_mkdir_p(const char *path);
+
+/**
+ *  @brief  Extract the filename from a file path
+ */
+char *vrna_basename(const char *path);
+
+/**
+ *  @brief  Extract the directory part of a file path
+ */
+char *vrna_dirname(const char *path);
+
+/**
+ *  @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/findpath.c b/C/ViennaRNA/findpath.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/findpath.c
@@ -0,0 +1,557 @@
+/* gcc -fopenmp -g3 -DTEST_FINDPATH findpath.c -o FINDpath -lRNA -lm -I ../H/ -L ./ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/findpath.h"
+#include "ViennaRNA/data_structures.h"
+#include "ViennaRNA/model.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/cofold.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/structure_utils.h"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#define LOOP_EN
+
+/**
+ *  @brief
+ */
+typedef struct move {
+  int i;  /* i,j>0 insert; i,j<0 delete */
+  int j;
+  int when;  /* 0 if still available, else resulting distance from start */
+  int E;
+} move_t;
+
+/**
+ *  @brief
+ */
+typedef struct intermediate {
+  short *pt;      /**<  @brief  pair table */
+  int Sen;        /**<  @brief  saddle energy so far */
+  int curr_en;    /**<  @brief  current energy */
+  move_t *moves;  /**<  @brief  remaining moves to target */
+} intermediate_t;
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+PRIVATE int         BP_dist;
+PRIVATE move_t      *path=NULL;
+PRIVATE int         path_fwd; /* 1: struc1->struc2, else struc2 -> struc1 */
+
+PRIVATE vrna_fold_compound_t  *backward_compat_compound = NULL;
+
+#ifdef _OPENMP
+
+/* NOTE: all variables are assumed to be uninitialized if they are declared as threadprivate
+*/
+#pragma omp threadprivate(BP_dist, path, path_fwd, backward_compat_compound)
+
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE move_t  *copy_moves(move_t *mvs);
+PRIVATE int     compare_ptable(const void *A, const void *B);
+PRIVATE int     compare_energy(const void *A, const void *B);
+PRIVATE int     compare_moves_when(const void *A, const void *B);
+PRIVATE void    free_intermediate(intermediate_t *i);
+
+#ifdef TEST_FINDPATH
+
+/* TEST_FINDPATH, COFOLD */
+PRIVATE void  usage(void);
+
+#endif
+
+PRIVATE int     find_path_once(vrna_fold_compound_t *vc, const char *struc1, const char *struc2, int maxE, int maxl);
+PRIVATE int     try_moves(vrna_fold_compound_t *vc, intermediate_t c, int maxE, intermediate_t *next, int dist);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+PUBLIC void free_path(vrna_path_t *path){
+  vrna_path_t *tmp = path;
+  if(tmp){
+    while(tmp->s){ free(tmp->s); tmp++;}
+    free(path);
+  }
+}
+
+PUBLIC int
+find_saddle(const char *seq,
+            const char *struc1,
+            const char *struc2,
+            int max){
+
+  int                 maxE;
+  char                *sequence;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t           md;
+
+  vc = NULL;
+  set_model_details(&md);
+
+  if(backward_compat_compound){
+    if(!strcmp(seq, backward_compat_compound->sequence)){ /* check if sequence is the same as before */
+      md.window_size = backward_compat_compound->length;
+      if(!memcmp(&md, &(backward_compat_compound->params->model_details), sizeof(vrna_md_t))){ /* check if model_details are the same as before */
+        vc = backward_compat_compound; /* re-use previous vrna_fold_compound_t */
+      }
+    }
+  }
+
+  if(!vc){
+    vrna_fold_compound_free(backward_compat_compound);
+
+    sequence = vrna_cut_point_insert(seq, cut_point);
+
+    backward_compat_compound = vc = vrna_fold_compound(sequence, &md, VRNA_OPTION_EVAL_ONLY);
+
+    free(sequence);
+  }
+
+  maxE = vrna_path_findpath_saddle(vc, struc1, struc2, max);
+
+  return maxE;
+}
+
+PUBLIC int
+vrna_path_findpath_saddle( vrna_fold_compound_t *vc,
+                  const char *struc1,
+                  const char *struc2,
+                  int max) {
+
+  int         maxl, maxE;
+  const char  *tmp;
+  move_t      *bestpath=NULL;
+  int         dir;
+
+  path_fwd  = 0;
+  maxE      = INT_MAX - 1;
+
+  maxl = 1;
+  do {
+    int saddleE;
+    path_fwd = !path_fwd;
+    if (maxl>max) maxl=max;
+    if(path) free(path);
+    saddleE  = find_path_once(vc, struc1, struc2, maxE, maxl);
+    if (saddleE<maxE) {
+      maxE = saddleE;
+      if (bestpath) free(bestpath);
+      bestpath = path;
+      path = NULL;
+      dir = path_fwd;
+    } else{
+      free(path);path=NULL;
+    }
+    tmp=struc1;
+    struc1=struc2;
+    struc2=tmp;
+    maxl *=2;
+  } while (maxl<2*max);
+
+  /* (re)set some globals */
+  path=bestpath;
+  path_fwd = dir;
+
+  return maxE;
+}
+
+PUBLIC vrna_path_t *
+get_path( const char *seq,
+          const char *s1,
+          const char* s2,
+          int maxkeep){
+
+  vrna_path_t              *route    = NULL;
+  char                *sequence = NULL;
+  vrna_fold_compound_t  *vc       = NULL;
+  vrna_md_t           md;
+
+  set_model_details(&md);
+
+  if(backward_compat_compound){
+    if(!strcmp(seq, backward_compat_compound->sequence)){ /* check if sequence is the same as before */
+      if(!memcmp(&md, &(backward_compat_compound->params->model_details), sizeof(vrna_md_t))){ /* check if model_details are the same as before */
+        vc = backward_compat_compound; /* re-use previous vrna_fold_compound_t */
+      }
+    }
+  }
+
+  if(!vc){
+    vrna_fold_compound_free(backward_compat_compound);
+
+    sequence = vrna_cut_point_insert(seq, cut_point);
+
+    backward_compat_compound = vc = vrna_fold_compound(sequence, &md, VRNA_OPTION_EVAL_ONLY);
+
+    free(sequence);
+  }
+
+  route = vrna_path_findpath(vc, s1, s2, maxkeep);
+
+  return (route);
+}
+
+PUBLIC vrna_path_t *
+vrna_path_findpath(vrna_fold_compound_t *vc,
+              const char *s1,
+              const char* s2,
+              int maxkeep){
+
+  int E, d;
+  vrna_path_t *route=NULL;
+
+  E = vrna_path_findpath_saddle(vc, s1, s2, maxkeep);
+
+  route = (vrna_path_t *)vrna_alloc((BP_dist+2)*sizeof(vrna_path_t));
+
+  qsort(path, BP_dist, sizeof(move_t), compare_moves_when);
+
+  if (path_fwd) {
+    /* memorize start of path */
+    route[0].s  = strdup(s1);
+    route[0].en = vrna_eval_structure(vc, s1);
+
+    for (d=0; d<BP_dist; d++) {
+      int i,j;
+      route[d+1].s = strdup(route[d].s);
+      i = path[d].i; j=path[d].j;
+      if (i<0) { /* delete */
+        route[d+1].s[(-i)-1] = route[d+1].s[(-j)-1] = '.';
+      } else {
+        route[d+1].s[i-1] = '('; route[d+1].s[j-1] = ')';
+      }
+      route[d+1].en = path[d].E/100.0;
+    }
+  }
+  else {
+    /* memorize start of path */
+
+    route[BP_dist].s  = strdup(s2);
+    route[BP_dist].en = vrna_eval_structure(vc, s2);
+
+    for (d=0; d<BP_dist; d++) {
+      int i,j;
+      route[BP_dist-d-1].s = strdup(route[BP_dist-d].s);
+      i = path[d].i;
+      j = path[d].j;
+      if (i<0) { /* delete */
+        route[BP_dist-d-1].s[(-i)-1] = route[BP_dist-d-1].s[(-j)-1] = '.';
+      } else {
+        route[BP_dist-d-1].s[i-1] = '('; route[BP_dist-d-1].s[j-1] = ')';
+      }
+      route[BP_dist-d-1].en = path[d].E/100.0;
+    }
+  }
+
+#if _DEBUG_FINDPATH_
+  fprintf(stderr, "\n%s\n%s\n%s\n\n", seq, s1, s2);
+  for (d=0; d<=BP_dist; d++)
+    fprintf(stderr, "%s %6.2f\n", route[d].s, route[d].en);
+  fprintf(stderr, "%d\n", *num_entry);
+#endif
+
+  free(path);path=NULL;
+  return (route);
+}
+
+PRIVATE int
+try_moves(vrna_fold_compound_t *vc,
+          intermediate_t c,
+          int maxE,
+          intermediate_t *next,
+          int dist){
+
+  int *loopidx, len, num_next=0, en, oldE;
+  move_t *mv;
+  short *pt;
+
+  len = c.pt[0];
+  loopidx = vrna_loopidx_from_ptable(c.pt);
+  oldE = c.Sen;
+  for (mv=c.moves; mv->i!=0; mv++) {
+    int i,j;
+    if (mv->when>0) continue;
+    i = mv->i; j = mv->j;
+    pt = (short *) vrna_alloc(sizeof(short)*(len+1));
+    memcpy(pt, c.pt,(len+1)*sizeof(short));
+    if (j<0) { /*it's a delete move */
+      pt[-i]=0;
+      pt[-j]=0;
+    } else { /* insert move */
+      if ((loopidx[i] == loopidx[j]) && /* i and j belong to same loop */
+          (pt[i] == 0) && (pt[j]==0)     /* ... and are unpaired */
+          ) {
+        pt[i]=j;
+        pt[j]=i;
+      } else {
+        free(pt);
+        continue; /* llegal move, try next; */
+      }
+    }
+#ifdef LOOP_EN
+    en = c.curr_en + vrna_eval_move_pt(vc, c.pt, i, j);
+#else
+    en = vrna_eval_structure_pt(vc, pt);
+#endif
+    if (en<maxE) {
+      next[num_next].Sen = (en>oldE)?en:oldE;
+      next[num_next].curr_en = en;
+      next[num_next].pt = pt;
+      mv->when=dist;
+      mv->E = en;
+      next[num_next++].moves = copy_moves(c.moves);
+      mv->when=0;
+    }
+    else free(pt);
+  }
+  free(loopidx);
+  return num_next;
+}
+
+PRIVATE int find_path_once(vrna_fold_compound_t *vc, const char *struc1, const char *struc2, int maxE, int maxl) {
+  short *pt1, *pt2;
+  move_t *mlist;
+  int i, len, d, dist=0, result;
+  intermediate_t *current, *next;
+
+  pt1 = vrna_ptable(struc1);
+  pt2 = vrna_ptable(struc2);
+  len = (int) strlen(struc1);
+
+  mlist = (move_t *) vrna_alloc(sizeof(move_t)*len); /* bp_dist < n */
+
+  for (i=1; i<=len; i++) {
+    if (pt1[i] != pt2[i]) {
+      if (i<pt1[i]) { /* need to delete this pair */
+        mlist[dist].i = -i;
+        mlist[dist].j = -pt1[i];
+        mlist[dist++].when = 0;
+      }
+      if (i<pt2[i]) { /* need to insert this pair */
+        mlist[dist].i = i;
+        mlist[dist].j = pt2[i];
+        mlist[dist++].when = 0;
+      }
+    }
+  }
+  free(pt2);
+  BP_dist = dist;
+  current = (intermediate_t *) vrna_alloc(sizeof(intermediate_t)*(maxl+1));
+  current[0].pt = pt1;
+  current[0].Sen = current[0].curr_en = vrna_eval_structure_pt(vc, pt1);
+  current[0].moves = mlist;
+  next = (intermediate_t *) vrna_alloc(sizeof(intermediate_t)*(dist*maxl+1));
+
+  for (d=1; d<=dist; d++) { /* go through the distance classes */
+    int c, u, num_next=0;
+    intermediate_t *cc;
+
+    for (c=0; current[c].pt != NULL; c++) {
+      num_next += try_moves(vc, current[c], maxE, next+num_next, d);
+    }
+    if (num_next==0) {
+      for (cc=current; cc->pt != NULL; cc++) free_intermediate(cc);
+      current[0].Sen=INT_MAX;
+      break;
+    }
+    /* remove duplicates via sort|uniq
+       if this becomes a bottleneck we can use a hash instead */
+    qsort(next, num_next, sizeof(intermediate_t),compare_ptable);
+    for (u=0,c=1; c<num_next; c++) {
+      if (memcmp(next[u].pt,next[c].pt,sizeof(short)*len)!=0) {
+        next[++u] = next[c];
+      } else {
+        free_intermediate(next+c);
+      }
+    }
+    num_next = u+1;
+    qsort(next, num_next, sizeof(intermediate_t),compare_energy);
+    /* free the old stuff */
+    for (cc=current; cc->pt != NULL; cc++) free_intermediate(cc);
+    for (u=0; u<maxl && u<num_next; u++) {
+      current[u] = next[u];
+    }
+    for (; u<num_next; u++)
+      free_intermediate(next+u);
+    num_next=0;
+  }
+  free(next);
+  path = current[0].moves;
+  result = current[0].Sen;
+  free(current[0].pt); free(current);
+  return(result);
+}
+
+PRIVATE void free_intermediate(intermediate_t *i) {
+   free(i->pt);
+   free(i->moves);
+   i->pt = NULL;
+   i->moves = NULL;
+   i->Sen = INT_MAX;
+ }
+
+PRIVATE int compare_ptable(const void *A, const void *B) {
+  intermediate_t *a, *b;
+  int c;
+  a = (intermediate_t *) A;
+  b = (intermediate_t *) B;
+
+  c = memcmp(a->pt, b->pt, a->pt[0]*sizeof(short));
+  if (c!=0) return c;
+  if ((a->Sen - b->Sen) != 0) return (a->Sen - b->Sen);
+  return (a->curr_en - b->curr_en);
+}
+
+PRIVATE int compare_energy(const void *A, const void *B) {
+  intermediate_t *a, *b;
+  a = (intermediate_t *) A;
+  b = (intermediate_t *) B;
+
+  if ((a->Sen - b->Sen) != 0) return (a->Sen - b->Sen);
+  return (a->curr_en - b->curr_en);
+}
+
+PRIVATE int compare_moves_when(const void *A, const void *B) {
+  move_t *a, *b;
+  a = (move_t *) A;
+  b = (move_t *) B;
+
+  return(a->when - b->when);
+}
+
+PRIVATE move_t* copy_moves(move_t *mvs) {
+  move_t *new;
+  new = (move_t *) vrna_alloc(sizeof(move_t)*(BP_dist+1));
+  memcpy(new,mvs,sizeof(move_t)*(BP_dist+1));
+  return new;
+}
+
+#ifdef TEST_FINDPATH
+
+PUBLIC void print_path(const char *seq, const char *struc) {
+  int d;
+  char *s;
+  s = strdup(struc);
+  if (cut_point == -1)
+    printf("%s\n%s\n", seq, s);
+    /* printf("%s\n%s %6.2f\n", seq, s, vrna_eval_structure_simple(seq,s)); */
+  else {
+    char *pstruct, *pseq;
+    pstruct = vrna_cut_point_insert(s, cut_point);
+    pseq = vrna_cut_point_insert(seq, cut_point);
+    printf("%s\n%s\n", pseq, pstruct);
+    /* printf("%s\n%s %6.2f\n", pseq, pstruct, vrna_eval_structure_simple(seq,s)); */
+    free(pstruct);
+    free(pseq);
+  }
+  qsort(path, BP_dist, sizeof(move_t), compare_moves_when);
+  for (d=0; d<BP_dist; d++) {
+    int i,j;
+    i = path[d].i; j=path[d].j;
+    if (i<0) { /* delete */
+      s[(-i)-1] = s[(-j)-1] = '.';
+    } else {
+      s[i-1] = '('; s[j-1] = ')';
+    }
+    /* printf("%s %6.2f - %6.2f\n", s, vrna_eval_structure_simple(seq,s), path[d].E/100.0); */
+  }
+  free(s);
+}
+
+int main(int argc, char *argv[]) {
+  char *line, *seq, *s1, *s2;
+  int E, maxkeep=1000;
+  int verbose=0, i;
+  vrna_path_t *route, *r;
+
+  for (i=1; i<argc; i++) {
+    switch ( argv[i][1] ) {
+      case 'm': if (strcmp(argv[i],"-m")==0)
+                  sscanf(argv[++i], "%d", &maxkeep);
+                break;
+      case 'v': verbose = !strcmp(argv[i],"-v");
+                break;
+      case 'd': if (strcmp(argv[i],"-d")==0){
+                  sscanf(argv[++i], "%d", &dangles);
+                  md.dangles = dangles;
+                }
+                break;
+      default: usage();
+    }
+  }
+
+  cut_point = -1;
+  line = vrna_read_line(stdin);
+  seq = vrna_cut_point_remove(line, &cut_point);
+  free(line);   
+  line = vrna_read_line(stdin);
+  s1 = vrna_cut_point_remove(line, &cut_point);
+  free(line);
+  line = vrna_read_line(stdin);
+  s2 = vrna_cut_point_remove(line, &cut_point);
+  free(line);
+
+  E = find_saddle(seq, s1, s2, maxkeep);
+  printf("saddle_energy = %6.2f\n", E/100.);
+  if (verbose) {
+      if (path_fwd)
+          print_path(seq,s1);
+      else
+          print_path(seq,s2);
+      free(path);
+      path = NULL;
+      route = get_path(seq, s1, s2, maxkeep);
+      for (r=route; r->s; r++) {
+          if (cut_point == -1) {
+              printf("%s %6.2f\n", r->s, r->en);
+              /* printf("%s %6.2f - %6.2f\n", r->s, vrna_eval_structure_simple(seq,r->s), r->en); */
+          } else {
+              char *pstruct;
+              pstruct = vrna_cut_point_insert(r->s, cut_point);
+              printf("%s %6.2f\n", pstruct, r->en);
+              /* printf("%s %6.2f - %6.2f\n", pstruct, vrna_eval_structure_simple(seq,r->s), r->en); */
+              free(pstruct);
+          }
+          free(r->s);
+      }
+      free(route);
+  }
+  free(seq); free(s1); free(s2);
+  return(EXIT_SUCCESS);
+}
+
+static void usage(void){
+  vrna_message_error("usage: findpath.c  [-m depth] [-d[0|1|2]] [-v]");
+}
+
+#endif
diff --git a/C/ViennaRNA/findpath.h b/C/ViennaRNA/findpath.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/findpath.h
@@ -0,0 +1,155 @@
+#ifndef VIENNA_RNA_PACKAGE_FIND_PATH_H
+#define VIENNA_RNA_PACKAGE_FIND_PATH_H
+
+/**
+ *  @file     findpath.h
+ *  @ingroup  paths
+ *  @brief    A breadth-first search heuristic for optimal direct folding paths
+ */
+
+/**
+ *  @addtogroup   direct_paths
+ *  @brief Heuristics to explore direct, optimal (re-)folding paths between two secondary structures
+ *
+ *  @{
+ *  @ingroup  direct_paths
+ */
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/* below are several convenience typedef's we use throughout the ViennaRNA library */
+
+/**
+ *  @brief Typename for the refolding path data structure #vrna_path_s
+ */
+typedef struct vrna_path_s  vrna_path_t;
+
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/* the following typedefs are for backward compatibility only */
+
+/**
+ *  @brief Old typename of #vrna_path_s
+ *  @deprecated Use #vrna_path_t instead!
+*/
+typedef struct vrna_path_s path_t;
+
+#endif
+
+#include <ViennaRNA/data_structures.h>
+
+/**
+ *  @brief  An element of a refolding path list
+ *  @see    vrna_path_findpath()
+ */
+struct vrna_path_s {
+  double en;  /**<  @brief  Free energy of current structure */
+  char *s;    /**<  @brief  Secondary structure in dot-bracket notation */
+};
+
+
+/**
+ *  \brief Find energy of a saddle point between 2 structures
+ *  (search only direct path)
+ *
+ *  This function uses an inplementation of the @em findpath algorithm @cite flamm:2001
+ *  for near-optimal direct refolding path prediction.
+ *
+ *  Model details, and energy parameters are used as provided via the parameter 'vc'.
+ *  The #vrna_fold_compound_t does not require memory for any DP matrices,
+ *  but requires all most basic init values as one would get from a call like this:
+ *  @code{.c}
+ vc = vrna_fold_compound(sequence, NULL, VRNA_OPTION_EVAL_ONLY);
+    @endcode
+ *
+ *  @see vrna_fold_compound(), #vrna_fold_compound_t, vrna_path_findpath()
+ *
+ *  @param vc     The #vrna_fold_compound_t with precomputed sequence encoding and model details
+ *  @param struc1 The start structure in dot-brakcet notation
+ *  @param struc2 The target structure in dot-bracket notation
+ *  @param max    A number specifying how many strutures are being kept at each step during the search
+ *  @returns      The saddle energy in 10cal/mol
+ */
+int vrna_path_findpath_saddle(vrna_fold_compound_t *vc,
+                              const char *struc1,
+                              const char *struc2,
+                              int max);
+
+/**
+ *  @brief Find refolding path between 2 structures
+ *  (search only direct path)
+ *
+ *  This function uses an inplementation of the @em findpath algorithm @cite flamm:2001
+ *  for near-optimal direct refolding path prediction.
+ *
+ *  Model details, and energy parameters are used as provided via the parameter 'vc'.
+ *  The #vrna_fold_compound_t does not require memory for any DP matrices,
+ *  but requires all most basic init values as one would get from a call like this:
+ *  @code{.c}
+ vc = vrna_fold_compound(sequence, NULL, VRNA_OPTION_EVAL_ONLY);
+    @endcode
+ *
+ *  @see vrna_fold_compound(), #vrna_fold_compound_t, vrna_path_findpath_saddle()
+ *
+ *  @param vc       The #vrna_fold_compound_t with precomputed sequence encoding and model details
+ *  @param s1       The start structure in dot-brakcet notation
+ *  @param s2       The target structure in dot-bracket notation
+ *  @param maxkeep  A number specifying how many strutures are being kept at each step during the search
+ *  @returns        The saddle energy in 10cal/mol
+ */
+vrna_path_t *vrna_path_findpath(vrna_fold_compound_t *vc,
+                                const char *s1,
+                                const char* s2,
+                                int maxkeep);
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/**
+ *  \brief Find energy of a saddle point between 2 structures
+ *  (search only direct path)
+ *
+ *  \param seq RNA sequence
+ *  \param struc1 A pointer to the character array where the first
+ *         secondary structure in dot-bracket notation will be written to
+ *  \param struc2 A pointer to the character array where the second
+ *         secondary structure in dot-bracket notation will be written to
+ *  \param max integer how many strutures are being kept during the search
+ *  \returns the saddle energy in 10cal/mol
+ */
+int find_saddle(const char *seq,
+                const char *struc1,
+                const char *struc2,
+                int max);
+/**
+ *  \brief Free memory allocated by get_path() function
+ *
+ *  \param path pointer to memory to be freed
+ */
+void    free_path(vrna_path_t *path);
+
+/**
+ *  \brief Find refolding path between 2 structures
+ *  (search only direct path)
+ *
+ *  \param seq RNA sequence
+ *  \param s1 A pointer to the character array where the first
+ *         secondary structure in dot-bracket notation will be written to
+ *  \param s2 A pointer to the character array where the second
+ *         secondary structure in dot-bracket notation will be written to
+ *  \param maxkeep integer how many strutures are being kept during the search
+ *  \returns direct refolding path between two structures
+ */
+vrna_path_t *get_path(const char *seq,
+                      const char *s1,
+                      const char* s2,
+                      int maxkeep);
+
+#endif
+
+/**
+ *  @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/fold.c b/C/ViennaRNA/fold.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/fold.c
@@ -0,0 +1,569 @@
+/** \file **/
+
+/*
+                  minimum free energy
+                  RNA secondary structure prediction
+
+                  c Ivo Hofacker, Chrisoph Flamm
+                  original implementation by
+                  Walter Fontana
+                  g-quadruplex support and threadsafety
+                  by Ronny Lorenz
+
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/data_structures.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/fold.h"
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#endif
+
+#define MAXSECTORS        500     /* dimension for a backtrack array */
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/* some backward compatibility stuff */
+PRIVATE int                 backward_compat           = 0;
+PRIVATE vrna_fold_compound_t  *backward_compat_compound = NULL;
+
+#ifdef _OPENMP
+
+#pragma omp threadprivate(backward_compat_compound, backward_compat)
+
+#endif
+
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/* wrappers for old API compatibility */
+PRIVATE float wrap_fold( const char *string, char *structure, vrna_param_t *parameters, int is_constrained, int is_circular);
+PRIVATE void  wrap_array_export(int **f5_p, int **c_p, int **fML_p, int **fM1_p, int **indx_p, char **ptype_p);
+PRIVATE void  wrap_array_export_circ( int *Fc_p, int *FcH_p, int *FcI_p, int *FcM_p, int **fM2_p);
+
+#endif
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC float
+vrna_fold(const char *string,
+          char *structure){
+
+  float                 mfe;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vrna_md_set_default(&md);
+  vc  = vrna_fold_compound(string, &md, 0);
+  mfe = vrna_mfe(vc, structure);
+
+  vrna_fold_compound_free(vc);
+
+  return mfe;
+}
+
+PUBLIC float
+vrna_circfold(const char *string,
+              char *structure){
+
+  float                 mfe;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vrna_md_set_default(&md);
+  md.circ = 1;
+  vc      = vrna_fold_compound(string, &md, 0);
+  mfe     = vrna_mfe(vc, structure);
+
+  vrna_fold_compound_free(vc);
+
+  return mfe;
+
+}
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+PRIVATE void
+wrap_array_export(int **f5_p,
+                  int **c_p,
+                  int **fML_p,
+                  int **fM1_p,
+                  int **indx_p,
+                  char **ptype_p){
+
+  /* make the DP arrays available to routines such as subopt() */
+  if(backward_compat_compound){
+    *f5_p     = backward_compat_compound->matrices->f5;
+    *c_p      = backward_compat_compound->matrices->c;
+    *fML_p    = backward_compat_compound->matrices->fML;
+    *fM1_p    = backward_compat_compound->matrices->fM1;
+    *indx_p   = backward_compat_compound->jindx;
+    *ptype_p  = backward_compat_compound->ptype;
+  }
+}
+
+PRIVATE void
+wrap_array_export_circ( int *Fc_p,
+                        int *FcH_p,
+                        int *FcI_p,
+                        int *FcM_p,
+                        int **fM2_p){
+
+  /* make the DP arrays available to routines such as subopt() */
+  if(backward_compat_compound){
+    *Fc_p   = backward_compat_compound->matrices->Fc;
+    *FcH_p  = backward_compat_compound->matrices->FcH;
+    *FcI_p  = backward_compat_compound->matrices->FcI;
+    *FcM_p  = backward_compat_compound->matrices->FcM;
+    *fM2_p  = backward_compat_compound->matrices->fM2;
+  }
+}
+
+PRIVATE float
+wrap_fold( const char *string,
+          char *structure,
+          vrna_param_t *parameters,
+          int is_constrained,
+          int is_circular){
+
+  vrna_fold_compound_t  *vc;
+  vrna_param_t          *P;
+  float                 mfe;
+
+#ifdef _OPENMP
+/* Explicitly turn off dynamic threads */
+  omp_set_dynamic(0);
+#endif
+
+  /* we need the parameter structure for hard constraints */
+  if(parameters){
+    P = vrna_params_copy(parameters);
+  } else {
+    vrna_md_t md;
+    set_model_details(&md);
+    md.temperature = temperature;
+    P = vrna_params(&md);
+  }
+  P->model_details.circ = is_circular;
+
+  vc = vrna_fold_compound(string, &(P->model_details), VRNA_OPTION_DEFAULT);
+
+  if(parameters){ /* replace params if necessary */
+    free(vc->params);
+    vc->params = P;
+  } else {
+    free(P);
+  }
+
+  /* handle hard constraints in pseudo dot-bracket format if passed via simple interface */
+  if(is_constrained && structure){
+    unsigned int constraint_options = 0;
+    constraint_options |= VRNA_CONSTRAINT_DB
+                          | VRNA_CONSTRAINT_DB_PIPE
+                          | VRNA_CONSTRAINT_DB_DOT
+                          | VRNA_CONSTRAINT_DB_X
+                          | VRNA_CONSTRAINT_DB_ANG_BRACK
+                          | VRNA_CONSTRAINT_DB_RND_BRACK;
+
+    vrna_constraints_add(vc, (const char *)structure, constraint_options);
+  }
+
+  if(backward_compat_compound && backward_compat)
+    vrna_fold_compound_free(backward_compat_compound);
+
+  backward_compat_compound  = vc;
+  backward_compat           = 1;
+
+  /* call mfe() function without backtracking */
+  mfe = vrna_mfe(vc, NULL);
+
+  /* backtrack structure */
+  if(structure && vc->params->model_details.backtrack){
+    char            *ss;
+    int             length;
+    sect            bt_stack[MAXSECTORS];
+    vrna_bp_stack_t *bp;
+
+    length  = vc->length;
+    bp      = (vrna_bp_stack_t *)vrna_alloc(sizeof(vrna_bp_stack_t) * (4*(1+length/2))); /* add a guess of how many G's may be involved in a G quadruplex */
+
+    vrna_backtrack_from_intervals(vc, bp, bt_stack, 0);
+
+    ss = vrna_db_from_bp_stack(bp, length);
+    strncpy(structure, ss, length + 1);
+    free(ss);
+
+    if(base_pair)
+      free(base_pair);
+    base_pair = bp;
+  }
+
+  return mfe;
+}
+
+PUBLIC void
+free_arrays(void){
+
+  if(backward_compat_compound && backward_compat){
+    vrna_fold_compound_free(backward_compat_compound);
+    backward_compat_compound = NULL;
+    backward_compat          = 0;
+  }
+}
+
+PUBLIC float
+fold_par( const char *string,
+          char *structure,
+          vrna_param_t *parameters,
+          int is_constrained,
+          int is_circular){
+
+  return wrap_fold(string, structure, parameters, is_constrained, is_circular);
+
+}
+
+PUBLIC float
+fold( const char *string,
+      char *structure){
+
+  return wrap_fold(string, structure, NULL, fold_constrained, 0);
+}
+
+PUBLIC float
+circfold( const char *string,
+          char *structure){
+
+  return wrap_fold(string, structure, NULL, fold_constrained, 1);
+}
+
+PUBLIC void
+initialize_fold(int length){
+
+  /* DO NOTHING */
+}
+
+PUBLIC void
+update_fold_params(void){
+
+  vrna_md_t           md;
+
+  if(backward_compat_compound && backward_compat){
+    set_model_details(&md);
+    vrna_params_reset(backward_compat_compound, &md);
+  }
+}
+
+PUBLIC void
+update_fold_params_par(vrna_param_t *parameters){
+
+  vrna_md_t           md;
+
+  if(backward_compat_compound && backward_compat){
+    if(parameters)
+      vrna_params_subst(backward_compat_compound, parameters);
+    else{
+      set_model_details(&md);
+      vrna_params_reset(backward_compat_compound, &md);
+    }
+  }
+}
+
+PUBLIC void
+export_fold_arrays( int **f5_p,
+                    int **c_p,
+                    int **fML_p,
+                    int **fM1_p,
+                    int **indx_p,
+                    char **ptype_p){
+
+  wrap_array_export(f5_p,c_p,fML_p,fM1_p,indx_p,ptype_p);
+}
+
+PUBLIC void
+export_fold_arrays_par( int **f5_p,
+                        int **c_p,
+                        int **fML_p,
+                        int **fM1_p,
+                        int **indx_p,
+                        char **ptype_p,
+                        vrna_param_t **P_p){
+
+  wrap_array_export(f5_p,c_p,fML_p,fM1_p,indx_p,ptype_p);
+  if(backward_compat_compound) *P_p  = backward_compat_compound->params;
+}
+
+PUBLIC void
+export_circfold_arrays( int *Fc_p,
+                        int *FcH_p,
+                        int *FcI_p,
+                        int *FcM_p,
+                        int **fM2_p,
+                        int **f5_p,
+                        int **c_p,
+                        int **fML_p,
+                        int **fM1_p,
+                        int **indx_p,
+                        char **ptype_p){
+
+  wrap_array_export(f5_p,c_p,fML_p,fM1_p,indx_p,ptype_p);
+  wrap_array_export_circ(Fc_p,FcH_p,FcI_p,FcM_p,fM2_p);
+}
+
+PUBLIC void
+export_circfold_arrays_par( int *Fc_p,
+                            int *FcH_p,
+                            int *FcI_p,
+                            int *FcM_p,
+                            int **fM2_p,
+                            int **f5_p,
+                            int **c_p,
+                            int **fML_p,
+                            int **fM1_p,
+                            int **indx_p,
+                            char **ptype_p,
+                            vrna_param_t **P_p){
+
+  wrap_array_export(f5_p,c_p,fML_p,fM1_p,indx_p,ptype_p);
+  wrap_array_export_circ(Fc_p,FcH_p,FcI_p,FcM_p,fM2_p);
+  if(backward_compat_compound) *P_p  = backward_compat_compound->params;
+}
+
+PUBLIC char *
+backtrack_fold_from_pair( char *sequence,
+                          int i,
+                          int j){
+
+  char          *structure  = NULL;
+  unsigned int  length      = 0;
+  vrna_bp_stack_t         *bp         = NULL;
+  sect          bt_stack[MAXSECTORS]; /* stack of partial structures for backtracking */
+
+  if(sequence){
+    length = strlen(sequence);
+    bp = (vrna_bp_stack_t *)vrna_alloc(sizeof(vrna_bp_stack_t) * (1+length/2));
+  } else {
+    vrna_message_error("backtrack_fold_from_pair@fold.c: no sequence given");
+  }
+
+  bt_stack[1].i  = i;
+  bt_stack[1].j  = j;
+  bt_stack[1].ml = 2;
+
+  bp[0].i = 0; /* ??? this is set by backtrack anyway... */
+
+  vrna_backtrack_from_intervals(backward_compat_compound, bp, bt_stack, 1);
+  structure = vrna_db_from_bp_stack(bp, length);
+
+  /* backward compatibitlity stuff */
+  if(base_pair) free(base_pair);
+  base_pair = bp;
+
+  return structure;
+}
+
+#define STACK_BULGE1      1       /* stacking energies for bulges of size 1 */
+#define NEW_NINIO         1       /* new asymetry penalty */
+
+PUBLIC int HairpinE(int size, int type, int si1, int sj1, const char *string) {
+  vrna_param_t  *P  = backward_compat_compound->params;
+  int energy;
+
+  energy = (size <= 30) ? P->hairpin[size] :
+    P->hairpin[30]+(int)(P->lxc*log((size)/30.));
+
+  if (tetra_loop){
+    if (size == 4) { /* check for tetraloop bonus */
+      char tl[7]={0}, *ts;
+      strncpy(tl, string, 6);
+      if ((ts=strstr(P->Tetraloops, tl)))
+        return (P->Tetraloop_E[(ts - P->Tetraloops)/7]);
+    }
+    if (size == 6) {
+      char tl[9]={0}, *ts;
+      strncpy(tl, string, 8);
+      if ((ts=strstr(P->Hexaloops, tl)))
+        return (energy = P->Hexaloop_E[(ts - P->Hexaloops)/9]);
+    }
+    if (size == 3) {
+      char tl[6]={0,0,0,0,0,0}, *ts;
+      strncpy(tl, string, 5);
+      if ((ts=strstr(P->Triloops, tl))) {
+        return (P->Triloop_E[(ts - P->Triloops)/6]);
+      }
+      if (type>2)  /* neither CG nor GC */
+        energy += P->TerminalAU; /* penalty for closing AU GU pair IVOO??
+                                    sind dass jetzt beaunuesse oder mahlnuesse (vorzeichen?)*/
+      return energy;
+    }
+   }
+   energy += P->mismatchH[type][si1][sj1];
+
+  return energy;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC int oldLoopEnergy(int i, int j, int p, int q, int type, int type_2) {
+
+  vrna_param_t  *P  = backward_compat_compound->params;
+  short   *S1 = backward_compat_compound->sequence_encoding;
+
+  /* compute energy of degree 2 loop (stack bulge or interior) */
+  int n1, n2, m, energy;
+  n1 = p-i-1;
+  n2 = j-q-1;
+
+  if (n1>n2) { m=n1; n1=n2; n2=m; } /* so that n2>=n1 */
+
+  if (n2 == 0)
+    energy = P->stack[type][type_2];   /* stack */
+
+  else if (n1==0) {                  /* bulge */
+    energy = (n2<=MAXLOOP)?P->bulge[n2]:
+      (P->bulge[30]+(int)(P->lxc*log(n2/30.)));
+
+#if STACK_BULGE1
+    if (n2==1) energy+=P->stack[type][type_2];
+#endif
+  } else {                           /* interior loop */
+
+    if ((n1+n2==2)&&(james_rule))
+      /* special case for loop size 2 */
+      energy = P->int11[type][type_2][S1[i+1]][S1[j-1]];
+    else {
+      energy = (n1+n2<=MAXLOOP)?(P->internal_loop[n1+n2]):
+        (P->internal_loop[30]+(int)(P->lxc*log((n1+n2)/30.)));
+
+#if NEW_NINIO
+      energy += MIN2(MAX_NINIO, (n2-n1)*P->ninio[2]);
+#else
+      m       = MIN2(4, n1);
+      energy += MIN2(MAX_NINIO,((n2-n1)*P->ninio[m]));
+#endif
+      energy += P->mismatchI[type][S1[i+1]][S1[j-1]]+
+        P->mismatchI[type_2][S1[q+1]][S1[p-1]];
+    }
+  }
+  return energy;
+}
+
+/*--------------------------------------------------------------------------*/
+
+PUBLIC int LoopEnergy(int n1, int n2, int type, int type_2,
+                      int si1, int sj1, int sp1, int sq1) {
+
+  vrna_param_t  *P  = backward_compat_compound->params;
+  /* compute energy of degree 2 loop (stack bulge or interior) */
+  int nl, ns, energy;
+
+  if (n1>n2) { nl=n1; ns=n2;}
+  else {nl=n2; ns=n1;}
+
+  if (nl == 0)
+    return P->stack[type][type_2];    /* stack */
+
+  if (ns==0) {                       /* bulge */
+    energy = (nl<=MAXLOOP)?P->bulge[nl]:
+      (P->bulge[30]+(int)(P->lxc*log(nl/30.)));
+    if (nl==1) energy += P->stack[type][type_2];
+    else {
+      if (type>2) energy += P->TerminalAU;
+      if (type_2>2) energy += P->TerminalAU;
+    }
+    return energy;
+  }
+  else {                             /* interior loop */
+    if (ns==1) {
+      if (nl==1)                     /* 1x1 loop */
+        return P->int11[type][type_2][si1][sj1];
+      if (nl==2) {                   /* 2x1 loop */
+        if (n1==1)
+          energy = P->int21[type][type_2][si1][sq1][sj1];
+        else
+          energy = P->int21[type_2][type][sq1][si1][sp1];
+        return energy;
+      }
+        else {  /* 1xn loop */
+        energy = (nl+1<=MAXLOOP)?(P->internal_loop[nl+1]):
+        (P->internal_loop[30]+(int)(P->lxc*log((nl+1)/30.)));
+        energy += MIN2(MAX_NINIO, (nl-ns)*P->ninio[2]);
+        energy += P->mismatch1nI[type][si1][sj1]+
+        P->mismatch1nI[type_2][sq1][sp1];
+        return energy;
+        }
+    }
+    else if (ns==2) {
+      if(nl==2)      {   /* 2x2 loop */
+        return P->int22[type][type_2][si1][sp1][sq1][sj1];}
+      else if (nl==3)  { /* 2x3 loop */
+        energy = P->internal_loop[5]+P->ninio[2];
+        energy += P->mismatch23I[type][si1][sj1]+
+          P->mismatch23I[type_2][sq1][sp1];
+        return energy;
+      }
+
+    }
+    { /* generic interior loop (no else here!)*/
+      energy = (n1+n2<=MAXLOOP)?(P->internal_loop[n1+n2]):
+        (P->internal_loop[30]+(int)(P->lxc*log((n1+n2)/30.)));
+
+      energy += MIN2(MAX_NINIO, (nl-ns)*P->ninio[2]);
+
+      energy += P->mismatchI[type][si1][sj1]+
+        P->mismatchI[type_2][sq1][sp1];
+    }
+  }
+  return energy;
+}
+
+#endif
diff --git a/C/ViennaRNA/fold.h b/C/ViennaRNA/fold.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/fold.h
@@ -0,0 +1,320 @@
+#ifndef VIENNA_RNA_PACKAGE_FOLD_H
+#define VIENNA_RNA_PACKAGE_FOLD_H
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+#include <ViennaRNA/mfe.h>
+#include <ViennaRNA/eval.h>
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file fold.h
+ *  @ingroup  mfe_fold
+ *  @brief MFE calculations for single RNA sequences
+ */
+
+/**
+ *  @addtogroup mfe_fold_single
+ *  @brief This module contains all functions and variables related to the calculation
+ *  of global minimum free energy structures for single sequences.
+ *
+ *  The library provides a fast dynamic programming minimum free energy
+ *  folding algorithm as described by "Zuker & Stiegler (1981)" @cite zuker:1981.
+ *
+ *  @{
+ *  @ingroup  mfe_fold_single
+ */
+
+/**
+ *  @brief Compute Minimum Free Energy (MFE), and a corresponding secondary structure for an RNA sequence
+ *
+ *  This simplified interface to vrna_mfe() computes the MFE and, if required, a secondary structure for an
+ *  RNA sequence using default options. Memory required for dynamic programming (DP) matrices will
+ *  be allocated and free'd on-the-fly. Hence, after return of this function, the recursively filled
+ *  matrices are not available any more for any post-processing, e.g. suboptimal backtracking, etc.
+ *
+ *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
+ *  you require other conditions than specified by the default model details, use vrna_mfe(),
+ *  and the data structure #vrna_fold_compound_t instead.
+ *
+ *  @see vrna_circfold(), vrna_mfe(), vrna_fold_compound(), #vrna_fold_compound_t
+ *
+ *  @param sequence   RNA sequence
+ *  @param structure  A pointer to the character array where the
+ *         secondary structure in dot-bracket notation will be written to
+ *  @return the minimum free energy (MFE) in kcal/mol
+ */
+float
+vrna_fold(const char *sequence,
+          char *structure);
+
+/**
+ *  @brief Compute Minimum Free Energy (MFE), and a corresponding secondary structure for a circular RNA sequence
+ *
+ *  This simplified interface to vrna_mfe() computes the MFE and, if required, a secondary structure for a
+ *  circular RNA sequence using default options. Memory required for dynamic programming (DP) matrices will
+ *  be allocated and free'd on-the-fly. Hence, after return of this function, the recursively filled
+ *  matrices are not available any more for any post-processing, e.g. suboptimal backtracking, etc.
+ *
+ *  Folding of circular RNA sequences is handled as a post-processing step of the forward
+ *  recursions. See @cite hofacker:2006 for further details.
+ *
+ *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
+ *  you require other conditions than specified by the default model details, use vrna_mfe(),
+ *  and the data structure #vrna_fold_compound_t instead.
+ *
+ *  @see vrna_fold(), vrna_mfe(), vrna_fold_compound(), #vrna_fold_compound_t
+ *
+ *  @param sequence   RNA sequence
+ *  @param structure  A pointer to the character array where the
+ *         secondary structure in dot-bracket notation will be written to
+ *  @return the minimum free energy (MFE) in kcal/mol
+ */
+float
+vrna_circfold(const char *sequence,
+              char *structure);
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief Compute minimum free energy and an appropriate secondary
+ *  structure of an RNA sequence
+ *
+ *  The first parameter given, the RNA sequence, must be @a uppercase and should only contain
+ *  an alphabet @f$\Sigma@f$ that is understood by the RNAlib\n
+ *  (e.g. @f$ \Sigma = \{A,U,C,G\} @f$)\n
+ *
+ *  The second parameter, @a structure, must always point to an allocated
+ *  block of memory with a size of at least @f$\mathrm{strlen}(\mathrm{sequence})+1@f$
+ *
+ *  If the third parameter is NULL, global model detail settings are assumed for the folding
+ *  recursions. Otherwise, the provided parameters are used.
+ *
+ *  The fourth parameter indicates whether a secondary structure constraint in enhanced dot-bracket
+ *  notation is passed through the structure parameter or not. If so, the characters " | x < > " are
+ *  recognized to mark bases that are paired, unpaired, paired upstream, or downstream, respectively.
+ *  Matching brackets " ( ) " denote base pairs, dots "." are used for unconstrained bases.
+ *
+ *  To indicate that the RNA sequence is circular and thus has to be post-processed, set the last
+ *  parameter to non-zero
+ *
+ *  After a successful call of fold_par(), a backtracked secondary structure (in dot-bracket notation)
+ *  that exhibits the minimum of free energy will be written to the memory @a structure is pointing to.
+ *  The function returns the minimum of free energy for any fold of the sequence given.
+ *
+ *  @note OpenMP: Passing NULL to the 'parameters' argument involves access to several global model
+ *        detail variables and thus is not to be considered threadsafe
+ *
+ *  @deprecated use vrna_mfe() instead!
+ *
+ *  @see vrna_mfe(), fold(), circfold(), #vrna_md_t, set_energy_model(), get_scaled_parameters()
+ *
+ *  @param sequence       RNA sequence
+ *  @param structure      A pointer to the character array where the
+ *                        secondary structure in dot-bracket notation will be written to
+ *  @param parameters     A data structure containing the pre-scaled energy contributions
+ *                        and the model details. (NULL may be passed, see OpenMP notes above)
+ *  @param is_constrained Switch to indicate that a structure constraint is passed via the structure argument (0==off)
+ *  @param is_circular    Switch to (de-)activate post-processing steps in case RNA sequence is circular (0==off)
+ *
+ *  @return the minimum free energy (MFE) in kcal/mol
+ */
+DEPRECATED(float
+fold_par( const char *sequence,
+          char *structure,
+          vrna_param_t *parameters,
+          int is_constrained,
+          int is_circular));
+
+/**
+ *  @brief Compute minimum free energy and an appropriate secondary structure of an RNA sequence
+ *
+ *  This function essentially does the same thing as fold_par(). However, it takes its model details,
+ *  i.e. #temperature, #dangles, #tetra_loop, #noGU, #no_closingGU, #fold_constrained, #noLonelyPairs
+ *  from the current global settings within the library
+ *
+ *  @deprecated use vrna_fold(), or vrna_mfe() instead!
+ *
+ *  @see fold_par(), circfold()
+ *
+ *  @param sequence RNA sequence
+ *  @param structure A pointer to the character array where the
+ *         secondary structure in dot-bracket notation will be written to
+ *  @return the minimum free energy (MFE) in kcal/mol
+ */
+DEPRECATED(float fold( const char *sequence, char *structure));
+
+/**
+ *  @brief Compute minimum free energy and an appropriate secondary structure of a circular RNA sequence
+ *
+ *  This function essentially does the same thing as fold_par(). However, it takes its model details,
+ *  i.e. #temperature, #dangles, #tetra_loop, #noGU, #no_closingGU, #fold_constrained, #noLonelyPairs
+ *  from the current global settings within the library
+ *
+ *  @deprecated Use vrna_circfold(), or vrna_mfe() instead!
+ *
+ *  @see fold_par(), circfold()
+ *
+ *  @param sequence RNA sequence
+ *  @param structure A pointer to the character array where the
+ *         secondary structure in dot-bracket notation will be written to
+ *  @return the minimum free energy (MFE) in kcal/mol
+ */
+DEPRECATED(float circfold( const char *sequence, char *structure));
+
+
+/**
+ *  @brief Free arrays for mfe folding
+ *
+ *  @deprecated See vrna_fold(), vrna_circfold(), or vrna_mfe() and #vrna_fold_compound_t for the usage of the new API!
+ *
+ */
+DEPRECATED(void free_arrays(void));
+
+
+
+/**
+ *  @brief Recalculate energy parameters
+ *
+ *  @deprecated For non-default model settings use the new API with vrna_params_subst() and vrna_mfe() instead!
+ *
+ */
+DEPRECATED(void update_fold_params(void));
+
+/**
+ *  @brief Recalculate energy parameters
+ *
+ *  @deprecated For non-default model settings use the new API with vrna_params_subst() and vrna_mfe() instead!
+ *
+ */
+DEPRECATED(void update_fold_params_par(vrna_param_t *parameters));
+
+/**
+ *
+ *  @deprecated See vrna_mfe() and #vrna_fold_compound_t for the usage of the new API!
+ *
+ */
+DEPRECATED(void
+export_fold_arrays( int **f5_p,
+                    int **c_p,
+                    int **fML_p,
+                    int **fM1_p,
+                    int **indx_p,
+                    char **ptype_p));
+
+/**
+ *
+ *  @deprecated See vrna_mfe() and #vrna_fold_compound_t for the usage of the new API!
+ *
+ */
+DEPRECATED(void
+export_fold_arrays_par( int **f5_p,
+                        int **c_p,
+                        int **fML_p,
+                        int **fM1_p,
+                        int **indx_p,
+                        char **ptype_p,
+                        vrna_param_t **P_p));
+
+/**
+ *
+ *  @deprecated See vrna_mfe() and #vrna_fold_compound_t for the usage of the new API!
+ *
+ */
+DEPRECATED(void
+export_circfold_arrays( int *Fc_p,
+                        int *FcH_p,
+                        int *FcI_p,
+                        int *FcM_p,
+                        int **fM2_p,
+                        int **f5_p,
+                        int **c_p,
+                        int **fML_p,
+                        int **fM1_p,
+                        int **indx_p,
+                        char **ptype_p));
+
+/**
+ *
+ *  @deprecated See vrna_mfe() and #vrna_fold_compound_t for the usage of the new API!
+ *
+ */
+DEPRECATED(void
+export_circfold_arrays_par( int *Fc_p,
+                            int *FcH_p,
+                            int *FcI_p,
+                            int *FcM_p,
+                            int **fM2_p,
+                            int **f5_p,
+                            int **c_p,
+                            int **fML_p,
+                            int **fM1_p,
+                            int **indx_p,
+                            char **ptype_p,
+                            vrna_param_t **P_p));
+
+
+
+/* finally moved the loop energy function declarations to this header...  */
+/* BUT: The functions only exist for backward compatibility reasons!      */
+/* You better include "loop_energies.h" and call the functions:           */
+/* E_Hairpin() and E_IntLoop() which are (almost) threadsafe as they get  */
+/* a pointer to the energy parameter data structure as additional argument */
+
+/**
+ *  @deprecated {This function is deprecated and will be removed soon.
+ *  Use @ref E_IntLoop() instead!}
+ */
+DEPRECATED(int LoopEnergy(int n1,
+                          int n2,
+                          int type,
+                          int type_2,
+                          int si1,
+                          int sj1,
+                          int sp1,
+                          int sq1));
+
+/**
+ *  @deprecated {This function is deprecated and will be removed soon.
+ *  Use @ref E_Hairpin() instead!}
+ */
+DEPRECATED(int HairpinE(int size,
+                        int type,
+                        int si1,
+                        int sj1,
+                        const char *string));
+
+/**
+ *  Allocate arrays for folding\n
+ *  @deprecated See vrna_mfe() and #vrna_fold_compound_t for the usage of the new API!
+ *
+ */
+DEPRECATED(void initialize_fold(int length));
+
+/**
+ *
+ */
+DEPRECATED(char *backtrack_fold_from_pair(char *sequence,
+                                          int i,
+                                          int j));
+
+
+#endif
+
+/**
+ *  @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/fold_vars.h b/C/ViennaRNA/fold_vars.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/fold_vars.h
@@ -0,0 +1,93 @@
+#ifndef VIENNA_RNA_PACKAGE_FOLD_VARS_H
+#define VIENNA_RNA_PACKAGE_FOLD_VARS_H
+
+#include <ViennaRNA/data_structures.h>
+/*  For now, we include model.h by default to provide backwards compatibility
+    However, this will most likely change, since fold_vars.h is scheduled to
+    vanish from the sources at latest in ViennaRNA Package v3
+*/
+#include <ViennaRNA/model.h>
+
+
+/**
+ *  \file fold_vars.h
+ *  \brief Here all all declarations of the global variables used throughout RNAlib
+ */
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  \brief Global switch to activate/deactivate folding with structure constraints
+ */
+extern int    fold_constrained;
+
+/**
+ *  \brief generate comma seperated output
+ */
+extern int  csv;
+
+/**
+ *  warning this variable will vanish in the future
+ *  ribosums will be compiled in instead
+ */
+extern char *RibosumFile;   
+
+/**
+ *  interior loops of size 2 get energy 0.8Kcal and
+ *  no mismatches, default 1
+ */
+extern int  james_rule;
+
+/**
+ *  use logarithmic multiloop energy function
+ */
+extern int  logML;
+
+/**
+ *  \brief Marks the position (starting from 1) of the first
+ *  nucleotide of the second molecule within the concatenated sequence.
+ * 
+ *  To evaluate the energy of a duplex structure (a structure formed by two
+ *  strands), concatenate the to sequences and set it to the
+ *  first base of the second strand in the concatenated sequence.
+ *  The default value of -1 stands for single molecule folding. The
+ *  cut_point variable is also used by vrna_file_PS_rnaplot() and
+ *  PS_dot_plot() to mark the chain break in postscript plots.
+ */
+extern int  cut_point;
+
+/**
+ *  \brief Contains a list of base pairs after a call to fold().
+ * 
+ *  base_pair[0].i contains the total number of pairs.
+ *  \deprecated Do not use this variable anymore!
+ */
+extern bondT  *base_pair;
+
+/**
+ *  \brief A pointer to the base pair probability matrix
+ * 
+ *  \deprecated Do not use this variable anymore!
+ */
+extern FLT_OR_DBL *pr;
+
+/**
+ *  \brief index array to move through pr.
+ * 
+ *  The probability for base i and j to form a pair is in pr[iindx[i]-j].
+ *  \deprecated Do not use this variable anymore!
+ */
+extern int   *iindx;
+
+
+
+
+#endif
diff --git a/C/ViennaRNA/gquad.c b/C/ViennaRNA/gquad.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/gquad.c
@@ -0,0 +1,1086 @@
+/*
+  gquad.c
+
+  Ronny Lorenz 2012
+
+  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+#include "fold_vars.h"
+#include "data_structures.h"
+#include "energy_const.h"
+#include "utils.h"
+#include "aln_util.h"
+#include "gquad.h"
+
+#ifndef INLINE
+#ifdef __GNUC__
+# define INLINE inline
+#else
+# define INLINE
+#endif
+#endif
+
+/**
+ *  Use this macro to loop over each G-quadruplex
+ *  delimited by a and b within the subsequence [c,d]
+ */
+#define FOR_EACH_GQUAD(a, b, c, d)  \
+          for((a) = (d) - VRNA_GQUAD_MIN_BOX_SIZE + 1; (a) >= (c); (a)--)\
+            for((b) = (a) + VRNA_GQUAD_MIN_BOX_SIZE - 1;\
+                (b) <= MIN2((d), (a) + VRNA_GQUAD_MAX_BOX_SIZE - 1);\
+                (b)++)
+
+/**
+ *  This macro does almost the same as FOR_EACH_GQUAD() but keeps
+ *  the 5' delimiter fixed. 'b' is the 3' delimiter of the gquad,
+ *  for gquads within subsequence [a,c] that have 5' delimiter 'a'
+ */
+#define FOR_EACH_GQUAD_AT(a, b, c)  \
+          for((b) = (a) + VRNA_GQUAD_MIN_BOX_SIZE - 1;\
+              (b) <= MIN2((c), (a) + VRNA_GQUAD_MAX_BOX_SIZE - 1);\
+              (b)++)
+
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+PRIVATE INLINE
+int *
+get_g_islands(short *S);
+
+PRIVATE INLINE
+int *
+get_g_islands_sub(short *S, int i, int j);
+
+/**
+ *  IMPORTANT:
+ *  If you don't know how to use this function, DONT'T USE IT!
+ *
+ *  The function pointer this function takes as argument is
+ *  used for individual calculations with each g-quadruplex
+ *  delimited by [i,j].
+ *  The function it points to always receives as first 3 arguments
+ *  position i, the stack size L and an array l[3] containing the
+ *  individual linker sizes.
+ *  The remaining 4 (void *) pointers of the callback function receive
+ *  the parameters 'data', 'P', 'aux1' and 'aux2' and thus may be
+ *  used to pass whatever data you like to.
+ *  As the names of those parameters suggest the convention is that
+ *  'data' should be used as a pointer where data is stored into,
+ *  e.g the MFE or PF and the 'P' parameter should actually be a
+ *  'vrna_param_t *' or 'vrna_exp_param_t *' type.
+ *  However, what you actually pass obviously depends on the
+ *  function the pointer is pointing to.
+ *
+ *  Although all of this may look like an overkill, it is found
+ *  to be almost as fast as implementing g-quadruplex enumeration
+ *  in each individual scenario, i.e. code duplication.
+ *  Using this function, however, ensures that all g-quadruplex
+ *  enumerations are absolutely identical.
+ */
+PRIVATE
+void
+process_gquad_enumeration(int *gg,
+                          int i,
+                          int j,
+                          void (*f)(int, int, int *,
+                                    void *, void *, void *, void *),
+                          void *data,
+                          void *P,
+                          void *aux1,
+                          void *aux2);
+
+/**
+ *  MFE callback for process_gquad_enumeration()
+ */
+PRIVATE
+void
+gquad_mfe(int i,
+          int L,
+          int *l,
+          void *data,
+          void *P,
+          void *NA,
+          void *NA2);
+
+PRIVATE
+void
+gquad_mfe_pos(int i,
+              int L,
+              int *l,
+              void *data,
+              void *P,
+              void *Lmfe,
+              void *lmfe);
+
+PRIVATE
+void
+gquad_pos_exhaustive( int i,
+                      int L,
+                      int *l,
+                      void *data,
+                      void *P,
+                      void *Lex,
+                      void *lex);
+
+/**
+ * Partition function callback for process_gquad_enumeration()
+ */
+PRIVATE
+void
+gquad_pf( int i,
+          int L,
+          int *l,
+          void *data,
+          void *P,
+          void *NA,
+          void *NA2);
+
+/**
+ * Partition function callback for process_gquad_enumeration()
+ * in contrast to gquad_pf() it stores the stack size L and
+ * the linker lengths l[3] of the g-quadruplex that dominates
+ * the interval [i,j]
+ * (FLT_OR_DBL *)data must be 0. on entry
+ */
+PRIVATE
+void
+gquad_pf_pos( int i,
+              int L,
+              int *l,
+              void *data,
+              void *pf,
+              void *Lmax,
+              void *lmax);
+
+/**
+ * MFE (alifold) callback for process_gquad_enumeration()
+ */
+PRIVATE
+void
+gquad_mfe_ali(int i,
+              int L,
+              int *l,
+              void *data,
+              void *P,
+              void *S,
+              void *n_seq);
+
+/**
+ * MFE (alifold) callback for process_gquad_enumeration()
+ * with seperation of free energy and penalty contribution
+ */
+PRIVATE
+void
+gquad_mfe_ali_en( int i,
+                  int L,
+                  int *l,
+                  void *data,
+                  void *P,
+                  void *S,
+                  void *n_seq);
+
+PRIVATE
+void
+gquad_interact( int i,
+                int L,
+                int *l,
+                void *data,
+                void *pf,
+                void *index,
+                void *NA2);
+
+PRIVATE
+void
+gquad_count(int i,
+            int L,
+            int *l,
+            void *data,
+            void *NA,
+            void *NA2,
+            void *NA3);
+
+PRIVATE
+void
+gquad_count_layers( int i,
+                    int L,
+                    int *l,
+                    void *data,
+                    void *NA,
+                    void *NA2,
+                    void *NA3);
+
+/* other useful static functions */
+
+PRIVATE
+int
+gquad_ali_penalty(int i,
+                  int L,
+                  int l[3],
+                  const short **S,
+                  vrna_param_t *P);
+
+PRIVATE int **
+create_L_matrix(short *S,
+                int start,
+                int maxdist,
+                int n,
+                int **g,
+                vrna_param_t *P);
+
+/*
+#########################################
+# BEGIN OF PUBLIC FUNCTION DEFINITIONS  #
+#      (all available in RNAlib)        #
+#########################################
+*/
+
+/********************************
+  Here are the G-quadruplex energy
+  contribution functions
+*********************************/
+
+PUBLIC int E_gquad( int L,
+                    int l[3],
+                    vrna_param_t *P){
+
+  int i, c = INF;
+
+  for(i=0;i<3;i++){
+    if(l[i] > VRNA_GQUAD_MAX_LINKER_LENGTH) return c;
+    if(l[i] < VRNA_GQUAD_MIN_LINKER_LENGTH) return c;
+  }
+  if(L > VRNA_GQUAD_MAX_STACK_SIZE) return c;
+  if(L < VRNA_GQUAD_MIN_STACK_SIZE) return c;
+  
+  gquad_mfe(0, L, l,
+            (void *)(&c),
+            (void *)P,
+            NULL,
+            NULL);
+  return c;
+}
+
+PUBLIC FLT_OR_DBL exp_E_gquad(int L,
+                              int l[3],
+                              vrna_exp_param_t *pf){
+
+  int i;
+  FLT_OR_DBL q = 0.;
+
+  for(i=0;i<3;i++){
+    if(l[i] > VRNA_GQUAD_MAX_LINKER_LENGTH) return q;
+    if(l[i] < VRNA_GQUAD_MIN_LINKER_LENGTH) return q;
+  }
+  if(L > VRNA_GQUAD_MAX_STACK_SIZE) return q;
+  if(L < VRNA_GQUAD_MIN_STACK_SIZE) return q;
+
+  gquad_pf( 0, L, l,
+            (void *)(&q),
+            (void *)pf,
+            NULL,
+            NULL);
+  return q;
+}
+
+PUBLIC int E_gquad_ali( int i,
+                        int L,
+                        int l[3],
+                        const short **S,
+                        int n_seq,
+                        vrna_param_t *P){
+
+  int en[2];
+  E_gquad_ali_en(i, L, l, S, n_seq, en, P);
+  return en[0] + en[1];
+}
+
+
+PUBLIC void E_gquad_ali_en( int i,
+                            int L,
+                            int l[3],
+                            const short **S,
+                            int n_seq,
+                            int en[2],
+                            vrna_param_t *P){
+
+  int j;
+  en[0] = en[1] = INF;
+
+  for(j=0;j<3;j++){
+    if(l[j] > VRNA_GQUAD_MAX_LINKER_LENGTH) return;
+    if(l[j] < VRNA_GQUAD_MIN_LINKER_LENGTH) return;
+  }
+  if(L > VRNA_GQUAD_MAX_STACK_SIZE) return;
+  if(L < VRNA_GQUAD_MIN_STACK_SIZE) return;
+
+  gquad_mfe_ali_en( i, L, l,
+                    (void *)(&(en[0])),
+                    (void *)P,
+                    (void *)S,
+                    (void *)(&n_seq));
+}
+
+/********************************
+  Now, the triangular matrix
+  generators for the G-quadruplex
+  contributions are following
+*********************************/
+
+PUBLIC int *get_gquad_matrix(short *S, vrna_param_t *P){
+
+  int n, size, i, j, *gg, *my_index, *data;
+
+  n         = S[0];
+  my_index  = vrna_idx_col_wise(n);
+  gg        = get_g_islands(S);
+  size      = (n * (n+1))/2 + 2;
+  data      = (int *)vrna_alloc(sizeof(int) * size);
+
+  /* prefill the upper triangular matrix with INF */
+  for(i = 0; i < size; i++) data[i] = INF;
+
+  FOR_EACH_GQUAD(i, j, 1, n){
+    process_gquad_enumeration(gg, i, j,
+                              &gquad_mfe,
+                              (void *)(&(data[my_index[j]+i])),
+                              (void *)P,
+                              NULL,
+                              NULL);
+  }
+
+  free(my_index);
+  free(gg);
+  return data;
+}
+
+PUBLIC FLT_OR_DBL *get_gquad_pf_matrix( short *S,
+                                        FLT_OR_DBL *scale,
+                                        vrna_exp_param_t *pf){
+
+  int n, size, *gg, i, j, *my_index;
+  FLT_OR_DBL *data;
+
+
+  n         = S[0];
+  size      = (n * (n+1))/2 + 2;
+  data      = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * size);
+  gg        = get_g_islands(S);
+  my_index  = vrna_idx_row_wise(n);
+
+  FOR_EACH_GQUAD(i, j, 1, n){
+    process_gquad_enumeration(gg, i, j,
+                              &gquad_pf,
+                              (void *)(&(data[my_index[i]-j])),
+                              (void *)pf,
+                              NULL,
+                              NULL);
+    data[my_index[i]-j] *= scale[j-i+1];
+  }
+
+  free(my_index);
+  free(gg);
+  return data;
+}
+
+PUBLIC int *get_gquad_ali_matrix( short *S_cons,
+                                  short **S,
+                                  int n_seq,
+                                  vrna_param_t *P){
+
+  int n, size, *data, *gg;
+  int i, j, *my_index;
+
+
+  n         = S[0][0];
+  size      = (n * (n+1))/2 + 2;
+  data      = (int *)vrna_alloc(sizeof(int) * size);
+  gg        = get_g_islands(S_cons);
+  my_index  = vrna_idx_col_wise(n);
+
+  /* prefill the upper triangular matrix with INF */
+  for(i=0;i<size;i++) data[i] = INF;
+
+  FOR_EACH_GQUAD(i, j, 1, n){
+    process_gquad_enumeration(gg, i, j,
+                              &gquad_mfe_ali,
+                              (void *)(&(data[my_index[j]+i])),
+                              (void *)P,
+                              (void *)S,
+                              (void *)(&n_seq));
+  }
+
+  free(my_index);
+  free(gg);
+  return data;
+}
+
+PUBLIC int **get_gquad_L_matrix(short *S,
+                                int start,
+                                int maxdist,
+                                int n,
+                                int **g,
+                                vrna_param_t *P){
+
+  return create_L_matrix(S, start, maxdist, n, g, P);
+}
+
+PUBLIC void
+vrna_gquad_mx_local_update( vrna_fold_compound_t *vc,
+                            int start){
+
+  vc->matrices->ggg_local = create_L_matrix(
+                              vc->sequence_encoding,
+                              start,
+                              vc->window_size,
+                              vc->length,
+                              vc->matrices->ggg_local,
+                              vc->params);
+}
+
+PRIVATE int **
+create_L_matrix(short *S,
+                int start,
+                int maxdist,
+                int n,
+                int **g,
+                vrna_param_t *P){
+
+  int **data;
+  int i, j, k, *gg;
+
+  gg  = get_g_islands_sub(S, start, MIN2(n, start + maxdist + 4));
+
+  if(g){ /* we just update the gquadruplex contribution for the current
+            start and rotate the rest */
+    data = g;
+    /* we re-use the memory allocated previously */
+    data[start] = data[start + maxdist + 5];
+    data[start + maxdist + 5] = NULL;
+
+    /* prefill with INF */
+    for(i = 0; i < maxdist + 5; i++)
+      data[start][i] = INF;
+
+    /*  now we compute contributions for all gquads with 5' delimiter at
+        position 'start'
+    */
+    FOR_EACH_GQUAD_AT(start, j, start + maxdist + 4){
+      process_gquad_enumeration(gg, start, j,
+                                &gquad_mfe,
+                                (void *)(&(data[start][j-start])),
+                                (void *)P,
+                                NULL,
+                                NULL);
+    }
+
+  } else { /* create a new matrix from scratch since this is the first
+              call to this function */
+
+    /* allocate memory and prefill with INF */
+    data = (int **) vrna_alloc(sizeof(int *) * (n+1));
+    for(k = n; (k>n-maxdist-5) && (k>=0); k--){
+      data[k] = (int *) vrna_alloc(sizeof(int)*(maxdist+5));
+      for(i = 0; i < maxdist+5; i++) data[k][i] = INF;
+    }
+    
+    /* compute all contributions for the gquads in this interval */
+    FOR_EACH_GQUAD(i, j, n - maxdist - 4, n){
+      process_gquad_enumeration(gg, i, j,
+                                &gquad_mfe,
+                                (void *)(&(data[i][j-i])),
+                                (void *)P,
+                                NULL,
+                                NULL);
+    }
+  }
+
+  gg += start - 1;
+  free(gg);
+  return data;
+}
+
+PUBLIC plist *get_plist_gquad_from_db(const char *structure, float pr){
+  int x, size, actual_size, L, n, ge, ee, gb, l[3];
+  plist *pl;
+
+  actual_size = 0;
+  ge          = 0;
+  n           = 2;
+  size        = strlen(structure);
+  pl          = (plist *)vrna_alloc(n*size*sizeof(plist));
+
+  while((ee = parse_gquad(structure + ge, &L, l)) > 0){
+    ge += ee;
+    gb = ge - L*4 - l[0] - l[1] - l[2] + 1;
+    /* add pseudo-base pair encloding gquad */
+    for(x = 0; x < L; x++){
+      if (actual_size >= n * size - 5){
+        n *= 2;
+        pl = (plist *)vrna_realloc(pl, n * size * sizeof(plist));
+      }
+      pl[actual_size].i = gb + x;
+      pl[actual_size].j = ge + x - L + 1;
+      pl[actual_size].p = pr;
+      pl[actual_size++].type = 0;
+
+      pl[actual_size].i = gb + x;
+      pl[actual_size].j = gb + x + l[0] + L;
+      pl[actual_size].p = pr;
+      pl[actual_size++].type = 0;
+
+      pl[actual_size].i = gb + x + l[0] + L;
+      pl[actual_size].j = ge + x - 2*L - l[2] + 1;
+      pl[actual_size].p = pr;
+      pl[actual_size++].type = 0;
+
+      pl[actual_size].i = ge + x - 2*L - l[2] + 1;
+      pl[actual_size].j = ge + x - L + 1;
+      pl[actual_size].p = pr;
+      pl[actual_size++].type = 0;
+    }
+  } 
+
+  pl[actual_size].i = pl[actual_size].j = 0;
+  pl[actual_size++].p = 0;
+  pl = (plist *)vrna_realloc(pl, actual_size * sizeof(plist));
+  return pl;
+}
+
+PUBLIC void get_gquad_pattern_mfe(short *S,
+                                  int i,
+                                  int j,
+                                  vrna_param_t *P,
+                                  int *L,
+                                  int l[3]){
+
+  int *gg = get_g_islands_sub(S, i, j);
+  int c = INF;
+
+  process_gquad_enumeration(gg, i, j,
+                            &gquad_mfe_pos,
+                            (void *)(&c),
+                            (void *)P,
+                            (void *)L,
+                            (void *)l);
+
+  gg += i - 1;
+  free(gg);
+}
+
+PUBLIC void
+get_gquad_pattern_exhaustive( short *S,
+                              int i,
+                              int j,
+                              vrna_param_t *P,
+                              int *L,
+                              int *l,
+                              int threshold){
+
+  int *gg = get_g_islands_sub(S, i, j);
+
+  process_gquad_enumeration(gg, i, j,
+                            &gquad_pos_exhaustive,
+                            (void *)(&threshold),
+                            (void *)P,
+                            (void *)L,
+                            (void *)l);
+
+  gg += i - 1;
+  free(gg);
+}
+
+PUBLIC void get_gquad_pattern_pf( short *S,
+                                  int i,
+                                  int j,
+                                  vrna_exp_param_t *pf,
+                                  int *L,
+                                  int l[3]){
+
+  int *gg = get_g_islands_sub(S, i, j);
+  FLT_OR_DBL q = 0.;
+
+  process_gquad_enumeration(gg, i, j,
+                            &gquad_pf_pos,
+                            (void *)(&q),
+                            (void *)pf,
+                            (void *)L,
+                            (void *)l);
+
+  gg += i - 1;
+  free(gg);
+}
+
+PUBLIC plist *get_plist_gquad_from_pr(short *S,
+                                      int gi,
+                                      int gj,
+                                      FLT_OR_DBL *G,
+                                      FLT_OR_DBL *probs,
+                                      FLT_OR_DBL *scale,
+                                      vrna_exp_param_t *pf){
+
+  int L, l[3];
+  return  get_plist_gquad_from_pr_max(S, gi, gj, G, probs, scale, &L, l, pf);
+}
+
+
+PUBLIC plist *get_plist_gquad_from_pr_max(short *S,
+                                      int gi,
+                                      int gj,
+                                      FLT_OR_DBL *G,
+                                      FLT_OR_DBL *probs,
+                                      FLT_OR_DBL *scale,
+                                      int *Lmax,
+                                      int lmax[3],
+                                      vrna_exp_param_t *pf){ 
+
+  int n, size, *gg, counter, i, j, *my_index;
+  FLT_OR_DBL pp, *tempprobs;
+  plist *pl;
+  
+  n         = S[0];
+  size      = (n * (n + 1))/2 + 2;
+  tempprobs = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * size);
+  pl        = (plist *)vrna_alloc((S[0]*S[0])*sizeof(plist));
+  gg        = get_g_islands_sub(S, gi, gj);
+  counter   = 0;
+  my_index  = vrna_idx_row_wise(n);
+
+  process_gquad_enumeration(gg, gi, gj,
+                            &gquad_interact,
+                            (void *)tempprobs,
+                            (void *)pf,
+                            (void *)my_index,
+                            NULL);
+
+  pp = 0.;
+  process_gquad_enumeration(gg, gi, gj,
+                            &gquad_pf_pos,
+                            (void *)(&pp),
+                            (void *)pf,
+                            (void *)Lmax,
+                            (void *)lmax);
+
+  pp = probs[my_index[gi]-gj] * scale[gj-gi+1] / G[my_index[gi]-gj];
+  for (i=gi;i<gj; i++) {
+    for (j=i; j<=gj; j++) {
+      if (tempprobs[my_index[i]-j]>0.) {
+        pl[counter].i=i;
+        pl[counter].j=j;
+        pl[counter++].p = pp * tempprobs[my_index[i]-j];
+      }
+    }
+  }
+  pl[counter].i = pl[counter].j = 0;
+  pl[counter++].p = 0.;
+  /* shrink memory to actual size needed */
+  pl = (plist *) vrna_realloc(pl, counter * sizeof(plist));
+
+  gg += gi - 1; free(gg);
+  free(my_index);
+  free (tempprobs);
+  return pl;
+}
+
+PUBLIC int
+get_gquad_count(short *S,
+                int i,
+                int j){
+
+  int *gg     = get_g_islands_sub(S, i, j);
+  int p,q,counter = 0;
+
+  FOR_EACH_GQUAD(p, q, i, j)
+    process_gquad_enumeration(gg, p, q,
+                              &gquad_count,
+                              (void *)(&counter),
+                              NULL,
+                              NULL,
+                              NULL);
+
+  gg += i - 1;
+  free(gg);
+  return counter;
+}
+
+PUBLIC int
+get_gquad_layer_count(short *S,
+                      int i,
+                      int j){
+
+  int *gg     = get_g_islands_sub(S, i, j);
+  int p,q,counter = 0;
+
+  FOR_EACH_GQUAD(p, q, i, j)
+    process_gquad_enumeration(gg, p, q,
+                              &gquad_count_layers,
+                              (void *)(&counter),
+                              NULL,
+                              NULL,
+                              NULL);
+
+  gg += i - 1;
+  free(gg);
+  return counter;
+}
+
+PUBLIC int parse_gquad(const char *struc, int *L, int l[3]) {
+  int i, il, start, end, len;
+
+  for (i=0; struc[i] && struc[i]!='+'; i++);
+  if (struc[i] == '+') { /* start of gquad */
+    for (il=0; il<=3; il++) {
+      start=i; /* pos of first '+' */
+      while (struc[++i] == '+'){
+        if((il) && (i-start == *L))
+          break;
+      }
+      end=i; len=end-start; 
+      if (il==0) *L=len;
+      else if (len!=*L)
+        vrna_message_error("unequal stack lengths in gquad");
+      if (il==3) break;
+      while (struc[++i] == '.'); /* linker */
+      l[il] = i-end;
+      if (struc[i] != '+')
+        vrna_message_error("illegal character in gquad linker region");
+    }
+  }
+  else return 0;
+  /* printf("gquad at %d %d %d %d %d\n", end, *L, l[0], l[1], l[2]); */
+  return end;
+}
+
+
+
+/*
+#########################################
+# BEGIN OF PRIVATE FUNCTION DEFINITIONS #
+#          (internal use only)          #
+#########################################
+*/
+
+PRIVATE int gquad_ali_penalty(int i,
+                              int L,
+                              int l[3],
+                              const short **S,
+                              vrna_param_t *P){
+
+  int s, cnt;
+  int penalty     = 0;
+  int gg_mismatch = 0;
+
+  /* check for compatibility in the alignment */
+  for(s = 0; S[s]; s++){
+    unsigned int  ld  = 0; /* !=0 if layer destruction was detected */
+    int           pen = 0;
+
+    /* check bottom layer */
+    if(S[s][i] != 3)                            ld |= 1U;
+    if(S[s][i + L + l[0]] != 3)                 ld |= 2U;
+    if(S[s][i + 2*L + l[0] + l[1]] != 3)        ld |= 4U;
+    if(S[s][i + 3*L + l[0] + l[1] + l[2]] != 3) ld |= 8U;
+     /* add 1x penalty for missing bottom layer */
+    if(ld) pen += VRNA_GQUAD_MISMATCH_PENALTY;
+
+    /* check top layer */
+    ld = 0;
+    if(S[s][i + L - 1] != 3)                        ld |= 1U;
+    if(S[s][i + 2*L + l[0] - 1] != 3)               ld |= 2U;
+    if(S[s][i + 3*L + l[0] + l[1] - 1] != 3)        ld |= 4U;
+    if(S[s][i + 4*L + l[0] + l[1] + l[2] - 1] != 3) ld |= 8U;
+     /* add 1x penalty for missing top layer */
+    if(ld) pen += VRNA_GQUAD_MISMATCH_PENALTY;
+
+    /* check inner layers */
+    for(cnt=1;cnt<L-1;cnt++){
+      if(S[s][i + cnt] != 3)                            ld |= 1U;
+      if(S[s][i + L + l[0] + cnt] != 3)                 ld |= 2U;
+      if(S[s][i + 2*L + l[0] + l[1] + cnt] != 3)        ld |= 4U;
+      if(S[s][i + 3*L + l[0] + l[1] + l[2] + cnt] != 3) ld |= 8U;
+      /* add 2x penalty for missing inner layer */
+      if(ld) pen += 2*VRNA_GQUAD_MISMATCH_PENALTY;
+    }
+
+    /* if all layers are missing, we have a complete gg mismatch */
+    if(pen >= (2*VRNA_GQUAD_MISMATCH_PENALTY * (L-1)))
+      gg_mismatch++;
+
+    /* add the penalty to the score */
+    penalty += pen;
+  }
+  /* if gg_mismatch exceeds maximum allowed, this g-quadruplex is forbidden */
+  if(gg_mismatch > VRNA_GQUAD_MISMATCH_NUM_ALI) return INF;
+  else return penalty;
+}
+
+
+PRIVATE void gquad_mfe( int i,
+                        int L,
+                        int *l,
+                        void *data,
+                        void *P,
+                        void *NA,
+                        void *NA2){
+
+  int cc = ((vrna_param_t *)P)->gquad[L][l[0] + l[1] + l[2]];
+  if(cc < *((int *)data))
+    *((int *)data) = cc;
+}
+
+PRIVATE void gquad_mfe_pos( int i,
+                            int L,
+                            int *l,
+                            void *data,
+                            void *P,
+                            void *Lmfe,
+                            void *lmfe){
+
+  int cc = ((vrna_param_t *)P)->gquad[L][l[0] + l[1] + l[2]];
+  if(cc < *((int *)data)){
+    *((int *)data)        = cc;
+    *((int *)Lmfe)        = L;
+    *((int *)lmfe)        = l[0];
+    *(((int *)lmfe) + 1)  = l[1];
+    *(((int *)lmfe) + 2)  = l[2];
+  }
+}
+
+PRIVATE
+void
+gquad_pos_exhaustive( int i,
+                      int L,
+                      int *l,
+                      void *data,
+                      void *P,
+                      void *Lex,
+                      void *lex){
+
+  int cnt;
+  int cc = ((vrna_param_t *)P)->gquad[L][l[0] + l[1] + l[2]];
+  if(cc <= *((int *)data)){
+    /*  since Lex is an array of L values and lex an
+        array of l triples we need to find out where
+        the current gquad position is to be stored...
+		the below implementation might be slow but we
+		still use it for now
+    */
+    for(cnt = 0; ((int *)Lex)[cnt] != -1; cnt++);
+
+    *((int *)Lex + cnt)           = L;
+    *((int *)Lex + cnt + 1)       = -1;
+    *(((int *)lex) + (3*cnt) + 0) = l[0];
+    *(((int *)lex) + (3*cnt) + 1) = l[1];
+    *(((int *)lex) + (3*cnt) + 2) = l[2];
+  }
+}
+
+PRIVATE
+void
+gquad_count(int i,
+            int L,
+            int *l,
+            void *data,
+            void *NA,
+            void *NA2,
+            void *NA3){
+
+  *((int *)data) += 1;
+}
+
+PRIVATE
+void
+gquad_count_layers( int i,
+                    int L,
+                    int *l,
+                    void *data,
+                    void *NA,
+                    void *NA2,
+                    void *NA3){
+
+  *((int *)data) += L;
+}
+
+
+PRIVATE void gquad_pf(int i,
+                      int L,
+                      int *l,
+                      void *data,
+                      void *pf,
+                      void *NA,
+                      void *NA2){
+
+  *((FLT_OR_DBL *)data) += ((vrna_exp_param_t *)pf)->expgquad[L][l[0] + l[1] + l[2]];
+}
+
+PRIVATE void gquad_pf_pos(int i,
+                          int L,
+                          int *l,
+                          void *data,
+                          void *pf,
+                          void *Lmax,
+                          void *lmax){
+
+  FLT_OR_DBL gq = ((vrna_exp_param_t *)pf)->expgquad[L][l[0] + l[1] + l[2]];
+  if(gq > *((FLT_OR_DBL *)data)){
+    *((FLT_OR_DBL *)data) = gq;
+    *((int *)Lmax)        = L;
+    *((int *)lmax)        = l[0];
+    *(((int *)lmax) + 1)  = l[1];
+    *(((int *)lmax) + 2)  = l[2];
+  }
+}
+
+PRIVATE void gquad_mfe_ali( int i,
+                            int L,
+                            int *l,
+                            void *data,
+                            void *P,
+                            void *S,
+                            void *n_seq){
+
+  int j, en[2], cc;
+  en[0] = en[1] = INF;
+
+  for(j=0;j<3;j++){
+    if(l[j] > VRNA_GQUAD_MAX_LINKER_LENGTH) return;
+    if(l[j] < VRNA_GQUAD_MIN_LINKER_LENGTH) return;
+  }
+  if(L > VRNA_GQUAD_MAX_STACK_SIZE) return;
+  if(L < VRNA_GQUAD_MIN_STACK_SIZE) return;
+
+  gquad_mfe_ali_en(i, L, l, (void *)(&(en[0])), P, S, n_seq);
+  if(en[1] != INF){
+    cc  = en[0] + en[1];
+    if(cc < *((int *)data)) *((int *)data) = cc;
+  }
+}
+
+PRIVATE void gquad_mfe_ali_en(int i,
+                              int L,
+                              int *l,
+                              void *data,
+                              void *P,
+                              void *S,
+                              void *n_seq){
+
+  int en[2], cc, dd;
+  en[0] = ((vrna_param_t *)P)->gquad[L][l[0] + l[1] + l[2]] * (*(int *)n_seq);
+  en[1] = gquad_ali_penalty(i, L, l, (const short **)S, (vrna_param_t *)P);
+  if(en[1] != INF){
+    cc = en[0] + en[1];
+    dd = ((int *)data)[0] + ((int *)data)[1];
+    if(cc < dd){
+      ((int *)data)[0] = en[0];
+      ((int *)data)[1] = en[1];
+    }
+  }
+}
+
+PRIVATE void gquad_interact(int i,
+                      int L,
+                      int *l,
+                      void *data,
+                      void *pf,
+                      void *index,
+                      void *NA2){
+
+  int x, *idx;
+  FLT_OR_DBL gq, *pp;
+
+  idx = (int *)index;
+  pp  = (FLT_OR_DBL *)data;
+  gq  = exp_E_gquad(L, l, (vrna_exp_param_t *)pf);
+
+  for(x = 0; x < L; x++){
+    pp[idx[i + x] - (i + x + 3*L + l[0] + l[1] + l[2])] += gq;
+    pp[idx[i + x] - (i + x + L + l[0])] += gq;
+    pp[idx[i + x + L + l[0]] - (i + x + 2*L + l[0] + l[1])] += gq;
+    pp[idx[i + x + 2*L + l[0] + l[1]] - (i + x + 3*L + l[0] + l[1] + l[2])] += gq;
+  }
+  
+}
+
+PRIVATE INLINE int *get_g_islands(short *S){
+  return get_g_islands_sub(S, 1, S[0]);
+}
+
+PRIVATE INLINE int *get_g_islands_sub(short *S, int i, int j){
+  int x, *gg;
+
+  gg = (int *)vrna_alloc(sizeof(int)*(j-i+2));
+  gg -= i - 1;
+
+  if(S[j]==3) gg[j] = 1;
+  for(x = j - 1; x >= i; x--)
+    if(S[x] == 3)
+      gg[x] = gg[x+1]+1;
+
+  return gg;
+}
+
+/**
+ *  We could've also created a macro that loops over all G-quadruplexes
+ *  delimited by i and j. However, for the fun of it we use this function
+ *  that receives a pointer to a callback function which in turn does the
+ *  actual computation for each quadruplex found.
+ */
+PRIVATE
+void
+process_gquad_enumeration(int *gg,
+                          int i,
+                          int j,
+                          void (*f)(int, int, int *,
+                                    void *, void *, void *, void *),
+                          void *data,
+                          void *P,
+                          void *aux1,
+                          void *aux2){
+
+  int L, l[3], n, max_linker, maxl0, maxl1;
+
+  n = j - i + 1;
+
+  if((n >= VRNA_GQUAD_MIN_BOX_SIZE) && (n <= VRNA_GQUAD_MAX_BOX_SIZE))
+    for(L = MIN2(gg[i], VRNA_GQUAD_MAX_STACK_SIZE);
+        L >= VRNA_GQUAD_MIN_STACK_SIZE;
+        L--)
+      if(gg[j-L+1] >= L){
+        max_linker = n-4*L;
+        if(     (max_linker >= 3*VRNA_GQUAD_MIN_LINKER_LENGTH)
+            &&  (max_linker <= 3*VRNA_GQUAD_MAX_LINKER_LENGTH)){
+          maxl0 = MIN2( VRNA_GQUAD_MAX_LINKER_LENGTH,
+                        max_linker - 2*VRNA_GQUAD_MIN_LINKER_LENGTH
+                      );
+          for(l[0] = VRNA_GQUAD_MIN_LINKER_LENGTH;
+              l[0] <= maxl0;
+              l[0]++)
+            if(gg[i+L+l[0]] >= L){
+              maxl1 = MIN2( VRNA_GQUAD_MAX_LINKER_LENGTH,
+                            max_linker - l[0] - VRNA_GQUAD_MIN_LINKER_LENGTH
+                          );
+              for(l[1] = VRNA_GQUAD_MIN_LINKER_LENGTH;
+                  l[1] <= maxl1;
+                  l[1]++)
+                if(gg[i + 2*L + l[0] + l[1]] >= L){
+                  l[2] = max_linker - l[0] - l[1];
+                  f(i, L, &(l[0]), data, P, aux1, aux2);
+                }
+            }
+        }
+      }
+}
+
diff --git a/C/ViennaRNA/gquad.h b/C/ViennaRNA/gquad.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/gquad.h
@@ -0,0 +1,906 @@
+#ifndef VIENNA_RNA_PACKAGE_GQUAD_H
+#define VIENNA_RNA_PACKAGE_GQUAD_H
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+
+#ifndef INLINE
+#ifdef __GNUC__
+# define INLINE inline
+#else
+# define INLINE
+#endif
+#endif
+
+/**
+ *  @file       gquad.h
+ *  @ingroup    paired_modules
+ *  @brief      G-quadruplexes
+ */
+
+/**
+ *  @addtogroup gquads
+ *  @brief Various functions related to G-quadruplex computations
+ *  @{
+ *  @ingroup gquads
+ */
+
+
+int         E_gquad(int L,
+                    int l[3],
+                    vrna_param_t *P);
+
+FLT_OR_DBL exp_E_gquad( int L,
+                        int l[3],
+                        vrna_exp_param_t *pf);
+
+int         E_gquad_ali(int i,
+                        int L,
+                        int l[3],
+                        const short **S,
+                        int n_seq,
+                        vrna_param_t *P);
+
+
+void        E_gquad_ali_en( int i,
+                            int L,
+                            int l[3],
+                            const short **S,
+                            int n_seq,
+                            int en[2],
+                            vrna_param_t *P);
+
+/**
+ *  @brief Get a triangular matrix prefilled with minimum free energy
+ *  contributions of G-quadruplexes.
+ *
+ *  At each position ij in the matrix, the minimum free energy of any
+ *  G-quadruplex delimited by i and j is stored. If no G-quadruplex formation
+ *  is possible, the matrix element is set to INF.
+ *  Access the elements in the matrix via matrix[indx[j]+i]. To get
+ *  the integer array indx see get_jindx().
+ *
+ *  @see get_jindx(), encode_sequence()
+ *
+ *  @param S  The encoded sequence
+ *  @param P  A pointer to the data structure containing the precomputed energy contributions
+ *  @return   A pointer to the G-quadruplex contribution matrix
+*/
+int         *get_gquad_matrix(short *S, vrna_param_t *P);
+
+int         *get_gquad_ali_matrix(short *S_cons,
+                                  short **S,
+                                  int n_seq,
+                                  vrna_param_t *P);
+
+FLT_OR_DBL  *get_gquad_pf_matrix( short *S,
+                                  FLT_OR_DBL *scale,
+                                  vrna_exp_param_t *pf);
+
+int         **get_gquad_L_matrix( short *S,
+                                  int start,
+                                  int maxdist,
+                                  int n,
+                                  int **g,
+                                  vrna_param_t *P);
+
+void        vrna_gquad_mx_local_update( vrna_fold_compound_t *vc,
+                                        int start);
+
+void        get_gquad_pattern_mfe(short *S,
+                                  int i,
+                                  int j,
+                                  vrna_param_t *P,
+                                  int *L,
+                                  int l[3]);
+
+void
+get_gquad_pattern_exhaustive( short *S,
+                              int i,
+                              int j,
+                              vrna_param_t *P,
+                              int *L,
+                              int *l,
+                              int threshold);
+
+void        get_gquad_pattern_pf( short *S,
+                                  int i,
+                                  int j,
+                                  vrna_exp_param_t *pf,
+                                  int *L,
+                                  int l[3]);
+
+plist       *get_plist_gquad_from_pr( short *S,
+                                      int gi,
+                                      int gj,
+                                      FLT_OR_DBL *G,
+                                      FLT_OR_DBL *probs,
+                                      FLT_OR_DBL *scale,
+                                      vrna_exp_param_t *pf);
+plist       *get_plist_gquad_from_pr_max(short *S,
+                                      int gi,
+                                      int gj,
+                                      FLT_OR_DBL *G,
+                                      FLT_OR_DBL *probs,
+                                      FLT_OR_DBL *scale,
+                                      int *L,
+                                      int l[3],
+                                      vrna_exp_param_t *pf);
+
+plist       *get_plist_gquad_from_db( const char *structure,
+                                      float pr);
+
+int         get_gquad_count(short *S,
+                            int i,
+                            int j);
+
+int         get_gquad_layer_count(short *S,
+                            int i,
+                            int j);
+
+
+/**
+ *  given a dot-bracket structure (possibly) containing gquads encoded
+ *  by '+' signs, find first gquad, return end position or 0 if none found
+ *  Upon return L and l[] contain the number of stacked layers, as well as
+ *  the lengths of the linker regions.  
+ *  To parse a string with many gquads, call parse_gquad repeatedly e.g.
+ *  end1 = parse_gquad(struc, &L, l); ... ;
+ *  end2 = parse_gquad(struc+end1, &L, l); end2+=end1; ... ;
+ *  end3 = parse_gquad(struc+end2, &L, l); end3+=end2; ... ; 
+ */
+int         parse_gquad(const char *struc, int *L, int l[3]);
+
+INLINE  PRIVATE int backtrack_GQuad_IntLoop(int c,
+                                            int i,
+                                            int j,
+                                            int type,
+                                            short *S,
+                                            int *ggg,
+                                            int *index,
+                                            int *p,
+                                            int *q,
+                                            vrna_param_t *P);
+
+INLINE  PRIVATE int backtrack_GQuad_IntLoop_L(int c,
+                                              int i,
+                                              int j,
+                                              int type,
+                                              short *S,
+                                              int **ggg,
+                                              int maxdist,
+                                              int *p,
+                                              int *q,
+                                              vrna_param_t *P);
+
+PRIVATE INLINE int
+vrna_BT_gquad_mfe(vrna_fold_compound_t *vc,
+                  int i,
+                  int j,
+                  vrna_bp_stack_t *bp_stack,
+                  int *stack_count);
+
+PRIVATE INLINE int
+vrna_BT_gquad_int(vrna_fold_compound_t *vc,
+                  int i,
+                  int j,
+                  int en,
+                  vrna_bp_stack_t *bp_stack,
+                  int *stack_count);
+
+PRIVATE INLINE int
+vrna_BT_gquad_mfe(vrna_fold_compound_t *vc,
+                  int i,
+                  int j,
+                  vrna_bp_stack_t *bp_stack,
+                  int *stack_count){
+
+  /*
+    here we do some fancy stuff to backtrace the stacksize and linker lengths
+    of the g-quadruplex that should reside within position i,j
+  */
+  short         *S;
+  int           l[3], L, a;
+  vrna_param_t  *P;
+
+  P = vc->params;
+  S = vc->sequence_encoding2;
+  L = -1;
+
+  get_gquad_pattern_mfe(S, i, j, P, &L, l);
+
+  if(L != -1){
+    /* fill the G's of the quadruplex into base_pair2 */
+    for(a=0;a<L;a++){
+      bp_stack[++(*stack_count)].i = i+a;
+      bp_stack[(*stack_count)].j   = i+a;
+      bp_stack[++(*stack_count)].i = i+L+l[0]+a;
+      bp_stack[(*stack_count)].j   = i+L+l[0]+a;
+      bp_stack[++(*stack_count)].i = i+L+l[0]+L+l[1]+a;
+      bp_stack[(*stack_count)].j   = i+L+l[0]+L+l[1]+a;
+      bp_stack[++(*stack_count)].i = i+L+l[0]+L+l[1]+L+l[2]+a;
+      bp_stack[(*stack_count)].j   = i+L+l[0]+L+l[1]+L+l[2]+a;
+    }
+    return 1;
+  } else {
+    return 0;
+  }
+}
+
+PRIVATE INLINE int
+vrna_BT_gquad_int(vrna_fold_compound_t *vc,
+                  int i,
+                  int j,
+                  int en,
+                  vrna_bp_stack_t *bp_stack,
+                  int *stack_count){
+
+  int           energy, dangles, *idx, ij, p, q, maxl, minl, c0, l1, *rtype, *ggg;
+  unsigned char type;
+  char          *ptype;
+  short         si, sj, *S, *S1;
+
+  vrna_param_t  *P;
+  vrna_md_t     *md;
+
+  idx         = vc->jindx;
+  ij          = idx[j] + i;
+  P           = vc->params;
+  md          = &(P->model_details);
+  ptype       = vc->ptype;
+  rtype       = &(md->rtype[0]);
+  type        = rtype[(unsigned char)ptype[ij]];
+  S1          = vc->sequence_encoding;
+  S           = vc->sequence_encoding2;
+  dangles     = md->dangles;
+  si          = S1[i + 1];
+  sj          = S1[j - 1];
+  ggg         = vc->matrices->ggg;
+  energy      = 0;
+
+  if(dangles == 2)
+    energy += P->mismatchI[type][si][sj];
+
+  if(type > 2)
+    energy += P->TerminalAU;
+
+  p = i + 1;
+  if(S1[p] == 3){
+    if(p < j - VRNA_GQUAD_MIN_BOX_SIZE){
+      minl  = j - i + p - MAXLOOP - 2;
+      c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+      minl  = MAX2(c0, minl);
+      c0    = j - 3;
+      maxl  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+      maxl  = MIN2(c0, maxl);
+      for(q = minl; q < maxl; q++){
+        if(S[q] != 3) continue;
+        if(en == energy + ggg[idx[q] + p] + P->internal_loop[j - q - 1]){
+          return vrna_BT_gquad_mfe(vc, p, q, bp_stack, stack_count);
+        }
+      }
+    }
+  }
+
+  for(p = i + 2;
+      p < j - VRNA_GQUAD_MIN_BOX_SIZE;
+      p++){
+    l1    = p - i - 1;
+    if(l1>MAXLOOP) break;
+    if(S1[p] != 3) continue;
+    minl  = j - i + p - MAXLOOP - 2;
+    c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+    minl  = MAX2(c0, minl);
+    c0    = j - 1;
+    maxl  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+    maxl  = MIN2(c0, maxl);
+    for(q = minl; q < maxl; q++){
+      if(S1[q] != 3) continue;
+      if(en == energy + ggg[idx[q] + p] + P->internal_loop[l1 + j - q - 1]){
+        return vrna_BT_gquad_mfe(vc, p, q, bp_stack, stack_count);
+      }
+    }
+  }
+
+  q = j - 1;
+  if(S1[q] == 3)
+    for(p = i + 4;
+        p < j - VRNA_GQUAD_MIN_BOX_SIZE;
+        p++){
+      l1    = p - i - 1;
+      if(l1>MAXLOOP) break;
+      if(S1[p] != 3) continue;
+      if(en == energy + ggg[idx[q] + p] + P->internal_loop[l1]){
+        return vrna_BT_gquad_mfe(vc, p, q, bp_stack, stack_count);
+      }
+    }
+
+  return 0;
+}
+
+/**
+ *  backtrack an interior loop like enclosed g-quadruplex
+ *  with closing pair (i,j)
+ *
+ *  @param c      The total contribution the loop should resemble
+ *  @param i      position i of enclosing pair
+ *  @param j      position j of enclosing pair
+ *  @param type   base pair type of enclosing pair (must be reverse type)
+ *  @param S      integer encoded sequence
+ *  @param ggg    triangular matrix containing g-quadruplex contributions
+ *  @param index  the index for accessing the triangular matrix
+ *  @param p      here the 5' position of the gquad is stored
+ *  @param q      here the 3' position of the gquad is stored
+ *  @param P      the datastructure containing the precalculated contibutions
+ *
+ *  @return       1 on success, 0 if no gquad found
+ */
+INLINE  PRIVATE int backtrack_GQuad_IntLoop(int c,
+                                            int i,
+                                            int j,
+                                            int type,
+                                            short *S,
+                                            int *ggg,
+                                            int *index,
+                                            int *p,
+                                            int *q,
+                                            vrna_param_t *P){
+
+  int energy, dangles, k, l, maxl, minl, c0, l1;
+  short si, sj;
+
+  dangles = P->model_details.dangles;
+  si      = S[i + 1];
+  sj      = S[j - 1];
+  energy  = 0;
+
+  if(dangles == 2)
+    energy += P->mismatchI[type][si][sj];
+
+  if(type > 2)
+    energy += P->TerminalAU;
+
+  k = i + 1;
+  if(S[k] == 3){
+    if(k < j - VRNA_GQUAD_MIN_BOX_SIZE){
+      minl  = j - i + k - MAXLOOP - 2;
+      c0    = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+      minl  = MAX2(c0, minl);
+      c0    = j - 3;
+      maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+      maxl  = MIN2(c0, maxl);
+      for(l = minl; l < maxl; l++){
+        if(S[l] != 3) continue;
+        if(c == energy + ggg[index[l] + k] + P->internal_loop[j - l - 1]){
+          *p = k; *q = l;
+          return 1;
+        }
+      }
+    }
+  }
+
+  for(k = i + 2;
+      k < j - VRNA_GQUAD_MIN_BOX_SIZE;
+      k++){
+    l1    = k - i - 1;
+    if(l1>MAXLOOP) break;
+    if(S[k] != 3) continue;
+    minl  = j - i + k - MAXLOOP - 2;
+    c0    = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+    minl  = MAX2(c0, minl);
+    c0    = j - 1;
+    maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+    maxl  = MIN2(c0, maxl);
+    for(l = minl; l < maxl; l++){
+      if(S[l] != 3) continue;
+      if(c == energy + ggg[index[l] + k] + P->internal_loop[l1 + j - l - 1]){
+        *p = k; *q = l;
+        return 1;
+      }
+    }
+  }
+
+  l = j - 1;
+  if(S[l] == 3)
+    for(k = i + 4;
+        k < j - VRNA_GQUAD_MIN_BOX_SIZE;
+        k++){
+      l1    = k - i - 1;
+      if(l1>MAXLOOP) break;
+      if(S[k] != 3) continue;
+      if(c == energy + ggg[index[l] + k] + P->internal_loop[l1]){
+        *p = k; *q = l;
+        return 1;
+      }
+    }
+
+  return 0;
+}
+
+/**
+ *  backtrack an interior loop like enclosed g-quadruplex
+ *  with closing pair (i,j) with underlying Lfold matrix
+ *
+ *  @param c      The total contribution the loop should resemble
+ *  @param i      position i of enclosing pair
+ *  @param j      position j of enclosing pair
+ *  @param type   base pair type of enclosing pair (must be reverse type)
+ *  @param S      integer encoded sequence
+ *  @param ggg    triangular matrix containing g-quadruplex contributions
+ *  @param p      here the 5' position of the gquad is stored
+ *  @param q      here the 3' position of the gquad is stored
+ *  @param P      the datastructure containing the precalculated contibutions
+ *
+ *  @return       1 on success, 0 if no gquad found
+ */
+INLINE  PRIVATE int backtrack_GQuad_IntLoop_L(int c,
+                                              int i,
+                                              int j,
+                                              int type,
+                                              short *S,
+                                              int **ggg,
+                                              int maxdist,
+                                              int *p,
+                                              int *q,
+                                              vrna_param_t *P){
+
+  int energy, dangles, k, l, maxl, minl, c0, l1;
+  short si, sj;
+
+  dangles = P->model_details.dangles;
+  si      = S[i + 1];
+  sj      = S[j - 1];
+  energy  = 0;
+
+  if(dangles == 2)
+    energy += P->mismatchI[type][si][sj];
+
+  if(type > 2)
+    energy += P->TerminalAU;
+
+  k = i + 1;
+  if(S[k] == 3){
+    if(k < j - VRNA_GQUAD_MIN_BOX_SIZE){
+      minl  = j - i + k - MAXLOOP - 2;
+      c0    = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+      minl  = MAX2(c0, minl);
+      c0    = j - 3;
+      maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+      maxl  = MIN2(c0, maxl);
+      for(l = minl; l < maxl; l++){
+        if(S[l] != 3) continue;
+        if(c == energy + ggg[k][l - k] + P->internal_loop[j - l - 1]){
+          *p = k; *q = l;
+          return 1;
+        }
+      }
+    }
+  }
+
+  for(k = i + 2;
+      k < j - VRNA_GQUAD_MIN_BOX_SIZE;
+      k++){
+    l1    = k - i - 1;
+    if(l1>MAXLOOP) break;
+    if(S[k] != 3) continue;
+    minl  = j - i + k - MAXLOOP - 2;
+    c0    = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+    minl  = MAX2(c0, minl);
+    c0    = j - 1;
+    maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+    maxl  = MIN2(c0, maxl);
+    for(l = minl; l < maxl; l++){
+      if(S[l] != 3) continue;
+      if(c == energy + ggg[k][l - k] + P->internal_loop[l1 + j - l - 1]){
+        *p = k; *q = l;
+        return 1;
+      }
+    }
+  }
+
+  l = j - 1;
+  if(S[l] == 3)
+    for(k = i + 4;
+        k < j - VRNA_GQUAD_MIN_BOX_SIZE;
+        k++){
+      l1    = k - i - 1;
+      if(l1>MAXLOOP) break;
+      if(S[k] != 3) continue;
+      if(c == energy + ggg[k][l - k] + P->internal_loop[l1]){
+        *p = k; *q = l;
+        return 1;
+      }
+    }
+
+  return 0;
+}
+
+PRIVATE INLINE
+int
+E_GQuad_IntLoop(int i,
+                int j,
+                int type,
+                short *S,
+                int *ggg,
+                int *index,
+                vrna_param_t *P){
+
+  int energy, ge, dangles, p, q, l1, minq, maxq, c0;
+  short si, sj;
+
+  dangles = P->model_details.dangles;
+  si      = S[i + 1];
+  sj      = S[j - 1];
+  energy  = 0;
+
+  if(dangles == 2)
+    energy += P->mismatchI[type][si][sj];
+
+  if(type > 2)
+    energy += P->TerminalAU;
+
+  ge = INF;
+
+  p = i + 1;
+  if(S[p] == 3){
+    if(p < j - VRNA_GQUAD_MIN_BOX_SIZE){
+      minq  = j - i + p - MAXLOOP - 2;
+      c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+      minq  = MAX2(c0, minq);
+      c0    = j - 3;
+      maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+      maxq  = MIN2(c0, maxq);
+      for(q = minq; q < maxq; q++){
+        if(S[q] != 3) continue;
+        c0  = energy + ggg[index[q] + p] + P->internal_loop[j - q - 1];
+        ge  = MIN2(ge, c0);
+      }
+    }
+  }
+
+  for(p = i + 2;
+      p < j - VRNA_GQUAD_MIN_BOX_SIZE;
+      p++){
+    l1    = p - i - 1;
+    if(l1>MAXLOOP) break;
+    if(S[p] != 3) continue;
+    minq  = j - i + p - MAXLOOP - 2;
+    c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+    minq  = MAX2(c0, minq);
+    c0    = j - 1;
+    maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+    maxq  = MIN2(c0, maxq);
+    for(q = minq; q < maxq; q++){
+      if(S[q] != 3) continue;
+      c0  = energy + ggg[index[q] + p] + P->internal_loop[l1 + j - q - 1];
+      ge   = MIN2(ge, c0);
+    }
+  }
+
+  q = j - 1;
+  if(S[q] == 3)
+    for(p = i + 4;
+        p < j - VRNA_GQUAD_MIN_BOX_SIZE;
+        p++){
+      l1    = p - i - 1;
+      if(l1>MAXLOOP) break;
+      if(S[p] != 3) continue;
+      c0  = energy + ggg[index[q] + p] + P->internal_loop[l1];
+      ge  = MIN2(ge, c0);
+    }
+
+#if 0
+  /* here comes the additional stuff for the odd dangle models */
+  if(dangles % 1){
+    en1 = energy + P->dangle5[type][si];
+    en2 = energy + P->dangle5[type][sj];
+    en3 = energy + P->mismatchI[type][si][sj];
+
+    /* first case with 5' dangle (i.e. j-1) onto enclosing pair */
+    p = i + 1;
+    if(S[p] == 3){
+      if(p < j - VRNA_GQUAD_MIN_BOX_SIZE){
+        minq  = j - i + p - MAXLOOP - 2;
+        c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+        minq  = MAX2(c0, minq);
+        c0    = j - 4;
+        maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+        maxq  = MIN2(c0, maxq);
+        for(q = minq; q < maxq; q++){
+          if(S[q] != 3) continue;
+          c0  = en1 + ggg[index[q] + p] + P->internal_loop[j - q - 1];
+          ge  = MIN2(ge, c0);
+        }
+      }
+    }
+
+    for(p = i + 2; p < j - VRNA_GQUAD_MIN_BOX_SIZE; p++){
+      l1    = p - i - 1;
+      if(l1>MAXLOOP) break;
+      if(S[p] != 3) continue;
+      minq  = j - i + p - MAXLOOP - 2;
+      c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+      minq  = MAX2(c0, minq);
+      c0    = j - 2;
+      maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+      maxq  = MIN2(c0, maxq);
+      for(q = minq; q < maxq; q++){
+        if(S[q] != 3) continue;
+        c0  = en1 + ggg[index[q] + p] + P->internal_loop[l1 + j - q - 1];
+        ge   = MIN2(ge, c0);
+      }
+    }
+
+    q = j - 2;
+    if(S[q] == 3)
+      for(p = i + 4; p < j - VRNA_GQUAD_MIN_BOX_SIZE; p++){
+        l1    = p - i - 1;
+        if(l1>MAXLOOP) break;
+        if(S[p] != 3) continue;
+        c0  = en1 + ggg[index[q] + p] + P->internal_loop[l1 + 1];
+        ge  = MIN2(ge, c0);
+      }
+
+    /* second case with 3' dangle (i.e. i+1) onto enclosing pair */
+
+  }
+#endif
+  return ge;
+}
+
+PRIVATE INLINE
+int *
+E_GQuad_IntLoop_exhaustive( int i,
+                            int j,
+                            int **p_p,
+                            int **q_p,
+                            int type,
+                            short *S,
+                            int *ggg,
+                            int threshold,
+                            int *index,
+                            vrna_param_t *P){
+
+  int energy, *ge, dangles, p, q, l1, minq, maxq, c0;
+  short si, sj;
+  int cnt = 0;
+
+  dangles = P->model_details.dangles;
+  si      = S[i + 1];
+  sj      = S[j - 1];
+  energy  = 0;
+
+  if(dangles == 2)
+    energy += P->mismatchI[type][si][sj];
+
+  if(type > 2)
+    energy += P->TerminalAU;
+
+  /* guess how many gquads are possible in interval [i+1,j-1] */
+  *p_p  = (int *)vrna_alloc(sizeof(int) * 256);
+  *q_p  = (int *)vrna_alloc(sizeof(int) * 256);
+  ge    = (int *)vrna_alloc(sizeof(int) * 256);
+
+  p = i + 1;
+  if(S[p] == 3){
+    if(p < j - VRNA_GQUAD_MIN_BOX_SIZE){
+      minq  = j - i + p - MAXLOOP - 2;
+      c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+      minq  = MAX2(c0, minq);
+      c0    = j - 3;
+      maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+      maxq  = MIN2(c0, maxq);
+      for(q = minq; q < maxq; q++){
+        if(S[q] != 3) continue;
+        c0  = energy + ggg[index[q] + p] + P->internal_loop[j - q - 1];
+        if(c0 <= threshold){
+          ge[cnt]       = energy + P->internal_loop[j - q - 1];
+          (*p_p)[cnt]   = p;
+          (*q_p)[cnt++] = q;
+        }
+      }
+    }
+  }
+
+  for(p = i + 2;
+      p < j - VRNA_GQUAD_MIN_BOX_SIZE;
+      p++){
+    l1    = p - i - 1;
+    if(l1>MAXLOOP) break;
+    if(S[p] != 3) continue;
+    minq  = j - i + p - MAXLOOP - 2;
+    c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+    minq  = MAX2(c0, minq);
+    c0    = j - 1;
+    maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+    maxq  = MIN2(c0, maxq);
+    for(q = minq; q < maxq; q++){
+      if(S[q] != 3) continue;
+      c0  = energy + ggg[index[q] + p] + P->internal_loop[l1 + j - q - 1];
+        if(c0 <= threshold){
+          ge[cnt]       = energy + P->internal_loop[l1 + j - q - 1];
+          (*p_p)[cnt]   = p;
+          (*q_p)[cnt++] = q;
+        }
+    }
+  }
+
+  q = j - 1;
+  if(S[q] == 3)
+    for(p = i + 4;
+        p < j - VRNA_GQUAD_MIN_BOX_SIZE;
+        p++){
+      l1    = p - i - 1;
+      if(l1>MAXLOOP) break;
+      if(S[p] != 3) continue;
+      c0  = energy + ggg[index[q] + p] + P->internal_loop[l1];
+        if(c0 <= threshold){
+          ge[cnt]       = energy + P->internal_loop[l1];
+          (*p_p)[cnt]   = p;
+          (*q_p)[cnt++] = q;
+        }
+    }
+
+
+  (*p_p)[cnt] = -1;
+
+  return ge;
+}
+
+PRIVATE INLINE
+int
+E_GQuad_IntLoop_L(int i,
+                  int j,
+                  int type,
+                  short *S,
+                  int **ggg,
+                  int maxdist,
+                  vrna_param_t *P){
+
+  int energy, ge, dangles, p, q, l1, minq, maxq, c0;
+  short si, sj;
+
+  dangles = P->model_details.dangles;
+  si      = S[i + 1];
+  sj      = S[j - 1];
+  energy  = 0;
+
+  if(dangles == 2)
+    energy += P->mismatchI[type][si][sj];
+
+  if(type > 2)
+    energy += P->TerminalAU;
+
+  ge = INF;
+
+  p = i + 1;
+  if(S[p] == 3){
+    if(p < j - VRNA_GQUAD_MIN_BOX_SIZE){
+      minq  = j - i + p - MAXLOOP - 2;
+      c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+      minq  = MAX2(c0, minq);
+      c0    = j - 3;
+      maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+      maxq  = MIN2(c0, maxq);
+      for(q = minq; q < maxq; q++){
+        if(S[q] != 3) continue;
+        c0  = energy + ggg[p][q-p] + P->internal_loop[j - q - 1];
+        ge  = MIN2(ge, c0);
+      }
+    }
+  }
+
+  for(p = i + 2;
+      p < j - VRNA_GQUAD_MIN_BOX_SIZE;
+      p++){
+    l1    = p - i - 1;
+    if(l1>MAXLOOP) break;
+    if(S[p] != 3) continue;
+    minq  = j - i + p - MAXLOOP - 2;
+    c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+    minq  = MAX2(c0, minq);
+    c0    = j - 1;
+    maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+    maxq  = MIN2(c0, maxq);
+    for(q = minq; q < maxq; q++){
+      if(S[q] != 3) continue;
+      c0  = energy + ggg[p][q - p] + P->internal_loop[l1 + j - q - 1];
+      ge   = MIN2(ge, c0);
+    }
+  }
+
+  q = j - 1;
+  if(S[q] == 3)
+    for(p = i + 4;
+        p < j - VRNA_GQUAD_MIN_BOX_SIZE;
+        p++){
+      l1    = p - i - 1;
+      if(l1>MAXLOOP) break;
+      if(S[p] != 3) continue;
+      c0  = energy + ggg[p][q - p] + P->internal_loop[l1];
+      ge  = MIN2(ge, c0);
+    }
+
+  return ge;
+}
+
+PRIVATE INLINE
+FLT_OR_DBL
+exp_E_GQuad_IntLoop(int i,
+                    int j,
+                    int type,
+                    short *S,
+                    FLT_OR_DBL *G,
+                    int *index,
+                    vrna_exp_param_t *pf){
+
+  int         k, l, minl, maxl, u, r;
+  FLT_OR_DBL  q, qe;
+  double      *expintern;
+  short       si, sj;
+
+  q         = 0;
+  si        = S[i + 1];
+  sj        = S[j - 1];
+  qe        = (FLT_OR_DBL)pf->expmismatchI[type][si][sj];
+  expintern = pf->expinternal;
+
+  if(type > 2)
+    qe *= (FLT_OR_DBL)pf->expTermAU;
+
+  k = i + 1;
+  if(S[k] == 3){
+    if(k < j - VRNA_GQUAD_MIN_BOX_SIZE){
+      minl  = j - i + k - MAXLOOP - 2;
+      u     = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+      minl  = MAX2(u, minl);
+      u     = j - 3;
+      maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+      maxl  = MIN2(u, maxl);
+      for(l = minl; l < maxl; l++){
+        if(S[l] != 3) continue;
+        if(G[index[k]-l] == 0.) continue;
+        q += qe * G[index[k]-l] * (FLT_OR_DBL)expintern[j - l - 1];
+      }
+    }
+  }
+
+
+  for(k = i + 2;
+      k <= j - VRNA_GQUAD_MIN_BOX_SIZE;
+      k++){
+    u = k - i - 1;
+    if(u > MAXLOOP) break;
+    if(S[k] != 3) continue;
+    minl  = j - i + k - MAXLOOP - 2;
+    r     = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+    minl  = MAX2(r, minl);
+    maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+    r     = j - 1;
+    maxl  = MIN2(r, maxl);
+    for(l = minl; l < maxl; l++){
+      if(S[l] != 3) continue;
+      if(G[index[k]-l] == 0.) continue;
+      q += qe * G[index[k]-l] * (FLT_OR_DBL)expintern[u + j - l - 1];
+    }
+  }
+
+  l = j - 1;
+  if(S[l] == 3)
+    for(k = i + 4; k < j - VRNA_GQUAD_MIN_BOX_SIZE; k++){
+      u    = k - i - 1;
+      if(u>MAXLOOP) break;
+      if(S[k] != 3) continue;
+      if(G[index[k]-l] == 0.) continue;
+      q += qe * G[index[k]-l] * (FLT_OR_DBL)expintern[u];
+    }
+
+  return q;
+}
+
+/**
+ * @}
+ */
+
+
+#endif
diff --git a/C/ViennaRNA/grammar.h b/C/ViennaRNA/grammar.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/grammar.h
@@ -0,0 +1,31 @@
+#ifndef VIENNA_RNA_PACKAGE_GRAMMAR_H
+#define VIENNA_RNA_PACKAGE_GRAMMAR_H
+
+/**
+ *  @file     grammar.h
+ *  @ingroup  grammar
+ *  @brief    Implementations for the RNA folding grammar
+ */
+
+#include <ViennaRNA/data_structures.h>
+
+typedef void (vrna_callback_gr_rule_aux)(vrna_fold_compound_t *vc, int i, int j, void *data);
+
+typedef void (vrna_callback_gr_free_auxdata)(void *data);
+
+typedef struct vrna_gr_aux_s  vrna_gr_aux_t;
+
+struct vrna_gr_aux_s {
+
+  vrna_callback_gr_rule_aux     *cb_aux_f;
+  vrna_callback_gr_rule_aux     *cb_aux_c;
+  vrna_callback_gr_rule_aux     *cb_aux_m;
+  vrna_callback_gr_rule_aux     *cb_aux_m1;
+  vrna_callback_gr_rule_aux     *cb_aux;
+
+  void                          *auxdata;
+  vrna_callback_gr_free_auxdata *free_auxdata;
+};
+
+
+#endif
diff --git a/C/ViennaRNA/hairpin_loops.c b/C/ViennaRNA/hairpin_loops.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/hairpin_loops.c
@@ -0,0 +1,945 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/data_structures.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/exterior_loops.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/structured_domains.h"
+#include "ViennaRNA/unstructured_domains.h"
+#include "ViennaRNA/hairpin_loops.h"
+
+struct default_data {
+  int                       n;
+  int                       *idx;
+  char                      *mx;
+  int                       cp;
+  int                       *hc_up;
+  void                      *hc_dat;
+  vrna_callback_hc_evaluate *hc_f;
+};
+
+
+/*
+ #################################
+ # PRIVATE FUNCTION DECLARATIONS #
+ #################################
+ */
+
+PRIVATE FLT_OR_DBL
+exp_eval_hp_loop(vrna_fold_compound_t *vc,
+                 int                  i,
+                 int                  j);
+
+
+PRIVATE FLT_OR_DBL
+exp_eval_ext_hp_loop(vrna_fold_compound_t *vc,
+                     int                  i,
+                     int                  j);
+
+
+PRIVATE char
+hc_default(int  i,
+           int  j,
+           int  k,
+           int  l,
+           char d,
+           void *data);
+
+
+PRIVATE char
+hc_default_user(int   i,
+                int   j,
+                int   k,
+                int   l,
+                char  d,
+                void  *data);
+
+
+PRIVATE int
+eval_hp_loop_fake(vrna_fold_compound_t  *vc,
+                  int                   i,
+                  int                   j);
+
+
+PRIVATE FLT_OR_DBL
+exp_eval_hp_loop_fake(vrna_fold_compound_t  *vc,
+                      int                   i,
+                      int                   j);
+
+/*
+ #################################
+ # BEGIN OF FUNCTION DEFINITIONS #
+ #################################
+ */
+
+/**
+ *  @brief  Evaluate the free energy of a hairpin loop
+ *          and consider possible hard constraints
+ *
+ *  @note This function is polymorphic! The provided #vrna_fold_compound_t may be of type
+ *  #VRNA_FC_TYPE_SINGLE or #VRNA_FC_TYPE_COMPARATIVE
+ *
+ */
+PUBLIC int
+vrna_E_hp_loop(vrna_fold_compound_t *vc,
+               int                  i,
+               int                  j)
+{
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = vc->hc->matrix;
+  hc_dat_local.hc_up  = vc->hc->up_hp;
+  hc_dat_local.n      = vc->length;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  if ((i > 0) && (j > 0)) {
+    /* is this base pair allowed to close a hairpin (like) loop ? */
+    if (evaluate(i, j, i, j, VRNA_DECOMP_PAIR_HP, &hc_dat_local)) {
+      if (j > i)  /* linear case */
+        return vrna_eval_hp_loop(vc, i, j);
+      else        /* circular case */
+        return vrna_eval_ext_hp_loop(vc, j, i);
+    }
+  }
+
+  return INF;
+}
+
+
+/**
+ *  @brief High-Level function for hairpin loop energy evaluation (partition function variant)
+ *
+ *  @see E_hp_loop() for it's free energy counterpart
+ */
+PUBLIC FLT_OR_DBL
+vrna_exp_E_hp_loop(vrna_fold_compound_t *vc,
+                   int                  i,
+                   int                  j)
+{
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = vc->hc->matrix;
+  hc_dat_local.hc_up  = vc->hc->up_hp;
+  hc_dat_local.n      = vc->length;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  if ((i > 0) && (j > 0)) {
+    if (evaluate(i, j, i, j, VRNA_DECOMP_PAIR_HP, &hc_dat_local)) {
+      if (j > i)  /* linear case */
+        return exp_eval_hp_loop(vc, i, j);
+      else        /* circular case */
+        return exp_eval_ext_hp_loop(vc, j, i);
+    }
+  }
+
+  return 0.;
+}
+
+
+/**
+ *  @brief  Evaluate the free energy of an exterior hairpin loop
+ *          and consider possible hard constraints
+ */
+PUBLIC int
+vrna_E_ext_hp_loop(vrna_fold_compound_t *vc,
+                   int                  i,
+                   int                  j)
+{
+  return vrna_E_hp_loop(vc, j, i);
+}
+
+
+/**
+ *  @brief Evaluate free energy of an exterior hairpin loop
+ *
+ *  @ingroup eval
+ *
+ */
+PUBLIC int
+vrna_eval_ext_hp_loop(vrna_fold_compound_t  *vc,
+                      int                   i,
+                      int                   j)
+{
+  char            **Ss, loopseq[10];
+  unsigned short  **a2s;
+  short           *S, **SS, **S5, **S3;
+  int             u, e, s, type, *types, n_seq, length;
+  vrna_param_t    *P;
+  vrna_sc_t       *sc, **scs;
+  vrna_md_t       *md;
+
+  length  = vc->length;
+  P       = vc->params;
+  md      = &(P->model_details);
+  e       = INF;
+
+  switch (vc->type) {
+    /* single sequences and cofolding hybrids */
+    case  VRNA_FC_TYPE_SINGLE:
+      S     = vc->sequence_encoding;
+      sc    = vc->sc;
+      u     = vc->length - j + i - 1;
+      type  = md->pair[S[j]][S[i]];
+
+      if (type == 0)
+        type = 7;
+
+      if (u < 7) {
+        strcpy(loopseq, vc->sequence + j - 1);
+        strncat(loopseq, vc->sequence, i);
+      }
+
+      e = E_Hairpin(u, type, S[j + 1], S[i - 1], loopseq, P);
+
+      if (sc) {
+        if (sc->energy_up)
+          e += sc->energy_up[j + 1][vc->length - j]
+               + sc->energy_up[1][i - 1];
+
+        if (sc->f)
+          e += sc->f(j, i, j, i, VRNA_DECOMP_PAIR_HP, sc->data);
+      }
+      break;
+
+    /* sequence alignments */
+    case  VRNA_FC_TYPE_COMPARATIVE:
+      SS    = vc->S;
+      S5    = vc->S5;                                 /*S5[s][i] holds next base 5' of i in sequence s*/
+      S3    = vc->S3;                                 /*Sl[s][i] holds next base 3' of i in sequence s*/
+      Ss    = vc->Ss;
+      a2s   = vc->a2s;
+      scs   = vc->scs;
+      n_seq = vc->n_seq;
+      e     = 0;
+      types = (int *)vrna_alloc(sizeof(int) * n_seq);
+
+      for (s = 0; s < n_seq; s++) {
+        types[s] = md->pair[SS[s][j]][SS[s][i]];
+        if (types[s] == 0) types[s] = 7;
+      }
+
+      for (s = 0; s < n_seq; s++) {
+        char loopseq[10];
+        u = a2s[s][length] - a2s[s][j] + a2s[s][i - 1];
+
+        if (u < 9) {
+          strcpy(loopseq, Ss[s] + a2s[s][j] - 1);
+          strncat(loopseq, Ss[s], a2s[s][i]);
+        }
+        if (u < 3) e += 600;
+        else e += E_Hairpin(u, types[s], S3[s][j], S5[s][i], loopseq, P);
+      }
+      if (scs) {
+        for (s = 0; s < n_seq; s++) {
+          if (scs[s]) {
+            if (scs[s]->energy_up)
+              e += ((i > 1) ? scs[s]->energy_up[1][a2s[s][i - 1]] : 0)
+                   + ((j < length) ? scs[s]->energy_up[a2s[s][j + 1]][a2s[s][length] - a2s[s][j]] : 0);
+            if (scs[s]->f)
+              e += scs[s]->f(a2s[s][j], a2s[s][i], a2s[s][j], a2s[s][i], VRNA_DECOMP_PAIR_HP, scs[s]->data);
+          }
+        }
+      }
+
+      free(types);
+      break;
+
+    /* nothing */
+    default:
+      break;
+  }
+
+  return e;
+}
+
+
+/**
+ *  @brief Evaluate free energy of a hairpin loop
+ *
+ *  @ingroup eval
+ *
+ *  @note This function is polymorphic! The provided #vrna_fold_compound_t may be of type
+ *  #VRNA_FC_TYPE_SINGLE or #VRNA_FC_TYPE_COMPARATIVE
+ *
+ *  @param  vc  The #vrna_fold_compound_t for the particular energy evaluation
+ *  @param  i   5'-position of the base pair
+ *  @param  j   3'-position of the base pair
+ *  @returns    Free energy of the hairpin loop closed by @f$ (i,j) @f$ in deka-kal/mol
+ */
+PUBLIC int
+vrna_eval_hp_loop(vrna_fold_compound_t  *vc,
+                  int                   i,
+                  int                   j)
+{
+  char            **Ss;
+  unsigned short  **a2s;
+  short           *S, **SS, **S5, **S3;
+  unsigned int    *sn;
+  int             u, e, s, ij, type, *types, *idx, n_seq, en;
+  vrna_param_t    *P;
+  vrna_sc_t       *sc, **scs;
+  vrna_md_t       *md;
+  vrna_ud_t       *domains_up;
+
+  idx         = vc->jindx;
+  P           = vc->params;
+  md          = &(P->model_details);
+  sn          = vc->strand_number;
+  domains_up  = vc->domains_up;
+  e           = INF;
+
+  if (sn[j] != sn[i])
+    return eval_hp_loop_fake(vc, i, j);
+
+  /* regular hairpin loop */
+  switch (vc->type) {
+    /* single sequences and cofolding hybrids */
+    case  VRNA_FC_TYPE_SINGLE:
+      S     = vc->sequence_encoding;
+      sc    = vc->sc;
+      u     = j - i - 1;
+      ij    = idx[j] + i;
+      type  = md->pair[S[i]][S[j]];
+
+      if (type == 0)
+        type = 7;
+
+      e = E_Hairpin(u, type, S[i + 1], S[j - 1], vc->sequence + i - 1, P);
+
+      /* add soft constraints */
+      if (sc) {
+        if (sc->energy_up)
+          e += sc->energy_up[i + 1][u];
+
+        if (sc->energy_bp)
+          e += sc->energy_bp[ij];
+        if (sc->f)
+          e += sc->f(i, j, i, j, VRNA_DECOMP_PAIR_HP, sc->data);
+      }
+
+      /* consider possible ligand binding */
+      if (domains_up && domains_up->energy_cb) {
+        en = domains_up->energy_cb(vc,
+                                   i + 1, j - 1,
+                                   VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+                                   domains_up->data);
+        if (en != INF)
+          en += e;
+        e = MIN2(e, en);
+      }
+
+      break;
+
+    /* sequence alignments */
+    case  VRNA_FC_TYPE_COMPARATIVE:
+      SS    = vc->S;
+      S5    = vc->S5;                                 /*S5[s][i] holds next base 5' of i in sequence s*/
+      S3    = vc->S3;                                 /*Sl[s][i] holds next base 3' of i in sequence s*/
+      Ss    = vc->Ss;
+      a2s   = vc->a2s;
+      scs   = vc->scs;
+      n_seq = vc->n_seq;
+      ij    = idx[j] + i;
+      types = (int *)vrna_alloc(sizeof(int) * n_seq);
+
+      for (s = 0; s < n_seq; s++) {
+        types[s] = md->pair[SS[s][i]][SS[s][j]];
+        if (types[s] == 0) types[s] = 7;
+      }
+
+      for (e = s = 0; s < n_seq; s++) {
+        u = a2s[s][j - 1] - a2s[s][i];
+        e += (u < 3) ? 600 : E_Hairpin(u, types[s], S3[s][i], S5[s][j], Ss[s] + (a2s[s][i - 1]), P);                          /* ??? really 600 ??? */
+      }
+
+      if (scs) {
+        for (s = 0; s < n_seq; s++) {
+          if (scs[s]) {
+            u = a2s[s][j - 1] - a2s[s][i];
+
+            if (scs[s]->energy_up)
+              e += scs[s]->energy_up[a2s[s][i + 1]][u];
+
+            if (scs[s]->energy_bp)
+              e += scs[s]->energy_bp[ij];
+
+            if (scs[s]->f)
+              e += scs[s]->f(a2s[s][i], a2s[s][j], a2s[s][i], a2s[s][j], VRNA_DECOMP_PAIR_HP, scs[s]->data);
+          }
+        }
+      }
+
+      free(types);
+      break;
+
+    /* nothing */
+    default:
+      break;
+  }
+
+  return e;
+}
+
+
+PRIVATE int
+eval_hp_loop_fake(vrna_fold_compound_t  *vc,
+                  int                   i,
+                  int                   j)
+{
+  short         *S;
+  unsigned int  *sn;
+  int           u, e, ij, type, *idx, en;
+  vrna_param_t  *P;
+  vrna_sc_t     *sc;
+  vrna_md_t     *md;
+  vrna_ud_t     *domains_up;
+
+  idx         = vc->jindx;
+  P           = vc->params;
+  md          = &(P->model_details);
+  sn          = vc->strand_number;
+  domains_up  = vc->domains_up;
+  e           = INF;
+
+  switch (vc->type) {
+    /* single sequences and cofolding hybrids */
+    case  VRNA_FC_TYPE_SINGLE:
+      S     = vc->sequence_encoding;
+      sc    = vc->sc;
+      u     = j - i - 1;
+      ij    = idx[j] + i;
+      type  = md->pair[S[i]][S[j]];
+
+      if (type == 0)
+        type = 7;
+
+      /* hairpin-like exterior loop (for cofolding) */
+      short si, sj;
+
+      si  = (sn[i + 1] == sn[i]) ? S[i + 1] : -1;
+      sj  = (sn[j] == sn[j - 1]) ? S[j - 1] : -1;
+
+      if (md->dangles)
+        e = E_ExtLoop(md->rtype[type], sj, si, P);
+      else
+        e = E_ExtLoop(md->rtype[type], -1, -1, P);
+
+      /* add soft constraints */
+      if (sc) {
+        if (sc->energy_up)
+          e += sc->energy_up[i + 1][u];
+
+        if (sc->energy_bp)
+          e += sc->energy_bp[ij];
+        if (sc->f)
+          e += sc->f(i, j, i, j, VRNA_DECOMP_PAIR_HP, sc->data);
+      }
+
+      /* consider possible ligand binding */
+      if (domains_up && domains_up->energy_cb) {
+        en = domains_up->energy_cb(vc,
+                                   i + 1, j - 1,
+                                   VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+                                   domains_up->data);
+        if (en != INF)
+          en += e;
+        e = MIN2(e, en);
+      }
+      break;
+
+    /* nothing */
+    default:
+      break;
+  }
+
+  return e;
+}
+
+
+PRIVATE FLT_OR_DBL
+exp_eval_hp_loop_fake(vrna_fold_compound_t  *vc,
+                      int                   i,
+                      int                   j)
+{
+  short             *S, s5, s3;
+  unsigned int      *sn;
+  int               u, cp, type, *iidx;
+  FLT_OR_DBL        qq, temp, *q, *scale;
+  vrna_exp_param_t  *pf_params;
+  vrna_sc_t         *sc;
+  vrna_md_t         *md;
+  vrna_ud_t         *domains_up;
+
+  cp          = vc->cutpoint;
+  iidx        = vc->iindx;
+  pf_params   = vc->exp_params;
+  md          = &(pf_params->model_details);
+  q           = vc->exp_matrices->q;
+  scale       = vc->exp_matrices->scale;
+  sn          = vc->strand_number;
+  domains_up  = vc->domains_up;
+
+  qq = 0;
+
+  switch (vc->type) {
+    /* single sequences and cofolding hybrids */
+    case  VRNA_FC_TYPE_SINGLE:
+      S     = vc->sequence_encoding;
+      sc    = vc->sc;
+      u     = j - i - 1;
+      type  = md->pair[S[j]][S[i]];
+
+      if (type == 0)
+        type = 7;
+
+      temp = q[iidx[i + 1] - (cp - 1)] * q[iidx[cp] - (j - 1)];
+      if ((j == cp) && (i == cp - 1))
+        temp = scale[2];
+      else if (i == cp - 1)
+        temp = q[iidx[cp] - (j - 1)] * scale[1];
+      else if (j == cp)
+        temp = q[iidx[i + 1] - (cp - 1)] * scale[1];
+      if (j > cp)
+        temp *= scale[1];
+      if (i < cp - 1)
+        temp *= scale[1];
+
+      s5  = (sn[j] == sn[j - 1]) ? S[j - 1] : -1;
+      s3  = (sn[i + 1] == sn[i]) ? S[i + 1] : -1;
+
+      temp *= exp_E_ExtLoop(type, s5, s3, pf_params);
+
+      qq += temp;
+
+      /* add soft constraints */
+      if (sc) {
+        if (sc->exp_energy_up)
+          qq *= sc->exp_energy_up[i + 1][u];
+
+        if (sc->exp_energy_bp)
+          qq *= sc->exp_energy_bp[iidx[i] - j];
+
+        if (sc->exp_f)
+          qq *= sc->exp_f(i, j, i, j, VRNA_DECOMP_PAIR_HP, sc->data);
+      }
+
+      if (domains_up && domains_up->exp_energy_cb) {
+        /* we always consider both, bound and unbound state */
+        qq += qq * domains_up->exp_energy_cb(vc,
+                                             i + 1, j - 1,
+                                             VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+                                             domains_up->data);
+      }
+      break;
+
+    /* nothing */
+    default:
+      break;
+  }
+
+  return qq;
+}
+
+
+/*
+ *************************************
+ * Partition function variants below *
+ *************************************
+ */
+PRIVATE FLT_OR_DBL
+exp_eval_hp_loop(vrna_fold_compound_t *vc,
+                 int                  i,
+                 int                  j)
+{
+  char              **Ss;
+  unsigned short    **a2s;
+  short             *S, **SS, **S5, **S3;
+  unsigned int      *sn;
+  int               u, ij, type, n_seq, s, *types, *idx, *iidx;
+  FLT_OR_DBL        q, qbt1, *scale;
+  vrna_exp_param_t  *P;
+  vrna_sc_t         *sc, **scs;
+  vrna_md_t         *md;
+  vrna_ud_t         *domains_up;
+
+  idx         = vc->jindx;
+  iidx        = vc->iindx;
+  P           = vc->exp_params;
+  md          = &(P->model_details);
+  sn          = vc->strand_number;
+  scale       = vc->exp_matrices->scale;
+  types       = NULL;
+  domains_up  = vc->domains_up;
+
+  q   = 0.;
+  ij  = idx[j] + i;
+
+  if (sn[j] != sn[i])
+    return exp_eval_hp_loop_fake(vc, i, j);
+
+  switch (vc->type) {
+    case VRNA_FC_TYPE_SINGLE:
+      S     = vc->sequence_encoding;
+      sc    = vc->sc;
+      u     = j - i - 1;
+      type  = vc->ptype[ij];
+
+      if (type == 0)
+        type = 7;
+
+      if (sn[j] == sn[i]) {
+        /* regular hairpin loop */
+        q = exp_E_Hairpin(u, type, S[i + 1], S[j - 1], vc->sequence + i - 1, P);
+      } else {
+        /* hairpin-like exterior loop (for cofolding) */
+        /* this is currently handle somewhere else */
+      }
+
+      /* add soft constraints */
+      if (sc) {
+        if (sc->exp_energy_up)
+          q *= sc->exp_energy_up[i + 1][u];
+
+        if (sc->exp_energy_bp)
+          q *= sc->exp_energy_bp[iidx[i] - j];
+
+        if (sc->exp_f)
+          q *= sc->exp_f(i, j, i, j, VRNA_DECOMP_PAIR_HP, sc->data);
+      }
+
+      q *= scale[u + 2];
+
+      if (domains_up && domains_up->exp_energy_cb) {
+        /* we always consider both, bound and unbound state */
+        q += q * domains_up->exp_energy_cb(vc,
+                                           i + 1, j - 1,
+                                           VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+                                           domains_up->data);
+      }
+      break;
+
+    case VRNA_FC_TYPE_COMPARATIVE:
+      SS    = vc->S;
+      S5    = vc->S5;                                 /*S5[s][i] holds next base 5' of i in sequence s*/
+      S3    = vc->S3;                                 /*Sl[s][i] holds next base 3' of i in sequence s*/
+      Ss    = vc->Ss;
+      a2s   = vc->a2s;
+      scs   = vc->scs;
+      n_seq = vc->n_seq;
+      qbt1  = 1.;
+      types = (int *)vrna_alloc(sizeof(int) * n_seq);
+
+      for (s = 0; s < n_seq; s++) {
+        types[s] = md->pair[SS[s][i]][SS[s][j]];
+        if (types[s] == 0) types[s] = 7;
+      }
+
+      for (s = 0; s < n_seq; s++) {
+        u = a2s[s][j - 1] - a2s[s][i];
+        if (a2s[s][i] < 1) continue;
+        char loopseq[10];
+        if (u < 9)
+          strncpy(loopseq, Ss[s] + a2s[s][i] - 1, 10);
+        qbt1 *= exp_E_Hairpin(u, types[s], S3[s][i], S5[s][j], loopseq, P);
+      }
+
+      /* add soft constraints */
+      if (scs) {
+        for (s = 0; s < n_seq; s++) {
+          if (scs[s]) {
+            u = a2s[s][j - 1] - a2s[s][i];
+
+            if (scs[s]->exp_energy_bp)
+              qbt1 *= scs[s]->exp_energy_bp[iidx[i] - j];
+
+            if (scs[s]->exp_energy_up)
+              qbt1 *= scs[s]->exp_energy_up[a2s[s][i + 1]][u];
+
+            if (scs[s]->exp_f)
+              qbt1 *= scs[s]->exp_f(a2s[s][i], a2s[s][j], a2s[s][i], a2s[s][j], VRNA_DECOMP_PAIR_HP, scs[s]->data);
+          }
+        }
+      }
+
+      q = qbt1 * scale[j - i + 1];
+      break;
+
+    default:
+      break;
+  }
+
+  free(types);
+  return q;
+}
+
+
+PRIVATE FLT_OR_DBL
+exp_eval_ext_hp_loop(vrna_fold_compound_t *vc,
+                     int                  i,
+                     int                  j)
+{
+  char              **Ss, *sequence;
+  unsigned short    **a2s;
+  short             *S, **SS, **S5, **S3;
+  int               u, u1, ij, n, type, n_seq, s, *rtype, *types, *idx, noGUclosure;
+  FLT_OR_DBL        q, qbt1, *scale;
+  vrna_exp_param_t  *P;
+  vrna_sc_t         *sc, **scs;
+  vrna_md_t         *md;
+  vrna_ud_t         *domains_up;
+
+  n           = vc->length;
+  idx         = vc->jindx;
+  P           = vc->exp_params;
+  md          = &(P->model_details);
+  noGUclosure = md->noGUclosure;
+  scale       = vc->exp_matrices->scale;
+  types       = NULL;
+  domains_up  = vc->domains_up;
+  rtype       = &(md->rtype[0]);
+
+  q   = 0.;
+  u   = n - j + i - 1;
+  ij  = idx[j] + i;
+
+  switch (vc->type) {
+    case VRNA_FC_TYPE_SINGLE:
+      sequence  = vc->sequence;
+      S         = vc->sequence_encoding;
+      sc        = vc->sc;
+      type      = rtype[vc->ptype[ij]];
+
+      if (type == 0)
+        type = 7;
+
+      if (((type == 3) || (type == 4)) && noGUclosure)
+        return q;
+
+      /* get the loop sequence */
+      char loopseq[10];
+      if (u < 7) {
+        strcpy(loopseq, sequence + j - 1);
+        strncat(loopseq, sequence, i);
+      }
+
+      q = exp_E_Hairpin(u, type, S[j + 1], S[i - 1], loopseq, P);
+
+      /* add soft constraints */
+      if (sc) {
+        if (sc->exp_energy_up)
+          q *= ((i > 1) ? sc->exp_energy_up[1][i - 1] : 1.)
+               * ((j < n) ? sc->exp_energy_up[j + 1][n - j] : 1.);
+
+        if (sc->exp_f)
+          q *= sc->exp_f(j, i, j, i, VRNA_DECOMP_PAIR_HP, sc->data);
+      }
+
+      q *= scale[u];
+
+      if (domains_up && domains_up->exp_energy_cb) {
+        /* we always consider both, bound and unbound state */
+        q += q * domains_up->exp_energy_cb(vc,
+                                           j + 1, i - 1,
+                                           VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+                                           domains_up->data);
+      }
+      break;
+
+    case VRNA_FC_TYPE_COMPARATIVE:
+      SS    = vc->S;
+      S5    = vc->S5;                                 /*S5[s][i] holds next base 5' of i in sequence s*/
+      S3    = vc->S3;                                 /*Sl[s][i] holds next base 3' of i in sequence s*/
+      Ss    = vc->Ss;
+      a2s   = vc->a2s;
+      scs   = vc->scs;
+      n_seq = vc->n_seq;
+      qbt1  = 1.;
+      types = (int *)vrna_alloc(sizeof(int) * n_seq);
+
+      for (s = 0; s < n_seq; s++) {
+        types[s] = md->pair[SS[s][j]][SS[s][i]];
+        if (types[s] == 0) types[s] = 7;
+      }
+
+      for (s = 0; s < n_seq; s++) {
+        u1 = a2s[s][i] - 1 + a2s[s][n] - a2s[s][j];
+        char loopseq[10];
+        if (u1 < 7) {
+          strcpy(loopseq, Ss[s] + a2s[s][j] - 1);
+          strncat(loopseq, Ss[s], a2s[s][i]);
+        }
+        qbt1 *= exp_E_Hairpin(u1, types[s], S3[s][j], S5[s][i], loopseq, P);
+      }
+
+      /* add soft constraints */
+      if (scs) {
+        for (s = 0; s < n_seq; s++) {
+          if (scs[s]) {
+            if (scs[s]->exp_energy_up)
+              qbt1 *= ((i > 1) ? scs[s]->exp_energy_up[a2s[s][1]][a2s[s][i] - a2s[s][1]] : 1.)
+                      * ((j < n) ? scs[s]->exp_energy_up[a2s[s][j] + 1][a2s[s][n] - a2s[s][j]] : 1.);
+
+            if (scs[s]->exp_f)
+              qbt1 *= scs[s]->exp_f(a2s[s][j], a2s[s][i], a2s[s][j], a2s[s][i], VRNA_DECOMP_PAIR_HP, scs[s]->data);
+          }
+        }
+      }
+
+      q = qbt1 * scale[u];
+
+      free(types);
+      break;
+
+    default:
+      break;
+  }
+
+  return q;
+}
+
+
+/**
+ *  @brief Backtrack a hairpin loop closed by @f$ (i,j) @f$
+ *
+ *  @note This function is polymorphic! The provided #vrna_fold_compound_t may be of type
+ *  #VRNA_FC_TYPE_SINGLE or #VRNA_FC_TYPE_COMPARATIVE
+ *
+ */
+PUBLIC int
+vrna_BT_hp_loop(vrna_fold_compound_t  *vc,
+                int                   i,
+                int                   j,
+                int                   en,
+                vrna_bp_stack_t       *bp_stack,
+                int                   *stack_count)
+{
+  int       e, u;
+  vrna_sc_t *sc;
+
+  sc = NULL;
+
+  u = j - i - 1;
+
+  if (vc->hc->up_hp[i + 1] < u)
+    return 0;
+
+  e = vrna_E_hp_loop(vc, i, j);
+
+  if (e == en) {
+    switch (vc->type) {
+      case  VRNA_FC_TYPE_SINGLE:
+        sc = vc->sc;
+        break;
+
+      case  VRNA_FC_TYPE_COMPARATIVE:
+        if (vc->scs)
+          sc = vc->scs[0];
+        break;
+
+      default:
+        break;
+    }
+
+    if (sc) {
+      if (sc->bt) {
+        vrna_basepair_t *ptr, *aux_bps;
+        aux_bps = sc->bt(i, j, i, j, VRNA_DECOMP_PAIR_HP, sc->data);
+        for (ptr = aux_bps; ptr && ptr->i != 0; ptr++) {
+          bp_stack[++(*stack_count)].i  = ptr->i;
+          bp_stack[(*stack_count)].j    = ptr->j;
+        }
+        free(aux_bps);
+      }
+    }
+
+    return 1;
+  }
+
+  return 0;
+}
+
+
+PRIVATE char
+hc_default(int  i,
+           int  j,
+           int  k,
+           int  l,
+           char d,
+           void *data)
+{
+  int                 ij, u, p, q;
+  char                eval;
+  struct default_data *dat = (struct default_data *)data;
+
+  eval = (char)0;
+
+  if (j > i) {
+    /* linear case */
+    p = i;
+    q = j;
+    u = q - p - 1;
+  } else {
+    /* circular case */
+    p = j;
+    q = i;
+    u = dat->n - q + p - 1;
+  }
+
+  ij = dat->idx[q] + p;
+  if (dat->mx[ij] & VRNA_CONSTRAINT_CONTEXT_HP_LOOP) {
+    eval = (char)1;
+    if (dat->hc_up[i + 1] < u)
+      eval = (char)0;
+  }
+
+  return eval;
+}
+
+
+PRIVATE char
+hc_default_user(int   i,
+                int   j,
+                int   k,
+                int   l,
+                char  d,
+                void  *data)
+{
+  char                eval;
+  struct default_data *dat = (struct default_data *)data;
+
+  eval  = hc_default(i, j, k, l, d, data);
+  eval  = (dat->hc_f(i, j, k, l, d, dat->hc_dat)) ? eval : (char)0;
+
+  return eval;
+}
diff --git a/C/ViennaRNA/hairpin_loops.h b/C/ViennaRNA/hairpin_loops.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/hairpin_loops.h
@@ -0,0 +1,303 @@
+#ifndef VIENNA_RNA_PACKAGE_HAIRPIN_LOOPS_H
+#define VIENNA_RNA_PACKAGE_HAIRPIN_LOOPS_H
+
+#include <math.h>
+#include <string.h>
+#include <ViennaRNA/utils.h>
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+
+#ifdef __GNUC__
+# define INLINE inline
+#else
+# define INLINE
+#endif
+
+/**
+ *
+ *  @file     hairpin_loops.h
+ *  @ingroup  loops
+ *  @brief    Energy evaluation of hairpin loops for MFE and partition function calculations
+ */
+
+/**
+ *
+ *  @{
+ *  @ingroup   loops
+ */
+
+
+/**
+ *  @brief Compute the Energy of a hairpin-loop
+ *
+ *  To evaluate the free energy of a hairpin-loop, several parameters have to be known.
+ *  A general hairpin-loop has this structure:<BR>
+ *  <PRE>
+ *        a3 a4
+ *      a2     a5
+ *      a1     a6
+ *        X - Y
+ *        |   |
+ *        5'  3'
+ *  </PRE>
+ *  where X-Y marks the closing pair [e.g. a <B>(G,C)</B> pair]. The length of this loop is 6 as there are
+ *  six unpaired nucleotides (a1-a6) enclosed by (X,Y). The 5' mismatching nucleotide is
+ *  a1 while the 3' mismatch is a6. The nucleotide sequence of this loop is &quot;a1.a2.a3.a4.a5.a6&quot; <BR>
+ *  @note The parameter sequence should contain the sequence of the loop in capital letters of the nucleic acid
+ *  alphabet if the loop size is below 7. This is useful for unusually stable tri-, tetra- and hexa-loops
+ *  which are treated differently (based on experimental data) if they are tabulated.
+ *  @see scale_parameters()
+ *  @see vrna_param_t
+ *  @warning Not (really) thread safe! A threadsafe implementation will replace this function in a future release!\n
+ *  Energy evaluation may change due to updates in global variable "tetra_loop"
+ * 
+ *  @param  size  The size of the loop (number of unpaired nucleotides)
+ *  @param  type  The pair type of the base pair closing the hairpin
+ *  @param  si1   The 5'-mismatching nucleotide
+ *  @param  sj1   The 3'-mismatching nucleotide
+ *  @param  string  The sequence of the loop
+ *  @param  P     The datastructure containing scaled energy parameters
+ *  @return The Free energy of the Hairpin-loop in dcal/mol
+ */
+PRIVATE INLINE int
+E_Hairpin(int size,
+              int type,
+              int si1,
+              int sj1,
+              const char *string,
+              vrna_param_t *P);
+
+/**
+ *  @brief Compute Boltzmann weight @f$e^{-\Delta G/kT} @f$ of a hairpin loop
+ *
+ *  multiply by scale[u+2]
+ *  @see get_scaled_pf_parameters()
+ *  @see vrna_exp_param_t
+ *  @see E_Hairpin()
+ *  @warning Not (really) thread safe! A threadsafe implementation will replace this function in a future release!\n
+ *  Energy evaluation may change due to updates in global variable "tetra_loop"
+ * 
+ *  @param  u       The size of the loop (number of unpaired nucleotides)
+ *  @param  type    The pair type of the base pair closing the hairpin
+ *  @param  si1     The 5'-mismatching nucleotide
+ *  @param  sj1     The 3'-mismatching nucleotide
+ *  @param  string  The sequence of the loop
+ *  @param  P       The datastructure containing scaled Boltzmann weights of the energy parameters
+ *  @return The Boltzmann weight of the Hairpin-loop
+ */
+PRIVATE INLINE FLT_OR_DBL
+exp_E_Hairpin(  int u,
+                int type,
+                short si1,
+                short sj1,
+                const char *string,
+                vrna_exp_param_t *P);
+
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PRIVATE INLINE int
+E_Hairpin(int size,
+          int type,
+          int si1,
+          int sj1,
+          const char *string,
+          vrna_param_t *P){
+
+  int energy;
+
+  if(size <= 30)
+    energy = P->hairpin[size];
+  else
+    energy = P->hairpin[30] + (int)(P->lxc*log((size)/30.));
+
+  if(size < 3) return energy; /* should only be the case when folding alignments */
+
+  if(P->model_details.special_hp){
+    if(size == 4){ /* check for tetraloop bonus */
+      char tl[7]={0}, *ts;
+      strncpy(tl, string, 6);
+      if ((ts=strstr(P->Tetraloops, tl)))
+        return (P->Tetraloop_E[(ts - P->Tetraloops)/7]);
+    }
+    else if(size == 6){
+      char tl[9]={0}, *ts;
+      strncpy(tl, string, 8);
+      if ((ts=strstr(P->Hexaloops, tl)))
+        return (energy = P->Hexaloop_E[(ts - P->Hexaloops)/9]);
+    }
+    else if(size == 3){
+      char tl[6]={0,0,0,0,0,0}, *ts;
+      strncpy(tl, string, 5);
+      if ((ts=strstr(P->Triloops, tl))) {
+        return (P->Triloop_E[(ts - P->Triloops)/6]);
+      }
+      return (energy + (type>2 ? P->TerminalAU : 0));
+    }
+  }
+  energy += P->mismatchH[type][si1][sj1];
+
+  return energy;
+}
+
+/**
+ *  @brief  Evaluate the free energy of a hairpin loop
+ *          and consider hard constraints if they apply
+ *
+ *  This function evaluates the free energy of a hairpin loop
+ *
+ *  In case the base pair is not allowed due to a constraint
+ *  conflict, this function returns #INF.
+ *
+ *  @note This function is polymorphic! The provided #vrna_fold_compound_t may be of type
+ *  #VRNA_FC_TYPE_SINGLE or #VRNA_FC_TYPE_COMPARATIVE
+ *
+ *  @param vc   The #vrna_fold_compound_t that stores all relevant model settings
+ *  @param i    The 5' nucleotide of the base pair (3' to evaluate the pair as exterior hairpin loop)
+ *  @param j    The 3' nucleotide of the base pair (5' to evaluate the pair as exterior hairpin loop)
+ *  @returns    The free energy of the hairpin loop in 10cal/mol
+ */
+int
+vrna_E_hp_loop( vrna_fold_compound_t *vc,
+                int i,
+                int j);
+
+/**
+ *  @brief  Evaluate the free energy of an exterior hairpin loop
+ *          and consider possible hard constraints
+ *
+ *  @note This function is polymorphic! The provided #vrna_fold_compound_t may be of type
+ *  #VRNA_FC_TYPE_SINGLE or #VRNA_FC_TYPE_COMPARATIVE
+ *
+ */
+int
+vrna_E_ext_hp_loop( vrna_fold_compound_t *vc,
+                    int i,
+                    int j);
+
+/**
+ *  @brief Evaluate free energy of an exterior hairpin loop
+ *
+ *  @ingroup loops
+ *
+ */
+int
+vrna_eval_ext_hp_loop(vrna_fold_compound_t *vc,
+                      int i,
+                      int j);
+
+/**
+ *  @brief Evaluate free energy of a hairpin loop
+ *
+ *  @ingroup loops
+ *
+ *  @note This function is polymorphic! The provided #vrna_fold_compound_t may be of type
+ *  #VRNA_FC_TYPE_SINGLE or #VRNA_FC_TYPE_COMPARATIVE
+ *
+ *  @param  vc  The #vrna_fold_compound_t for the particular energy evaluation
+ *  @param  i   5'-position of the base pair
+ *  @param  j   3'-position of the base pair
+ *  @returns    Free energy of the hairpin loop closed by @f$ (i,j) @f$ in deka-kal/mol
+ */
+int
+vrna_eval_hp_loop(vrna_fold_compound_t *vc,
+                  int i,
+                  int j);
+
+/*
+*************************************
+* Partition function variants below *
+*************************************
+*/
+
+PRIVATE INLINE FLT_OR_DBL
+exp_E_Hairpin(int u,
+              int type,
+              short si1,
+              short sj1,
+              const char *string,
+              vrna_exp_param_t *P){
+
+  double q, kT;
+  kT = P->kT;   /* kT in cal/mol  */
+
+  if(u <= 30)
+    q = P->exphairpin[u];
+  else
+    q = P->exphairpin[30] * exp( -(P->lxc*log( u/30.))*10./kT);
+
+  if(u < 3) return (FLT_OR_DBL)q; /* should only be the case when folding alignments */
+
+  if(P->model_details.special_hp){
+    if(u==4){
+      char tl[7]={0,0,0,0,0,0,0}, *ts;
+      strncpy(tl, string, 6);
+      if ((ts=strstr(P->Tetraloops, tl))){
+        if(type != 7)
+          return (FLT_OR_DBL)(P->exptetra[(ts-P->Tetraloops)/7]);
+        else
+          q *= P->exptetra[(ts-P->Tetraloops)/7];
+      }
+    }
+    else if(u==6){
+      char tl[9]={0,0,0,0,0,0,0,0,0}, *ts;
+      strncpy(tl, string, 8);
+      if ((ts=strstr(P->Hexaloops, tl)))
+        return  (FLT_OR_DBL)(P->exphex[(ts-P->Hexaloops)/9]);
+    }
+    else if(u==3){
+      char tl[6]={0,0,0,0,0,0}, *ts;
+      strncpy(tl, string, 5);
+      if ((ts=strstr(P->Triloops, tl)))
+        return (FLT_OR_DBL)(P->exptri[(ts-P->Triloops)/6]);
+      if (type>2)
+        return (FLT_OR_DBL)(q * P->expTermAU);
+      else
+        return (FLT_OR_DBL)q;
+    }
+  }
+  q *= P->expmismatchH[type][si1][sj1];
+
+  return (FLT_OR_DBL)q;
+}
+
+
+/**
+ *  @brief High-Level function for hairpin loop energy evaluation (partition function variant)
+ *
+ *  @see vrna_E_hp_loop() for it's free energy counterpart
+ *
+ *  @note This function is polymorphic! The provided #vrna_fold_compound_t may be of type
+ *  #VRNA_FC_TYPE_SINGLE or #VRNA_FC_TYPE_COMPARATIVE
+ *
+*/
+FLT_OR_DBL
+vrna_exp_E_hp_loop( vrna_fold_compound_t *vc,
+                    int i,
+                    int j);
+
+/**
+ *  @brief Backtrack a hairpin loop closed by @f$ (i,j) @f$
+ *
+ *  @note This function is polymorphic! The provided #vrna_fold_compound_t may be of type
+ *  #VRNA_FC_TYPE_SINGLE or #VRNA_FC_TYPE_COMPARATIVE
+ *
+ */
+int
+vrna_BT_hp_loop(vrna_fold_compound_t *vc,
+                int i,
+                int j,
+                int en,
+                vrna_bp_stack_t *bp_stack,
+                int   *stack_count);
+
+/**
+ * @}
+ */
+
+
+#endif
diff --git a/C/ViennaRNA/interior_loops.c b/C/ViennaRNA/interior_loops.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/interior_loops.c
@@ -0,0 +1,1807 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/exterior_loops.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/structured_domains.h"
+#include "ViennaRNA/unstructured_domains.h"
+#include "ViennaRNA/interior_loops.h"
+
+
+struct default_data {
+  void                      *hc_dat;
+  vrna_callback_hc_evaluate *hc_f;
+};
+
+
+/*
+ #################################
+ # PRIVATE FUNCTION DECLARATIONS #
+ #################################
+ */
+
+PRIVATE int
+E_int_loop(vrna_fold_compound_t *vc,
+           int                  i,
+           int                  j);
+
+
+PRIVATE int
+E_int_loop_comparative(vrna_fold_compound_t *vc,
+                       int                  i,
+                       int                  j);
+
+
+PRIVATE FLT_OR_DBL
+exp_E_int_loop(vrna_fold_compound_t *vc,
+               int                  i,
+               int                  j);
+
+
+PRIVATE FLT_OR_DBL
+exp_E_int_loop_comparative(vrna_fold_compound_t *vc,
+                           int                  i,
+                           int                  j);
+
+
+PRIVATE INLINE int
+eval_interior_loop(vrna_fold_compound_t *vc,
+                   int                  i,
+                   int                  j,
+                   int                  p,
+                   int                  q);
+
+
+PRIVATE INLINE int
+eval_int_loop(vrna_fold_compound_t  *vc,
+              int                   i,
+              int                   j,
+              int                   k,
+              int                   l);
+
+
+PRIVATE FLT_OR_DBL
+exp_E_interior_loop(vrna_fold_compound_t  *vc,
+                    int                   i,
+                    int                   j,
+                    int                   k,
+                    int                   l);
+
+
+PRIVATE char
+hc_default(int  i,
+           int  j,
+           int  k,
+           int  l,
+           char d,
+           void *data);
+
+
+PRIVATE char
+hc_default_user(int   i,
+                int   j,
+                int   k,
+                int   l,
+                char  d,
+                void  *data);
+
+
+/*
+ #################################
+ # BEGIN OF FUNCTION DEFINITIONS #
+ #################################
+ */
+PUBLIC int
+vrna_E_int_loop(vrna_fold_compound_t  *vc,
+                int                   i,
+                int                   j)
+{
+  int e = INF;
+
+  if (vc) {
+    switch (vc->type) {
+      case VRNA_FC_TYPE_SINGLE:
+        e = E_int_loop(vc, i, j);
+        break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:
+        e = E_int_loop_comparative(vc, i, j);
+        break;
+    }
+  }
+
+  return e;
+}
+
+
+PUBLIC FLT_OR_DBL
+vrna_exp_E_int_loop(vrna_fold_compound_t  *vc,
+                    int                   i,
+                    int                   j)
+{
+  FLT_OR_DBL q = 0.;
+
+  if (vc) {
+    switch (vc->type) {
+      case VRNA_FC_TYPE_SINGLE:
+        q = exp_E_int_loop(vc, i, j);
+        break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:
+        q = exp_E_int_loop_comparative(vc, i, j);
+        break;
+    }
+  }
+
+  return q;
+}
+
+
+PUBLIC int
+vrna_eval_int_loop(vrna_fold_compound_t *vc,
+                   int                  i,
+                   int                  j,
+                   int                  k,
+                   int                  l)
+{
+  int e = INF;
+
+  if (vc) {
+    switch (vc->type) {
+      case VRNA_FC_TYPE_SINGLE:
+        e = eval_int_loop(vc, i, j, k, l);
+        break;
+    }
+  }
+
+  return e;
+}
+
+
+PRIVATE INLINE int
+eval_int_loop(vrna_fold_compound_t  *vc,
+              int                   i,
+              int                   j,
+              int                   k,
+              int                   l)
+{
+  unsigned int  *sn;
+  int           ij, kl, e, u1, u2, cp, *jindx, *hc_up, *rtype, type, type2;
+  short         *S;
+  vrna_sc_t     *sc;
+  vrna_param_t  *P;
+  vrna_md_t     *md;
+
+  cp    = vc->cutpoint;
+  jindx = vc->jindx;
+  sc    = vc->sc;
+  P     = vc->params;
+  md    = &(P->model_details);
+  sn    = vc->strand_number;
+  rtype = &(md->rtype[0]);
+  ij    = jindx[j] + i;
+  kl    = jindx[l] + k;
+  S     = vc->sequence_encoding;
+
+  e = INF;
+
+  u1  = k - i - 1;
+  u2  = j - l - 1;
+
+  if ((sn[k] != sn[i]) || (sn[j] != sn[l]))
+    return e;
+
+  type  = md->pair[S[i]][S[j]];
+  type2 = md->pair[S[l]][S[k]];
+  if (type == 0)
+    type = 7;
+  if (type2 == 0)
+    type2 = 7;
+
+  e = ubf_eval_int_loop(i, j, k, l,
+                        i + 1, j - 1, k - 1, l + 1,
+                        S[i + 1], S[j - 1], S[k - 1], S[l + 1],
+                        type, type2, rtype,
+                        ij, cp,
+                        P, sc);
+
+  return e;
+}
+
+
+PRIVATE int
+E_int_loop(vrna_fold_compound_t *vc,
+           int                  i,
+           int                  j)
+{
+  unsigned char             type, type_2;
+  char                      *ptype, *ptype_pq, *hc_pq, *hc, eval_loop;
+  short                     *S, S_i1, S_j1, *S_p1, *S_q1;
+  unsigned int              *sn;
+  int                       q, p, j_q, p_i, pq, *c_pq, max_q, max_p, tmp,
+                            *rtype, noGUclosure, no_close, energy, cp, en,
+                            *indx, *hc_up, ij, hc_decompose, e, *c, *ggg,
+                            with_gquad, turn;
+  vrna_sc_t                 *sc;
+  vrna_param_t              *P;
+  vrna_md_t                 *md;
+  vrna_mx_mfe_t             *matrices;
+  vrna_ud_t                 *domains_up;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  cp            = vc->cutpoint;
+  indx          = vc->jindx;
+  hc            = vc->hc->matrix;
+  hc_up         = vc->hc->up_int;
+  P             = vc->params;
+  matrices      = vc->matrices;
+  ij            = indx[j] + i;
+  hc_decompose  = hc[ij];
+  e             = INF;
+  sn            = vc->strand_number;
+  c             = vc->matrices->c;
+  ggg           = vc->matrices->ggg;
+  md            = &(P->model_details);
+  with_gquad    = md->gquad;
+  turn          = md->min_loop_size;
+  domains_up    = vc->domains_up;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  /* CONSTRAINED INTERIOR LOOP start */
+  if (hc_decompose & VRNA_CONSTRAINT_CONTEXT_INT_LOOP) {
+    /* prepare necessary variables */
+    rtype       = &(md->rtype[0]);
+    noGUclosure = md->noGUclosure;
+    max_q       = i + turn + 2;
+    max_q       = MAX2(max_q, j - MAXLOOP - 1);
+
+    ptype     = vc->ptype;
+    type      = (unsigned char)ptype[ij];
+    no_close  = (((type == 3) || (type == 4)) && noGUclosure);
+    S         = vc->sequence_encoding;
+
+    S_i1  = S[i + 1];
+    S_j1  = S[j - 1];
+    sc    = vc->sc;
+
+    if (type == 0)
+      type = 7;
+
+    if (domains_up && domains_up->energy_cb) {
+      for (q = j - 1; q >= max_q; q--) {
+        j_q = j - q - 1;
+
+        if (hc_up[q + 1] < j_q) break;
+
+        pq    = indx[q] + i + 1;
+        p_i   = 0;
+        max_p = i + 1;
+        tmp   = i + 1 + MAXLOOP - j_q;
+        max_p = MAX2(max_p, tmp);
+        tmp   = q - turn;
+        max_p = MIN2(max_p, tmp);
+        tmp   = i + 1 + hc_up[i + 1];
+        max_p = MIN2(max_p, tmp);
+        c_pq  = c + pq;
+
+        ptype_pq  = ptype + pq;
+        S_p1      = S + i;
+        S_q1      = S + q + 1;
+
+        hc_pq = hc + pq;
+
+        for (p = i + 1; p <= max_p; p++) {
+          eval_loop = *hc_pq & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC;
+          /* discard this configuration if (p,q) is not allowed to be enclosed pair of an interior loop */
+          if (eval_loop && evaluate(i, j, p, q, VRNA_DECOMP_PAIR_IL, &hc_dat_local)) {
+            energy = *c_pq;
+            if (energy != INF) {
+              type_2 = rtype[(unsigned char)*ptype_pq];
+
+              if (type_2 == 0)
+                type_2 = 7;
+
+              if (noGUclosure)
+                if (no_close || (type_2 == 3) || (type_2 == 4))
+                  if ((p > i + 1) || (q < j - 1)) continue;  /* continue unless stack */
+
+              energy  += eval_interior_loop(vc, i, j, p, q);
+              e       = MIN2(e, energy);
+            }
+          }
+          hc_pq++;    /* get hc[pq + 1] */
+          c_pq++;     /* get c[pq + 1] */
+          p_i++;      /* increase unpaired region [i+1...p-1] */
+
+          ptype_pq++; /* get ptype[pq + 1] */
+          S_p1++;
+
+          pq++;
+        } /* end q-loop */
+      }   /* end p-loop */
+    } else {
+      for (q = j - 1; q >= max_q; q--) {
+        j_q = j - q - 1;
+
+        if (hc_up[q + 1] < j_q) break;
+
+        pq    = indx[q] + i + 1;
+        p_i   = 0;
+        max_p = i + 1;
+        tmp   = i + 1 + MAXLOOP - j_q;
+        max_p = MAX2(max_p, tmp);
+        tmp   = q - turn;
+        max_p = MIN2(max_p, tmp);
+        tmp   = i + 1 + hc_up[i + 1];
+        max_p = MIN2(max_p, tmp);
+        hc_pq = hc + pq;
+        c_pq  = c + pq;
+
+        ptype_pq  = ptype + pq;
+        S_p1      = S + i;
+        S_q1      = S + q + 1;
+
+        for (p = i + 1; p <= max_p; p++) {
+          eval_loop = *hc_pq & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC;
+          /* discard this configuration if (p,q) is not allowed to be enclosed pair of an interior loop */
+          if (eval_loop && evaluate(i, j, p, q, VRNA_DECOMP_PAIR_IL, &hc_dat_local)) {
+            energy = *c_pq;
+            if (energy != INF) {
+              type_2 = rtype[(unsigned char)*ptype_pq];
+
+              if (noGUclosure)
+                if (no_close || (type_2 == 3) || (type_2 == 4))
+                  if ((p > i + 1) || (q < j - 1)) continue;  /* continue unless stack */
+
+              if (type_2 == 0)
+                type_2 = 7;
+
+              energy += ubf_eval_int_loop(i, j, p, q,
+                                          i + 1, j - 1, p - 1, q + 1,
+                                          S_i1, S_j1, *S_p1, *S_q1,
+                                          type, type_2, rtype,
+                                          ij, cp,
+                                          P, sc);
+              e = MIN2(e, energy);
+            }
+          }
+          hc_pq++;    /* get hc[pq + 1] */
+          c_pq++;     /* get c[pq + 1] */
+          p_i++;      /* increase unpaired region [i+1...p-1] */
+
+          ptype_pq++; /* get ptype[pq + 1] */
+          S_p1++;
+
+          pq++;
+        } /* end q-loop */
+      }   /* end p-loop */
+    }
+
+    if (with_gquad) {
+      /* include all cases where a g-quadruplex may be enclosed by base pair (i,j) */
+      if ((!no_close) && (sn[j] == sn[i])) {
+        energy  = E_GQuad_IntLoop(i, j, type, S, ggg, indx, P);
+        e       = MIN2(e, energy);
+      }
+    }
+  }
+
+  return e;
+}
+
+
+PRIVATE INLINE int
+ubf_eval_int_loop_comparative(int             col_i,
+                              int             col_j,
+                              int             col_p,
+                              int             col_q,
+                              unsigned char   type,
+                              unsigned char   type_2,
+                              int             *rtype,
+                              int             ij,
+                              int             cp,
+                              vrna_param_t    *P,
+                              short           *SS,
+                              short           *S5,
+                              short           *S3,
+                              unsigned short  *a2s,
+                              vrna_sc_t       *sc)
+{
+  short si, sj, sp, sq;
+  int   energy, u1, u2;
+  int   i, j, p, q, i1, j1, p1, q1;
+
+  i   = a2s[col_i];
+  j   = a2s[col_j];
+  p   = a2s[col_p];
+  q   = a2s[col_q];
+  i1  = a2s[col_i + 1];
+  j1  = a2s[col_j - 1];
+  p1  = a2s[col_p - 1];
+  q1  = a2s[col_q + 1];
+
+  si  = S3[col_i];
+  sj  = S5[col_j];
+  sp  = S5[col_p];
+  sq  = S3[col_q];
+
+  u1  = p1 - i;
+  u2  = j1 - q;
+
+  energy = E_IntLoop(u1, u2, type, type_2, si, sj, sp, sq, P);
+
+  /* add soft constraints */
+  if (sc) {
+    if (sc->energy_up)
+      energy += sc->energy_up[i1][u1]
+                + sc->energy_up[q1][u2];
+
+    if (sc->energy_bp)
+      energy += sc->energy_bp[ij];
+
+    if (sc->energy_stack) {
+      if (u1 + u2 == 0) {
+        if (SS[col_i] && SS[col_j] && SS[col_p] && SS[col_q]) {
+          /* no gap allowed */
+          int a = sc->energy_stack[i]
+                  + sc->energy_stack[p]
+                  + sc->energy_stack[q]
+                  + sc->energy_stack[j];
+          energy += a;
+        }
+      }
+    }
+    if (sc->f)
+      energy += sc->f(i, j, p, q, VRNA_DECOMP_PAIR_IL, sc->data);
+  }
+
+  return energy;
+}
+
+
+PRIVATE int
+E_int_loop_comparative(vrna_fold_compound_t *vc,
+                       int                  i,
+                       int                  j)
+{
+  unsigned char             type, type_2;
+  char                      *hc_pq, *hc, eval_loop;
+  unsigned short            **a2s;
+  short                     **SS, **S5, **S3, *S_cons;
+  int                       q, p, j_q, p_i, u, pq, *c_pq, min_q, max_q, max_p, tmp,
+                            *rtype, *types, dangle_model, energy, c0, s, n_seq, cp,
+                            *indx, *hc_up, ij, hc_decompose, e, *c, *ggg, with_gquad,
+                            turn;
+  vrna_sc_t                 *sc, **scs;
+  vrna_param_t              *P;
+  vrna_md_t                 *md;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  cp            = vc->cutpoint;
+  indx          = vc->jindx;
+  hc            = vc->hc->matrix;
+  hc_up         = vc->hc->up_int;
+  P             = vc->params;
+  ij            = indx[j] + i;
+  hc_decompose  = hc[ij];
+  e             = INF;
+  c             = vc->matrices->c;
+  ggg           = vc->matrices->ggg;
+  md            = &(P->model_details);
+  with_gquad    = md->gquad;
+  turn          = md->min_loop_size;
+  dangle_model  = md->dangles;
+  types         = NULL;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  /* CONSTRAINED INTERIOR LOOP start */
+  if (hc_decompose & VRNA_CONSTRAINT_CONTEXT_INT_LOOP) {
+    SS      = vc->S;
+    S5      = vc->S5;     /*S5[s][i] holds next base 5' of i in sequence s*/
+    S3      = vc->S3;     /*Sl[s][i] holds next base 3' of i in sequence s*/
+    a2s     = vc->a2s;
+    S_cons  = vc->S_cons;
+    scs     = vc->scs;
+    n_seq   = vc->n_seq;
+    types   = (int *)vrna_alloc(sizeof(int) * n_seq);
+
+    for (s = 0; s < n_seq; s++) {
+      types[s] = md->pair[SS[s][i]][SS[s][j]];
+      if (types[s] == 0)
+        types[s] = 7;
+    }
+
+    /* prepare necessary variables */
+    rtype = &(md->rtype[0]);
+    max_q = i + turn + 2;
+    max_q = MAX2(max_q, j - MAXLOOP - 1);
+
+    for (q = j - 1; q >= max_q; q--) {
+      j_q = j - q - 1;
+
+      if (hc_up[q + 1] < j_q) break;
+
+      pq    = indx[q] + i + 1;
+      p_i   = 0;
+      max_p = i + 1;
+      tmp   = i + 1 + MAXLOOP - j_q;
+      max_p = MAX2(max_p, tmp);
+      tmp   = q - turn;
+      max_p = MIN2(max_p, tmp);
+      tmp   = i + 1 + hc_up[i + 1];
+      max_p = MIN2(max_p, tmp);
+      hc_pq = hc + pq;
+      c_pq  = c + pq;
+
+      for (p = i + 1; p <= max_p; p++) {
+        eval_loop = *hc_pq & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC;
+        /* discard this configuration if (p,q) is not allowed to be enclosed pair of an interior loop */
+        if (eval_loop && evaluate(i, j, p, q, VRNA_DECOMP_PAIR_IL, &hc_dat_local)) {
+          energy = *c_pq;
+          if (energy != INF) {
+            for (s = 0; s < n_seq; s++) {
+              type_2 = md->pair[SS[s][q]][SS[s][p]]; /* q,p not p,q! */
+              if (type_2 == 0)
+                type_2 = 7;
+
+              sc = (scs && scs[s]) ? scs[s] : NULL;
+
+              energy += ubf_eval_int_loop_comparative(i, j, p, q,
+                                                      types[s], type_2, rtype,
+                                                      ij, cp,
+                                                      P,
+                                                      SS[s],
+                                                      S5[s],
+                                                      S3[s],
+                                                      a2s[s],
+                                                      sc);
+            }
+
+            e = MIN2(e, energy);
+          }
+        }
+        hc_pq++;    /* get hc[pq + 1] */
+        c_pq++;     /* get c[pq + 1] */
+        p_i++;      /* increase unpaired region [i+1...p-1] */
+
+        pq++;
+      } /* end q-loop */
+    }   /* end p-loop */
+
+    if (with_gquad) {
+      /* include all cases where a g-quadruplex may be enclosed by base pair (i,j) */
+      energy = 0;
+      for (s = 0; s < n_seq; s++) {
+        type = types[s];
+        if (dangle_model == 2)
+          energy += P->mismatchI[type][S3[s][i]][S5[s][j]];
+        if (type > 2)
+          energy += P->TerminalAU;
+      }
+      for (p = i + 2; p < j - VRNA_GQUAD_MIN_BOX_SIZE; p++) {
+        u = p - i - 1;
+        if (u > MAXLOOP) break;
+        if (S_cons[p] != 3) continue;
+        min_q = j - i + p - MAXLOOP - 2;
+        c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+        min_q = MAX2(c0, min_q);
+        c0    = j - 1;
+        max_q = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+        max_q = MIN2(c0, max_q);
+        for (q = min_q; q < max_q; q++) {
+          if (S_cons[q] != 3) continue;
+          c0  = energy + ggg[indx[q] + p] + n_seq * P->internal_loop[u + j - q - 1];
+          e   = MIN2(e, c0);
+        }
+      }
+
+      p = i + 1;
+      if (S_cons[p] == 3) {
+        if (p < j - VRNA_GQUAD_MIN_BOX_SIZE) {
+          min_q = j - i + p - MAXLOOP - 2;
+          c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+          min_q = MAX2(c0, min_q);
+          c0    = j - 3;
+          max_q = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+          max_q = MIN2(c0, max_q);
+          for (q = min_q; q < max_q; q++) {
+            if (S_cons[q] != 3) continue;
+            c0  = energy + ggg[indx[q] + p] + n_seq * P->internal_loop[j - q - 1];
+            e   = MIN2(e, c0);
+          }
+        }
+      }
+      q = j - 1;
+      if (S_cons[q] == 3) {
+        for (p = i + 4; p < j - VRNA_GQUAD_MIN_BOX_SIZE; p++) {
+          u = p - i - 1;
+          if (u > MAXLOOP) break;
+          if (S_cons[p] != 3) continue;
+          c0  = energy + ggg[indx[q] + p] + n_seq * P->internal_loop[u];
+          e   = MIN2(e, c0);
+        }
+      }
+    }
+  }
+
+  free(types);
+  return e;
+}
+
+
+PRIVATE INLINE int
+eval_interior_loop(vrna_fold_compound_t *vc,
+                   int                  i,
+                   int                  j,
+                   int                  p,
+                   int                  q)
+{
+  int           energy, en, e, e5, e3, u1, u2, i1, j1, p1, q1, *idx;
+  short         *S, si, sj, sp, sq;
+  unsigned char type, type_2;
+  unsigned int  *sn;
+  int           *rtype, ij, cp, *bI;
+  vrna_param_t  *P;
+  vrna_sc_t     *sc;
+  vrna_md_t     *md;
+  vrna_ud_t     *domains_up;
+
+  S           = vc->sequence_encoding;
+  cp          = vc->cutpoint;
+  P           = vc->params;
+  sc          = vc->sc;
+  domains_up  = vc->domains_up;
+  md          = &(P->model_details);
+  sn          = vc->strand_number;
+  rtype       = &(md->rtype[0]);
+  idx         = vc->jindx;
+  type        = md->pair[S[i]][S[j]];
+  type_2      = md->pair[S[q]][S[p]];
+
+  i1  = i + 1;
+  j1  = j - 1;
+  p1  = p - 1;
+  q1  = q + 1;
+  u1  = p1 - i;
+  u2  = j1 - q;
+
+  si  = S[i1];
+  sj  = S[j1];
+  sp  = S[p1];
+  sq  = S[q1];
+  ij  = idx[j] + i;
+
+  if (type == 0)
+    type = 7;
+  if (type_2 == 0)
+    type_2 = 7;
+
+  if ((sn[p] == sn[i]) && (sn[j] == sn[q])) {
+    /* regular interior loop */
+    energy = E_IntLoop(u1, u2, type, type_2, si, sj, sp, sq, P);
+  } else {
+    /* interior loop like cofold structure */
+    short Si, Sj;
+    Si      = (sn[i1] == sn[i]) ? si : -1;
+    Sj      = (sn[j] == sn[j1]) ? sj : -1;
+    energy  = E_IntLoop_Co(rtype[type], rtype[type_2],
+                           i, j, p, q,
+                           cp,
+                           Si, Sj,
+                           sp, sq,
+                           P->model_details.dangles,
+                           P);
+  }
+
+  /* add soft constraints */
+  if (sc) {
+    if (sc->energy_up)
+      energy += sc->energy_up[i1][u1]
+                + sc->energy_up[q1][u2];
+
+    if (sc->energy_bp)
+      energy += sc->energy_bp[ij];
+
+    if (sc->energy_stack) {
+      if (u1 + u2 == 0) {
+        int a = sc->energy_stack[i]
+                + sc->energy_stack[p]
+                + sc->energy_stack[q]
+                + sc->energy_stack[j];
+        energy += a;
+      }
+    }
+    if (sc->f)
+      energy += sc->f(i, j, p, q, VRNA_DECOMP_PAIR_IL, sc->data);
+  }
+
+  e   = energy;
+  e5  = e3 = 0;
+
+  if (u1 > 0) {
+    e5 = domains_up->energy_cb(vc,
+                               i + 1, p - 1,
+                               VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                               domains_up->data);
+  }
+  if (u2 > 0) {
+    e3 = domains_up->energy_cb(vc,
+                               q + 1, j - 1,
+                               VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                               domains_up->data);
+  }
+
+  e = MIN2(e, energy + e5);
+  e = MIN2(e, energy + e3);
+  e = MIN2(e, energy + e5 + e3);
+
+
+  return e;
+}
+
+
+PRIVATE FLT_OR_DBL
+exp_E_int_loop(vrna_fold_compound_t *vc,
+               int                  i,
+               int                  j)
+{
+  unsigned char             type, type_2;
+  char                      *ptype, *hc, eval_loop;
+  short                     *S1, S_i1, S_j1;
+  unsigned int              *sn;
+  int                       k, l, u1, u2, kl, maxk, minl, *rtype, noGUclosure,
+                            no_close, cp, *my_iindx, *jindx, *hc_up, ij,
+                            with_gquad, turn;
+  FLT_OR_DBL                qbt1, q_temp, *qb, *G, *scale;
+  vrna_sc_t                 *sc;
+  vrna_exp_param_t          *pf_params;
+  vrna_md_t                 *md;
+  vrna_ud_t                 *domains_up;
+  vrna_callback_hc_evaluate *evaluate;
+  struct  default_data      hc_dat_local;
+
+  cp          = vc->cutpoint;
+  ptype       = vc->ptype;
+  S1          = vc->sequence_encoding;
+  S_i1        = S1[i + 1];
+  S_j1        = S1[j - 1];
+  my_iindx    = vc->iindx;
+  jindx       = vc->jindx;
+  hc          = vc->hc->matrix;
+  hc_up       = vc->hc->up_int;
+  sc          = vc->sc;
+  sn          = vc->strand_number;
+  pf_params   = vc->exp_params;
+  ij          = jindx[j] + i;
+  md          = &(pf_params->model_details);
+  with_gquad  = md->gquad;
+  turn        = md->min_loop_size;
+  qb          = vc->exp_matrices->qb;
+  G           = vc->exp_matrices->G;
+  scale       = vc->exp_matrices->scale;
+  domains_up  = vc->domains_up;
+  qbt1        = 0.;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  /* CONSTRAINED INTERIOR LOOP start */
+  if (hc[ij] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP) {
+    type        = (unsigned char)ptype[ij];
+    rtype       = &(md->rtype[0]);
+    noGUclosure = md->noGUclosure;
+    no_close    = (((type == 3) || (type == 4)) && noGUclosure);
+    maxk        = i + MAXLOOP + 1;
+    maxk        = MIN2(maxk, j - turn - 2);
+    maxk        = MIN2(maxk, i + 1 + hc_up[i + 1]);
+
+    if (type == 0)
+      type = 7;
+
+    for (k = i + 1; k <= maxk; k++) {
+      if (sn[k] != sn[i])
+        break;
+      u1 = k - i - 1;
+
+      minl  = MAX2(k + turn + 1, j - 1 - MAXLOOP + u1);
+      kl    = my_iindx[k] - j + 1;
+
+      for (u2 = 0, l = j - 1; l >= minl; l--, kl++, u2++) {
+        if (hc_up[l + 1] < u2) break;
+        eval_loop = (hc[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC) ? (char)1 : (char)0;
+
+        /* discard this configuration if (p,q) is not allowed to be enclosed pair of an interior loop */
+        if (eval_loop && evaluate(i, j, k, l, VRNA_DECOMP_PAIR_IL, &hc_dat_local)) {
+          if (sn[j] != sn[l])
+            break;
+          type_2 = rtype[(unsigned char)ptype[jindx[l] + k]];
+
+          if (type_2 == 0)
+            type_2 = 7;
+
+          q_temp = qb[kl]
+                   * scale[u1 + u2 + 2]
+                   * exp_E_IntLoop(u1, u2, type, type_2, S_i1, S_j1, S1[k - 1], S1[l + 1], pf_params);
+
+          /* soft constraints */
+          if (sc) {
+            if (sc->exp_energy_up)
+              q_temp *= sc->exp_energy_up[i + 1][u1]
+                        * sc->exp_energy_up[l + 1][u2];
+
+            if (sc->exp_f)
+              q_temp *= sc->exp_f(i, j, k, l, VRNA_DECOMP_PAIR_IL, sc->data);
+
+            if (sc->exp_energy_stack) {
+              if ((i + 1 == k) && (j - 1 == l)) {
+                q_temp *= sc->exp_energy_stack[i]
+                          * sc->exp_energy_stack[k]
+                          * sc->exp_energy_stack[l]
+                          * sc->exp_energy_stack[j];
+              }
+            }
+          }
+
+          qbt1 += q_temp;
+
+          /* unstructured domains */
+          if (domains_up && domains_up->exp_energy_cb) {
+            FLT_OR_DBL qq5, qq3;
+
+            qq5 = qq3 = 0.;
+
+            if (u1 > 0) {
+              qq5 = domains_up->exp_energy_cb(vc,
+                                              i + 1, k - 1,
+                                              VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                              domains_up->data);
+            }
+
+            if (u2 > 0) {
+              qq3 = domains_up->exp_energy_cb(vc,
+                                              l + 1, j - 1,
+                                              VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                              domains_up->data);
+            }
+
+            qbt1  += q_temp * qq5;        /* only motifs in 5' part */
+            qbt1  += q_temp * qq3;        /* only motifs in 3' part */
+            qbt1  += q_temp * qq5 * qq3;  /* motifs in both parts */
+          }
+        }
+      }
+    }
+
+    if (with_gquad) {
+      /* include all cases where a g-quadruplex may be enclosed by base pair (i,j) */
+      if ((!no_close) && (sn[j] == sn[i]))
+        qbt1 += exp_E_GQuad_IntLoop(i, j, type, S1, G, my_iindx, pf_params)
+                * scale[2];
+    }
+
+    if (sc && sc->exp_energy_bp)
+      qbt1 *= sc->exp_energy_bp[my_iindx[i] - j];
+  }
+  return qbt1;
+}
+
+
+PUBLIC FLT_OR_DBL
+vrna_exp_E_interior_loop(vrna_fold_compound_t *vc,
+                         int                  i,
+                         int                  j,
+                         int                  k,
+                         int                  l)
+{
+  if (vc)
+    return exp_E_interior_loop(vc, i, j, k, l);
+
+  return 0.;
+}
+
+
+PRIVATE FLT_OR_DBL
+exp_E_interior_loop(vrna_fold_compound_t  *vc,
+                    int                   i,
+                    int                   j,
+                    int                   k,
+                    int                   l)
+{
+  unsigned char             type, type_2;
+  char                      *ptype, *hc, eval_loop;
+  short                     *S1, S_i1, S_j1;
+  unsigned int              *sn;
+  int                       u1, u2, kl, maxk, minl, *rtype, noGUclosure,
+                            no_close, cp, *my_iindx, *jindx, *hc_up, ij,
+                            with_gquad, turn;
+  FLT_OR_DBL                qbt1, q_temp, *qb, *G, *scale;
+  vrna_sc_t                 *sc;
+  vrna_exp_param_t          *pf_params;
+  vrna_md_t                 *md;
+  vrna_ud_t                 *domains_up;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  cp          = vc->cutpoint;
+  ptype       = vc->ptype;
+  S1          = vc->sequence_encoding;
+  S_i1        = S1[i + 1];
+  S_j1        = S1[j - 1];
+  my_iindx    = vc->iindx;
+  jindx       = vc->jindx;
+  hc          = vc->hc->matrix;
+  hc_up       = vc->hc->up_int;
+  sc          = vc->sc;
+  pf_params   = vc->exp_params;
+  ij          = jindx[j] + i;
+  kl          = my_iindx[k] - l;
+  sn          = vc->strand_number;
+  md          = &(pf_params->model_details);
+  with_gquad  = md->gquad;
+  turn        = md->min_loop_size;
+  qb          = vc->exp_matrices->qb;
+  G           = vc->exp_matrices->G;
+  scale       = vc->exp_matrices->scale;
+  domains_up  = vc->domains_up;
+  qbt1        = 0.;
+  u1          = k - i - 1;
+  u2          = j - l - 1;
+
+  if ((sn[k] != sn[i]) || (sn[j] != sn[l]))
+    return qbt1;
+
+  if (hc_up[l + 1] < u2)
+    return qbt1;
+  if (hc_up[i + 1] < u1)
+    return qbt1;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  /* CONSTRAINED INTERIOR LOOP start */
+  eval_loop = ((hc[ij] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP) && (hc[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC)) ? (char)1 : (char)0;
+
+  /* discard this configuration if (p,q) is not allowed to be enclosed pair of an interior loop */
+  if (eval_loop && evaluate(i, j, k, l, VRNA_DECOMP_PAIR_IL, &hc_dat_local)) {
+    type        = (unsigned char)ptype[ij];
+    rtype       = &(md->rtype[0]);
+    noGUclosure = md->noGUclosure;
+    no_close    = (((type == 3) || (type == 4)) && noGUclosure);
+    type        = (unsigned char)ptype[ij];
+    type_2      = rtype[(unsigned char)ptype[jindx[l] + k]];
+
+    if (type == 0)
+      type = 7;
+
+    if (type_2 == 0)
+      type_2 = 7;
+
+    q_temp = exp_E_IntLoop(u1, u2, type, type_2, S_i1, S_j1, S1[k - 1], S1[l + 1], pf_params)
+             * scale[u1 + u2 + 2];
+
+    /* soft constraints */
+    if (sc) {
+      if (sc->exp_energy_up)
+        q_temp *= sc->exp_energy_up[i + 1][u1]
+                  * sc->exp_energy_up[l + 1][u2];
+
+      if (sc->exp_f)
+        q_temp *= sc->exp_f(i, j, k, l, VRNA_DECOMP_PAIR_IL, sc->data);
+
+      if (sc->exp_energy_stack) {
+        if ((i + 1 == k) && (j - 1 == l)) {
+          q_temp *= sc->exp_energy_stack[i]
+                    * sc->exp_energy_stack[k]
+                    * sc->exp_energy_stack[l]
+                    * sc->exp_energy_stack[j];
+        }
+      }
+
+      if (sc->exp_energy_bp)
+        q_temp *= sc->exp_energy_bp[my_iindx[i] - j];
+    }
+
+    qbt1 += q_temp;
+
+    /* unstructured domains */
+    if (domains_up && domains_up->exp_energy_cb) {
+      FLT_OR_DBL qq5, qq3;
+
+      qq5 = qq3 = 0.;
+
+      if (u1 > 0) {
+        qq5 = domains_up->exp_energy_cb(vc,
+                                        i + 1, k - 1,
+                                        VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                        domains_up->data);
+      }
+
+      if (u2 > 0) {
+        qq3 = domains_up->exp_energy_cb(vc,
+                                        l + 1, j - 1,
+                                        VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                                        domains_up->data);
+      }
+
+      qbt1  += q_temp * qq5;        /* only motifs in 5' part */
+      qbt1  += q_temp * qq3;        /* only motigs in 3' part */
+      qbt1  += q_temp * qq5 * qq3;  /* motifs in both parts */
+    }
+  }
+  return qbt1;
+}
+
+
+PRIVATE FLT_OR_DBL
+exp_E_int_loop_comparative(vrna_fold_compound_t *vc,
+                           int                  i,
+                           int                  j)
+{
+  unsigned char             type_2;
+  char                      *hc, eval_loop;
+  unsigned short            **a2s;
+  short                     **S, **S5, **S3;
+  int                       n_seq, s, ij, jij, k, l, u1, u2, kl, maxk, minl, *types,
+                            turn, with_gquad, *hc_up, *jindx, *my_iindx;
+  FLT_OR_DBL                qbt1, *qb, *scale, qloop;
+  vrna_sc_t                 **scs;
+  vrna_exp_param_t          *pf_params;
+  vrna_md_t                 *md;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  types       = NULL;
+  my_iindx    = vc->iindx;
+  jindx       = vc->jindx;
+  hc          = vc->hc->matrix;
+  hc_up       = vc->hc->up_int;
+  pf_params   = vc->exp_params;
+  md          = &(pf_params->model_details);
+  with_gquad  = md->gquad;
+  turn        = md->min_loop_size;
+  qb          = vc->exp_matrices->qb;
+  scale       = vc->exp_matrices->scale;
+  qbt1        = 0.;
+  jij         = jindx[j] + i;
+  ij          = my_iindx[i] - j;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  /* CONSTRAINED INTERIOR LOOP start */
+  if (hc[jij] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP) {
+    S     = vc->S;
+    S5    = vc->S5;     /*S5[s][i] holds next base 5' of i in sequence s*/
+    S3    = vc->S3;     /*Sl[s][i] holds next base 3' of i in sequence s*/
+    a2s   = vc->a2s;
+    scs   = vc->scs;
+    n_seq = vc->n_seq;
+    types = (int *)vrna_alloc(sizeof(int) * n_seq);
+
+    for (s = 0; s < n_seq; s++) {
+      types[s] = md->pair[S[s][i]][S[s][j]];
+      if (types[s] == 0)
+        types[s] = 7;
+    }
+
+    /* prepare necessary variables */
+    maxk  = i + MAXLOOP + 1;
+    maxk  = MIN2(maxk, j - turn - 2);
+    maxk  = MIN2(maxk, i + 1 + hc_up[i + 1]);
+
+    for (k = i + 1; k <= maxk; k++) {
+      u1 = k - i - 1;
+
+      minl  = MAX2(k + turn + 1, j - 1 - MAXLOOP + u1);
+      kl    = my_iindx[k] - j + 1;
+
+      for (l = j - 1; l >= minl; l--, kl++, u2++) {
+        if (hc_up[l + 1] < j - l - 1)
+          break;
+
+        eval_loop = (hc[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC) ? (char)1 : (char)0;
+
+        /* discard this configuration if (p,q) is not allowed to be enclosed pair of an interior loop */
+        if (eval_loop && evaluate(i, j, k, l, VRNA_DECOMP_PAIR_IL, &hc_dat_local)) {
+          qloop = 1.;
+
+          for (s = 0; s < n_seq; s++) {
+            u1      = a2s[s][k - 1] - a2s[s][i];
+            u2      = a2s[s][j - 1] - a2s[s][l];
+            type_2  = md->pair[S[s][l]][S[s][k]];
+
+            if (type_2 == 0)
+              type_2 = 7;
+
+            qloop *= exp_E_IntLoop(u1, u2,
+                                   types[s], type_2, S3[s][i],
+                                   S5[s][j], S5[s][k], S3[s][l],
+                                   pf_params
+                                   );
+          }
+
+          if (scs) {
+            for (s = 0; s < n_seq; s++) {
+              if (scs[s]) {
+                u1  = a2s[s][k - 1] - a2s[s][i];
+                u2  = a2s[s][j - 1] - a2s[s][l];
+
+                if (scs[s]->exp_energy_up)
+                  qloop *= scs[s]->exp_energy_up[a2s[s][i] + 1][u1]
+                           * scs[s]->exp_energy_up[a2s[s][l] + 1][u2];
+
+                if (scs[s]->exp_energy_stack) {
+                  if (u1 + u2 == 0) {
+                    if (S[s][i] && S[s][j] && S[s][k] && S[s][l]) {
+                      /* don't allow gaps in stack */
+                      qloop *= scs[s]->exp_energy_stack[i]
+                               * scs[s]->exp_energy_stack[k]
+                               * scs[s]->exp_energy_stack[l]
+                               * scs[s]->exp_energy_stack[j];
+                    }
+                  }
+                }
+              }
+            }
+          }
+
+          qbt1 += qb[my_iindx[k] - l] * qloop * scale[k - i + j - l];
+        }
+      }
+    }
+
+    if (with_gquad) {
+      /* include all cases where a g-quadruplex may be enclosed by base pair (i,j) */
+      /* not implemented yet! */
+    }
+
+    if (scs) {
+      for (s = 0; s < n_seq; s++)
+        if (scs[s] && scs[s]->exp_energy_bp)
+          qbt1 *= scs[s]->exp_energy_bp[ij];
+    }
+  }
+
+  /* cleanup */
+  free(types);
+
+  return qbt1;
+}
+
+
+PUBLIC int
+vrna_E_ext_int_loop(vrna_fold_compound_t  *vc,
+                    int                   i,
+                    int                   j,
+                    int                   *ip,
+                    int                   *iq)
+{
+  unsigned char             type, type_2;
+  int                       ij, q, p, e, s, u1, u2, qmin, energy, *rtype, *types,
+                            length, *indx, *hc_up, *c, turn, n_seq;
+  char                      *ptype, *hc, eval_loop;
+  unsigned short            **a2s;
+  short                     *S, **SS, **S5, **S3;
+  vrna_md_t                 *md;
+  vrna_param_t              *P;
+  vrna_sc_t                 *sc, **scs;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  length  = vc->length;
+  indx    = vc->jindx;
+  ptype   = vc->ptype;
+  c       = vc->matrices->c;
+  hc      = vc->hc->matrix;
+  hc_up   = vc->hc->up_int;
+  P       = vc->params;
+  md      = &(P->model_details);
+  turn    = md->min_loop_size;
+  types   = NULL;
+  ij      = indx[j] + i;
+  rtype   = &(md->rtype[0]);
+  e       = INF;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  /* CONSTRAINED INTERIOR LOOP start */
+  if (hc[ij] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP) {
+    /* prepare necessary variables */
+    switch (vc->type) {
+      case VRNA_FC_TYPE_SINGLE:
+        type = rtype[(unsigned char)ptype[ij]];
+
+        if (type == 0)
+          type = 7;
+
+        S   = vc->sequence_encoding;
+        sc  = vc->sc;
+        break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:
+        SS    = vc->S;
+        S5    = vc->S5;                                 /*S5[s][i] holds next base 5' of i in sequence s*/
+        S3    = vc->S3;                                 /*Sl[s][i] holds next base 3' of i in sequence s*/
+        a2s   = vc->a2s;
+        scs   = vc->scs;
+        n_seq = vc->n_seq;
+        types = (int *)vrna_alloc(sizeof(int) * n_seq);
+
+        for (s = 0; s < n_seq; s++) {
+          types[s] = md->pair[SS[s][j]][SS[s][i]];
+          if (types[s] == 0)
+            types[s] = 7;
+        }
+        break;
+
+      default:
+        return e;
+        break;
+    }
+
+    for (p = j + 1; p < length; p++) {
+      u1 = p - j - 1;
+      if (u1 + i - 1 > MAXLOOP) break;
+      if (hc_up[j + 1] < u1) break;
+
+      qmin = u1 + i - 1 + length - MAXLOOP;
+      if (qmin < p + turn + 1)
+        qmin = p + turn + 1;
+      for (q = length; q >= qmin; q--) {
+        u2 = i - 1 + length - q;
+        if (hc_up[q + 1] < u2)
+          break;
+
+        if (u1 + u2 > MAXLOOP)
+          continue;
+
+        eval_loop = hc[indx[q] + p] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP;
+
+        if (eval_loop && evaluate(i, j, p, q, VRNA_DECOMP_PAIR_IL, &hc_dat_local)) {
+          switch (vc->type) {
+            case VRNA_FC_TYPE_SINGLE:
+              type_2 = rtype[(unsigned char)ptype[indx[q] + p]];
+
+              if (type_2 == 0)
+                type_2 = 7;
+
+              energy = ubf_eval_ext_int_loop(i, j, p, q,
+                                             i - 1, j + 1, p - 1, q + 1,
+                                             S[j + 1], S[i - 1], S[p - 1], S[q + 1],
+                                             type, type_2,
+                                             length,
+                                             P, sc);
+              break;
+
+            case VRNA_FC_TYPE_COMPARATIVE:
+              for (energy = s = 0; s < n_seq; s++) {
+                type_2 = md->pair[SS[s][q]][SS[s][p]];                             /* q,p not p,q! */
+                if (type_2 == 0)
+                  type_2 = 7;
+
+                sc = (scs && scs[s]) ? scs[s] : NULL;
+
+                energy += ubf_eval_ext_int_loop(a2s[s][i], a2s[s][j], a2s[s][p], a2s[s][q],
+                                                a2s[s][i - 1], a2s[s][j + 1], a2s[s][p - 1], a2s[s][q + 1],
+                                                S3[s][j], S5[s][i], S5[s][p], S3[s][q],
+                                                types[s], type_2,
+                                                a2s[s][length],
+                                                P, sc);
+              }
+              break;
+          }
+
+          energy += c[indx[q] + p];
+
+          if (energy < e) {
+            e = energy;
+            if ((ip != NULL) && (iq != NULL)) {
+              *ip = p;
+              *iq = q;
+            }
+          }
+        }
+      }
+    }
+  }
+
+  free(types);
+
+  return e;
+}
+
+
+PUBLIC int
+vrna_E_stack(vrna_fold_compound_t *vc,
+             int                  i,
+             int                  j)
+{
+  unsigned char             type, type_2;
+  char                      *ptype, *hard_constraints, eval_loop;
+  unsigned short            **a2s;
+  short                     *S, **SS;
+  unsigned int              *sn;
+  int                       e, ij, pq, p, q, s, n_seq, cp, *rtype, *indx;
+  vrna_sc_t                 *sc, **scs;
+  vrna_param_t              *P;
+  vrna_md_t                 *md;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  cp                = vc->cutpoint;
+  P                 = vc->params;
+  md                = &(P->model_details);
+  sn                = vc->strand_number;
+  rtype             = &(md->rtype[0]);
+  indx              = vc->jindx;
+  hard_constraints  = vc->hc->matrix;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  e         = INF;
+  p         = i + 1;
+  q         = j - 1;
+  ij        = indx[j] + i;
+  pq        = indx[q] + p;
+  eval_loop = (hard_constraints[pq] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC) && (hard_constraints[ij] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP);
+
+  if ((j - i - 1) < 2)
+    return e;
+
+  if (eval_loop && evaluate(i, j, p, q, VRNA_DECOMP_PAIR_IL, &hc_dat_local)) {
+    switch (vc->type) {
+      case VRNA_FC_TYPE_SINGLE:
+        S       = vc->sequence_encoding;
+        ptype   = vc->ptype;
+        type    = (unsigned char)ptype[ij];
+        type_2  = rtype[(unsigned char)ptype[pq]];
+        sc      = vc->sc;
+
+        if (type == 0)
+          type = 7;
+        if (type_2 == 0)
+          type_2 = 7;
+
+        if ((sn[p] == sn[i]) && (sn[j] == sn[q])) {
+          /* regular stack */
+          e = P->stack[type][type_2];
+        } else {
+          /* stack like cofold structure */
+          short si, sj;
+          si  = (sn[i + 1] == sn[i]) ? S[i + 1] : -1;
+          sj  = (sn[j] == sn[j - 1]) ? S[j - 1] : -1;
+          e   = E_IntLoop_Co(rtype[type], rtype[type_2],
+                             i, j, p, q,
+                             cp,
+                             si, sj,
+                             S[p - 1], S[q + 1],
+                             md->dangles,
+                             P);
+        }
+
+        /* add soft constraints */
+        if (sc) {
+          if (sc->energy_bp)
+            e += sc->energy_bp[ij];
+
+          if (sc->energy_stack) {
+            e += sc->energy_stack[i]
+                 + sc->energy_stack[p]
+                 + sc->energy_stack[q]
+                 + sc->energy_stack[j];
+          }
+
+          if (sc->f)
+            e += sc->f(i, j, p, q, VRNA_DECOMP_PAIR_IL, sc->data);
+        }
+        break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:
+        n_seq = vc->n_seq;
+        SS    = vc->S;
+        a2s   = vc->a2s;
+        scs   = vc->scs;
+        e     = 0;
+        for (s = 0; s < n_seq; s++) {
+          type    = md->pair[SS[s][i]][SS[s][j]];
+          type_2  = md->pair[SS[s][q]][SS[s][p]];                            /* q,p not p,q! */
+          if (type == 0)
+            type = 7;
+          if (type_2 == 0)
+            type_2 = 7;
+          e += P->stack[type][type_2];
+        }
+
+        if (scs) {
+          for (s = 0; s < n_seq; s++) {
+            if (scs[s]) {
+              if (scs[s]->energy_bp)
+                e += scs[s]->energy_bp[ij];
+
+              if (scs[s]->energy_stack) {
+                if (SS[s][i] && SS[s][j] && SS[s][p] && SS[s][q]) {
+                  /* don't allow gaps in stack */
+                  e += scs[s]->energy_stack[a2s[s][i]]
+                       + scs[s]->energy_stack[a2s[s][p]]
+                       + scs[s]->energy_stack[a2s[s][q]]
+                       + scs[s]->energy_stack[a2s[s][j]];
+                }
+              }
+              if (scs[s]->f)
+                e += scs[s]->f(a2s[s][i], a2s[s][j], a2s[s][p], a2s[s][q], VRNA_DECOMP_PAIR_IL, scs[s]->data);
+            }
+          }
+        }
+        break;
+
+      default:
+        break;
+    }
+  }
+
+  return e;
+}
+
+
+PUBLIC int
+vrna_BT_stack(vrna_fold_compound_t  *vc,
+              int                   *i,
+              int                   *j,
+              int                   *en,
+              vrna_bp_stack_t       *bp_stack,
+              int                   *stack_count)
+{
+  unsigned char             type, type_2;
+  char                      *ptype, eval_loop;
+  unsigned int              *sn;
+  int                       ij, p, q, *idx, *my_c, *rtype, cp;
+  vrna_param_t              *P;
+  vrna_md_t                 *md;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  cp    = vc->cutpoint;
+  idx   = vc->jindx;
+  P     = vc->params;
+  md    = &(P->model_details);
+  hc    = vc->hc;
+  sc    = vc->sc;
+  sn    = vc->strand_number;
+  my_c  = vc->matrices->c;
+  ij    = idx[*j] + *i;
+  ptype = vc->ptype;
+  type  = (unsigned char)ptype[ij];
+  rtype = &(md->rtype[0]);
+  p     = *i + 1;
+  q     = *j - 1;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  if (my_c[ij] == *en) {
+    /*  always true, if (i.j) closes canonical structure,
+     * thus (i+1.j-1) must be a pair
+     */
+    eval_loop = (hc->matrix[ij] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP)
+                && (hc->matrix[idx[q] + p] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC);
+
+    if (eval_loop && evaluate(*i, *j, p, q, VRNA_DECOMP_PAIR_IL, &hc_dat_local)) {
+      type_2  = ptype[idx[q] + p];
+      type_2  = rtype[type_2];
+
+      if (type == 0)
+        type = 7;
+      if (type_2 == 0)
+        type_2 = 7;
+
+      if ((sn[p] == sn[*i]) && (sn[*j] == sn[q])) {
+        /* regular stack */
+        *en -= P->stack[type][type_2];
+      } else {
+        /* stack like cofold structure */
+        short si, sj, *S;
+        S   = vc->sequence_encoding;
+        si  = (sn[p] == sn[*i]) ? S[p] : -1;
+        sj  = (sn[*j] == sn[q]) ? S[q] : -1;
+        *en -= E_IntLoop_Co(rtype[type], rtype[type_2],
+                            *i, *j, p, q,
+                            cp,
+                            si, sj,
+                            S[p - 1], S[q + 1],
+                            md->dangles,
+                            P);
+      }
+
+      if (sc) {
+        if (sc->energy_bp)
+          *en -= sc->energy_bp[ij];
+        if (sc->energy_stack) {
+          *en -= sc->energy_stack[*i]
+                 + sc->energy_stack[p]
+                 + sc->energy_stack[q]
+                 + sc->energy_stack[*j];
+        }
+        if (sc->f)
+          *en -= sc->f(*i, *j, p, q, VRNA_DECOMP_PAIR_IL, sc->data);
+      }
+      bp_stack[++(*stack_count)].i  = p;
+      bp_stack[(*stack_count)].j    = q;
+      (*i)++;
+      (*j)--;
+      return 1;
+    }
+  }
+
+  return 0;
+}
+
+
+PUBLIC int
+vrna_BT_int_loop(vrna_fold_compound_t *vc,
+                 int                  *i,
+                 int                  *j,
+                 int                  en,
+                 vrna_bp_stack_t      *bp_stack,
+                 int                  *stack_count)
+{
+  unsigned char             type, type_2;
+  char                      *ptype, eval_loop;
+  short                     *S1;
+  unsigned int              *sn;
+  int                       cp, ij, p, q, minq, turn, *idx, noGUclosure, no_close,
+                            energy, new, *my_c, *rtype;
+  vrna_param_t              *P;
+  vrna_md_t                 *md;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_ud_t                 *domains_up;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  cp          = vc->cutpoint;
+  idx         = vc->jindx;
+  P           = vc->params;
+  md          = &(P->model_details);
+  hc          = vc->hc;
+  sc          = vc->sc;
+  sn          = vc->strand_number;
+  my_c        = vc->matrices->c;
+  turn        = md->min_loop_size;
+  ij          = idx[*j] + *i;
+  ptype       = vc->ptype;
+  type        = (unsigned char)ptype[ij];
+  rtype       = &(md->rtype[0]);
+  S1          = vc->sequence_encoding;
+  noGUclosure = md->noGUclosure;
+  no_close    = (((type == 3) || (type == 4)) && noGUclosure);
+  domains_up  = vc->domains_up;
+
+  if (vc->hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = vc->hc->f;
+    hc_dat_local.hc_dat = vc->hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  if (hc->matrix[ij] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP) {
+    if (type == 0)
+      type = 7;
+
+    if (domains_up && domains_up->energy_cb) {
+      for (p = *i + 1; p <= MIN2(*j - 2 - turn, *i + MAXLOOP + 1); p++) {
+        minq = *j - *i + p - MAXLOOP - 2;
+        if (minq < p + 1 + turn)
+          minq = p + 1 + turn;
+
+        if (hc->up_int[*i + 1] < (p - *i - 1))
+          break;
+
+        for (q = *j - 1; q >= minq; q--) {
+          if (hc->up_int[q + 1] < (*j - q - 1))
+            break;
+
+          type_2    = (unsigned char)ptype[idx[q] + p];
+          eval_loop = hc->matrix[idx[q] + p] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC;
+
+          if (!(eval_loop && evaluate(*i, *j, p, q, VRNA_DECOMP_PAIR_IL, &hc_dat_local)))
+            continue;
+
+          type_2 = rtype[type_2];
+
+          if (type_2 == 0)
+            type_2 = 7;
+
+          if (noGUclosure)
+            if (no_close || (type_2 == 3) || (type_2 == 4))
+              if ((p > *i + 1) || (q < *j - 1))
+                continue;  /* continue unless stack */
+
+          energy  = eval_interior_loop(vc, *i, *j, p, q);
+          new     = energy + my_c[idx[q] + p];
+
+          if (new == en) {
+            bp_stack[++(*stack_count)].i  = p;
+            bp_stack[(*stack_count)].j    = q;
+            if (sc) {
+              if (sc->bt) {
+                vrna_basepair_t *ptr, *aux_bps;
+                aux_bps = sc->bt(*i, *j, p, q, VRNA_DECOMP_PAIR_IL, sc->data);
+                for (ptr = aux_bps; ptr && ptr->i != 0; ptr++) {
+                  bp_stack[++(*stack_count)].i  = ptr->i;
+                  bp_stack[(*stack_count)].j    = ptr->j;
+                }
+                free(aux_bps);
+              }
+            }
+            *i = p, *j = q;
+            return 1; /* success */
+          }
+        }
+      }
+    } else {
+      for (p = *i + 1; p <= MIN2(*j - 2 - turn, *i + MAXLOOP + 1); p++) {
+        minq = *j - *i + p - MAXLOOP - 2;
+        if (minq < p + 1 + turn)
+          minq = p + 1 + turn;
+
+        if (hc->up_int[*i + 1] < (p - *i - 1))
+          break;
+
+        for (q = *j - 1; q >= minq; q--) {
+          if (hc->up_int[q + 1] < (*j - q - 1))
+            break;
+
+          type_2 = (unsigned char)ptype[idx[q] + p];
+
+          eval_loop = hc->matrix[idx[q] + p] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC;
+
+          if (!(eval_loop && evaluate(*i, *j, p, q, VRNA_DECOMP_PAIR_IL, &hc_dat_local)))
+            continue;
+
+          type_2 = rtype[type_2];
+
+          if (type_2 == 0)
+            type_2 = 7;
+
+          if (noGUclosure)
+            if (no_close || (type_2 == 3) || (type_2 == 4))
+              if ((p > *i + 1) || (q < *j - 1))
+                continue;  /* continue unless stack */
+
+          energy = ubf_eval_int_loop(*i, *j, p, q,
+                                     (*i) + 1, (*j) - 1, p - 1, q + 1,
+                                     S1[*i + 1], S1[*j - 1], S1[p - 1], S1[q + 1],
+                                     type, type_2,
+                                     rtype,
+                                     ij,
+                                     -1,
+                                     P,
+                                     sc);
+          new = energy + my_c[idx[q] + p];
+
+          if (new == en) {
+            bp_stack[++(*stack_count)].i  = p;
+            bp_stack[(*stack_count)].j    = q;
+            if (sc) {
+              if (sc->bt) {
+                vrna_basepair_t *ptr, *aux_bps;
+                aux_bps = sc->bt(*i, *j, p, q, VRNA_DECOMP_PAIR_IL, sc->data);
+                for (ptr = aux_bps; ptr && ptr->i != 0; ptr++) {
+                  bp_stack[++(*stack_count)].i  = ptr->i;
+                  bp_stack[(*stack_count)].j    = ptr->j;
+                }
+                free(aux_bps);
+              }
+            }
+            *i = p, *j = q;
+            return 1; /* success */
+          }
+        }
+      }
+    }
+  }
+
+  /* is it a g-quadruplex? */
+  if (md->gquad) {
+    /*
+     * The case that is handled here actually resembles something like
+     * an interior loop where the enclosing base pair is of regular
+     * kind and the enclosed pair is not a canonical one but a g-quadruplex
+     * that should then be decomposed further...
+     */
+    if (sn[*j] == sn[*i]) {
+      if (vrna_BT_gquad_int(vc, *i, *j, en, bp_stack, stack_count)) {
+        *i = *j = -1; /* tell the calling block to continue backtracking with next block */
+        return 1;
+      }
+    }
+  }
+
+  return 0; /* unsuccessful */
+}
+
+
+PRIVATE char
+hc_default(int  i,
+           int  j,
+           int  k,
+           int  l,
+           char d,
+           void *data)
+{
+  return (char)1;
+}
+
+
+PRIVATE char
+hc_default_user(int   i,
+                int   j,
+                int   k,
+                int   l,
+                char  d,
+                void  *data)
+{
+  struct default_data *dat = (struct default_data *)data;
+
+  return dat->hc_f(i, j, k, l, d, dat->hc_dat);
+}
diff --git a/C/ViennaRNA/interior_loops.h b/C/ViennaRNA/interior_loops.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/interior_loops.h
@@ -0,0 +1,532 @@
+#ifndef VIENNA_RNA_PACKAGE_INTERIOR_LOOPS_H
+#define VIENNA_RNA_PACKAGE_INTERIOR_LOOPS_H
+
+#include <ViennaRNA/utils.h>
+#include "ViennaRNA/energy_par.h"
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+#include <ViennaRNA/constraints.h>
+
+#ifdef __GNUC__
+# define INLINE inline
+#else
+# define INLINE
+#endif
+
+#ifdef ON_SAME_STRAND
+#undef ON_SAME_STRAND
+#endif
+
+#define ON_SAME_STRAND(I,J,C)  (((I)>=(C))||((J)<(C)))
+
+/**
+ *  @file     interior_loops.h
+ *  @ingroup  loops
+ *  @brief    Energy evaluation of interior loops for MFE and partition function calculations
+ */
+
+/**
+ *  @{
+ *  @ingroup   loops
+ */
+
+/**
+ *  <H2>Compute the Energy of an interior-loop</H2>
+ *  This function computes the free energy @f$\Delta G@f$ of an interior-loop with the
+ *  following structure: <BR>
+ *  <PRE>
+ *        3'  5'
+ *        |   |
+ *        U - V
+ *    a_n       b_1
+ *     .        .
+ *     .        .
+ *     .        .
+ *    a_1       b_m
+ *        X - Y
+ *        |   |
+ *        5'  3'
+ *  </PRE>
+ *  This general structure depicts an interior-loop that is closed by the base pair (X,Y).
+ *  The enclosed base pair is (V,U) which leaves the unpaired bases a_1-a_n and b_1-b_n
+ *  that constitute the loop. In this example, the length of the interior-loop is @f$(n+m)@f$
+ *  where n or m may be 0 resulting in a bulge-loop or base pair stack.
+ *  The mismatching nucleotides for the closing pair (X,Y) are:<BR>
+ *  5'-mismatch: a_1<BR>
+ *  3'-mismatch: b_m<BR>
+ *  and for the enclosed base pair (V,U):<BR>
+ *  5'-mismatch: b_1<BR>
+ *  3'-mismatch: a_n<BR>
+ *  @note Base pairs are always denoted in 5'->3' direction. Thus the enclosed base pair
+ *  must be 'turned arround' when evaluating the free energy of the interior-loop
+ *  @see scale_parameters()
+ *  @see vrna_param_t
+ *  @note This function is threadsafe
+ * 
+ *  @param  n1      The size of the 'left'-loop (number of unpaired nucleotides)
+ *  @param  n2      The size of the 'right'-loop (number of unpaired nucleotides)
+ *  @param  type    The pair type of the base pair closing the interior loop
+ *  @param  type_2  The pair type of the enclosed base pair
+ *  @param  si1     The 5'-mismatching nucleotide of the closing pair
+ *  @param  sj1     The 3'-mismatching nucleotide of the closing pair
+ *  @param  sp1     The 3'-mismatching nucleotide of the enclosed pair
+ *  @param  sq1     The 5'-mismatching nucleotide of the enclosed pair
+ *  @param  P       The datastructure containing scaled energy parameters
+ *  @return The Free energy of the Interior-loop in dcal/mol
+ */
+PRIVATE INLINE int E_IntLoop(int n1,
+                              int n2,
+                              int type,
+                              int type_2,
+                              int si1,
+                              int sj1,
+                              int sp1,
+                              int sq1,
+                              vrna_param_t *P);
+
+/**
+ *  <H2>Compute Boltzmann weight @f$e^{-\Delta G/kT} @f$ of interior loop</H2>
+ *  multiply by scale[u1+u2+2] for scaling
+ *  @see get_scaled_pf_parameters()
+ *  @see vrna_exp_param_t
+ *  @see E_IntLoop()
+ *  @note This function is threadsafe
+ * 
+ *  @param  u1      The size of the 'left'-loop (number of unpaired nucleotides)
+ *  @param  u2      The size of the 'right'-loop (number of unpaired nucleotides)
+ *  @param  type    The pair type of the base pair closing the interior loop
+ *  @param  type2   The pair type of the enclosed base pair
+ *  @param  si1     The 5'-mismatching nucleotide of the closing pair
+ *  @param  sj1     The 3'-mismatching nucleotide of the closing pair
+ *  @param  sp1     The 3'-mismatching nucleotide of the enclosed pair
+ *  @param  sq1     The 5'-mismatching nucleotide of the enclosed pair
+ *  @param  P       The datastructure containing scaled Boltzmann weights of the energy parameters
+ *  @return The Boltzmann weight of the Interior-loop
+ */
+PRIVATE INLINE FLT_OR_DBL exp_E_IntLoop(int u1,
+                                        int u2,
+                                        int type,
+                                        int type2,
+                                        short si1,
+                                        short sj1,
+                                        short sp1,
+                                        short sq1,
+                                        vrna_exp_param_t *P);
+
+
+PRIVATE INLINE int E_IntLoop_Co(int type,
+                                int type_2,
+                                int i,
+                                int j,
+                                int p,
+                                int q,
+                                int cutpoint,
+                                short si1,
+                                short sj1,
+                                short sp1,
+                                short sq1,
+                                int dangles,
+                                vrna_param_t *P);
+
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+/*
+ *  ugly but fast interior loop evaluation
+ *
+ *  Avoid including this function in your own code. It only serves
+ *  as a fast inline block internally re-used throughout the RNAlib. It
+ *  evalutes the free energy of interior loops in single sequences or sequence
+ *  hybrids. Soft constraints are also applied if available.
+ *
+ *  NOTE: do not include into doxygen reference manual!
+ */
+PRIVATE INLINE int
+ubf_eval_int_loop(  int i,
+                    int j,
+                    int p,
+                    int q,
+                    int i1,
+                    int j1,
+                    int p1,
+                    int q1,
+                    short si,
+                    short sj,
+                    short sp,
+                    short sq,
+                    unsigned char type,
+                    unsigned char type_2,
+                    int *rtype,
+                    int ij,
+                    int cp,
+                    vrna_param_t *P,
+                    vrna_sc_t *sc){
+
+  int energy, u1, u2;
+
+  u1 = p1 - i;
+  u2 = j1 - q;
+
+  if((cp < 0) || (ON_SAME_STRAND(i, p, cp) && ON_SAME_STRAND(q, j, cp))){ /* regular interior loop */
+    energy = E_IntLoop(u1, u2, type, type_2, si, sj, sp, sq, P);
+  } else { /* interior loop like cofold structure */
+    short Si, Sj;
+    Si  = ON_SAME_STRAND(i, i1, cp) ? si : -1;
+    Sj  = ON_SAME_STRAND(j1, j, cp) ? sj : -1;
+    energy = E_IntLoop_Co(rtype[type], rtype[type_2],
+                            i, j, p, q,
+                            cp,
+                            Si, Sj,
+                            sp, sq,
+                            P->model_details.dangles,
+                            P);
+  }
+
+  /* add soft constraints */
+  if(sc){
+    if(sc->energy_up)
+      energy += sc->energy_up[i1][u1]
+                + sc->energy_up[q1][u2];
+
+    if(sc->energy_bp)
+      energy += sc->energy_bp[ij];
+
+    if(sc->energy_stack)
+      if(u1 + u2 == 0){
+        int a =   sc->energy_stack[i]
+                  + sc->energy_stack[p]
+                  + sc->energy_stack[q]
+                  + sc->energy_stack[j];
+        energy += a;
+      }
+    if(sc->f)
+      energy += sc->f(i, j, p, q, VRNA_DECOMP_PAIR_IL, sc->data);
+  }
+
+  return energy;
+
+}
+
+/*
+ *  ugly but fast exterior interior loop evaluation
+ *
+ *  Avoid including this function in your own code. It only serves
+ *  as a fast inline block internally re-used throughout the RNAlib. It
+ *  evalutes the free energy of interior loops in single sequences or sequence
+ *  hybrids. Soft constraints are also applied if available.
+ *
+ *  NOTE: do not include into doxygen reference manual!
+ */
+PRIVATE INLINE int
+ubf_eval_ext_int_loop(int i,
+                      int j,
+                      int p,
+                      int q,
+                      int i1,
+                      int j1,
+                      int p1,
+                      int q1,
+                      short si,
+                      short sj,
+                      short sp,
+                      short sq,
+                      unsigned char type,
+                      unsigned char type_2,
+                      int length,
+                      vrna_param_t *P,
+                      vrna_sc_t *sc){
+
+  int energy, u1, u2, u3;
+  
+  u1 = i1;
+  u2 = p1 - j;
+  u3 = length - q;
+
+  energy = E_IntLoop(u2, u1 + u3, type, type_2, si, sj, sp, sq, P);
+
+  /* add soft constraints */
+  if(sc){
+    if(sc->energy_up){
+      energy += sc->energy_up[j1][u2]
+                + ((u3 > 0) ? sc->energy_up[q1][u3] : 0)
+                + ((u1 > 0) ? sc->energy_up[1][u1] : 0);
+    }
+    if(sc->energy_stack)
+      if(u1 + u2 + u3 == 0)
+        energy +=   sc->energy_stack[i]
+                  + sc->energy_stack[p]
+                  + sc->energy_stack[q]
+                  + sc->energy_stack[j];
+
+    if(sc->f)
+      energy += sc->f(i, j, p, q, VRNA_DECOMP_PAIR_IL, sc->data);
+  }
+
+  return energy;
+
+}
+
+PRIVATE INLINE int
+E_IntLoop(int n1,
+          int n2,
+          int type,
+          int type_2,
+          int si1,
+          int sj1,
+          int sp1,
+          int sq1,
+          vrna_param_t *P){
+
+  /* compute energy of degree 2 loop (stack bulge or interior) */
+  int nl, ns, u, energy;
+  energy = INF;
+
+  if (n1>n2) { nl=n1; ns=n2;}
+  else {nl=n2; ns=n1;}
+
+  if (nl == 0)
+    return P->stack[type][type_2];  /* stack */
+
+  if (ns==0) {                      /* bulge */
+    energy = (nl<=MAXLOOP)?P->bulge[nl]:
+      (P->bulge[30]+(int)(P->lxc*log(nl/30.)));
+    if (nl==1) energy += P->stack[type][type_2];
+    else {
+      if (type>2) energy += P->TerminalAU;
+      if (type_2>2) energy += P->TerminalAU;
+    }
+    return energy;
+  }
+  else {                            /* interior loop */
+    if (ns==1) {
+      if (nl==1)                    /* 1x1 loop */
+        return P->int11[type][type_2][si1][sj1];
+      if (nl==2) {                  /* 2x1 loop */
+        if (n1==1)
+          energy = P->int21[type][type_2][si1][sq1][sj1];
+        else
+          energy = P->int21[type_2][type][sq1][si1][sp1];
+        return energy;
+      }
+      else {  /* 1xn loop */
+        energy = (nl+1<=MAXLOOP)?(P->internal_loop[nl+1]) : (P->internal_loop[30]+(int)(P->lxc*log((nl+1)/30.)));
+        energy += MIN2(MAX_NINIO, (nl-ns)*P->ninio[2]);
+        energy += P->mismatch1nI[type][si1][sj1] + P->mismatch1nI[type_2][sq1][sp1];
+        return energy;
+      }
+    }
+    else if (ns==2) {
+      if(nl==2)      {              /* 2x2 loop */
+        return P->int22[type][type_2][si1][sp1][sq1][sj1];}
+      else if (nl==3){              /* 2x3 loop */
+        energy = P->internal_loop[5]+P->ninio[2];
+        energy += P->mismatch23I[type][si1][sj1] + P->mismatch23I[type_2][sq1][sp1];
+        return energy;
+      }
+
+    }
+    { /* generic interior loop (no else here!)*/
+      u = nl + ns;
+      energy = (u <= MAXLOOP) ? (P->internal_loop[u]) : (P->internal_loop[30]+(int)(P->lxc*log((u)/30.)));
+
+      energy += MIN2(MAX_NINIO, (nl-ns)*P->ninio[2]);
+
+      energy += P->mismatchI[type][si1][sj1] + P->mismatchI[type_2][sq1][sp1];
+    }
+  }
+  return energy;
+}
+
+PRIVATE INLINE FLT_OR_DBL
+exp_E_IntLoop(int u1,
+              int u2,
+              int type,
+              int type2,
+              short si1,
+              short sj1,
+              short sp1,
+              short sq1,
+              vrna_exp_param_t *P){
+
+  int ul, us, no_close = 0;
+  double z = 0.;
+  int noGUclosure = P->model_details.noGUclosure;
+
+  if ((noGUclosure) && ((type2==3)||(type2==4)||(type==3)||(type==4)))
+    no_close = 1;
+
+  if (u1>u2) { ul=u1; us=u2;}
+  else {ul=u2; us=u1;}
+
+  if (ul==0) /* stack */
+    z = P->expstack[type][type2];
+  else if(!no_close){
+    if (us==0) {                      /* bulge */
+      z = P->expbulge[ul];
+      if (ul==1) z *= P->expstack[type][type2];
+      else {
+        if (type>2) z *= P->expTermAU;
+        if (type2>2) z *= P->expTermAU;
+      }
+      return (FLT_OR_DBL)z;
+    }
+    else if (us==1) {
+      if (ul==1){                    /* 1x1 loop */
+        return (FLT_OR_DBL)(P->expint11[type][type2][si1][sj1]);
+      }
+      if (ul==2) {                  /* 2x1 loop */
+        if (u1==1)
+          return (FLT_OR_DBL)(P->expint21[type][type2][si1][sq1][sj1]);
+        else
+          return (FLT_OR_DBL)(P->expint21[type2][type][sq1][si1][sp1]);
+      }
+      else {  /* 1xn loop */
+        z = P->expinternal[ul+us] * P->expmismatch1nI[type][si1][sj1] * P->expmismatch1nI[type2][sq1][sp1];
+        return (FLT_OR_DBL)(z * P->expninio[2][ul-us]);
+      }
+    }
+    else if (us==2) {
+      if(ul==2) /* 2x2 loop */
+        return (FLT_OR_DBL)(P->expint22[type][type2][si1][sp1][sq1][sj1]);
+      else if(ul==3){              /* 2x3 loop */
+        z = P->expinternal[5]*P->expmismatch23I[type][si1][sj1]*P->expmismatch23I[type2][sq1][sp1];
+        return (FLT_OR_DBL)(z * P->expninio[2][1]);
+      }
+    }
+    /* generic interior loop (no else here!)*/
+    z = P->expinternal[ul+us] * P->expmismatchI[type][si1][sj1] * P->expmismatchI[type2][sq1][sp1];
+    return (FLT_OR_DBL)(z * P->expninio[2][ul-us]);
+
+  }
+  return (FLT_OR_DBL)z;
+}
+
+PRIVATE INLINE int
+E_IntLoop_Co( int type,
+              int type_2,
+              int i,
+              int j,
+              int p,
+              int q,
+              int cutpoint,
+              short si1,
+              short sj1,
+              short sp1,
+              short sq1,
+              int dangles,
+              vrna_param_t *P){
+
+  int energy, ci, cj, cp, cq, d3, d5, d5_2, d3_2, tmm, tmm_2;
+
+  energy = 0;
+  if(type > 2)   energy += P->TerminalAU;
+  if(type_2 > 2) energy += P->TerminalAU;
+
+  if(!dangles) return energy;
+
+  ci = ON_SAME_STRAND(i, i + 1, cutpoint);
+  cj = ON_SAME_STRAND(j - 1, j, cutpoint);
+  cp = ON_SAME_STRAND(p - 1, p, cutpoint);
+  cq = ON_SAME_STRAND(q, q + 1, cutpoint);
+
+  d3    = ci  ? P->dangle3[type][si1]   : 0;
+  d5    = cj  ? P->dangle5[type][sj1]   : 0;
+  d5_2  = cp  ? P->dangle5[type_2][sp1] : 0;
+  d3_2  = cq  ? P->dangle3[type_2][sq1] : 0;
+
+  tmm   = (cj && ci) ? P->mismatchExt[type][sj1][si1]   : d5 + d3;
+  tmm_2 = (cp && cq) ? P->mismatchExt[type_2][sp1][sq1] : d5_2 + d3_2;
+
+  if(dangles == 2) return energy + tmm + tmm_2;
+
+  /* now we may have non-double dangles only */
+  if(i+2 < p){
+    if(q+2 < j){ energy += tmm + tmm_2;}
+    else if(q+2 == j){ energy += (cj && cq) ? MIN2(tmm + d5_2, tmm_2 + d3) : tmm + tmm_2;}
+    else energy += d3 + d5_2;
+  }
+  else if(i+2 == p){
+    if(q+2 < j){ energy += (ci && cp) ? MIN2(tmm + d3_2, tmm_2 + d5) : tmm + tmm_2;}
+    else if(q+2 == j){
+      energy += MIN2(tmm, MIN2(tmm_2, MIN2(d5 + d5_2, d3 + d3_2)));
+    }
+    else energy += MIN2(d3, d5_2);
+  }
+  else{
+    if(q+2 < j){ energy += d5 + d3_2;}
+    else if(q+2 == j){ energy += MIN2(d5, d3_2);}
+  }
+  return energy;
+}
+
+int
+vrna_E_int_loop(vrna_fold_compound_t *vc,
+                int i,
+                int j);
+
+int
+vrna_eval_int_loop( vrna_fold_compound_t *vc,
+                    int i,
+                    int j,
+                    int k,
+                    int l);
+
+FLT_OR_DBL
+vrna_exp_E_int_loop(vrna_fold_compound_t *vc,
+                int i,
+                int j);
+
+FLT_OR_DBL
+vrna_exp_E_interior_loop( vrna_fold_compound_t *vc,
+                          int i,
+                          int j,
+                          int k,
+                          int l);
+
+int
+vrna_E_ext_int_loop(vrna_fold_compound_t *vc,
+                    int i,
+                    int j,
+                    int *ip,
+                    int *iq);
+
+int
+vrna_E_stack( vrna_fold_compound_t *vc,
+              int i,
+              int j);
+
+
+/**
+ *  @brief Backtrack a stacked pair closed by @f$ (i,j) @f$
+ *
+ */
+int
+vrna_BT_stack(vrna_fold_compound_t *vc,
+              int *i,
+              int *j,
+              int *en,
+              vrna_bp_stack_t *bp_stack,
+              int *stack_count);
+/**
+ *  @brief Backtrack an interior loop closed by @f$ (i,j) @f$
+ *
+ */
+int
+vrna_BT_int_loop( vrna_fold_compound_t *vc,
+                  int *i,
+                  int *j,
+                  int en,
+                  vrna_bp_stack_t *bp_stack,
+                  int *stack_count);
+
+
+/**
+ * @}
+ */
+
+
+#endif
diff --git a/C/ViennaRNA/intl11.h b/C/ViennaRNA/intl11.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/intl11.h
@@ -0,0 +1,393 @@
+PUBLIC int int11_37[NBPAIRS+1][NBPAIRS+1][5][5] =
+{{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{    90,    90,    50,    50,    50}
+  ,{    90,    90,    50,    50,    50}
+  ,{    50,    50,    50,    50,    50}
+  ,{    50,    50,    50,  -140,    50}
+  ,{    50,    50,    50,    50,    40}
+  }
+ ,{{    90,    90,    50,    50,    60}
+  ,{    90,    90,   -40,    50,    50}
+  ,{    60,    30,    50,    50,    60}
+  ,{    50,   -10,    50,  -220,    50}
+  ,{    50,    50,     0,    50,   -10}
+  }
+ ,{{   120,   120,   120,   120,   120}
+  ,{   120,    60,    50,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   -20,   120,  -140,   120}
+  ,{   120,   120,   100,   120,   110}
+  }
+ ,{{   220,   220,   170,   120,   120}
+  ,{   220,   220,   130,   120,   120}
+  ,{   170,   120,   170,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,   110}
+  }
+ ,{{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,    80}
+  }
+ ,{{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,   120}
+  }
+ ,{{   220,   220,   170,   120,   120}
+  ,{   220,   220,   130,   120,   120}
+  ,{   170,   120,   170,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,   120}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{    90,    90,    60,    50,    50}
+  ,{    90,    90,    30,   -10,    50}
+  ,{    50,   -40,    50,    50,     0}
+  ,{    50,    50,    50,  -220,    50}
+  ,{    60,    50,    60,    50,   -10}
+  }
+ ,{{    80,    80,    50,    50,    50}
+  ,{    80,    80,    50,    50,    50}
+  ,{    50,    50,    50,    50,    50}
+  ,{    50,    50,    50,  -230,    50}
+  ,{    50,    50,    50,    50,   -60}
+  }
+ ,{{   190,   190,   120,   150,   150}
+  ,{   190,   190,   120,   150,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   150,   120,   120,   120,   150}
+  }
+ ,{{   160,   160,   120,   120,   120}
+  ,{   160,   160,   120,   100,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,    70}
+  }
+ ,{{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,    80}
+  }
+ ,{{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,   120}
+  }
+ ,{{   190,   190,   120,   150,   150}
+  ,{   190,   190,   120,   150,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   150,   120,   120,   120,   150}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   120,   120,   120,   120,   120}
+  ,{   120,    60,   120,   -20,   120}
+  ,{   120,    50,   120,   120,   100}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,   110}
+  }
+ ,{{   190,   190,   120,   120,   150}
+  ,{   190,   190,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   150,   150,   120,  -140,   120}
+  ,{   150,   120,   120,   120,   150}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   120}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   160}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   120}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   160}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   160}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   220,   220,   170,   120,   120}
+  ,{   220,   220,   120,   120,   120}
+  ,{   170,   130,   170,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,   110}
+  }
+ ,{{   160,   160,   120,   120,   120}
+  ,{   160,   160,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   100,   120,  -140,   120}
+  ,{   120,   120,   120,   120,    70}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   160}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   190}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   160}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   190}
+  }
+ ,{{   220,   220,   190,   190,   190}
+  ,{   220,   220,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   190}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,    80}
+  }
+ ,{{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,    80}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   120}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   160}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   120}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   150}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   160}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,   120}
+  }
+ ,{{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,   120}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   160}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   190}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   150}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   170}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   190}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   220,   220,   170,   120,   120}
+  ,{   220,   220,   120,   120,   120}
+  ,{   170,   130,   170,   120,   120}
+  ,{   120,   120,   120,  -140,   120}
+  ,{   120,   120,   120,   120,   120}
+  }
+ ,{{   190,   190,   120,   120,   150}
+  ,{   190,   190,   120,   120,   120}
+  ,{   120,   120,   120,   120,   120}
+  ,{   150,   150,   120,  -140,   120}
+  ,{   150,   120,   120,   120,   150}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   160}
+  }
+ ,{{   220,   220,   190,   190,   190}
+  ,{   220,   220,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   190}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   160}
+  }
+ ,{{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   190}
+  }
+ ,{{   220,   220,   190,   190,   190}
+  ,{   220,   220,   190,   190,   190}
+  ,{   190,   190,   190,   190,   190}
+  ,{   190,   190,   190,   -70,   190}
+  ,{   190,   190,   190,   190,   190}
+  }
+ }};
diff --git a/C/ViennaRNA/intl11dH.h b/C/ViennaRNA/intl11dH.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/intl11dH.h
@@ -0,0 +1,393 @@
+PUBLIC int int11_dH[NBPAIRS+1][NBPAIRS+1][5][5] =
+{{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1840, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1050}
+  }
+ ,{{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1840, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1390}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -890}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -890}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1840, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1390}
+  }
+ ,{{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1050}
+  ,{ -1050, -1050, -1050, -1840, -1050}
+  ,{ -1050, -1050, -1050, -1050, -1730}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550, -1230}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -890}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550, -1230}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -890}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -890}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -890}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550, -1230}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -730}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -730}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -890}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -890}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550, -1230}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -730}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -730}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -890}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  }
+ }
+,{{{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  ,{   INF,   INF,   INF,   INF,   INF}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  }
+ ,{{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550,  -550,  -550}
+  ,{  -550,  -550,  -550, -1340,  -550}
+  ,{  -550,  -550,  -550,  -550,  -890}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,  -390}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  }
+ ,{{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  ,{   -50,   -50,   -50,  -830,   -50}
+  ,{   -50,   -50,   -50,   -50,   -50}
+  }
+ }};
diff --git a/C/ViennaRNA/intl21.h b/C/ViennaRNA/intl21.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/intl21.h
@@ -0,0 +1,1993 @@
+PUBLIC int int21_37[NBPAIRS+1][NBPAIRS+1][5][5][5] =
+{{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   }
+  ,{{   230,   230,   230,   110,   230}
+   ,{   230,   230,   230,   110,   230}
+   ,{   230,   230,   230,   110,   230}
+   ,{   110,   110,   110,   110,   110}
+   ,{   230,   230,   230,   110,   230}
+   }
+  ,{{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   }
+  ,{{   230,   110,   230,   110,   230}
+   ,{   110,   110,   110,   110,   110}
+   ,{   230,   110,   230,   110,   230}
+   ,{   110,   110,   110,   110,   110}
+   ,{   230,   110,   230,   110,   230}
+   }
+  ,{{   230,   230,   230,   230,   150}
+   ,{   230,   230,   230,   230,   150}
+   ,{   230,   230,   230,   230,   150}
+   ,{   230,   230,   230,   230,   150}
+   ,{   150,   150,   150,   150,   150}
+   }
+  }
+ ,{{{   250,   250,   250,   230,   230}
+   ,{   250,   250,   230,   230,   230}
+   ,{   250,   230,   250,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   250,   250,   230,   230,   230}
+   }
+  ,{{   250,   250,   230,   110,   230}
+   ,{   250,   250,   230,   110,   230}
+   ,{   230,   230,   170,   110,   230}
+   ,{   110,    80,   110,   110,   110}
+   ,{   230,   230,   230,   110,   230}
+   }
+  ,{{   250,   250,   250,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   250,   230,   250,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   250,   250,   230,   230,   230}
+   }
+  ,{{   230,   170,   230,   110,   230}
+   ,{   230,   170,   230,    80,   230}
+   ,{   230,   110,   230,   110,   230}
+   ,{   120,   120,   110,   110,   110}
+   ,{   230,   110,   230,   110,   230}
+   }
+  ,{{   230,   230,   230,   230,   150}
+   ,{   230,   230,   230,   230,   150}
+   ,{   230,   230,   220,   230,   150}
+   ,{   230,   230,   230,   230,   150}
+   ,{   170,   150,   170,   150,   140}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   250,   250,   230,   230,   230}
+   ,{   250,   250,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   }
+  ,{{   250,   250,   230,   230,   230}
+   ,{   250,   250,   230,   210,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   120,   120,   110,   110,   110}
+   ,{   230,   230,   230,   230,   230}
+   }
+  ,{{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   190,   230,   230}
+   }
+  ,{{   230,   110,   230,   110,   230}
+   ,{   110,   110,   110,   110,   110}
+   ,{   230,   110,   230,   110,   230}
+   ,{   110,   110,   110,   110,   110}
+   ,{   230,   110,   230,   110,   230}
+   }
+  ,{{   230,   230,   230,   230,   150}
+   ,{   230,   230,   230,   230,   150}
+   ,{   230,   230,   230,   230,   150}
+   ,{   230,   230,   230,   230,   150}
+   ,{   150,   150,   150,   150,   150}
+   }
+  }
+ ,{{{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   }
+  ,{{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   110,   110,   110,   110,   110}
+   ,{   230,   230,   230,   230,   230}
+   }
+  ,{{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   ,{   230,   230,   230,   230,   230}
+   }
+  ,{{   230,   110,   230,   110,   230}
+   ,{   230,   110,   230,   110,   230}
+   ,{   230,   110,   230,   110,   230}
+   ,{   110,   110,   110,   110,   110}
+   ,{   230,   110,   230,   110,   230}
+   }
+  ,{{   230,   230,   230,   230,   150}
+   ,{   230,   230,   230,   230,   150}
+   ,{   230,   230,   230,   230,   150}
+   ,{   230,   230,   230,   230,   150}
+   ,{   150,   150,   150,   150,   150}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   250,   300,   210,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   190,   120,   190,   190,   190}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   190,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   250,   300,   210,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   190,   120,   190,   190,   190}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   190,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   250,   370,   210,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   120,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   190,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   300,   300,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   370,   370,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  ,{{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   300,   190,   300,   190,   300}
+   ,{   190,   190,   190,   190,   190}
+   ,{   300,   190,   300,   190,   300}
+   }
+  ,{{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   300,   300,   300,   300,   220}
+   ,{   220,   220,   220,   220,   220}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ ,{{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   ,{   370,   370,   370,   370,   370}
+   }
+  ,{{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   370,   260,   370,   260,   370}
+   ,{   260,   260,   260,   260,   260}
+   ,{   370,   260,   370,   260,   370}
+   }
+  ,{{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   370,   370,   370,   370,   300}
+   ,{   300,   300,   300,   300,   300}
+   }
+  }
+ }};
diff --git a/C/ViennaRNA/intl21dH.h b/C/ViennaRNA/intl21dH.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/intl21dH.h
@@ -0,0 +1,1993 @@
+PUBLIC int int21_dH[NBPAIRS+1][NBPAIRS+1][5][5][5] =
+{{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   }
+  ,{{   350,   350,   350,  -230,   350}
+   ,{   350,   350,   350,  -230,   350}
+   ,{   350,   350,   350,  -230,   350}
+   ,{  -230,  -230,  -230,  -230,  -230}
+   ,{   350,   350,   350,  -230,   350}
+   }
+  ,{{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   }
+  ,{{   350,  -230,   350,  -230,   350}
+   ,{  -230,  -230,  -230,  -230,  -230}
+   ,{   350,  -230,   350,  -230,   350}
+   ,{  -230,  -230,  -230,  -230,  -230}
+   ,{   350,  -230,   350,  -230,   350}
+   }
+  ,{{   350,   350,   350,   350,  -670}
+   ,{   350,   350,   350,   350,  -670}
+   ,{   350,   350,   350,   350,  -670}
+   ,{   350,   350,   350,   350,  -670}
+   ,{  -670,  -670,  -670,  -670,  -670}
+   }
+  }
+ ,{{{   780,   640,   780,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   780,   350,   780,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   640,   640,   350,   350,   350}
+   }
+  ,{{   350,   350,   350,   250,   350}
+   ,{   350,   260,   350,   250,   350}
+   ,{   350,   350,  -250,  -230,   350}
+   ,{  -230,  -230,  -230,  -230,  -230}
+   ,{   350,   350,   350,  -230,   350}
+   }
+  ,{{   780,   640,   780,   350,   350}
+   ,{   350,   160,   350,   350,   350}
+   ,{   780,   350,   780,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   640,   640,   350,   350,   350}
+   }
+  ,{{   350,  -160,   350,  -230,   350}
+   ,{   350,  -160,   350,  -410,   350}
+   ,{   350,  -230,   350,  -230,   350}
+   ,{  -230,  -310,  -230,  -230,  -230}
+   ,{   350,  -230,   350,  -230,   350}
+   }
+  ,{{   580,   350,   580,   350,  -580}
+   ,{   350,   350,   350,   350,  -670}
+   ,{   580,   350,   580,   350,  -580}
+   ,{   350,   350,   350,   350,  -670}
+   ,{  -670,  -670,  -690,  -670,  -700}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   690,   690,   350,   350,   350}
+   ,{   690,   690,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   }
+  ,{{   690,   690,   350,   350,   350}
+   ,{   690,   690,   350,   240,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{  -230,  -500,  -230,  -230,  -230}
+   ,{   350,   350,   350,   350,   350}
+   }
+  ,{{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   130,   350,   350}
+   }
+  ,{{   350,  -230,   350,  -230,   350}
+   ,{  -230,  -230,  -230,  -230,  -230}
+   ,{   350,  -230,   350,  -230,   350}
+   ,{  -230,  -230,  -230,  -230,  -230}
+   ,{   350,  -230,   350,  -230,   350}
+   }
+  ,{{   350,   350,   350,   350,  -670}
+   ,{   350,   350,   350,   350,  -670}
+   ,{   350,   350,   350,   350,  -670}
+   ,{   350,   350,   350,   350,  -670}
+   ,{  -670,  -670,  -670,  -670,  -670}
+   }
+  }
+ ,{{{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   }
+  ,{{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{  -230,  -230,  -230,  -230,  -230}
+   ,{   350,   350,   350,   350,   350}
+   }
+  ,{{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   ,{   350,   350,   350,   350,   350}
+   }
+  ,{{   350,  -230,   350,  -230,   350}
+   ,{   350,  -230,   350,  -230,   350}
+   ,{   350,  -230,   350,  -230,   350}
+   ,{  -230,  -230,  -230,  -230,  -230}
+   ,{   350,  -230,   350,  -230,   350}
+   }
+  ,{{   350,   350,   350,   350,  -670}
+   ,{   350,   350,   350,   350,  -670}
+   ,{   350,   350,   350,   350,  -670}
+   ,{   350,   350,   350,   350,  -670}
+   ,{  -670,  -670,  -670,  -670,  -670}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   690,   850,   240,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   280,  -500,   280,   280,   280}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   130,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   690,   850,   240,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   280,  -500,   280,   280,   280}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   130,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,   690,  1350,   240,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,  -500,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,   130,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   850,   850,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{  1350,  1350,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ }
+,{{{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  ,{{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   ,{   INF,   INF,   INF,   INF,   INF}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   ,{   850,   850,   850,   850,   850}
+   }
+  ,{{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   850,   280,   850,   280,   850}
+   ,{   280,   280,   280,   280,   280}
+   ,{   850,   280,   850,   280,   850}
+   }
+  ,{{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{   850,   850,   850,   850,  -160}
+   ,{  -160,  -160,  -160,  -160,  -160}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ ,{{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   ,{  1350,  1350,  1350,  1350,  1350}
+   }
+  ,{{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{  1350,   780,  1350,   780,  1350}
+   ,{   780,   780,   780,   780,   780}
+   ,{  1350,   780,  1350,   780,  1350}
+   }
+  ,{{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{  1350,  1350,  1350,  1350,   340}
+   ,{   340,   340,   340,   340,   340}
+   }
+  }
+ }};
diff --git a/C/ViennaRNA/intl22.h b/C/ViennaRNA/intl22.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/intl22.h
@@ -0,0 +1,9993 @@
+PUBLIC int int22_37[NBPAIRS+1][NBPAIRS+1][5][5][5][5] =
+{{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   200,   160,   200,   150,   200}
+    ,{   200,   160,   200,   150,   200}
+    ,{   180,   140,   180,   140,   180}
+    ,{   200,   160,   200,   150,   200}
+    ,{   170,   130,   170,   120,   170}
+    }
+   ,{{   160,   120,   160,   110,   160}
+    ,{   160,   120,   160,   110,   160}
+    ,{   150,   110,   150,   110,   150}
+    ,{   110,    20,   110,    20,    90}
+    ,{   150,   110,   150,   110,   150}
+    }
+   ,{{   200,   160,   200,   150,   200}
+    ,{   200,   160,   200,   150,   200}
+    ,{   180,   140,   180,   140,   180}
+    ,{   200,   160,   200,   150,   200}
+    ,{   170,   130,   170,   120,   170}
+    }
+   ,{{   150,   110,   150,   110,   150}
+    ,{   110,    20,   110,    20,    90}
+    ,{   150,   110,   150,   110,   150}
+    ,{    80,     0,    10,    80,    20}
+    ,{   150,   110,   150,   110,   150}
+    }
+   ,{{   200,   160,   200,   150,   200}
+    ,{   200,   160,   200,   150,   200}
+    ,{   170,   130,   170,   120,   170}
+    ,{   200,   160,   200,   150,   200}
+    ,{   100,   100,    80,    30,    80}
+    }
+   }
+  ,{{{   200,   160,   200,   110,   200}
+    ,{   200,   160,   200,    60,   200}
+    ,{   180,   140,   180,   110,   180}
+    ,{   200,   160,   200,    60,   200}
+    ,{   170,   130,   170,    90,   170}
+    }
+   ,{{   160,   120,   160,    20,   160}
+    ,{   160,   120,   160,    20,   160}
+    ,{   150,   110,   150,    20,   150}
+    ,{    60,    20,    60,   -70,    60}
+    ,{   150,   110,   150,    20,   150}
+    }
+   ,{{   200,   160,   200,   110,   200}
+    ,{   200,   160,   200,    60,   200}
+    ,{   180,   140,   180,   110,   180}
+    ,{   200,   160,   200,    60,   200}
+    ,{   170,   130,   170,    90,   170}
+    }
+   ,{{   150,   110,   150,    20,   150}
+    ,{    60,    20,    60,   -70,    60}
+    ,{   150,   110,   150,    20,   150}
+    ,{    10,   -30,    10,     0,    10}
+    ,{   150,   110,   150,    20,   150}
+    }
+   ,{{   200,   160,   200,    90,   200}
+    ,{   200,   160,   200,    60,   200}
+    ,{   170,   130,   170,    90,   170}
+    ,{   200,   160,   200,    60,   200}
+    ,{   100,   100,    80,   -50,    80}
+    }
+   }
+  ,{{{   180,   150,   180,   150,   170}
+    ,{   180,   150,   180,   150,   170}
+    ,{   170,   140,   170,   140,   150}
+    ,{   180,   150,   180,   150,   170}
+    ,{   150,   120,   150,   120,   140}
+    }
+   ,{{   140,   110,   140,   110,   130}
+    ,{   140,   110,   140,   110,   130}
+    ,{   140,   110,   140,   110,   120}
+    ,{   110,    20,   110,    20,    90}
+    ,{   140,   110,   140,   110,   120}
+    }
+   ,{{   180,   150,   180,   150,   170}
+    ,{   180,   150,   180,   150,   170}
+    ,{   170,   140,   170,   140,   150}
+    ,{   180,   150,   180,   150,   170}
+    ,{   150,   120,   150,   120,   140}
+    }
+   ,{{   140,   110,   140,   110,   120}
+    ,{   110,    20,   110,    20,    90}
+    ,{   140,   110,   140,   110,   120}
+    ,{   -10,   -40,   -10,   -40,   -20}
+    ,{   140,   110,   140,   110,   120}
+    }
+   ,{{   180,   150,   180,   150,   170}
+    ,{   180,   150,   180,   150,   170}
+    ,{   150,   120,   150,   120,   140}
+    ,{   180,   150,   180,   150,   170}
+    ,{    60,    30,    60,    30,    50}
+    }
+   }
+  ,{{{   200,   110,   200,    80,   200}
+    ,{   200,    60,   200,    10,   200}
+    ,{   180,   110,   180,   -10,   180}
+    ,{   200,    60,   200,    80,   200}
+    ,{   170,    90,   170,    20,   170}
+    }
+   ,{{   160,    20,   160,     0,   160}
+    ,{   160,    20,   160,   -30,   160}
+    ,{   150,    20,   150,   -40,   150}
+    ,{    60,   -70,    60,     0,    60}
+    ,{   150,    20,   150,   -40,   150}
+    }
+   ,{{   200,   110,   200,    10,   200}
+    ,{   200,    60,   200,    10,   200}
+    ,{   180,   110,   180,   -10,   180}
+    ,{   200,    60,   200,    10,   200}
+    ,{   170,    90,   170,   -20,   170}
+    }
+   ,{{   150,    20,   150,    80,   150}
+    ,{    60,   -70,    60,     0,    60}
+    ,{   150,    20,   150,   -40,   150}
+    ,{    80,     0,    10,    80,    10}
+    ,{   150,    20,   150,   -40,   150}
+    }
+   ,{{   200,    90,   200,    20,   200}
+    ,{   200,    60,   200,    10,   200}
+    ,{   170,    90,   170,   -20,   170}
+    ,{   200,    60,   200,    10,   200}
+    ,{    80,   -50,    80,    20,    80}
+    }
+   }
+  ,{{{   170,   150,   170,   150,   100}
+    ,{   170,   150,   170,   150,   100}
+    ,{   150,   140,   150,   140,    60}
+    ,{   170,   150,   170,   150,    80}
+    ,{   140,   120,   140,   120,    50}
+    }
+   ,{{   130,   110,   130,   110,   100}
+    ,{   130,   110,   130,   110,   100}
+    ,{   120,   110,   120,   110,    30}
+    ,{    90,    20,    90,    20,   -50}
+    ,{   120,   110,   120,   110,    30}
+    }
+   ,{{   170,   150,   170,   150,    80}
+    ,{   170,   150,   170,   150,    80}
+    ,{   150,   140,   150,   140,    60}
+    ,{   170,   150,   170,   150,    80}
+    ,{   140,   120,   140,   120,    50}
+    }
+   ,{{   120,   110,   120,   110,    30}
+    ,{    90,    20,    90,    20,   -50}
+    ,{   120,   110,   120,   110,    30}
+    ,{    20,   -40,   -20,   -40,    20}
+    ,{   120,   110,   120,   110,    30}
+    }
+   ,{{   170,   150,   170,   150,    80}
+    ,{   170,   150,   170,   150,    80}
+    ,{   140,   120,   140,   120,    50}
+    ,{   170,   150,   170,   150,    80}
+    ,{    50,    30,    50,    30,   -40}
+    }
+   }
+  }
+ ,{{{{   220,   150,   220,   140,   170}
+    ,{   220,   130,   220,   130,   170}
+    ,{   150,   110,   150,   110,   150}
+    ,{   140,   100,   140,   100,   140}
+    ,{   170,   150,   150,   140,   170}
+    }
+   ,{{   220,   130,   220,   130,   170}
+    ,{   220,   130,   220,   130,   170}
+    ,{   150,   110,   150,   100,   150}
+    ,{    70,   -30,    70,   -70,    50}
+    ,{   150,   110,   150,   100,   150}
+    }
+   ,{{   190,   110,   190,   100,   170}
+    ,{   190,   110,   190,   100,   140}
+    ,{   150,   110,   150,   100,   150}
+    ,{   140,   100,   140,   100,   140}
+    ,{   170,   110,   150,   100,   170}
+    }
+   ,{{   150,   110,   150,   100,   150}
+    ,{   140,    70,    70,   -10,   140}
+    ,{   150,   110,   150,   100,   150}
+    ,{    80,   -30,    10,    80,    70}
+    ,{   150,   110,   150,   100,   150}
+    }
+   ,{{   150,   150,   150,   140,   150}
+    ,{   140,   100,   140,   100,   140}
+    ,{   150,   110,   150,   110,   150}
+    ,{   140,   100,   140,   100,   140}
+    ,{   150,   150,    70,   140,    70}
+    }
+   }
+  ,{{{   170,   150,   150,    90,   170}
+    ,{   170,   130,   140,    10,   170}
+    ,{   150,   110,   150,    80,   150}
+    ,{   140,   100,   140,    10,   140}
+    ,{   150,   150,   150,    90,   150}
+    }
+   ,{{   170,   130,   150,    10,   170}
+    ,{   170,   130,    60,     0,   170}
+    ,{   150,   110,   150,   -70,   150}
+    ,{    10,   -30,    10,  -160,   -30}
+    ,{   150,   110,   150,    10,   150}
+    }
+   ,{{   150,   110,   150,    70,   150}
+    ,{   140,   100,    50,  -100,   140}
+    ,{   150,   110,   150,   -60,   150}
+    ,{   140,   100,   140,    10,   140}
+    ,{   150,   110,   150,    70,   150}
+    }
+   ,{{   150,   110,   150,    10,   150}
+    ,{    40,    40,    30,   -70,    30}
+    ,{   150,   110,   150,    10,   150}
+    ,{    10,   -30,   -30,     0,    10}
+    ,{   150,   110,   150,    10,   150}
+    }
+   ,{{   150,   150,   150,    90,   150}
+    ,{   140,   100,   140,    10,   140}
+    ,{   150,   110,   150,    80,   150}
+    ,{   140,   100,   140,    10,   140}
+    ,{   150,   150,     0,    90,    70}
+    }
+   }
+  ,{{{   220,   130,   220,   130,   170}
+    ,{   220,   130,   220,   130,   140}
+    ,{   140,   110,   140,   110,   120}
+    ,{   130,   100,   130,   100,   110}
+    ,{   170,   100,   130,   100,   170}
+    }
+   ,{{   220,   130,   220,   130,   140}
+    ,{   220,   130,   220,   130,   140}
+    ,{   130,   100,   130,   100,   120}
+    ,{    70,   -70,    70,   -70,     0}
+    ,{   130,   100,   130,   100,   120}
+    }
+   ,{{   190,   110,   190,   100,   170}
+    ,{   190,   110,   190,   100,   110}
+    ,{   130,   100,   130,   100,   120}
+    ,{   130,   100,   130,   100,   110}
+    ,{   170,   100,   130,   100,   170}
+    }
+   ,{{   130,   100,   130,   100,   120}
+    ,{    70,    70,    70,   -10,    60}
+    ,{   130,   100,   130,   100,   120}
+    ,{    20,   -40,   -10,   -40,    20}
+    ,{   130,   100,   130,   100,   120}
+    }
+   ,{{   140,   110,   140,   110,   120}
+    ,{   130,   100,   130,   100,   110}
+    ,{   140,   110,   140,   110,   120}
+    ,{   130,   100,   130,   100,   110}
+    ,{    30,   -20,   -10,    30,    20}
+    }
+   }
+  ,{{{   170,    90,   170,   140,   170}
+    ,{   170,    70,   170,   -10,   170}
+    ,{   150,    80,   150,   -40,   150}
+    ,{   140,    10,   140,    80,   140}
+    ,{   150,    90,   150,   140,   150}
+    }
+   ,{{   170,    10,   170,   -10,   170}
+    ,{   170,   -20,   170,   -10,   170}
+    ,{   150,   -40,   150,   -40,   150}
+    ,{   -30,  -170,   -30,   -90,   -30}
+    ,{   150,    10,   150,   -40,   150}
+    }
+   ,{{   150,    70,   150,    20,   150}
+    ,{   140,    70,   140,   -50,   140}
+    ,{   150,    70,   150,   -40,   150}
+    ,{   140,    10,   140,   -50,   140}
+    ,{   150,    70,   150,    20,   150}
+    }
+   ,{{   150,    10,   150,    80,   150}
+    ,{    30,   -50,    30,   -30,    30}
+    ,{   150,    10,   150,   -40,   150}
+    ,{    80,   -30,    10,    80,    10}
+    ,{   150,    10,   150,   -40,   150}
+    }
+   ,{{   150,    90,   150,   140,   150}
+    ,{   140,    10,   140,   -50,   140}
+    ,{   150,    80,   150,   -50,   150}
+    ,{   140,    10,   140,   -50,   140}
+    ,{   140,    90,    70,   140,    70}
+    }
+   }
+  ,{{{   140,   130,   140,   130,   140}
+    ,{   140,   130,   140,   130,   140}
+    ,{   120,   110,   120,   110,    30}
+    ,{   110,   100,   110,   100,    70}
+    ,{   120,   100,   120,   100,    30}
+    }
+   ,{{   140,   130,   140,   130,   140}
+    ,{   140,   130,   140,   130,   140}
+    ,{   120,   100,   120,   100,    30}
+    ,{    50,   -70,     0,   -70,    50}
+    ,{   120,   100,   120,   100,    30}
+    }
+   ,{{   120,   100,   120,   100,    30}
+    ,{   110,   100,   110,   100,    30}
+    ,{   120,   100,   120,   100,    30}
+    ,{   110,   100,   110,   100,    20}
+    ,{   120,   100,   120,   100,    30}
+    }
+   ,{{   140,   100,   120,   100,   140}
+    ,{   140,   -10,    50,   -10,   140}
+    ,{   120,   100,   120,   100,    30}
+    ,{    70,   -40,   -60,   -40,    70}
+    ,{   120,   100,   120,   100,    30}
+    }
+   ,{{   120,   110,   120,   110,    30}
+    ,{   110,   100,   110,   100,    20}
+    ,{   120,   110,   120,   110,    30}
+    ,{   110,   100,   110,   100,    20}
+    ,{    40,    30,    40,    30,   -60}
+    }
+   }
+  }
+ ,{{{{   300,   290,   300,   260,   300}
+    ,{   300,   270,   300,   260,   300}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   290,   290,   270,   220,   270}
+    }
+   ,{{   300,   270,   300,   260,   300}
+    ,{   300,   270,   300,   260,   300}
+    ,{   270,   230,   270,   220,   270}
+    ,{   230,   150,   230,   140,   220}
+    ,{   270,   230,   270,   220,   270}
+    }
+   ,{{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    }
+   ,{{   270,   230,   270,   220,   270}
+    ,{   270,   190,   270,   180,   260}
+    ,{   270,   230,   270,   220,   270}
+    ,{   210,   130,   140,   210,   150}
+    ,{   270,   230,   270,   220,   270}
+    }
+   ,{{   290,   290,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   290,   290,   270,   220,   270}
+    }
+   }
+  ,{{{   300,   290,   300,   190,   300}
+    ,{   300,   270,   300,   170,   300}
+    ,{   270,   230,   270,   190,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   290,   290,   270,   190,   270}
+    }
+   ,{{   300,   270,   300,   170,   300}
+    ,{   300,   270,   300,   170,   300}
+    ,{   270,   230,   270,   130,   270}
+    ,{   190,   150,   190,    50,   190}
+    ,{   270,   230,   270,   130,   270}
+    }
+   ,{{   270,   230,   270,   190,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   270,   230,   270,   190,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   270,   230,   270,   190,   270}
+    }
+   ,{{   270,   230,   270,   130,   270}
+    ,{   230,   190,   230,    90,   230}
+    ,{   270,   230,   270,   130,   270}
+    ,{   140,   100,   140,   130,   140}
+    ,{   270,   230,   270,   130,   270}
+    }
+   ,{{   290,   290,   270,   190,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   270,   230,   270,   190,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   290,   290,   270,   130,   270}
+    }
+   }
+  ,{{{   290,   260,   290,   260,   270}
+    ,{   290,   260,   290,   260,   270}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    }
+   ,{{   290,   260,   290,   260,   270}
+    ,{   290,   260,   290,   260,   270}
+    ,{   250,   220,   250,   220,   240}
+    ,{   230,   140,   230,   140,   220}
+    ,{   250,   220,   250,   220,   240}
+    }
+   ,{{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    }
+   ,{{   270,   220,   270,   220,   260}
+    ,{   270,   180,   270,   180,   260}
+    ,{   250,   220,   250,   220,   240}
+    ,{   120,    90,   120,    90,   110}
+    ,{   250,   220,   250,   220,   240}
+    }
+   ,{{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    }
+   }
+  ,{{{   300,   190,   300,   210,   300}
+    ,{   300,   170,   300,   170,   300}
+    ,{   270,   190,   270,    80,   270}
+    ,{   270,   130,   270,   210,   270}
+    ,{   270,   190,   270,   210,   270}
+    }
+   ,{{   300,   170,   300,   130,   300}
+    ,{   300,   170,   300,   110,   300}
+    ,{   270,   130,   270,    80,   270}
+    ,{   190,    50,   190,   130,   190}
+    ,{   270,   130,   270,    80,   270}
+    }
+   ,{{   270,   190,   270,    80,   270}
+    ,{   270,   130,   270,    80,   270}
+    ,{   270,   190,   270,    80,   270}
+    ,{   270,   130,   270,    80,   270}
+    ,{   270,   190,   270,    80,   270}
+    }
+   ,{{   270,   130,   270,   210,   270}
+    ,{   230,    90,   230,   170,   230}
+    ,{   270,   130,   270,    80,   270}
+    ,{   210,   130,   140,   210,   140}
+    ,{   270,   130,   270,    80,   270}
+    }
+   ,{{   270,   190,   270,   210,   270}
+    ,{   270,   130,   270,    80,   270}
+    ,{   270,   190,   270,    80,   270}
+    ,{   270,   130,   270,    80,   270}
+    ,{   270,   130,   270,   210,   270}
+    }
+   }
+  ,{{{   270,   260,   270,   260,   240}
+    ,{   270,   260,   270,   260,   240}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    }
+   ,{{   270,   260,   270,   260,   240}
+    ,{   270,   260,   270,   260,   240}
+    ,{   240,   220,   240,   220,   150}
+    ,{   220,   140,   220,   140,    70}
+    ,{   240,   220,   240,   220,   150}
+    }
+   ,{{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    }
+   ,{{   260,   220,   260,   220,   150}
+    ,{   260,   180,   260,   180,   110}
+    ,{   240,   220,   240,   220,   150}
+    ,{   150,    90,   110,    90,   150}
+    ,{   240,   220,   240,   220,   150}
+    }
+   ,{{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    }
+   }
+  }
+ ,{{{{   310,   260,   310,   220,   300}
+    ,{   310,   230,   310,   220,   300}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   260,   260,   240,   190,   240}
+    }
+   ,{{   240,   200,   240,   190,   240}
+    ,{   200,   160,   200,   160,   200}
+    ,{   240,   200,   240,   190,   240}
+    ,{   150,    60,   150,    60,   130}
+    ,{   240,   200,   240,   190,   240}
+    }
+   ,{{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    }
+   ,{{   310,   230,   310,   220,   300}
+    ,{   310,   230,   310,   220,   300}
+    ,{   240,   200,   240,   190,   240}
+    ,{   180,   100,   110,   180,   120}
+    ,{   240,   200,   240,   190,   240}
+    }
+   ,{{   260,   260,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   260,   260,   240,   190,   240}
+    }
+   }
+  ,{{{   270,   260,   270,   160,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   240,   200,   240,   160,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   260,   260,   240,   160,   240}
+    }
+   ,{{   240,   200,   240,   100,   240}
+    ,{   200,   160,   200,    70,   200}
+    ,{   240,   200,   240,   100,   240}
+    ,{   100,    60,   100,   -30,   100}
+    ,{   240,   200,   240,   100,   240}
+    }
+   ,{{   240,   200,   240,   160,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   240,   200,   240,   160,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   240,   200,   240,   160,   240}
+    }
+   ,{{   270,   230,   270,   130,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   240,   200,   240,   100,   240}
+    ,{   110,    70,   110,   100,   110}
+    ,{   240,   200,   240,   100,   240}
+    }
+   ,{{   260,   260,   240,   160,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   240,   200,   240,   160,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   260,   260,   240,   100,   240}
+    }
+   }
+  ,{{{   310,   220,   310,   220,   300}
+    ,{   310,   220,   310,   220,   300}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    }
+   ,{{   220,   190,   220,   190,   210}
+    ,{   190,   160,   190,   160,   170}
+    ,{   220,   190,   220,   190,   210}
+    ,{   150,    60,   150,    60,   130}
+    ,{   220,   190,   220,   190,   210}
+    }
+   ,{{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    }
+   ,{{   310,   220,   310,   220,   300}
+    ,{   310,   220,   310,   220,   300}
+    ,{   220,   190,   220,   190,   210}
+    ,{    90,    60,    90,    60,    80}
+    ,{   220,   190,   220,   190,   210}
+    }
+   ,{{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    }
+   }
+  ,{{{   270,   160,   270,   210,   270}
+    ,{   270,   130,   270,   210,   270}
+    ,{   240,   160,   240,    50,   240}
+    ,{   240,   100,   240,   180,   240}
+    ,{   240,   160,   240,   180,   240}
+    }
+   ,{{   240,   100,   240,    50,   240}
+    ,{   200,    70,   200,    10,   200}
+    ,{   240,   100,   240,    50,   240}
+    ,{   100,   -30,   100,    40,   100}
+    ,{   240,   100,   240,    50,   240}
+    }
+   ,{{   240,   160,   240,    50,   240}
+    ,{   240,   100,   240,    50,   240}
+    ,{   240,   160,   240,    50,   240}
+    ,{   240,   100,   240,    50,   240}
+    ,{   240,   160,   240,    50,   240}
+    }
+   ,{{   270,   130,   270,   210,   270}
+    ,{   270,   130,   270,   210,   270}
+    ,{   240,   100,   240,    50,   240}
+    ,{   180,   100,   110,   180,   110}
+    ,{   240,   100,   240,    50,   240}
+    }
+   ,{{   240,   160,   240,   180,   240}
+    ,{   240,   100,   240,    50,   240}
+    ,{   240,   160,   240,    50,   240}
+    ,{   240,   100,   240,    50,   240}
+    ,{   240,   100,   240,   180,   240}
+    }
+   }
+  ,{{{   300,   220,   300,   220,   150}
+    ,{   300,   220,   300,   220,   150}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    }
+   ,{{   210,   190,   210,   190,   140}
+    ,{   170,   160,   170,   160,   140}
+    ,{   210,   190,   210,   190,   120}
+    ,{   130,    60,   130,    60,   -10}
+    ,{   210,   190,   210,   190,   120}
+    }
+   ,{{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    }
+   ,{{   300,   220,   300,   220,   150}
+    ,{   300,   220,   300,   220,   150}
+    ,{   210,   190,   210,   190,   120}
+    ,{   120,    60,    80,    60,   120}
+    ,{   210,   190,   210,   190,   120}
+    }
+   ,{{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    }
+   }
+  }
+ ,{{{{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   220,   180,   220,   170,   220}
+    ,{   220,   180,   220,   180,   220}
+    ,{   220,   180,   220,   170,   220}
+    }
+   ,{{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   210,   170,   210,   170,   210}
+    ,{   160,    70,   160,    70,   140}
+    ,{   210,   170,   210,   170,   210}
+    }
+   ,{{   220,   180,   220,   180,   220}
+    ,{   220,   180,   220,   180,   220}
+    ,{   220,   180,   220,   170,   220}
+    ,{   220,   180,   220,   180,   220}
+    ,{   220,   180,   220,   170,   220}
+    }
+   ,{{   230,   170,   230,   170,   210}
+    ,{   230,   140,   230,   140,   210}
+    ,{   210,   170,   210,   170,   210}
+    ,{   130,    60,    60,   130,    70}
+    ,{   210,   170,   210,   170,   210}
+    }
+   ,{{   220,   180,   220,   180,   220}
+    ,{   220,   180,   220,   180,   220}
+    ,{   220,   180,   220,   170,   220}
+    ,{   220,   180,   220,   180,   220}
+    ,{   150,   150,   130,    80,   130}
+    }
+   }
+  ,{{{   240,   200,   240,   140,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   220,   180,   220,   140,   220}
+    ,{   220,   180,   220,    90,   220}
+    ,{   220,   180,   220,   140,   220}
+    }
+   ,{{   240,   200,   240,   100,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   210,   170,   210,    80,   210}
+    ,{   110,    70,   110,   -20,   110}
+    ,{   210,   170,   210,    80,   210}
+    }
+   ,{{   220,   180,   220,   140,   220}
+    ,{   220,   180,   220,    90,   220}
+    ,{   220,   180,   220,   140,   220}
+    ,{   220,   180,   220,    90,   220}
+    ,{   220,   180,   220,   140,   220}
+    }
+   ,{{   210,   170,   210,    80,   210}
+    ,{   180,   140,   180,    50,   180}
+    ,{   210,   170,   210,    80,   210}
+    ,{    60,    20,    60,    60,    60}
+    ,{   210,   170,   210,    80,   210}
+    }
+   ,{{   220,   180,   220,   140,   220}
+    ,{   220,   180,   220,    90,   220}
+    ,{   220,   180,   220,   140,   220}
+    ,{   220,   180,   220,    90,   220}
+    ,{   150,   150,   130,     0,   130}
+    }
+   }
+  ,{{{   230,   190,   230,   190,   210}
+    ,{   230,   190,   230,   190,   210}
+    ,{   200,   170,   200,   170,   190}
+    ,{   210,   180,   210,   180,   190}
+    ,{   200,   170,   200,   170,   190}
+    }
+   ,{{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   200,   170,   200,   170,   180}
+    ,{   160,    70,   160,    70,   140}
+    ,{   200,   170,   200,   170,   180}
+    }
+   ,{{   210,   180,   210,   180,   190}
+    ,{   210,   180,   210,   180,   190}
+    ,{   200,   170,   200,   170,   190}
+    ,{   210,   180,   210,   180,   190}
+    ,{   200,   170,   200,   170,   190}
+    }
+   ,{{   230,   170,   230,   170,   210}
+    ,{   230,   140,   230,   140,   210}
+    ,{   200,   170,   200,   170,   180}
+    ,{    50,    20,    50,    20,    30}
+    ,{   200,   170,   200,   170,   180}
+    }
+   ,{{   210,   180,   210,   180,   190}
+    ,{   210,   180,   210,   180,   190}
+    ,{   200,   170,   200,   170,   190}
+    ,{   210,   180,   210,   180,   190}
+    ,{   110,    80,   110,    80,   100}
+    }
+   }
+  ,{{{   240,   140,   240,   130,   240}
+    ,{   240,   100,   240,   120,   240}
+    ,{   220,   140,   220,    30,   220}
+    ,{   220,    90,   220,   130,   220}
+    ,{   220,   140,   220,    70,   220}
+    }
+   ,{{   240,   100,   240,    50,   240}
+    ,{   240,   100,   240,    50,   240}
+    ,{   210,    80,   210,    20,   210}
+    ,{   110,   -20,   110,    50,   110}
+    ,{   210,    80,   210,    20,   210}
+    }
+   ,{{   220,   140,   220,    30,   220}
+    ,{   220,    90,   220,    30,   220}
+    ,{   220,   140,   220,    30,   220}
+    ,{   220,    90,   220,    30,   220}
+    ,{   220,   140,   220,    30,   220}
+    }
+   ,{{   210,    80,   210,   130,   210}
+    ,{   180,    50,   180,   120,   180}
+    ,{   210,    80,   210,    20,   210}
+    ,{   130,    60,    60,   130,    60}
+    ,{   210,    80,   210,    20,   210}
+    }
+   ,{{   220,   140,   220,    70,   220}
+    ,{   220,    90,   220,    30,   220}
+    ,{   220,   140,   220,    30,   220}
+    ,{   220,    90,   220,    30,   220}
+    ,{   130,     0,   130,    70,   130}
+    }
+   }
+  ,{{{   210,   190,   210,   190,   180}
+    ,{   210,   190,   210,   190,   180}
+    ,{   190,   170,   190,   170,   100}
+    ,{   190,   180,   190,   180,   100}
+    ,{   190,   170,   190,   170,   100}
+    }
+   ,{{   210,   190,   210,   190,   180}
+    ,{   210,   190,   210,   190,   180}
+    ,{   180,   170,   180,   170,    90}
+    ,{   140,    70,   140,    70,     0}
+    ,{   180,   170,   180,   170,    90}
+    }
+   ,{{   190,   180,   190,   180,   100}
+    ,{   190,   180,   190,   180,   100}
+    ,{   190,   170,   190,   170,   100}
+    ,{   190,   180,   190,   180,   100}
+    ,{   190,   170,   190,   170,   100}
+    }
+   ,{{   210,   170,   210,   170,    90}
+    ,{   210,   140,   210,   140,    60}
+    ,{   180,   170,   180,   170,    90}
+    ,{    70,    20,    30,    20,    70}
+    ,{   180,   170,   180,   170,    90}
+    }
+   ,{{   190,   180,   190,   180,   100}
+    ,{   190,   180,   190,   180,   100}
+    ,{   190,   170,   190,   170,   100}
+    ,{   190,   180,   190,   180,   100}
+    ,{   100,    80,   100,    80,    10}
+    }
+   }
+  }
+ ,{{{{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    }
+   ,{{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   190,   150,   190,   150,   190}
+    ,{   180,    90,   180,    90,   160}
+    ,{   190,   150,   190,   150,   190}
+    }
+   ,{{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    }
+   ,{{   190,   150,   190,   150,   190}
+    ,{   190,   100,   190,   100,   170}
+    ,{   190,   150,   190,   150,   190}
+    ,{   150,    80,    80,   150,    90}
+    ,{   190,   150,   190,   150,   190}
+    }
+   ,{{   240,   200,   240,   190,   240}
+    ,{   240,   200,   240,   190,   240}
+    ,{   210,   170,   210,   160,   210}
+    ,{   240,   200,   240,   190,   240}
+    ,{   170,   170,   150,   110,   150}
+    }
+   }
+  ,{{{   240,   200,   240,   160,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   240,   200,   240,   160,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   240,   200,   240,   160,   240}
+    }
+   ,{{   240,   200,   240,   100,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   190,   150,   190,    60,   190}
+    ,{   130,    90,   130,     0,   130}
+    ,{   190,   150,   190,    60,   190}
+    }
+   ,{{   240,   200,   240,   160,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   240,   200,   240,   160,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   240,   200,   240,   160,   240}
+    }
+   ,{{   190,   150,   190,    80,   190}
+    ,{   140,   100,   140,    10,   140}
+    ,{   190,   150,   190,    60,   190}
+    ,{    80,    40,    80,    80,    80}
+    ,{   190,   150,   190,    60,   190}
+    }
+   ,{{   240,   200,   240,   130,   240}
+    ,{   240,   200,   240,   100,   240}
+    ,{   210,   170,   210,   130,   210}
+    ,{   240,   200,   240,   100,   240}
+    ,{   170,   170,   150,    20,   150}
+    }
+   }
+  ,{{{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    }
+   ,{{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   180,   150,   180,   150,   160}
+    ,{   180,    90,   180,    90,   160}
+    ,{   180,   150,   180,   150,   160}
+    }
+   ,{{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    }
+   ,{{   190,   150,   190,   150,   170}
+    ,{   190,   100,   190,   100,   170}
+    ,{   180,   150,   180,   150,   160}
+    ,{    70,    40,    70,    40,    50}
+    ,{   180,   150,   180,   150,   160}
+    }
+   ,{{   220,   190,   220,   190,   210}
+    ,{   220,   190,   220,   190,   210}
+    ,{   190,   160,   190,   160,   180}
+    ,{   220,   190,   220,   190,   210}
+    ,{   140,   110,   140,   110,   120}
+    }
+   }
+  ,{{{   240,   160,   240,   150,   240}
+    ,{   240,   100,   240,    80,   240}
+    ,{   240,   160,   240,    50,   240}
+    ,{   240,   100,   240,   150,   240}
+    ,{   240,   160,   240,    90,   240}
+    }
+   ,{{   240,   100,   240,    70,   240}
+    ,{   240,   100,   240,    50,   240}
+    ,{   190,    60,   190,     0,   190}
+    ,{   130,     0,   130,    70,   130}
+    ,{   190,    60,   190,     0,   190}
+    }
+   ,{{   240,   160,   240,    50,   240}
+    ,{   240,   100,   240,    50,   240}
+    ,{   240,   160,   240,    50,   240}
+    ,{   240,   100,   240,    50,   240}
+    ,{   240,   160,   240,    50,   240}
+    }
+   ,{{   190,    80,   190,   150,   190}
+    ,{   140,    10,   140,    80,   140}
+    ,{   190,    60,   190,     0,   190}
+    ,{   150,    80,    80,   150,    80}
+    ,{   190,    60,   190,     0,   190}
+    }
+   ,{{   240,   130,   240,    90,   240}
+    ,{   240,   100,   240,    50,   240}
+    ,{   210,   130,   210,    20,   210}
+    ,{   240,   100,   240,    50,   240}
+    ,{   150,    20,   150,    90,   150}
+    }
+   }
+  ,{{{   210,   190,   210,   190,   180}
+    ,{   210,   190,   210,   190,   180}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    }
+   ,{{   210,   190,   210,   190,   180}
+    ,{   210,   190,   210,   190,   180}
+    ,{   160,   150,   160,   150,    70}
+    ,{   160,    90,   160,    90,    10}
+    ,{   160,   150,   160,   150,    70}
+    }
+   ,{{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    }
+   ,{{   170,   150,   170,   150,    90}
+    ,{   170,   100,   170,   100,    20}
+    ,{   160,   150,   160,   150,    70}
+    ,{    90,    40,    50,    40,    90}
+    ,{   160,   150,   160,   150,    70}
+    }
+   ,{{   210,   190,   210,   190,   120}
+    ,{   210,   190,   210,   190,   120}
+    ,{   180,   160,   180,   160,    90}
+    ,{   210,   190,   210,   190,   120}
+    ,{   120,   110,   120,   110,    30}
+    }
+   }
+  }
+ ,{{{{   310,   290,   310,   260,   300}
+    ,{   310,   270,   310,   260,   300}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   290,   290,   270,   220,   270}
+    }
+   ,{{   300,   270,   300,   260,   300}
+    ,{   300,   270,   300,   260,   300}
+    ,{   270,   230,   270,   220,   270}
+    ,{   230,   150,   230,   140,   220}
+    ,{   270,   230,   270,   220,   270}
+    }
+   ,{{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    }
+   ,{{   310,   230,   310,   220,   300}
+    ,{   310,   230,   310,   220,   300}
+    ,{   270,   230,   270,   220,   270}
+    ,{   210,   130,   140,   210,   150}
+    ,{   270,   230,   270,   220,   270}
+    }
+   ,{{   290,   290,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   270,   230,   270,   220,   270}
+    ,{   290,   290,   270,   220,   270}
+    }
+   }
+  ,{{{   300,   290,   300,   190,   300}
+    ,{   300,   270,   300,   170,   300}
+    ,{   270,   230,   270,   190,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   290,   290,   270,   190,   270}
+    }
+   ,{{   300,   270,   300,   170,   300}
+    ,{   300,   270,   300,   170,   300}
+    ,{   270,   230,   270,   130,   270}
+    ,{   190,   150,   190,    50,   190}
+    ,{   270,   230,   270,   130,   270}
+    }
+   ,{{   270,   230,   270,   190,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   270,   230,   270,   190,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   270,   230,   270,   190,   270}
+    }
+   ,{{   270,   230,   270,   130,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   140,   100,   140,   130,   140}
+    ,{   270,   230,   270,   130,   270}
+    }
+   ,{{   290,   290,   270,   190,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   270,   230,   270,   190,   270}
+    ,{   270,   230,   270,   130,   270}
+    ,{   290,   290,   270,   130,   270}
+    }
+   }
+  ,{{{   310,   260,   310,   260,   300}
+    ,{   310,   260,   310,   260,   300}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    }
+   ,{{   290,   260,   290,   260,   270}
+    ,{   290,   260,   290,   260,   270}
+    ,{   250,   220,   250,   220,   240}
+    ,{   230,   140,   230,   140,   220}
+    ,{   250,   220,   250,   220,   240}
+    }
+   ,{{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    }
+   ,{{   310,   220,   310,   220,   300}
+    ,{   310,   220,   310,   220,   300}
+    ,{   250,   220,   250,   220,   240}
+    ,{   120,    90,   120,    90,   110}
+    ,{   250,   220,   250,   220,   240}
+    }
+   ,{{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    ,{   250,   220,   250,   220,   240}
+    }
+   }
+  ,{{{   300,   190,   300,   210,   300}
+    ,{   300,   170,   300,   210,   300}
+    ,{   270,   190,   270,    80,   270}
+    ,{   270,   130,   270,   210,   270}
+    ,{   270,   190,   270,   210,   270}
+    }
+   ,{{   300,   170,   300,   130,   300}
+    ,{   300,   170,   300,   110,   300}
+    ,{   270,   130,   270,    80,   270}
+    ,{   190,    50,   190,   130,   190}
+    ,{   270,   130,   270,    80,   270}
+    }
+   ,{{   270,   190,   270,    80,   270}
+    ,{   270,   130,   270,    80,   270}
+    ,{   270,   190,   270,    80,   270}
+    ,{   270,   130,   270,    80,   270}
+    ,{   270,   190,   270,    80,   270}
+    }
+   ,{{   270,   130,   270,   210,   270}
+    ,{   270,   130,   270,   210,   270}
+    ,{   270,   130,   270,    80,   270}
+    ,{   210,   130,   140,   210,   140}
+    ,{   270,   130,   270,    80,   270}
+    }
+   ,{{   270,   190,   270,   210,   270}
+    ,{   270,   130,   270,    80,   270}
+    ,{   270,   190,   270,    80,   270}
+    ,{   270,   130,   270,    80,   270}
+    ,{   270,   130,   270,   210,   270}
+    }
+   }
+  ,{{{   300,   260,   300,   260,   240}
+    ,{   300,   260,   300,   260,   240}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    }
+   ,{{   270,   260,   270,   260,   240}
+    ,{   270,   260,   270,   260,   240}
+    ,{   240,   220,   240,   220,   150}
+    ,{   220,   140,   220,   140,    70}
+    ,{   240,   220,   240,   220,   150}
+    }
+   ,{{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    }
+   ,{{   300,   220,   300,   220,   150}
+    ,{   300,   220,   300,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   150,    90,   110,    90,   150}
+    ,{   240,   220,   240,   220,   150}
+    }
+   ,{{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    ,{   240,   220,   240,   220,   150}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   220,   220,   190,   150,   150}
+    ,{   170,   170,   150,   150,   150}
+    ,{   220,   220,   190,   130,   140}
+    ,{   170,   170,   150,   150,   150}
+    ,{   140,   140,   120,   140,   120}
+    }
+   ,{{   150,   130,   110,   110,   150}
+    ,{   150,   130,   110,   110,   150}
+    ,{   130,   130,   110,   100,   110}
+    ,{    90,    10,    70,    10,    90}
+    ,{   130,   130,   100,   100,   110}
+    }
+   ,{{   220,   220,   190,   150,   150}
+    ,{   150,   150,   150,   150,   150}
+    ,{   220,   220,   190,   130,   140}
+    ,{   170,   170,   150,   150,   150}
+    ,{   140,   140,   120,   120,   120}
+    }
+   ,{{   140,   130,   100,   100,   140}
+    ,{    90,    10,    70,    10,    90}
+    ,{   130,   130,   100,   100,   110}
+    ,{   140,   -10,    20,    80,   140}
+    ,{   130,   130,   100,   100,   110}
+    }
+   ,{{   170,   170,   170,   150,   150}
+    ,{   170,   170,   150,   150,   150}
+    ,{   170,   140,   170,   120,   120}
+    ,{   170,   170,   150,   150,   150}
+    ,{   140,   140,    30,   140,    30}
+    }
+   }
+  ,{{{   220,   220,   190,   140,   140}
+    ,{   170,   170,   140,    40,   140}
+    ,{   220,   220,   190,    70,   130}
+    ,{   170,   170,   140,    30,   140}
+    ,{   140,   140,   110,   140,   110}
+    }
+   ,{{   130,   130,   110,    70,   100}
+    ,{   130,   130,   100,    40,   100}
+    ,{   130,   130,   110,    70,   100}
+    ,{    70,   -20,    70,   -50,    10}
+    ,{   130,   130,   100,   -10,   100}
+    }
+   ,{{   220,   220,   190,    70,   140}
+    ,{   140,    60,    50,    30,   140}
+    ,{   220,   220,   190,    70,   130}
+    ,{   170,   170,   140,    30,   140}
+    ,{   140,   140,   110,    50,   110}
+    }
+   ,{{   130,   130,   100,   -10,   100}
+    ,{    10,     0,  -100,   -70,    10}
+    ,{   130,   130,   100,   -10,   100}
+    ,{   -10,   -10,   -50,   -30,   -50}
+    ,{   130,   130,   100,   -10,   100}
+    }
+   ,{{   170,   170,   140,   140,   140}
+    ,{   170,   170,   140,    30,   140}
+    ,{   140,   140,   110,    60,   110}
+    ,{   170,   170,   140,    30,   140}
+    ,{   140,   140,    30,   140,    20}
+    }
+   }
+  ,{{{   150,   150,   150,   150,   150}
+    ,{   150,   150,   150,   150,   150}
+    ,{   140,   130,   130,   130,   140}
+    ,{   150,   150,   150,   150,   150}
+    ,{   120,   120,   120,   120,   120}
+    }
+   ,{{   110,   110,   110,   110,   110}
+    ,{   110,   110,   110,   110,   110}
+    ,{   110,   100,   100,   100,   110}
+    ,{    80,   -40,    70,    10,    80}
+    ,{   110,   100,   100,   100,   110}
+    }
+   ,{{   150,   150,   150,   150,   150}
+    ,{   150,   150,   150,   150,   150}
+    ,{   140,   130,   130,   130,   140}
+    ,{   150,   150,   150,   150,   150}
+    ,{   120,   120,   120,   120,   120}
+    }
+   ,{{   110,   100,   100,   100,   110}
+    ,{    80,   -70,   -60,    10,    80}
+    ,{   110,   100,   100,   100,   110}
+    ,{   -40,   -40,   -40,   -40,   -50}
+    ,{   110,   100,   100,   100,   110}
+    }
+   ,{{   150,   150,   150,   150,   150}
+    ,{   150,   150,   150,   150,   150}
+    ,{   120,   120,   120,   120,   120}
+    ,{   150,   150,   150,   150,   150}
+    ,{    30,    30,    30,    30,    30}
+    }
+   }
+  ,{{{   140,    70,   140,    80,   140}
+    ,{   140,    10,   140,    10,   140}
+    ,{   130,    70,   130,    20,   130}
+    ,{   140,   -30,   140,    80,   140}
+    ,{   110,    50,   110,    70,   110}
+    }
+   ,{{   100,   -30,   100,   -30,   100}
+    ,{   100,   -30,   100,   -30,   100}
+    ,{   100,   -70,   100,   -40,   100}
+    ,{    10,  -170,    10,   -30,    10}
+    ,{   100,   -70,   100,   -40,   100}
+    }
+   ,{{   140,    70,   140,    10,   140}
+    ,{   140,    10,   140,   -30,   140}
+    ,{   130,    70,   130,   -10,   130}
+    ,{   140,   -30,   140,    10,   140}
+    ,{   110,     0,   110,   -60,   110}
+    }
+   ,{{   100,   -70,   100,    80,   100}
+    ,{    10,  -160,    10,     0,    10}
+    ,{   100,   -70,   100,   -40,   100}
+    ,{    80,   -90,   -50,    80,   -50}
+    ,{   100,   -70,   100,   -40,   100}
+    }
+   ,{{   140,    50,   140,    70,   140}
+    ,{   140,   -30,   140,    10,   140}
+    ,{   110,     0,   110,    20,   110}
+    ,{   140,   -30,   140,    10,   140}
+    ,{    70,    50,    20,    70,    20}
+    }
+   }
+  ,{{{   170,   150,   170,   150,   150}
+    ,{   150,   150,   150,   150,   150}
+    ,{   170,   130,   170,   130,    30}
+    ,{   150,   150,   150,   150,   140}
+    ,{   120,   120,   120,   120,    40}
+    }
+   ,{{   150,   110,   110,   110,   150}
+    ,{   150,   110,   110,   110,   150}
+    ,{   100,   100,   100,   100,   -20}
+    ,{    90,    10,    70,    10,    90}
+    ,{   100,   100,   100,   100,    30}
+    }
+   ,{{   150,   150,   150,   150,    70}
+    ,{   150,   150,   150,   150,     0}
+    ,{   130,   130,   130,   130,   -10}
+    ,{   150,   150,   150,   150,    70}
+    ,{   120,   120,   120,   120,    40}
+    }
+   ,{{   140,   100,   100,   100,   140}
+    ,{    90,    10,    70,    10,    90}
+    ,{   100,   100,   100,   100,    30}
+    ,{   140,   -40,    20,   -40,   140}
+    ,{   100,   100,   100,   100,    30}
+    }
+   ,{{   170,   150,   170,   150,    70}
+    ,{   150,   150,   150,   150,    70}
+    ,{   170,   120,   170,   120,    20}
+    ,{   150,   150,   150,   150,    70}
+    ,{    30,    30,    30,    30,   -60}
+    }
+   }
+  }
+ ,{{{{   150,   150,   120,   120,   130}
+    ,{   150,   150,   120,   120,   130}
+    ,{   130,   130,   100,   100,   110}
+    ,{   120,   120,    90,    90,   100}
+    ,{   120,   120,   100,   100,   100}
+    }
+   ,{{   150,   150,   120,   120,   130}
+    ,{   150,   150,   120,   120,   130}
+    ,{   120,   120,   100,   100,   100}
+    ,{   -10,   -50,   -20,   -80,   -10}
+    ,{   120,   120,   100,   100,   100}
+    }
+   ,{{   120,   120,   100,   100,   100}
+    ,{   120,   120,    90,    90,   100}
+    ,{   120,   120,   100,   100,   100}
+    ,{   120,   120,    90,    90,   100}
+    ,{   120,   120,   100,   100,   100}
+    }
+   ,{{   120,   120,   100,   100,   100}
+    ,{    50,    10,    50,   -10,    50}
+    ,{   120,   120,   100,   100,   100}
+    ,{    80,   -20,   -40,    80,    10}
+    ,{   120,   120,   100,   100,   100}
+    }
+   ,{{   130,   130,   100,   100,   110}
+    ,{   120,   120,    90,    90,   100}
+    ,{   130,   130,   100,   100,   110}
+    ,{   120,   120,    90,    90,   100}
+    ,{   110,   110,    20,    20,    30}
+    }
+   }
+  ,{{{   150,   150,   120,    50,   120}
+    ,{   150,   150,   120,    10,   120}
+    ,{   130,   130,   100,    50,   100}
+    ,{   120,   120,    90,   -20,    90}
+    ,{   120,   120,    90,    50,    90}
+    }
+   ,{{   150,   150,   120,    10,   120}
+    ,{   150,   150,   120,    10,   120}
+    ,{   120,   120,    90,   -10,    90}
+    ,{   -50,   -50,   -80,  -190,   -80}
+    ,{   120,   120,    90,   -10,    90}
+    }
+   ,{{   120,   120,    90,    50,    90}
+    ,{   120,   120,    90,   -20,    90}
+    ,{   120,   120,    90,    50,    90}
+    ,{   120,   120,    90,   -20,    90}
+    ,{   120,   120,    90,    50,    90}
+    }
+   ,{{   120,   120,    90,   -10,    90}
+    ,{    10,    10,   -20,  -130,   -20}
+    ,{   120,   120,    90,   -10,    90}
+    ,{   -20,   -20,   -50,   -20,   -50}
+    ,{   120,   120,    90,   -10,    90}
+    }
+   ,{{   130,   130,   100,    50,   100}
+    ,{   120,   120,    90,   -20,    90}
+    ,{   130,   130,   100,    50,   100}
+    ,{   120,   120,    90,   -20,    90}
+    ,{   110,   110,    20,   -90,    20}
+    }
+   }
+  ,{{{   130,   120,   120,   120,   130}
+    ,{   130,   120,   120,   120,   130}
+    ,{   110,   100,   100,   100,   110}
+    ,{   100,    90,    90,    90,   100}
+    ,{   100,   100,   100,   100,   100}
+    }
+   ,{{   130,   120,   120,   120,   130}
+    ,{   130,   120,   120,   120,   130}
+    ,{   100,   100,   100,   100,   100}
+    ,{   -10,   -80,   -20,   -80,   -10}
+    ,{   100,   100,   100,   100,   100}
+    }
+   ,{{   100,   100,   100,   100,   100}
+    ,{   100,    90,    90,    90,   100}
+    ,{   100,   100,   100,   100,   100}
+    ,{   100,    90,    90,    90,   100}
+    ,{   100,   100,   100,   100,   100}
+    }
+   ,{{   100,   100,   100,   100,   100}
+    ,{    50,   -10,    50,   -10,    50}
+    ,{   100,   100,   100,   100,   100}
+    ,{   -40,   -40,   -40,   -40,   -40}
+    ,{   100,   100,   100,   100,   100}
+    }
+   ,{{   110,   100,   100,   100,   110}
+    ,{   100,    90,    90,    90,   100}
+    ,{   110,   100,   100,   100,   110}
+    ,{   100,    90,    90,    90,   100}
+    ,{    30,    20,    20,    20,    30}
+    }
+   }
+  ,{{{   120,   -10,   120,    80,   120}
+    ,{   120,   -50,   120,   -20,   120}
+    ,{   100,   -10,   100,   -40,   100}
+    ,{    90,   -80,    90,    80,    90}
+    ,{    90,   -20,    90,    10,    90}
+    }
+   ,{{   120,   -50,   120,   -20,   120}
+    ,{   120,   -50,   120,   -20,   120}
+    ,{    90,   -80,    90,   -40,    90}
+    ,{   -80,  -260,   -80,   -90,   -80}
+    ,{    90,   -80,    90,   -40,    90}
+    }
+   ,{{    90,   -20,    90,   -40,    90}
+    ,{    90,   -80,    90,   -50,    90}
+    ,{    90,   -20,    90,   -40,    90}
+    ,{    90,   -80,    90,   -50,    90}
+    ,{    90,   -20,    90,   -40,    90}
+    }
+   ,{{    90,   -80,    90,    80,    90}
+    ,{   -20,  -190,   -20,   -20,   -20}
+    ,{    90,   -80,    90,   -40,    90}
+    ,{    80,   -90,   -50,    80,   -50}
+    ,{    90,   -80,    90,   -40,    90}
+    }
+   ,{{   100,   -10,   100,    10,   100}
+    ,{    90,   -80,    90,   -50,    90}
+    ,{   100,   -10,   100,   -40,   100}
+    ,{    90,   -80,    90,   -50,    90}
+    ,{    20,  -150,    20,    10,    20}
+    }
+   }
+  ,{{{   120,   120,   120,   120,   110}
+    ,{   120,   120,   120,   120,   110}
+    ,{   100,   100,   100,   100,    30}
+    ,{    90,    90,    90,    90,    20}
+    ,{   100,   100,   100,   100,    20}
+    }
+   ,{{   120,   120,   120,   120,   110}
+    ,{   120,   120,   120,   120,   110}
+    ,{   100,   100,   100,   100,    20}
+    ,{   -20,   -80,   -20,   -80,  -150}
+    ,{   100,   100,   100,   100,    20}
+    }
+   ,{{   100,   100,   100,   100,    20}
+    ,{    90,    90,    90,    90,    20}
+    ,{   100,   100,   100,   100,    20}
+    ,{    90,    90,    90,    90,    20}
+    ,{   100,   100,   100,   100,    20}
+    }
+   ,{{   100,   100,   100,   100,    20}
+    ,{    50,   -10,    50,   -10,   -90}
+    ,{   100,   100,   100,   100,    20}
+    ,{    10,   -40,   -40,   -40,    10}
+    ,{   100,   100,   100,   100,    20}
+    }
+   ,{{   100,   100,   100,   100,    30}
+    ,{    90,    90,    90,    90,    20}
+    ,{   100,   100,   100,   100,    30}
+    ,{    90,    90,    90,    90,    20}
+    ,{    20,    20,    20,    20,   -50}
+    }
+   }
+  }
+ ,{{{{   300,   300,   250,   250,   260}
+    ,{   280,   280,   250,   250,   260}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   300,   300,   220,   220,   220}
+    }
+   ,{{   280,   280,   250,   250,   260}
+    ,{   280,   280,   250,   250,   260}
+    ,{   240,   240,   220,   220,   220}
+    ,{   200,   160,   200,   140,   200}
+    ,{   240,   240,   220,   220,   220}
+    }
+   ,{{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    }
+   ,{{   240,   240,   240,   220,   240}
+    ,{   240,   200,   240,   180,   240}
+    ,{   240,   240,   220,   220,   220}
+    ,{   210,   110,    90,   210,   140}
+    ,{   240,   240,   220,   220,   220}
+    }
+   ,{{   300,   300,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   300,   300,   220,   220,   220}
+    }
+   }
+  ,{{{   300,   300,   250,   160,   250}
+    ,{   280,   280,   250,   140,   250}
+    ,{   240,   240,   210,   160,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   300,   300,   210,   160,   210}
+    }
+   ,{{   280,   280,   250,   140,   250}
+    ,{   280,   280,   250,   140,   250}
+    ,{   240,   240,   210,   100,   210}
+    ,{   160,   160,   130,    20,   130}
+    ,{   240,   240,   210,   100,   210}
+    }
+   ,{{   240,   240,   210,   160,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   240,   240,   210,   160,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   240,   240,   210,   160,   210}
+    }
+   ,{{   240,   240,   210,   100,   210}
+    ,{   200,   200,   170,    60,   170}
+    ,{   240,   240,   210,   100,   210}
+    ,{   110,   110,    80,   100,    80}
+    ,{   240,   240,   210,   100,   210}
+    }
+   ,{{   300,   300,   210,   160,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   240,   240,   210,   160,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   300,   300,   210,   100,   210}
+    }
+   }
+  ,{{{   260,   250,   250,   250,   260}
+    ,{   260,   250,   250,   250,   260}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   260,   250,   250,   250,   260}
+    ,{   260,   250,   250,   250,   260}
+    ,{   220,   220,   220,   220,   220}
+    ,{   200,   140,   200,   140,   200}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   240,   220,   240,   220,   240}
+    ,{   240,   180,   240,   180,   240}
+    ,{   220,   220,   220,   220,   220}
+    ,{    90,    90,    90,    90,    90}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    }
+   }
+  ,{{{   250,   100,   250,   210,   250}
+    ,{   250,    70,   250,   170,   250}
+    ,{   210,   100,   210,    80,   210}
+    ,{   210,    40,   210,   210,   210}
+    ,{   210,   100,   210,   210,   210}
+    }
+   ,{{   250,    70,   250,   130,   250}
+    ,{   250,    70,   250,   110,   250}
+    ,{   210,    40,   210,    80,   210}
+    ,{   130,   -40,   130,   130,   130}
+    ,{   210,    40,   210,    80,   210}
+    }
+   ,{{   210,   100,   210,    80,   210}
+    ,{   210,    40,   210,    80,   210}
+    ,{   210,   100,   210,    80,   210}
+    ,{   210,    40,   210,    80,   210}
+    ,{   210,   100,   210,    80,   210}
+    }
+   ,{{   210,    40,   210,   210,   210}
+    ,{   170,     0,   170,   170,   170}
+    ,{   210,    40,   210,    80,   210}
+    ,{   210,    40,    80,   210,    80}
+    ,{   210,    40,   210,    80,   210}
+    }
+   ,{{   210,   100,   210,   210,   210}
+    ,{   210,    40,   210,    80,   210}
+    ,{   210,   100,   210,    80,   210}
+    ,{   210,    40,   210,    80,   210}
+    ,{   210,    40,   210,   210,   210}
+    }
+   }
+  ,{{{   250,   250,   250,   250,   240}
+    ,{   250,   250,   250,   250,   240}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    }
+   ,{{   250,   250,   250,   250,   240}
+    ,{   250,   250,   250,   250,   240}
+    ,{   220,   220,   220,   220,   140}
+    ,{   200,   140,   200,   140,    60}
+    ,{   220,   220,   220,   220,   140}
+    }
+   ,{{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    }
+   ,{{   240,   220,   240,   220,   140}
+    ,{   240,   180,   240,   180,   100}
+    ,{   220,   220,   220,   220,   140}
+    ,{   140,    90,    90,    90,   140}
+    ,{   220,   220,   220,   220,   140}
+    }
+   ,{{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    }
+   }
+  }
+ ,{{{{   280,   270,   280,   220,   280}
+    ,{   280,   240,   280,   220,   280}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   270,   270,   190,   190,   190}
+    }
+   ,{{   210,   210,   190,   190,   190}
+    ,{   190,   190,   150,   150,   160}
+    ,{   210,   210,   190,   190,   190}
+    ,{   120,    80,   110,    50,   120}
+    ,{   210,   210,   190,   190,   190}
+    }
+   ,{{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    }
+   ,{{   280,   240,   280,   220,   280}
+    ,{   280,   240,   280,   220,   280}
+    ,{   210,   210,   190,   190,   190}
+    ,{   180,    80,    60,   180,   110}
+    ,{   210,   210,   190,   190,   190}
+    }
+   ,{{   270,   270,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   270,   270,   190,   190,   190}
+    }
+   }
+  ,{{{   270,   270,   210,   130,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   210,   210,   180,   130,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   270,   270,   180,   130,   180}
+    }
+   ,{{   210,   210,   180,    70,   180}
+    ,{   190,   190,   150,    40,   150}
+    ,{   210,   210,   180,    70,   180}
+    ,{    80,    80,    50,   -60,    50}
+    ,{   210,   210,   180,    70,   180}
+    }
+   ,{{   210,   210,   180,   130,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   210,   210,   180,   130,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   210,   210,   180,   130,   180}
+    }
+   ,{{   240,   240,   210,   100,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   210,   210,   180,    70,   180}
+    ,{    80,    80,    50,    70,    50}
+    ,{   210,   210,   180,    70,   180}
+    }
+   ,{{   270,   270,   180,   130,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   210,   210,   180,   130,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   270,   270,   180,    70,   180}
+    }
+   }
+  ,{{{   280,   220,   280,   220,   280}
+    ,{   280,   220,   280,   220,   280}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   160,   150,   150,   150,   160}
+    ,{   190,   190,   190,   190,   190}
+    ,{   120,    50,   110,    50,   120}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   280,   220,   280,   220,   280}
+    ,{   280,   220,   280,   220,   280}
+    ,{   190,   190,   190,   190,   190}
+    ,{    60,    60,    60,    60,    60}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    }
+   }
+  ,{{{   210,    70,   210,   210,   210}
+    ,{   210,    40,   210,   210,   210}
+    ,{   180,    70,   180,    50,   180}
+    ,{   180,    10,   180,   180,   180}
+    ,{   180,    70,   180,   180,   180}
+    }
+   ,{{   180,    10,   180,    50,   180}
+    ,{   150,   -20,   150,    10,   150}
+    ,{   180,    10,   180,    50,   180}
+    ,{    50,  -120,    50,    40,    50}
+    ,{   180,    10,   180,    50,   180}
+    }
+   ,{{   180,    70,   180,    50,   180}
+    ,{   180,    10,   180,    50,   180}
+    ,{   180,    70,   180,    50,   180}
+    ,{   180,    10,   180,    50,   180}
+    ,{   180,    70,   180,    50,   180}
+    }
+   ,{{   210,    40,   210,   210,   210}
+    ,{   210,    40,   210,   210,   210}
+    ,{   180,    10,   180,    50,   180}
+    ,{   180,    10,    50,   180,    50}
+    ,{   180,    10,   180,    50,   180}
+    }
+   ,{{   180,    70,   180,   180,   180}
+    ,{   180,    10,   180,    50,   180}
+    ,{   180,    70,   180,    50,   180}
+    ,{   180,    10,   180,    50,   180}
+    ,{   180,    10,   180,   180,   180}
+    }
+   }
+  ,{{{   280,   220,   280,   220,   140}
+    ,{   280,   220,   280,   220,   140}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    }
+   ,{{   190,   190,   190,   190,   140}
+    ,{   150,   150,   150,   150,   140}
+    ,{   190,   190,   190,   190,   110}
+    ,{   110,    50,   110,    50,   -20}
+    ,{   190,   190,   190,   190,   110}
+    }
+   ,{{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    }
+   ,{{   280,   220,   280,   220,   140}
+    ,{   280,   220,   280,   220,   140}
+    ,{   190,   190,   190,   190,   110}
+    ,{   110,    60,    60,    60,   110}
+    ,{   190,   190,   190,   190,   110}
+    }
+   ,{{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    }
+   }
+  }
+ ,{{{{   210,   210,   190,   190,   200}
+    ,{   210,   210,   190,   190,   200}
+    ,{   190,   190,   170,   170,   170}
+    ,{   200,   200,   170,   170,   180}
+    ,{   190,   190,   170,   170,   170}
+    }
+   ,{{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   190,   190,   160,   160,   170}
+    ,{   130,    90,   120,    60,   130}
+    ,{   190,   190,   160,   160,   170}
+    }
+   ,{{   200,   200,   170,   170,   180}
+    ,{   200,   200,   170,   170,   180}
+    ,{   190,   190,   170,   170,   170}
+    ,{   200,   200,   170,   170,   180}
+    ,{   190,   190,   170,   170,   170}
+    }
+   ,{{   200,   190,   190,   160,   200}
+    ,{   200,   160,   190,   130,   200}
+    ,{   190,   190,   160,   160,   170}
+    ,{   130,    40,    10,   130,    70}
+    ,{   190,   190,   160,   160,   170}
+    }
+   ,{{   200,   200,   170,   170,   180}
+    ,{   200,   200,   170,   170,   180}
+    ,{   190,   190,   170,   170,   170}
+    ,{   200,   200,   170,   170,   180}
+    ,{   160,   160,    80,    80,    80}
+    }
+   }
+  ,{{{   210,   210,   180,   110,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   190,   190,   160,   110,   160}
+    ,{   200,   200,   170,    60,   170}
+    ,{   190,   190,   160,   110,   160}
+    }
+   ,{{   210,   210,   180,    70,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   190,   190,   160,    50,   160}
+    ,{    90,    90,    60,   -50,    60}
+    ,{   190,   190,   160,    50,   160}
+    }
+   ,{{   200,   200,   170,   110,   170}
+    ,{   200,   200,   170,    60,   170}
+    ,{   190,   190,   160,   110,   160}
+    ,{   200,   200,   170,    60,   170}
+    ,{   190,   190,   160,   110,   160}
+    }
+   ,{{   190,   190,   160,    50,   160}
+    ,{   160,   160,   130,    20,   130}
+    ,{   190,   190,   160,    50,   160}
+    ,{    40,    40,    10,    30,    10}
+    ,{   190,   190,   160,    50,   160}
+    }
+   ,{{   200,   200,   170,   110,   170}
+    ,{   200,   200,   170,    60,   170}
+    ,{   190,   190,   160,   110,   160}
+    ,{   200,   200,   170,    60,   170}
+    ,{   160,   160,    70,   -30,    70}
+    }
+   }
+  ,{{{   200,   190,   190,   190,   200}
+    ,{   200,   190,   190,   190,   200}
+    ,{   170,   170,   170,   170,   170}
+    ,{   180,   170,   170,   170,   180}
+    ,{   170,   170,   170,   170,   170}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   170,   160,   160,   160,   170}
+    ,{   130,    60,   120,    60,   130}
+    ,{   170,   160,   160,   160,   170}
+    }
+   ,{{   180,   170,   170,   170,   180}
+    ,{   180,   170,   170,   170,   180}
+    ,{   170,   170,   170,   170,   170}
+    ,{   180,   170,   170,   170,   180}
+    ,{   170,   170,   170,   170,   170}
+    }
+   ,{{   200,   160,   190,   160,   200}
+    ,{   200,   130,   190,   130,   200}
+    ,{   170,   160,   160,   160,   170}
+    ,{    20,    10,    10,    10,    20}
+    ,{   170,   160,   160,   160,   170}
+    }
+   ,{{   180,   170,   170,   170,   180}
+    ,{   180,   170,   170,   170,   180}
+    ,{   170,   170,   170,   170,   170}
+    ,{   180,   170,   170,   170,   180}
+    ,{    80,    80,    80,    80,    80}
+    }
+   }
+  ,{{{   180,    50,   180,   130,   180}
+    ,{   180,    10,   180,   120,   180}
+    ,{   160,    50,   160,    30,   160}
+    ,{   170,     0,   170,   130,   170}
+    ,{   160,    50,   160,    70,   160}
+    }
+   ,{{   180,    10,   180,    50,   180}
+    ,{   180,    10,   180,    50,   180}
+    ,{   160,   -10,   160,    20,   160}
+    ,{    60,  -110,    60,    50,    60}
+    ,{   160,   -10,   160,    20,   160}
+    }
+   ,{{   170,    50,   170,    30,   170}
+    ,{   170,     0,   170,    30,   170}
+    ,{   160,    50,   160,    30,   160}
+    ,{   170,     0,   170,    30,   170}
+    ,{   160,    50,   160,    30,   160}
+    }
+   ,{{   160,   -10,   160,   130,   160}
+    ,{   130,   -40,   130,   120,   130}
+    ,{   160,   -10,   160,    20,   160}
+    ,{   130,   -30,    10,   130,    10}
+    ,{   160,   -10,   160,    20,   160}
+    }
+   ,{{   170,    50,   170,    70,   170}
+    ,{   170,     0,   170,    30,   170}
+    ,{   160,    50,   160,    30,   160}
+    ,{   170,     0,   170,    30,   170}
+    ,{    70,  -100,    70,    70,    70}
+    }
+   }
+  ,{{{   190,   190,   190,   190,   170}
+    ,{   190,   190,   190,   190,   170}
+    ,{   170,   170,   170,   170,    90}
+    ,{   170,   170,   170,   170,   100}
+    ,{   170,   170,   170,   170,    90}
+    }
+   ,{{   190,   190,   190,   190,   170}
+    ,{   190,   190,   190,   190,   170}
+    ,{   160,   160,   160,   160,    90}
+    ,{   120,    60,   120,    60,   -10}
+    ,{   160,   160,   160,   160,    90}
+    }
+   ,{{   170,   170,   170,   170,   100}
+    ,{   170,   170,   170,   170,   100}
+    ,{   170,   170,   170,   170,    90}
+    ,{   170,   170,   170,   170,   100}
+    ,{   170,   170,   170,   170,    90}
+    }
+   ,{{   190,   160,   190,   160,    90}
+    ,{   190,   130,   190,   130,    60}
+    ,{   160,   160,   160,   160,    90}
+    ,{    70,    10,    10,    10,    70}
+    ,{   160,   160,   160,   160,    90}
+    }
+   ,{{   170,   170,   170,   170,   100}
+    ,{   170,   170,   170,   170,   100}
+    ,{   170,   170,   170,   170,    90}
+    ,{   170,   170,   170,   170,   100}
+    ,{    80,    80,    80,    80,     0}
+    }
+   }
+  }
+ ,{{{{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    }
+   ,{{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   170,   170,   140,   140,   150}
+    ,{   150,   110,   140,    80,   150}
+    ,{   170,   170,   140,   140,   150}
+    }
+   ,{{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    }
+   ,{{   170,   170,   150,   150,   160}
+    ,{   160,   120,   150,    90,   160}
+    ,{   170,   170,   140,   140,   150}
+    ,{   150,    60,    30,   150,    90}
+    ,{   170,   170,   140,   140,   150}
+    }
+   ,{{   210,   210,   190,   190,   190}
+    ,{   210,   210,   190,   190,   190}
+    ,{   180,   180,   160,   160,   160}
+    ,{   210,   210,   190,   190,   190}
+    ,{   190,   190,   100,   100,   110}
+    }
+   }
+  ,{{{   210,   210,   180,   130,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   210,   210,   180,   130,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   210,   210,   180,   130,   180}
+    }
+   ,{{   210,   210,   180,    70,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   170,   170,   140,    30,   140}
+    ,{   110,   110,    80,   -30,    80}
+    ,{   170,   170,   140,    30,   140}
+    }
+   ,{{   210,   210,   180,   130,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   210,   210,   180,   130,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   210,   210,   180,   130,   180}
+    }
+   ,{{   170,   170,   140,    50,   140}
+    ,{   120,   120,    90,   -20,    90}
+    ,{   170,   170,   140,    30,   140}
+    ,{    60,    60,    30,    50,    30}
+    ,{   170,   170,   140,    30,   140}
+    }
+   ,{{   210,   210,   180,   100,   180}
+    ,{   210,   210,   180,    70,   180}
+    ,{   180,   180,   150,   100,   150}
+    ,{   210,   210,   180,    70,   180}
+    ,{   190,   190,   100,   -10,   100}
+    }
+   }
+  ,{{{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   150,   140,   140,   140,   150}
+    ,{   150,    80,   140,    80,   150}
+    ,{   150,   140,   140,   140,   150}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   160,   140,   150,   140,   160}
+    ,{   160,    90,   150,    90,   160}
+    ,{   150,   140,   140,   140,   150}
+    ,{    40,    30,    30,    30,    40}
+    ,{   150,   140,   140,   140,   150}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   160,   160,   160,   160,   160}
+    ,{   190,   190,   190,   190,   190}
+    ,{   110,   100,   100,   100,   110}
+    }
+   }
+  ,{{{   180,    70,   180,   150,   180}
+    ,{   180,    10,   180,    80,   180}
+    ,{   180,    70,   180,    50,   180}
+    ,{   180,    10,   180,   150,   180}
+    ,{   180,    70,   180,    90,   180}
+    }
+   ,{{   180,    10,   180,    70,   180}
+    ,{   180,    10,   180,    50,   180}
+    ,{   140,   -30,   140,     0,   140}
+    ,{    80,   -90,    80,    70,    80}
+    ,{   140,   -30,   140,     0,   140}
+    }
+   ,{{   180,    70,   180,    50,   180}
+    ,{   180,    10,   180,    50,   180}
+    ,{   180,    70,   180,    50,   180}
+    ,{   180,    10,   180,    50,   180}
+    ,{   180,    70,   180,    50,   180}
+    }
+   ,{{   150,   -10,   140,   150,   140}
+    ,{    90,   -80,    90,    80,    90}
+    ,{   140,   -30,   140,     0,   140}
+    ,{   150,   -10,    30,   150,    30}
+    ,{   140,   -30,   140,     0,   140}
+    }
+   ,{{   180,    40,   180,    90,   180}
+    ,{   180,    10,   180,    50,   180}
+    ,{   150,    40,   150,    20,   150}
+    ,{   180,    10,   180,    50,   180}
+    ,{   100,   -70,   100,    90,   100}
+    }
+   }
+  ,{{{   190,   190,   190,   190,   170}
+    ,{   190,   190,   190,   190,   170}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    }
+   ,{{   190,   190,   190,   190,   170}
+    ,{   190,   190,   190,   190,   170}
+    ,{   140,   140,   140,   140,    70}
+    ,{   140,    80,   140,    80,    10}
+    ,{   140,   140,   140,   140,    70}
+    }
+   ,{{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    }
+   ,{{   150,   140,   150,   140,    90}
+    ,{   150,    90,   150,    90,    20}
+    ,{   140,   140,   140,   140,    70}
+    ,{    90,    30,    30,    30,    90}
+    ,{   140,   140,   140,   140,    70}
+    }
+   ,{{   190,   190,   190,   190,   110}
+    ,{   190,   190,   190,   190,   110}
+    ,{   160,   160,   160,   160,    80}
+    ,{   190,   190,   190,   190,   110}
+    ,{   100,   100,   100,   100,    30}
+    }
+   }
+  }
+ ,{{{{   300,   300,   280,   250,   280}
+    ,{   280,   280,   280,   250,   280}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   300,   300,   220,   220,   220}
+    }
+   ,{{   280,   280,   250,   250,   260}
+    ,{   280,   280,   250,   250,   260}
+    ,{   240,   240,   220,   220,   220}
+    ,{   200,   160,   200,   140,   200}
+    ,{   240,   240,   220,   220,   220}
+    }
+   ,{{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    }
+   ,{{   280,   240,   280,   220,   280}
+    ,{   280,   240,   280,   220,   280}
+    ,{   240,   240,   220,   220,   220}
+    ,{   210,   110,    90,   210,   140}
+    ,{   240,   240,   220,   220,   220}
+    }
+   ,{{   300,   300,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   240,   240,   220,   220,   220}
+    ,{   300,   300,   220,   220,   220}
+    }
+   }
+  ,{{{   300,   300,   250,   160,   250}
+    ,{   280,   280,   250,   140,   250}
+    ,{   240,   240,   210,   160,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   300,   300,   210,   160,   210}
+    }
+   ,{{   280,   280,   250,   140,   250}
+    ,{   280,   280,   250,   140,   250}
+    ,{   240,   240,   210,   100,   210}
+    ,{   160,   160,   130,    20,   130}
+    ,{   240,   240,   210,   100,   210}
+    }
+   ,{{   240,   240,   210,   160,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   240,   240,   210,   160,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   240,   240,   210,   160,   210}
+    }
+   ,{{   240,   240,   210,   100,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   110,   110,    80,   100,    80}
+    ,{   240,   240,   210,   100,   210}
+    }
+   ,{{   300,   300,   210,   160,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   240,   240,   210,   160,   210}
+    ,{   240,   240,   210,   100,   210}
+    ,{   300,   300,   210,   140,   210}
+    }
+   }
+  ,{{{   280,   250,   280,   250,   280}
+    ,{   280,   250,   280,   250,   280}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   260,   250,   250,   250,   260}
+    ,{   260,   250,   250,   250,   260}
+    ,{   220,   220,   220,   220,   220}
+    ,{   200,   140,   200,   140,   200}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   280,   220,   280,   220,   280}
+    ,{   280,   220,   280,   220,   280}
+    ,{   220,   220,   220,   220,   220}
+    ,{    90,    90,    90,    90,    90}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    ,{   220,   220,   220,   220,   220}
+    }
+   }
+  ,{{{   250,   100,   250,   210,   250}
+    ,{   250,    70,   250,   210,   250}
+    ,{   210,   100,   210,    80,   210}
+    ,{   210,    40,   210,   210,   210}
+    ,{   210,   100,   210,   210,   210}
+    }
+   ,{{   250,    70,   250,   130,   250}
+    ,{   250,    70,   250,   110,   250}
+    ,{   210,    40,   210,    80,   210}
+    ,{   130,   -40,   130,   130,   130}
+    ,{   210,    40,   210,    80,   210}
+    }
+   ,{{   210,   100,   210,    80,   210}
+    ,{   210,    40,   210,    80,   210}
+    ,{   210,   100,   210,    80,   210}
+    ,{   210,    40,   210,    80,   210}
+    ,{   210,   100,   210,    80,   210}
+    }
+   ,{{   210,    40,   210,   210,   210}
+    ,{   210,    40,   210,   210,   210}
+    ,{   210,    40,   210,    80,   210}
+    ,{   210,    40,    80,   210,    80}
+    ,{   210,    40,   210,    80,   210}
+    }
+   ,{{   210,   100,   210,   210,   210}
+    ,{   210,    40,   210,    80,   210}
+    ,{   210,   100,   210,    80,   210}
+    ,{   210,    40,   210,    80,   210}
+    ,{   210,    50,   210,   210,   210}
+    }
+   }
+  ,{{{   280,   250,   280,   250,   240}
+    ,{   280,   250,   280,   250,   240}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    }
+   ,{{   250,   250,   250,   250,   240}
+    ,{   250,   250,   250,   250,   240}
+    ,{   220,   220,   220,   220,   140}
+    ,{   200,   140,   200,   140,    90}
+    ,{   220,   220,   220,   220,   140}
+    }
+   ,{{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    }
+   ,{{   280,   220,   280,   220,   140}
+    ,{   280,   220,   280,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   140,    90,    90,    90,   140}
+    ,{   220,   220,   220,   220,   140}
+    }
+   ,{{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    ,{   220,   220,   220,   220,   140}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   300,   300,   270,   270,   290}
+    ,{   300,   300,   270,   270,   290}
+    ,{   290,   290,   250,   270,   250}
+    ,{   300,   300,   270,   270,   270}
+    ,{   270,   270,   240,   260,   240}
+    }
+   ,{{   290,   270,   230,   230,   290}
+    ,{   290,   270,   230,   230,   290}
+    ,{   260,   260,   220,   220,   220}
+    ,{   190,   170,   190,   130,   190}
+    ,{   260,   260,   220,   220,   220}
+    }
+   ,{{   300,   300,   270,   270,   270}
+    ,{   300,   300,   270,   270,   270}
+    ,{   290,   290,   250,   270,   250}
+    ,{   300,   300,   270,   270,   270}
+    ,{   270,   270,   240,   260,   240}
+    }
+   ,{{   260,   260,   220,   220,   220}
+    ,{   190,   170,   190,   130,   190}
+    ,{   260,   260,   220,   220,   220}
+    ,{   210,   130,    80,   210,   210}
+    ,{   260,   260,   220,   220,   220}
+    }
+   ,{{   300,   300,   270,   270,   270}
+    ,{   300,   300,   270,   270,   270}
+    ,{   270,   270,   240,   260,   240}
+    ,{   300,   300,   270,   270,   270}
+    ,{   240,   240,   150,   150,   150}
+    }
+   }
+  ,{{{   300,   300,   270,   270,   270}
+    ,{   300,   300,   270,   230,   270}
+    ,{   290,   290,   250,   270,   250}
+    ,{   300,   300,   270,   230,   270}
+    ,{   270,   270,   240,   260,   240}
+    }
+   ,{{   270,   270,   230,   190,   230}
+    ,{   270,   270,   230,   190,   230}
+    ,{   260,   260,   220,   180,   220}
+    ,{   170,   170,   130,    90,   130}
+    ,{   260,   260,   220,   180,   220}
+    }
+   ,{{   300,   300,   270,   270,   270}
+    ,{   300,   300,   270,   230,   270}
+    ,{   290,   290,   250,   270,   250}
+    ,{   300,   300,   270,   230,   270}
+    ,{   270,   270,   240,   260,   240}
+    }
+   ,{{   260,   260,   220,   180,   220}
+    ,{   170,   170,   130,    90,   130}
+    ,{   260,   260,   220,   180,   220}
+    ,{   170,   110,    80,   170,    80}
+    ,{   260,   260,   220,   180,   220}
+    }
+   ,{{   300,   300,   270,   260,   270}
+    ,{   300,   300,   270,   230,   270}
+    ,{   270,   270,   240,   260,   240}
+    ,{   300,   300,   270,   230,   270}
+    ,{   240,   240,   150,   110,   150}
+    }
+   }
+  ,{{{   270,   270,   270,   270,   270}
+    ,{   270,   270,   270,   270,   270}
+    ,{   250,   250,   250,   250,   250}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    }
+   ,{{   230,   230,   230,   230,   230}
+    ,{   230,   230,   230,   230,   230}
+    ,{   220,   220,   220,   220,   220}
+    ,{   190,   130,   190,   130,   190}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   270,   270,   270,   270,   270}
+    ,{   270,   270,   270,   270,   270}
+    ,{   250,   250,   250,   250,   250}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   190,   130,   190,   130,   190}
+    ,{   220,   220,   220,   220,   220}
+    ,{    80,    80,    80,    80,    80}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   270,   270,   270,   270,   270}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    ,{   270,   270,   270,   270,   270}
+    ,{   150,   150,   150,   150,   150}
+    }
+   }
+  ,{{{   270,   230,   270,   210,   270}
+    ,{   270,   190,   270,   140,   270}
+    ,{   250,   230,   250,   120,   250}
+    ,{   270,   190,   270,   210,   270}
+    ,{   240,   220,   240,   150,   240}
+    }
+   ,{{   230,   150,   230,   130,   230}
+    ,{   230,   150,   230,   100,   230}
+    ,{   220,   140,   220,    90,   220}
+    ,{   130,    50,   130,   130,   130}
+    ,{   220,   140,   220,    90,   220}
+    }
+   ,{{   270,   230,   270,   140,   270}
+    ,{   270,   190,   270,   140,   270}
+    ,{   250,   230,   250,   120,   250}
+    ,{   270,   190,   270,   140,   270}
+    ,{   240,   220,   240,   110,   240}
+    }
+   ,{{   220,   140,   220,   210,   220}
+    ,{   130,    50,   130,   130,   130}
+    ,{   220,   140,   220,    90,   220}
+    ,{   210,   130,    80,   210,    80}
+    ,{   220,   140,   220,    90,   220}
+    }
+   ,{{   270,   220,   270,   150,   270}
+    ,{   270,   190,   270,   140,   270}
+    ,{   240,   220,   240,   110,   240}
+    ,{   270,   190,   270,   140,   270}
+    ,{   150,    70,   150,   150,   150}
+    }
+   }
+  ,{{{   290,   270,   270,   270,   290}
+    ,{   290,   270,   270,   270,   290}
+    ,{   250,   250,   250,   250,   250}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    }
+   ,{{   290,   230,   230,   230,   290}
+    ,{   290,   230,   230,   230,   290}
+    ,{   220,   220,   220,   220,   220}
+    ,{   190,   130,   190,   130,   130}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   270,   270,   270,   270,   270}
+    ,{   270,   270,   270,   270,   270}
+    ,{   250,   250,   250,   250,   250}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   190,   130,   190,   130,   130}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,    80,    80,    80,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   270,   270,   270,   270,   270}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    ,{   270,   270,   270,   270,   270}
+    ,{   150,   150,   150,   150,   150}
+    }
+   }
+  }
+ ,{{{{   300,   280,   240,   240,   300}
+    ,{   300,   280,   240,   240,   300}
+    ,{   260,   260,   220,   240,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   250,   250,   220,   240,   220}
+    }
+   ,{{   300,   280,   240,   240,   300}
+    ,{   300,   280,   240,   240,   300}
+    ,{   250,   250,   220,   220,   220}
+    ,{   100,    70,   100,    40,   100}
+    ,{   250,   250,   220,   220,   220}
+    }
+   ,{{   250,   250,   220,   240,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   250,   250,   220,   240,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   250,   250,   220,   240,   220}
+    }
+   ,{{   250,   250,   220,   220,   220}
+    ,{   160,   140,   160,   100,   160}
+    ,{   250,   250,   220,   220,   220}
+    ,{   210,   130,    80,   210,   210}
+    ,{   250,   250,   220,   220,   220}
+    }
+   ,{{   260,   260,   220,   240,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   260,   260,   220,   240,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   240,   240,   140,   140,   140}
+    }
+   }
+  ,{{{   280,   280,   240,   240,   240}
+    ,{   280,   280,   240,   200,   240}
+    ,{   260,   260,   220,   240,   220}
+    ,{   250,   250,   210,   170,   210}
+    ,{   250,   250,   220,   240,   220}
+    }
+   ,{{   280,   280,   240,   200,   240}
+    ,{   280,   280,   240,   200,   240}
+    ,{   250,   250,   220,   180,   220}
+    ,{    70,    70,    40,     0,    40}
+    ,{   250,   250,   220,   180,   220}
+    }
+   ,{{   250,   250,   220,   240,   220}
+    ,{   250,   250,   210,   170,   210}
+    ,{   250,   250,   220,   240,   220}
+    ,{   250,   250,   210,   170,   210}
+    ,{   250,   250,   220,   240,   220}
+    }
+   ,{{   250,   250,   220,   180,   220}
+    ,{   140,   140,   100,    60,   100}
+    ,{   250,   250,   220,   180,   220}
+    ,{   170,   110,    80,   170,    80}
+    ,{   250,   250,   220,   180,   220}
+    }
+   ,{{   260,   260,   220,   240,   220}
+    ,{   250,   250,   210,   170,   210}
+    ,{   260,   260,   220,   240,   220}
+    ,{   250,   250,   210,   170,   210}
+    ,{   240,   240,   140,   100,   140}
+    }
+   }
+  ,{{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   220,   220,   220,   220,   220}
+    ,{   100,    40,   100,    40,   100}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   160,   100,   160,   100,   160}
+    ,{   220,   220,   220,   220,   220}
+    ,{    80,    80,    80,    80,    80}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   140,   140,   140,   140,   140}
+    }
+   }
+  ,{{{   240,   200,   240,   210,   240}
+    ,{   240,   160,   240,   110,   240}
+    ,{   220,   200,   220,    90,   220}
+    ,{   210,   130,   210,   210,   210}
+    ,{   220,   200,   220,   140,   220}
+    }
+   ,{{   240,   160,   240,   110,   240}
+    ,{   240,   160,   240,   110,   240}
+    ,{   220,   140,   220,    90,   220}
+    ,{    40,   -40,    40,    40,    40}
+    ,{   220,   140,   220,    90,   220}
+    }
+   ,{{   220,   200,   220,    90,   220}
+    ,{   210,   130,   210,    80,   210}
+    ,{   220,   200,   220,    90,   220}
+    ,{   210,   130,   210,    80,   210}
+    ,{   220,   200,   220,    90,   220}
+    }
+   ,{{   220,   140,   220,   210,   220}
+    ,{   100,    20,   100,   100,   100}
+    ,{   220,   140,   220,    90,   220}
+    ,{   210,   130,    80,   210,    80}
+    ,{   220,   140,   220,    90,   220}
+    }
+   ,{{   220,   200,   220,   140,   220}
+    ,{   210,   130,   210,    80,   210}
+    ,{   220,   200,   220,    90,   220}
+    ,{   210,   130,   210,    80,   210}
+    ,{   140,    60,   140,   140,   140}
+    }
+   }
+  ,{{{   300,   240,   240,   240,   300}
+    ,{   300,   240,   240,   240,   300}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   300,   240,   240,   240,   300}
+    ,{   300,   240,   240,   240,   300}
+    ,{   220,   220,   220,   220,   220}
+    ,{   100,    40,   100,    40,    40}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   160,   100,   160,   100,   100}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,    80,    80,    80,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   140,   140,   140,   140,   140}
+    }
+   }
+  }
+ ,{{{{   430,   430,   370,   370,   430}
+    ,{   430,   410,   370,   370,   430}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   360,   340}
+    }
+   ,{{   430,   410,   370,   370,   430}
+    ,{   430,   410,   370,   370,   430}
+    ,{   370,   370,   340,   340,   340}
+    ,{   320,   290,   320,   260,   320}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   370,   370,   340,   360,   340}
+    }
+   ,{{   370,   370,   360,   340,   360}
+    ,{   360,   330,   360,   300,   360}
+    ,{   370,   370,   340,   340,   340}
+    ,{   340,   260,   210,   340,   340}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   430,   430,   340,   360,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   340,   340}
+    }
+   }
+  ,{{{   430,   430,   370,   360,   370}
+    ,{   410,   410,   370,   330,   370}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   430,   430,   340,   360,   340}
+    }
+   ,{{   410,   410,   370,   330,   370}
+    ,{   410,   410,   370,   330,   370}
+    ,{   370,   370,   340,   300,   340}
+    ,{   290,   290,   260,   220,   260}
+    ,{   370,   370,   340,   300,   340}
+    }
+   ,{{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   370,   370,   340,   360,   340}
+    }
+   ,{{   370,   370,   340,   300,   340}
+    ,{   330,   330,   300,   260,   300}
+    ,{   370,   370,   340,   300,   340}
+    ,{   300,   240,   210,   300,   210}
+    ,{   370,   370,   340,   300,   340}
+    }
+   ,{{   430,   430,   340,   360,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   430,   430,   340,   300,   340}
+    }
+   }
+  ,{{{   370,   370,   370,   370,   370}
+    ,{   370,   370,   370,   370,   370}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   370,   370,   370,   370,   370}
+    ,{   370,   370,   370,   370,   370}
+    ,{   340,   340,   340,   340,   340}
+    ,{   320,   260,   320,   260,   320}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   360,   340,   360,   340,   360}
+    ,{   360,   300,   360,   300,   360}
+    ,{   340,   340,   340,   340,   340}
+    ,{   210,   210,   210,   210,   210}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   }
+  ,{{{   370,   320,   370,   340,   370}
+    ,{   370,   290,   370,   300,   370}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   340,   340}
+    ,{   340,   320,   340,   340,   340}
+    }
+   ,{{   370,   290,   370,   260,   370}
+    ,{   370,   290,   370,   240,   370}
+    ,{   340,   260,   340,   210,   340}
+    ,{   260,   180,   260,   260,   260}
+    ,{   340,   260,   340,   210,   340}
+    }
+   ,{{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    }
+   ,{{   340,   260,   340,   340,   340}
+    ,{   300,   220,   300,   300,   300}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   260,   210,   340,   210}
+    ,{   340,   260,   340,   210,   340}
+    }
+   ,{{   340,   320,   340,   340,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   260,   340,   340,   340}
+    }
+   }
+  ,{{{   430,   370,   370,   370,   430}
+    ,{   430,   370,   370,   370,   430}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   430,   370,   370,   370,   430}
+    ,{   430,   370,   370,   370,   430}
+    ,{   340,   340,   340,   340,   340}
+    ,{   320,   260,   320,   260,   260}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   360,   340,   360,   340,   340}
+    ,{   360,   300,   360,   300,   300}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   210,   210,   210,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   }
+  }
+ ,{{{{   400,   400,   400,   360,   400}
+    ,{   400,   370,   400,   360,   400}
+    ,{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   400,   400,   310,   330,   310}
+    }
+   ,{{   360,   360,   310,   360,   330}
+    ,{   360,   360,   270,   360,   330}
+    ,{   340,   340,   310,   310,   310}
+    ,{   230,   220,   230,   170,   230}
+    ,{   340,   340,   310,   310,   310}
+    }
+   ,{{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   340,   340,   310,   330,   310}
+    }
+   ,{{   400,   370,   400,   340,   400}
+    ,{   400,   370,   400,   340,   400}
+    ,{   340,   340,   310,   310,   310}
+    ,{   310,   230,   180,   310,   310}
+    ,{   340,   340,   310,   310,   310}
+    }
+   ,{{   400,   400,   310,   330,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   400,   400,   310,   310,   310}
+    }
+   }
+  ,{{{   400,   400,   340,   360,   340}
+    ,{   370,   370,   340,   360,   340}
+    ,{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   400,   400,   310,   330,   310}
+    }
+   ,{{   360,   360,   310,   360,   310}
+    ,{   360,   360,   270,   360,   270}
+    ,{   340,   340,   310,   270,   310}
+    ,{   220,   220,   170,   130,   170}
+    ,{   340,   340,   310,   270,   310}
+    }
+   ,{{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   340,   340,   310,   330,   310}
+    }
+   ,{{   370,   370,   340,   300,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   340,   340,   310,   270,   310}
+    ,{   270,   210,   180,   270,   180}
+    ,{   340,   340,   310,   270,   310}
+    }
+   ,{{   400,   400,   310,   330,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   400,   400,   310,   270,   310}
+    }
+   }
+  ,{{{   400,   340,   400,   340,   400}
+    ,{   400,   340,   400,   340,   400}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   270,   270,   270,   270,   270}
+    ,{   310,   310,   310,   310,   310}
+    ,{   230,   170,   230,   170,   230}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   400,   340,   400,   340,   400}
+    ,{   400,   340,   400,   340,   400}
+    ,{   310,   310,   310,   310,   310}
+    ,{   180,   180,   180,   180,   180}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   }
+  ,{{{   340,   290,   340,   340,   340}
+    ,{   340,   260,   340,   340,   340}
+    ,{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   310,   310}
+    ,{   310,   290,   310,   310,   310}
+    }
+   ,{{   310,   230,   310,   180,   310}
+    ,{   270,   190,   270,   140,   270}
+    ,{   310,   230,   310,   180,   310}
+    ,{   170,    20,   170,   170,   170}
+    ,{   310,   230,   310,   180,   310}
+    }
+   ,{{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   290,   310,   180,   310}
+    }
+   ,{{   340,   260,   340,   340,   340}
+    ,{   340,   260,   340,   340,   340}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   230,   180,   310,   180}
+    ,{   310,   230,   310,   180,   310}
+    }
+   ,{{   310,   290,   310,   310,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   230,   310,   310,   310}
+    }
+   }
+  ,{{{   400,   340,   400,   340,   340}
+    ,{   400,   340,   400,   340,   340}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   330,   310,   310,   310,   330}
+    ,{   330,   270,   270,   270,   330}
+    ,{   310,   310,   310,   310,   310}
+    ,{   230,   170,   230,   170,   170}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   400,   340,   400,   340,   340}
+    ,{   400,   340,   400,   340,   340}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   180,   180,   180,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   }
+  }
+ ,{{{{   370,   340,   310,   310,   370}
+    ,{   370,   340,   310,   310,   370}
+    ,{   320,   320,   290,   310,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   320,   320,   290,   310,   290}
+    }
+   ,{{   370,   340,   310,   310,   370}
+    ,{   370,   340,   310,   310,   370}
+    ,{   320,   320,   280,   280,   280}
+    ,{   240,   220,   240,   180,   240}
+    ,{   320,   320,   280,   280,   280}
+    }
+   ,{{   330,   330,   290,   310,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   320,   320,   290,   310,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   320,   320,   290,   310,   290}
+    }
+   ,{{   320,   320,   310,   280,   310}
+    ,{   310,   290,   310,   250,   310}
+    ,{   320,   320,   280,   280,   280}
+    ,{   260,   180,   130,   260,   260}
+    ,{   320,   320,   280,   280,   280}
+    }
+   ,{{   330,   330,   290,   310,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   320,   320,   290,   310,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   290,   290,   200,   200,   200}
+    }
+   }
+  ,{{{   340,   340,   310,   310,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   320,   320,   290,   310,   290}
+    ,{   330,   330,   290,   250,   290}
+    ,{   320,   320,   290,   310,   290}
+    }
+   ,{{   340,   340,   310,   270,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   320,   320,   280,   240,   280}
+    ,{   220,   220,   180,   140,   180}
+    ,{   320,   320,   280,   240,   280}
+    }
+   ,{{   330,   330,   290,   310,   290}
+    ,{   330,   330,   290,   250,   290}
+    ,{   320,   320,   290,   310,   290}
+    ,{   330,   330,   290,   250,   290}
+    ,{   320,   320,   290,   310,   290}
+    }
+   ,{{   320,   320,   280,   240,   280}
+    ,{   290,   290,   250,   210,   250}
+    ,{   320,   320,   280,   240,   280}
+    ,{   220,   170,   130,   220,   130}
+    ,{   320,   320,   280,   240,   280}
+    }
+   ,{{   330,   330,   290,   310,   290}
+    ,{   330,   330,   290,   250,   290}
+    ,{   320,   320,   290,   310,   290}
+    ,{   330,   330,   290,   250,   290}
+    ,{   290,   290,   200,   160,   200}
+    }
+   }
+  ,{{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   280,   280,   280,   280,   280}
+    ,{   240,   180,   240,   180,   240}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    }
+   ,{{   310,   280,   310,   280,   310}
+    ,{   310,   250,   310,   250,   310}
+    ,{   280,   280,   280,   280,   280}
+    ,{   130,   130,   130,   130,   130}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   200,   200,   200,   200,   200}
+    }
+   }
+  ,{{{   310,   270,   310,   260,   310}
+    ,{   310,   230,   310,   250,   310}
+    ,{   290,   270,   290,   160,   290}
+    ,{   290,   210,   290,   260,   290}
+    ,{   290,   270,   290,   200,   290}
+    }
+   ,{{   310,   230,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   280,   200,   280,   150,   280}
+    ,{   180,   100,   180,   180,   180}
+    ,{   280,   200,   280,   150,   280}
+    }
+   ,{{   290,   270,   290,   160,   290}
+    ,{   290,   210,   290,   160,   290}
+    ,{   290,   270,   290,   160,   290}
+    ,{   290,   210,   290,   160,   290}
+    ,{   290,   270,   290,   160,   290}
+    }
+   ,{{   280,   200,   280,   260,   280}
+    ,{   250,   170,   250,   250,   250}
+    ,{   280,   200,   280,   150,   280}
+    ,{   260,   180,   130,   260,   130}
+    ,{   280,   200,   280,   150,   280}
+    }
+   ,{{   290,   270,   290,   200,   290}
+    ,{   290,   210,   290,   160,   290}
+    ,{   290,   270,   290,   160,   290}
+    ,{   290,   210,   290,   160,   290}
+    ,{   200,   120,   200,   200,   200}
+    }
+   }
+  ,{{{   370,   310,   310,   310,   370}
+    ,{   370,   310,   310,   310,   370}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    }
+   ,{{   370,   310,   310,   310,   370}
+    ,{   370,   310,   310,   310,   370}
+    ,{   280,   280,   280,   280,   280}
+    ,{   240,   180,   240,   180,   180}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    }
+   ,{{   310,   280,   310,   280,   280}
+    ,{   310,   250,   310,   250,   250}
+    ,{   280,   280,   280,   280,   280}
+    ,{   260,   130,   130,   130,   260}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   200,   200,   200,   200,   200}
+    }
+   }
+  }
+ ,{{{{   370,   340,   310,   330,   370}
+    ,{   370,   340,   310,   310,   370}
+    ,{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   340,   340,   310,   330,   310}
+    }
+   ,{{   370,   340,   310,   310,   370}
+    ,{   370,   340,   310,   310,   370}
+    ,{   300,   300,   260,   260,   260}
+    ,{   260,   240,   260,   200,   260}
+    ,{   300,   300,   260,   260,   260}
+    }
+   ,{{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   340,   340,   310,   330,   310}
+    }
+   ,{{   300,   300,   270,   280,   280}
+    ,{   270,   250,   270,   210,   270}
+    ,{   300,   300,   260,   260,   260}
+    ,{   280,   200,   150,   280,   280}
+    ,{   300,   300,   260,   260,   260}
+    }
+   ,{{   340,   340,   310,   310,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   310,   310,   280,   300,   280}
+    ,{   340,   340,   310,   310,   310}
+    ,{   320,   320,   220,   220,   220}
+    }
+   }
+  ,{{{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   340,   340,   310,   330,   310}
+    }
+   ,{{   340,   340,   310,   270,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   300,   300,   260,   220,   260}
+    ,{   240,   240,   200,   160,   200}
+    ,{   300,   300,   260,   220,   260}
+    }
+   ,{{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   340,   340,   310,   330,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   340,   340,   310,   330,   310}
+    }
+   ,{{   300,   300,   260,   240,   260}
+    ,{   250,   250,   210,   170,   210}
+    ,{   300,   300,   260,   220,   260}
+    ,{   240,   190,   150,   240,   150}
+    ,{   300,   300,   260,   220,   260}
+    }
+   ,{{   340,   340,   310,   300,   310}
+    ,{   340,   340,   310,   270,   310}
+    ,{   310,   310,   280,   300,   280}
+    ,{   340,   340,   310,   270,   310}
+    ,{   320,   320,   220,   180,   220}
+    }
+   }
+  ,{{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   200,   260,   200,   260}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   270,   260,   270,   260,   270}
+    ,{   270,   210,   270,   210,   270}
+    ,{   260,   260,   260,   260,   260}
+    ,{   150,   150,   150,   150,   150}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   280,   280,   280,   280,   280}
+    ,{   310,   310,   310,   310,   310}
+    ,{   220,   220,   220,   220,   220}
+    }
+   }
+  ,{{{   310,   290,   310,   280,   310}
+    ,{   310,   230,   310,   210,   310}
+    ,{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   280,   310}
+    ,{   310,   290,   310,   220,   310}
+    }
+   ,{{   310,   230,   310,   200,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   260,   180,   260,   130,   260}
+    ,{   200,   120,   200,   200,   200}
+    ,{   260,   180,   260,   130,   260}
+    }
+   ,{{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   290,   310,   180,   310}
+    }
+   ,{{   280,   200,   260,   280,   260}
+    ,{   210,   130,   210,   210,   210}
+    ,{   260,   180,   260,   130,   260}
+    ,{   280,   200,   150,   280,   150}
+    ,{   260,   180,   260,   130,   260}
+    }
+   ,{{   310,   260,   310,   220,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   280,   260,   280,   150,   280}
+    ,{   310,   230,   310,   180,   310}
+    ,{   220,   140,   220,   220,   220}
+    }
+   }
+  ,{{{   370,   310,   310,   310,   370}
+    ,{   370,   310,   310,   310,   370}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   370,   310,   310,   310,   370}
+    ,{   370,   310,   310,   310,   370}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   200,   260,   200,   200}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   280,   260,   270,   260,   280}
+    ,{   270,   210,   270,   210,   210}
+    ,{   260,   260,   260,   260,   260}
+    ,{   280,   150,   150,   150,   280}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   280,   280,   280,   280,   280}
+    ,{   310,   310,   310,   310,   310}
+    ,{   220,   220,   220,   220,   220}
+    }
+   }
+  }
+ ,{{{{   430,   430,   400,   370,   430}
+    ,{   430,   410,   400,   370,   430}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   360,   340}
+    }
+   ,{{   430,   410,   370,   370,   430}
+    ,{   430,   410,   370,   370,   430}
+    ,{   370,   370,   340,   340,   340}
+    ,{   320,   290,   320,   260,   320}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   370,   370,   340,   360,   340}
+    }
+   ,{{   400,   370,   400,   340,   400}
+    ,{   400,   370,   400,   340,   400}
+    ,{   370,   370,   340,   340,   340}
+    ,{   340,   260,   210,   340,   340}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   430,   430,   340,   360,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   340,   340}
+    }
+   }
+  ,{{{   430,   430,   370,   360,   370}
+    ,{   410,   410,   370,   360,   370}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   430,   430,   340,   360,   340}
+    }
+   ,{{   410,   410,   370,   360,   370}
+    ,{   410,   410,   370,   360,   370}
+    ,{   370,   370,   340,   300,   340}
+    ,{   290,   290,   260,   220,   260}
+    ,{   370,   370,   340,   300,   340}
+    }
+   ,{{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   370,   370,   340,   360,   340}
+    }
+   ,{{   370,   370,   340,   300,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   300,   240,   210,   300,   210}
+    ,{   370,   370,   340,   300,   340}
+    }
+   ,{{   430,   430,   340,   360,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   370,   340,   300,   340}
+    ,{   430,   430,   340,   300,   340}
+    }
+   }
+  ,{{{   400,   370,   400,   370,   400}
+    ,{   400,   370,   400,   370,   400}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   370,   370,   370,   370,   370}
+    ,{   370,   370,   370,   370,   370}
+    ,{   340,   340,   340,   340,   340}
+    ,{   320,   260,   320,   260,   320}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   400,   340,   400,   340,   400}
+    ,{   400,   340,   400,   340,   400}
+    ,{   340,   340,   340,   340,   340}
+    ,{   210,   210,   210,   210,   210}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   }
+  ,{{{   370,   320,   370,   340,   370}
+    ,{   370,   290,   370,   340,   370}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   340,   340}
+    ,{   340,   320,   340,   340,   340}
+    }
+   ,{{   370,   290,   370,   260,   370}
+    ,{   370,   290,   370,   240,   370}
+    ,{   340,   260,   340,   210,   340}
+    ,{   260,   180,   260,   260,   260}
+    ,{   340,   260,   340,   210,   340}
+    }
+   ,{{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    }
+   ,{{   340,   260,   340,   340,   340}
+    ,{   340,   260,   340,   340,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   260,   210,   340,   210}
+    ,{   340,   260,   340,   210,   340}
+    }
+   ,{{   340,   320,   340,   340,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   260,   340,   340,   340}
+    }
+   }
+  ,{{{   430,   370,   400,   370,   430}
+    ,{   430,   370,   400,   370,   430}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   430,   370,   370,   370,   430}
+    ,{   430,   370,   370,   370,   430}
+    ,{   340,   340,   340,   340,   340}
+    ,{   320,   260,   320,   260,   260}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   400,   340,   400,   340,   340}
+    ,{   400,   340,   400,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   210,   210,   210,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   310,   240,   240,   310,   260}
+    ,{   270,   240,   240,   270,   260}
+    ,{   310,   220,   220,   310,   220}
+    ,{   270,   240,   240,   270,   240}
+    ,{   300,   210,   210,   300,   210}
+    }
+   ,{{   260,   200,   200,   230,   260}
+    ,{   260,   200,   200,   230,   260}
+    ,{   220,   190,   190,   220,   190}
+    ,{   160,   100,   160,   130,   160}
+    ,{   220,   190,   190,   220,   190}
+    }
+   ,{{   310,   240,   240,   310,   240}
+    ,{   270,   240,   240,   270,   240}
+    ,{   310,   220,   220,   310,   220}
+    ,{   270,   240,   240,   270,   240}
+    ,{   300,   210,   210,   300,   210}
+    }
+   ,{{   220,   190,   190,   220,   190}
+    ,{   160,   100,   160,   130,   160}
+    ,{   220,   190,   190,   220,   190}
+    ,{   210,    50,    50,   210,   180}
+    ,{   220,   190,   190,   220,   190}
+    }
+   ,{{   300,   240,   240,   300,   240}
+    ,{   270,   240,   240,   270,   240}
+    ,{   300,   210,   210,   300,   210}
+    ,{   270,   240,   240,   270,   240}
+    ,{   150,   140,   120,   150,   120}
+    }
+   }
+  ,{{{   310,   200,   240,   310,   240}
+    ,{   270,   200,   240,   270,   240}
+    ,{   310,   190,   220,   310,   220}
+    ,{   270,   200,   240,   270,   240}
+    ,{   300,   170,   210,   300,   210}
+    }
+   ,{{   230,   160,   200,   230,   200}
+    ,{   230,   160,   200,   230,   200}
+    ,{   220,   160,   190,   220,   190}
+    ,{   130,    70,   100,   130,   100}
+    ,{   220,   160,   190,   220,   190}
+    }
+   ,{{   310,   200,   240,   310,   240}
+    ,{   270,   200,   240,   270,   240}
+    ,{   310,   190,   220,   310,   220}
+    ,{   270,   200,   240,   270,   240}
+    ,{   300,   170,   210,   300,   210}
+    }
+   ,{{   220,   160,   190,   220,   190}
+    ,{   130,    70,   100,   130,   100}
+    ,{   220,   160,   190,   220,   190}
+    ,{   210,    10,    50,   210,    50}
+    ,{   220,   160,   190,   220,   190}
+    }
+   ,{{   300,   200,   240,   300,   240}
+    ,{   270,   200,   240,   270,   240}
+    ,{   300,   170,   210,   300,   210}
+    ,{   270,   200,   240,   270,   240}
+    ,{   150,   140,   120,   150,   120}
+    }
+   }
+  ,{{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   220,   220,   220,   220,   220}
+    ,{   240,   240,   240,   240,   240}
+    ,{   210,   210,   210,   210,   210}
+    }
+   ,{{   200,   200,   200,   200,   200}
+    ,{   200,   200,   200,   200,   200}
+    ,{   190,   190,   190,   190,   190}
+    ,{   160,   100,   160,   100,   160}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   220,   220,   220,   220,   220}
+    ,{   240,   240,   240,   240,   240}
+    ,{   210,   210,   210,   210,   210}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   160,   100,   160,   100,   160}
+    ,{   190,   190,   190,   190,   190}
+    ,{    50,    50,    50,    50,    50}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   210,   210,   210,   210,   210}
+    ,{   240,   240,   240,   240,   240}
+    ,{   120,   120,   120,   120,   120}
+    }
+   }
+  ,{{{   240,   150,   240,   180,   240}
+    ,{   240,   100,   240,   110,   240}
+    ,{   220,   150,   220,    90,   220}
+    ,{   240,   100,   240,   180,   240}
+    ,{   210,   130,   210,   120,   210}
+    }
+   ,{{   200,    60,   200,   100,   200}
+    ,{   200,    60,   200,    70,   200}
+    ,{   190,    60,   190,    60,   190}
+    ,{   100,   -30,   100,   100,   100}
+    ,{   190,    60,   190,    60,   190}
+    }
+   ,{{   240,   150,   240,   110,   240}
+    ,{   240,   100,   240,   110,   240}
+    ,{   220,   150,   220,    90,   220}
+    ,{   240,   100,   240,   110,   240}
+    ,{   210,   130,   210,    80,   210}
+    }
+   ,{{   190,    60,   190,   180,   190}
+    ,{   100,   -30,   100,   100,   100}
+    ,{   190,    60,   190,    60,   190}
+    ,{   180,    40,    50,   180,    50}
+    ,{   190,    60,   190,    60,   190}
+    }
+   ,{{   240,   130,   240,   120,   240}
+    ,{   240,   100,   240,   110,   240}
+    ,{   210,   130,   210,    80,   210}
+    ,{   240,   100,   240,   110,   240}
+    ,{   120,   -10,   120,   120,   120}
+    }
+   }
+  ,{{{   260,   240,   240,   240,   260}
+    ,{   260,   240,   240,   240,   260}
+    ,{   220,   220,   220,   220,   220}
+    ,{   240,   240,   240,   240,   240}
+    ,{   210,   210,   210,   210,   210}
+    }
+   ,{{   260,   200,   200,   200,   260}
+    ,{   260,   200,   200,   200,   260}
+    ,{   190,   190,   190,   190,   190}
+    ,{   160,   100,   160,   100,   100}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   220,   220,   220,   220,   220}
+    ,{   240,   240,   240,   240,   240}
+    ,{   210,   210,   210,   210,   210}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   160,   100,   160,   100,   100}
+    ,{   190,   190,   190,   190,   190}
+    ,{   180,    50,    50,    50,   180}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   210,   210,   210,   210,   210}
+    ,{   240,   240,   240,   240,   240}
+    ,{   120,   120,   120,   120,   120}
+    }
+   }
+  }
+ ,{{{{   280,   210,   210,   280,   270}
+    ,{   270,   210,   210,   240,   270}
+    ,{   280,   190,   190,   280,   190}
+    ,{   210,   180,   180,   210,   180}
+    ,{   280,   190,   190,   280,   190}
+    }
+   ,{{   270,   210,   210,   240,   270}
+    ,{   270,   210,   210,   240,   270}
+    ,{   220,   190,   190,   220,   190}
+    ,{    70,    10,    70,    40,    70}
+    ,{   220,   190,   190,   220,   190}
+    }
+   ,{{   280,   190,   190,   280,   190}
+    ,{   210,   180,   180,   210,   180}
+    ,{   280,   190,   190,   280,   190}
+    ,{   210,   180,   180,   210,   180}
+    ,{   280,   190,   190,   280,   190}
+    }
+   ,{{   220,   190,   190,   220,   190}
+    ,{   130,    70,   130,   100,   130}
+    ,{   220,   190,   190,   220,   190}
+    ,{   210,    50,    50,   210,   180}
+    ,{   220,   190,   190,   220,   190}
+    }
+   ,{{   280,   190,   190,   280,   190}
+    ,{   210,   180,   180,   210,   180}
+    ,{   280,   190,   190,   280,   190}
+    ,{   210,   180,   180,   210,   180}
+    ,{   140,   140,   110,   140,   110}
+    }
+   }
+  ,{{{   280,   190,   210,   280,   210}
+    ,{   240,   190,   210,   240,   210}
+    ,{   280,   160,   190,   280,   190}
+    ,{   210,   150,   180,   210,   180}
+    ,{   280,   150,   190,   280,   190}
+    }
+   ,{{   240,   190,   210,   240,   210}
+    ,{   240,   190,   210,   240,   210}
+    ,{   220,   150,   190,   220,   190}
+    ,{    40,   -20,    10,    40,    10}
+    ,{   220,   150,   190,   220,   190}
+    }
+   ,{{   280,   150,   190,   280,   190}
+    ,{   210,   150,   180,   210,   180}
+    ,{   280,   150,   190,   280,   190}
+    ,{   210,   150,   180,   210,   180}
+    ,{   280,   150,   190,   280,   190}
+    }
+   ,{{   220,   150,   190,   220,   190}
+    ,{   100,    40,    70,   100,    70}
+    ,{   220,   150,   190,   220,   190}
+    ,{   210,    10,    50,   210,    50}
+    ,{   220,   150,   190,   220,   190}
+    }
+   ,{{   280,   160,   190,   280,   190}
+    ,{   210,   150,   180,   210,   180}
+    ,{   280,   160,   190,   280,   190}
+    ,{   210,   150,   180,   210,   180}
+    ,{   140,   140,   110,   140,   110}
+    }
+   }
+  ,{{{   210,   210,   210,   210,   210}
+    ,{   210,   210,   210,   210,   210}
+    ,{   190,   190,   190,   190,   190}
+    ,{   180,   180,   180,   180,   180}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   210,   210,   210,   210,   210}
+    ,{   210,   210,   210,   210,   210}
+    ,{   190,   190,   190,   190,   190}
+    ,{    70,    10,    70,    10,    70}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   180,   180,   180,   180,   180}
+    ,{   190,   190,   190,   190,   190}
+    ,{   180,   180,   180,   180,   180}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   130,    70,   130,    70,   130}
+    ,{   190,   190,   190,   190,   190}
+    ,{    50,    50,    50,    50,    50}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   180,   180,   180,   180,   180}
+    ,{   190,   190,   190,   190,   190}
+    ,{   180,   180,   180,   180,   180}
+    ,{   110,   110,   110,   110,   110}
+    }
+   }
+  ,{{{   210,   120,   210,   180,   210}
+    ,{   210,    80,   210,    80,   210}
+    ,{   190,   120,   190,    60,   190}
+    ,{   180,    50,   180,   180,   180}
+    ,{   190,   110,   190,   110,   190}
+    }
+   ,{{   210,    80,   210,    80,   210}
+    ,{   210,    80,   210,    80,   210}
+    ,{   190,    50,   190,    60,   190}
+    ,{    10,  -120,    10,    10,    10}
+    ,{   190,    50,   190,    60,   190}
+    }
+   ,{{   190,   110,   190,    60,   190}
+    ,{   180,    50,   180,    50,   180}
+    ,{   190,   110,   190,    60,   190}
+    ,{   180,    50,   180,    50,   180}
+    ,{   190,   110,   190,    60,   190}
+    }
+   ,{{   190,    50,   190,   180,   190}
+    ,{    70,   -60,    70,    70,    70}
+    ,{   190,    50,   190,    60,   190}
+    ,{   180,    40,    50,   180,    50}
+    ,{   190,    50,   190,    60,   190}
+    }
+   ,{{   190,   120,   190,   110,   190}
+    ,{   180,    50,   180,    50,   180}
+    ,{   190,   120,   190,    60,   190}
+    ,{   180,    50,   180,    50,   180}
+    ,{   110,   -20,   110,   110,   110}
+    }
+   }
+  ,{{{   270,   210,   210,   210,   270}
+    ,{   270,   210,   210,   210,   270}
+    ,{   190,   190,   190,   190,   190}
+    ,{   180,   180,   180,   180,   180}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   270,   210,   210,   210,   270}
+    ,{   270,   210,   210,   210,   270}
+    ,{   190,   190,   190,   190,   190}
+    ,{    70,    10,    70,    10,    10}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   180,   180,   180,   180,   180}
+    ,{   190,   190,   190,   190,   190}
+    ,{   180,   180,   180,   180,   180}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   130,    70,   130,    70,    70}
+    ,{   190,   190,   190,   190,   190}
+    ,{   180,    50,    50,    50,   180}
+    ,{   190,   190,   190,   190,   190}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   180,   180,   180,   180,   180}
+    ,{   190,   190,   190,   190,   190}
+    ,{   180,   180,   180,   180,   180}
+    ,{   110,   110,   110,   110,   110}
+    }
+   }
+  }
+ ,{{{{   400,   360,   340,   400,   400}
+    ,{   400,   360,   340,   370,   400}
+    ,{   400,   310,   310,   400,   310}
+    ,{   340,   310,   310,   340,   310}
+    ,{   400,   330,   310,   400,   310}
+    }
+   ,{{   400,   360,   340,   370,   400}
+    ,{   400,   360,   340,   370,   400}
+    ,{   340,   310,   310,   340,   310}
+    ,{   290,   230,   290,   260,   290}
+    ,{   340,   310,   310,   340,   310}
+    }
+   ,{{   400,   310,   310,   400,   310}
+    ,{   340,   310,   310,   340,   310}
+    ,{   400,   310,   310,   400,   310}
+    ,{   340,   310,   310,   340,   310}
+    ,{   400,   310,   310,   400,   310}
+    }
+   ,{{   360,   360,   330,   340,   330}
+    ,{   360,   360,   330,   300,   330}
+    ,{   340,   310,   310,   340,   310}
+    ,{   340,   180,   180,   340,   310}
+    ,{   340,   310,   310,   340,   310}
+    }
+   ,{{   400,   330,   310,   400,   310}
+    ,{   340,   310,   310,   340,   310}
+    ,{   400,   310,   310,   400,   310}
+    ,{   340,   310,   310,   340,   310}
+    ,{   340,   330,   310,   340,   310}
+    }
+   }
+  ,{{{   400,   360,   340,   400,   340}
+    ,{   370,   360,   340,   370,   340}
+    ,{   400,   270,   310,   400,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   400,   330,   310,   400,   310}
+    }
+   ,{{   370,   360,   340,   370,   340}
+    ,{   370,   360,   340,   370,   340}
+    ,{   340,   270,   310,   340,   310}
+    ,{   260,   190,   230,   260,   230}
+    ,{   340,   270,   310,   340,   310}
+    }
+   ,{{   400,   270,   310,   400,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   400,   270,   310,   400,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   400,   270,   310,   400,   310}
+    }
+   ,{{   360,   360,   310,   340,   310}
+    ,{   360,   360,   270,   300,   270}
+    ,{   340,   270,   310,   340,   310}
+    ,{   340,   140,   180,   340,   180}
+    ,{   340,   270,   310,   340,   310}
+    }
+   ,{{   400,   330,   310,   400,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   400,   270,   310,   400,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   340,   330,   310,   340,   310}
+    }
+   }
+  ,{{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   310,   310,   310,   310,   310}
+    ,{   290,   230,   290,   230,   290}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   330,   310,   330,   310,   330}
+    ,{   330,   270,   330,   270,   330}
+    ,{   310,   310,   310,   310,   310}
+    ,{   180,   180,   180,   180,   180}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   }
+  ,{{{   340,   230,   340,   310,   340}
+    ,{   340,   220,   340,   270,   340}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   170,   310,   310,   310}
+    ,{   310,   230,   310,   310,   310}
+    }
+   ,{{   340,   220,   340,   230,   340}
+    ,{   340,   220,   340,   210,   340}
+    ,{   310,   170,   310,   180,   310}
+    ,{   230,    20,   230,   230,   230}
+    ,{   310,   170,   310,   180,   310}
+    }
+   ,{{   310,   230,   310,   180,   310}
+    ,{   310,   170,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   170,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    }
+   ,{{   310,   170,   310,   310,   310}
+    ,{   270,   130,   270,   270,   270}
+    ,{   310,   170,   310,   180,   310}
+    ,{   310,   170,   180,   310,   180}
+    ,{   310,   170,   310,   180,   310}
+    }
+   ,{{   310,   230,   310,   310,   310}
+    ,{   310,   170,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   170,   310,   180,   310}
+    ,{   310,   170,   310,   310,   310}
+    }
+   }
+  ,{{{   400,   340,   340,   340,   400}
+    ,{   400,   340,   340,   340,   400}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   400,   340,   340,   340,   400}
+    ,{   400,   340,   340,   340,   400}
+    ,{   310,   310,   310,   310,   310}
+    ,{   290,   230,   290,   230,   230}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   330,   310,   330,   310,   310}
+    ,{   330,   270,   330,   270,   270}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   180,   180,   180,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   }
+  }
+ ,{{{{   370,   310,   370,   370,   370}
+    ,{   370,   310,   370,   340,   370}
+    ,{   370,   280,   280,   370,   280}
+    ,{   310,   280,   280,   310,   280}
+    ,{   370,   300,   280,   370,   280}
+    }
+   ,{{   310,   280,   280,   310,   300}
+    ,{   300,   240,   240,   270,   300}
+    ,{   310,   280,   280,   310,   280}
+    ,{   200,   140,   200,   170,   200}
+    ,{   310,   280,   280,   310,   280}
+    }
+   ,{{   370,   280,   280,   370,   280}
+    ,{   310,   280,   280,   310,   280}
+    ,{   370,   280,   280,   370,   280}
+    ,{   310,   280,   280,   310,   280}
+    ,{   370,   280,   280,   370,   280}
+    }
+   ,{{   370,   310,   370,   340,   370}
+    ,{   370,   310,   370,   340,   370}
+    ,{   310,   280,   280,   310,   280}
+    ,{   310,   150,   150,   310,   280}
+    ,{   310,   280,   280,   310,   280}
+    }
+   ,{{   370,   300,   280,   370,   280}
+    ,{   310,   280,   280,   310,   280}
+    ,{   370,   280,   280,   370,   280}
+    ,{   310,   280,   280,   310,   280}
+    ,{   310,   300,   280,   310,   280}
+    }
+   }
+  ,{{{   370,   300,   310,   370,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   370,   240,   280,   370,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   370,   300,   280,   370,   280}
+    }
+   ,{{   310,   240,   280,   310,   280}
+    ,{   270,   210,   240,   270,   240}
+    ,{   310,   240,   280,   310,   280}
+    ,{   170,   110,   140,   170,   140}
+    ,{   310,   240,   280,   310,   280}
+    }
+   ,{{   370,   240,   280,   370,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   370,   240,   280,   370,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   370,   240,   280,   370,   280}
+    }
+   ,{{   340,   270,   310,   340,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   310,   240,   280,   310,   280}
+    ,{   310,   110,   150,   310,   150}
+    ,{   310,   240,   280,   310,   280}
+    }
+   ,{{   370,   300,   280,   370,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   370,   240,   280,   370,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   310,   300,   280,   310,   280}
+    }
+   }
+  ,{{{   370,   310,   370,   310,   370}
+    ,{   370,   310,   370,   310,   370}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   280,   280,   280,   280,   280}
+    ,{   240,   240,   240,   240,   240}
+    ,{   280,   280,   280,   280,   280}
+    ,{   200,   140,   200,   140,   200}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   370,   310,   370,   310,   370}
+    ,{   370,   310,   370,   310,   370}
+    ,{   280,   280,   280,   280,   280}
+    ,{   150,   150,   150,   150,   150}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    }
+   }
+  ,{{{   310,   200,   310,   310,   310}
+    ,{   310,   170,   310,   310,   310}
+    ,{   280,   200,   280,   150,   280}
+    ,{   280,   140,   280,   280,   280}
+    ,{   280,   200,   280,   280,   280}
+    }
+   ,{{   280,   140,   280,   150,   280}
+    ,{   240,   110,   240,   110,   240}
+    ,{   280,   140,   280,   150,   280}
+    ,{   140,    10,   140,   140,   140}
+    ,{   280,   140,   280,   150,   280}
+    }
+   ,{{   280,   200,   280,   150,   280}
+    ,{   280,   140,   280,   150,   280}
+    ,{   280,   200,   280,   150,   280}
+    ,{   280,   140,   280,   150,   280}
+    ,{   280,   200,   280,   150,   280}
+    }
+   ,{{   310,   170,   310,   310,   310}
+    ,{   310,   170,   310,   310,   310}
+    ,{   280,   140,   280,   150,   280}
+    ,{   280,   140,   150,   280,   150}
+    ,{   280,   140,   280,   150,   280}
+    }
+   ,{{   280,   200,   280,   280,   280}
+    ,{   280,   140,   280,   150,   280}
+    ,{   280,   200,   280,   150,   280}
+    ,{   280,   140,   280,   150,   280}
+    ,{   280,   140,   280,   280,   280}
+    }
+   }
+  ,{{{   370,   310,   370,   310,   310}
+    ,{   370,   310,   370,   310,   310}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   300,   280,   280,   280,   300}
+    ,{   300,   240,   240,   240,   300}
+    ,{   280,   280,   280,   280,   280}
+    ,{   200,   140,   200,   140,   140}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   370,   310,   370,   310,   310}
+    ,{   370,   310,   370,   310,   310}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   150,   150,   150,   280}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    }
+   }
+  }
+ ,{{{{   350,   280,   280,   350,   340}
+    ,{   340,   280,   280,   310,   340}
+    ,{   350,   260,   260,   350,   260}
+    ,{   290,   260,   260,   290,   260}
+    ,{   350,   260,   260,   350,   260}
+    }
+   ,{{   340,   280,   280,   310,   340}
+    ,{   340,   280,   280,   310,   340}
+    ,{   280,   250,   250,   280,   250}
+    ,{   210,   150,   210,   180,   210}
+    ,{   280,   250,   250,   280,   250}
+    }
+   ,{{   350,   260,   260,   350,   260}
+    ,{   290,   260,   260,   290,   260}
+    ,{   350,   260,   260,   350,   260}
+    ,{   290,   260,   260,   290,   260}
+    ,{   350,   260,   260,   350,   260}
+    }
+   ,{{   280,   250,   280,   280,   280}
+    ,{   280,   220,   280,   250,   280}
+    ,{   280,   250,   250,   280,   250}
+    ,{   260,   100,   100,   260,   230}
+    ,{   280,   250,   250,   280,   250}
+    }
+   ,{{   350,   260,   260,   350,   260}
+    ,{   290,   260,   260,   290,   260}
+    ,{   350,   260,   260,   350,   260}
+    ,{   290,   260,   260,   290,   260}
+    ,{   200,   190,   170,   200,   170}
+    }
+   }
+  ,{{{   350,   240,   280,   350,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   350,   220,   260,   350,   260}
+    ,{   290,   230,   260,   290,   260}
+    ,{   350,   220,   260,   350,   260}
+    }
+   ,{{   310,   240,   280,   310,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   280,   220,   250,   280,   250}
+    ,{   180,   120,   150,   180,   150}
+    ,{   280,   220,   250,   280,   250}
+    }
+   ,{{   350,   230,   260,   350,   260}
+    ,{   290,   230,   260,   290,   260}
+    ,{   350,   220,   260,   350,   260}
+    ,{   290,   230,   260,   290,   260}
+    ,{   350,   220,   260,   350,   260}
+    }
+   ,{{   280,   220,   250,   280,   250}
+    ,{   250,   190,   220,   250,   220}
+    ,{   280,   220,   250,   280,   250}
+    ,{   260,    70,   100,   260,   100}
+    ,{   280,   220,   250,   280,   250}
+    }
+   ,{{   350,   230,   260,   350,   260}
+    ,{   290,   230,   260,   290,   260}
+    ,{   350,   220,   260,   350,   260}
+    ,{   290,   230,   260,   290,   260}
+    ,{   200,   190,   170,   200,   170}
+    }
+   }
+  ,{{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   250,   250,   250,   250,   250}
+    ,{   210,   150,   210,   150,   210}
+    ,{   250,   250,   250,   250,   250}
+    }
+   ,{{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   280,   250,   280,   250,   280}
+    ,{   280,   220,   280,   220,   280}
+    ,{   250,   250,   250,   250,   250}
+    ,{   100,   100,   100,   100,   100}
+    ,{   250,   250,   250,   250,   250}
+    }
+   ,{{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   170,   170,   170,   170,   170}
+    }
+   }
+  ,{{{   280,   180,   280,   230,   280}
+    ,{   280,   140,   280,   220,   280}
+    ,{   260,   180,   260,   130,   260}
+    ,{   260,   130,   260,   230,   260}
+    ,{   260,   180,   260,   170,   260}
+    }
+   ,{{   280,   140,   280,   150,   280}
+    ,{   280,   140,   280,   150,   280}
+    ,{   250,   120,   250,   120,   250}
+    ,{   150,    20,   150,   150,   150}
+    ,{   250,   120,   250,   120,   250}
+    }
+   ,{{   260,   180,   260,   130,   260}
+    ,{   260,   130,   260,   130,   260}
+    ,{   260,   180,   260,   130,   260}
+    ,{   260,   130,   260,   130,   260}
+    ,{   260,   180,   260,   130,   260}
+    }
+   ,{{   250,   120,   250,   230,   250}
+    ,{   220,    90,   220,   220,   220}
+    ,{   250,   120,   250,   120,   250}
+    ,{   230,   100,   100,   230,   100}
+    ,{   250,   120,   250,   120,   250}
+    }
+   ,{{   260,   180,   260,   170,   260}
+    ,{   260,   130,   260,   130,   260}
+    ,{   260,   180,   260,   130,   260}
+    ,{   260,   130,   260,   130,   260}
+    ,{   170,    30,   170,   170,   170}
+    }
+   }
+  ,{{{   340,   280,   280,   280,   340}
+    ,{   340,   280,   280,   280,   340}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   340,   280,   280,   280,   340}
+    ,{   340,   280,   280,   280,   340}
+    ,{   250,   250,   250,   250,   250}
+    ,{   210,   150,   210,   150,   150}
+    ,{   250,   250,   250,   250,   250}
+    }
+   ,{{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   280,   250,   280,   250,   250}
+    ,{   280,   220,   280,   220,   220}
+    ,{   250,   250,   250,   250,   250}
+    ,{   230,   100,   100,   100,   230}
+    ,{   250,   250,   250,   250,   250}
+    }
+   ,{{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   260,   260,   260,   260}
+    ,{   170,   170,   170,   170,   170}
+    }
+   }
+  }
+ ,{{{{   370,   280,   280,   370,   340}
+    ,{   340,   280,   280,   310,   340}
+    ,{   370,   280,   280,   370,   280}
+    ,{   310,   280,   280,   310,   280}
+    ,{   370,   280,   280,   370,   280}
+    }
+   ,{{   340,   280,   280,   310,   340}
+    ,{   340,   280,   280,   310,   340}
+    ,{   260,   230,   230,   260,   230}
+    ,{   230,   170,   230,   200,   230}
+    ,{   260,   230,   230,   260,   230}
+    }
+   ,{{   370,   280,   280,   370,   280}
+    ,{   310,   280,   280,   310,   280}
+    ,{   370,   280,   280,   370,   280}
+    ,{   310,   280,   280,   310,   280}
+    ,{   370,   280,   280,   370,   280}
+    }
+   ,{{   280,   230,   240,   280,   250}
+    ,{   240,   180,   240,   210,   240}
+    ,{   260,   230,   230,   260,   230}
+    ,{   280,   120,   120,   280,   250}
+    ,{   260,   230,   230,   260,   230}
+    }
+   ,{{   340,   280,   280,   340,   280}
+    ,{   310,   280,   280,   310,   280}
+    ,{   340,   250,   250,   340,   250}
+    ,{   310,   280,   280,   310,   280}
+    ,{   220,   220,   190,   220,   190}
+    }
+   }
+  ,{{{   370,   240,   280,   370,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   370,   240,   280,   370,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   370,   240,   280,   370,   280}
+    }
+   ,{{   310,   240,   280,   310,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   260,   200,   230,   260,   230}
+    ,{   200,   140,   170,   200,   170}
+    ,{   260,   200,   230,   260,   230}
+    }
+   ,{{   370,   240,   280,   370,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   370,   240,   280,   370,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   370,   240,   280,   370,   280}
+    }
+   ,{{   280,   200,   230,   280,   230}
+    ,{   210,   150,   180,   210,   180}
+    ,{   260,   200,   230,   260,   230}
+    ,{   280,    90,   120,   280,   120}
+    ,{   260,   200,   230,   260,   230}
+    }
+   ,{{   340,   240,   280,   340,   280}
+    ,{   310,   240,   280,   310,   280}
+    ,{   340,   210,   250,   340,   250}
+    ,{   310,   240,   280,   310,   280}
+    ,{   220,   220,   190,   220,   190}
+    }
+   }
+  ,{{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   230,   230,   230,   230,   230}
+    ,{   230,   170,   230,   170,   230}
+    ,{   230,   230,   230,   230,   230}
+    }
+   ,{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   240,   230,   240,   230,   240}
+    ,{   240,   180,   240,   180,   240}
+    ,{   230,   230,   230,   230,   230}
+    ,{   120,   120,   120,   120,   120}
+    ,{   230,   230,   230,   230,   230}
+    }
+   ,{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   250,   250,   250,   250,   250}
+    ,{   280,   280,   280,   280,   280}
+    ,{   190,   190,   190,   190,   190}
+    }
+   }
+  ,{{{   280,   200,   280,   250,   280}
+    ,{   280,   140,   280,   180,   280}
+    ,{   280,   200,   280,   150,   280}
+    ,{   280,   140,   280,   250,   280}
+    ,{   280,   200,   280,   190,   280}
+    }
+   ,{{   280,   140,   280,   170,   280}
+    ,{   280,   140,   280,   150,   280}
+    ,{   230,   100,   230,   100,   230}
+    ,{   170,    40,   170,   170,   170}
+    ,{   230,   100,   230,   100,   230}
+    }
+   ,{{   280,   200,   280,   150,   280}
+    ,{   280,   140,   280,   150,   280}
+    ,{   280,   200,   280,   150,   280}
+    ,{   280,   140,   280,   150,   280}
+    ,{   280,   200,   280,   150,   280}
+    }
+   ,{{   250,   120,   230,   250,   230}
+    ,{   180,    50,   180,   180,   180}
+    ,{   230,   100,   230,   100,   230}
+    ,{   250,   120,   120,   250,   120}
+    ,{   230,   100,   230,   100,   230}
+    }
+   ,{{   280,   170,   280,   190,   280}
+    ,{   280,   140,   280,   150,   280}
+    ,{   250,   170,   250,   120,   250}
+    ,{   280,   140,   280,   150,   280}
+    ,{   190,    60,   190,   190,   190}
+    }
+   }
+  ,{{{   340,   280,   280,   280,   340}
+    ,{   340,   280,   280,   280,   340}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   340,   280,   280,   280,   340}
+    ,{   340,   280,   280,   280,   340}
+    ,{   230,   230,   230,   230,   230}
+    ,{   230,   170,   230,   170,   170}
+    ,{   230,   230,   230,   230,   230}
+    }
+   ,{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   250,   230,   240,   230,   250}
+    ,{   240,   180,   240,   180,   180}
+    ,{   230,   230,   230,   230,   230}
+    ,{   250,   120,   120,   120,   250}
+    ,{   230,   230,   230,   230,   230}
+    }
+   ,{{   280,   280,   280,   280,   280}
+    ,{   280,   280,   280,   280,   280}
+    ,{   250,   250,   250,   250,   250}
+    ,{   280,   280,   280,   280,   280}
+    ,{   190,   190,   190,   190,   190}
+    }
+   }
+  }
+ ,{{{{   400,   360,   370,   400,   400}
+    ,{   400,   360,   370,   370,   400}
+    ,{   400,   310,   310,   400,   310}
+    ,{   340,   310,   310,   340,   310}
+    ,{   400,   330,   310,   400,   310}
+    }
+   ,{{   400,   360,   340,   370,   400}
+    ,{   400,   360,   340,   370,   400}
+    ,{   340,   310,   310,   340,   310}
+    ,{   290,   230,   290,   260,   290}
+    ,{   340,   310,   310,   340,   310}
+    }
+   ,{{   400,   310,   310,   400,   310}
+    ,{   340,   310,   310,   340,   310}
+    ,{   400,   310,   310,   400,   310}
+    ,{   340,   310,   310,   340,   310}
+    ,{   400,   310,   310,   400,   310}
+    }
+   ,{{   370,   360,   370,   340,   370}
+    ,{   370,   360,   370,   340,   370}
+    ,{   340,   310,   310,   340,   310}
+    ,{   340,   180,   180,   340,   310}
+    ,{   340,   310,   310,   340,   310}
+    }
+   ,{{   400,   330,   310,   400,   310}
+    ,{   340,   310,   310,   340,   310}
+    ,{   400,   310,   310,   400,   310}
+    ,{   340,   310,   310,   340,   310}
+    ,{   340,   330,   310,   340,   310}
+    }
+   }
+  ,{{{   400,   360,   340,   400,   340}
+    ,{   370,   360,   340,   370,   340}
+    ,{   400,   270,   310,   400,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   400,   330,   310,   400,   310}
+    }
+   ,{{   370,   360,   340,   370,   340}
+    ,{   370,   360,   340,   370,   340}
+    ,{   340,   270,   310,   340,   310}
+    ,{   260,   190,   230,   260,   230}
+    ,{   340,   270,   310,   340,   310}
+    }
+   ,{{   400,   270,   310,   400,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   400,   270,   310,   400,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   400,   270,   310,   400,   310}
+    }
+   ,{{   360,   360,   310,   340,   310}
+    ,{   360,   360,   310,   340,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   340,   140,   180,   340,   180}
+    ,{   340,   270,   310,   340,   310}
+    }
+   ,{{   400,   330,   310,   400,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   400,   270,   310,   400,   310}
+    ,{   340,   270,   310,   340,   310}
+    ,{   340,   330,   310,   340,   310}
+    }
+   }
+  ,{{{   370,   340,   370,   340,   370}
+    ,{   370,   340,   370,   340,   370}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   310,   310,   310,   310,   310}
+    ,{   290,   230,   290,   230,   290}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   370,   310,   370,   310,   370}
+    ,{   370,   310,   370,   310,   370}
+    ,{   310,   310,   310,   310,   310}
+    ,{   180,   180,   180,   180,   180}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   }
+  ,{{{   340,   230,   340,   310,   340}
+    ,{   340,   220,   340,   310,   340}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   170,   310,   310,   310}
+    ,{   310,   230,   310,   310,   310}
+    }
+   ,{{   340,   220,   340,   230,   340}
+    ,{   340,   220,   340,   210,   340}
+    ,{   310,   170,   310,   180,   310}
+    ,{   230,    40,   230,   230,   230}
+    ,{   310,   170,   310,   180,   310}
+    }
+   ,{{   310,   230,   310,   180,   310}
+    ,{   310,   170,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   170,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    }
+   ,{{   310,   170,   310,   310,   310}
+    ,{   310,   170,   310,   310,   310}
+    ,{   310,   170,   310,   180,   310}
+    ,{   310,   170,   180,   310,   180}
+    ,{   310,   170,   310,   180,   310}
+    }
+   ,{{   310,   230,   310,   310,   310}
+    ,{   310,   170,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   170,   310,   180,   310}
+    ,{   310,   170,   310,   310,   310}
+    }
+   }
+  ,{{{   400,   340,   370,   340,   400}
+    ,{   400,   340,   370,   340,   400}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   400,   340,   340,   340,   400}
+    ,{   400,   340,   340,   340,   400}
+    ,{   310,   310,   310,   310,   310}
+    ,{   290,   230,   290,   230,   230}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   370,   310,   370,   310,   310}
+    ,{   370,   310,   370,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   180,   180,   180,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   240,   240,   220,   230,   220}
+    ,{   240,   240,   220,   210,   220}
+    ,{   230,   220,   210,   230,   210}
+    ,{   240,   240,   220,   210,   220}
+    ,{   210,   210,   190,   210,   190}
+    }
+   ,{{   200,   200,   180,   170,   180}
+    ,{   200,   200,   180,   170,   180}
+    ,{   190,   190,   180,   170,   180}
+    ,{   140,   100,   140,    80,   140}
+    ,{   190,   190,   180,   170,   180}
+    }
+   ,{{   240,   240,   220,   230,   220}
+    ,{   240,   240,   220,   210,   220}
+    ,{   230,   220,   210,   230,   210}
+    ,{   240,   240,   220,   210,   220}
+    ,{   210,   210,   190,   210,   190}
+    }
+   ,{{   190,   190,   180,   170,   180}
+    ,{   140,   100,   140,    80,   140}
+    ,{   190,   190,   180,   170,   180}
+    ,{   130,    50,    30,   130,    70}
+    ,{   190,   190,   180,   170,   180}
+    }
+   ,{{   240,   240,   220,   210,   220}
+    ,{   240,   240,   220,   210,   220}
+    ,{   210,   210,   190,   210,   190}
+    ,{   240,   240,   220,   210,   220}
+    ,{   180,   180,   100,    90,   100}
+    }
+   }
+  ,{{{   240,   240,   220,   230,   220}
+    ,{   240,   240,   220,   180,   220}
+    ,{   230,   220,   210,   230,   210}
+    ,{   240,   240,   220,   180,   220}
+    ,{   210,   210,   190,   210,   190}
+    }
+   ,{{   200,   200,   180,   140,   180}
+    ,{   200,   200,   180,   140,   180}
+    ,{   190,   190,   180,   140,   180}
+    ,{   100,   100,    90,    50,    90}
+    ,{   190,   190,   180,   140,   180}
+    }
+   ,{{   240,   240,   220,   230,   220}
+    ,{   240,   240,   220,   180,   220}
+    ,{   230,   220,   210,   230,   210}
+    ,{   240,   240,   220,   180,   220}
+    ,{   210,   210,   190,   210,   190}
+    }
+   ,{{   190,   190,   180,   140,   180}
+    ,{   100,   100,    90,    50,    90}
+    ,{   190,   190,   180,   140,   180}
+    ,{   120,    50,    30,   120,    30}
+    ,{   190,   190,   180,   140,   180}
+    }
+   ,{{   240,   240,   220,   210,   220}
+    ,{   240,   240,   220,   180,   220}
+    ,{   210,   210,   190,   210,   190}
+    ,{   240,   240,   220,   180,   220}
+    ,{   180,   180,   100,    60,   100}
+    }
+   }
+  ,{{{   220,   210,   220,   210,   220}
+    ,{   220,   210,   220,   210,   220}
+    ,{   200,   200,   200,   200,   200}
+    ,{   220,   210,   220,   210,   220}
+    ,{   190,   180,   190,   180,   190}
+    }
+   ,{{   180,   170,   180,   170,   180}
+    ,{   180,   170,   180,   170,   180}
+    ,{   170,   170,   170,   170,   170}
+    ,{   140,    80,   140,    80,   140}
+    ,{   170,   170,   170,   170,   170}
+    }
+   ,{{   220,   210,   220,   210,   220}
+    ,{   220,   210,   220,   210,   220}
+    ,{   200,   200,   200,   200,   200}
+    ,{   220,   210,   220,   210,   220}
+    ,{   190,   180,   190,   180,   190}
+    }
+   ,{{   170,   170,   170,   170,   170}
+    ,{   140,    80,   140,    80,   140}
+    ,{   170,   170,   170,   170,   170}
+    ,{    30,    20,    30,    20,    30}
+    ,{   170,   170,   170,   170,   170}
+    }
+   ,{{   220,   210,   220,   210,   220}
+    ,{   220,   210,   220,   210,   220}
+    ,{   190,   180,   190,   180,   190}
+    ,{   220,   210,   220,   210,   220}
+    ,{   100,    90,   100,    90,   100}
+    }
+   }
+  ,{{{   220,   160,   220,   130,   220}
+    ,{   220,   110,   220,    60,   220}
+    ,{   210,   160,   210,    50,   210}
+    ,{   220,   110,   220,   130,   220}
+    ,{   190,   140,   190,    70,   190}
+    }
+   ,{{   180,    70,   180,    60,   180}
+    ,{   180,    70,   180,    20,   180}
+    ,{   180,    70,   180,    20,   180}
+    ,{    90,   -20,    90,    60,    90}
+    ,{   180,    70,   180,    20,   180}
+    }
+   ,{{   220,   160,   220,    60,   220}
+    ,{   220,   110,   220,    60,   220}
+    ,{   210,   160,   210,    50,   210}
+    ,{   220,   110,   220,    60,   220}
+    ,{   190,   140,   190,    30,   190}
+    }
+   ,{{   180,    70,   180,   130,   180}
+    ,{    90,   -20,    90,    60,    90}
+    ,{   180,    70,   180,    20,   180}
+    ,{   130,    50,    30,   130,    30}
+    ,{   180,    70,   180,    20,   180}
+    }
+   ,{{   220,   140,   220,    70,   220}
+    ,{   220,   110,   220,    60,   220}
+    ,{   190,   140,   190,    30,   190}
+    ,{   220,   110,   220,    60,   220}
+    ,{   100,     0,   100,    70,   100}
+    }
+   }
+  ,{{{   220,   210,   220,   210,   150}
+    ,{   220,   210,   220,   210,   150}
+    ,{   200,   200,   200,   200,   110}
+    ,{   220,   210,   220,   210,   130}
+    ,{   190,   180,   190,   180,   100}
+    }
+   ,{{   180,   170,   180,   170,   150}
+    ,{   180,   170,   180,   170,   150}
+    ,{   170,   170,   170,   170,    80}
+    ,{   140,    80,   140,    80,     0}
+    ,{   170,   170,   170,   170,    80}
+    }
+   ,{{   220,   210,   220,   210,   130}
+    ,{   220,   210,   220,   210,   130}
+    ,{   200,   200,   200,   200,   110}
+    ,{   220,   210,   220,   210,   130}
+    ,{   190,   180,   190,   180,   100}
+    }
+   ,{{   170,   170,   170,   170,    80}
+    ,{   140,    80,   140,    80,     0}
+    ,{   170,   170,   170,   170,    80}
+    ,{    70,    20,    30,    20,    70}
+    ,{   170,   170,   170,   170,    80}
+    }
+   ,{{   220,   210,   220,   210,   130}
+    ,{   220,   210,   220,   210,   130}
+    ,{   190,   180,   190,   180,   100}
+    ,{   220,   210,   220,   210,   130}
+    ,{   100,    90,   100,    90,    10}
+    }
+   }
+  }
+ ,{{{{   210,   210,   200,   200,   200}
+    ,{   210,   210,   200,   190,   200}
+    ,{   200,   190,   180,   200,   180}
+    ,{   180,   180,   170,   160,   170}
+    ,{   190,   190,   170,   190,   170}
+    }
+   ,{{   210,   210,   200,   190,   200}
+    ,{   210,   210,   200,   190,   200}
+    ,{   190,   190,   170,   160,   170}
+    ,{    50,    10,    50,   -10,    50}
+    ,{   190,   190,   170,   160,   170}
+    }
+   ,{{   190,   190,   170,   190,   170}
+    ,{   180,   180,   170,   160,   170}
+    ,{   190,   190,   170,   190,   170}
+    ,{   180,   180,   170,   160,   170}
+    ,{   190,   190,   170,   190,   170}
+    }
+   ,{{   190,   190,   170,   160,   170}
+    ,{   110,    70,   110,    50,   110}
+    ,{   190,   190,   170,   160,   170}
+    ,{   130,    50,    30,   130,    70}
+    ,{   190,   190,   170,   160,   170}
+    }
+   ,{{   200,   190,   180,   200,   180}
+    ,{   180,   180,   170,   160,   170}
+    ,{   200,   190,   180,   200,   180}
+    ,{   180,   180,   170,   160,   170}
+    ,{   170,   170,   100,    90,   100}
+    }
+   }
+  ,{{{   210,   210,   200,   200,   200}
+    ,{   210,   210,   200,   160,   200}
+    ,{   200,   190,   180,   200,   180}
+    ,{   180,   180,   170,   130,   170}
+    ,{   190,   190,   170,   190,   170}
+    }
+   ,{{   210,   210,   200,   160,   200}
+    ,{   210,   210,   200,   160,   200}
+    ,{   190,   190,   170,   130,   170}
+    ,{    10,    10,     0,   -40,     0}
+    ,{   190,   190,   170,   130,   170}
+    }
+   ,{{   190,   190,   170,   190,   170}
+    ,{   180,   180,   170,   130,   170}
+    ,{   190,   190,   170,   190,   170}
+    ,{   180,   180,   170,   130,   170}
+    ,{   190,   190,   170,   190,   170}
+    }
+   ,{{   190,   190,   170,   130,   170}
+    ,{    70,    70,    60,    20,    60}
+    ,{   190,   190,   170,   130,   170}
+    ,{   120,    50,    30,   120,    30}
+    ,{   190,   190,   170,   130,   170}
+    }
+   ,{{   200,   190,   180,   200,   180}
+    ,{   180,   180,   170,   130,   170}
+    ,{   200,   190,   180,   200,   180}
+    ,{   180,   180,   170,   130,   170}
+    ,{   170,   170,   100,    60,   100}
+    }
+   }
+  ,{{{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   170,   170,   170,   170,   170}
+    ,{   160,   160,   160,   160,   160}
+    ,{   170,   160,   170,   160,   170}
+    }
+   ,{{   190,   190,   190,   190,   190}
+    ,{   190,   190,   190,   190,   190}
+    ,{   170,   160,   170,   160,   170}
+    ,{    50,   -10,    50,   -10,    50}
+    ,{   170,   160,   170,   160,   170}
+    }
+   ,{{   170,   160,   170,   160,   170}
+    ,{   160,   160,   160,   160,   160}
+    ,{   170,   160,   170,   160,   170}
+    ,{   160,   160,   160,   160,   160}
+    ,{   170,   160,   170,   160,   170}
+    }
+   ,{{   170,   160,   170,   160,   170}
+    ,{   110,    50,   110,    50,   110}
+    ,{   170,   160,   170,   160,   170}
+    ,{    30,    20,    30,    20,    30}
+    ,{   170,   160,   170,   160,   170}
+    }
+   ,{{   170,   170,   170,   170,   170}
+    ,{   160,   160,   160,   160,   160}
+    ,{   170,   170,   170,   170,   170}
+    ,{   160,   160,   160,   160,   160}
+    ,{    90,    90,    90,    90,    90}
+    }
+   }
+  ,{{{   200,   130,   200,   130,   200}
+    ,{   200,    90,   200,    40,   200}
+    ,{   180,   130,   180,    20,   180}
+    ,{   170,    60,   170,   130,   170}
+    ,{   170,   120,   170,    70,   170}
+    }
+   ,{{   200,    90,   200,    40,   200}
+    ,{   200,    90,   200,    40,   200}
+    ,{   170,    60,   170,    10,   170}
+    ,{     0,  -110,     0,   -30,     0}
+    ,{   170,    60,   170,    10,   170}
+    }
+   ,{{   170,   120,   170,    10,   170}
+    ,{   170,    60,   170,    10,   170}
+    ,{   170,   120,   170,    10,   170}
+    ,{   170,    60,   170,    10,   170}
+    ,{   170,   120,   170,    10,   170}
+    }
+   ,{{   170,    60,   170,   130,   170}
+    ,{    60,   -50,    60,    30,    60}
+    ,{   170,    60,   170,    10,   170}
+    ,{   130,    50,    30,   130,    30}
+    ,{   170,    60,   170,    10,   170}
+    }
+   ,{{   180,   130,   180,    70,   180}
+    ,{   170,    60,   170,    10,   170}
+    ,{   180,   130,   180,    20,   180}
+    ,{   170,    60,   170,    10,   170}
+    ,{   100,   -10,   100,    70,   100}
+    }
+   }
+  ,{{{   190,   190,   190,   190,   160}
+    ,{   190,   190,   190,   190,   160}
+    ,{   170,   170,   170,   170,    80}
+    ,{   160,   160,   160,   160,    70}
+    ,{   170,   160,   170,   160,    80}
+    }
+   ,{{   190,   190,   190,   190,   160}
+    ,{   190,   190,   190,   190,   160}
+    ,{   170,   160,   170,   160,    80}
+    ,{    50,   -10,    50,   -10,  -100}
+    ,{   170,   160,   170,   160,    80}
+    }
+   ,{{   170,   160,   170,   160,    80}
+    ,{   160,   160,   160,   160,    70}
+    ,{   170,   160,   170,   160,    80}
+    ,{   160,   160,   160,   160,    70}
+    ,{   170,   160,   170,   160,    80}
+    }
+   ,{{   170,   160,   170,   160,    80}
+    ,{   110,    50,   110,    50,   -30}
+    ,{   170,   160,   170,   160,    80}
+    ,{    70,    20,    30,    20,    70}
+    ,{   170,   160,   170,   160,    80}
+    }
+   ,{{   170,   170,   170,   170,    80}
+    ,{   160,   160,   160,   160,    70}
+    ,{   170,   170,   170,   170,    80}
+    ,{   160,   160,   160,   160,    70}
+    ,{    90,    90,    90,    90,     0}
+    }
+   }
+  }
+ ,{{{{   370,   370,   330,   320,   330}
+    ,{   340,   340,   330,   320,   330}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   280,   290}
+    ,{   370,   370,   290,   310,   290}
+    }
+   ,{{   340,   340,   330,   320,   330}
+    ,{   340,   340,   330,   320,   330}
+    ,{   310,   310,   290,   280,   290}
+    ,{   270,   230,   270,   200,   270}
+    ,{   310,   310,   290,   280,   290}
+    }
+   ,{{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   280,   290}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   280,   290}
+    ,{   310,   310,   290,   310,   290}
+    }
+   ,{{   310,   310,   310,   280,   310}
+    ,{   310,   270,   310,   240,   310}
+    ,{   310,   310,   290,   280,   290}
+    ,{   260,   180,   160,   260,   200}
+    ,{   310,   310,   290,   280,   290}
+    }
+   ,{{   370,   370,   290,   310,   290}
+    ,{   310,   310,   290,   280,   290}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   280,   290}
+    ,{   370,   370,   290,   280,   290}
+    }
+   }
+  ,{{{   370,   370,   330,   310,   330}
+    ,{   340,   340,   330,   290,   330}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   370,   370,   290,   310,   290}
+    }
+   ,{{   340,   340,   330,   290,   330}
+    ,{   340,   340,   330,   290,   330}
+    ,{   310,   310,   290,   250,   290}
+    ,{   230,   230,   210,   170,   210}
+    ,{   310,   310,   290,   250,   290}
+    }
+   ,{{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   310,   310,   290,   310,   290}
+    }
+   ,{{   310,   310,   290,   250,   290}
+    ,{   270,   270,   250,   210,   250}
+    ,{   310,   310,   290,   250,   290}
+    ,{   250,   180,   160,   250,   160}
+    ,{   310,   310,   290,   250,   290}
+    }
+   ,{{   370,   370,   290,   310,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   370,   370,   290,   250,   290}
+    }
+   }
+  ,{{{   320,   320,   320,   320,   320}
+    ,{   320,   320,   320,   320,   320}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    }
+   ,{{   320,   320,   320,   320,   320}
+    ,{   320,   320,   320,   320,   320}
+    ,{   290,   280,   290,   280,   290}
+    ,{   270,   200,   270,   200,   270}
+    ,{   290,   280,   290,   280,   290}
+    }
+   ,{{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    }
+   ,{{   310,   280,   310,   280,   310}
+    ,{   310,   240,   310,   240,   310}
+    ,{   290,   280,   290,   280,   290}
+    ,{   160,   150,   160,   150,   160}
+    ,{   290,   280,   290,   280,   290}
+    }
+   ,{{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    }
+   }
+  ,{{{   330,   240,   330,   260,   330}
+    ,{   330,   220,   330,   220,   330}
+    ,{   290,   240,   290,   130,   290}
+    ,{   290,   180,   290,   260,   290}
+    ,{   290,   240,   290,   260,   290}
+    }
+   ,{{   330,   220,   330,   180,   330}
+    ,{   330,   220,   330,   170,   330}
+    ,{   290,   180,   290,   130,   290}
+    ,{   210,   100,   210,   180,   210}
+    ,{   290,   180,   290,   130,   290}
+    }
+   ,{{   290,   240,   290,   130,   290}
+    ,{   290,   180,   290,   130,   290}
+    ,{   290,   240,   290,   130,   290}
+    ,{   290,   180,   290,   130,   290}
+    ,{   290,   240,   290,   130,   290}
+    }
+   ,{{   290,   180,   290,   260,   290}
+    ,{   250,   140,   250,   220,   250}
+    ,{   290,   180,   290,   130,   290}
+    ,{   260,   180,   160,   260,   160}
+    ,{   290,   180,   290,   130,   290}
+    }
+   ,{{   290,   240,   290,   260,   290}
+    ,{   290,   180,   290,   130,   290}
+    ,{   290,   240,   290,   130,   290}
+    ,{   290,   180,   290,   130,   290}
+    ,{   290,   180,   290,   260,   290}
+    }
+   }
+  ,{{{   320,   320,   320,   320,   290}
+    ,{   320,   320,   320,   320,   290}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    }
+   ,{{   320,   320,   320,   320,   290}
+    ,{   320,   320,   320,   320,   290}
+    ,{   290,   280,   290,   280,   200}
+    ,{   270,   200,   270,   200,   120}
+    ,{   290,   280,   290,   280,   200}
+    }
+   ,{{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    }
+   ,{{   310,   280,   310,   280,   200}
+    ,{   310,   240,   310,   240,   160}
+    ,{   290,   280,   290,   280,   200}
+    ,{   200,   150,   160,   150,   200}
+    ,{   290,   280,   290,   280,   200}
+    }
+   ,{{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    }
+   }
+  }
+ ,{{{{   350,   340,   350,   280,   350}
+    ,{   350,   310,   350,   280,   350}
+    ,{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   340,   340,   260,   280,   260}
+    }
+   ,{{   280,   280,   260,   250,   260}
+    ,{   240,   240,   230,   220,   230}
+    ,{   280,   280,   260,   250,   260}
+    ,{   180,   140,   180,   120,   180}
+    ,{   280,   280,   260,   250,   260}
+    }
+   ,{{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   280,   280,   260,   280,   260}
+    }
+   ,{{   350,   310,   350,   280,   350}
+    ,{   350,   310,   350,   280,   350}
+    ,{   280,   280,   260,   250,   260}
+    ,{   230,   150,   130,   230,   170}
+    ,{   280,   280,   260,   250,   260}
+    }
+   ,{{   340,   340,   260,   280,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   340,   340,   260,   250,   260}
+    }
+   }
+  ,{{{   340,   340,   290,   280,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   340,   340,   260,   280,   260}
+    }
+   ,{{   280,   280,   260,   220,   260}
+    ,{   240,   240,   230,   190,   230}
+    ,{   280,   280,   260,   220,   260}
+    ,{   140,   140,   130,    90,   130}
+    ,{   280,   280,   260,   220,   260}
+    }
+   ,{{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   280,   280,   260,   280,   260}
+    }
+   ,{{   310,   310,   290,   250,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   280,   280,   260,   220,   260}
+    ,{   220,   150,   130,   220,   130}
+    ,{   280,   280,   260,   220,   260}
+    }
+   ,{{   340,   340,   260,   280,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   340,   340,   260,   220,   260}
+    }
+   }
+  ,{{{   350,   280,   350,   280,   350}
+    ,{   350,   280,   350,   280,   350}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    }
+   ,{{   260,   250,   260,   250,   260}
+    ,{   220,   220,   220,   220,   220}
+    ,{   260,   250,   260,   250,   260}
+    ,{   180,   120,   180,   120,   180}
+    ,{   260,   250,   260,   250,   260}
+    }
+   ,{{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    }
+   ,{{   350,   280,   350,   280,   350}
+    ,{   350,   280,   350,   280,   350}
+    ,{   260,   250,   260,   250,   260}
+    ,{   130,   120,   130,   120,   130}
+    ,{   260,   250,   260,   250,   260}
+    }
+   ,{{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    }
+   }
+  ,{{{   290,   210,   290,   260,   290}
+    ,{   290,   180,   290,   260,   290}
+    ,{   260,   210,   260,   100,   260}
+    ,{   260,   150,   260,   230,   260}
+    ,{   260,   210,   260,   230,   260}
+    }
+   ,{{   260,   150,   260,   100,   260}
+    ,{   230,   120,   230,    70,   230}
+    ,{   260,   150,   260,   100,   260}
+    ,{   130,    20,   130,   100,   130}
+    ,{   260,   150,   260,   100,   260}
+    }
+   ,{{   260,   210,   260,   100,   260}
+    ,{   260,   150,   260,   100,   260}
+    ,{   260,   210,   260,   100,   260}
+    ,{   260,   150,   260,   100,   260}
+    ,{   260,   210,   260,   100,   260}
+    }
+   ,{{   290,   180,   290,   260,   290}
+    ,{   290,   180,   290,   260,   290}
+    ,{   260,   150,   260,   100,   260}
+    ,{   230,   150,   130,   230,   130}
+    ,{   260,   150,   260,   100,   260}
+    }
+   ,{{   260,   210,   260,   230,   260}
+    ,{   260,   150,   260,   100,   260}
+    ,{   260,   210,   260,   100,   260}
+    ,{   260,   150,   260,   100,   260}
+    ,{   260,   150,   260,   230,   260}
+    }
+   }
+  ,{{{   350,   280,   350,   280,   200}
+    ,{   350,   280,   350,   280,   200}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    }
+   ,{{   260,   250,   260,   250,   190}
+    ,{   220,   220,   220,   220,   190}
+    ,{   260,   250,   260,   250,   170}
+    ,{   180,   120,   180,   120,    30}
+    ,{   260,   250,   260,   250,   170}
+    }
+   ,{{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    }
+   ,{{   350,   280,   350,   280,   200}
+    ,{   350,   280,   350,   280,   200}
+    ,{   260,   250,   260,   250,   170}
+    ,{   170,   120,   130,   120,   170}
+    ,{   260,   250,   260,   250,   170}
+    }
+   ,{{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    }
+   }
+  }
+ ,{{{{   280,   280,   260,   260,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   260,   260,   240,   260,   240}
+    ,{   260,   260,   250,   240,   250}
+    ,{   260,   260,   240,   260,   240}
+    }
+   ,{{   280,   280,   260,   250,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   250,   250,   240,   230,   240}
+    ,{   190,   150,   190,   130,   190}
+    ,{   250,   250,   240,   230,   240}
+    }
+   ,{{   260,   260,   250,   260,   250}
+    ,{   260,   260,   250,   240,   250}
+    ,{   260,   260,   240,   260,   240}
+    ,{   260,   260,   250,   240,   250}
+    ,{   260,   260,   240,   260,   240}
+    }
+   ,{{   260,   250,   260,   230,   260}
+    ,{   260,   220,   260,   200,   260}
+    ,{   250,   250,   240,   230,   240}
+    ,{   190,   110,    90,   190,   120}
+    ,{   250,   250,   240,   230,   240}
+    }
+   ,{{   260,   260,   250,   260,   250}
+    ,{   260,   260,   250,   240,   250}
+    ,{   260,   260,   240,   260,   240}
+    ,{   260,   260,   250,   240,   250}
+    ,{   230,   230,   150,   140,   150}
+    }
+   }
+  ,{{{   280,   280,   260,   260,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   260,   260,   240,   260,   240}
+    ,{   260,   260,   250,   210,   250}
+    ,{   260,   260,   240,   260,   240}
+    }
+   ,{{   280,   280,   260,   220,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   250,   250,   240,   200,   240}
+    ,{   150,   150,   140,   100,   140}
+    ,{   250,   250,   240,   200,   240}
+    }
+   ,{{   260,   260,   250,   260,   250}
+    ,{   260,   260,   250,   210,   250}
+    ,{   260,   260,   240,   260,   240}
+    ,{   260,   260,   250,   210,   250}
+    ,{   260,   260,   240,   260,   240}
+    }
+   ,{{   250,   250,   240,   200,   240}
+    ,{   220,   220,   210,   170,   210}
+    ,{   250,   250,   240,   200,   240}
+    ,{   180,   100,    90,   180,    90}
+    ,{   250,   250,   240,   200,   240}
+    }
+   ,{{   260,   260,   250,   260,   250}
+    ,{   260,   260,   250,   210,   250}
+    ,{   260,   260,   240,   260,   240}
+    ,{   260,   260,   250,   210,   250}
+    ,{   230,   230,   150,   110,   150}
+    }
+   }
+  ,{{{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   240,   230,   240,   230,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   240,   230,   240,   230,   240}
+    }
+   ,{{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   230,   230,   230,   230,   230}
+    ,{   190,   130,   190,   130,   190}
+    ,{   230,   230,   230,   230,   230}
+    }
+   ,{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   240,   230,   240,   230,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   240,   230,   240,   230,   240}
+    }
+   ,{{   260,   230,   260,   230,   260}
+    ,{   260,   200,   260,   200,   260}
+    ,{   230,   230,   230,   230,   230}
+    ,{    80,    80,    80,    80,    80}
+    ,{   230,   230,   230,   230,   230}
+    }
+   ,{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   240,   230,   240,   230,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   150,   140,   150,   140,   150}
+    }
+   }
+  ,{{{   260,   190,   260,   190,   260}
+    ,{   260,   150,   260,   180,   260}
+    ,{   240,   190,   240,    80,   240}
+    ,{   250,   140,   250,   190,   250}
+    ,{   240,   190,   240,   120,   240}
+    }
+   ,{{   260,   150,   260,   110,   260}
+    ,{   260,   150,   260,   100,   260}
+    ,{   240,   130,   240,    80,   240}
+    ,{   140,    30,   140,   110,   140}
+    ,{   240,   130,   240,    80,   240}
+    }
+   ,{{   250,   190,   250,    90,   250}
+    ,{   250,   140,   250,    90,   250}
+    ,{   240,   190,   240,    80,   240}
+    ,{   250,   140,   250,    90,   250}
+    ,{   240,   190,   240,    80,   240}
+    }
+   ,{{   240,   130,   240,   190,   240}
+    ,{   210,   100,   210,   180,   210}
+    ,{   240,   130,   240,    80,   240}
+    ,{   190,   110,    90,   190,    90}
+    ,{   240,   130,   240,    80,   240}
+    }
+   ,{{   250,   190,   250,   120,   250}
+    ,{   250,   140,   250,    90,   250}
+    ,{   240,   190,   240,    80,   240}
+    ,{   250,   140,   250,    90,   250}
+    ,{   150,    40,   150,   120,   150}
+    }
+   }
+  ,{{{   260,   250,   260,   250,   230}
+    ,{   260,   250,   260,   250,   230}
+    ,{   240,   230,   240,   230,   150}
+    ,{   240,   240,   240,   240,   150}
+    ,{   240,   230,   240,   230,   150}
+    }
+   ,{{   260,   250,   260,   250,   230}
+    ,{   260,   250,   260,   250,   230}
+    ,{   230,   230,   230,   230,   140}
+    ,{   190,   130,   190,   130,    40}
+    ,{   230,   230,   230,   230,   140}
+    }
+   ,{{   240,   240,   240,   240,   150}
+    ,{   240,   240,   240,   240,   150}
+    ,{   240,   230,   240,   230,   150}
+    ,{   240,   240,   240,   240,   150}
+    ,{   240,   230,   240,   230,   150}
+    }
+   ,{{   260,   230,   260,   230,   140}
+    ,{   260,   200,   260,   200,   110}
+    ,{   230,   230,   230,   230,   140}
+    ,{   120,    80,    80,    80,   120}
+    ,{   230,   230,   230,   230,   140}
+    }
+   ,{{   240,   240,   240,   240,   150}
+    ,{   240,   240,   240,   240,   150}
+    ,{   240,   230,   240,   230,   150}
+    ,{   240,   240,   240,   240,   150}
+    ,{   150,   140,   150,   140,    60}
+    }
+   }
+  }
+ ,{{{{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   280,   280,   260,   280,   260}
+    }
+   ,{{   280,   280,   260,   250,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   230,   230,   220,   210,   220}
+    ,{   210,   170,   210,   150,   210}
+    ,{   230,   230,   220,   210,   220}
+    }
+   ,{{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   280,   280,   260,   280,   260}
+    }
+   ,{{   230,   230,   220,   210,   220}
+    ,{   220,   180,   220,   160,   220}
+    ,{   230,   230,   220,   210,   220}
+    ,{   210,   130,   110,   210,   140}
+    ,{   230,   230,   220,   210,   220}
+    }
+   ,{{   280,   280,   260,   250,   260}
+    ,{   280,   280,   260,   250,   260}
+    ,{   250,   250,   230,   250,   230}
+    ,{   280,   280,   260,   250,   260}
+    ,{   250,   250,   180,   170,   180}
+    }
+   }
+  ,{{{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   280,   280,   260,   280,   260}
+    }
+   ,{{   280,   280,   260,   220,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   230,   230,   220,   180,   220}
+    ,{   170,   170,   160,   120,   160}
+    ,{   230,   230,   220,   180,   220}
+    }
+   ,{{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   280,   280,   260,   280,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   280,   280,   260,   280,   260}
+    }
+   ,{{   230,   230,   220,   200,   220}
+    ,{   180,   180,   170,   130,   170}
+    ,{   230,   230,   220,   180,   220}
+    ,{   200,   120,   110,   200,   110}
+    ,{   230,   230,   220,   180,   220}
+    }
+   ,{{   280,   280,   260,   250,   260}
+    ,{   280,   280,   260,   220,   260}
+    ,{   250,   250,   230,   250,   230}
+    ,{   280,   280,   260,   220,   260}
+    ,{   250,   250,   180,   140,   180}
+    }
+   }
+  ,{{{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    }
+   ,{{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   210,   210,   210,   210,   210}
+    ,{   210,   150,   210,   150,   210}
+    ,{   210,   210,   210,   210,   210}
+    }
+   ,{{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    }
+   ,{{   220,   210,   220,   210,   220}
+    ,{   220,   160,   220,   160,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   100,   100,   100,   100,   100}
+    ,{   210,   210,   210,   210,   210}
+    }
+   ,{{   260,   250,   260,   250,   260}
+    ,{   260,   250,   260,   250,   260}
+    ,{   230,   220,   230,   220,   230}
+    ,{   260,   250,   260,   250,   260}
+    ,{   170,   170,   170,   170,   170}
+    }
+   }
+  ,{{{   260,   210,   260,   210,   260}
+    ,{   260,   150,   260,   140,   260}
+    ,{   260,   210,   260,   100,   260}
+    ,{   260,   150,   260,   210,   260}
+    ,{   260,   210,   260,   150,   260}
+    }
+   ,{{   260,   150,   260,   130,   260}
+    ,{   260,   150,   260,   100,   260}
+    ,{   220,   110,   220,    60,   220}
+    ,{   160,    50,   160,   130,   160}
+    ,{   220,   110,   220,    60,   220}
+    }
+   ,{{   260,   210,   260,   100,   260}
+    ,{   260,   150,   260,   100,   260}
+    ,{   260,   210,   260,   100,   260}
+    ,{   260,   150,   260,   100,   260}
+    ,{   260,   210,   260,   100,   260}
+    }
+   ,{{   220,   130,   220,   210,   220}
+    ,{   170,    60,   170,   140,   170}
+    ,{   220,   110,   220,    60,   220}
+    ,{   210,   130,   110,   210,   110}
+    ,{   220,   110,   220,    60,   220}
+    }
+   ,{{   260,   180,   260,   150,   260}
+    ,{   260,   150,   260,   100,   260}
+    ,{   230,   180,   230,    70,   230}
+    ,{   260,   150,   260,   100,   260}
+    ,{   180,    70,   180,   150,   180}
+    }
+   }
+  ,{{{   260,   250,   260,   250,   230}
+    ,{   260,   250,   260,   250,   230}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    }
+   ,{{   260,   250,   260,   250,   230}
+    ,{   260,   250,   260,   250,   230}
+    ,{   210,   210,   210,   210,   120}
+    ,{   210,   150,   210,   150,    60}
+    ,{   210,   210,   210,   210,   120}
+    }
+   ,{{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    }
+   ,{{   220,   210,   220,   210,   140}
+    ,{   220,   160,   220,   160,    70}
+    ,{   210,   210,   210,   210,   120}
+    ,{   140,   100,   100,   100,   140}
+    ,{   210,   210,   210,   210,   120}
+    }
+   ,{{   260,   250,   260,   250,   170}
+    ,{   260,   250,   260,   250,   170}
+    ,{   230,   220,   230,   220,   140}
+    ,{   260,   250,   260,   250,   170}
+    ,{   170,   170,   170,   170,    80}
+    }
+   }
+  }
+ ,{{{{   370,   370,   350,   320,   350}
+    ,{   350,   340,   350,   320,   350}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   280,   290}
+    ,{   370,   370,   290,   310,   290}
+    }
+   ,{{   340,   340,   330,   320,   330}
+    ,{   340,   340,   330,   320,   330}
+    ,{   310,   310,   290,   280,   290}
+    ,{   270,   230,   270,   200,   270}
+    ,{   310,   310,   290,   280,   290}
+    }
+   ,{{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   280,   290}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   280,   290}
+    ,{   310,   310,   290,   310,   290}
+    }
+   ,{{   350,   310,   350,   280,   350}
+    ,{   350,   310,   350,   280,   350}
+    ,{   310,   310,   290,   280,   290}
+    ,{   260,   180,   160,   260,   200}
+    ,{   310,   310,   290,   280,   290}
+    }
+   ,{{   370,   370,   290,   310,   290}
+    ,{   310,   310,   290,   280,   290}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   280,   290}
+    ,{   370,   370,   290,   280,   290}
+    }
+   }
+  ,{{{   370,   370,   330,   310,   330}
+    ,{   340,   340,   330,   290,   330}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   370,   370,   290,   310,   290}
+    }
+   ,{{   340,   340,   330,   290,   330}
+    ,{   340,   340,   330,   290,   330}
+    ,{   310,   310,   290,   250,   290}
+    ,{   230,   230,   210,   170,   210}
+    ,{   310,   310,   290,   250,   290}
+    }
+   ,{{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   310,   310,   290,   310,   290}
+    }
+   ,{{   310,   310,   290,   250,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   250,   180,   160,   250,   160}
+    ,{   310,   310,   290,   250,   290}
+    }
+   ,{{   370,   370,   290,   310,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   310,   310,   290,   310,   290}
+    ,{   310,   310,   290,   250,   290}
+    ,{   370,   370,   290,   250,   290}
+    }
+   }
+  ,{{{   350,   320,   350,   320,   350}
+    ,{   350,   320,   350,   320,   350}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    }
+   ,{{   320,   320,   320,   320,   320}
+    ,{   320,   320,   320,   320,   320}
+    ,{   290,   280,   290,   280,   290}
+    ,{   270,   200,   270,   200,   270}
+    ,{   290,   280,   290,   280,   290}
+    }
+   ,{{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    }
+   ,{{   350,   280,   350,   280,   350}
+    ,{   350,   280,   350,   280,   350}
+    ,{   290,   280,   290,   280,   290}
+    ,{   160,   150,   160,   150,   160}
+    ,{   290,   280,   290,   280,   290}
+    }
+   ,{{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    ,{   290,   280,   290,   280,   290}
+    }
+   }
+  ,{{{   330,   240,   330,   260,   330}
+    ,{   330,   220,   330,   260,   330}
+    ,{   290,   240,   290,   130,   290}
+    ,{   290,   180,   290,   260,   290}
+    ,{   290,   240,   290,   260,   290}
+    }
+   ,{{   330,   220,   330,   180,   330}
+    ,{   330,   220,   330,   170,   330}
+    ,{   290,   180,   290,   130,   290}
+    ,{   210,   100,   210,   180,   210}
+    ,{   290,   180,   290,   130,   290}
+    }
+   ,{{   290,   240,   290,   130,   290}
+    ,{   290,   180,   290,   130,   290}
+    ,{   290,   240,   290,   130,   290}
+    ,{   290,   180,   290,   130,   290}
+    ,{   290,   240,   290,   130,   290}
+    }
+   ,{{   290,   180,   290,   260,   290}
+    ,{   290,   180,   290,   260,   290}
+    ,{   290,   180,   290,   130,   290}
+    ,{   260,   180,   160,   260,   160}
+    ,{   290,   180,   290,   130,   290}
+    }
+   ,{{   290,   240,   290,   260,   290}
+    ,{   290,   180,   290,   130,   290}
+    ,{   290,   240,   290,   130,   290}
+    ,{   290,   180,   290,   130,   290}
+    ,{   290,   180,   290,   260,   290}
+    }
+   }
+  ,{{{   350,   320,   350,   320,   290}
+    ,{   350,   320,   350,   320,   290}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    }
+   ,{{   320,   320,   320,   320,   290}
+    ,{   320,   320,   320,   320,   290}
+    ,{   290,   280,   290,   280,   200}
+    ,{   270,   200,   270,   200,   120}
+    ,{   290,   280,   290,   280,   200}
+    }
+   ,{{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    }
+   ,{{   350,   280,   350,   280,   200}
+    ,{   350,   280,   350,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   200,   150,   160,   150,   200}
+    ,{   290,   280,   290,   280,   200}
+    }
+   ,{{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    ,{   290,   280,   290,   280,   200}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   240,   240,   240,   190,   240}
+    ,{   240,   240,   240,   190,   240}
+    ,{   220,   220,   220,   190,   220}
+    ,{   240,   240,   240,   190,   240}
+    ,{   210,   210,   210,   170,   210}
+    }
+   ,{{   200,   200,   200,   150,   200}
+    ,{   200,   200,   200,   150,   200}
+    ,{   190,   190,   190,   150,   190}
+    ,{   160,   100,   160,    80,   130}
+    ,{   190,   190,   190,   150,   190}
+    }
+   ,{{   240,   240,   240,   190,   240}
+    ,{   240,   240,   240,   190,   240}
+    ,{   220,   220,   220,   190,   220}
+    ,{   240,   240,   240,   190,   240}
+    ,{   210,   210,   210,   170,   210}
+    }
+   ,{{   190,   190,   190,   150,   190}
+    ,{   160,   100,   160,    80,   130}
+    ,{   190,   190,   190,   150,   190}
+    ,{   150,    70,    50,   150,    90}
+    ,{   190,   190,   190,   150,   190}
+    }
+   ,{{   240,   240,   240,   190,   240}
+    ,{   240,   240,   240,   190,   240}
+    ,{   210,   210,   210,   170,   210}
+    ,{   240,   240,   240,   190,   240}
+    ,{   180,   180,   120,    90,   120}
+    }
+   }
+  ,{{{   240,   240,   240,   190,   240}
+    ,{   240,   240,   240,   140,   240}
+    ,{   220,   220,   220,   190,   220}
+    ,{   240,   240,   240,   140,   240}
+    ,{   210,   210,   210,   170,   210}
+    }
+   ,{{   200,   200,   200,   100,   200}
+    ,{   200,   200,   200,   100,   200}
+    ,{   190,   190,   190,   100,   190}
+    ,{   100,   100,   100,    10,   100}
+    ,{   190,   190,   190,   100,   190}
+    }
+   ,{{   240,   240,   240,   190,   240}
+    ,{   240,   240,   240,   140,   240}
+    ,{   220,   220,   220,   190,   220}
+    ,{   240,   240,   240,   140,   240}
+    ,{   210,   210,   210,   170,   210}
+    }
+   ,{{   190,   190,   190,   100,   190}
+    ,{   100,   100,   100,    10,   100}
+    ,{   190,   190,   190,   100,   190}
+    ,{    80,    50,    50,    80,    50}
+    ,{   190,   190,   190,   100,   190}
+    }
+   ,{{   240,   240,   240,   170,   240}
+    ,{   240,   240,   240,   140,   240}
+    ,{   210,   210,   210,   170,   210}
+    ,{   240,   240,   240,   140,   240}
+    ,{   180,   180,   120,    20,   120}
+    }
+   }
+  ,{{{   240,   190,   240,   190,   210}
+    ,{   240,   190,   240,   190,   210}
+    ,{   220,   180,   220,   180,   190}
+    ,{   240,   190,   240,   190,   210}
+    ,{   210,   160,   210,   160,   180}
+    }
+   ,{{   200,   150,   200,   150,   170}
+    ,{   200,   150,   200,   150,   170}
+    ,{   190,   150,   190,   150,   160}
+    ,{   160,    60,   160,    60,   130}
+    ,{   190,   150,   190,   150,   160}
+    }
+   ,{{   240,   190,   240,   190,   210}
+    ,{   240,   190,   240,   190,   210}
+    ,{   220,   180,   220,   180,   190}
+    ,{   240,   190,   240,   190,   210}
+    ,{   210,   160,   210,   160,   180}
+    }
+   ,{{   190,   150,   190,   150,   160}
+    ,{   160,    60,   160,    60,   130}
+    ,{   190,   150,   190,   150,   160}
+    ,{    50,     0,    50,     0,    20}
+    ,{   190,   150,   190,   150,   160}
+    }
+   ,{{   240,   190,   240,   190,   210}
+    ,{   240,   190,   240,   190,   210}
+    ,{   210,   160,   210,   160,   180}
+    ,{   240,   190,   240,   190,   210}
+    ,{   120,    70,   120,    70,    90}
+    }
+   }
+  ,{{{   240,   180,   240,   150,   240}
+    ,{   240,   130,   240,    80,   240}
+    ,{   220,   180,   220,    70,   220}
+    ,{   240,   130,   240,   150,   240}
+    ,{   210,   160,   210,    90,   210}
+    }
+   ,{{   200,    90,   200,    80,   200}
+    ,{   200,    90,   200,    40,   200}
+    ,{   190,    90,   190,    40,   190}
+    ,{   100,     0,   100,    80,   100}
+    ,{   190,    90,   190,    40,   190}
+    }
+   ,{{   240,   180,   240,    80,   240}
+    ,{   240,   130,   240,    80,   240}
+    ,{   220,   180,   220,    70,   220}
+    ,{   240,   130,   240,    80,   240}
+    ,{   210,   160,   210,    50,   210}
+    }
+   ,{{   190,    90,   190,   150,   190}
+    ,{   100,     0,   100,    80,   100}
+    ,{   190,    90,   190,    40,   190}
+    ,{   150,    70,    50,   150,    50}
+    ,{   190,    90,   190,    40,   190}
+    }
+   ,{{   240,   160,   240,    90,   240}
+    ,{   240,   130,   240,    80,   240}
+    ,{   210,   160,   210,    50,   210}
+    ,{   240,   130,   240,    80,   240}
+    ,{   120,    10,   120,    90,   120}
+    }
+   }
+  ,{{{   240,   190,   240,   190,   170}
+    ,{   240,   190,   240,   190,   170}
+    ,{   220,   180,   220,   180,   140}
+    ,{   240,   190,   240,   190,   150}
+    ,{   210,   160,   210,   160,   120}
+    }
+   ,{{   200,   150,   200,   150,   170}
+    ,{   200,   150,   200,   150,   170}
+    ,{   190,   150,   190,   150,   110}
+    ,{   160,    60,   160,    60,    20}
+    ,{   190,   150,   190,   150,   110}
+    }
+   ,{{   240,   190,   240,   190,   150}
+    ,{   240,   190,   240,   190,   150}
+    ,{   220,   180,   220,   180,   140}
+    ,{   240,   190,   240,   190,   150}
+    ,{   210,   160,   210,   160,   120}
+    }
+   ,{{   190,   150,   190,   150,   110}
+    ,{   160,    60,   160,    60,    20}
+    ,{   190,   150,   190,   150,   110}
+    ,{    90,     0,    50,     0,    90}
+    ,{   190,   150,   190,   150,   110}
+    }
+   ,{{   240,   190,   240,   190,   150}
+    ,{   240,   190,   240,   190,   150}
+    ,{   210,   160,   210,   160,   120}
+    ,{   240,   190,   240,   190,   150}
+    ,{   120,    70,   120,    70,    30}
+    }
+   }
+  }
+ ,{{{{   210,   210,   210,   170,   210}
+    ,{   210,   210,   210,   170,   210}
+    ,{   190,   190,   190,   160,   190}
+    ,{   180,   180,   180,   150,   180}
+    ,{   190,   190,   190,   150,   190}
+    }
+   ,{{   210,   210,   210,   170,   210}
+    ,{   210,   210,   210,   170,   210}
+    ,{   190,   190,   190,   140,   190}
+    ,{    70,    10,    70,   -10,    40}
+    ,{   190,   190,   190,   140,   190}
+    }
+   ,{{   190,   190,   190,   150,   190}
+    ,{   180,   180,   180,   140,   180}
+    ,{   190,   190,   190,   150,   190}
+    ,{   180,   180,   180,   140,   180}
+    ,{   190,   190,   190,   150,   190}
+    }
+   ,{{   190,   190,   190,   150,   190}
+    ,{   130,    70,   130,    50,   100}
+    ,{   190,   190,   190,   140,   190}
+    ,{   150,    70,    50,   150,    90}
+    ,{   190,   190,   190,   140,   190}
+    }
+   ,{{   190,   190,   190,   160,   190}
+    ,{   180,   180,   180,   140,   180}
+    ,{   190,   190,   190,   160,   190}
+    ,{   180,   180,   180,   140,   180}
+    ,{   170,   170,   110,    90,   110}
+    }
+   }
+  ,{{{   210,   210,   210,   160,   210}
+    ,{   210,   210,   210,   120,   210}
+    ,{   190,   190,   190,   160,   190}
+    ,{   180,   180,   180,    90,   180}
+    ,{   190,   190,   190,   150,   190}
+    }
+   ,{{   210,   210,   210,   120,   210}
+    ,{   210,   210,   210,   120,   210}
+    ,{   190,   190,   190,    90,   190}
+    ,{    10,    10,    10,   -80,    10}
+    ,{   190,   190,   190,    90,   190}
+    }
+   ,{{   190,   190,   190,   150,   190}
+    ,{   180,   180,   180,    90,   180}
+    ,{   190,   190,   190,   150,   190}
+    ,{   180,   180,   180,    90,   180}
+    ,{   190,   190,   190,   150,   190}
+    }
+   ,{{   190,   190,   190,    90,   190}
+    ,{    70,    70,    70,   -20,    70}
+    ,{   190,   190,   190,    90,   190}
+    ,{    80,    50,    50,    80,    50}
+    ,{   190,   190,   190,    90,   190}
+    }
+   ,{{   190,   190,   190,   160,   190}
+    ,{   180,   180,   180,    90,   180}
+    ,{   190,   190,   190,   160,   190}
+    ,{   180,   180,   180,    90,   180}
+    ,{   170,   170,   110,    20,   110}
+    }
+   }
+  ,{{{   210,   170,   210,   170,   180}
+    ,{   210,   170,   210,   170,   180}
+    ,{   190,   150,   190,   150,   160}
+    ,{   180,   140,   180,   140,   150}
+    ,{   190,   140,   190,   140,   160}
+    }
+   ,{{   210,   170,   210,   170,   180}
+    ,{   210,   170,   210,   170,   180}
+    ,{   190,   140,   190,   140,   160}
+    ,{    70,   -30,    70,   -30,    40}
+    ,{   190,   140,   190,   140,   160}
+    }
+   ,{{   190,   140,   190,   140,   160}
+    ,{   180,   140,   180,   140,   150}
+    ,{   190,   140,   190,   140,   160}
+    ,{   180,   140,   180,   140,   150}
+    ,{   190,   140,   190,   140,   160}
+    }
+   ,{{   190,   140,   190,   140,   160}
+    ,{   130,    30,   130,    30,   100}
+    ,{   190,   140,   190,   140,   160}
+    ,{    50,     0,    50,     0,    20}
+    ,{   190,   140,   190,   140,   160}
+    }
+   ,{{   190,   150,   190,   150,   160}
+    ,{   180,   140,   180,   140,   150}
+    ,{   190,   150,   190,   150,   160}
+    ,{   180,   140,   180,   140,   150}
+    ,{   110,    70,   110,    70,    80}
+    }
+   }
+  ,{{{   210,   150,   210,   150,   210}
+    ,{   210,   110,   210,    60,   210}
+    ,{   190,   150,   190,    40,   190}
+    ,{   180,    80,   180,   150,   180}
+    ,{   190,   140,   190,    90,   190}
+    }
+   ,{{   210,   110,   210,    60,   210}
+    ,{   210,   110,   210,    60,   210}
+    ,{   190,    80,   190,    30,   190}
+    ,{    10,   -90,    10,   -10,    10}
+    ,{   190,    80,   190,    30,   190}
+    }
+   ,{{   190,   140,   190,    30,   190}
+    ,{   180,    80,   180,    30,   180}
+    ,{   190,   140,   190,    30,   190}
+    ,{   180,    80,   180,    30,   180}
+    ,{   190,   140,   190,    30,   190}
+    }
+   ,{{   190,    80,   190,   150,   190}
+    ,{    70,   -30,    70,    50,    70}
+    ,{   190,    80,   190,    30,   190}
+    ,{   150,    70,    50,   150,    50}
+    ,{   190,    80,   190,    30,   190}
+    }
+   ,{{   190,   150,   190,    90,   190}
+    ,{   180,    80,   180,    30,   180}
+    ,{   190,   150,   190,    40,   190}
+    ,{   180,    80,   180,    30,   180}
+    ,{   110,    10,   110,    90,   110}
+    }
+   }
+  ,{{{   210,   170,   210,   170,   190}
+    ,{   210,   170,   210,   170,   190}
+    ,{   190,   150,   190,   150,   110}
+    ,{   180,   140,   180,   140,   100}
+    ,{   190,   140,   190,   140,   100}
+    }
+   ,{{   210,   170,   210,   170,   190}
+    ,{   210,   170,   210,   170,   190}
+    ,{   190,   140,   190,   140,   100}
+    ,{    70,   -30,    70,   -30,   -70}
+    ,{   190,   140,   190,   140,   100}
+    }
+   ,{{   190,   140,   190,   140,   100}
+    ,{   180,   140,   180,   140,   100}
+    ,{   190,   140,   190,   140,   100}
+    ,{   180,   140,   180,   140,   100}
+    ,{   190,   140,   190,   140,   100}
+    }
+   ,{{   190,   140,   190,   140,   100}
+    ,{   130,    30,   130,    30,   -10}
+    ,{   190,   140,   190,   140,   100}
+    ,{    90,     0,    50,     0,    90}
+    ,{   190,   140,   190,   140,   100}
+    }
+   ,{{   190,   150,   190,   150,   110}
+    ,{   180,   140,   180,   140,   100}
+    ,{   190,   150,   190,   150,   110}
+    ,{   180,   140,   180,   140,   100}
+    ,{   110,    70,   110,    70,    30}
+    }
+   }
+  }
+ ,{{{{   370,   370,   340,   300,   340}
+    ,{   340,   340,   340,   300,   340}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   280,   310}
+    ,{   370,   370,   310,   280,   310}
+    }
+   ,{{   340,   340,   340,   300,   340}
+    ,{   340,   340,   340,   300,   340}
+    ,{   310,   310,   310,   260,   310}
+    ,{   290,   230,   290,   200,   260}
+    ,{   310,   310,   310,   260,   310}
+    }
+   ,{{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   260,   310}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   260,   310}
+    ,{   310,   310,   310,   270,   310}
+    }
+   ,{{   330,   310,   330,   280,   310}
+    ,{   330,   270,   330,   240,   300}
+    ,{   310,   310,   310,   260,   310}
+    ,{   280,   200,   180,   280,   220}
+    ,{   310,   310,   310,   260,   310}
+    }
+   ,{{   370,   370,   310,   280,   310}
+    ,{   310,   310,   310,   260,   310}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   260,   310}
+    ,{   370,   370,   310,   280,   310}
+    }
+   }
+  ,{{{   370,   370,   340,   270,   340}
+    ,{   340,   340,   340,   250,   340}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   370,   370,   310,   270,   310}
+    }
+   ,{{   340,   340,   340,   250,   340}
+    ,{   340,   340,   340,   250,   340}
+    ,{   310,   310,   310,   210,   310}
+    ,{   230,   230,   230,   130,   230}
+    ,{   310,   310,   310,   210,   310}
+    }
+   ,{{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   310,   310,   310,   270,   310}
+    }
+   ,{{   310,   310,   310,   210,   310}
+    ,{   270,   270,   270,   170,   270}
+    ,{   310,   310,   310,   210,   310}
+    ,{   210,   180,   180,   210,   180}
+    ,{   310,   310,   310,   210,   310}
+    }
+   ,{{   370,   370,   310,   270,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   370,   370,   310,   210,   310}
+    }
+   }
+  ,{{{   340,   300,   340,   300,   310}
+    ,{   340,   300,   340,   300,   310}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    }
+   ,{{   340,   300,   340,   300,   310}
+    ,{   340,   300,   340,   300,   310}
+    ,{   310,   260,   310,   260,   280}
+    ,{   290,   180,   290,   180,   260}
+    ,{   310,   260,   310,   260,   280}
+    }
+   ,{{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    }
+   ,{{   330,   260,   330,   260,   300}
+    ,{   330,   220,   330,   220,   300}
+    ,{   310,   260,   310,   260,   280}
+    ,{   180,   130,   180,   130,   150}
+    ,{   310,   260,   310,   260,   280}
+    }
+   ,{{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    }
+   }
+  ,{{{   340,   260,   340,   280,   340}
+    ,{   340,   240,   340,   240,   340}
+    ,{   310,   260,   310,   150,   310}
+    ,{   310,   200,   310,   280,   310}
+    ,{   310,   260,   310,   280,   310}
+    }
+   ,{{   340,   240,   340,   200,   340}
+    ,{   340,   240,   340,   190,   340}
+    ,{   310,   200,   310,   150,   310}
+    ,{   230,   120,   230,   200,   230}
+    ,{   310,   200,   310,   150,   310}
+    }
+   ,{{   310,   260,   310,   150,   310}
+    ,{   310,   200,   310,   150,   310}
+    ,{   310,   260,   310,   150,   310}
+    ,{   310,   200,   310,   150,   310}
+    ,{   310,   260,   310,   150,   310}
+    }
+   ,{{   310,   200,   310,   280,   310}
+    ,{   270,   160,   270,   240,   270}
+    ,{   310,   200,   310,   150,   310}
+    ,{   280,   200,   180,   280,   180}
+    ,{   310,   200,   310,   150,   310}
+    }
+   ,{{   310,   260,   310,   280,   310}
+    ,{   310,   200,   310,   150,   310}
+    ,{   310,   260,   310,   150,   310}
+    ,{   310,   200,   310,   150,   310}
+    ,{   310,   200,   310,   280,   310}
+    }
+   }
+  ,{{{   340,   300,   340,   300,   320}
+    ,{   340,   300,   340,   300,   320}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    }
+   ,{{   340,   300,   340,   300,   320}
+    ,{   340,   300,   340,   300,   320}
+    ,{   310,   260,   310,   260,   220}
+    ,{   290,   180,   290,   180,   140}
+    ,{   310,   260,   310,   260,   220}
+    }
+   ,{{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    }
+   ,{{   330,   260,   330,   260,   220}
+    ,{   330,   220,   330,   220,   180}
+    ,{   310,   260,   310,   260,   220}
+    ,{   220,   130,   180,   130,   220}
+    ,{   310,   260,   310,   260,   220}
+    }
+   ,{{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    }
+   }
+  }
+ ,{{{{   370,   340,   370,   280,   340}
+    ,{   370,   310,   370,   280,   340}
+    ,{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   250,   280}
+    ,{   340,   340,   280,   250,   280}
+    }
+   ,{{   280,   280,   280,   230,   280}
+    ,{   240,   240,   240,   200,   240}
+    ,{   280,   280,   280,   230,   280}
+    ,{   200,   140,   200,   120,   170}
+    ,{   280,   280,   280,   230,   280}
+    }
+   ,{{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   280,   280,   280,   240,   280}
+    }
+   ,{{   370,   310,   370,   280,   340}
+    ,{   370,   310,   370,   280,   340}
+    ,{   280,   280,   280,   230,   280}
+    ,{   250,   170,   150,   250,   190}
+    ,{   280,   280,   280,   230,   280}
+    }
+   ,{{   340,   340,   280,   250,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   340,   340,   280,   250,   280}
+    }
+   }
+  ,{{{   340,   340,   310,   240,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   340,   340,   280,   240,   280}
+    }
+   ,{{   280,   280,   280,   180,   280}
+    ,{   240,   240,   240,   150,   240}
+    ,{   280,   280,   280,   180,   280}
+    ,{   140,   140,   140,    50,   140}
+    ,{   280,   280,   280,   180,   280}
+    }
+   ,{{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   280,   280,   280,   240,   280}
+    }
+   ,{{   310,   310,   310,   210,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   280,   280,   280,   180,   280}
+    ,{   180,   150,   150,   180,   150}
+    ,{   280,   280,   280,   180,   280}
+    }
+   ,{{   340,   340,   280,   240,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   340,   340,   280,   180,   280}
+    }
+   }
+  ,{{{   370,   260,   370,   260,   340}
+    ,{   370,   260,   370,   260,   340}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    }
+   ,{{   280,   230,   280,   230,   250}
+    ,{   240,   200,   240,   200,   210}
+    ,{   280,   230,   280,   230,   250}
+    ,{   200,   100,   200,   100,   170}
+    ,{   280,   230,   280,   230,   250}
+    }
+   ,{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    }
+   ,{{   370,   260,   370,   260,   340}
+    ,{   370,   260,   370,   260,   340}
+    ,{   280,   230,   280,   230,   250}
+    ,{   150,   100,   150,   100,   120}
+    ,{   280,   230,   280,   230,   250}
+    }
+   ,{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    }
+   }
+  ,{{{   310,   230,   310,   280,   310}
+    ,{   310,   200,   310,   280,   310}
+    ,{   280,   230,   280,   120,   280}
+    ,{   280,   170,   280,   250,   280}
+    ,{   280,   230,   280,   250,   280}
+    }
+   ,{{   280,   170,   280,   120,   280}
+    ,{   240,   140,   240,    90,   240}
+    ,{   280,   170,   280,   120,   280}
+    ,{   140,    40,   140,   120,   140}
+    ,{   280,   170,   280,   120,   280}
+    }
+   ,{{   280,   230,   280,   120,   280}
+    ,{   280,   170,   280,   120,   280}
+    ,{   280,   230,   280,   120,   280}
+    ,{   280,   170,   280,   120,   280}
+    ,{   280,   230,   280,   120,   280}
+    }
+   ,{{   310,   200,   310,   280,   310}
+    ,{   310,   200,   310,   280,   310}
+    ,{   280,   170,   280,   120,   280}
+    ,{   250,   170,   150,   250,   150}
+    ,{   280,   170,   280,   120,   280}
+    }
+   ,{{   280,   230,   280,   250,   280}
+    ,{   280,   170,   280,   120,   280}
+    ,{   280,   230,   280,   120,   280}
+    ,{   280,   170,   280,   120,   280}
+    ,{   280,   170,   280,   250,   280}
+    }
+   }
+  ,{{{   370,   260,   370,   260,   220}
+    ,{   370,   260,   370,   260,   220}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    }
+   ,{{   280,   230,   280,   230,   220}
+    ,{   240,   200,   240,   200,   220}
+    ,{   280,   230,   280,   230,   190}
+    ,{   200,   100,   200,   100,    60}
+    ,{   280,   230,   280,   230,   190}
+    }
+   ,{{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    }
+   ,{{   370,   260,   370,   260,   220}
+    ,{   370,   260,   370,   260,   220}
+    ,{   280,   230,   280,   230,   190}
+    ,{   190,   100,   150,   100,   190}
+    ,{   280,   230,   280,   230,   190}
+    }
+   ,{{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    }
+   }
+  }
+ ,{{{{   280,   280,   280,   230,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   220,   260}
+    }
+   ,{{   280,   280,   280,   230,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   250,   250,   250,   210,   250}
+    ,{   210,   150,   210,   130,   180}
+    ,{   250,   250,   250,   210,   250}
+    }
+   ,{{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   220,   260}
+    }
+   ,{{   280,   250,   280,   210,   250}
+    ,{   280,   220,   280,   200,   250}
+    ,{   250,   250,   250,   210,   250}
+    ,{   210,   130,   100,   210,   150}
+    ,{   250,   250,   250,   210,   250}
+    }
+   ,{{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   220,   260}
+    ,{   230,   230,   170,   140,   170}
+    }
+   }
+  ,{{{   280,   280,   280,   220,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   170,   260}
+    ,{   260,   260,   260,   220,   260}
+    }
+   ,{{   280,   280,   280,   180,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   250,   250,   250,   160,   250}
+    ,{   150,   150,   150,    60,   150}
+    ,{   250,   250,   250,   160,   250}
+    }
+   ,{{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   170,   260}
+    ,{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   170,   260}
+    ,{   260,   260,   260,   220,   260}
+    }
+   ,{{   250,   250,   250,   160,   250}
+    ,{   220,   220,   220,   130,   220}
+    ,{   250,   250,   250,   160,   250}
+    ,{   140,   100,   100,   140,   100}
+    ,{   250,   250,   250,   160,   250}
+    }
+   ,{{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   170,   260}
+    ,{   260,   260,   260,   220,   260}
+    ,{   260,   260,   260,   170,   260}
+    ,{   230,   230,   170,    70,   170}
+    }
+   }
+  ,{{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   260,   210,   260,   210,   230}
+    ,{   260,   220,   260,   220,   230}
+    ,{   260,   210,   260,   210,   230}
+    }
+   ,{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   250,   210,   250,   210,   220}
+    ,{   210,   110,   210,   110,   180}
+    ,{   250,   210,   250,   210,   220}
+    }
+   ,{{   260,   220,   260,   220,   230}
+    ,{   260,   220,   260,   220,   230}
+    ,{   260,   210,   260,   210,   230}
+    ,{   260,   220,   260,   220,   230}
+    ,{   260,   210,   260,   210,   230}
+    }
+   ,{{   280,   210,   280,   210,   250}
+    ,{   280,   180,   280,   180,   250}
+    ,{   250,   210,   250,   210,   220}
+    ,{   100,    60,   100,    60,    70}
+    ,{   250,   210,   250,   210,   220}
+    }
+   ,{{   260,   220,   260,   220,   230}
+    ,{   260,   220,   260,   220,   230}
+    ,{   260,   210,   260,   210,   230}
+    ,{   260,   220,   260,   220,   230}
+    ,{   170,   120,   170,   120,   140}
+    }
+   }
+  ,{{{   280,   210,   280,   210,   280}
+    ,{   280,   170,   280,   200,   280}
+    ,{   260,   210,   260,   100,   260}
+    ,{   260,   160,   260,   210,   260}
+    ,{   260,   210,   260,   140,   260}
+    }
+   ,{{   280,   170,   280,   130,   280}
+    ,{   280,   170,   280,   120,   280}
+    ,{   250,   150,   250,   100,   250}
+    ,{   150,    50,   150,   130,   150}
+    ,{   250,   150,   250,   100,   250}
+    }
+   ,{{   260,   210,   260,   110,   260}
+    ,{   260,   160,   260,   110,   260}
+    ,{   260,   210,   260,   100,   260}
+    ,{   260,   160,   260,   110,   260}
+    ,{   260,   210,   260,   100,   260}
+    }
+   ,{{   250,   150,   250,   210,   250}
+    ,{   220,   120,   220,   200,   220}
+    ,{   250,   150,   250,   100,   250}
+    ,{   210,   130,   100,   210,   100}
+    ,{   250,   150,   250,   100,   250}
+    }
+   ,{{   260,   210,   260,   140,   260}
+    ,{   260,   160,   260,   110,   260}
+    ,{   260,   210,   260,   100,   260}
+    ,{   260,   160,   260,   110,   260}
+    ,{   170,    60,   170,   140,   170}
+    }
+   }
+  ,{{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   260,   210,   260,   210,   170}
+    ,{   260,   220,   260,   220,   180}
+    ,{   260,   210,   260,   210,   170}
+    }
+   ,{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   250,   210,   250,   210,   170}
+    ,{   210,   110,   210,   110,    70}
+    ,{   250,   210,   250,   210,   170}
+    }
+   ,{{   260,   220,   260,   220,   180}
+    ,{   260,   220,   260,   220,   180}
+    ,{   260,   210,   260,   210,   170}
+    ,{   260,   220,   260,   220,   180}
+    ,{   260,   210,   260,   210,   170}
+    }
+   ,{{   280,   210,   280,   210,   170}
+    ,{   280,   180,   280,   180,   140}
+    ,{   250,   210,   250,   210,   170}
+    ,{   150,    60,   100,    60,   150}
+    ,{   250,   210,   250,   210,   170}
+    }
+   ,{{   260,   220,   260,   220,   180}
+    ,{   260,   220,   260,   220,   180}
+    ,{   260,   210,   260,   210,   170}
+    ,{   260,   220,   260,   220,   180}
+    ,{   170,   120,   170,   120,    80}
+    }
+   }
+  }
+ ,{{{{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   280,   280,   280,   240,   280}
+    }
+   ,{{   280,   280,   280,   230,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   230,   230,   230,   190,   230}
+    ,{   230,   170,   230,   150,   200}
+    ,{   230,   230,   230,   190,   230}
+    }
+   ,{{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   280,   280,   280,   240,   280}
+    }
+   ,{{   240,   230,   240,   230,   230}
+    ,{   240,   180,   240,   160,   210}
+    ,{   230,   230,   230,   190,   230}
+    ,{   230,   150,   120,   230,   170}
+    ,{   230,   230,   230,   190,   230}
+    }
+   ,{{   280,   280,   280,   230,   280}
+    ,{   280,   280,   280,   230,   280}
+    ,{   250,   250,   250,   210,   250}
+    ,{   280,   280,   280,   230,   280}
+    ,{   250,   250,   190,   170,   190}
+    }
+   }
+  ,{{{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   280,   280,   280,   240,   280}
+    }
+   ,{{   280,   280,   280,   180,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   230,   230,   230,   140,   230}
+    ,{   170,   170,   170,    80,   170}
+    ,{   230,   230,   230,   140,   230}
+    }
+   ,{{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   280,   280,   280,   240,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   280,   280,   280,   240,   280}
+    }
+   ,{{   230,   230,   230,   160,   230}
+    ,{   180,   180,   180,    90,   180}
+    ,{   230,   230,   230,   140,   230}
+    ,{   160,   120,   120,   160,   120}
+    ,{   230,   230,   230,   140,   230}
+    }
+   ,{{   280,   280,   280,   210,   280}
+    ,{   280,   280,   280,   180,   280}
+    ,{   250,   250,   250,   210,   250}
+    ,{   280,   280,   280,   180,   280}
+    ,{   250,   250,   190,   100,   190}
+    }
+   }
+  ,{{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    }
+   ,{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   230,   190,   230,   190,   200}
+    ,{   230,   130,   230,   130,   200}
+    ,{   230,   190,   230,   190,   200}
+    }
+   ,{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    }
+   ,{{   240,   190,   240,   190,   210}
+    ,{   240,   140,   240,   140,   210}
+    ,{   230,   190,   230,   190,   200}
+    ,{   120,    80,   120,    80,    90}
+    ,{   230,   190,   230,   190,   200}
+    }
+   ,{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   250,   200,   250,   200,   220}
+    ,{   280,   230,   280,   230,   250}
+    ,{   190,   150,   190,   150,   160}
+    }
+   }
+  ,{{{   280,   230,   280,   230,   280}
+    ,{   280,   170,   280,   160,   280}
+    ,{   280,   230,   280,   120,   280}
+    ,{   280,   170,   280,   230,   280}
+    ,{   280,   230,   280,   170,   280}
+    }
+   ,{{   280,   170,   280,   150,   280}
+    ,{   280,   170,   280,   120,   280}
+    ,{   230,   130,   230,    80,   230}
+    ,{   170,    70,   170,   150,   170}
+    ,{   230,   130,   230,    80,   230}
+    }
+   ,{{   280,   230,   280,   120,   280}
+    ,{   280,   170,   280,   120,   280}
+    ,{   280,   230,   280,   120,   280}
+    ,{   280,   170,   280,   120,   280}
+    ,{   280,   230,   280,   120,   280}
+    }
+   ,{{   230,   150,   230,   230,   230}
+    ,{   180,    80,   180,   160,   180}
+    ,{   230,   130,   230,    80,   230}
+    ,{   230,   150,   120,   230,   120}
+    ,{   230,   130,   230,    80,   230}
+    }
+   ,{{   280,   200,   280,   170,   280}
+    ,{   280,   170,   280,   120,   280}
+    ,{   250,   200,   250,    90,   250}
+    ,{   280,   170,   280,   120,   280}
+    ,{   190,    90,   190,   170,   190}
+    }
+   }
+  ,{{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    }
+   ,{{   280,   230,   280,   230,   250}
+    ,{   280,   230,   280,   230,   250}
+    ,{   230,   190,   230,   190,   150}
+    ,{   230,   130,   230,   130,    90}
+    ,{   230,   190,   230,   190,   150}
+    }
+   ,{{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    }
+   ,{{   240,   190,   240,   190,   170}
+    ,{   240,   140,   240,   140,   100}
+    ,{   230,   190,   230,   190,   150}
+    ,{   170,    80,   120,    80,   170}
+    ,{   230,   190,   230,   190,   150}
+    }
+   ,{{   280,   230,   280,   230,   190}
+    ,{   280,   230,   280,   230,   190}
+    ,{   250,   200,   250,   200,   160}
+    ,{   280,   230,   280,   230,   190}
+    ,{   190,   150,   190,   150,   110}
+    }
+   }
+  }
+ ,{{{{   370,   370,   370,   300,   340}
+    ,{   370,   340,   370,   300,   340}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   280,   310}
+    ,{   370,   370,   310,   280,   310}
+    }
+   ,{{   340,   340,   340,   300,   340}
+    ,{   340,   340,   340,   300,   340}
+    ,{   310,   310,   310,   260,   310}
+    ,{   290,   230,   290,   200,   260}
+    ,{   310,   310,   310,   260,   310}
+    }
+   ,{{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   260,   310}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   260,   310}
+    ,{   310,   310,   310,   270,   310}
+    }
+   ,{{   370,   310,   370,   280,   340}
+    ,{   370,   310,   370,   280,   340}
+    ,{   310,   310,   310,   260,   310}
+    ,{   280,   200,   180,   280,   220}
+    ,{   310,   310,   310,   260,   310}
+    }
+   ,{{   370,   370,   310,   280,   310}
+    ,{   310,   310,   310,   260,   310}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   260,   310}
+    ,{   370,   370,   310,   280,   310}
+    }
+   }
+  ,{{{   370,   370,   340,   270,   340}
+    ,{   340,   340,   340,   250,   340}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   370,   370,   310,   270,   310}
+    }
+   ,{{   340,   340,   340,   250,   340}
+    ,{   340,   340,   340,   250,   340}
+    ,{   310,   310,   310,   210,   310}
+    ,{   230,   230,   230,   130,   230}
+    ,{   310,   310,   310,   210,   310}
+    }
+   ,{{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   310,   310,   310,   270,   310}
+    }
+   ,{{   310,   310,   310,   210,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   210,   180,   180,   210,   180}
+    ,{   310,   310,   310,   210,   310}
+    }
+   ,{{   370,   370,   310,   270,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   310,   310,   310,   270,   310}
+    ,{   310,   310,   310,   210,   310}
+    ,{   370,   370,   310,   210,   310}
+    }
+   }
+  ,{{{   370,   300,   370,   300,   340}
+    ,{   370,   300,   370,   300,   340}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    }
+   ,{{   340,   300,   340,   300,   310}
+    ,{   340,   300,   340,   300,   310}
+    ,{   310,   260,   310,   260,   280}
+    ,{   290,   180,   290,   180,   260}
+    ,{   310,   260,   310,   260,   280}
+    }
+   ,{{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    }
+   ,{{   370,   260,   370,   260,   340}
+    ,{   370,   260,   370,   260,   340}
+    ,{   310,   260,   310,   260,   280}
+    ,{   180,   130,   180,   130,   150}
+    ,{   310,   260,   310,   260,   280}
+    }
+   ,{{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    ,{   310,   260,   310,   260,   280}
+    }
+   }
+  ,{{{   340,   260,   340,   280,   340}
+    ,{   340,   240,   340,   280,   340}
+    ,{   310,   260,   310,   150,   310}
+    ,{   310,   200,   310,   280,   310}
+    ,{   310,   260,   310,   280,   310}
+    }
+   ,{{   340,   240,   340,   200,   340}
+    ,{   340,   240,   340,   190,   340}
+    ,{   310,   200,   310,   150,   310}
+    ,{   230,   120,   230,   200,   230}
+    ,{   310,   200,   310,   150,   310}
+    }
+   ,{{   310,   260,   310,   150,   310}
+    ,{   310,   200,   310,   150,   310}
+    ,{   310,   260,   310,   150,   310}
+    ,{   310,   200,   310,   150,   310}
+    ,{   310,   260,   310,   150,   310}
+    }
+   ,{{   310,   200,   310,   280,   310}
+    ,{   310,   200,   310,   280,   310}
+    ,{   310,   200,   310,   150,   310}
+    ,{   280,   200,   180,   280,   180}
+    ,{   310,   200,   310,   150,   310}
+    }
+   ,{{   310,   260,   310,   280,   310}
+    ,{   310,   200,   310,   150,   310}
+    ,{   310,   260,   310,   150,   310}
+    ,{   310,   200,   310,   150,   310}
+    ,{   310,   200,   310,   280,   310}
+    }
+   }
+  ,{{{   370,   300,   370,   300,   320}
+    ,{   370,   300,   370,   300,   320}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    }
+   ,{{   340,   300,   340,   300,   320}
+    ,{   340,   300,   340,   300,   320}
+    ,{   310,   260,   310,   260,   220}
+    ,{   290,   180,   290,   180,   140}
+    ,{   310,   260,   310,   260,   220}
+    }
+   ,{{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    }
+   ,{{   370,   260,   370,   260,   220}
+    ,{   370,   260,   370,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   220,   130,   180,   130,   220}
+    ,{   310,   260,   310,   260,   220}
+    }
+   ,{{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    ,{   310,   260,   310,   260,   220}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   310,   300,   270,   310,   290}
+    ,{   300,   300,   270,   270,   290}
+    ,{   310,   290,   250,   310,   250}
+    ,{   300,   300,   270,   270,   270}
+    ,{   300,   270,   240,   300,   240}
+    }
+   ,{{   290,   270,   230,   230,   290}
+    ,{   290,   270,   230,   230,   290}
+    ,{   260,   260,   220,   220,   220}
+    ,{   190,   170,   190,   130,   190}
+    ,{   260,   260,   220,   220,   220}
+    }
+   ,{{   310,   300,   270,   310,   270}
+    ,{   300,   300,   270,   270,   270}
+    ,{   310,   290,   250,   310,   250}
+    ,{   300,   300,   270,   270,   270}
+    ,{   300,   270,   240,   300,   240}
+    }
+   ,{{   260,   260,   220,   220,   220}
+    ,{   190,   170,   190,   130,   190}
+    ,{   260,   260,   220,   220,   220}
+    ,{   210,   130,    80,   210,   210}
+    ,{   260,   260,   220,   220,   220}
+    }
+   ,{{   300,   300,   270,   300,   270}
+    ,{   300,   300,   270,   270,   270}
+    ,{   300,   270,   240,   300,   240}
+    ,{   300,   300,   270,   270,   270}
+    ,{   240,   240,   150,   150,   150}
+    }
+   }
+  ,{{{   310,   300,   270,   310,   270}
+    ,{   300,   300,   270,   270,   270}
+    ,{   310,   290,   250,   310,   250}
+    ,{   300,   300,   270,   270,   270}
+    ,{   300,   270,   240,   300,   240}
+    }
+   ,{{   270,   270,   230,   230,   230}
+    ,{   270,   270,   230,   230,   230}
+    ,{   260,   260,   220,   220,   220}
+    ,{   170,   170,   130,   130,   130}
+    ,{   260,   260,   220,   220,   220}
+    }
+   ,{{   310,   300,   270,   310,   270}
+    ,{   300,   300,   270,   270,   270}
+    ,{   310,   290,   250,   310,   250}
+    ,{   300,   300,   270,   270,   270}
+    ,{   300,   270,   240,   300,   240}
+    }
+   ,{{   260,   260,   220,   220,   220}
+    ,{   170,   170,   130,   130,   130}
+    ,{   260,   260,   220,   220,   220}
+    ,{   210,   110,    80,   210,    80}
+    ,{   260,   260,   220,   220,   220}
+    }
+   ,{{   300,   300,   270,   300,   270}
+    ,{   300,   300,   270,   270,   270}
+    ,{   300,   270,   240,   300,   240}
+    ,{   300,   300,   270,   270,   270}
+    ,{   240,   240,   150,   150,   150}
+    }
+   }
+  ,{{{   270,   270,   270,   270,   270}
+    ,{   270,   270,   270,   270,   270}
+    ,{   250,   250,   250,   250,   250}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    }
+   ,{{   230,   230,   230,   230,   230}
+    ,{   230,   230,   230,   230,   230}
+    ,{   220,   220,   220,   220,   220}
+    ,{   190,   130,   190,   130,   190}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   270,   270,   270,   270,   270}
+    ,{   270,   270,   270,   270,   270}
+    ,{   250,   250,   250,   250,   250}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   190,   130,   190,   130,   190}
+    ,{   220,   220,   220,   220,   220}
+    ,{    80,    80,    80,    80,    80}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   270,   270,   270,   270,   270}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    ,{   270,   270,   270,   270,   270}
+    ,{   150,   150,   150,   150,   150}
+    }
+   }
+  ,{{{   270,   230,   270,   210,   270}
+    ,{   270,   190,   270,   140,   270}
+    ,{   250,   230,   250,   120,   250}
+    ,{   270,   190,   270,   210,   270}
+    ,{   240,   220,   240,   150,   240}
+    }
+   ,{{   230,   150,   230,   130,   230}
+    ,{   230,   150,   230,   100,   230}
+    ,{   220,   140,   220,    90,   220}
+    ,{   130,    50,   130,   130,   130}
+    ,{   220,   140,   220,    90,   220}
+    }
+   ,{{   270,   230,   270,   140,   270}
+    ,{   270,   190,   270,   140,   270}
+    ,{   250,   230,   250,   120,   250}
+    ,{   270,   190,   270,   140,   270}
+    ,{   240,   220,   240,   110,   240}
+    }
+   ,{{   220,   140,   220,   210,   220}
+    ,{   130,    50,   130,   130,   130}
+    ,{   220,   140,   220,    90,   220}
+    ,{   210,   130,    80,   210,    80}
+    ,{   220,   140,   220,    90,   220}
+    }
+   ,{{   270,   220,   270,   150,   270}
+    ,{   270,   190,   270,   140,   270}
+    ,{   240,   220,   240,   110,   240}
+    ,{   270,   190,   270,   140,   270}
+    ,{   150,    70,   150,   150,   150}
+    }
+   }
+  ,{{{   290,   270,   270,   270,   290}
+    ,{   290,   270,   270,   270,   290}
+    ,{   250,   250,   250,   250,   250}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    }
+   ,{{   290,   230,   230,   230,   290}
+    ,{   290,   230,   230,   230,   290}
+    ,{   220,   220,   220,   220,   220}
+    ,{   190,   130,   190,   130,   130}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   270,   270,   270,   270,   270}
+    ,{   270,   270,   270,   270,   270}
+    ,{   250,   250,   250,   250,   250}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   190,   130,   190,   130,   130}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,    80,    80,    80,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   270,   270,   270,   270,   270}
+    ,{   270,   270,   270,   270,   270}
+    ,{   240,   240,   240,   240,   240}
+    ,{   270,   270,   270,   270,   270}
+    ,{   150,   150,   150,   150,   150}
+    }
+   }
+  }
+ ,{{{{   300,   280,   240,   280,   300}
+    ,{   300,   280,   240,   240,   300}
+    ,{   280,   260,   220,   280,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   280,   250,   220,   280,   220}
+    }
+   ,{{   300,   280,   240,   240,   300}
+    ,{   300,   280,   240,   240,   300}
+    ,{   250,   250,   220,   220,   220}
+    ,{   100,    70,   100,    40,   100}
+    ,{   250,   250,   220,   220,   220}
+    }
+   ,{{   280,   250,   220,   280,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   280,   250,   220,   280,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   280,   250,   220,   280,   220}
+    }
+   ,{{   250,   250,   220,   220,   220}
+    ,{   160,   140,   160,   100,   160}
+    ,{   250,   250,   220,   220,   220}
+    ,{   210,   130,    80,   210,   210}
+    ,{   250,   250,   220,   220,   220}
+    }
+   ,{{   280,   260,   220,   280,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   280,   260,   220,   280,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   240,   240,   140,   140,   140}
+    }
+   }
+  ,{{{   280,   280,   240,   280,   240}
+    ,{   280,   280,   240,   240,   240}
+    ,{   280,   260,   220,   280,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   280,   250,   220,   280,   220}
+    }
+   ,{{   280,   280,   240,   240,   240}
+    ,{   280,   280,   240,   240,   240}
+    ,{   250,   250,   220,   220,   220}
+    ,{    70,    70,    40,    40,    40}
+    ,{   250,   250,   220,   220,   220}
+    }
+   ,{{   280,   250,   220,   280,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   280,   250,   220,   280,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   280,   250,   220,   280,   220}
+    }
+   ,{{   250,   250,   220,   220,   220}
+    ,{   140,   140,   100,   100,   100}
+    ,{   250,   250,   220,   220,   220}
+    ,{   210,   110,    80,   210,    80}
+    ,{   250,   250,   220,   220,   220}
+    }
+   ,{{   280,   260,   220,   280,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   280,   260,   220,   280,   220}
+    ,{   250,   250,   210,   210,   210}
+    ,{   240,   240,   140,   140,   140}
+    }
+   }
+  ,{{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   220,   220,   220,   220,   220}
+    ,{   100,    40,   100,    40,   100}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   160,   100,   160,   100,   160}
+    ,{   220,   220,   220,   220,   220}
+    ,{    80,    80,    80,    80,    80}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   140,   140,   140,   140,   140}
+    }
+   }
+  ,{{{   240,   200,   240,   210,   240}
+    ,{   240,   160,   240,   110,   240}
+    ,{   220,   200,   220,    90,   220}
+    ,{   210,   130,   210,   210,   210}
+    ,{   220,   200,   220,   140,   220}
+    }
+   ,{{   240,   160,   240,   110,   240}
+    ,{   240,   160,   240,   110,   240}
+    ,{   220,   140,   220,    90,   220}
+    ,{    40,   -40,    40,    40,    40}
+    ,{   220,   140,   220,    90,   220}
+    }
+   ,{{   220,   200,   220,    90,   220}
+    ,{   210,   130,   210,    80,   210}
+    ,{   220,   200,   220,    90,   220}
+    ,{   210,   130,   210,    80,   210}
+    ,{   220,   200,   220,    90,   220}
+    }
+   ,{{   220,   140,   220,   210,   220}
+    ,{   100,    20,   100,   100,   100}
+    ,{   220,   140,   220,    90,   220}
+    ,{   210,   130,    80,   210,    80}
+    ,{   220,   140,   220,    90,   220}
+    }
+   ,{{   220,   200,   220,   140,   220}
+    ,{   210,   130,   210,    80,   210}
+    ,{   220,   200,   220,    90,   220}
+    ,{   210,   130,   210,    80,   210}
+    ,{   140,    90,   140,   140,   140}
+    }
+   }
+  ,{{{   300,   240,   240,   240,   300}
+    ,{   300,   240,   240,   240,   300}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   300,   240,   240,   240,   300}
+    ,{   300,   240,   240,   240,   300}
+    ,{   220,   220,   220,   220,   220}
+    ,{   100,    40,   100,    40,    50}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   160,   100,   160,   100,   140}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,    80,    80,    80,   210}
+    ,{   220,   220,   220,   220,   220}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   220,   220,   220,   220,   220}
+    ,{   210,   210,   210,   210,   210}
+    ,{   140,   140,   140,   140,   140}
+    }
+   }
+  }
+ ,{{{{   430,   430,   370,   400,   430}
+    ,{   430,   410,   370,   370,   430}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   400,   340}
+    }
+   ,{{   430,   410,   370,   370,   430}
+    ,{   430,   410,   370,   370,   430}
+    ,{   370,   370,   340,   340,   340}
+    ,{   320,   290,   320,   260,   320}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    }
+   ,{{   370,   370,   360,   340,   360}
+    ,{   360,   360,   360,   300,   360}
+    ,{   370,   370,   340,   340,   340}
+    ,{   340,   260,   210,   340,   340}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   430,   430,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   340,   340}
+    }
+   }
+  ,{{{   430,   430,   370,   400,   370}
+    ,{   410,   410,   370,   370,   370}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   400,   340}
+    }
+   ,{{   410,   410,   370,   370,   370}
+    ,{   410,   410,   370,   370,   370}
+    ,{   370,   370,   340,   340,   340}
+    ,{   290,   290,   260,   260,   260}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    }
+   ,{{   370,   370,   340,   340,   340}
+    ,{   360,   360,   300,   300,   300}
+    ,{   370,   370,   340,   340,   340}
+    ,{   340,   240,   210,   340,   210}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   430,   430,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   340,   340}
+    }
+   }
+  ,{{{   370,   370,   370,   370,   370}
+    ,{   370,   370,   370,   370,   370}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   370,   370,   370,   370,   370}
+    ,{   370,   370,   370,   370,   370}
+    ,{   340,   340,   340,   340,   340}
+    ,{   320,   260,   320,   260,   320}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   360,   340,   360,   340,   360}
+    ,{   360,   300,   360,   300,   360}
+    ,{   340,   340,   340,   340,   340}
+    ,{   210,   210,   210,   210,   210}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   }
+  ,{{{   370,   320,   370,   340,   370}
+    ,{   370,   290,   370,   300,   370}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   340,   340}
+    ,{   340,   320,   340,   340,   340}
+    }
+   ,{{   370,   290,   370,   260,   370}
+    ,{   370,   290,   370,   240,   370}
+    ,{   340,   260,   340,   210,   340}
+    ,{   260,   180,   260,   260,   260}
+    ,{   340,   260,   340,   210,   340}
+    }
+   ,{{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    }
+   ,{{   340,   260,   340,   340,   340}
+    ,{   300,   220,   300,   300,   300}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   260,   210,   340,   210}
+    ,{   340,   260,   340,   210,   340}
+    }
+   ,{{   340,   320,   340,   340,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   260,   340,   340,   340}
+    }
+   }
+  ,{{{   430,   370,   370,   370,   430}
+    ,{   430,   370,   370,   370,   430}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   430,   370,   370,   370,   430}
+    ,{   430,   370,   370,   370,   430}
+    ,{   340,   340,   340,   340,   340}
+    ,{   320,   260,   320,   260,   260}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   360,   340,   360,   340,   340}
+    ,{   360,   300,   360,   300,   300}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   210,   210,   210,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   }
+  }
+ ,{{{{   400,   400,   400,   370,   400}
+    ,{   400,   370,   400,   360,   400}
+    ,{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   400,   400,   310,   370,   310}
+    }
+   ,{{   360,   360,   310,   360,   330}
+    ,{   360,   360,   270,   360,   330}
+    ,{   340,   340,   310,   310,   310}
+    ,{   230,   220,   230,   170,   230}
+    ,{   340,   340,   310,   310,   310}
+    }
+   ,{{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    }
+   ,{{   400,   370,   400,   340,   400}
+    ,{   400,   370,   400,   340,   400}
+    ,{   340,   340,   310,   310,   310}
+    ,{   310,   230,   180,   310,   310}
+    ,{   340,   340,   310,   310,   310}
+    }
+   ,{{   400,   400,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   400,   400,   310,   310,   310}
+    }
+   }
+  ,{{{   400,   400,   340,   370,   340}
+    ,{   370,   370,   340,   360,   340}
+    ,{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   400,   400,   310,   370,   310}
+    }
+   ,{{   360,   360,   310,   360,   310}
+    ,{   360,   360,   270,   360,   270}
+    ,{   340,   340,   310,   310,   310}
+    ,{   220,   220,   170,   170,   170}
+    ,{   340,   340,   310,   310,   310}
+    }
+   ,{{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    }
+   ,{{   370,   370,   340,   340,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   340,   340,   310,   310,   310}
+    ,{   310,   210,   180,   310,   180}
+    ,{   340,   340,   310,   310,   310}
+    }
+   ,{{   400,   400,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   400,   400,   310,   310,   310}
+    }
+   }
+  ,{{{   400,   340,   400,   340,   400}
+    ,{   400,   340,   400,   340,   400}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   270,   270,   270,   270,   270}
+    ,{   310,   310,   310,   310,   310}
+    ,{   230,   170,   230,   170,   230}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   400,   340,   400,   340,   400}
+    ,{   400,   340,   400,   340,   400}
+    ,{   310,   310,   310,   310,   310}
+    ,{   180,   180,   180,   180,   180}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   }
+  ,{{{   340,   290,   340,   340,   340}
+    ,{   340,   260,   340,   340,   340}
+    ,{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   310,   310}
+    ,{   310,   290,   310,   310,   310}
+    }
+   ,{{   310,   230,   310,   180,   310}
+    ,{   270,   190,   270,   140,   270}
+    ,{   310,   230,   310,   180,   310}
+    ,{   170,    40,   170,   170,   170}
+    ,{   310,   230,   310,   180,   310}
+    }
+   ,{{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   290,   310,   180,   310}
+    }
+   ,{{   340,   260,   340,   340,   340}
+    ,{   340,   260,   340,   340,   340}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   230,   180,   310,   180}
+    ,{   310,   230,   310,   180,   310}
+    }
+   ,{{   310,   290,   310,   310,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   230,   310,   310,   310}
+    }
+   }
+  ,{{{   400,   340,   400,   340,   340}
+    ,{   400,   340,   400,   340,   340}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   330,   310,   310,   310,   330}
+    ,{   330,   270,   270,   270,   330}
+    ,{   310,   310,   310,   310,   310}
+    ,{   230,   170,   230,   170,   170}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   400,   340,   400,   340,   340}
+    ,{   400,   340,   400,   340,   340}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   180,   180,   180,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   }
+  }
+ ,{{{{   370,   340,   310,   350,   370}
+    ,{   370,   340,   310,   310,   370}
+    ,{   350,   320,   290,   350,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   350,   320,   290,   350,   290}
+    }
+   ,{{   370,   340,   310,   310,   370}
+    ,{   370,   340,   310,   310,   370}
+    ,{   320,   320,   280,   280,   280}
+    ,{   240,   220,   240,   180,   240}
+    ,{   320,   320,   280,   280,   280}
+    }
+   ,{{   350,   330,   290,   350,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   350,   320,   290,   350,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   350,   320,   290,   350,   290}
+    }
+   ,{{   320,   320,   310,   280,   310}
+    ,{   310,   290,   310,   250,   310}
+    ,{   320,   320,   280,   280,   280}
+    ,{   260,   180,   130,   260,   260}
+    ,{   320,   320,   280,   280,   280}
+    }
+   ,{{   350,   330,   290,   350,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   350,   320,   290,   350,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   290,   290,   200,   200,   200}
+    }
+   }
+  ,{{{   350,   340,   310,   350,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   350,   320,   290,   350,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   350,   320,   290,   350,   290}
+    }
+   ,{{   340,   340,   310,   310,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   320,   320,   280,   280,   280}
+    ,{   220,   220,   180,   180,   180}
+    ,{   320,   320,   280,   280,   280}
+    }
+   ,{{   350,   330,   290,   350,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   350,   320,   290,   350,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   350,   320,   290,   350,   290}
+    }
+   ,{{   320,   320,   280,   280,   280}
+    ,{   290,   290,   250,   250,   250}
+    ,{   320,   320,   280,   280,   280}
+    ,{   260,   170,   130,   260,   130}
+    ,{   320,   320,   280,   280,   280}
+    }
+   ,{{   350,   330,   290,   350,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   350,   320,   290,   350,   290}
+    ,{   330,   330,   290,   290,   290}
+    ,{   290,   290,   200,   200,   200}
+    }
+   }
+  ,{{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   280,   280,   280,   280,   280}
+    ,{   240,   180,   240,   180,   240}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    }
+   ,{{   310,   280,   310,   280,   310}
+    ,{   310,   250,   310,   250,   310}
+    ,{   280,   280,   280,   280,   280}
+    ,{   130,   130,   130,   130,   130}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   200,   200,   200,   200,   200}
+    }
+   }
+  ,{{{   310,   270,   310,   260,   310}
+    ,{   310,   230,   310,   250,   310}
+    ,{   290,   270,   290,   160,   290}
+    ,{   290,   210,   290,   260,   290}
+    ,{   290,   270,   290,   200,   290}
+    }
+   ,{{   310,   230,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   280,   200,   280,   150,   280}
+    ,{   180,   100,   180,   180,   180}
+    ,{   280,   200,   280,   150,   280}
+    }
+   ,{{   290,   270,   290,   160,   290}
+    ,{   290,   210,   290,   160,   290}
+    ,{   290,   270,   290,   160,   290}
+    ,{   290,   210,   290,   160,   290}
+    ,{   290,   270,   290,   160,   290}
+    }
+   ,{{   280,   200,   280,   260,   280}
+    ,{   250,   170,   250,   250,   250}
+    ,{   280,   200,   280,   150,   280}
+    ,{   260,   180,   130,   260,   130}
+    ,{   280,   200,   280,   150,   280}
+    }
+   ,{{   290,   270,   290,   200,   290}
+    ,{   290,   210,   290,   160,   290}
+    ,{   290,   270,   290,   160,   290}
+    ,{   290,   210,   290,   160,   290}
+    ,{   200,   120,   200,   200,   200}
+    }
+   }
+  ,{{{   370,   310,   310,   310,   370}
+    ,{   370,   310,   310,   310,   370}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    }
+   ,{{   370,   310,   310,   310,   370}
+    ,{   370,   310,   310,   310,   370}
+    ,{   280,   280,   280,   280,   280}
+    ,{   240,   180,   240,   180,   180}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    }
+   ,{{   310,   280,   310,   280,   280}
+    ,{   310,   250,   310,   250,   250}
+    ,{   280,   280,   280,   280,   280}
+    ,{   260,   130,   130,   130,   260}
+    ,{   280,   280,   280,   280,   280}
+    }
+   ,{{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   290,   290,   290,   290,   290}
+    ,{   200,   200,   200,   200,   200}
+    }
+   }
+  }
+ ,{{{{   370,   340,   310,   370,   370}
+    ,{   370,   340,   310,   310,   370}
+    ,{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    }
+   ,{{   370,   340,   310,   310,   370}
+    ,{   370,   340,   310,   310,   370}
+    ,{   300,   300,   260,   260,   260}
+    ,{   260,   240,   260,   200,   260}
+    ,{   300,   300,   260,   260,   260}
+    }
+   ,{{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    }
+   ,{{   300,   300,   270,   280,   280}
+    ,{   270,   250,   270,   210,   270}
+    ,{   300,   300,   260,   260,   260}
+    ,{   280,   200,   150,   280,   280}
+    ,{   300,   300,   260,   260,   260}
+    }
+   ,{{   340,   340,   310,   340,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   340,   310,   280,   340,   280}
+    ,{   340,   340,   310,   310,   310}
+    ,{   320,   320,   220,   220,   220}
+    }
+   }
+  ,{{{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    }
+   ,{{   340,   340,   310,   310,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   300,   300,   260,   260,   260}
+    ,{   240,   240,   200,   200,   200}
+    ,{   300,   300,   260,   260,   260}
+    }
+   ,{{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   370,   340,   310,   370,   310}
+    }
+   ,{{   300,   300,   260,   280,   260}
+    ,{   250,   250,   210,   210,   210}
+    ,{   300,   300,   260,   260,   260}
+    ,{   280,   190,   150,   280,   150}
+    ,{   300,   300,   260,   260,   260}
+    }
+   ,{{   340,   340,   310,   340,   310}
+    ,{   340,   340,   310,   310,   310}
+    ,{   340,   310,   280,   340,   280}
+    ,{   340,   340,   310,   310,   310}
+    ,{   320,   320,   220,   220,   220}
+    }
+   }
+  ,{{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   200,   260,   200,   260}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   270,   260,   270,   260,   270}
+    ,{   270,   210,   270,   210,   270}
+    ,{   260,   260,   260,   260,   260}
+    ,{   150,   150,   150,   150,   150}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   280,   280,   280,   280,   280}
+    ,{   310,   310,   310,   310,   310}
+    ,{   220,   220,   220,   220,   220}
+    }
+   }
+  ,{{{   310,   290,   310,   280,   310}
+    ,{   310,   230,   310,   210,   310}
+    ,{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   280,   310}
+    ,{   310,   290,   310,   220,   310}
+    }
+   ,{{   310,   230,   310,   200,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   260,   180,   260,   130,   260}
+    ,{   200,   120,   200,   200,   200}
+    ,{   260,   180,   260,   130,   260}
+    }
+   ,{{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   290,   310,   180,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   310,   290,   310,   180,   310}
+    }
+   ,{{   280,   200,   260,   280,   260}
+    ,{   210,   130,   210,   210,   210}
+    ,{   260,   180,   260,   130,   260}
+    ,{   280,   200,   150,   280,   150}
+    ,{   260,   180,   260,   130,   260}
+    }
+   ,{{   310,   260,   310,   220,   310}
+    ,{   310,   230,   310,   180,   310}
+    ,{   280,   260,   280,   150,   280}
+    ,{   310,   230,   310,   180,   310}
+    ,{   220,   140,   220,   220,   220}
+    }
+   }
+  ,{{{   370,   310,   310,   310,   370}
+    ,{   370,   310,   310,   310,   370}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   370,   310,   310,   310,   370}
+    ,{   370,   310,   310,   310,   370}
+    ,{   260,   260,   260,   260,   260}
+    ,{   260,   200,   260,   200,   200}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    }
+   ,{{   280,   260,   270,   260,   280}
+    ,{   270,   210,   270,   210,   210}
+    ,{   260,   260,   260,   260,   260}
+    ,{   280,   150,   150,   150,   280}
+    ,{   260,   260,   260,   260,   260}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{   280,   280,   280,   280,   280}
+    ,{   310,   310,   310,   310,   310}
+    ,{   220,   220,   220,   220,   220}
+    }
+   }
+  }
+ ,{{{{   430,   430,   400,   400,   430}
+    ,{   430,   410,   400,   370,   430}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   400,   340}
+    }
+   ,{{   430,   410,   370,   370,   430}
+    ,{   430,   410,   370,   370,   430}
+    ,{   370,   370,   340,   340,   340}
+    ,{   320,   290,   320,   260,   320}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    }
+   ,{{   400,   370,   400,   340,   400}
+    ,{   400,   370,   400,   340,   400}
+    ,{   370,   370,   340,   340,   340}
+    ,{   340,   260,   210,   340,   340}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   430,   430,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   340,   340}
+    }
+   }
+  ,{{{   430,   430,   370,   400,   370}
+    ,{   410,   410,   370,   370,   370}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   400,   340}
+    }
+   ,{{   410,   410,   370,   370,   370}
+    ,{   410,   410,   370,   370,   370}
+    ,{   370,   370,   340,   340,   340}
+    ,{   290,   290,   260,   260,   260}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    }
+   ,{{   370,   370,   340,   340,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   340,   240,   210,   340,   210}
+    ,{   370,   370,   340,   340,   340}
+    }
+   ,{{   430,   430,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   400,   370,   340,   400,   340}
+    ,{   370,   370,   340,   340,   340}
+    ,{   430,   430,   340,   340,   340}
+    }
+   }
+  ,{{{   400,   370,   400,   370,   400}
+    ,{   400,   370,   400,   370,   400}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   370,   370,   370,   370,   370}
+    ,{   370,   370,   370,   370,   370}
+    ,{   340,   340,   340,   340,   340}
+    ,{   320,   260,   320,   260,   320}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   400,   340,   400,   340,   400}
+    ,{   400,   340,   400,   340,   400}
+    ,{   340,   340,   340,   340,   340}
+    ,{   210,   210,   210,   210,   210}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   }
+  ,{{{   370,   320,   370,   340,   370}
+    ,{   370,   290,   370,   340,   370}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   340,   340}
+    ,{   340,   320,   340,   340,   340}
+    }
+   ,{{   370,   290,   370,   260,   370}
+    ,{   370,   290,   370,   240,   370}
+    ,{   340,   260,   340,   210,   340}
+    ,{   260,   180,   260,   260,   260}
+    ,{   340,   260,   340,   210,   340}
+    }
+   ,{{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    }
+   ,{{   340,   260,   340,   340,   340}
+    ,{   340,   260,   340,   340,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   260,   210,   340,   210}
+    ,{   340,   260,   340,   210,   340}
+    }
+   ,{{   340,   320,   340,   340,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   320,   340,   210,   340}
+    ,{   340,   260,   340,   210,   340}
+    ,{   340,   260,   340,   340,   340}
+    }
+   }
+  ,{{{   430,   370,   400,   370,   430}
+    ,{   430,   370,   400,   370,   430}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   430,   370,   370,   370,   430}
+    ,{   430,   370,   370,   370,   430}
+    ,{   340,   340,   340,   340,   340}
+    ,{   320,   260,   320,   260,   260}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   400,   340,   400,   340,   340}
+    ,{   400,   340,   400,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   210,   210,   210,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   ,{{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    ,{   340,   340,   340,   340,   340}
+    }
+   }
+  }
+ }};
diff --git a/C/ViennaRNA/intl22dH.h b/C/ViennaRNA/intl22dH.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/intl22dH.h
@@ -0,0 +1,9993 @@
+PUBLIC int int22_dH[NBPAIRS+1][NBPAIRS+1][5][5][5][5] =
+{{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{    80,  -120,    30,    80,    80}
+    ,{    30,  -310,  -170,    30,  -110}
+    ,{    80,  -230,  -110,    80,   -60}
+    ,{    80,  -120,    30,    30,    80}
+    ,{   -30,  -340,  -220,   -30,  -170}
+    }
+   ,{{  -120,  -460,  -290,  -120,  -230}
+    ,{  -120,  -460,  -310,  -120,  -260}
+    ,{  -430,  -770,  -620,  -430,  -570}
+    ,{  -230,  -670,  -290,  -980,  -230}
+    ,{  -430,  -770,  -620,  -430,  -570}
+    }
+   ,{{    30,  -290,  -170,    30,  -110}
+    ,{    30,  -310,  -170,    30,  -110}
+    ,{    20,  -290,  -170,    20,  -120}
+    ,{    30,  -310,  -170,    30,  -110}
+    ,{   -30,  -340,  -220,   -30,  -170}
+    }
+   ,{{    80,  -120,    30,  -430,    80}
+    ,{  -520,  -960,  -580, -1270,  -520}
+    ,{  -430,  -770,  -620,  -430,  -570}
+    ,{    80,  -120,    30,  -430,    80}
+    ,{  -430,  -770,  -620,  -430,  -570}
+    }
+   ,{{    80,  -230,  -110,    80,   -60}
+    ,{    30,  -310,  -170,    30,  -110}
+    ,{    80,  -230,  -110,    80,   -60}
+    ,{    30,  -310,  -170,    30,  -110}
+    ,{  -860,  -860,  -960, -1410,  -900}
+    }
+   }
+  ,{{{    30,  -120,    30,  -520,    30}
+    ,{  -170,  -310,  -170,  -810,  -170}
+    ,{  -110,  -260,  -110,  -520,  -110}
+    ,{    30,  -120,    30,  -810,    30}
+    ,{  -220,  -370,  -220,  -630,  -220}
+    }
+   ,{{  -310,  -460,  -310,  -960,  -310}
+    ,{  -310,  -460,  -310,  -960,  -310}
+    ,{  -620,  -770,  -620, -1270,  -620}
+    ,{  -530,  -670,  -530, -1170,  -530}
+    ,{  -620,  -770,  -620, -1270,  -620}
+    }
+   ,{{  -170,  -310,  -170,  -580,  -170}
+    ,{  -170,  -310,  -170,  -810,  -170}
+    ,{  -170,  -320,  -170,  -580,  -170}
+    ,{  -170,  -310,  -170,  -810,  -170}
+    ,{  -220,  -370,  -220,  -630,  -220}
+    }
+   ,{{    30,  -120,    30, -1270,    30}
+    ,{  -810,  -960,  -810, -1460,  -810}
+    ,{  -620,  -770,  -620, -1270,  -620}
+    ,{    30,  -120,    30, -1870,    30}
+    ,{  -620,  -770,  -620, -1270,  -620}
+    }
+   ,{{  -110,  -260,  -110,  -520,  -110}
+    ,{  -170,  -310,  -170,  -810,  -170}
+    ,{  -110,  -260,  -110,  -520,  -110}
+    ,{  -170,  -310,  -170,  -810,  -170}
+    ,{  -860,  -860,  -960, -1600,  -960}
+    }
+   }
+  ,{{{    80,  -430,    20,  -430,    80}
+    ,{  -110,  -620,  -170,  -620,  -110}
+    ,{   -60,  -570,  -120,  -570,   -60}
+    ,{    80,  -430,    20,  -430,    80}
+    ,{  -170,  -680,  -230,  -680,  -170}
+    }
+   ,{{  -230,  -770,  -290,  -770,  -230}
+    ,{  -260,  -770,  -320,  -770,  -260}
+    ,{  -570, -1080,  -630, -1080,  -570}
+    ,{  -230,  -980,  -290,  -980,  -230}
+    ,{  -570, -1080,  -630, -1080,  -570}
+    }
+   ,{{  -110,  -620,  -170,  -620,  -110}
+    ,{  -110,  -620,  -170,  -620,  -110}
+    ,{  -120,  -630,  -180,  -630,  -120}
+    ,{  -110,  -620,  -170,  -620,  -110}
+    ,{  -170,  -680,  -230,  -680,  -170}
+    }
+   ,{{    80,  -430,    20,  -430,    80}
+    ,{  -520, -1270,  -580, -1270,  -520}
+    ,{  -570, -1080,  -630, -1080,  -570}
+    ,{    80,  -430,    20,  -430,    80}
+    ,{  -570, -1080,  -630, -1080,  -570}
+    }
+   ,{{   -60,  -570,  -120,  -570,   -60}
+    ,{  -110,  -620,  -170,  -620,  -110}
+    ,{   -60,  -570,  -120,  -570,   -60}
+    ,{  -110,  -620,  -170,  -620,  -110}
+    ,{  -900, -1410,  -960, -1410,  -900}
+    }
+   }
+  ,{{{    80,  -230,    30,    80,    30}
+    ,{    30,  -530,  -170,    30,  -170}
+    ,{    80,  -230,  -110,    80,  -110}
+    ,{    30,  -530,    30,    30,    30}
+    ,{   -30,  -340,  -220,   -30,  -220}
+    }
+   ,{{  -120,  -670,  -310,  -120,  -310}
+    ,{  -120,  -670,  -310,  -120,  -310}
+    ,{  -430,  -980,  -620,  -430,  -620}
+    ,{  -530,  -890,  -530, -1580,  -530}
+    ,{  -430,  -980,  -620,  -430,  -620}
+    }
+   ,{{    30,  -290,  -170,    30,  -170}
+    ,{    30,  -530,  -170,    30,  -170}
+    ,{    20,  -290,  -170,    20,  -170}
+    ,{    30,  -530,  -170,    30,  -170}
+    ,{   -30,  -340,  -220,   -30,  -220}
+    }
+   ,{{    30,  -980,    30,  -430,    30}
+    ,{  -810, -1170,  -810, -1870,  -810}
+    ,{  -430,  -980,  -620,  -430,  -620}
+    ,{    30, -1580,    30, -2280,    30}
+    ,{  -430,  -980,  -620,  -430,  -620}
+    }
+   ,{{    80,  -230,  -110,    80,  -110}
+    ,{    30,  -530,  -170,    30,  -170}
+    ,{    80,  -230,  -110,    80,  -110}
+    ,{    30,  -530,  -170,    30,  -170}
+    ,{  -960, -1320,  -960, -2010,  -960}
+    }
+   }
+  ,{{{   -30,  -430,   -30,  -430,  -860}
+    ,{  -220,  -620,  -220,  -620,  -860}
+    ,{  -170,  -570,  -170,  -570,  -900}
+    ,{   -30,  -430,   -30,  -430,  -960}
+    ,{  -280,  -680,  -280,  -680, -1010}
+    }
+   ,{{  -340,  -770,  -340,  -770,  -860}
+    ,{  -370,  -770,  -370,  -770,  -860}
+    ,{  -680, -1080,  -680, -1080, -1410}
+    ,{  -340,  -980,  -340,  -980, -1320}
+    ,{  -680, -1080,  -680, -1080, -1410}
+    }
+   ,{{  -220,  -620,  -220,  -620,  -960}
+    ,{  -220,  -620,  -220,  -620,  -960}
+    ,{  -230,  -630,  -230,  -630,  -960}
+    ,{  -220,  -620,  -220,  -620,  -960}
+    ,{  -280,  -680,  -280,  -680, -1010}
+    }
+   ,{{   -30,  -430,   -30,  -430, -1410}
+    ,{  -630, -1270,  -630, -1270, -1600}
+    ,{  -680, -1080,  -680, -1080, -1410}
+    ,{   -30,  -430,   -30,  -430, -2010}
+    ,{  -680, -1080,  -680, -1080, -1410}
+    }
+   ,{{  -170,  -570,  -170,  -570,  -900}
+    ,{  -220,  -620,  -220,  -620,  -960}
+    ,{  -170,  -570,  -170,  -570,  -900}
+    ,{  -220,  -620,  -220,  -620,  -960}
+    ,{ -1010, -1410, -1010, -1410, -1750}
+    }
+   }
+  }
+ ,{{{{   540,   180,    30,   540,   180}
+    ,{    10,  -580,  -150,    10,   -90}
+    ,{   540,  -350,  -600,   540,  -540}
+    ,{   180,   180,    30,  -320,   180}
+    ,{   -90,  -740,   -90,  -260,  -540}
+    }
+   ,{{   -90,  -350,  -150,  -100,   -90}
+    ,{   -90,  -580,  -150,  -200,   -90}
+    ,{  -100,  -350,  -600,  -100,  -540}
+    ,{  -630, -1790,  -630, -1790, -1040}
+    ,{  -400,  -740,  -600,  -400,  -540}
+    }
+   ,{{   540,  -660,  -510,   540,  -400}
+    ,{    10,  -660,  -510,    10,  -400}
+    ,{   540,  -940,  -820,   540,  -760}
+    ,{  -320,  -660,  -510,  -320,  -460}
+    ,{  -260,  -940,  -820,  -260,  -550}
+    }
+   ,{{   180,   180,    30,  -400,   180}
+    ,{  -500, -1070,  -500, -1080,  -570}
+    ,{  -400,  -740,  -600,  -400,  -540}
+    ,{   180,   180,    30,  -430,   180}
+    ,{  -400,  -740,  -600,  -400,  -540}
+    }
+   ,{{   -90,  -660,   -90,  -210,  -460}
+    ,{  -320,  -660,  -510,  -320,  -460}
+    ,{  -210, -1250, -1130,  -210, -1070}
+    ,{  -320,  -660,  -510,  -320,  -460}
+    ,{   -90,  -830,   -90,  -810,  -800}
+    }
+   }
+  ,{{{   540,   180,   -90,   540,    30}
+    ,{    10,  -580,  -220,    10,  -150}
+    ,{   540,  -740,  -600,   540,  -600}
+    ,{   180,   180,  -390, -1160,    30}
+    ,{   -90,  -740,   -90,  -810,  -600}
+    }
+   ,{{  -100,  -580,  -220,  -100,  -150}
+    ,{  -150,  -580,  -220,  -970,  -150}
+    ,{  -100,  -740,  -600,  -100,  -600}
+    ,{ -1340, -2010, -1650, -1980, -1340}
+    ,{  -600,  -740,  -600, -1240,  -600}
+    }
+   ,{{   540,  -660,  -510,   540,  -510}
+    ,{    10,  -660, -1150,    10,  -510}
+    ,{   540,  -960,  -820,   540,  -820}
+    ,{  -510,  -660,  -510, -1160,  -510}
+    ,{  -820,  -960,  -820, -1220,  -820}
+    }
+   ,{{   180,   180,  -390, -1240,    30}
+    ,{  -860, -1340,  -860, -2450,  -860}
+    ,{  -600,  -740,  -600, -1240,  -600}
+    ,{   180,   180,  -390, -1870,    30}
+    ,{  -600,  -740,  -600, -1240,  -600}
+    }
+   ,{{   -90,  -660,   -90,  -810,  -510}
+    ,{  -510,  -660,  -510, -1160,  -510}
+    ,{ -1130, -1270, -1130, -1530, -1130}
+    ,{  -510,  -660,  -510, -1160,  -510}
+    ,{   -90, -1240,   -90,  -810,  -800}
+    }
+   }
+  ,{{{   180,  -430,    20,  -430,   180}
+    ,{   -90,  -600,  -500,  -600,   -90}
+    ,{  -540, -1050,  -600, -1050,  -540}
+    ,{   180,  -430,    20,  -430,   180}
+    ,{  -540,  -830,  -600, -1050,  -540}
+    }
+   ,{{   -90,  -600,  -600,  -600,   -90}
+    ,{   -90,  -600, -1070,  -600,   -90}
+    ,{  -540, -1050,  -600, -1050,  -540}
+    ,{  -630, -1790,  -630, -1790, -1040}
+    ,{  -540, -1050,  -600, -1050,  -540}
+    }
+   ,{{  -460,  -970,  -520,  -970,  -460}
+    ,{  -460,  -970,  -750,  -970,  -460}
+    ,{  -760, -1270,  -820, -1270,  -760}
+    ,{  -460,  -970,  -520,  -970,  -460}
+    ,{  -550, -1270,  -820, -1270,  -550}
+    }
+   ,{{   180,  -430,    20,  -430,   180}
+    ,{  -500, -1070,  -500, -1320,  -570}
+    ,{  -540, -1050,  -600, -1050,  -540}
+    ,{   180,  -430,    20,  -430,   180}
+    ,{  -540, -1050,  -600, -1050,  -540}
+    }
+   ,{{  -460,  -830,  -520,  -970,  -460}
+    ,{  -460,  -970,  -520,  -970,  -460}
+    ,{ -1070, -1580, -1130, -1580, -1070}
+    ,{  -460,  -970,  -520,  -970,  -460}
+    ,{  -830,  -830, -1710, -1260, -1460}
+    }
+   }
+  ,{{{    30,  -350,    30,  -200,    30}
+    ,{  -150,  -870,  -150,  -200,  -150}
+    ,{  -210,  -350,  -600,  -210,  -600}
+    ,{    30,  -870,    30,  -320,    30}
+    ,{  -260,  -940,  -600,  -260,  -600}
+    }
+   ,{{  -150,  -350,  -150,  -200,  -150}
+    ,{  -150, -1600,  -150,  -200,  -150}
+    ,{  -350,  -350,  -600,  -440,  -600}
+    ,{ -1340, -3070, -1340, -2390, -1340}
+    ,{  -400,  -960,  -600,  -400,  -600}
+    }
+   ,{{  -260,  -870,  -510,  -260,  -510}
+    ,{  -320, -1110,  -510,  -320,  -510}
+    ,{  -620,  -940,  -820,  -620,  -820}
+    ,{  -320,  -870,  -510,  -320,  -510}
+    ,{  -260,  -940,  -820,  -260,  -820}
+    }
+   ,{{    30,  -960,    30,  -400,    30}
+    ,{  -860, -1880,  -860, -1080,  -860}
+    ,{  -400,  -960,  -600,  -400,  -600}
+    ,{    30, -1370,    30, -2280,    30}
+    ,{  -400,  -960,  -600,  -400,  -600}
+    }
+   ,{{  -210,  -870,  -510,  -210,  -510}
+    ,{  -320,  -870,  -510,  -320,  -510}
+    ,{  -210, -1250, -1130,  -210, -1130}
+    ,{  -320,  -870,  -510,  -320,  -510}
+    ,{  -800, -1360,  -800, -1550,  -800}
+    }
+   }
+  ,{{{  -200,  -430,  -200,  -430,  -230}
+    ,{  -200,  -600,  -200,  -600,  -400}
+    ,{  -650, -1050,  -650, -1050, -1390}
+    ,{  -230,  -430,  -570,  -430,  -230}
+    ,{  -650, -1050,  -650, -1050, -1390}
+    }
+   ,{{  -200,  -600,  -200,  -600, -1390}
+    ,{  -200,  -600,  -200,  -600, -1490}
+    ,{  -650, -1050,  -650, -1050, -1390}
+    ,{ -1150, -1790, -1150, -1790, -1520}
+    ,{  -650, -1050,  -650, -1050, -1390}
+    }
+   ,{{  -400,  -970,  -570,  -970,  -400}
+    ,{  -400,  -970,  -570,  -970,  -400}
+    ,{  -870, -1270,  -870, -1270, -1610}
+    ,{  -570,  -970,  -570,  -970, -1300}
+    ,{  -870, -1270,  -870, -1270, -1610}
+    }
+   ,{{  -230,  -430,  -650,  -430,  -230}
+    ,{ -1300, -1320, -1750, -1320, -1300}
+    ,{  -650, -1050,  -650, -1050, -1390}
+    ,{  -230,  -430,  -880,  -430,  -230}
+    ,{  -650, -1050,  -650, -1050, -1390}
+    }
+   ,{{  -570,  -970,  -570,  -970, -1300}
+    ,{  -570,  -970,  -570,  -970, -1300}
+    ,{ -1180, -1580, -1180, -1580, -1920}
+    ,{  -570,  -970,  -570,  -970, -1300}
+    ,{  -860, -1260,  -860, -1260, -2350}
+    }
+   }
+  }
+ ,{{{{   240,    40,   190,  -270,   240}
+    ,{  -590, -1030,  -650,  -870,  -590}
+    ,{  -870, -1180, -1060,  -870, -1010}
+    ,{   240,    40,   190,  -270,   240}
+    ,{  -870,  -970, -1060,  -870, -1010}
+    }
+   ,{{  -780, -1210,  -840,  -870,  -780}
+    ,{ -1050, -1370, -1240, -1050, -1190}
+    ,{  -870, -1210, -1060,  -870, -1010}
+    ,{  -780, -1220,  -840, -1530,  -780}
+    ,{  -870, -1210, -1060,  -870, -1010}
+    }
+   ,{{  -870, -1180, -1060,  -870, -1010}
+    ,{  -870, -1210, -1060,  -870, -1010}
+    ,{  -870, -1180, -1060,  -870, -1010}
+    ,{  -870, -1210, -1060,  -870, -1010}
+    ,{  -870, -1180, -1060,  -870, -1010}
+    }
+   ,{{   240,    40,   190,  -270,   240}
+    ,{  -590, -1030,  -650, -1340,  -590}
+    ,{  -870, -1210, -1060,  -870, -1010}
+    ,{   240,    40,   190,  -270,   240}
+    ,{  -870, -1210, -1060,  -870, -1010}
+    }
+   ,{{  -870,  -970, -1060,  -870, -1010}
+    ,{  -870, -1210, -1060,  -870, -1010}
+    ,{  -870, -1180, -1060,  -870, -1010}
+    ,{  -870, -1210, -1060,  -870, -1010}
+    ,{  -970,  -970, -1060, -1520, -1010}
+    }
+   }
+  ,{{{   190,    40,   190, -1470,   190}
+    ,{  -890, -1030,  -890, -1530,  -890}
+    ,{ -1060, -1210, -1060, -1470, -1060}
+    ,{   190,    40,   190, -1710,   190}
+    ,{  -970,  -970, -1060, -1470, -1060}
+    }
+   ,{{ -1060, -1210, -1060, -1710, -1060}
+    ,{ -1240, -1370, -1240, -1890, -1240}
+    ,{ -1060, -1210, -1060, -1710, -1060}
+    ,{ -1080, -1220, -1080, -1720, -1080}
+    ,{ -1060, -1210, -1060, -1710, -1060}
+    }
+   ,{{ -1060, -1210, -1060, -1470, -1060}
+    ,{ -1060, -1210, -1060, -1710, -1060}
+    ,{ -1060, -1210, -1060, -1470, -1060}
+    ,{ -1060, -1210, -1060, -1710, -1060}
+    ,{ -1060, -1210, -1060, -1470, -1060}
+    }
+   ,{{   190,    40,   190, -1530,   190}
+    ,{  -890, -1030,  -890, -1530,  -890}
+    ,{ -1060, -1210, -1060, -1710, -1060}
+    ,{   190,    40,   190, -1710,   190}
+    ,{ -1060, -1210, -1060, -1710, -1060}
+    }
+   ,{{  -970,  -970, -1060, -1470, -1060}
+    ,{ -1060, -1210, -1060, -1710, -1060}
+    ,{ -1060, -1210, -1060, -1470, -1060}
+    ,{ -1060, -1210, -1060, -1710, -1060}
+    ,{  -970,  -970, -1060, -1710, -1060}
+    }
+   }
+  ,{{{   240,  -270,   180,  -270,   240}
+    ,{  -590, -1340,  -650, -1340,  -590}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    ,{   240,  -270,   180,  -270,   240}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    }
+   ,{{  -780, -1520,  -840, -1520,  -780}
+    ,{ -1190, -1700, -1250, -1700, -1190}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    ,{  -780, -1530,  -840, -1530,  -780}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    }
+   ,{{ -1010, -1520, -1070, -1520, -1010}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    }
+   ,{{   240,  -270,   180,  -270,   240}
+    ,{  -590, -1340,  -650, -1340,  -590}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    ,{   240,  -270,   180,  -270,   240}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    }
+   ,{{ -1010, -1520, -1070, -1520, -1010}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    ,{ -1010, -1520, -1070, -1520, -1010}
+    }
+   }
+  ,{{{   190, -1180,   190,  -870,   190}
+    ,{  -870, -1250,  -890,  -870,  -890}
+    ,{  -870, -1180, -1060,  -870, -1060}
+    ,{   190, -1420,   190,  -870,   190}
+    ,{  -870, -1180, -1060,  -870, -1060}
+    }
+   ,{{  -870, -1420, -1060,  -870, -1060}
+    ,{ -1050, -1600, -1240, -1050, -1240}
+    ,{  -870, -1420, -1060,  -870, -1060}
+    ,{ -1080, -1440, -1080, -2130, -1080}
+    ,{  -870, -1420, -1060,  -870, -1060}
+    }
+   ,{{  -870, -1180, -1060,  -870, -1060}
+    ,{  -870, -1420, -1060,  -870, -1060}
+    ,{  -870, -1180, -1060,  -870, -1060}
+    ,{  -870, -1420, -1060,  -870, -1060}
+    ,{  -870, -1180, -1060,  -870, -1060}
+    }
+   ,{{   190, -1250,   190,  -870,   190}
+    ,{  -890, -1250,  -890, -1940,  -890}
+    ,{  -870, -1420, -1060,  -870, -1060}
+    ,{   190, -1420,   190, -2120,   190}
+    ,{  -870, -1420, -1060,  -870, -1060}
+    }
+   ,{{  -870, -1180, -1060,  -870, -1060}
+    ,{  -870, -1420, -1060,  -870, -1060}
+    ,{  -870, -1180, -1060,  -870, -1060}
+    ,{  -870, -1420, -1060,  -870, -1060}
+    ,{ -1060, -1420, -1060, -2120, -1060}
+    }
+   }
+  ,{{{   130,  -270,   130,  -270, -1680}
+    ,{  -700, -1340,  -700, -1340, -1680}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    ,{   130,  -270,   130,  -270, -1850}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    }
+   ,{{  -890, -1520,  -890, -1520, -1790}
+    ,{ -1300, -1700, -1300, -1700, -1790}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    ,{  -890, -1530,  -890, -1530, -1870}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    }
+   ,{{ -1120, -1520, -1120, -1520, -1850}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    }
+   ,{{   130,  -270,   130,  -270, -1680}
+    ,{  -700, -1340,  -700, -1340, -1680}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    ,{   130,  -270,   130,  -270, -1850}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    }
+   ,{{ -1120, -1520, -1120, -1520, -1850}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    ,{ -1120, -1520, -1120, -1520, -1850}
+    }
+   }
+  }
+ ,{{{{   800,   600,   740,   290,   800}
+    ,{   200,  -140,     0,   200,    50}
+    ,{  -310,  -630,  -510,  -310,  -450}
+    ,{   800,   600,   740,   290,   800}
+    ,{  -310,  -410,  -510,  -310,  -450}
+    }
+   ,{{   200,  -140,     0,   200,    50}
+    ,{   200,  -140,     0,   200,    50}
+    ,{  -310,  -650,  -510,  -310,  -450}
+    ,{  -550,  -990,  -610, -1300,  -550}
+    ,{  -310,  -650,  -510,  -310,  -450}
+    }
+   ,{{  -310,  -630,  -510,  -310,  -450}
+    ,{  -310,  -650,  -510,  -310,  -450}
+    ,{  -310,  -630,  -510,  -310,  -450}
+    ,{  -310,  -650,  -510,  -310,  -450}
+    ,{  -310,  -630,  -510,  -310,  -450}
+    }
+   ,{{   800,   600,   740,   290,   800}
+    ,{  -720, -1160,  -780, -1470,  -720}
+    ,{  -310,  -650,  -510,  -310,  -450}
+    ,{   800,   600,   740,   290,   800}
+    ,{  -310,  -650,  -510,  -310,  -450}
+    }
+   ,{{  -310,  -410,  -510,  -310,  -450}
+    ,{  -310,  -650,  -510,  -310,  -450}
+    ,{  -310,  -630,  -510,  -310,  -450}
+    ,{  -310,  -650,  -510,  -310,  -450}
+    ,{  -410,  -410,  -510,  -960,  -450}
+    }
+   }
+  ,{{{   740,   600,   740,  -640,   740}
+    ,{     0,  -140,     0,  -640,     0}
+    ,{  -510,  -650,  -510,  -910,  -510}
+    ,{   740,   600,   740, -1150,   740}
+    ,{  -410,  -410,  -510,  -910,  -510}
+    }
+   ,{{     0,  -140,     0,  -640,     0}
+    ,{     0,  -140,     0,  -640,     0}
+    ,{  -510,  -650,  -510, -1150,  -510}
+    ,{  -850,  -990,  -850, -1490,  -850}
+    ,{  -510,  -650,  -510, -1150,  -510}
+    }
+   ,{{  -510,  -650,  -510,  -910,  -510}
+    ,{  -510,  -650,  -510, -1150,  -510}
+    ,{  -510,  -650,  -510,  -910,  -510}
+    ,{  -510,  -650,  -510, -1150,  -510}
+    ,{  -510,  -650,  -510,  -910,  -510}
+    }
+   ,{{   740,   600,   740, -1150,   740}
+    ,{ -1020, -1160, -1020, -1660, -1020}
+    ,{  -510,  -650,  -510, -1150,  -510}
+    ,{   740,   600,   740, -1150,   740}
+    ,{  -510,  -650,  -510, -1150,  -510}
+    }
+   ,{{  -410,  -410,  -510,  -910,  -510}
+    ,{  -510,  -650,  -510, -1150,  -510}
+    ,{  -510,  -650,  -510,  -910,  -510}
+    ,{  -510,  -650,  -510, -1150,  -510}
+    ,{  -410,  -410,  -510, -1150,  -510}
+    }
+   }
+  ,{{{   800,   290,   740,   290,   800}
+    ,{    50,  -450,     0,  -450,    50}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    ,{   800,   290,   740,   290,   800}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    }
+   ,{{    50,  -450,     0,  -450,    50}
+    ,{    50,  -450,     0,  -450,    50}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    ,{  -550, -1300,  -610, -1300,  -550}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    }
+   ,{{  -450,  -960,  -510,  -960,  -450}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    }
+   ,{{   800,   290,   740,   290,   800}
+    ,{  -720, -1470,  -780, -1470,  -720}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    ,{   800,   290,   740,   290,   800}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    }
+   ,{{  -450,  -960,  -510,  -960,  -450}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    ,{  -450,  -960,  -510,  -960,  -450}
+    }
+   }
+  ,{{{   740,  -360,   740,   200,   740}
+    ,{   200,  -360,     0,   200,     0}
+    ,{  -310,  -630,  -510,  -310,  -510}
+    ,{   740,  -870,   740,  -310,   740}
+    ,{  -310,  -630,  -510,  -310,  -510}
+    }
+   ,{{   200,  -360,     0,   200,     0}
+    ,{   200,  -360,     0,   200,     0}
+    ,{  -310,  -870,  -510,  -310,  -510}
+    ,{  -850, -1210,  -850, -1900,  -850}
+    ,{  -310,  -870,  -510,  -310,  -510}
+    }
+   ,{{  -310,  -630,  -510,  -310,  -510}
+    ,{  -310,  -870,  -510,  -310,  -510}
+    ,{  -310,  -630,  -510,  -310,  -510}
+    ,{  -310,  -870,  -510,  -310,  -510}
+    ,{  -310,  -630,  -510,  -310,  -510}
+    }
+   ,{{   740,  -870,   740,  -310,   740}
+    ,{ -1020, -1380, -1020, -2070, -1020}
+    ,{  -310,  -870,  -510,  -310,  -510}
+    ,{   740,  -870,   740, -1560,   740}
+    ,{  -310,  -870,  -510,  -310,  -510}
+    }
+   ,{{  -310,  -630,  -510,  -310,  -510}
+    ,{  -310,  -870,  -510,  -310,  -510}
+    ,{  -310,  -630,  -510,  -310,  -510}
+    ,{  -310,  -870,  -510,  -310,  -510}
+    ,{  -510,  -870,  -510, -1560,  -510}
+    }
+   }
+  ,{{{   690,   290,   690,   290,  -550}
+    ,{   -50,  -450,   -50,  -450,  -550}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    ,{   690,   290,   690,   290, -1300}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    }
+   ,{{   -50,  -450,   -50,  -450,  -550}
+    ,{   -50,  -450,   -50,  -450,  -550}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    ,{  -660, -1300,  -660, -1300, -1640}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    }
+   ,{{  -560,  -960,  -560,  -960, -1300}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    }
+   ,{{   690,   290,   690,   290, -1300}
+    ,{  -830, -1470,  -830, -1470, -1810}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    ,{   690,   290,   690,   290, -1300}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    }
+   ,{{  -560,  -960,  -560,  -960, -1300}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    ,{  -560,  -960,  -560,  -960, -1300}
+    }
+   }
+  }
+ ,{{{{  1170,   970,  1120,   780,  1170}
+    ,{   780,   440,   580,   780,   640}
+    ,{   480,   170,   280,   480,   340}
+    ,{  1170,   970,  1120,   660,  1170}
+    ,{   480,   170,   280,   480,   340}
+    }
+   ,{{   780,   440,   580,   780,   640}
+    ,{   780,   440,   580,   780,   640}
+    ,{   470,   130,   270,   470,   330}
+    ,{  -510,  -950,  -570, -1260,  -510}
+    ,{   470,   130,   270,   470,   330}
+    }
+   ,{{   490,   170,   290,   490,   340}
+    ,{   490,   140,   290,   490,   340}
+    ,{   480,   170,   280,   480,   340}
+    ,{   490,   140,   290,   490,   340}
+    ,{   480,   170,   280,   480,   340}
+    }
+   ,{{  1170,   970,  1120,   660,  1170}
+    ,{  -330,  -770,  -390, -1080,  -330}
+    ,{   470,   130,   270,   470,   330}
+    ,{  1170,   970,  1120,   660,  1170}
+    ,{   470,   130,   270,   470,   330}
+    }
+   ,{{   490,   170,   290,   490,   340}
+    ,{   490,   140,   290,   490,   340}
+    ,{   480,   170,   280,   480,   340}
+    ,{   490,   140,   290,   490,   340}
+    ,{  -600,  -600,  -690, -1150,  -640}
+    }
+   }
+  ,{{{  1120,   970,  1120,   -60,  1120}
+    ,{   580,   440,   580,   -60,   580}
+    ,{   280,   140,   280,  -120,   280}
+    ,{  1120,   970,  1120,  -350,  1120}
+    ,{   280,   140,   280,  -120,   280}
+    }
+   ,{{   580,   440,   580,   -60,   580}
+    ,{   580,   440,   580,   -60,   580}
+    ,{   270,   130,   270,  -370,   270}
+    ,{  -800,  -950,  -800, -1450,  -800}
+    ,{   270,   130,   270,  -370,   270}
+    }
+   ,{{   290,   140,   290,  -120,   290}
+    ,{   290,   140,   290,  -350,   290}
+    ,{   280,   140,   280,  -120,   280}
+    ,{   290,   140,   290,  -350,   290}
+    ,{   280,   140,   280,  -120,   280}
+    }
+   ,{{  1120,   970,  1120,  -370,  1120}
+    ,{  -620,  -770,  -620, -1270,  -620}
+    ,{   270,   130,   270,  -370,   270}
+    ,{  1120,   970,  1120,  -780,  1120}
+    ,{   270,   130,   270,  -370,   270}
+    }
+   ,{{   290,   140,   290,  -120,   290}
+    ,{   290,   140,   290,  -350,   290}
+    ,{   280,   140,   280,  -120,   280}
+    ,{   290,   140,   290,  -350,   290}
+    ,{  -600,  -600,  -690, -1340,  -690}
+    }
+   }
+  ,{{{  1170,   660,  1110,   660,  1170}
+    ,{   640,   130,   580,   130,   640}
+    ,{   340,  -170,   280,  -170,   340}
+    ,{  1170,   660,  1110,   660,  1170}
+    ,{   340,  -170,   280,  -170,   340}
+    }
+   ,{{   640,   130,   580,   130,   640}
+    ,{   640,   130,   580,   130,   640}
+    ,{   330,  -180,   270,  -180,   330}
+    ,{  -510, -1260,  -570, -1260,  -510}
+    ,{   330,  -180,   270,  -180,   330}
+    }
+   ,{{   340,  -160,   280,  -160,   340}
+    ,{   340,  -160,   280,  -160,   340}
+    ,{   340,  -170,   280,  -170,   340}
+    ,{   340,  -160,   280,  -160,   340}
+    ,{   340,  -170,   280,  -170,   340}
+    }
+   ,{{  1170,   660,  1110,   660,  1170}
+    ,{  -330, -1080,  -390, -1080,  -330}
+    ,{   330,  -180,   270,  -180,   330}
+    ,{  1170,   660,  1110,   660,  1170}
+    ,{   330,  -180,   270,  -180,   330}
+    }
+   ,{{   340,  -160,   280,  -160,   340}
+    ,{   340,  -160,   280,  -160,   340}
+    ,{   340,  -170,   280,  -170,   340}
+    ,{   340,  -160,   280,  -160,   340}
+    ,{  -640, -1150,  -700, -1150,  -640}
+    }
+   }
+  ,{{{  1120,   220,  1120,   780,  1120}
+    ,{   780,   220,   580,   780,   580}
+    ,{   480,   170,   280,   480,   280}
+    ,{  1120,   -70,  1120,   490,  1120}
+    ,{   480,   170,   280,   480,   280}
+    }
+   ,{{   780,   220,   580,   780,   580}
+    ,{   780,   220,   580,   780,   580}
+    ,{   470,   -80,   270,   470,   270}
+    ,{  -800, -1160,  -800, -1860,  -800}
+    ,{   470,   -80,   270,   470,   270}
+    }
+   ,{{   490,   170,   290,   490,   290}
+    ,{   490,   -70,   290,   490,   290}
+    ,{   480,   170,   280,   480,   280}
+    ,{   490,   -70,   290,   490,   290}
+    ,{   480,   170,   280,   480,   280}
+    }
+   ,{{  1120,   -80,  1120,   470,  1120}
+    ,{  -620,  -980,  -620, -1680,  -620}
+    ,{   470,   -80,   270,   470,   270}
+    ,{  1120,  -490,  1120, -1190,  1120}
+    ,{   470,   -80,   270,   470,   270}
+    }
+   ,{{   490,   170,   290,   490,   290}
+    ,{   490,   -70,   290,   490,   290}
+    ,{   480,   170,   280,   480,   280}
+    ,{   490,   -70,   290,   490,   290}
+    ,{  -690, -1050,  -690, -1750,  -690}
+    }
+   }
+  ,{{{  1060,   660,  1060,   660,    40}
+    ,{   530,   130,   530,   130,    40}
+    ,{   230,  -170,   230,  -170,  -500}
+    ,{  1060,   660,  1060,   660,  -500}
+    ,{   230,  -170,   230,  -170,  -500}
+    }
+   ,{{   530,   130,   530,   130,    40}
+    ,{   530,   130,   530,   130,    40}
+    ,{   220,  -180,   220,  -180,  -510}
+    ,{  -620, -1260,  -620, -1260, -1590}
+    ,{   220,  -180,   220,  -180,  -510}
+    }
+   ,{{   230,  -160,   230,  -160,  -500}
+    ,{   230,  -160,   230,  -160,  -500}
+    ,{   230,  -170,   230,  -170,  -500}
+    ,{   230,  -160,   230,  -160,  -500}
+    ,{   230,  -170,   230,  -170,  -500}
+    }
+   ,{{  1060,   660,  1060,   660,  -510}
+    ,{  -440, -1080,  -440, -1080, -1410}
+    ,{   220,  -180,   220,  -180,  -510}
+    ,{  1060,   660,  1060,   660,  -920}
+    ,{   220,  -180,   220,  -180,  -510}
+    }
+   ,{{   230,  -160,   230,  -160,  -500}
+    ,{   230,  -160,   230,  -160,  -500}
+    ,{   230,  -170,   230,  -170,  -500}
+    ,{   230,  -160,   230,  -160,  -500}
+    ,{  -750, -1150,  -750, -1150, -1480}
+    }
+   }
+  }
+ ,{{{{  1350,  1160,  1300,   850,  1350}
+    ,{   850,   500,   650,   850,   700}
+    ,{   720,   400,   520,   720,   570}
+    ,{  1350,  1160,  1300,   850,  1350}
+    ,{   590,   270,   390,   590,   440}
+    }
+   ,{{   850,   500,   650,   850,   700}
+    ,{   850,   500,   650,   850,   700}
+    ,{   570,   220,   370,   570,   420}
+    ,{  -460,  -900,  -520, -1210,  -460}
+    ,{   570,   220,   370,   570,   420}
+    }
+   ,{{   720,   400,   520,   720,   570}
+    ,{   720,   370,   520,   720,   570}
+    ,{   720,   400,   520,   720,   570}
+    ,{   720,   370,   520,   720,   570}
+    ,{   590,   270,   390,   590,   440}
+    }
+   ,{{  1350,  1160,  1300,   850,  1350}
+    ,{  -760, -1200,  -820, -1510,  -760}
+    ,{   570,   220,   370,   570,   420}
+    ,{  1350,  1160,  1300,   850,  1350}
+    ,{   570,   220,   370,   570,   420}
+    }
+   ,{{   720,   370,   520,   720,   570}
+    ,{   720,   370,   520,   720,   570}
+    ,{   280,   -40,    80,   280,   130}
+    ,{   720,   370,   520,   720,   570}
+    ,{  -320,  -320,  -420,  -870,  -360}
+    }
+   }
+  ,{{{  1300,  1160,  1300,   120,  1300}
+    ,{   650,   500,   650,     0,   650}
+    ,{   520,   370,   520,   120,   520}
+    ,{  1300,  1160,  1300,  -120,  1300}
+    ,{   390,   240,   390,   -10,   390}
+    }
+   ,{{   650,   500,   650,     0,   650}
+    ,{   650,   500,   650,     0,   650}
+    ,{   370,   220,   370,  -270,   370}
+    ,{  -750,  -900,  -750, -1400,  -750}
+    ,{   370,   220,   370,  -270,   370}
+    }
+   ,{{   520,   370,   520,   120,   520}
+    ,{   520,   370,   520,  -120,   520}
+    ,{   520,   370,   520,   120,   520}
+    ,{   520,   370,   520,  -120,   520}
+    ,{   390,   240,   390,   -10,   390}
+    }
+   ,{{  1300,  1160,  1300,  -270,  1300}
+    ,{ -1050, -1200, -1050, -1700, -1050}
+    ,{   370,   220,   370,  -270,   370}
+    ,{  1300,  1160,  1300,  -590,  1300}
+    ,{   370,   220,   370,  -270,   370}
+    }
+   ,{{   520,   370,   520,  -120,   520}
+    ,{   520,   370,   520,  -120,   520}
+    ,{    80,   -60,    80,  -320,    80}
+    ,{   520,   370,   520,  -120,   520}
+    ,{  -320,  -320,  -420, -1060,  -420}
+    }
+   }
+  ,{{{  1350,   850,  1290,   850,  1350}
+    ,{   700,   190,   640,   190,   700}
+    ,{   570,    60,   510,    60,   570}
+    ,{  1350,   850,  1290,   850,  1350}
+    ,{   440,   -60,   380,   -60,   440}
+    }
+   ,{{   700,   190,   640,   190,   700}
+    ,{   700,   190,   640,   190,   700}
+    ,{   420,   -80,   360,   -80,   420}
+    ,{  -460, -1210,  -520, -1210,  -460}
+    ,{   420,   -80,   360,   -80,   420}
+    }
+   ,{{   570,    60,   510,    60,   570}
+    ,{   570,    60,   510,    60,   570}
+    ,{   570,    60,   510,    60,   570}
+    ,{   570,    60,   510,    60,   570}
+    ,{   440,   -60,   380,   -60,   440}
+    }
+   ,{{  1350,   850,  1290,   850,  1350}
+    ,{  -760, -1510,  -820, -1510,  -760}
+    ,{   420,   -80,   360,   -80,   420}
+    ,{  1350,   850,  1290,   850,  1350}
+    ,{   420,   -80,   360,   -80,   420}
+    }
+   ,{{   570,    60,   510,    60,   570}
+    ,{   570,    60,   510,    60,   570}
+    ,{   130,  -370,    70,  -370,   130}
+    ,{   570,    60,   510,    60,   570}
+    ,{  -360,  -870,  -420,  -870,  -360}
+    }
+   }
+  ,{{{  1300,   400,  1300,   850,  1300}
+    ,{   850,   290,   650,   850,   650}
+    ,{   720,   400,   520,   720,   520}
+    ,{  1300,   160,  1300,   720,  1300}
+    ,{   590,   270,   390,   590,   390}
+    }
+   ,{{   850,   290,   650,   850,   650}
+    ,{   850,   290,   650,   850,   650}
+    ,{   570,    10,   370,   570,   370}
+    ,{  -750, -1110,  -750, -1810,  -750}
+    ,{   570,    10,   370,   570,   370}
+    }
+   ,{{   720,   400,   520,   720,   520}
+    ,{   720,   160,   520,   720,   520}
+    ,{   720,   400,   520,   720,   520}
+    ,{   720,   160,   520,   720,   520}
+    ,{   590,   270,   390,   590,   390}
+    }
+   ,{{  1300,    10,  1300,   570,  1300}
+    ,{ -1050, -1410, -1050, -2110, -1050}
+    ,{   570,    10,   370,   570,   370}
+    ,{  1300,  -310,  1300, -1000,  1300}
+    ,{   570,    10,   370,   570,   370}
+    }
+   ,{{   720,   160,   520,   720,   520}
+    ,{   720,   160,   520,   720,   520}
+    ,{   280,   -40,    80,   280,    80}
+    ,{   720,   160,   520,   720,   520}
+    ,{  -420,  -780,  -420, -1470,  -420}
+    }
+   }
+  ,{{{  1250,   850,  1250,   850,   100}
+    ,{   590,   190,   590,   190,   100}
+    ,{   460,    60,   460,    60,  -270}
+    ,{  1250,   850,  1250,   850,  -270}
+    ,{   330,   -60,   330,   -60,  -400}
+    }
+   ,{{   590,   190,   590,   190,   100}
+    ,{   590,   190,   590,   190,   100}
+    ,{   310,   -80,   310,   -80,  -420}
+    ,{  -570, -1210,  -570, -1210, -1540}
+    ,{   310,   -80,   310,   -80,  -420}
+    }
+   ,{{   460,    60,   460,    60,  -270}
+    ,{   460,    60,   460,    60,  -270}
+    ,{   460,    60,   460,    60,  -270}
+    ,{   460,    60,   460,    60,  -270}
+    ,{   330,   -60,   330,   -60,  -400}
+    }
+   ,{{  1250,   850,  1250,   850,  -420}
+    ,{  -870, -1510,  -870, -1510, -1840}
+    ,{   310,   -80,   310,   -80,  -420}
+    ,{  1250,   850,  1250,   850,  -740}
+    ,{   310,   -80,   310,   -80,  -420}
+    }
+   ,{{   460,    60,   460,    60,  -270}
+    ,{   460,    60,   460,    60,  -270}
+    ,{    20,  -370,    20,  -370,  -710}
+    ,{   460,    60,   460,    60,  -270}
+    ,{  -470,  -870,  -470,  -870, -1210}
+    }
+   }
+  }
+ ,{{{{  1350,  1160,  1300,   850,  1350}
+    ,{   850,   500,   650,   850,   700}
+    ,{   720,   400,   520,   720,   570}
+    ,{  1350,  1160,  1300,   850,  1350}
+    ,{   590,   270,   390,   590,   440}
+    }
+   ,{{   850,   500,   650,   850,   700}
+    ,{   850,   500,   650,   850,   700}
+    ,{   570,   220,   370,   570,   420}
+    ,{  -230,  -670,  -290,  -980,  -230}
+    ,{   570,   220,   370,   570,   420}
+    }
+   ,{{   720,   400,   520,   720,   570}
+    ,{   720,   370,   520,   720,   570}
+    ,{   720,   400,   520,   720,   570}
+    ,{   720,   370,   520,   720,   570}
+    ,{   590,   270,   390,   590,   440}
+    }
+   ,{{  1350,  1160,  1300,   850,  1350}
+    ,{  -330,  -770,  -390, -1080,  -330}
+    ,{   570,   220,   370,   570,   420}
+    ,{  1350,  1160,  1300,   850,  1350}
+    ,{   570,   220,   370,   570,   420}
+    }
+   ,{{   720,   370,   520,   720,   570}
+    ,{   720,   370,   520,   720,   570}
+    ,{   480,   170,   280,   480,   340}
+    ,{   720,   370,   520,   720,   570}
+    ,{   -90,  -320,   -90,  -810,  -360}
+    }
+   }
+  ,{{{  1300,  1160,  1300,   540,  1300}
+    ,{   650,   500,   650,    10,   650}
+    ,{   540,   370,   520,   540,   520}
+    ,{  1300,  1160,  1300,  -120,  1300}
+    ,{   390,   240,   390,   -10,   390}
+    }
+   ,{{   650,   500,   650,     0,   650}
+    ,{   650,   500,   650,     0,   650}
+    ,{   370,   220,   370,  -100,   370}
+    ,{  -530,  -670,  -530, -1170,  -530}
+    ,{   370,   220,   370,  -270,   370}
+    }
+   ,{{   540,   370,   520,   540,   520}
+    ,{   520,   370,   520,    10,   520}
+    ,{   540,   370,   520,   540,   520}
+    ,{   520,   370,   520,  -120,   520}
+    ,{   390,   240,   390,   -10,   390}
+    }
+   ,{{  1300,  1160,  1300,  -270,  1300}
+    ,{  -620,  -770,  -620, -1270,  -620}
+    ,{   370,   220,   370,  -270,   370}
+    ,{  1300,  1160,  1300,  -590,  1300}
+    ,{   370,   220,   370,  -270,   370}
+    }
+   ,{{   520,   370,   520,  -120,   520}
+    ,{   520,   370,   520,  -120,   520}
+    ,{   280,   140,   280,  -120,   280}
+    ,{   520,   370,   520,  -120,   520}
+    ,{   -90,  -320,   -90,  -810,  -420}
+    }
+   }
+  ,{{{  1350,   850,  1290,   850,  1350}
+    ,{   700,   190,   640,   190,   700}
+    ,{   570,    60,   510,    60,   570}
+    ,{  1350,   850,  1290,   850,  1350}
+    ,{   440,   -60,   380,   -60,   440}
+    }
+   ,{{   700,   190,   640,   190,   700}
+    ,{   700,   190,   640,   190,   700}
+    ,{   420,   -80,   360,   -80,   420}
+    ,{  -230,  -980,  -290,  -980,  -230}
+    ,{   420,   -80,   360,   -80,   420}
+    }
+   ,{{   570,    60,   510,    60,   570}
+    ,{   570,    60,   510,    60,   570}
+    ,{   570,    60,   510,    60,   570}
+    ,{   570,    60,   510,    60,   570}
+    ,{   440,   -60,   380,   -60,   440}
+    }
+   ,{{  1350,   850,  1290,   850,  1350}
+    ,{  -330, -1070,  -390, -1080,  -330}
+    ,{   420,   -80,   360,   -80,   420}
+    ,{  1350,   850,  1290,   850,  1350}
+    ,{   420,   -80,   360,   -80,   420}
+    }
+   ,{{   570,    60,   510,    60,   570}
+    ,{   570,    60,   510,    60,   570}
+    ,{   340,  -170,   280,  -170,   340}
+    ,{   570,    60,   510,    60,   570}
+    ,{  -360,  -830,  -420,  -870,  -360}
+    }
+   }
+  ,{{{  1300,   400,  1300,   850,  1300}
+    ,{   850,   290,   650,   850,   650}
+    ,{   720,   400,   520,   720,   520}
+    ,{  1300,   160,  1300,   720,  1300}
+    ,{   590,   270,   390,   590,   390}
+    }
+   ,{{   850,   290,   650,   850,   650}
+    ,{   850,   290,   650,   850,   650}
+    ,{   570,    10,   370,   570,   370}
+    ,{  -530,  -890,  -530, -1580,  -530}
+    ,{   570,    10,   370,   570,   370}
+    }
+   ,{{   720,   400,   520,   720,   520}
+    ,{   720,   160,   520,   720,   520}
+    ,{   720,   400,   520,   720,   520}
+    ,{   720,   160,   520,   720,   520}
+    ,{   590,   270,   390,   590,   390}
+    }
+   ,{{  1300,    10,  1300,   570,  1300}
+    ,{  -620,  -980,  -620, -1080,  -620}
+    ,{   570,    10,   370,   570,   370}
+    ,{  1300,  -310,  1300, -1000,  1300}
+    ,{   570,    10,   370,   570,   370}
+    }
+   ,{{   720,   170,   520,   720,   520}
+    ,{   720,   160,   520,   720,   520}
+    ,{   480,   170,   280,   480,   280}
+    ,{   720,   160,   520,   720,   520}
+    ,{  -420,  -780,  -420, -1470,  -420}
+    }
+   }
+  ,{{{  1250,   850,  1250,   850,   100}
+    ,{   590,   190,   590,   190,   100}
+    ,{   460,    60,   460,    60,  -270}
+    ,{  1250,   850,  1250,   850,  -230}
+    ,{   330,   -60,   330,   -60,  -400}
+    }
+   ,{{   590,   190,   590,   190,   100}
+    ,{   590,   190,   590,   190,   100}
+    ,{   310,   -80,   310,   -80,  -420}
+    ,{  -340,  -980,  -340,  -980, -1320}
+    ,{   310,   -80,   310,   -80,  -420}
+    }
+   ,{{   460,    60,   460,    60,  -270}
+    ,{   460,    60,   460,    60,  -270}
+    ,{   460,    60,   460,    60,  -270}
+    ,{   460,    60,   460,    60,  -270}
+    ,{   330,   -60,   330,   -60,  -400}
+    }
+   ,{{  1250,   850,  1250,   850,  -230}
+    ,{  -440, -1080,  -440, -1080, -1300}
+    ,{   310,   -80,   310,   -80,  -420}
+    ,{  1250,   850,  1250,   850,  -230}
+    ,{   310,   -80,   310,   -80,  -420}
+    }
+   ,{{   460,    60,   460,    60,  -270}
+    ,{   460,    60,   460,    60,  -270}
+    ,{   230,  -170,   230,  -170,  -500}
+    ,{   460,    60,   460,    60,  -270}
+    ,{  -470,  -870,  -470,  -870, -1210}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   540,   -90,   540,   180,   -90}
+    ,{   540,  -100,   540,   180,   -90}
+    ,{   180,   -90,  -460,   180,  -460}
+    ,{    30,  -150,  -260,    30,  -210}
+    ,{  -200,  -200,  -400,  -230,  -570}
+    }
+   ,{{   180,  -350,  -660,   180,  -660}
+    ,{   180,  -580,  -660,   180,  -660}
+    ,{  -430,  -600,  -970,  -430,  -830}
+    ,{  -350,  -350,  -870,  -960,  -870}
+    ,{  -430,  -600,  -970,  -430,  -970}
+    }
+   ,{{    30,  -150,  -510,    30,   -90}
+    ,{   -90,  -220,  -510,  -390,   -90}
+    ,{    20,  -600,  -520,    20,  -520}
+    ,{    30,  -150,  -510,    30,  -510}
+    ,{  -200,  -200,  -570,  -650,  -570}
+    }
+   ,{{   540,  -100,   540,  -400,  -210}
+    ,{   540,  -100,   540, -1240,  -810}
+    ,{  -430,  -600,  -970,  -430,  -970}
+    ,{  -200,  -200,  -260,  -400,  -210}
+    ,{  -430,  -600,  -970,  -430,  -970}
+    }
+   ,{{   180,   -90,  -400,   180,  -460}
+    ,{    30,  -150,  -510,    30,  -510}
+    ,{   180,   -90,  -460,   180,  -460}
+    ,{    30,  -150,  -510,    30,  -510}
+    ,{  -230, -1390,  -400,  -230, -1300}
+    }
+   }
+  ,{{{    10,   -90,    10,  -500,  -320}
+    ,{    10,  -150,    10,  -860,  -510}
+    ,{   -90,   -90,  -460,  -500,  -460}
+    ,{  -150,  -150,  -320,  -860,  -320}
+    ,{  -200,  -200,  -400, -1300,  -570}
+    }
+   ,{{  -580,  -580,  -660, -1070,  -660}
+    ,{  -580,  -580,  -660, -1340,  -660}
+    ,{  -600,  -600,  -970, -1070,  -970}
+    ,{  -870, -1600, -1110, -1880,  -870}
+    ,{  -600,  -600,  -970, -1320,  -970}
+    }
+   ,{{  -150,  -150,  -510,  -500,  -510}
+    ,{  -220,  -220, -1150,  -860,  -510}
+    ,{  -500, -1070,  -750,  -500,  -520}
+    ,{  -150,  -150,  -510,  -860,  -510}
+    ,{  -200,  -200,  -570, -1750,  -570}
+    }
+   ,{{    10,  -200,    10, -1080,  -320}
+    ,{    10,  -970,    10, -2450, -1160}
+    ,{  -600,  -600,  -970, -1320,  -970}
+    ,{  -200,  -200,  -320, -1080,  -320}
+    ,{  -600,  -600,  -970, -1320,  -970}
+    }
+   ,{{   -90,   -90,  -400,  -570,  -460}
+    ,{  -150,  -150,  -510,  -860,  -510}
+    ,{   -90,   -90,  -460,  -570,  -460}
+    ,{  -150,  -150,  -510,  -860,  -510}
+    ,{  -400, -1490,  -400, -1300, -1300}
+    }
+   }
+  ,{{{   540,  -100,   540,  -400,  -210}
+    ,{   540,  -100,   540,  -600, -1130}
+    ,{  -540,  -540,  -760,  -540, -1070}
+    ,{  -210,  -350,  -620,  -400,  -210}
+    ,{  -650,  -650,  -870,  -650, -1180}
+    }
+   ,{{  -350,  -350,  -940,  -740, -1250}
+    ,{  -740,  -740,  -960,  -740, -1270}
+    ,{ -1050, -1050, -1270, -1050, -1580}
+    ,{  -350,  -350,  -940,  -960, -1250}
+    ,{ -1050, -1050, -1270, -1050, -1580}
+    }
+   ,{{  -600,  -600,  -820,  -600, -1130}
+    ,{  -600,  -600,  -820,  -600, -1130}
+    ,{  -600,  -600,  -820,  -600, -1130}
+    ,{  -600,  -600,  -820,  -600, -1130}
+    ,{  -650,  -650,  -870,  -650, -1180}
+    }
+   ,{{   540,  -100,   540,  -400,  -210}
+    ,{   540,  -100,   540, -1240, -1530}
+    ,{ -1050, -1050, -1270, -1050, -1580}
+    ,{  -210,  -440,  -620,  -400,  -210}
+    ,{ -1050, -1050, -1270, -1050, -1580}
+    }
+   ,{{  -540,  -540,  -760,  -540, -1070}
+    ,{  -600,  -600,  -820,  -600, -1130}
+    ,{  -540,  -540,  -760,  -540, -1070}
+    ,{  -600,  -600,  -820,  -600, -1130}
+    ,{ -1390, -1390, -1610, -1390, -1920}
+    }
+   }
+  ,{{{   180,  -630,  -320,   180,  -320}
+    ,{   180, -1340,  -510,   180,  -510}
+    ,{   180,  -630,  -460,   180,  -460}
+    ,{    30, -1340,  -320,    30,  -320}
+    ,{  -230, -1150,  -570,  -230,  -570}
+    }
+   ,{{   180, -1790,  -660,   180,  -660}
+    ,{   180, -2010,  -660,   180,  -660}
+    ,{  -430, -1790,  -970,  -430,  -970}
+    ,{  -870, -3070,  -870, -1370,  -870}
+    ,{  -430, -1790,  -970,  -430,  -970}
+    }
+   ,{{    30,  -630,  -510,    30,  -510}
+    ,{  -390, -1650,  -510,  -390,  -510}
+    ,{    20,  -630,  -520,    20,  -520}
+    ,{    30, -1340,  -510,    30,  -510}
+    ,{  -570, -1150,  -570,  -880,  -570}
+    }
+   ,{{  -320, -1790,  -320,  -430,  -320}
+    ,{ -1160, -1980, -1160, -1870, -1160}
+    ,{  -430, -1790,  -970,  -430,  -970}
+    ,{  -320, -2390,  -320, -2280,  -320}
+    ,{  -430, -1790,  -970,  -430,  -970}
+    }
+   ,{{   180, -1040,  -460,   180,  -460}
+    ,{    30, -1340,  -510,    30,  -510}
+    ,{   180, -1040,  -460,   180,  -460}
+    ,{    30, -1340,  -510,    30,  -510}
+    ,{  -230, -1520, -1300,  -230, -1300}
+    }
+   }
+  ,{{{   -90,  -400,  -260,  -400,   -90}
+    ,{   -90,  -600,  -820,  -600,   -90}
+    ,{  -540,  -540,  -550,  -540,  -830}
+    ,{  -260,  -400,  -260,  -400,  -800}
+    ,{  -650,  -650,  -870,  -650,  -860}
+    }
+   ,{{  -740,  -740,  -940,  -740,  -830}
+    ,{  -740,  -740,  -960,  -740, -1240}
+    ,{  -830, -1050, -1270, -1050,  -830}
+    ,{  -940,  -960,  -940,  -960, -1360}
+    ,{ -1050, -1050, -1270, -1050, -1260}
+    }
+   ,{{   -90,  -600,  -820,  -600,   -90}
+    ,{   -90,  -600,  -820,  -600,   -90}
+    ,{  -600,  -600,  -820,  -600, -1710}
+    ,{  -600,  -600,  -820,  -600,  -800}
+    ,{  -650,  -650,  -870,  -650,  -860}
+    }
+   ,{{  -260,  -400,  -260,  -400,  -810}
+    ,{  -810, -1240, -1220, -1240,  -810}
+    ,{ -1050, -1050, -1270, -1050, -1260}
+    ,{  -260,  -400,  -260,  -400, -1550}
+    ,{ -1050, -1050, -1270, -1050, -1260}
+    }
+   ,{{  -540,  -540,  -550,  -540,  -800}
+    ,{  -600,  -600,  -820,  -600,  -800}
+    ,{  -540,  -540,  -550,  -540, -1460}
+    ,{  -600,  -600,  -820,  -600,  -800}
+    ,{ -1390, -1390, -1610, -1390, -2350}
+    }
+   }
+  }
+ ,{{{{    50,    50,  -320,    50,  -320}
+    ,{    50,  -130,  -490,    50,  -490}
+    ,{  -400,  -580,  -940,  -400,  -940}
+    ,{    50,    50,  -320,  -320,  -320}
+    ,{  -400,  -540,  -940,  -400,  -940}
+    }
+   ,{{    50,  -130,  -490,    50,  -490}
+    ,{    50,  -130,  -490,    50,  -490}
+    ,{  -400,  -580,  -940,  -400,  -940}
+    ,{ -1320, -1320, -1680, -1770, -1680}
+    ,{  -400,  -580,  -940,  -400,  -940}
+    }
+   ,{{  -320,  -490,  -860,  -320,  -860}
+    ,{  -320,  -490,  -860,  -320,  -860}
+    ,{  -620,  -800, -1160,  -620, -1160}
+    ,{  -320,  -490,  -860,  -320,  -860}
+    ,{  -620,  -800, -1160,  -620, -1160}
+    }
+   ,{{    50,    50,  -320,  -400,  -320}
+    ,{  -840,  -840, -1210, -1290, -1210}
+    ,{  -400,  -580,  -940,  -400,  -940}
+    ,{    50,    50,  -320,  -400,  -320}
+    ,{  -400,  -580,  -940,  -400,  -940}
+    }
+   ,{{  -320,  -490,  -860,  -320,  -860}
+    ,{  -320,  -490,  -860,  -320,  -860}
+    ,{  -930, -1110, -1470,  -930, -1470}
+    ,{  -320,  -490,  -860,  -320,  -860}
+    ,{  -540,  -540, -1150, -1230, -1150}
+    }
+   }
+  ,{{{    50,    50,  -320,  -840,  -320}
+    ,{  -130,  -130,  -490,  -840,  -490}
+    ,{  -580,  -580,  -940, -1270,  -940}
+    ,{    50,    50,  -320, -1210,  -320}
+    ,{  -540,  -540,  -940, -1270,  -940}
+    }
+   ,{{  -130,  -130,  -490,  -840,  -490}
+    ,{  -130,  -130,  -490,  -840,  -490}
+    ,{  -580,  -580,  -940, -1290,  -940}
+    ,{ -1320, -1320, -1680, -2030, -1680}
+    ,{  -580,  -580,  -940, -1290,  -940}
+    }
+   ,{{  -490,  -490,  -860, -1210,  -860}
+    ,{  -490,  -490,  -860, -1210,  -860}
+    ,{  -800,  -800, -1160, -1270, -1160}
+    ,{  -490,  -490,  -860, -1210,  -860}
+    ,{  -800,  -800, -1160, -1270, -1160}
+    }
+   ,{{    50,    50,  -320, -1290,  -320}
+    ,{  -840,  -840, -1210, -1560, -1210}
+    ,{  -580,  -580,  -940, -1290,  -940}
+    ,{    50,    50,  -320, -1920,  -320}
+    ,{  -580,  -580,  -940, -1290,  -940}
+    }
+   ,{{  -490,  -490,  -860, -1210,  -860}
+    ,{  -490,  -490,  -860, -1210,  -860}
+    ,{ -1110, -1110, -1470, -1580, -1470}
+    ,{  -490,  -490,  -860, -1210,  -860}
+    ,{  -540,  -540, -1150, -1500, -1150}
+    }
+   }
+  ,{{{  -400,  -400,  -620,  -400,  -930}
+    ,{  -580,  -580,  -800,  -580, -1110}
+    ,{ -1030, -1030, -1250, -1030, -1560}
+    ,{  -400,  -400,  -620,  -400,  -930}
+    ,{ -1030, -1030, -1250, -1030, -1560}
+    }
+   ,{{  -580,  -580,  -800,  -580, -1110}
+    ,{  -580,  -580,  -800,  -580, -1110}
+    ,{ -1030, -1030, -1250, -1030, -1560}
+    ,{ -1750, -1770, -1750, -1770, -2060}
+    ,{ -1030, -1030, -1250, -1030, -1560}
+    }
+   ,{{  -940,  -940, -1160,  -940, -1470}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{ -1250, -1250, -1470, -1250, -1780}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{ -1250, -1250, -1470, -1250, -1780}
+    }
+   ,{{  -400,  -400,  -620,  -400,  -930}
+    ,{ -1270, -1290, -1270, -1290, -1580}
+    ,{ -1030, -1030, -1250, -1030, -1560}
+    ,{  -400,  -400,  -620,  -400,  -930}
+    ,{ -1030, -1030, -1250, -1030, -1560}
+    }
+   ,{{  -940,  -940, -1160,  -940, -1470}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{ -1560, -1560, -1780, -1560, -2090}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{ -1230, -1230, -1450, -1230, -1760}
+    }
+   }
+  ,{{{    50, -1320,  -320,    50,  -320}
+    ,{    50, -1320,  -490,    50,  -490}
+    ,{  -400, -1750,  -940,  -400,  -940}
+    ,{  -320, -1680,  -320,  -320,  -320}
+    ,{  -400, -1750,  -940,  -400,  -940}
+    }
+   ,{{    50, -1320,  -490,    50,  -490}
+    ,{    50, -1320,  -490,    50,  -490}
+    ,{  -400, -1770,  -940,  -400,  -940}
+    ,{ -1680, -2510, -1680, -2390, -1680}
+    ,{  -400, -1770,  -940,  -400,  -940}
+    }
+   ,{{  -320, -1680,  -860,  -320,  -860}
+    ,{  -320, -1680,  -860,  -320,  -860}
+    ,{  -620, -1750, -1160,  -620, -1160}
+    ,{  -320, -1680,  -860,  -320,  -860}
+    ,{  -620, -1750, -1160,  -620, -1160}
+    }
+   ,{{  -320, -1770,  -320,  -400,  -320}
+    ,{ -1210, -2030, -1210, -1920, -1210}
+    ,{  -400, -1770,  -940,  -400,  -940}
+    ,{  -320, -2390,  -320, -2280,  -320}
+    ,{  -400, -1770,  -940,  -400,  -940}
+    }
+   ,{{  -320, -1680,  -860,  -320,  -860}
+    ,{  -320, -1680,  -860,  -320,  -860}
+    ,{  -930, -2060, -1470,  -930, -1470}
+    ,{  -320, -1680,  -860,  -320,  -860}
+    ,{ -1150, -1970, -1150, -1860, -1150}
+    }
+   }
+  ,{{{  -400,  -400,  -620,  -400,  -540}
+    ,{  -540,  -580,  -800,  -580,  -540}
+    ,{ -1030, -1030, -1250, -1030, -1230}
+    ,{  -400,  -400,  -620,  -400, -1150}
+    ,{ -1030, -1030, -1250, -1030, -1230}
+    }
+   ,{{  -540,  -580,  -800,  -580,  -540}
+    ,{  -540,  -580,  -800,  -580,  -540}
+    ,{ -1030, -1030, -1250, -1030, -1230}
+    ,{ -1750, -1770, -1750, -1770, -1970}
+    ,{ -1030, -1030, -1250, -1030, -1230}
+    }
+   ,{{  -940,  -940, -1160,  -940, -1150}
+    ,{  -940,  -940, -1160,  -940, -1150}
+    ,{ -1250, -1250, -1470, -1250, -1450}
+    ,{  -940,  -940, -1160,  -940, -1150}
+    ,{ -1250, -1250, -1470, -1250, -1450}
+    }
+   ,{{  -400,  -400,  -620,  -400, -1230}
+    ,{ -1270, -1290, -1270, -1290, -1500}
+    ,{ -1030, -1030, -1250, -1030, -1230}
+    ,{  -400,  -400,  -620,  -400, -1860}
+    ,{ -1030, -1030, -1250, -1030, -1230}
+    }
+   ,{{  -940,  -940, -1160,  -940, -1150}
+    ,{  -940,  -940, -1160,  -940, -1150}
+    ,{ -1560, -1560, -1780, -1560, -1760}
+    ,{  -940,  -940, -1160,  -940, -1150}
+    ,{ -1230, -1230, -1450, -1230, -1440}
+    }
+   }
+  }
+ ,{{{{   210,   210,  -160,  -240,  -160}
+    ,{  -870,  -870, -1230,  -870, -1230}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    ,{   210,   210,  -160,  -240,  -160}
+    ,{  -800,  -800, -1410,  -870, -1410}
+    }
+   ,{{  -870, -1040, -1410,  -870, -1410}
+    ,{ -1050, -1220, -1590, -1050, -1590}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    ,{ -1060, -1060, -1420, -1510, -1420}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    }
+   ,{{  -870, -1040, -1410,  -870, -1410}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    }
+   ,{{   210,   210,  -160,  -240,  -160}
+    ,{  -870,  -870, -1230, -1320, -1230}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    ,{   210,   210,  -160,  -240,  -160}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    }
+   ,{{  -800,  -800, -1410,  -870, -1410}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    ,{  -870, -1040, -1410,  -870, -1410}
+    ,{  -800,  -800, -1410, -1490, -1410}
+    }
+   }
+  ,{{{   210,   210,  -160, -1520,  -160}
+    ,{  -870,  -870, -1230, -1580, -1230}
+    ,{ -1040, -1040, -1410, -1520, -1410}
+    ,{   210,   210,  -160, -1760,  -160}
+    ,{  -800,  -800, -1410, -1520, -1410}
+    }
+   ,{{ -1040, -1040, -1410, -1760, -1410}
+    ,{ -1220, -1220, -1590, -1940, -1590}
+    ,{ -1040, -1040, -1410, -1760, -1410}
+    ,{ -1060, -1060, -1420, -1770, -1420}
+    ,{ -1040, -1040, -1410, -1760, -1410}
+    }
+   ,{{ -1040, -1040, -1410, -1520, -1410}
+    ,{ -1040, -1040, -1410, -1760, -1410}
+    ,{ -1040, -1040, -1410, -1520, -1410}
+    ,{ -1040, -1040, -1410, -1760, -1410}
+    ,{ -1040, -1040, -1410, -1520, -1410}
+    }
+   ,{{   210,   210,  -160, -1580,  -160}
+    ,{  -870,  -870, -1230, -1580, -1230}
+    ,{ -1040, -1040, -1410, -1760, -1410}
+    ,{   210,   210,  -160, -1760,  -160}
+    ,{ -1040, -1040, -1410, -1760, -1410}
+    }
+   ,{{  -800,  -800, -1410, -1520, -1410}
+    ,{ -1040, -1040, -1410, -1760, -1410}
+    ,{ -1040, -1040, -1410, -1520, -1410}
+    ,{ -1040, -1040, -1410, -1760, -1410}
+    ,{  -800,  -800, -1410, -1760, -1410}
+    }
+   }
+  ,{{{  -240,  -240,  -460,  -240,  -770}
+    ,{ -1300, -1320, -1300, -1320, -1610}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    ,{  -240,  -240,  -460,  -240,  -770}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    }
+   ,{{ -1490, -1490, -1490, -1490, -1800}
+    ,{ -1670, -1670, -1890, -1670, -2200}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    ,{ -1490, -1510, -1490, -1510, -1800}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    }
+   ,{{ -1490, -1490, -1710, -1490, -2020}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    }
+   ,{{  -240,  -240,  -460,  -240,  -770}
+    ,{ -1300, -1320, -1300, -1320, -1610}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    ,{  -240,  -240,  -460,  -240,  -770}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    }
+   ,{{ -1490, -1490, -1710, -1490, -2020}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    ,{ -1490, -1490, -1710, -1490, -2020}
+    }
+   }
+  ,{{{  -160, -1990,  -160,  -870,  -160}
+    ,{  -870, -2060, -1230,  -870, -1230}
+    ,{  -870, -1990, -1410,  -870, -1410}
+    ,{  -160, -2230,  -160,  -870,  -160}
+    ,{  -870, -1990, -1410,  -870, -1410}
+    }
+   ,{{  -870, -2230, -1410,  -870, -1410}
+    ,{ -1050, -2410, -1590, -1050, -1590}
+    ,{  -870, -2230, -1410,  -870, -1410}
+    ,{ -1420, -2250, -1420, -2130, -1420}
+    ,{  -870, -2230, -1410,  -870, -1410}
+    }
+   ,{{  -870, -1990, -1410,  -870, -1410}
+    ,{  -870, -2230, -1410,  -870, -1410}
+    ,{  -870, -1990, -1410,  -870, -1410}
+    ,{  -870, -2230, -1410,  -870, -1410}
+    ,{  -870, -1990, -1410,  -870, -1410}
+    }
+   ,{{  -160, -2060,  -160,  -870,  -160}
+    ,{ -1230, -2060, -1230, -1940, -1230}
+    ,{  -870, -2230, -1410,  -870, -1410}
+    ,{  -160, -2230,  -160, -2120,  -160}
+    ,{  -870, -2230, -1410,  -870, -1410}
+    }
+   ,{{  -870, -1990, -1410,  -870, -1410}
+    ,{  -870, -2230, -1410,  -870, -1410}
+    ,{  -870, -1990, -1410,  -870, -1410}
+    ,{  -870, -2230, -1410,  -870, -1410}
+    ,{ -1410, -2230, -1410, -2120, -1410}
+    }
+   }
+  ,{{{  -240,  -240,  -460,  -240, -1520}
+    ,{ -1300, -1320, -1300, -1320, -1520}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    ,{  -240,  -240,  -460,  -240, -1700}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    }
+   ,{{ -1490, -1490, -1490, -1490, -1640}
+    ,{ -1640, -1670, -1890, -1670, -1640}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    ,{ -1490, -1510, -1490, -1510, -1710}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    }
+   ,{{ -1490, -1490, -1710, -1490, -1700}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    }
+   ,{{  -240,  -240,  -460,  -240, -1520}
+    ,{ -1300, -1320, -1300, -1320, -1520}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    ,{  -240,  -240,  -460,  -240, -1700}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    }
+   ,{{ -1490, -1490, -1710, -1490, -1700}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    ,{ -1490, -1490, -1710, -1490, -1700}
+    }
+   }
+  }
+ ,{{{{   760,   760,   400,   310,   400}
+    ,{   200,  -430,  -340,   200,  -340}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    ,{   760,   760,   400,   310,   400}
+    ,{  -250,  -250,  -850,  -310,  -850}
+    }
+   ,{{   200,  -430,  -340,   200,  -340}
+    ,{   200,  -430,  -340,   200,  -340}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    ,{  -830,  -830, -1190, -1280, -1190}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    }
+   ,{{  -310,  -490,  -850,  -310,  -850}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    }
+   ,{{   760,   760,   400,   310,   400}
+    ,{ -1000, -1000, -1360, -1450, -1360}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    ,{   760,   760,   400,   310,   400}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    }
+   ,{{  -250,  -250,  -850,  -310,  -850}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    ,{  -310,  -490,  -850,  -310,  -850}
+    ,{  -250,  -250,  -850,  -940,  -850}
+    }
+   }
+  ,{{{   760,   760,   400,  -690,   400}
+    ,{  -340,  -490,  -340,  -690,  -340}
+    ,{  -490,  -490,  -850,  -960,  -850}
+    ,{   760,   760,   400, -1200,   400}
+    ,{  -250,  -250,  -850,  -960,  -850}
+    }
+   ,{{  -340,  -490,  -340,  -690,  -340}
+    ,{  -340, -2040,  -340,  -690,  -340}
+    ,{  -490,  -490,  -850, -1200,  -850}
+    ,{  -830,  -830, -1190, -1540, -1190}
+    ,{  -490,  -490,  -850, -1200,  -850}
+    }
+   ,{{  -490,  -490,  -850,  -960,  -850}
+    ,{  -490,  -490,  -850, -1200,  -850}
+    ,{  -490,  -490,  -850,  -960,  -850}
+    ,{  -490,  -490,  -850, -1200,  -850}
+    ,{  -490,  -490,  -850,  -960,  -850}
+    }
+   ,{{   760,   760,   400, -1200,   400}
+    ,{ -1000, -1000, -1360, -1710, -1360}
+    ,{  -490,  -490,  -850, -1200,  -850}
+    ,{   760,   760,   400, -1200,   400}
+    ,{  -490,  -490,  -850, -1200,  -850}
+    }
+   ,{{  -250,  -250,  -850,  -960,  -850}
+    ,{  -490,  -490,  -850, -1200,  -850}
+    ,{  -490,  -490,  -850,  -960,  -850}
+    ,{  -490,  -490,  -850, -1200,  -850}
+    ,{  -250,  -250,  -850, -1200,  -850}
+    }
+   }
+  ,{{{   310,   310,    90,   310,  -220}
+    ,{  -430,  -430,  -650,  -430,  -960}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{   310,   310,    90,   310,  -220}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    }
+   ,{{  -430,  -430,  -650,  -430,  -960}
+    ,{  -430,  -430,  -650,  -430,  -960}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{ -1260, -1280, -1260, -1280, -1570}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    }
+   ,{{  -940,  -940, -1160,  -940, -1470}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    }
+   ,{{   310,   310,    90,   310,  -220}
+    ,{ -1430, -1450, -1430, -1450, -1740}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{   310,   310,    90,   310,  -220}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    }
+   ,{{  -940,  -940, -1160,  -940, -1470}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    ,{  -940,  -940, -1160,  -940, -1470}
+    }
+   }
+  ,{{{   400, -1170,   400,   200,   400}
+    ,{   200, -1170,  -340,   200,  -340}
+    ,{  -310, -1440,  -850,  -310,  -850}
+    ,{   400, -1680,   400,  -310,   400}
+    ,{  -310, -1440,  -850,  -310,  -850}
+    }
+   ,{{   200, -1170,  -340,   200,  -340}
+    ,{   200, -1170,  -340,   200,  -340}
+    ,{  -310, -1680,  -850,  -310,  -850}
+    ,{ -1190, -2020, -1190, -1900, -1190}
+    ,{  -310, -1680,  -850,  -310,  -850}
+    }
+   ,{{  -310, -1440,  -850,  -310,  -850}
+    ,{  -310, -1680,  -850,  -310,  -850}
+    ,{  -310, -1440,  -850,  -310,  -850}
+    ,{  -310, -1680,  -850,  -310,  -850}
+    ,{  -310, -1440,  -850,  -310,  -850}
+    }
+   ,{{   400, -1680,   400,  -310,   400}
+    ,{ -1360, -2190, -1360, -2070, -1360}
+    ,{  -310, -1680,  -850,  -310,  -850}
+    ,{   400, -1680,   400, -1560,   400}
+    ,{  -310, -1680,  -850,  -310,  -850}
+    }
+   ,{{  -310, -1440,  -850,  -310,  -850}
+    ,{  -310, -1680,  -850,  -310,  -850}
+    ,{  -310, -1440,  -850,  -310,  -850}
+    ,{  -310, -1680,  -850,  -310,  -850}
+    ,{  -850, -1680,  -850, -1560,  -850}
+    }
+   }
+  ,{{{   310,   310,    90,   310,  -390}
+    ,{  -390,  -430,  -650,  -430,  -390}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    ,{   310,   310,    90,   310, -1140}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    }
+   ,{{  -390,  -430,  -650,  -430,  -390}
+    ,{  -390,  -430,  -650,  -430,  -390}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    ,{ -1260, -1280, -1260, -1280, -1480}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    }
+   ,{{  -940,  -940, -1160,  -940, -1140}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    }
+   ,{{   310,   310,    90,   310, -1140}
+    ,{ -1430, -1450, -1430, -1450, -1650}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    ,{   310,   310,    90,   310, -1140}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    }
+   ,{{  -940,  -940, -1160,  -940, -1140}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    ,{  -940,  -940, -1160,  -940, -1140}
+    }
+   }
+  }
+ ,{{{{  1140,  1140,   770,   780,   770}
+    ,{   780,   600,   240,   780,   240}
+    ,{   480,   300,   -60,   480,   -60}
+    ,{  1140,  1140,   770,   690,   770}
+    ,{   480,   300,   -60,   480,   -60}
+    }
+   ,{{   780,   600,   240,   780,   240}
+    ,{   780,   600,   240,   780,   240}
+    ,{   470,   290,   -70,   470,   -70}
+    ,{  -780,  -780, -1150, -1230, -1150}
+    ,{   470,   290,   -70,   470,   -70}
+    }
+   ,{{   490,   310,   -50,   490,   -50}
+    ,{   490,   310,   -50,   490,   -50}
+    ,{   480,   300,   -60,   480,   -60}
+    ,{   490,   310,   -50,   490,   -50}
+    ,{   480,   300,   -60,   480,   -60}
+    }
+   ,{{  1140,  1140,   770,   690,   770}
+    ,{  -600,  -600,  -970, -1050,  -970}
+    ,{   470,   290,   -70,   470,   -70}
+    ,{  1140,  1140,   770,   690,   770}
+    ,{   470,   290,   -70,   470,   -70}
+    }
+   ,{{   490,   310,   -50,   490,   -50}
+    ,{   490,   310,   -50,   490,   -50}
+    ,{   480,   300,   -60,   480,   -60}
+    ,{   490,   310,   -50,   490,   -50}
+    ,{  -430,  -430, -1040, -1120, -1040}
+    }
+   }
+  ,{{{  1140,  1140,   770,  -110,   770}
+    ,{   600,   600,   240,  -110,   240}
+    ,{   300,   300,   -60,  -170,   -60}
+    ,{  1140,  1140,   770,  -400,   770}
+    ,{   300,   300,   -60,  -170,   -60}
+    }
+   ,{{   600,   600,   240,  -110,   240}
+    ,{   600,   600,   240,  -110,   240}
+    ,{   290,   290,   -70,  -420,   -70}
+    ,{  -780,  -780, -1150, -1500, -1150}
+    ,{   290,   290,   -70,  -420,   -70}
+    }
+   ,{{   310,   310,   -50,  -170,   -50}
+    ,{   310,   310,   -50,  -400,   -50}
+    ,{   300,   300,   -60,  -170,   -60}
+    ,{   310,   310,   -50,  -400,   -50}
+    ,{   300,   300,   -60,  -170,   -60}
+    }
+   ,{{  1140,  1140,   770,  -420,   770}
+    ,{  -600,  -600,  -970, -1320,  -970}
+    ,{   290,   290,   -70,  -420,   -70}
+    ,{  1140,  1140,   770,  -830,   770}
+    ,{   290,   290,   -70,  -420,   -70}
+    }
+   ,{{   310,   310,   -50,  -170,   -50}
+    ,{   310,   310,   -50,  -400,   -50}
+    ,{   300,   300,   -60,  -170,   -60}
+    ,{   310,   310,   -50,  -400,   -50}
+    ,{  -430,  -430, -1040, -1390, -1040}
+    }
+   }
+  ,{{{   690,   690,   470,   690,   160}
+    ,{   150,   150,   -60,   150,  -370}
+    ,{  -140,  -140,  -360,  -140,  -670}
+    ,{   690,   690,   470,   690,   160}
+    ,{  -140,  -140,  -360,  -140,  -670}
+    }
+   ,{{   150,   150,   -60,   150,  -370}
+    ,{   150,   150,   -60,   150,  -370}
+    ,{  -150,  -150,  -370,  -150,  -680}
+    ,{ -1210, -1230, -1210, -1230, -1520}
+    ,{  -150,  -150,  -370,  -150,  -680}
+    }
+   ,{{  -140,  -140,  -360,  -140,  -670}
+    ,{  -140,  -140,  -360,  -140,  -670}
+    ,{  -140,  -140,  -360,  -140,  -670}
+    ,{  -140,  -140,  -360,  -140,  -670}
+    ,{  -140,  -140,  -360,  -140,  -670}
+    }
+   ,{{   690,   690,   470,   690,   160}
+    ,{ -1030, -1050, -1030, -1050, -1340}
+    ,{  -150,  -150,  -370,  -150,  -680}
+    ,{   690,   690,   470,   690,   160}
+    ,{  -150,  -150,  -370,  -150,  -680}
+    }
+   ,{{  -140,  -140,  -360,  -140,  -670}
+    ,{  -140,  -140,  -360,  -140,  -670}
+    ,{  -140,  -140,  -360,  -140,  -670}
+    ,{  -140,  -140,  -360,  -140,  -670}
+    ,{ -1120, -1120, -1340, -1120, -1650}
+    }
+   }
+  ,{{{   780,  -580,   770,   780,   770}
+    ,{   780,  -580,   240,   780,   240}
+    ,{   480,  -640,   -60,   480,   -60}
+    ,{   770,  -880,   770,   490,   770}
+    ,{   480,  -640,   -60,   480,   -60}
+    }
+   ,{{   780,  -580,   240,   780,   240}
+    ,{   780,  -580,   240,   780,   240}
+    ,{   470,  -890,   -70,   470,   -70}
+    ,{ -1150, -1970, -1150, -1860, -1150}
+    ,{   470,  -890,   -70,   470,   -70}
+    }
+   ,{{   490,  -640,   -50,   490,   -50}
+    ,{   490,  -880,   -50,   490,   -50}
+    ,{   480,  -640,   -60,   480,   -60}
+    ,{   490,  -880,   -50,   490,   -50}
+    ,{   480,  -640,   -60,   480,   -60}
+    }
+   ,{{   770,  -890,   770,   470,   770}
+    ,{  -970, -1790,  -970, -1680,  -970}
+    ,{   470,  -890,   -70,   470,   -70}
+    ,{   770, -1300,   770, -1190,   770}
+    ,{   470,  -890,   -70,   470,   -70}
+    }
+   ,{{   490,  -640,   -50,   490,   -50}
+    ,{   490,  -880,   -50,   490,   -50}
+    ,{   480,  -640,   -60,   480,   -60}
+    ,{   490,  -880,   -50,   490,   -50}
+    ,{ -1040, -1860, -1040, -1750, -1040}
+    }
+   }
+  ,{{{   690,   690,   470,   690,   190}
+    ,{   190,   150,   -60,   150,   190}
+    ,{  -140,  -140,  -360,  -140,  -350}
+    ,{   690,   690,   470,   690,  -340}
+    ,{  -140,  -140,  -360,  -140,  -350}
+    }
+   ,{{   190,   150,   -60,   150,   190}
+    ,{   190,   150,   -60,   150,   190}
+    ,{  -150,  -150,  -370,  -150,  -360}
+    ,{ -1210, -1230, -1210, -1230, -1440}
+    ,{  -150,  -150,  -370,  -150,  -360}
+    }
+   ,{{  -140,  -140,  -360,  -140,  -340}
+    ,{  -140,  -140,  -360,  -140,  -340}
+    ,{  -140,  -140,  -360,  -140,  -350}
+    ,{  -140,  -140,  -360,  -140,  -340}
+    ,{  -140,  -140,  -360,  -140,  -350}
+    }
+   ,{{   690,   690,   470,   690,  -360}
+    ,{ -1030, -1050, -1030, -1050, -1260}
+    ,{  -150,  -150,  -370,  -150,  -360}
+    ,{   690,   690,   470,   690,  -770}
+    ,{  -150,  -150,  -370,  -150,  -360}
+    }
+   ,{{  -140,  -140,  -360,  -140,  -340}
+    ,{  -140,  -140,  -360,  -140,  -340}
+    ,{  -140,  -140,  -360,  -140,  -350}
+    ,{  -140,  -140,  -360,  -140,  -340}
+    ,{ -1120, -1120, -1340, -1120, -1330}
+    }
+   }
+  }
+ ,{{{{  1320,  1320,   960,   870,   960}
+    ,{   850,   670,   300,   850,   300}
+    ,{   720,   540,   170,   720,   170}
+    ,{  1320,  1320,   960,   870,   960}
+    ,{   590,   410,    40,   590,    40}
+    }
+   ,{{   850,   670,   300,   850,   300}
+    ,{   850,   670,   300,   850,   300}
+    ,{   570,   390,    20,   570,    20}
+    ,{  -730,  -730, -1100, -1180, -1100}
+    ,{   570,   390,    20,   570,    20}
+    }
+   ,{{   720,   540,   170,   720,   170}
+    ,{   720,   540,   170,   720,   170}
+    ,{   720,   540,   170,   720,   170}
+    ,{   720,   540,   170,   720,   170}
+    ,{   590,   410,    40,   590,    40}
+    }
+   ,{{  1320,  1320,   960,   870,   960}
+    ,{ -1030, -1030, -1400, -1480, -1400}
+    ,{   570,   390,    20,   570,    20}
+    ,{  1320,  1320,   960,   870,   960}
+    ,{   570,   390,    20,   570,    20}
+    }
+   ,{{   720,   540,   170,   720,   170}
+    ,{   720,   540,   170,   720,   170}
+    ,{   280,   100,  -260,   280,  -260}
+    ,{   720,   540,   170,   720,   170}
+    ,{  -160,  -160,  -760,  -850,  -760}
+    }
+   }
+  ,{{{  1320,  1320,   960,    70,   960}
+    ,{   670,   670,   300,   -40,   300}
+    ,{   540,   540,   170,    70,   170}
+    ,{  1320,  1320,   960,  -170,   960}
+    ,{   410,   410,    40,   -60,    40}
+    }
+   ,{{   670,   670,   300,   -40,   300}
+    ,{   670,   670,   300,   -40,   300}
+    ,{   390,   390,    20,  -320,    20}
+    ,{  -730,  -730, -1100, -1450, -1100}
+    ,{   390,   390,    20,  -320,    20}
+    }
+   ,{{   540,   540,   170,    70,   170}
+    ,{   540,   540,   170,  -170,   170}
+    ,{   540,   540,   170,    70,   170}
+    ,{   540,   540,   170,  -170,   170}
+    ,{   410,   410,    40,   -60,    40}
+    }
+   ,{{  1320,  1320,   960,  -320,   960}
+    ,{ -1030, -1030, -1400, -1750, -1400}
+    ,{   390,   390,    20,  -320,    20}
+    ,{  1320,  1320,   960,  -640,   960}
+    ,{   390,   390,    20,  -320,    20}
+    }
+   ,{{   540,   540,   170,  -170,   170}
+    ,{   540,   540,   170,  -170,   170}
+    ,{   100,   100,  -260,  -370,  -260}
+    ,{   540,   540,   170,  -170,   170}
+    ,{  -160,  -160,  -760, -1110,  -760}
+    }
+   }
+  ,{{{   870,   870,   650,   870,   340}
+    ,{   220,   220,     0,   220,  -310}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{   870,   870,   650,   870,   340}
+    ,{   -40,   -40,  -260,   -40,  -570}
+    }
+   ,{{   220,   220,     0,   220,  -310}
+    ,{   220,   220,     0,   220,  -310}
+    ,{   -60,   -60,  -280,   -60,  -590}
+    ,{ -1160, -1180, -1160, -1180, -1470}
+    ,{   -60,   -60,  -280,   -60,  -590}
+    }
+   ,{{    90,    90,  -130,    90,  -440}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{   -40,   -40,  -260,   -40,  -570}
+    }
+   ,{{   870,   870,   650,   870,   340}
+    ,{ -1460, -1480, -1460, -1480, -1770}
+    ,{   -60,   -60,  -280,   -60,  -590}
+    ,{   870,   870,   650,   870,   340}
+    ,{   -60,   -60,  -280,   -60,  -590}
+    }
+   ,{{    90,    90,  -130,    90,  -440}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{  -350,  -350,  -570,  -350,  -880}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{  -850,  -850, -1070,  -850, -1380}
+    }
+   }
+  ,{{{   960,  -410,   960,   850,   960}
+    ,{   850,  -520,   300,   850,   300}
+    ,{   720,  -410,   170,   720,   170}
+    ,{   960,  -650,   960,   720,   960}
+    ,{   590,  -540,    40,   590,    40}
+    }
+   ,{{   850,  -520,   300,   850,   300}
+    ,{   850,  -520,   300,   850,   300}
+    ,{   570,  -800,    20,   570,    20}
+    ,{ -1100, -1920, -1100, -1810, -1100}
+    ,{   570,  -800,    20,   570,    20}
+    }
+   ,{{   720,  -410,   170,   720,   170}
+    ,{   720,  -650,   170,   720,   170}
+    ,{   720,  -410,   170,   720,   170}
+    ,{   720,  -650,   170,   720,   170}
+    ,{   590,  -540,    40,   590,    40}
+    }
+   ,{{   960,  -800,   960,   570,   960}
+    ,{ -1400, -2220, -1400, -2110, -1400}
+    ,{   570,  -800,    20,   570,    20}
+    ,{   960, -1120,   960, -1000,   960}
+    ,{   570,  -800,    20,   570,    20}
+    }
+   ,{{   720,  -650,   170,   720,   170}
+    ,{   720,  -650,   170,   720,   170}
+    ,{   280,  -850,  -260,   280,  -260}
+    ,{   720,  -650,   170,   720,   170}
+    ,{  -760, -1590,  -760, -1470,  -760}
+    }
+   }
+  ,{{{   870,   870,   650,   870,   250}
+    ,{   250,   220,     0,   220,   250}
+    ,{    90,    90,  -130,    90,  -110}
+    ,{   870,   870,   650,   870,  -110}
+    ,{   -40,   -40,  -260,   -40,  -240}
+    }
+   ,{{   250,   220,     0,   220,   250}
+    ,{   250,   220,     0,   220,   250}
+    ,{   -60,   -60,  -280,   -60,  -260}
+    ,{ -1160, -1180, -1160, -1180, -1390}
+    ,{   -60,   -60,  -280,   -60,  -260}
+    }
+   ,{{    90,    90,  -130,    90,  -110}
+    ,{    90,    90,  -130,    90,  -110}
+    ,{    90,    90,  -130,    90,  -110}
+    ,{    90,    90,  -130,    90,  -110}
+    ,{   -40,   -40,  -260,   -40,  -240}
+    }
+   ,{{   870,   870,   650,   870,  -260}
+    ,{ -1460, -1480, -1460, -1480, -1690}
+    ,{   -60,   -60,  -280,   -60,  -260}
+    ,{   870,   870,   650,   870,  -580}
+    ,{   -60,   -60,  -280,   -60,  -260}
+    }
+   ,{{    90,    90,  -130,    90,  -110}
+    ,{    90,    90,  -130,    90,  -110}
+    ,{  -350,  -350,  -570,  -350,  -550}
+    ,{    90,    90,  -130,    90,  -110}
+    ,{  -850,  -850, -1070,  -850, -1050}
+    }
+   }
+  }
+ ,{{{{  1320,  1320,   960,   870,   960}
+    ,{   850,   670,   540,   850,   300}
+    ,{   720,   540,   170,   720,   170}
+    ,{  1320,  1320,   960,   870,   960}
+    ,{   590,   410,    40,   590,    40}
+    }
+   ,{{   850,   670,   300,   850,   300}
+    ,{   850,   670,   300,   850,   300}
+    ,{   570,   390,    20,   570,    20}
+    ,{  -350,  -350,  -870,  -960,  -870}
+    ,{   570,   390,    20,   570,    20}
+    }
+   ,{{   720,   540,   170,   720,   170}
+    ,{   720,   540,   170,   720,   170}
+    ,{   720,   540,   170,   720,   170}
+    ,{   720,   540,   170,   720,   170}
+    ,{   590,   410,    40,   590,    40}
+    }
+   ,{{  1320,  1320,   960,   870,   960}
+    ,{   540,  -100,   540, -1050,  -810}
+    ,{   570,   390,    20,   570,    20}
+    ,{  1320,  1320,   960,   870,   960}
+    ,{   570,   390,    20,   570,    20}
+    }
+   ,{{   720,   540,   170,   720,   170}
+    ,{   720,   540,   170,   720,   170}
+    ,{   480,   300,   -60,   480,   -60}
+    ,{   720,   540,   170,   720,   170}
+    ,{  -160,  -160,  -400,  -230,  -760}
+    }
+   }
+  ,{{{  1320,  1320,   960,    70,   960}
+    ,{   670,   670,   300,   -40,   300}
+    ,{   540,   540,   170,    70,   170}
+    ,{  1320,  1320,   960,  -170,   960}
+    ,{   410,   410,    40,   -60,    40}
+    }
+   ,{{   670,   670,   300,   -40,   300}
+    ,{   670,   670,   300,   -40,   300}
+    ,{   390,   390,    20,  -320,    20}
+    ,{  -730,  -730, -1100, -1450,  -870}
+    ,{   390,   390,    20,  -320,    20}
+    }
+   ,{{   540,   540,   170,    70,   170}
+    ,{   540,   540,   170,  -170,   170}
+    ,{   540,   540,   170,    70,   170}
+    ,{   540,   540,   170,  -170,   170}
+    ,{   410,   410,    40,   -60,    40}
+    }
+   ,{{  1320,  1320,   960,  -320,   960}
+    ,{    10,  -600,    10, -1320,  -970}
+    ,{   390,   390,    20,  -320,    20}
+    ,{  1320,  1320,   960,  -640,   960}
+    ,{   390,   390,    20,  -320,    20}
+    }
+   ,{{   540,   540,   170,  -170,   170}
+    ,{   540,   540,   170,  -170,   170}
+    ,{   300,   300,   -60,  -170,   -60}
+    ,{   540,   540,   170,  -170,   170}
+    ,{  -160,  -160,  -400, -1110,  -760}
+    }
+   }
+  ,{{{   870,   870,   650,   870,   340}
+    ,{   540,   220,   540,   220,  -310}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{   870,   870,   650,   870,   340}
+    ,{   -40,   -40,  -260,   -40,  -570}
+    }
+   ,{{   220,   220,     0,   220,  -310}
+    ,{   220,   220,     0,   220,  -310}
+    ,{   -60,   -60,  -280,   -60,  -590}
+    ,{  -350,  -350,  -940,  -960, -1250}
+    ,{   -60,   -60,  -280,   -60,  -590}
+    }
+   ,{{    90,    90,  -130,    90,  -440}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{   -40,   -40,  -260,   -40,  -570}
+    }
+   ,{{   870,   870,   650,   870,   340}
+    ,{   540,  -100,   540, -1050, -1340}
+    ,{   -60,   -60,  -280,   -60,  -590}
+    ,{   870,   870,   650,   870,   340}
+    ,{   -60,   -60,  -280,   -60,  -590}
+    }
+   ,{{    90,    90,  -130,    90,  -440}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{  -140,  -140,  -360,  -140,  -670}
+    ,{    90,    90,  -130,    90,  -440}
+    ,{  -850,  -850, -1070,  -850, -1380}
+    }
+   }
+  ,{{{   960,  -410,   960,   850,   960}
+    ,{   850,  -520,   300,   850,   300}
+    ,{   720,  -410,   170,   720,   170}
+    ,{   960,  -650,   960,   720,   960}
+    ,{   590,  -540,    40,   590,    40}
+    }
+   ,{{   850,  -520,   300,   850,   300}
+    ,{   850,  -520,   300,   850,   300}
+    ,{   570,  -800,    20,   570,    20}
+    ,{  -870, -1920,  -870, -1370,  -870}
+    ,{   570,  -800,    20,   570,    20}
+    }
+   ,{{   720,  -410,   170,   720,   170}
+    ,{   720,  -650,   170,   720,   170}
+    ,{   720,  -410,   170,   720,   170}
+    ,{   720,  -650,   170,   720,   170}
+    ,{   590,  -540,    40,   590,    40}
+    }
+   ,{{   960,  -800,   960,   570,   960}
+    ,{  -970, -1790,  -970, -1680,  -970}
+    ,{   570,  -800,    20,   570,    20}
+    ,{   960, -1120,   960, -1000,   960}
+    ,{   570,  -800,    20,   570,    20}
+    }
+   ,{{   720,  -640,   170,   720,   170}
+    ,{   720,  -650,   170,   720,   170}
+    ,{   480,  -640,   -60,   480,   -60}
+    ,{   720,  -650,   170,   720,   170}
+    ,{  -230, -1520,  -760,  -230,  -760}
+    }
+   }
+  ,{{{   870,   870,   650,   870,   250}
+    ,{   250,   220,     0,   220,   250}
+    ,{    90,    90,  -130,    90,  -110}
+    ,{   870,   870,   650,   870,  -110}
+    ,{   -40,   -40,  -260,   -40,  -240}
+    }
+   ,{{   250,   220,     0,   220,   250}
+    ,{   250,   220,     0,   220,   250}
+    ,{   -60,   -60,  -280,   -60,  -260}
+    ,{  -940,  -960,  -940,  -960, -1360}
+    ,{   -60,   -60,  -280,   -60,  -260}
+    }
+   ,{{    90,    90,  -130,    90,   -90}
+    ,{    90,    90,  -130,    90,   -90}
+    ,{    90,    90,  -130,    90,  -110}
+    ,{    90,    90,  -130,    90,  -110}
+    ,{   -40,   -40,  -260,   -40,  -240}
+    }
+   ,{{   870,   870,   650,   870,  -260}
+    ,{  -810, -1050, -1030, -1050,  -810}
+    ,{   -60,   -60,  -280,   -60,  -260}
+    ,{   870,   870,   650,   870,  -580}
+    ,{   -60,   -60,  -280,   -60,  -260}
+    }
+   ,{{    90,    90,  -130,    90,  -110}
+    ,{    90,    90,  -130,    90,  -110}
+    ,{  -140,  -140,  -360,  -140,  -350}
+    ,{    90,    90,  -130,    90,  -110}
+    ,{  -850,  -850, -1070,  -850, -1050}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   240,  -780,  -870,   240,  -870}
+    ,{   190, -1060, -1060,   190,  -970}
+    ,{   240,  -780, -1010,   240, -1010}
+    ,{   190,  -870,  -870,   190,  -870}
+    ,{   130,  -890, -1120,   130, -1120}
+    }
+   ,{{    40, -1210, -1180,    40,  -970}
+    ,{    40, -1210, -1210,    40,  -970}
+    ,{  -270, -1520, -1520,  -270, -1520}
+    ,{ -1180, -1420, -1180, -1250, -1180}
+    ,{  -270, -1520, -1520,  -270, -1520}
+    }
+   ,{{   190,  -840, -1060,   190, -1060}
+    ,{   190, -1060, -1060,   190, -1060}
+    ,{   180,  -840, -1070,   180, -1070}
+    ,{   190, -1060, -1060,   190, -1060}
+    ,{   130,  -890, -1120,   130, -1120}
+    }
+   ,{{  -270,  -870,  -870,  -270,  -870}
+    ,{ -1470, -1710, -1470, -1530, -1470}
+    ,{  -270, -1520, -1520,  -270, -1520}
+    ,{  -870,  -870,  -870,  -870,  -870}
+    ,{  -270, -1520, -1520,  -270, -1520}
+    }
+   ,{{   240,  -780, -1010,   240, -1010}
+    ,{   190, -1060, -1060,   190, -1060}
+    ,{   240,  -780, -1010,   240, -1010}
+    ,{   190, -1060, -1060,   190, -1060}
+    ,{ -1680, -1790, -1850, -1680, -1850}
+    }
+   }
+  ,{{{  -590, -1050,  -870,  -590,  -870}
+    ,{  -890, -1240, -1060,  -890, -1060}
+    ,{  -590, -1190, -1010,  -590, -1010}
+    ,{  -870, -1050,  -870,  -890,  -870}
+    ,{  -700, -1300, -1120,  -700, -1120}
+    }
+   ,{{ -1030, -1370, -1210, -1030, -1210}
+    ,{ -1030, -1370, -1210, -1030, -1210}
+    ,{ -1340, -1700, -1520, -1340, -1520}
+    ,{ -1250, -1600, -1420, -1250, -1420}
+    ,{ -1340, -1700, -1520, -1340, -1520}
+    }
+   ,{{  -650, -1240, -1060,  -650, -1060}
+    ,{  -890, -1240, -1060,  -890, -1060}
+    ,{  -650, -1250, -1070,  -650, -1070}
+    ,{  -890, -1240, -1060,  -890, -1060}
+    ,{  -700, -1300, -1120,  -700, -1120}
+    }
+   ,{{  -870, -1050,  -870, -1340,  -870}
+    ,{ -1530, -1890, -1710, -1530, -1710}
+    ,{ -1340, -1700, -1520, -1340, -1520}
+    ,{  -870, -1050,  -870, -1940,  -870}
+    ,{ -1340, -1700, -1520, -1340, -1520}
+    }
+   ,{{  -590, -1190, -1010,  -590, -1010}
+    ,{  -890, -1240, -1060,  -890, -1060}
+    ,{  -590, -1190, -1010,  -590, -1010}
+    ,{  -890, -1240, -1060,  -890, -1060}
+    ,{ -1680, -1790, -1850, -1680, -1850}
+    }
+   }
+  ,{{{  -870,  -870,  -870,  -870,  -870}
+    ,{ -1060, -1060, -1060, -1060, -1060}
+    ,{ -1010, -1010, -1010, -1010, -1010}
+    ,{  -870,  -870,  -870,  -870,  -870}
+    ,{ -1120, -1120, -1120, -1120, -1120}
+    }
+   ,{{ -1180, -1210, -1180, -1210, -1180}
+    ,{ -1210, -1210, -1210, -1210, -1210}
+    ,{ -1520, -1520, -1520, -1520, -1520}
+    ,{ -1180, -1420, -1180, -1420, -1180}
+    ,{ -1520, -1520, -1520, -1520, -1520}
+    }
+   ,{{ -1060, -1060, -1060, -1060, -1060}
+    ,{ -1060, -1060, -1060, -1060, -1060}
+    ,{ -1070, -1070, -1070, -1070, -1070}
+    ,{ -1060, -1060, -1060, -1060, -1060}
+    ,{ -1120, -1120, -1120, -1120, -1120}
+    }
+   ,{{  -870,  -870,  -870,  -870,  -870}
+    ,{ -1470, -1710, -1470, -1710, -1470}
+    ,{ -1520, -1520, -1520, -1520, -1520}
+    ,{  -870,  -870,  -870,  -870,  -870}
+    ,{ -1520, -1520, -1520, -1520, -1520}
+    }
+   ,{{ -1010, -1010, -1010, -1010, -1010}
+    ,{ -1060, -1060, -1060, -1060, -1060}
+    ,{ -1010, -1010, -1010, -1010, -1010}
+    ,{ -1060, -1060, -1060, -1060, -1060}
+    ,{ -1850, -1850, -1850, -1850, -1850}
+    }
+   }
+  ,{{{   240,  -780,  -870,   240,  -870}
+    ,{   190, -1080, -1060,   190, -1060}
+    ,{   240,  -780, -1010,   240, -1010}
+    ,{   190, -1080,  -870,   190,  -870}
+    ,{   130,  -890, -1120,   130, -1120}
+    }
+   ,{{    40, -1220, -1210,    40, -1210}
+    ,{    40, -1220, -1210,    40, -1210}
+    ,{  -270, -1530, -1520,  -270, -1520}
+    ,{ -1420, -1440, -1420, -1420, -1420}
+    ,{  -270, -1530, -1520,  -270, -1520}
+    }
+   ,{{   190,  -840, -1060,   190, -1060}
+    ,{   190, -1080, -1060,   190, -1060}
+    ,{   180,  -840, -1070,   180, -1070}
+    ,{   190, -1080, -1060,   190, -1060}
+    ,{   130,  -890, -1120,   130, -1120}
+    }
+   ,{{  -270, -1530,  -870,  -270,  -870}
+    ,{ -1710, -1720, -1710, -1710, -1710}
+    ,{  -270, -1530, -1520,  -270, -1520}
+    ,{  -870, -2130,  -870, -2120,  -870}
+    ,{  -270, -1530, -1520,  -270, -1520}
+    }
+   ,{{   240,  -780, -1010,   240, -1010}
+    ,{   190, -1080, -1060,   190, -1060}
+    ,{   240,  -780, -1010,   240, -1010}
+    ,{   190, -1080, -1060,   190, -1060}
+    ,{ -1850, -1870, -1850, -1850, -1850}
+    }
+   }
+  ,{{{  -870,  -870,  -870,  -870,  -970}
+    ,{  -970, -1060, -1060, -1060,  -970}
+    ,{ -1010, -1010, -1010, -1010, -1010}
+    ,{  -870,  -870,  -870,  -870, -1060}
+    ,{ -1120, -1120, -1120, -1120, -1120}
+    }
+   ,{{  -970, -1210, -1180, -1210,  -970}
+    ,{  -970, -1210, -1210, -1210,  -970}
+    ,{ -1520, -1520, -1520, -1520, -1520}
+    ,{ -1180, -1420, -1180, -1420, -1420}
+    ,{ -1520, -1520, -1520, -1520, -1520}
+    }
+   ,{{ -1060, -1060, -1060, -1060, -1060}
+    ,{ -1060, -1060, -1060, -1060, -1060}
+    ,{ -1070, -1070, -1070, -1070, -1070}
+    ,{ -1060, -1060, -1060, -1060, -1060}
+    ,{ -1120, -1120, -1120, -1120, -1120}
+    }
+   ,{{  -870,  -870,  -870,  -870, -1520}
+    ,{ -1470, -1710, -1470, -1710, -1710}
+    ,{ -1520, -1520, -1520, -1520, -1520}
+    ,{  -870,  -870,  -870,  -870, -2120}
+    ,{ -1520, -1520, -1520, -1520, -1520}
+    }
+   ,{{ -1010, -1010, -1010, -1010, -1010}
+    ,{ -1060, -1060, -1060, -1060, -1060}
+    ,{ -1010, -1010, -1010, -1010, -1010}
+    ,{ -1060, -1060, -1060, -1060, -1060}
+    ,{ -1850, -1850, -1850, -1850, -1850}
+    }
+   }
+  }
+ ,{{{{   210,  -870,  -870,   210,  -800}
+    ,{   210, -1040, -1040,   210,  -800}
+    ,{  -240, -1490, -1490,  -240, -1490}
+    ,{  -160,  -870,  -870,  -160,  -870}
+    ,{  -240, -1490, -1490,  -240, -1490}
+    }
+   ,{{   210, -1040, -1040,   210,  -800}
+    ,{   210, -1040, -1040,   210,  -800}
+    ,{  -240, -1490, -1490,  -240, -1490}
+    ,{ -1990, -2230, -1990, -2060, -1990}
+    ,{  -240, -1490, -1490,  -240, -1490}
+    }
+   ,{{  -160, -1410, -1410,  -160, -1410}
+    ,{  -160, -1410, -1410,  -160, -1410}
+    ,{  -460, -1490, -1710,  -460, -1710}
+    ,{  -160, -1410, -1410,  -160, -1410}
+    ,{  -460, -1490, -1710,  -460, -1710}
+    }
+   ,{{  -240,  -870,  -870,  -240,  -870}
+    ,{ -1520, -1760, -1520, -1580, -1520}
+    ,{  -240, -1490, -1490,  -240, -1490}
+    ,{  -870,  -870,  -870,  -870,  -870}
+    ,{  -240, -1490, -1490,  -240, -1490}
+    }
+   ,{{  -160, -1410, -1410,  -160, -1410}
+    ,{  -160, -1410, -1410,  -160, -1410}
+    ,{  -770, -1800, -2020,  -770, -2020}
+    ,{  -160, -1410, -1410,  -160, -1410}
+    ,{ -1520, -1640, -1700, -1520, -1700}
+    }
+   }
+  ,{{{  -870, -1050,  -870,  -870,  -870}
+    ,{  -870, -1220, -1040,  -870, -1040}
+    ,{ -1300, -1670, -1490, -1300, -1490}
+    ,{  -870, -1050,  -870, -1230,  -870}
+    ,{ -1300, -1640, -1490, -1300, -1490}
+    }
+   ,{{  -870, -1220, -1040,  -870, -1040}
+    ,{  -870, -1220, -1040,  -870, -1040}
+    ,{ -1320, -1670, -1490, -1320, -1490}
+    ,{ -2060, -2410, -2230, -2060, -2230}
+    ,{ -1320, -1670, -1490, -1320, -1490}
+    }
+   ,{{ -1230, -1590, -1410, -1230, -1410}
+    ,{ -1230, -1590, -1410, -1230, -1410}
+    ,{ -1300, -1890, -1710, -1300, -1710}
+    ,{ -1230, -1590, -1410, -1230, -1410}
+    ,{ -1300, -1890, -1710, -1300, -1710}
+    }
+   ,{{  -870, -1050,  -870, -1320,  -870}
+    ,{ -1580, -1940, -1760, -1580, -1760}
+    ,{ -1320, -1670, -1490, -1320, -1490}
+    ,{  -870, -1050,  -870, -1940,  -870}
+    ,{ -1320, -1670, -1490, -1320, -1490}
+    }
+   ,{{ -1230, -1590, -1410, -1230, -1410}
+    ,{ -1230, -1590, -1410, -1230, -1410}
+    ,{ -1610, -2200, -2020, -1610, -2020}
+    ,{ -1230, -1590, -1410, -1230, -1410}
+    ,{ -1520, -1640, -1700, -1520, -1700}
+    }
+   }
+  ,{{{  -870,  -870,  -870,  -870,  -870}
+    ,{ -1040, -1040, -1040, -1040, -1040}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    ,{  -870,  -870,  -870,  -870,  -870}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    }
+   ,{{ -1040, -1040, -1040, -1040, -1040}
+    ,{ -1040, -1040, -1040, -1040, -1040}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    ,{ -1990, -2230, -1990, -2230, -1990}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    }
+   ,{{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -1710, -1710, -1710, -1710, -1710}
+    ,{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -1710, -1710, -1710, -1710, -1710}
+    }
+   ,{{  -870,  -870,  -870,  -870,  -870}
+    ,{ -1520, -1760, -1520, -1760, -1520}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    ,{  -870,  -870,  -870,  -870,  -870}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    }
+   ,{{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -2020, -2020, -2020, -2020, -2020}
+    ,{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -1700, -1700, -1700, -1700, -1700}
+    }
+   }
+  ,{{{   210, -1060,  -870,   210,  -870}
+    ,{   210, -1060, -1040,   210, -1040}
+    ,{  -240, -1490, -1490,  -240, -1490}
+    ,{  -160, -1420,  -870,  -160,  -870}
+    ,{  -240, -1490, -1490,  -240, -1490}
+    }
+   ,{{   210, -1060, -1040,   210, -1040}
+    ,{   210, -1060, -1040,   210, -1040}
+    ,{  -240, -1510, -1490,  -240, -1490}
+    ,{ -2230, -2250, -2230, -2230, -2230}
+    ,{  -240, -1510, -1490,  -240, -1490}
+    }
+   ,{{  -160, -1420, -1410,  -160, -1410}
+    ,{  -160, -1420, -1410,  -160, -1410}
+    ,{  -460, -1490, -1710,  -460, -1710}
+    ,{  -160, -1420, -1410,  -160, -1410}
+    ,{  -460, -1490, -1710,  -460, -1710}
+    }
+   ,{{  -240, -1510,  -870,  -240,  -870}
+    ,{ -1760, -1770, -1760, -1760, -1760}
+    ,{  -240, -1510, -1490,  -240, -1490}
+    ,{  -870, -2130,  -870, -2120,  -870}
+    ,{  -240, -1510, -1490,  -240, -1490}
+    }
+   ,{{  -160, -1420, -1410,  -160, -1410}
+    ,{  -160, -1420, -1410,  -160, -1410}
+    ,{  -770, -1800, -2020,  -770, -2020}
+    ,{  -160, -1420, -1410,  -160, -1410}
+    ,{ -1700, -1710, -1700, -1700, -1700}
+    }
+   }
+  ,{{{  -800,  -870,  -870,  -870,  -800}
+    ,{  -800, -1040, -1040, -1040,  -800}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    ,{  -870,  -870,  -870,  -870, -1410}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    }
+   ,{{  -800, -1040, -1040, -1040,  -800}
+    ,{  -800, -1040, -1040, -1040,  -800}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    ,{ -1990, -2230, -1990, -2230, -2230}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    }
+   ,{{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -1710, -1710, -1710, -1710, -1710}
+    ,{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -1710, -1710, -1710, -1710, -1710}
+    }
+   ,{{  -870,  -870,  -870,  -870, -1490}
+    ,{ -1520, -1760, -1520, -1760, -1760}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    ,{  -870,  -870,  -870,  -870, -2120}
+    ,{ -1490, -1490, -1490, -1490, -1490}
+    }
+   ,{{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -2020, -2020, -2020, -2020, -2020}
+    ,{ -1410, -1410, -1410, -1410, -1410}
+    ,{ -1700, -1700, -1700, -1700, -1700}
+    }
+   }
+  }
+ ,{{{{  -710,  -710,  -710,  -710,  -710}
+    ,{  -710, -1780, -1540,  -710, -1540}
+    ,{  -710, -1730, -1960,  -710, -1960}
+    ,{  -710,  -710,  -710,  -710,  -710}
+    ,{  -710, -1730, -1960,  -710, -1960}
+    }
+   ,{{  -710, -1960, -1730,  -710, -1730}
+    ,{  -890, -2140, -2140,  -890, -1900}
+    ,{  -710, -1960, -1960,  -710, -1960}
+    ,{ -1730, -1970, -1730, -1800, -1730}
+    ,{  -710, -1960, -1960,  -710, -1960}
+    }
+   ,{{  -710, -1730, -1960,  -710, -1960}
+    ,{  -710, -1960, -1960,  -710, -1960}
+    ,{  -710, -1730, -1960,  -710, -1960}
+    ,{  -710, -1960, -1960,  -710, -1960}
+    ,{  -710, -1730, -1960,  -710, -1960}
+    }
+   ,{{  -710,  -710,  -710,  -710,  -710}
+    ,{ -1540, -1780, -1540, -1610, -1540}
+    ,{  -710, -1960, -1960,  -710, -1960}
+    ,{  -710,  -710,  -710,  -710,  -710}
+    ,{  -710, -1960, -1960,  -710, -1960}
+    }
+   ,{{  -710, -1730, -1960,  -710, -1960}
+    ,{  -710, -1960, -1960,  -710, -1960}
+    ,{  -710, -1730, -1960,  -710, -1960}
+    ,{  -710, -1960, -1960,  -710, -1960}
+    ,{ -1780, -1900, -1960, -1780, -1960}
+    }
+   }
+  ,{{{  -710,  -890,  -710, -1540,  -710}
+    ,{ -1610, -1960, -1780, -1610, -1780}
+    ,{ -1540, -2140, -1960, -1540, -1960}
+    ,{  -710,  -890,  -710, -1780,  -710}
+    ,{ -1540, -1900, -1960, -1540, -1960}
+    }
+   ,{{ -1780, -2140, -1960, -1780, -1960}
+    ,{ -1960, -2320, -2140, -1960, -2140}
+    ,{ -1780, -2140, -1960, -1780, -1960}
+    ,{ -1800, -2150, -1970, -1800, -1970}
+    ,{ -1780, -2140, -1960, -1780, -1960}
+    }
+   ,{{ -1540, -2140, -1960, -1540, -1960}
+    ,{ -1780, -2140, -1960, -1780, -1960}
+    ,{ -1540, -2140, -1960, -1540, -1960}
+    ,{ -1780, -2140, -1960, -1780, -1960}
+    ,{ -1540, -2140, -1960, -1540, -1960}
+    }
+   ,{{  -710,  -890,  -710, -1610,  -710}
+    ,{ -1610, -1960, -1780, -1610, -1780}
+    ,{ -1780, -2140, -1960, -1780, -1960}
+    ,{  -710,  -890,  -710, -1780,  -710}
+    ,{ -1780, -2140, -1960, -1780, -1960}
+    }
+   ,{{ -1540, -1900, -1960, -1540, -1960}
+    ,{ -1780, -2140, -1960, -1780, -1960}
+    ,{ -1540, -2140, -1960, -1540, -1960}
+    ,{ -1780, -2140, -1960, -1780, -1960}
+    ,{ -1780, -1900, -1960, -1780, -1960}
+    }
+   }
+  ,{{{  -710,  -710,  -710,  -710,  -710}
+    ,{ -1540, -1780, -1540, -1780, -1540}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{  -710,  -710,  -710,  -710,  -710}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    }
+   ,{{ -1730, -1960, -1730, -1960, -1730}
+    ,{ -2140, -2140, -2140, -2140, -2140}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1730, -1970, -1730, -1970, -1730}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    }
+   ,{{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    }
+   ,{{  -710,  -710,  -710,  -710,  -710}
+    ,{ -1540, -1780, -1540, -1780, -1540}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{  -710,  -710,  -710,  -710,  -710}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    }
+   ,{{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    }
+   }
+  ,{{{  -710, -1730,  -710,  -710,  -710}
+    ,{  -710, -1800, -1780,  -710, -1780}
+    ,{  -710, -1730, -1960,  -710, -1960}
+    ,{  -710, -1970,  -710,  -710,  -710}
+    ,{  -710, -1730, -1960,  -710, -1960}
+    }
+   ,{{  -710, -1970, -1960,  -710, -1960}
+    ,{  -890, -2150, -2140,  -890, -2140}
+    ,{  -710, -1970, -1960,  -710, -1960}
+    ,{ -1970, -1990, -1970, -1970, -1970}
+    ,{  -710, -1970, -1960,  -710, -1960}
+    }
+   ,{{  -710, -1730, -1960,  -710, -1960}
+    ,{  -710, -1970, -1960,  -710, -1960}
+    ,{  -710, -1730, -1960,  -710, -1960}
+    ,{  -710, -1970, -1960,  -710, -1960}
+    ,{  -710, -1730, -1960,  -710, -1960}
+    }
+   ,{{  -710, -1800,  -710,  -710,  -710}
+    ,{ -1780, -1800, -1780, -1780, -1780}
+    ,{  -710, -1970, -1960,  -710, -1960}
+    ,{  -710, -1970,  -710, -1960,  -710}
+    ,{  -710, -1970, -1960,  -710, -1960}
+    }
+   ,{{  -710, -1730, -1960,  -710, -1960}
+    ,{  -710, -1970, -1960,  -710, -1960}
+    ,{  -710, -1730, -1960,  -710, -1960}
+    ,{  -710, -1970, -1960,  -710, -1960}
+    ,{ -1960, -1970, -1960, -1960, -1960}
+    }
+   }
+  ,{{{  -710,  -710,  -710,  -710, -1780}
+    ,{ -1540, -1780, -1540, -1780, -1780}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{  -710,  -710,  -710,  -710, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    }
+   ,{{ -1730, -1960, -1730, -1960, -1900}
+    ,{ -1900, -2140, -2140, -2140, -1900}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1730, -1970, -1730, -1970, -1970}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    }
+   ,{{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    }
+   ,{{  -710,  -710,  -710,  -710, -1780}
+    ,{ -1540, -1780, -1540, -1780, -1780}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{  -710,  -710,  -710,  -710, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    }
+   ,{{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    ,{ -1960, -1960, -1960, -1960, -1960}
+    }
+   }
+  }
+ ,{{{{   360,   -70,  -150,   360,  -150}
+    ,{   360,   -70,  -890,   360,  -650}
+    ,{  -150, -1180, -1400,  -150, -1400}
+    ,{  -150,  -150,  -150,  -150,  -150}
+    ,{  -150, -1180, -1400,  -150, -1400}
+    }
+   ,{{   360,   -70,  -890,   360,  -650}
+    ,{   360,   -70,  -890,   360,  -650}
+    ,{  -150, -1400, -1400,  -150, -1400}
+    ,{ -1500, -1600, -1500, -1570, -1500}
+    ,{  -150, -1400, -1400,  -150, -1400}
+    }
+   ,{{  -150, -1180, -1400,  -150, -1400}
+    ,{  -150, -1400, -1400,  -150, -1400}
+    ,{  -150, -1180, -1400,  -150, -1400}
+    ,{  -150, -1400, -1400,  -150, -1400}
+    ,{  -150, -1180, -1400,  -150, -1400}
+    }
+   ,{{  -150,  -150,  -150,  -150,  -150}
+    ,{ -1670, -1910, -1670, -1740, -1670}
+    ,{  -150, -1400, -1400,  -150, -1400}
+    ,{  -150,  -150,  -150,  -150,  -150}
+    ,{  -150, -1400, -1400,  -150, -1400}
+    }
+   ,{{  -150, -1180, -1400,  -150, -1400}
+    ,{  -150, -1400, -1400,  -150, -1400}
+    ,{  -150, -1180, -1400,  -150, -1400}
+    ,{  -150, -1400, -1400,  -150, -1400}
+    ,{ -1230, -1340, -1400, -1230, -1400}
+    }
+   }
+  ,{{{   -30,   -70,  -150,   -30,  -150}
+    ,{   -30,   -70,  -890,   -30,  -890}
+    ,{  -990, -1580, -1400,  -990, -1400}
+    ,{  -150,  -330,  -150, -1230,  -150}
+    ,{  -990, -1340, -1400,  -990, -1400}
+    }
+   ,{{   -30,   -70,  -890,   -30,  -890}
+    ,{   -30,   -70,  -890,   -30,  -890}
+    ,{ -1230, -1580, -1400, -1230, -1400}
+    ,{ -1570, -1600, -1740, -1570, -1740}
+    ,{ -1230, -1580, -1400, -1230, -1400}
+    }
+   ,{{  -990, -1580, -1400,  -990, -1400}
+    ,{ -1230, -1580, -1400, -1230, -1400}
+    ,{  -990, -1580, -1400,  -990, -1400}
+    ,{ -1230, -1580, -1400, -1230, -1400}
+    ,{  -990, -1580, -1400,  -990, -1400}
+    }
+   ,{{  -150,  -330,  -150, -1230,  -150}
+    ,{ -1740, -2090, -1910, -1740, -1910}
+    ,{ -1230, -1580, -1400, -1230, -1400}
+    ,{  -150,  -330,  -150, -1230,  -150}
+    ,{ -1230, -1580, -1400, -1230, -1400}
+    }
+   ,{{  -990, -1340, -1400,  -990, -1400}
+    ,{ -1230, -1580, -1400, -1230, -1400}
+    ,{  -990, -1580, -1400,  -990, -1400}
+    ,{ -1230, -1580, -1400, -1230, -1400}
+    ,{ -1230, -1340, -1400, -1230, -1400}
+    }
+   }
+  ,{{{  -150,  -150,  -150,  -150,  -150}
+    ,{  -890,  -890,  -890,  -890,  -890}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{  -150,  -150,  -150,  -150,  -150}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{  -890,  -890,  -890,  -890,  -890}
+    ,{  -890,  -890,  -890,  -890,  -890}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1500, -1740, -1500, -1740, -1500}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{  -150,  -150,  -150,  -150,  -150}
+    ,{ -1670, -1910, -1670, -1910, -1670}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{  -150,  -150,  -150,  -150,  -150}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   }
+  ,{{{   360,  -910,  -150,   360,  -150}
+    ,{   360,  -910,  -890,   360,  -890}
+    ,{  -150, -1180, -1400,  -150, -1400}
+    ,{  -150, -1420,  -150,  -150,  -150}
+    ,{  -150, -1180, -1400,  -150, -1400}
+    }
+   ,{{   360,  -910,  -890,   360,  -890}
+    ,{   360,  -910,  -890,   360,  -890}
+    ,{  -150, -1420, -1400,  -150, -1400}
+    ,{ -1740, -3040, -1740, -1740, -1740}
+    ,{  -150, -1420, -1400,  -150, -1400}
+    }
+   ,{{  -150, -1180, -1400,  -150, -1400}
+    ,{  -150, -1420, -1400,  -150, -1400}
+    ,{  -150, -1180, -1400,  -150, -1400}
+    ,{  -150, -1420, -1400,  -150, -1400}
+    ,{  -150, -1180, -1400,  -150, -1400}
+    }
+   ,{{  -150, -1420,  -150,  -150,  -150}
+    ,{ -1910, -1930, -1910, -1910, -1910}
+    ,{  -150, -1420, -1400,  -150, -1400}
+    ,{  -150, -1420,  -150, -1400,  -150}
+    ,{  -150, -1420, -1400,  -150, -1400}
+    }
+   ,{{  -150, -1180, -1400,  -150, -1400}
+    ,{  -150, -1420, -1400,  -150, -1400}
+    ,{  -150, -1180, -1400,  -150, -1400}
+    ,{  -150, -1420, -1400,  -150, -1400}
+    ,{ -1400, -1420, -1400, -1400, -1400}
+    }
+   }
+  ,{{{  -150,  -150,  -150,  -150,  -650}
+    ,{  -650,  -890,  -890,  -890,  -650}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{  -150,  -150,  -150,  -150, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{  -650,  -890,  -890,  -890,  -650}
+    ,{  -650,  -890,  -890,  -890,  -650}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1500, -1740, -1500, -1740, -1740}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{  -150,  -150,  -150,  -150, -1400}
+    ,{ -1670, -1910, -1670, -1910, -1910}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{  -150,  -150,  -150,  -150, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   }
+  }
+ ,{{{{   940,   220,   220,   940,   220}
+    ,{   940,  -310,  -310,   940,   -70}
+    ,{   640,  -380,  -610,   640,  -610}
+    ,{   650,   220,   220,   650,   220}
+    ,{   640,  -380,  -610,   640,  -610}
+    }
+   ,{{   940,  -310,  -310,   940,   -70}
+    ,{   940,  -310,  -310,   940,   -70}
+    ,{   630,  -620,  -620,   630,  -620}
+    ,{ -1460, -1700, -1460, -1520, -1460}
+    ,{   630,  -620,  -620,   630,  -620}
+    }
+   ,{{   650,  -380,  -600,   650,  -600}
+    ,{   650,  -600,  -600,   650,  -600}
+    ,{   640,  -380,  -610,   640,  -610}
+    ,{   650,  -600,  -600,   650,  -600}
+    ,{   640,  -380,  -610,   640,  -610}
+    }
+   ,{{   630,   220,   220,   630,   220}
+    ,{ -1280, -1520, -1280, -1340, -1280}
+    ,{   630,  -620,  -620,   630,  -620}
+    ,{   220,   220,   220,   220,   220}
+    ,{   630,  -620,  -620,   630,  -620}
+    }
+   ,{{   650,  -380,  -600,   650,  -600}
+    ,{   650,  -600,  -600,   650,  -600}
+    ,{   640,  -380,  -610,   640,  -610}
+    ,{   650,  -600,  -600,   650,  -600}
+    ,{ -1410, -1530, -1590, -1410, -1590}
+    }
+   }
+  ,{{{   220,    40,   220,  -130,   220}
+    ,{  -130,  -490,  -310,  -130,  -310}
+    ,{  -190,  -790,  -610,  -190,  -610}
+    ,{   220,    40,   220,  -430,   220}
+    ,{  -190,  -790,  -610,  -190,  -610}
+    }
+   ,{{  -130,  -490,  -310,  -130,  -310}
+    ,{  -130,  -490,  -310,  -130,  -310}
+    ,{  -440,  -800,  -620,  -440,  -620}
+    ,{ -1520, -1880, -1700, -1520, -1700}
+    ,{  -440,  -800,  -620,  -440,  -620}
+    }
+   ,{{  -190,  -780,  -600,  -190,  -600}
+    ,{  -430,  -780,  -600,  -430,  -600}
+    ,{  -190,  -790,  -610,  -190,  -610}
+    ,{  -430,  -780,  -600,  -430,  -600}
+    ,{  -190,  -790,  -610,  -190,  -610}
+    }
+   ,{{   220,    40,   220,  -440,   220}
+    ,{ -1340, -1700, -1520, -1340, -1520}
+    ,{  -440,  -800,  -620,  -440,  -620}
+    ,{   220,    40,   220,  -850,   220}
+    ,{  -440,  -800,  -620,  -440,  -620}
+    }
+   ,{{  -190,  -780,  -600,  -190,  -600}
+    ,{  -430,  -780,  -600,  -430,  -600}
+    ,{  -190,  -790,  -610,  -190,  -610}
+    ,{  -430,  -780,  -600,  -430,  -600}
+    ,{ -1410, -1530, -1590, -1410, -1590}
+    }
+   }
+  ,{{{   220,   220,   220,   220,   220}
+    ,{  -310,  -310,  -310,  -310,  -310}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    ,{   220,   220,   220,   220,   220}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    }
+   ,{{  -310,  -310,  -310,  -310,  -310}
+    ,{  -310,  -310,  -310,  -310,  -310}
+    ,{  -620,  -620,  -620,  -620,  -620}
+    ,{ -1460, -1700, -1460, -1700, -1460}
+    ,{  -620,  -620,  -620,  -620,  -620}
+    }
+   ,{{  -600,  -600,  -600,  -600,  -600}
+    ,{  -600,  -600,  -600,  -600,  -600}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    ,{  -600,  -600,  -600,  -600,  -600}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    }
+   ,{{   220,   220,   220,   220,   220}
+    ,{ -1280, -1520, -1280, -1520, -1280}
+    ,{  -620,  -620,  -620,  -620,  -620}
+    ,{   220,   220,   220,   220,   220}
+    ,{  -620,  -620,  -620,  -620,  -620}
+    }
+   ,{{  -600,  -600,  -600,  -600,  -600}
+    ,{  -600,  -600,  -600,  -600,  -600}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    ,{  -600,  -600,  -600,  -600,  -600}
+    ,{ -1590, -1590, -1590, -1590, -1590}
+    }
+   }
+  ,{{{   940,  -320,   220,   940,   220}
+    ,{   940,  -320,  -310,   940,  -310}
+    ,{   640,  -380,  -610,   640,  -610}
+    ,{   650,  -620,   220,   650,   220}
+    ,{   640,  -380,  -610,   640,  -610}
+    }
+   ,{{   940,  -320,  -310,   940,  -310}
+    ,{   940,  -320,  -310,   940,  -310}
+    ,{   630,  -630,  -620,   630,  -620}
+    ,{ -1700, -1710, -1700, -1700, -1700}
+    ,{   630,  -630,  -620,   630,  -620}
+    }
+   ,{{   650,  -380,  -600,   650,  -600}
+    ,{   650,  -620,  -600,   650,  -600}
+    ,{   640,  -380,  -610,   640,  -610}
+    ,{   650,  -620,  -600,   650,  -600}
+    ,{   640,  -380,  -610,   640,  -610}
+    }
+   ,{{   630,  -630,   220,   630,   220}
+    ,{ -1520, -1530, -1520, -1520, -1520}
+    ,{   630,  -630,  -620,   630,  -620}
+    ,{   220, -1040,   220, -1030,   220}
+    ,{   630,  -630,  -620,   630,  -620}
+    }
+   ,{{   650,  -380,  -600,   650,  -600}
+    ,{   650,  -620,  -600,   650,  -600}
+    ,{   640,  -380,  -610,   640,  -610}
+    ,{   650,  -620,  -600,   650,  -600}
+    ,{ -1590, -1600, -1590, -1590, -1590}
+    }
+   }
+  ,{{{   220,   220,   220,   220,   -70}
+    ,{   -70,  -310,  -310,  -310,   -70}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    ,{   220,   220,   220,   220,  -600}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    }
+   ,{{   -70,  -310,  -310,  -310,   -70}
+    ,{   -70,  -310,  -310,  -310,   -70}
+    ,{  -620,  -620,  -620,  -620,  -620}
+    ,{ -1460, -1700, -1460, -1700, -1700}
+    ,{  -620,  -620,  -620,  -620,  -620}
+    }
+   ,{{  -600,  -600,  -600,  -600,  -600}
+    ,{  -600,  -600,  -600,  -600,  -600}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    ,{  -600,  -600,  -600,  -600,  -600}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    }
+   ,{{   220,   220,   220,   220,  -620}
+    ,{ -1280, -1520, -1280, -1520, -1520}
+    ,{  -620,  -620,  -620,  -620,  -620}
+    ,{   220,   220,   220,   220, -1030}
+    ,{  -620,  -620,  -620,  -620,  -620}
+    }
+   ,{{  -600,  -600,  -600,  -600,  -600}
+    ,{  -600,  -600,  -600,  -600,  -600}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    ,{  -600,  -600,  -600,  -600,  -600}
+    ,{ -1590, -1590, -1590, -1590, -1590}
+    }
+   }
+  }
+ ,{{{{  1010,   410,   410,  1010,   410}
+    ,{  1010,  -240,  -240,  1010,     0}
+    ,{   880,  -150,  -370,   880,  -370}
+    ,{   880,   410,   410,   880,   410}
+    ,{   750,  -280,  -500,   750,  -500}
+    }
+   ,{{  1010,  -240,  -240,  1010,     0}
+    ,{  1010,  -240,  -240,  1010,     0}
+    ,{   730,  -520,  -520,   730,  -520}
+    ,{ -1410, -1650, -1410, -1470, -1410}
+    ,{   730,  -520,  -520,   730,  -520}
+    }
+   ,{{   880,  -150,  -370,   880,  -370}
+    ,{   880,  -370,  -370,   880,  -370}
+    ,{   880,  -150,  -370,   880,  -370}
+    ,{   880,  -370,  -370,   880,  -370}
+    ,{   750,  -280,  -500,   750,  -500}
+    }
+   ,{{   730,   410,   410,   730,   410}
+    ,{ -1710, -1950, -1710, -1770, -1710}
+    ,{   730,  -520,  -520,   730,  -520}
+    ,{   410,   410,   410,   410,   410}
+    ,{   730,  -520,  -520,   730,  -520}
+    }
+   ,{{   880,  -370,  -370,   880,  -370}
+    ,{   880,  -370,  -370,   880,  -370}
+    ,{   440,  -590,  -810,   440,  -810}
+    ,{   880,  -370,  -370,   880,  -370}
+    ,{ -1140, -1250, -1310, -1140, -1310}
+    }
+   }
+  ,{{{   410,   230,   410,    40,   410}
+    ,{   -70,  -420,  -240,   -70,  -240}
+    ,{    40,  -550,  -370,    40,  -370}
+    ,{   410,   230,   410,  -200,   410}
+    ,{   -90,  -680,  -500,   -90,  -500}
+    }
+   ,{{   -70,  -420,  -240,   -70,  -240}
+    ,{   -70,  -420,  -240,   -70,  -240}
+    ,{  -350,  -700,  -520,  -350,  -520}
+    ,{ -1470, -1830, -1650, -1470, -1650}
+    ,{  -350,  -700,  -520,  -350,  -520}
+    }
+   ,{{    40,  -550,  -370,    40,  -370}
+    ,{  -200,  -550,  -370,  -200,  -370}
+    ,{    40,  -550,  -370,    40,  -370}
+    ,{  -200,  -550,  -370,  -200,  -370}
+    ,{   -90,  -680,  -500,   -90,  -500}
+    }
+   ,{{   410,   230,   410,  -350,   410}
+    ,{ -1770, -2130, -1950, -1770, -1950}
+    ,{  -350,  -700,  -520,  -350,  -520}
+    ,{   410,   230,   410,  -670,   410}
+    ,{  -350,  -700,  -520,  -350,  -520}
+    }
+   ,{{  -200,  -550,  -370,  -200,  -370}
+    ,{  -200,  -550,  -370,  -200,  -370}
+    ,{  -400,  -990,  -810,  -400,  -810}
+    ,{  -200,  -550,  -370,  -200,  -370}
+    ,{ -1140, -1250, -1310, -1140, -1310}
+    }
+   }
+  ,{{{   410,   410,   410,   410,   410}
+    ,{  -240,  -240,  -240,  -240,  -240}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{   410,   410,   410,   410,   410}
+    ,{  -500,  -500,  -500,  -500,  -500}
+    }
+   ,{{  -240,  -240,  -240,  -240,  -240}
+    ,{  -240,  -240,  -240,  -240,  -240}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    ,{ -1410, -1650, -1410, -1650, -1410}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    }
+   ,{{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -500,  -500,  -500,  -500,  -500}
+    }
+   ,{{   410,   410,   410,   410,   410}
+    ,{ -1710, -1950, -1710, -1950, -1710}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    ,{   410,   410,   410,   410,   410}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    }
+   ,{{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -810,  -810,  -810,  -810,  -810}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{ -1310, -1310, -1310, -1310, -1310}
+    }
+   }
+  ,{{{  1010,  -150,   410,  1010,   410}
+    ,{  1010,  -260,  -240,  1010,  -240}
+    ,{   880,  -150,  -370,   880,  -370}
+    ,{   880,  -390,   410,   880,   410}
+    ,{   750,  -280,  -500,   750,  -500}
+    }
+   ,{{  1010,  -260,  -240,  1010,  -240}
+    ,{  1010,  -260,  -240,  1010,  -240}
+    ,{   730,  -540,  -520,   730,  -520}
+    ,{ -1650, -1660, -1650, -1650, -1650}
+    ,{   730,  -540,  -520,   730,  -520}
+    }
+   ,{{   880,  -150,  -370,   880,  -370}
+    ,{   880,  -390,  -370,   880,  -370}
+    ,{   880,  -150,  -370,   880,  -370}
+    ,{   880,  -390,  -370,   880,  -370}
+    ,{   750,  -280,  -500,   750,  -500}
+    }
+   ,{{   730,  -540,   410,   730,   410}
+    ,{ -1950, -1960, -1950, -1950, -1950}
+    ,{   730,  -540,  -520,   730,  -520}
+    ,{   410,  -860,   410,  -840,   410}
+    ,{   730,  -540,  -520,   730,  -520}
+    }
+   ,{{   880,  -390,  -370,   880,  -370}
+    ,{   880,  -390,  -370,   880,  -370}
+    ,{   440,  -590,  -810,   440,  -810}
+    ,{   880,  -390,  -370,   880,  -370}
+    ,{ -1310, -1330, -1310, -1310, -1310}
+    }
+   }
+  ,{{{   410,   410,   410,   410,     0}
+    ,{     0,  -240,  -240,  -240,     0}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{   410,   410,   410,   410,  -370}
+    ,{  -500,  -500,  -500,  -500,  -500}
+    }
+   ,{{     0,  -240,  -240,  -240,     0}
+    ,{     0,  -240,  -240,  -240,     0}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    ,{ -1410, -1650, -1410, -1650, -1650}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    }
+   ,{{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -500,  -500,  -500,  -500,  -500}
+    }
+   ,{{   410,   410,   410,   410,  -520}
+    ,{ -1710, -1950, -1710, -1950, -1950}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    ,{   410,   410,   410,   410,  -840}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    }
+   ,{{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -810,  -810,  -810,  -810,  -810}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{ -1310, -1310, -1310, -1310, -1310}
+    }
+   }
+  }
+ ,{{{{  1010,   410,   410,  1010,   410}
+    ,{  1010,   -70,  -240,  1010,     0}
+    ,{   880,  -150,  -370,   880,  -370}
+    ,{   880,   410,   410,   880,   410}
+    ,{   750,  -280,  -500,   750,  -500}
+    }
+   ,{{  1010,   -70,  -240,  1010,     0}
+    ,{  1010,   -70,  -240,  1010,     0}
+    ,{   730,  -520,  -520,   730,  -520}
+    ,{ -1180, -1420, -1180, -1250, -1180}
+    ,{   730,  -520,  -520,   730,  -520}
+    }
+   ,{{   880,  -150,  -370,   880,  -370}
+    ,{   880,  -370,  -370,   880,  -370}
+    ,{   880,  -150,  -370,   880,  -370}
+    ,{   880,  -370,  -370,   880,  -370}
+    ,{   750,  -280,  -500,   750,  -500}
+    }
+   ,{{   730,   410,   410,   730,   410}
+    ,{ -1280, -1520, -1280, -1340, -1280}
+    ,{   730,  -520,  -520,   730,  -520}
+    ,{   410,   410,   410,   410,   410}
+    ,{   730,  -520,  -520,   730,  -520}
+    }
+   ,{{   880,  -370,  -370,   880,  -370}
+    ,{   880,  -370,  -370,   880,  -370}
+    ,{   640,  -380,  -610,   640,  -610}
+    ,{   880,  -370,  -370,   880,  -370}
+    ,{ -1140, -1250, -1310, -1140, -1310}
+    }
+   }
+  ,{{{   410,   230,   410,    40,   410}
+    ,{   -30,   -70,  -240,   -30,  -240}
+    ,{    40,  -550,  -370,    40,  -370}
+    ,{   410,   230,   410,  -200,   410}
+    ,{   -90,  -680,  -500,   -90,  -500}
+    }
+   ,{{   -30,   -70,  -240,   -30,  -240}
+    ,{   -30,   -70,  -240,   -30,  -240}
+    ,{  -350,  -700,  -520,  -350,  -520}
+    ,{ -1250, -1600, -1420, -1250, -1420}
+    ,{  -350,  -700,  -520,  -350,  -520}
+    }
+   ,{{    40,  -550,  -370,    40,  -370}
+    ,{  -200,  -550,  -370,  -200,  -370}
+    ,{    40,  -550,  -370,    40,  -370}
+    ,{  -200,  -550,  -370,  -200,  -370}
+    ,{   -90,  -680,  -500,   -90,  -500}
+    }
+   ,{{   410,   230,   410,  -350,   410}
+    ,{ -1340, -1700, -1520, -1340, -1520}
+    ,{  -350,  -700,  -520,  -350,  -520}
+    ,{   410,   230,   410,  -670,   410}
+    ,{  -350,  -700,  -520,  -350,  -520}
+    }
+   ,{{  -190,  -550,  -370,  -190,  -370}
+    ,{  -200,  -550,  -370,  -200,  -370}
+    ,{  -190,  -790,  -610,  -190,  -610}
+    ,{  -200,  -550,  -370,  -200,  -370}
+    ,{ -1140, -1250, -1310, -1140, -1310}
+    }
+   }
+  ,{{{   410,   410,   410,   410,   410}
+    ,{  -240,  -240,  -240,  -240,  -240}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{   410,   410,   410,   410,   410}
+    ,{  -500,  -500,  -500,  -500,  -500}
+    }
+   ,{{  -240,  -240,  -240,  -240,  -240}
+    ,{  -240,  -240,  -240,  -240,  -240}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    ,{ -1180, -1420, -1180, -1420, -1180}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    }
+   ,{{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -500,  -500,  -500,  -500,  -500}
+    }
+   ,{{   410,   410,   410,   410,   410}
+    ,{ -1280, -1520, -1280, -1520, -1280}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    ,{   410,   410,   410,   410,   410}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    }
+   ,{{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{ -1310, -1310, -1310, -1310, -1310}
+    }
+   }
+  ,{{{  1010,  -150,   410,  1010,   410}
+    ,{  1010,  -260,  -240,  1010,  -240}
+    ,{   880,  -150,  -370,   880,  -370}
+    ,{   880,  -390,   410,   880,   410}
+    ,{   750,  -280,  -500,   750,  -500}
+    }
+   ,{{  1010,  -260,  -240,  1010,  -240}
+    ,{  1010,  -260,  -240,  1010,  -240}
+    ,{   730,  -540,  -520,   730,  -520}
+    ,{ -1420, -1440, -1420, -1420, -1420}
+    ,{   730,  -540,  -520,   730,  -520}
+    }
+   ,{{   880,  -150,  -370,   880,  -370}
+    ,{   880,  -390,  -370,   880,  -370}
+    ,{   880,  -150,  -370,   880,  -370}
+    ,{   880,  -390,  -370,   880,  -370}
+    ,{   750,  -280,  -500,   750,  -500}
+    }
+   ,{{   730,  -540,   410,   730,   410}
+    ,{ -1520, -1530, -1520, -1520, -1520}
+    ,{   730,  -540,  -520,   730,  -520}
+    ,{   410,  -860,   410,  -840,   410}
+    ,{   730,  -540,  -520,   730,  -520}
+    }
+   ,{{   880,  -380,  -370,   880,  -370}
+    ,{   880,  -390,  -370,   880,  -370}
+    ,{   640,  -380,  -610,   640,  -610}
+    ,{   880,  -390,  -370,   880,  -370}
+    ,{ -1310, -1330, -1310, -1310, -1310}
+    }
+   }
+  ,{{{   410,   410,   410,   410,     0}
+    ,{     0,  -240,  -240,  -240,     0}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{   410,   410,   410,   410,  -370}
+    ,{  -500,  -500,  -500,  -500,  -500}
+    }
+   ,{{     0,  -240,  -240,  -240,     0}
+    ,{     0,  -240,  -240,  -240,     0}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    ,{ -1180, -1420, -1180, -1420, -1420}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    }
+   ,{{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -500,  -500,  -500,  -500,  -500}
+    }
+   ,{{   410,   410,   410,   410,  -520}
+    ,{ -1280, -1520, -1280, -1520, -1520}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    ,{   410,   410,   410,   410,  -840}
+    ,{  -520,  -520,  -520,  -520,  -520}
+    }
+   ,{{  -370,  -370,  -370,  -370,  -370}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{  -610,  -610,  -610,  -610,  -610}
+    ,{  -370,  -370,  -370,  -370,  -370}
+    ,{ -1310, -1310, -1310, -1310, -1310}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{   800,   200,  -310,   800,  -310}
+    ,{   740,     0,  -510,   740,  -410}
+    ,{   800,    50,  -450,   800,  -450}
+    ,{   740,   200,  -310,   740,  -310}
+    ,{   690,   -50,  -560,   690,  -560}
+    }
+   ,{{   600,  -140,  -630,   600,  -410}
+    ,{   600,  -140,  -650,   600,  -410}
+    ,{   290,  -450,  -960,   290,  -960}
+    ,{  -360,  -360,  -630,  -870,  -630}
+    ,{   290,  -450,  -960,   290,  -960}
+    }
+   ,{{   740,     0,  -510,   740,  -510}
+    ,{   740,     0,  -510,   740,  -510}
+    ,{   740,     0,  -510,   740,  -510}
+    ,{   740,     0,  -510,   740,  -510}
+    ,{   690,   -50,  -560,   690,  -560}
+    }
+   ,{{   290,   200,  -310,   290,  -310}
+    ,{  -640,  -640,  -910, -1150,  -910}
+    ,{   290,  -450,  -960,   290,  -960}
+    ,{   200,   200,  -310,  -310,  -310}
+    ,{   290,  -450,  -960,   290,  -960}
+    }
+   ,{{   800,    50,  -450,   800,  -450}
+    ,{   740,     0,  -510,   740,  -510}
+    ,{   800,    50,  -450,   800,  -450}
+    ,{   740,     0,  -510,   740,  -510}
+    ,{  -550,  -550, -1300, -1300, -1300}
+    }
+   }
+  ,{{{   200,   200,  -310,  -720,  -310}
+    ,{     0,     0,  -510, -1020,  -510}
+    ,{    50,    50,  -450,  -720,  -450}
+    ,{   200,   200,  -310, -1020,  -310}
+    ,{   -50,   -50,  -560,  -830,  -560}
+    }
+   ,{{  -140,  -140,  -650, -1160,  -650}
+    ,{  -140,  -140,  -650, -1160,  -650}
+    ,{  -450,  -450,  -960, -1470,  -960}
+    ,{  -360,  -360,  -870, -1380,  -870}
+    ,{  -450,  -450,  -960, -1470,  -960}
+    }
+   ,{{     0,     0,  -510,  -780,  -510}
+    ,{     0,     0,  -510, -1020,  -510}
+    ,{     0,     0,  -510,  -780,  -510}
+    ,{     0,     0,  -510, -1020,  -510}
+    ,{   -50,   -50,  -560,  -830,  -560}
+    }
+   ,{{   200,   200,  -310, -1470,  -310}
+    ,{  -640,  -640, -1150, -1660, -1150}
+    ,{  -450,  -450,  -960, -1470,  -960}
+    ,{   200,   200,  -310, -2070,  -310}
+    ,{  -450,  -450,  -960, -1470,  -960}
+    }
+   ,{{    50,    50,  -450,  -720,  -450}
+    ,{     0,     0,  -510, -1020,  -510}
+    ,{    50,    50,  -450,  -720,  -450}
+    ,{     0,     0,  -510, -1020,  -510}
+    ,{  -550,  -550, -1300, -1810, -1300}
+    }
+   }
+  ,{{{  -310,  -310,  -310,  -310,  -310}
+    ,{  -510,  -510,  -510,  -510,  -510}
+    ,{  -450,  -450,  -450,  -450,  -450}
+    ,{  -310,  -310,  -310,  -310,  -310}
+    ,{  -560,  -560,  -560,  -560,  -560}
+    }
+   ,{{  -630,  -650,  -630,  -650,  -630}
+    ,{  -650,  -650,  -650,  -650,  -650}
+    ,{  -960,  -960,  -960,  -960,  -960}
+    ,{  -630,  -870,  -630,  -870,  -630}
+    ,{  -960,  -960,  -960,  -960,  -960}
+    }
+   ,{{  -510,  -510,  -510,  -510,  -510}
+    ,{  -510,  -510,  -510,  -510,  -510}
+    ,{  -510,  -510,  -510,  -510,  -510}
+    ,{  -510,  -510,  -510,  -510,  -510}
+    ,{  -560,  -560,  -560,  -560,  -560}
+    }
+   ,{{  -310,  -310,  -310,  -310,  -310}
+    ,{  -910, -1150,  -910, -1150,  -910}
+    ,{  -960,  -960,  -960,  -960,  -960}
+    ,{  -310,  -310,  -310,  -310,  -310}
+    ,{  -960,  -960,  -960,  -960,  -960}
+    }
+   ,{{  -450,  -450,  -450,  -450,  -450}
+    ,{  -510,  -510,  -510,  -510,  -510}
+    ,{  -450,  -450,  -450,  -450,  -450}
+    ,{  -510,  -510,  -510,  -510,  -510}
+    ,{ -1300, -1300, -1300, -1300, -1300}
+    }
+   }
+  ,{{{   800,  -550,  -310,   800,  -310}
+    ,{   740,  -850,  -510,   740,  -510}
+    ,{   800,  -550,  -450,   800,  -450}
+    ,{   740,  -850,  -310,   740,  -310}
+    ,{   690,  -660,  -560,   690,  -560}
+    }
+   ,{{   600,  -990,  -650,   600,  -650}
+    ,{   600,  -990,  -650,   600,  -650}
+    ,{   290, -1300,  -960,   290,  -960}
+    ,{  -870, -1210,  -870,  -870,  -870}
+    ,{   290, -1300,  -960,   290,  -960}
+    }
+   ,{{   740,  -610,  -510,   740,  -510}
+    ,{   740,  -850,  -510,   740,  -510}
+    ,{   740,  -610,  -510,   740,  -510}
+    ,{   740,  -850,  -510,   740,  -510}
+    ,{   690,  -660,  -560,   690,  -560}
+    }
+   ,{{   290, -1300,  -310,   290,  -310}
+    ,{ -1150, -1490, -1150, -1150, -1150}
+    ,{   290, -1300,  -960,   290,  -960}
+    ,{  -310, -1900,  -310, -1560,  -310}
+    ,{   290, -1300,  -960,   290,  -960}
+    }
+   ,{{   800,  -550,  -450,   800,  -450}
+    ,{   740,  -850,  -510,   740,  -510}
+    ,{   800,  -550,  -450,   800,  -450}
+    ,{   740,  -850,  -510,   740,  -510}
+    ,{ -1300, -1640, -1300, -1300, -1300}
+    }
+   }
+  ,{{{  -310,  -310,  -310,  -310,  -410}
+    ,{  -410,  -510,  -510,  -510,  -410}
+    ,{  -450,  -450,  -450,  -450,  -450}
+    ,{  -310,  -310,  -310,  -310,  -510}
+    ,{  -560,  -560,  -560,  -560,  -560}
+    }
+   ,{{  -410,  -650,  -630,  -650,  -410}
+    ,{  -410,  -650,  -650,  -650,  -410}
+    ,{  -960,  -960,  -960,  -960,  -960}
+    ,{  -630,  -870,  -630,  -870,  -870}
+    ,{  -960,  -960,  -960,  -960,  -960}
+    }
+   ,{{  -510,  -510,  -510,  -510,  -510}
+    ,{  -510,  -510,  -510,  -510,  -510}
+    ,{  -510,  -510,  -510,  -510,  -510}
+    ,{  -510,  -510,  -510,  -510,  -510}
+    ,{  -560,  -560,  -560,  -560,  -560}
+    }
+   ,{{  -310,  -310,  -310,  -310,  -960}
+    ,{  -910, -1150,  -910, -1150, -1150}
+    ,{  -960,  -960,  -960,  -960,  -960}
+    ,{  -310,  -310,  -310,  -310, -1560}
+    ,{  -960,  -960,  -960,  -960,  -960}
+    }
+   ,{{  -450,  -450,  -450,  -450,  -450}
+    ,{  -510,  -510,  -510,  -510,  -510}
+    ,{  -450,  -450,  -450,  -450,  -450}
+    ,{  -510,  -510,  -510,  -510,  -510}
+    ,{ -1300, -1300, -1300, -1300, -1300}
+    }
+   }
+  }
+ ,{{{{   760,   200,  -310,   760,  -250}
+    ,{   760,  -340,  -490,   760,  -250}
+    ,{   310,  -430,  -940,   310,  -940}
+    ,{   400,   200,  -310,   400,  -310}
+    ,{   310,  -390,  -940,   310,  -940}
+    }
+   ,{{   760,  -430,  -490,   760,  -250}
+    ,{   760,  -490,  -490,   760,  -250}
+    ,{   310,  -430,  -940,   310,  -940}
+    ,{ -1170, -1170, -1440, -1680, -1440}
+    ,{   310,  -430,  -940,   310,  -940}
+    }
+   ,{{   400,  -340,  -850,   400,  -850}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{    90,  -650, -1160,    90, -1160}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{    90,  -650, -1160,    90, -1160}
+    }
+   ,{{   310,   200,  -310,   310,  -310}
+    ,{  -690,  -690,  -960, -1200,  -960}
+    ,{   310,  -430,  -940,   310,  -940}
+    ,{   200,   200,  -310,  -310,  -310}
+    ,{   310,  -430,  -940,   310,  -940}
+    }
+   ,{{   400,  -340,  -850,   400,  -850}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{  -220,  -960, -1470,  -220, -1470}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{  -390,  -390, -1140, -1140, -1140}
+    }
+   }
+  ,{{{   200,   200,  -310, -1000,  -310}
+    ,{  -340,  -340,  -490, -1000,  -490}
+    ,{  -430,  -430,  -940, -1430,  -940}
+    ,{   200,   200,  -310, -1360,  -310}
+    ,{  -390,  -390,  -940, -1430,  -940}
+    }
+   ,{{  -430,  -430,  -490, -1000,  -490}
+    ,{  -490, -2040,  -490, -1000,  -490}
+    ,{  -430,  -430,  -940, -1450,  -940}
+    ,{ -1170, -1170, -1680, -2190, -1680}
+    ,{  -430,  -430,  -940, -1450,  -940}
+    }
+   ,{{  -340,  -340,  -850, -1360,  -850}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    ,{  -650,  -650, -1160, -1430, -1160}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    ,{  -650,  -650, -1160, -1430, -1160}
+    }
+   ,{{   200,   200,  -310, -1450,  -310}
+    ,{  -690,  -690, -1200, -1710, -1200}
+    ,{  -430,  -430,  -940, -1450,  -940}
+    ,{   200,   200,  -310, -2070,  -310}
+    ,{  -430,  -430,  -940, -1450,  -940}
+    }
+   ,{{  -340,  -340,  -850, -1360,  -850}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    ,{  -960,  -960, -1470, -1740, -1470}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    ,{  -390,  -390, -1140, -1650, -1140}
+    }
+   }
+  ,{{{  -310,  -310,  -310,  -310,  -310}
+    ,{  -490,  -490,  -490,  -490,  -490}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    ,{  -310,  -310,  -310,  -310,  -310}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    }
+   ,{{  -490,  -490,  -490,  -490,  -490}
+    ,{  -490,  -490,  -490,  -490,  -490}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    ,{ -1440, -1680, -1440, -1680, -1440}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    }
+   ,{{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{ -1160, -1160, -1160, -1160, -1160}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{ -1160, -1160, -1160, -1160, -1160}
+    }
+   ,{{  -310,  -310,  -310,  -310,  -310}
+    ,{  -960, -1200,  -960, -1200,  -960}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    ,{  -310,  -310,  -310,  -310,  -310}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    }
+   ,{{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{ -1470, -1470, -1470, -1470, -1470}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{ -1140, -1140, -1140, -1140, -1140}
+    }
+   }
+  ,{{{   760,  -830,  -310,   760,  -310}
+    ,{   760,  -830,  -490,   760,  -490}
+    ,{   310, -1260,  -940,   310,  -940}
+    ,{   400, -1190,  -310,   400,  -310}
+    ,{   310, -1260,  -940,   310,  -940}
+    }
+   ,{{   760,  -830,  -490,   760,  -490}
+    ,{   760,  -830,  -490,   760,  -490}
+    ,{   310, -1280,  -940,   310,  -940}
+    ,{ -1680, -2020, -1680, -1680, -1680}
+    ,{   310, -1280,  -940,   310,  -940}
+    }
+   ,{{   400, -1190,  -850,   400,  -850}
+    ,{   400, -1190,  -850,   400,  -850}
+    ,{    90, -1260, -1160,    90, -1160}
+    ,{   400, -1190,  -850,   400,  -850}
+    ,{    90, -1260, -1160,    90, -1160}
+    }
+   ,{{   310, -1280,  -310,   310,  -310}
+    ,{ -1200, -1540, -1200, -1200, -1200}
+    ,{   310, -1280,  -940,   310,  -940}
+    ,{  -310, -1900,  -310, -1560,  -310}
+    ,{   310, -1280,  -940,   310,  -940}
+    }
+   ,{{   400, -1190,  -850,   400,  -850}
+    ,{   400, -1190,  -850,   400,  -850}
+    ,{  -220, -1570, -1470,  -220, -1470}
+    ,{   400, -1190,  -850,   400,  -850}
+    ,{ -1140, -1480, -1140, -1140, -1140}
+    }
+   }
+  ,{{{  -250,  -310,  -310,  -310,  -250}
+    ,{  -250,  -490,  -490,  -490,  -250}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    ,{  -310,  -310,  -310,  -310,  -850}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    }
+   ,{{  -250,  -490,  -490,  -490,  -250}
+    ,{  -250,  -490,  -490,  -490,  -250}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    ,{ -1440, -1680, -1440, -1680, -1680}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    }
+   ,{{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{ -1160, -1160, -1160, -1160, -1160}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{ -1160, -1160, -1160, -1160, -1160}
+    }
+   ,{{  -310,  -310,  -310,  -310,  -940}
+    ,{  -960, -1200,  -960, -1200, -1200}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    ,{  -310,  -310,  -310,  -310, -1560}
+    ,{  -940,  -940,  -940,  -940,  -940}
+    }
+   ,{{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{ -1470, -1470, -1470, -1470, -1470}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{ -1140, -1140, -1140, -1140, -1140}
+    }
+   }
+  }
+ ,{{{{   360,   360,  -150,  -150,  -150}
+    ,{   -30,   -30,  -990,  -150,  -990}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    ,{   360,   360,  -150,  -150,  -150}
+    ,{  -150,  -650, -1400,  -150, -1400}
+    }
+   ,{{   -70,   -70, -1180,  -150, -1180}
+    ,{   -70,   -70, -1580,  -330, -1340}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    ,{  -910,  -910, -1180, -1420, -1180}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    }
+   ,{{  -150,  -890, -1400,  -150, -1400}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    }
+   ,{{   360,   360,  -150,  -150,  -150}
+    ,{   -30,   -30,  -990, -1230,  -990}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    ,{   360,   360,  -150,  -150,  -150}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    }
+   ,{{  -150,  -650, -1400,  -150, -1400}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    ,{  -150,  -890, -1400,  -150, -1400}
+    ,{  -650,  -650, -1400, -1400, -1400}
+    }
+   }
+  ,{{{   360,   360,  -150, -1670,  -150}
+    ,{   -30,   -30, -1230, -1740, -1230}
+    ,{  -890,  -890, -1400, -1670, -1400}
+    ,{   360,   360,  -150, -1910,  -150}
+    ,{  -650,  -650, -1400, -1670, -1400}
+    }
+   ,{{   -70,   -70, -1400, -1910, -1400}
+    ,{   -70,   -70, -1580, -2090, -1580}
+    ,{  -890,  -890, -1400, -1910, -1400}
+    ,{  -910,  -910, -1420, -1930, -1420}
+    ,{  -890,  -890, -1400, -1910, -1400}
+    }
+   ,{{  -890,  -890, -1400, -1670, -1400}
+    ,{  -890,  -890, -1400, -1910, -1400}
+    ,{  -890,  -890, -1400, -1670, -1400}
+    ,{  -890,  -890, -1400, -1910, -1400}
+    ,{  -890,  -890, -1400, -1670, -1400}
+    }
+   ,{{   360,   360,  -150, -1740,  -150}
+    ,{   -30,   -30, -1230, -1740, -1230}
+    ,{  -890,  -890, -1400, -1910, -1400}
+    ,{   360,   360,  -150, -1910,  -150}
+    ,{  -890,  -890, -1400, -1910, -1400}
+    }
+   ,{{  -650,  -650, -1400, -1670, -1400}
+    ,{  -890,  -890, -1400, -1910, -1400}
+    ,{  -890,  -890, -1400, -1670, -1400}
+    ,{  -890,  -890, -1400, -1910, -1400}
+    ,{  -650,  -650, -1400, -1910, -1400}
+    }
+   }
+  ,{{{  -150,  -150,  -150,  -150,  -150}
+    ,{  -990, -1230,  -990, -1230,  -990}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{  -150,  -150,  -150,  -150,  -150}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{ -1180, -1400, -1180, -1400, -1180}
+    ,{ -1580, -1580, -1580, -1580, -1580}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1180, -1420, -1180, -1420, -1180}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{  -150,  -150,  -150,  -150,  -150}
+    ,{  -990, -1230,  -990, -1230,  -990}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{  -150,  -150,  -150,  -150,  -150}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   }
+  ,{{{  -150, -1500,  -150,  -150,  -150}
+    ,{  -150, -1570, -1230,  -150, -1230}
+    ,{  -150, -1500, -1400,  -150, -1400}
+    ,{  -150, -1740,  -150,  -150,  -150}
+    ,{  -150, -1500, -1400,  -150, -1400}
+    }
+   ,{{  -150, -1600, -1400,  -150, -1400}
+    ,{  -330, -1600, -1580,  -330, -1580}
+    ,{  -150, -1740, -1400,  -150, -1400}
+    ,{ -1420, -3040, -1420, -1420, -1420}
+    ,{  -150, -1740, -1400,  -150, -1400}
+    }
+   ,{{  -150, -1500, -1400,  -150, -1400}
+    ,{  -150, -1740, -1400,  -150, -1400}
+    ,{  -150, -1500, -1400,  -150, -1400}
+    ,{  -150, -1740, -1400,  -150, -1400}
+    ,{  -150, -1500, -1400,  -150, -1400}
+    }
+   ,{{  -150, -1570,  -150,  -150,  -150}
+    ,{ -1230, -1570, -1230, -1230, -1230}
+    ,{  -150, -1740, -1400,  -150, -1400}
+    ,{  -150, -1740,  -150, -1400,  -150}
+    ,{  -150, -1740, -1400,  -150, -1400}
+    }
+   ,{{  -150, -1500, -1400,  -150, -1400}
+    ,{  -150, -1740, -1400,  -150, -1400}
+    ,{  -150, -1500, -1400,  -150, -1400}
+    ,{  -150, -1740, -1400,  -150, -1400}
+    ,{ -1400, -1740, -1400, -1400, -1400}
+    }
+   }
+  ,{{{  -150,  -150,  -150,  -150, -1230}
+    ,{  -990, -1230,  -990, -1230, -1230}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{  -150,  -150,  -150,  -150, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{ -1180, -1400, -1180, -1400, -1340}
+    ,{ -1340, -1580, -1580, -1580, -1340}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1180, -1420, -1180, -1420, -1420}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{  -150,  -150,  -150,  -150, -1230}
+    ,{  -990, -1230,  -990, -1230, -1230}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{  -150,  -150,  -150,  -150, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   ,{{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    ,{ -1400, -1400, -1400, -1400, -1400}
+    }
+   }
+  }
+ ,{{{{   910,   910,   400,   910,   400}
+    ,{   910,   170,  -340,   910,  -100}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{   910,   910,   400,   400,   400}
+    ,{   400,  -100,  -850,   400,  -850}
+    }
+   ,{{   910,   170,  -340,   910,  -100}
+    ,{   910,   170,  -340,   910,  -100}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{  -680,  -680,  -950, -1190,  -950}
+    ,{   400,  -340,  -850,   400,  -850}
+    }
+   ,{{   400,  -340,  -850,   400,  -850}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{   400,  -340,  -850,   400,  -850}
+    }
+   ,{{   910,   910,   400,   400,   400}
+    ,{  -850,  -850, -1120, -1360, -1120}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{   910,   910,   400,   400,   400}
+    ,{   400,  -340,  -850,   400,  -850}
+    }
+   ,{{   400,  -100,  -850,   400,  -850}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{   400,  -340,  -850,   400,  -850}
+    ,{  -100,  -100,  -850,  -850,  -850}
+    }
+   }
+  ,{{{   910,   910,   400,  -850,   400}
+    ,{   170,   170,  -340,  -850,  -340}
+    ,{  -340,  -340,  -850, -1120,  -850}
+    ,{   910,   910,   400, -1360,   400}
+    ,{  -100,  -100,  -850, -1120,  -850}
+    }
+   ,{{   170,   170,  -340,  -850,  -340}
+    ,{   170,   170,  -340,  -850,  -340}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    ,{  -680,  -680, -1190, -1700, -1190}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    }
+   ,{{  -340,  -340,  -850, -1120,  -850}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    ,{  -340,  -340,  -850, -1120,  -850}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    ,{  -340,  -340,  -850, -1120,  -850}
+    }
+   ,{{   910,   910,   400, -1360,   400}
+    ,{  -850,  -850, -1360, -1870, -1360}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    ,{   910,   910,   400, -1360,   400}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    }
+   ,{{  -100,  -100,  -850, -1120,  -850}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    ,{  -340,  -340,  -850, -1120,  -850}
+    ,{  -340,  -340,  -850, -1360,  -850}
+    ,{  -100,  -100,  -850, -1360,  -850}
+    }
+   }
+  ,{{{   400,   400,   400,   400,   400}
+    ,{  -340,  -340,  -340,  -340,  -340}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{   400,   400,   400,   400,   400}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    }
+   ,{{  -340,  -340,  -340,  -340,  -340}
+    ,{  -340,  -340,  -340,  -340,  -340}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -950, -1190,  -950, -1190,  -950}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    }
+   ,{{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    }
+   ,{{   400,   400,   400,   400,   400}
+    ,{ -1120, -1360, -1120, -1360, -1120}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{   400,   400,   400,   400,   400}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    }
+   ,{{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    }
+   }
+  ,{{{   910,  -680,   400,   910,   400}
+    ,{   910,  -680,  -340,   910,  -340}
+    ,{   400,  -950,  -850,   400,  -850}
+    ,{   400, -1190,   400,   400,   400}
+    ,{   400,  -950,  -850,   400,  -850}
+    }
+   ,{{   910,  -680,  -340,   910,  -340}
+    ,{   910,  -680,  -340,   910,  -340}
+    ,{   400, -1190,  -850,   400,  -850}
+    ,{ -1190, -1530, -1190, -1190, -1190}
+    ,{   400, -1190,  -850,   400,  -850}
+    }
+   ,{{   400,  -950,  -850,   400,  -850}
+    ,{   400, -1190,  -850,   400,  -850}
+    ,{   400,  -950,  -850,   400,  -850}
+    ,{   400, -1190,  -850,   400,  -850}
+    ,{   400,  -950,  -850,   400,  -850}
+    }
+   ,{{   400, -1190,   400,   400,   400}
+    ,{ -1360, -1700, -1360, -1360, -1360}
+    ,{   400, -1190,  -850,   400,  -850}
+    ,{   400, -1190,   400,  -850,   400}
+    ,{   400, -1190,  -850,   400,  -850}
+    }
+   ,{{   400,  -950,  -850,   400,  -850}
+    ,{   400, -1190,  -850,   400,  -850}
+    ,{   400,  -950,  -850,   400,  -850}
+    ,{   400, -1190,  -850,   400,  -850}
+    ,{  -850, -1190,  -850,  -850,  -850}
+    }
+   }
+  ,{{{   400,   400,   400,   400,  -100}
+    ,{  -100,  -340,  -340,  -340,  -100}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{   400,   400,   400,   400,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    }
+   ,{{  -100,  -340,  -340,  -340,  -100}
+    ,{  -100,  -340,  -340,  -340,  -100}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -950, -1190,  -950, -1190, -1190}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    }
+   ,{{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    }
+   ,{{   400,   400,   400,   400,  -850}
+    ,{ -1120, -1360, -1120, -1360, -1360}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{   400,   400,   400,   400,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    }
+   ,{{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    ,{  -850,  -850,  -850,  -850,  -850}
+    }
+   }
+  }
+ ,{{{{  1490,  1280,   780,  1490,   780}
+    ,{  1490,   750,   240,  1490,   480}
+    ,{  1200,   450,   -50,  1200,   -50}
+    ,{  1280,  1280,   780,  1200,   780}
+    ,{  1200,   450,   -50,  1200,   -50}
+    }
+   ,{{  1490,   750,   240,  1490,   480}
+    ,{  1490,   750,   240,  1490,   480}
+    ,{  1190,   440,   -60,  1190,   -60}
+    ,{  -630,  -630,  -900, -1140,  -900}
+    ,{  1190,   440,   -60,  1190,   -60}
+    }
+   ,{{  1200,   460,   -50,  1200,   -50}
+    ,{  1200,   460,   -50,  1200,   -50}
+    ,{  1200,   450,   -50,  1200,   -50}
+    ,{  1200,   460,   -50,  1200,   -50}
+    ,{  1200,   450,   -50,  1200,   -50}
+    }
+   ,{{  1280,  1280,   780,  1190,   780}
+    ,{  -450,  -450,  -720,  -960,  -720}
+    ,{  1190,   440,   -60,  1190,   -60}
+    ,{  1280,  1280,   780,   780,   780}
+    ,{  1190,   440,   -60,  1190,   -60}
+    }
+   ,{{  1200,   460,   -50,  1200,   -50}
+    ,{  1200,   460,   -50,  1200,   -50}
+    ,{  1200,   450,   -50,  1200,   -50}
+    ,{  1200,   460,   -50,  1200,   -50}
+    ,{  -280,  -280, -1030, -1030, -1030}
+    }
+   }
+  ,{{{  1280,  1280,   780,  -260,   780}
+    ,{   750,   750,   240,  -260,   240}
+    ,{   450,   450,   -50,  -320,   -50}
+    ,{  1280,  1280,   780,  -560,   780}
+    ,{   450,   450,   -50,  -320,   -50}
+    }
+   ,{{   750,   750,   240,  -260,   240}
+    ,{   750,   750,   240,  -260,   240}
+    ,{   440,   440,   -60,  -570,   -60}
+    ,{  -630,  -630, -1140, -1650, -1140}
+    ,{   440,   440,   -60,  -570,   -60}
+    }
+   ,{{   460,   460,   -50,  -320,   -50}
+    ,{   460,   460,   -50,  -560,   -50}
+    ,{   450,   450,   -50,  -320,   -50}
+    ,{   460,   460,   -50,  -560,   -50}
+    ,{   450,   450,   -50,  -320,   -50}
+    }
+   ,{{  1280,  1280,   780,  -570,   780}
+    ,{  -450,  -450,  -960, -1470,  -960}
+    ,{   440,   440,   -60,  -570,   -60}
+    ,{  1280,  1280,   780,  -980,   780}
+    ,{   440,   440,   -60,  -570,   -60}
+    }
+   ,{{   460,   460,   -50,  -320,   -50}
+    ,{   460,   460,   -50,  -560,   -50}
+    ,{   450,   450,   -50,  -320,   -50}
+    ,{   460,   460,   -50,  -560,   -50}
+    ,{  -280,  -280, -1030, -1540, -1030}
+    }
+   }
+  ,{{{   780,   780,   780,   780,   780}
+    ,{   240,   240,   240,   240,   240}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   780,   780,   780,   780,   780}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    }
+   ,{{   240,   240,   240,   240,   240}
+    ,{   240,   240,   240,   240,   240}
+    ,{   -60,   -60,   -60,   -60,   -60}
+    ,{  -900, -1140,  -900, -1140,  -900}
+    ,{   -60,   -60,   -60,   -60,   -60}
+    }
+   ,{{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    }
+   ,{{   780,   780,   780,   780,   780}
+    ,{  -720,  -960,  -720,  -960,  -720}
+    ,{   -60,   -60,   -60,   -60,   -60}
+    ,{   780,   780,   780,   780,   780}
+    ,{   -60,   -60,   -60,   -60,   -60}
+    }
+   ,{{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{ -1030, -1030, -1030, -1030, -1030}
+    }
+   }
+  ,{{{  1490,   -90,   780,  1490,   780}
+    ,{  1490,   -90,   240,  1490,   240}
+    ,{  1200,  -150,   -50,  1200,   -50}
+    ,{  1200,  -390,   780,  1200,   780}
+    ,{  1200,  -150,   -50,  1200,   -50}
+    }
+   ,{{  1490,   -90,   240,  1490,   240}
+    ,{  1490,   -90,   240,  1490,   240}
+    ,{  1190,  -400,   -60,  1190,   -60}
+    ,{ -1140, -1480, -1140, -1140, -1140}
+    ,{  1190,  -400,   -60,  1190,   -60}
+    }
+   ,{{  1200,  -150,   -50,  1200,   -50}
+    ,{  1200,  -390,   -50,  1200,   -50}
+    ,{  1200,  -150,   -50,  1200,   -50}
+    ,{  1200,  -390,   -50,  1200,   -50}
+    ,{  1200,  -150,   -50,  1200,   -50}
+    }
+   ,{{  1190,  -400,   780,  1190,   780}
+    ,{  -960, -1300,  -960,  -960,  -960}
+    ,{  1190,  -400,   -60,  1190,   -60}
+    ,{   780,  -810,   780,  -470,   780}
+    ,{  1190,  -400,   -60,  1190,   -60}
+    }
+   ,{{  1200,  -150,   -50,  1200,   -50}
+    ,{  1200,  -390,   -50,  1200,   -50}
+    ,{  1200,  -150,   -50,  1200,   -50}
+    ,{  1200,  -390,   -50,  1200,   -50}
+    ,{ -1030, -1370, -1030, -1030, -1030}
+    }
+   }
+  ,{{{   780,   780,   780,   780,   480}
+    ,{   480,   240,   240,   240,   480}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   780,   780,   780,   780,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    }
+   ,{{   480,   240,   240,   240,   480}
+    ,{   480,   240,   240,   240,   480}
+    ,{   -60,   -60,   -60,   -60,   -60}
+    ,{  -900, -1140,  -900, -1140, -1140}
+    ,{   -60,   -60,   -60,   -60,   -60}
+    }
+   ,{{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    }
+   ,{{   780,   780,   780,   780,   -60}
+    ,{  -720,  -960,  -720,  -960,  -960}
+    ,{   -60,   -60,   -60,   -60,   -60}
+    ,{   780,   780,   780,   780,  -470}
+    ,{   -60,   -60,   -60,   -60,   -60}
+    }
+   ,{{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{ -1030, -1030, -1030, -1030, -1030}
+    }
+   }
+  }
+ ,{{{{  1560,  1470,   960,  1560,   960}
+    ,{  1560,   820,   310,  1560,   550}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{  1470,  1470,   960,  1430,   960}
+    ,{  1300,   560,    50,  1300,    50}
+    }
+   ,{{  1560,   820,   310,  1560,   550}
+    ,{  1560,   820,   310,  1560,   550}
+    ,{  1280,   540,    30,  1280,    30}
+    ,{  -580,  -580,  -850, -1090,  -850}
+    ,{  1280,   540,    30,  1280,    30}
+    }
+   ,{{  1430,   690,   180,  1430,   180}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{  1300,   560,    50,  1300,    50}
+    }
+   ,{{  1470,  1470,   960,  1280,   960}
+    ,{  -880,  -880, -1150, -1390, -1150}
+    ,{  1280,   540,    30,  1280,    30}
+    ,{  1470,  1470,   960,   960,   960}
+    ,{  1280,   540,    30,  1280,    30}
+    }
+   ,{{  1430,   690,   180,  1430,   180}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{   990,   250,  -260,   990,  -260}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{   -10,   -10,  -760,  -760,  -760}
+    }
+   }
+  ,{{{  1470,  1470,   960,   -90,   960}
+    ,{   820,   820,   310,  -200,   310}
+    ,{   690,   690,   180,   -90,   180}
+    ,{  1470,  1470,   960,  -330,   960}
+    ,{   560,   560,    50,  -220,    50}
+    }
+   ,{{   820,   820,   310,  -200,   310}
+    ,{   820,   820,   310,  -200,   310}
+    ,{   540,   540,    30,  -480,    30}
+    ,{  -580,  -580, -1090, -1600, -1090}
+    ,{   540,   540,    30,  -480,    30}
+    }
+   ,{{   690,   690,   180,   -90,   180}
+    ,{   690,   690,   180,  -330,   180}
+    ,{   690,   690,   180,   -90,   180}
+    ,{   690,   690,   180,  -330,   180}
+    ,{   560,   560,    50,  -220,    50}
+    }
+   ,{{  1470,  1470,   960,  -480,   960}
+    ,{  -880,  -880, -1390, -1900, -1390}
+    ,{   540,   540,    30,  -480,    30}
+    ,{  1470,  1470,   960,  -800,   960}
+    ,{   540,   540,    30,  -480,    30}
+    }
+   ,{{   690,   690,   180,  -330,   180}
+    ,{   690,   690,   180,  -330,   180}
+    ,{   250,   250,  -260,  -530,  -260}
+    ,{   690,   690,   180,  -330,   180}
+    ,{   -10,   -10,  -760, -1270,  -760}
+    }
+   }
+  ,{{{   960,   960,   960,   960,   960}
+    ,{   310,   310,   310,   310,   310}
+    ,{   180,   180,   180,   180,   180}
+    ,{   960,   960,   960,   960,   960}
+    ,{    50,    50,    50,    50,    50}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{    30,    30,    30,    30,    30}
+    ,{  -850, -1090,  -850, -1090,  -850}
+    ,{    30,    30,    30,    30,    30}
+    }
+   ,{{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{    50,    50,    50,    50,    50}
+    }
+   ,{{   960,   960,   960,   960,   960}
+    ,{ -1150, -1390, -1150, -1390, -1150}
+    ,{    30,    30,    30,    30,    30}
+    ,{   960,   960,   960,   960,   960}
+    ,{    30,    30,    30,    30,    30}
+    }
+   ,{{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{  -260,  -260,  -260,  -260,  -260}
+    ,{   180,   180,   180,   180,   180}
+    ,{  -760,  -760,  -760,  -760,  -760}
+    }
+   }
+  ,{{{  1560,    80,   960,  1560,   960}
+    ,{  1560,   -30,   310,  1560,   310}
+    ,{  1430,    80,   180,  1430,   180}
+    ,{  1430,  -160,   960,  1430,   960}
+    ,{  1300,   -50,    50,  1300,    50}
+    }
+   ,{{  1560,   -30,   310,  1560,   310}
+    ,{  1560,   -30,   310,  1560,   310}
+    ,{  1280,  -310,    30,  1280,    30}
+    ,{ -1090, -1430, -1090, -1090, -1090}
+    ,{  1280,  -310,    30,  1280,    30}
+    }
+   ,{{  1430,    80,   180,  1430,   180}
+    ,{  1430,  -160,   180,  1430,   180}
+    ,{  1430,    80,   180,  1430,   180}
+    ,{  1430,  -160,   180,  1430,   180}
+    ,{  1300,   -50,    50,  1300,    50}
+    }
+   ,{{  1280,  -310,   960,  1280,   960}
+    ,{ -1390, -1730, -1390, -1390, -1390}
+    ,{  1280,  -310,    30,  1280,    30}
+    ,{   960,  -630,   960,  -290,   960}
+    ,{  1280,  -310,    30,  1280,    30}
+    }
+   ,{{  1430,  -160,   180,  1430,   180}
+    ,{  1430,  -160,   180,  1430,   180}
+    ,{   990,  -360,  -260,   990,  -260}
+    ,{  1430,  -160,   180,  1430,   180}
+    ,{  -760, -1100,  -760,  -760,  -760}
+    }
+   }
+  ,{{{   960,   960,   960,   960,   550}
+    ,{   550,   310,   310,   310,   550}
+    ,{   180,   180,   180,   180,   180}
+    ,{   960,   960,   960,   960,   180}
+    ,{    50,    50,    50,    50,    50}
+    }
+   ,{{   550,   310,   310,   310,   550}
+    ,{   550,   310,   310,   310,   550}
+    ,{    30,    30,    30,    30,    30}
+    ,{  -850, -1090,  -850, -1090, -1090}
+    ,{    30,    30,    30,    30,    30}
+    }
+   ,{{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{    50,    50,    50,    50,    50}
+    }
+   ,{{   960,   960,   960,   960,    30}
+    ,{ -1150, -1390, -1150, -1390, -1390}
+    ,{    30,    30,    30,    30,    30}
+    ,{   960,   960,   960,   960,  -290}
+    ,{    30,    30,    30,    30,    30}
+    }
+   ,{{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{  -260,  -260,  -260,  -260,  -260}
+    ,{   180,   180,   180,   180,   180}
+    ,{  -760,  -760,  -760,  -760,  -760}
+    }
+   }
+  }
+ ,{{{{  1560,  1470,   960,  1560,   960}
+    ,{  1560,   820,   310,  1560,   550}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{  1470,  1470,   960,  1430,   960}
+    ,{  1300,   560,    50,  1300,    50}
+    }
+   ,{{  1560,   820,   310,  1560,   550}
+    ,{  1560,   820,   310,  1560,   550}
+    ,{  1280,   540,    30,  1280,    30}
+    ,{  -360,  -360,  -630,  -870,  -630}
+    ,{  1280,   540,    30,  1280,    30}
+    }
+   ,{{  1430,   690,   180,  1430,   180}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{  1300,   560,    50,  1300,    50}
+    }
+   ,{{  1470,  1470,   960,  1280,   960}
+    ,{   -30,   -30,  -720,  -960,  -720}
+    ,{  1280,   540,    30,  1280,    30}
+    ,{  1470,  1470,   960,   960,   960}
+    ,{  1280,   540,    30,  1280,    30}
+    }
+   ,{{  1430,   690,   180,  1430,   180}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{  1200,   450,   -50,  1200,   -50}
+    ,{  1430,   690,   180,  1430,   180}
+    ,{   -10,   -10,  -760,  -760,  -760}
+    }
+   }
+  ,{{{  1470,  1470,   960,   -90,   960}
+    ,{   820,   820,   310,  -200,   310}
+    ,{   690,   690,   180,   -90,   180}
+    ,{  1470,  1470,   960,  -330,   960}
+    ,{   560,   560,    50,  -220,    50}
+    }
+   ,{{   820,   820,   310,  -200,   310}
+    ,{   820,   820,   310,  -200,   310}
+    ,{   540,   540,    30,  -480,    30}
+    ,{  -360,  -360,  -870, -1380,  -870}
+    ,{   540,   540,    30,  -480,    30}
+    }
+   ,{{   690,   690,   180,   -90,   180}
+    ,{   690,   690,   180,  -330,   180}
+    ,{   690,   690,   180,   -90,   180}
+    ,{   690,   690,   180,  -330,   180}
+    ,{   560,   560,    50,  -220,    50}
+    }
+   ,{{  1470,  1470,   960,  -480,   960}
+    ,{   -30,   -30,  -960, -1470,  -960}
+    ,{   540,   540,    30,  -480,    30}
+    ,{  1470,  1470,   960,  -800,   960}
+    ,{   540,   540,    30,  -480,    30}
+    }
+   ,{{   690,   690,   180,  -320,   180}
+    ,{   690,   690,   180,  -330,   180}
+    ,{   450,   450,   -50,  -320,   -50}
+    ,{   690,   690,   180,  -330,   180}
+    ,{   -10,   -10,  -760, -1270,  -760}
+    }
+   }
+  ,{{{   960,   960,   960,   960,   960}
+    ,{   310,   310,   310,   310,   310}
+    ,{   180,   180,   180,   180,   180}
+    ,{   960,   960,   960,   960,   960}
+    ,{    50,    50,    50,    50,    50}
+    }
+   ,{{   310,   310,   310,   310,   310}
+    ,{   310,   310,   310,   310,   310}
+    ,{    30,    30,    30,    30,    30}
+    ,{  -630,  -870,  -630,  -870,  -630}
+    ,{    30,    30,    30,    30,    30}
+    }
+   ,{{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{    50,    50,    50,    50,    50}
+    }
+   ,{{   960,   960,   960,   960,   960}
+    ,{  -720,  -960,  -720,  -960,  -720}
+    ,{    30,    30,    30,    30,    30}
+    ,{   960,   960,   960,   960,   960}
+    ,{    30,    30,    30,    30,    30}
+    }
+   ,{{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   180,   180,   180,   180,   180}
+    ,{  -760,  -760,  -760,  -760,  -760}
+    }
+   }
+  ,{{{  1560,    80,   960,  1560,   960}
+    ,{  1560,   -30,   310,  1560,   310}
+    ,{  1430,    80,   180,  1430,   180}
+    ,{  1430,  -160,   960,  1430,   960}
+    ,{  1300,   -50,    50,  1300,    50}
+    }
+   ,{{  1560,   -30,   310,  1560,   310}
+    ,{  1560,   -30,   310,  1560,   310}
+    ,{  1280,  -310,    30,  1280,    30}
+    ,{  -870, -1210,  -870,  -870,  -870}
+    ,{  1280,  -310,    30,  1280,    30}
+    }
+   ,{{  1430,    80,   180,  1430,   180}
+    ,{  1430,  -160,   180,  1430,   180}
+    ,{  1430,    80,   180,  1430,   180}
+    ,{  1430,  -160,   180,  1430,   180}
+    ,{  1300,   -50,    50,  1300,    50}
+    }
+   ,{{  1280,  -310,   960,  1280,   960}
+    ,{  -960, -1300,  -960,  -960,  -960}
+    ,{  1280,  -310,    30,  1280,    30}
+    ,{   960,  -630,   960,  -290,   960}
+    ,{  1280,  -310,    30,  1280,    30}
+    }
+   ,{{  1430,  -150,   180,  1430,   180}
+    ,{  1430,  -160,   180,  1430,   180}
+    ,{  1200,  -150,   -50,  1200,   -50}
+    ,{  1430,  -160,   180,  1430,   180}
+    ,{  -760, -1100,  -760,  -760,  -760}
+    }
+   }
+  ,{{{   960,   960,   960,   960,   550}
+    ,{   550,   310,   310,   310,   550}
+    ,{   180,   180,   180,   180,   180}
+    ,{   960,   960,   960,   960,   180}
+    ,{    50,    50,    50,    50,    50}
+    }
+   ,{{   550,   310,   310,   310,   550}
+    ,{   550,   310,   310,   310,   550}
+    ,{    30,    30,    30,    30,    30}
+    ,{  -630,  -870,  -630,  -870,  -870}
+    ,{    30,    30,    30,    30,    30}
+    }
+   ,{{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{    50,    50,    50,    50,    50}
+    }
+   ,{{   960,   960,   960,   960,    30}
+    ,{  -720,  -960,  -720,  -960,  -960}
+    ,{    30,    30,    30,    30,    30}
+    ,{   960,   960,   960,   960,  -290}
+    ,{    30,    30,    30,    30,    30}
+    }
+   ,{{   180,   180,   180,   180,   180}
+    ,{   180,   180,   180,   180,   180}
+    ,{   -50,   -50,   -50,   -50,   -50}
+    ,{   180,   180,   180,   180,   180}
+    ,{  -760,  -760,  -760,  -760,  -760}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{  1170,   780,   490,  1170,   490}
+    ,{  1120,   580,   290,  1120,   290}
+    ,{  1170,   640,   340,  1170,   340}
+    ,{  1120,   780,   490,  1120,   490}
+    ,{  1060,   530,   230,  1060,   230}
+    }
+   ,{{   970,   440,   170,   970,   170}
+    ,{   970,   440,   140,   970,   140}
+    ,{   660,   130,  -160,   660,  -160}
+    ,{   220,   220,   170,   -80,   170}
+    ,{   660,   130,  -160,   660,  -160}
+    }
+   ,{{  1120,   580,   290,  1120,   290}
+    ,{  1120,   580,   290,  1120,   290}
+    ,{  1110,   580,   280,  1110,   280}
+    ,{  1120,   580,   290,  1120,   290}
+    ,{  1060,   530,   230,  1060,   230}
+    }
+   ,{{   780,   780,   490,   660,   490}
+    ,{   -60,   -60,  -120,  -370,  -120}
+    ,{   660,   130,  -160,   660,  -160}
+    ,{   780,   780,   490,   470,   490}
+    ,{   660,   130,  -160,   660,  -160}
+    }
+   ,{{  1170,   640,   340,  1170,   340}
+    ,{  1120,   580,   290,  1120,   290}
+    ,{  1170,   640,   340,  1170,   340}
+    ,{  1120,   580,   290,  1120,   290}
+    ,{    40,    40,  -500,  -510,  -500}
+    }
+   }
+  ,{{{   780,   780,   490,  -330,   490}
+    ,{   580,   580,   290,  -620,   290}
+    ,{   640,   640,   340,  -330,   340}
+    ,{   780,   780,   490,  -620,   490}
+    ,{   530,   530,   230,  -440,   230}
+    }
+   ,{{   440,   440,   140,  -770,   140}
+    ,{   440,   440,   140,  -770,   140}
+    ,{   130,   130,  -160, -1080,  -160}
+    ,{   220,   220,   -70,  -980,   -70}
+    ,{   130,   130,  -160, -1080,  -160}
+    }
+   ,{{   580,   580,   290,  -390,   290}
+    ,{   580,   580,   290,  -620,   290}
+    ,{   580,   580,   280,  -390,   280}
+    ,{   580,   580,   290,  -620,   290}
+    ,{   530,   530,   230,  -440,   230}
+    }
+   ,{{   780,   780,   490, -1080,   490}
+    ,{   -60,   -60,  -350, -1270,  -350}
+    ,{   130,   130,  -160, -1080,  -160}
+    ,{   780,   780,   490, -1680,   490}
+    ,{   130,   130,  -160, -1080,  -160}
+    }
+   ,{{   640,   640,   340,  -330,   340}
+    ,{   580,   580,   290,  -620,   290}
+    ,{   640,   640,   340,  -330,   340}
+    ,{   580,   580,   290,  -620,   290}
+    ,{    40,    40,  -500, -1410,  -500}
+    }
+   }
+  ,{{{   480,   470,   480,   470,   480}
+    ,{   280,   270,   280,   270,   280}
+    ,{   340,   330,   340,   330,   340}
+    ,{   480,   470,   480,   470,   480}
+    ,{   230,   220,   230,   220,   230}
+    }
+   ,{{   170,   130,   170,   130,   170}
+    ,{   140,   130,   140,   130,   140}
+    ,{  -170,  -180,  -170,  -180,  -170}
+    ,{   170,   -80,   170,   -80,   170}
+    ,{  -170,  -180,  -170,  -180,  -170}
+    }
+   ,{{   280,   270,   280,   270,   280}
+    ,{   280,   270,   280,   270,   280}
+    ,{   280,   270,   280,   270,   280}
+    ,{   280,   270,   280,   270,   280}
+    ,{   230,   220,   230,   220,   230}
+    }
+   ,{{   480,   470,   480,   470,   480}
+    ,{  -120,  -370,  -120,  -370,  -120}
+    ,{  -170,  -180,  -170,  -180,  -170}
+    ,{   480,   470,   480,   470,   480}
+    ,{  -170,  -180,  -170,  -180,  -170}
+    }
+   ,{{   340,   330,   340,   330,   340}
+    ,{   280,   270,   280,   270,   280}
+    ,{   340,   330,   340,   330,   340}
+    ,{   280,   270,   280,   270,   280}
+    ,{  -500,  -510,  -500,  -510,  -500}
+    }
+   }
+  ,{{{  1170,  -510,   490,  1170,   490}
+    ,{  1120,  -800,   290,  1120,   290}
+    ,{  1170,  -510,   340,  1170,   340}
+    ,{  1120,  -800,   490,  1120,   490}
+    ,{  1060,  -620,   230,  1060,   230}
+    }
+   ,{{   970,  -950,   140,   970,   140}
+    ,{   970,  -950,   140,   970,   140}
+    ,{   660, -1260,  -160,   660,  -160}
+    ,{   -70, -1160,   -70,  -490,   -70}
+    ,{   660, -1260,  -160,   660,  -160}
+    }
+   ,{{  1120,  -570,   290,  1120,   290}
+    ,{  1120,  -800,   290,  1120,   290}
+    ,{  1110,  -570,   280,  1110,   280}
+    ,{  1120,  -800,   290,  1120,   290}
+    ,{  1060,  -620,   230,  1060,   230}
+    }
+   ,{{   660, -1260,   490,   660,   490}
+    ,{  -350, -1450,  -350,  -780,  -350}
+    ,{   660, -1260,  -160,   660,  -160}
+    ,{   490, -1860,   490, -1190,   490}
+    ,{   660, -1260,  -160,   660,  -160}
+    }
+   ,{{  1170,  -510,   340,  1170,   340}
+    ,{  1120,  -800,   290,  1120,   290}
+    ,{  1170,  -510,   340,  1170,   340}
+    ,{  1120,  -800,   290,  1120,   290}
+    ,{  -500, -1590,  -500,  -920,  -500}
+    }
+   }
+  ,{{{   480,   470,   480,   470,  -600}
+    ,{   280,   270,   280,   270,  -600}
+    ,{   340,   330,   340,   330,  -640}
+    ,{   480,   470,   480,   470,  -690}
+    ,{   230,   220,   230,   220,  -750}
+    }
+   ,{{   170,   130,   170,   130,  -600}
+    ,{   140,   130,   140,   130,  -600}
+    ,{  -170,  -180,  -170,  -180, -1150}
+    ,{   170,   -80,   170,   -80, -1050}
+    ,{  -170,  -180,  -170,  -180, -1150}
+    }
+   ,{{   280,   270,   280,   270,  -690}
+    ,{   280,   270,   280,   270,  -690}
+    ,{   280,   270,   280,   270,  -700}
+    ,{   280,   270,   280,   270,  -690}
+    ,{   230,   220,   230,   220,  -750}
+    }
+   ,{{   480,   470,   480,   470, -1150}
+    ,{  -120,  -370,  -120,  -370, -1340}
+    ,{  -170,  -180,  -170,  -180, -1150}
+    ,{   480,   470,   480,   470, -1750}
+    ,{  -170,  -180,  -170,  -180, -1150}
+    }
+   ,{{   340,   330,   340,   330,  -640}
+    ,{   280,   270,   280,   270,  -690}
+    ,{   340,   330,   340,   330,  -640}
+    ,{   280,   270,   280,   270,  -690}
+    ,{  -500,  -510,  -500,  -510, -1480}
+    }
+   }
+  }
+ ,{{{{  1140,   780,   490,  1140,   490}
+    ,{  1140,   600,   310,  1140,   310}
+    ,{   690,   150,  -140,   690,  -140}
+    ,{   780,   780,   490,   770,   490}
+    ,{   690,   190,  -140,   690,  -140}
+    }
+   ,{{  1140,   600,   310,  1140,   310}
+    ,{  1140,   600,   310,  1140,   310}
+    ,{   690,   150,  -140,   690,  -140}
+    ,{  -580,  -580,  -640,  -890,  -640}
+    ,{   690,   150,  -140,   690,  -140}
+    }
+   ,{{   770,   240,   -50,   770,   -50}
+    ,{   770,   240,   -50,   770,   -50}
+    ,{   470,   -60,  -360,   470,  -360}
+    ,{   770,   240,   -50,   770,   -50}
+    ,{   470,   -60,  -360,   470,  -360}
+    }
+   ,{{   780,   780,   490,   690,   490}
+    ,{  -110,  -110,  -170,  -420,  -170}
+    ,{   690,   150,  -140,   690,  -140}
+    ,{   780,   780,   490,   470,   490}
+    ,{   690,   150,  -140,   690,  -140}
+    }
+   ,{{   770,   240,   -50,   770,   -50}
+    ,{   770,   240,   -50,   770,   -50}
+    ,{   160,  -370,  -670,   160,  -670}
+    ,{   770,   240,   -50,   770,   -50}
+    ,{   190,   190,  -340,  -360,  -340}
+    }
+   }
+  ,{{{   780,   780,   490,  -600,   490}
+    ,{   600,   600,   310,  -600,   310}
+    ,{   150,   150,  -140, -1030,  -140}
+    ,{   780,   780,   490,  -970,   490}
+    ,{   190,   190,  -140, -1030,  -140}
+    }
+   ,{{   600,   600,   310,  -600,   310}
+    ,{   600,   600,   310,  -600,   310}
+    ,{   150,   150,  -140, -1050,  -140}
+    ,{  -580,  -580,  -880, -1790,  -880}
+    ,{   150,   150,  -140, -1050,  -140}
+    }
+   ,{{   240,   240,   -50,  -970,   -50}
+    ,{   240,   240,   -50,  -970,   -50}
+    ,{   -60,   -60,  -360, -1030,  -360}
+    ,{   240,   240,   -50,  -970,   -50}
+    ,{   -60,   -60,  -360, -1030,  -360}
+    }
+   ,{{   780,   780,   490, -1050,   490}
+    ,{  -110,  -110,  -400, -1320,  -400}
+    ,{   150,   150,  -140, -1050,  -140}
+    ,{   780,   780,   490, -1680,   490}
+    ,{   150,   150,  -140, -1050,  -140}
+    }
+   ,{{   240,   240,   -50,  -970,   -50}
+    ,{   240,   240,   -50,  -970,   -50}
+    ,{  -370,  -370,  -670, -1340,  -670}
+    ,{   240,   240,   -50,  -970,   -50}
+    ,{   190,   190,  -340, -1260,  -340}
+    }
+   }
+  ,{{{   480,   470,   480,   470,   480}
+    ,{   300,   290,   300,   290,   300}
+    ,{  -140,  -150,  -140,  -150,  -140}
+    ,{   480,   470,   480,   470,   480}
+    ,{  -140,  -150,  -140,  -150,  -140}
+    }
+   ,{{   300,   290,   300,   290,   300}
+    ,{   300,   290,   300,   290,   300}
+    ,{  -140,  -150,  -140,  -150,  -140}
+    ,{  -640,  -890,  -640,  -890,  -640}
+    ,{  -140,  -150,  -140,  -150,  -140}
+    }
+   ,{{   -60,   -70,   -60,   -70,   -60}
+    ,{   -60,   -70,   -60,   -70,   -60}
+    ,{  -360,  -370,  -360,  -370,  -360}
+    ,{   -60,   -70,   -60,   -70,   -60}
+    ,{  -360,  -370,  -360,  -370,  -360}
+    }
+   ,{{   480,   470,   480,   470,   480}
+    ,{  -170,  -420,  -170,  -420,  -170}
+    ,{  -140,  -150,  -140,  -150,  -140}
+    ,{   480,   470,   480,   470,   480}
+    ,{  -140,  -150,  -140,  -150,  -140}
+    }
+   ,{{   -60,   -70,   -60,   -70,   -60}
+    ,{   -60,   -70,   -60,   -70,   -60}
+    ,{  -670,  -680,  -670,  -680,  -670}
+    ,{   -60,   -70,   -60,   -70,   -60}
+    ,{  -350,  -360,  -350,  -360,  -350}
+    }
+   }
+  ,{{{  1140,  -780,   490,  1140,   490}
+    ,{  1140,  -780,   310,  1140,   310}
+    ,{   690, -1210,  -140,   690,  -140}
+    ,{   770, -1150,   490,   770,   490}
+    ,{   690, -1210,  -140,   690,  -140}
+    }
+   ,{{  1140,  -780,   310,  1140,   310}
+    ,{  1140,  -780,   310,  1140,   310}
+    ,{   690, -1230,  -140,   690,  -140}
+    ,{  -880, -1970,  -880, -1300,  -880}
+    ,{   690, -1230,  -140,   690,  -140}
+    }
+   ,{{   770, -1150,   -50,   770,   -50}
+    ,{   770, -1150,   -50,   770,   -50}
+    ,{   470, -1210,  -360,   470,  -360}
+    ,{   770, -1150,   -50,   770,   -50}
+    ,{   470, -1210,  -360,   470,  -360}
+    }
+   ,{{   690, -1230,   490,   690,   490}
+    ,{  -400, -1500,  -400,  -830,  -400}
+    ,{   690, -1230,  -140,   690,  -140}
+    ,{   490, -1860,   490, -1190,   490}
+    ,{   690, -1230,  -140,   690,  -140}
+    }
+   ,{{   770, -1150,   -50,   770,   -50}
+    ,{   770, -1150,   -50,   770,   -50}
+    ,{   160, -1520,  -670,   160,  -670}
+    ,{   770, -1150,   -50,   770,   -50}
+    ,{  -340, -1440,  -340,  -770,  -340}
+    }
+   }
+  ,{{{   480,   470,   480,   470,  -430}
+    ,{   300,   290,   300,   290,  -430}
+    ,{  -140,  -150,  -140,  -150, -1120}
+    ,{   480,   470,   480,   470, -1040}
+    ,{  -140,  -150,  -140,  -150, -1120}
+    }
+   ,{{   300,   290,   300,   290,  -430}
+    ,{   300,   290,   300,   290,  -430}
+    ,{  -140,  -150,  -140,  -150, -1120}
+    ,{  -640,  -890,  -640,  -890, -1860}
+    ,{  -140,  -150,  -140,  -150, -1120}
+    }
+   ,{{   -60,   -70,   -60,   -70, -1040}
+    ,{   -60,   -70,   -60,   -70, -1040}
+    ,{  -360,  -370,  -360,  -370, -1340}
+    ,{   -60,   -70,   -60,   -70, -1040}
+    ,{  -360,  -370,  -360,  -370, -1340}
+    }
+   ,{{   480,   470,   480,   470, -1120}
+    ,{  -170,  -420,  -170,  -420, -1390}
+    ,{  -140,  -150,  -140,  -150, -1120}
+    ,{   480,   470,   480,   470, -1750}
+    ,{  -140,  -150,  -140,  -150, -1120}
+    }
+   ,{{   -60,   -70,   -60,   -70, -1040}
+    ,{   -60,   -70,   -60,   -70, -1040}
+    ,{  -670,  -680,  -670,  -680, -1650}
+    ,{   -60,   -70,   -60,   -70, -1040}
+    ,{  -350,  -360,  -350,  -360, -1330}
+    }
+   }
+  }
+ ,{{{{   940,   940,   650,   630,   650}
+    ,{   220,  -130,  -190,   220,  -190}
+    ,{   220,  -310,  -600,   220,  -600}
+    ,{   940,   940,   650,   630,   650}
+    ,{   220,   -70,  -600,   220,  -600}
+    }
+   ,{{   220,  -310,  -380,   220,  -380}
+    ,{    40,  -490,  -780,    40,  -780}
+    ,{   220,  -310,  -600,   220,  -600}
+    ,{  -320,  -320,  -380,  -630,  -380}
+    ,{   220,  -310,  -600,   220,  -600}
+    }
+   ,{{   220,  -310,  -600,   220,  -600}
+    ,{   220,  -310,  -600,   220,  -600}
+    ,{   220,  -310,  -600,   220,  -600}
+    ,{   220,  -310,  -600,   220,  -600}
+    ,{   220,  -310,  -600,   220,  -600}
+    }
+   ,{{   940,   940,   650,   630,   650}
+    ,{  -130,  -130,  -190,  -440,  -190}
+    ,{   220,  -310,  -600,   220,  -600}
+    ,{   940,   940,   650,   630,   650}
+    ,{   220,  -310,  -600,   220,  -600}
+    }
+   ,{{   220,   -70,  -600,   220,  -600}
+    ,{   220,  -310,  -600,   220,  -600}
+    ,{   220,  -310,  -600,   220,  -600}
+    ,{   220,  -310,  -600,   220,  -600}
+    ,{   -70,   -70,  -600,  -620,  -600}
+    }
+   }
+  ,{{{   940,   940,   650, -1280,   650}
+    ,{  -130,  -130,  -430, -1340,  -430}
+    ,{  -310,  -310,  -600, -1280,  -600}
+    ,{   940,   940,   650, -1520,   650}
+    ,{   -70,   -70,  -600, -1280,  -600}
+    }
+   ,{{  -310,  -310,  -600, -1520,  -600}
+    ,{  -490,  -490,  -780, -1700,  -780}
+    ,{  -310,  -310,  -600, -1520,  -600}
+    ,{  -320,  -320,  -620, -1530,  -620}
+    ,{  -310,  -310,  -600, -1520,  -600}
+    }
+   ,{{  -310,  -310,  -600, -1280,  -600}
+    ,{  -310,  -310,  -600, -1520,  -600}
+    ,{  -310,  -310,  -600, -1280,  -600}
+    ,{  -310,  -310,  -600, -1520,  -600}
+    ,{  -310,  -310,  -600, -1280,  -600}
+    }
+   ,{{   940,   940,   650, -1340,   650}
+    ,{  -130,  -130,  -430, -1340,  -430}
+    ,{  -310,  -310,  -600, -1520,  -600}
+    ,{   940,   940,   650, -1520,   650}
+    ,{  -310,  -310,  -600, -1520,  -600}
+    }
+   ,{{   -70,   -70,  -600, -1280,  -600}
+    ,{  -310,  -310,  -600, -1520,  -600}
+    ,{  -310,  -310,  -600, -1280,  -600}
+    ,{  -310,  -310,  -600, -1520,  -600}
+    ,{   -70,   -70,  -600, -1520,  -600}
+    }
+   }
+  ,{{{   640,   630,   640,   630,   640}
+    ,{  -190,  -440,  -190,  -440,  -190}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    ,{   640,   630,   640,   630,   640}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    }
+   ,{{  -380,  -620,  -380,  -620,  -380}
+    ,{  -790,  -800,  -790,  -800,  -790}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    ,{  -380,  -630,  -380,  -630,  -380}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    }
+   ,{{  -610,  -620,  -610,  -620,  -610}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    }
+   ,{{   640,   630,   640,   630,   640}
+    ,{  -190,  -440,  -190,  -440,  -190}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    ,{   640,   630,   640,   630,   640}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    }
+   ,{{  -610,  -620,  -610,  -620,  -610}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    ,{  -610,  -620,  -610,  -620,  -610}
+    }
+   }
+  ,{{{   650, -1460,   650,   220,   650}
+    ,{   220, -1520,  -430,   220,  -430}
+    ,{   220, -1460,  -600,   220,  -600}
+    ,{   650, -1700,   650,   220,   650}
+    ,{   220, -1460,  -600,   220,  -600}
+    }
+   ,{{   220, -1700,  -600,   220,  -600}
+    ,{    40, -1880,  -780,    40,  -780}
+    ,{   220, -1700,  -600,   220,  -600}
+    ,{  -620, -1710,  -620, -1040,  -620}
+    ,{   220, -1700,  -600,   220,  -600}
+    }
+   ,{{   220, -1460,  -600,   220,  -600}
+    ,{   220, -1700,  -600,   220,  -600}
+    ,{   220, -1460,  -600,   220,  -600}
+    ,{   220, -1700,  -600,   220,  -600}
+    ,{   220, -1460,  -600,   220,  -600}
+    }
+   ,{{   650, -1520,   650,   220,   650}
+    ,{  -430, -1520,  -430,  -850,  -430}
+    ,{   220, -1700,  -600,   220,  -600}
+    ,{   650, -1700,   650, -1030,   650}
+    ,{   220, -1700,  -600,   220,  -600}
+    }
+   ,{{   220, -1460,  -600,   220,  -600}
+    ,{   220, -1700,  -600,   220,  -600}
+    ,{   220, -1460,  -600,   220,  -600}
+    ,{   220, -1700,  -600,   220,  -600}
+    ,{  -600, -1700,  -600, -1030,  -600}
+    }
+   }
+  ,{{{   640,   630,   640,   630, -1410}
+    ,{  -190,  -440,  -190,  -440, -1410}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    ,{   640,   630,   640,   630, -1590}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    }
+   ,{{  -380,  -620,  -380,  -620, -1530}
+    ,{  -790,  -800,  -790,  -800, -1530}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    ,{  -380,  -630,  -380,  -630, -1600}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    }
+   ,{{  -610,  -620,  -610,  -620, -1590}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    }
+   ,{{   640,   630,   640,   630, -1410}
+    ,{  -190,  -440,  -190,  -440, -1410}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    ,{   640,   630,   640,   630, -1590}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    }
+   ,{{  -610,  -620,  -610,  -620, -1590}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    ,{  -610,  -620,  -610,  -620, -1590}
+    }
+   }
+  }
+ ,{{{{  1490,  1490,  1200,  1280,  1200}
+    ,{  1280,   750,   460,  1280,   460}
+    ,{   780,   240,   -50,   780,   -50}
+    ,{  1490,  1490,  1200,  1190,  1200}
+    ,{   780,   480,   -50,   780,   -50}
+    }
+   ,{{  1280,   750,   460,  1280,   460}
+    ,{  1280,   750,   460,  1280,   460}
+    ,{   780,   240,   -50,   780,   -50}
+    ,{   -90,   -90,  -150,  -400,  -150}
+    ,{   780,   240,   -50,   780,   -50}
+    }
+   ,{{   780,   240,   -50,   780,   -50}
+    ,{   780,   240,   -50,   780,   -50}
+    ,{   780,   240,   -50,   780,   -50}
+    ,{   780,   240,   -50,   780,   -50}
+    ,{   780,   240,   -50,   780,   -50}
+    }
+   ,{{  1490,  1490,  1200,  1190,  1200}
+    ,{  -260,  -260,  -320,  -570,  -320}
+    ,{   780,   240,   -50,   780,   -50}
+    ,{  1490,  1490,  1200,  1190,  1200}
+    ,{   780,   240,   -50,   780,   -50}
+    }
+   ,{{   780,   480,   -50,   780,   -50}
+    ,{   780,   240,   -50,   780,   -50}
+    ,{   780,   240,   -50,   780,   -50}
+    ,{   780,   240,   -50,   780,   -50}
+    ,{   480,   480,   -50,   -60,   -50}
+    }
+   }
+  ,{{{  1490,  1490,  1200,  -450,  1200}
+    ,{   750,   750,   460,  -450,   460}
+    ,{   240,   240,   -50,  -720,   -50}
+    ,{  1490,  1490,  1200,  -960,  1200}
+    ,{   480,   480,   -50,  -720,   -50}
+    }
+   ,{{   750,   750,   460,  -450,   460}
+    ,{   750,   750,   460,  -450,   460}
+    ,{   240,   240,   -50,  -960,   -50}
+    ,{   -90,   -90,  -390, -1300,  -390}
+    ,{   240,   240,   -50,  -960,   -50}
+    }
+   ,{{   240,   240,   -50,  -720,   -50}
+    ,{   240,   240,   -50,  -960,   -50}
+    ,{   240,   240,   -50,  -720,   -50}
+    ,{   240,   240,   -50,  -960,   -50}
+    ,{   240,   240,   -50,  -720,   -50}
+    }
+   ,{{  1490,  1490,  1200,  -960,  1200}
+    ,{  -260,  -260,  -560, -1470,  -560}
+    ,{   240,   240,   -50,  -960,   -50}
+    ,{  1490,  1490,  1200,  -960,  1200}
+    ,{   240,   240,   -50,  -960,   -50}
+    }
+   ,{{   480,   480,   -50,  -720,   -50}
+    ,{   240,   240,   -50,  -960,   -50}
+    ,{   240,   240,   -50,  -720,   -50}
+    ,{   240,   240,   -50,  -960,   -50}
+    ,{   480,   480,   -50,  -960,   -50}
+    }
+   }
+  ,{{{  1200,  1190,  1200,  1190,  1200}
+    ,{   450,   440,   450,   440,   450}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    ,{  1200,  1190,  1200,  1190,  1200}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    }
+   ,{{   450,   440,   450,   440,   450}
+    ,{   450,   440,   450,   440,   450}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    ,{  -150,  -400,  -150,  -400,  -150}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    }
+   ,{{   -50,   -60,   -50,   -60,   -50}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    }
+   ,{{  1200,  1190,  1200,  1190,  1200}
+    ,{  -320,  -570,  -320,  -570,  -320}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    ,{  1200,  1190,  1200,  1190,  1200}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    }
+   ,{{   -50,   -60,   -50,   -60,   -50}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    ,{   -50,   -60,   -50,   -60,   -50}
+    }
+   }
+  ,{{{  1280,  -630,  1200,  1280,  1200}
+    ,{  1280,  -630,   460,  1280,   460}
+    ,{   780,  -900,   -50,   780,   -50}
+    ,{  1200, -1140,  1200,   780,  1200}
+    ,{   780,  -900,   -50,   780,   -50}
+    }
+   ,{{  1280,  -630,   460,  1280,   460}
+    ,{  1280,  -630,   460,  1280,   460}
+    ,{   780, -1140,   -50,   780,   -50}
+    ,{  -390, -1480,  -390,  -810,  -390}
+    ,{   780, -1140,   -50,   780,   -50}
+    }
+   ,{{   780,  -900,   -50,   780,   -50}
+    ,{   780, -1140,   -50,   780,   -50}
+    ,{   780,  -900,   -50,   780,   -50}
+    ,{   780, -1140,   -50,   780,   -50}
+    ,{   780,  -900,   -50,   780,   -50}
+    }
+   ,{{  1200, -1140,  1200,   780,  1200}
+    ,{  -560, -1650,  -560,  -980,  -560}
+    ,{   780, -1140,   -50,   780,   -50}
+    ,{  1200, -1140,  1200,  -470,  1200}
+    ,{   780, -1140,   -50,   780,   -50}
+    }
+   ,{{   780,  -900,   -50,   780,   -50}
+    ,{   780, -1140,   -50,   780,   -50}
+    ,{   780,  -900,   -50,   780,   -50}
+    ,{   780, -1140,   -50,   780,   -50}
+    ,{   -50, -1140,   -50,  -470,   -50}
+    }
+   }
+  ,{{{  1200,  1190,  1200,  1190,  -280}
+    ,{   450,   440,   450,   440,  -280}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    ,{  1200,  1190,  1200,  1190, -1030}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    }
+   ,{{   450,   440,   450,   440,  -280}
+    ,{   450,   440,   450,   440,  -280}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    ,{  -150,  -400,  -150,  -400, -1370}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    }
+   ,{{   -50,   -60,   -50,   -60, -1030}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    }
+   ,{{  1200,  1190,  1200,  1190, -1030}
+    ,{  -320,  -570,  -320,  -570, -1540}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    ,{  1200,  1190,  1200,  1190, -1030}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    }
+   ,{{   -50,   -60,   -50,   -60, -1030}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    ,{   -50,   -60,   -50,   -60, -1030}
+    }
+   }
+  }
+ ,{{{{  1870,  1870,  1570,  1870,  1570}
+    ,{  1870,  1340,  1040,  1870,  1040}
+    ,{  1570,  1040,   740,  1570,   740}
+    ,{  1870,  1870,  1570,  1570,  1570}
+    ,{  1570,  1040,   740,  1570,   740}
+    }
+   ,{{  1870,  1340,  1040,  1870,  1040}
+    ,{  1870,  1340,  1040,  1870,  1040}
+    ,{  1560,  1030,   730,  1560,   730}
+    ,{   -50,   -50,  -110,  -360,  -110}
+    ,{  1560,  1030,   730,  1560,   730}
+    }
+   ,{{  1570,  1040,   750,  1570,   750}
+    ,{  1570,  1040,   750,  1570,   750}
+    ,{  1570,  1040,   740,  1570,   740}
+    ,{  1570,  1040,   750,  1570,   750}
+    ,{  1570,  1040,   740,  1570,   740}
+    }
+   ,{{  1870,  1870,  1570,  1560,  1570}
+    ,{   130,   130,    70,  -180,    70}
+    ,{  1560,  1030,   730,  1560,   730}
+    ,{  1870,  1870,  1570,  1560,  1570}
+    ,{  1560,  1030,   730,  1560,   730}
+    }
+   ,{{  1570,  1040,   750,  1570,   750}
+    ,{  1570,  1040,   750,  1570,   750}
+    ,{  1570,  1040,   740,  1570,   740}
+    ,{  1570,  1040,   750,  1570,   750}
+    ,{   300,   300,  -230,  -250,  -230}
+    }
+   }
+  ,{{{  1870,  1870,  1570,   130,  1570}
+    ,{  1340,  1340,  1040,   130,  1040}
+    ,{  1040,  1040,   740,    70,   740}
+    ,{  1870,  1870,  1570,  -160,  1570}
+    ,{  1040,  1040,   740,    70,   740}
+    }
+   ,{{  1340,  1340,  1040,   130,  1040}
+    ,{  1340,  1340,  1040,   130,  1040}
+    ,{  1030,  1030,   730,  -180,   730}
+    ,{   -50,   -50,  -340, -1260,  -340}
+    ,{  1030,  1030,   730,  -180,   730}
+    }
+   ,{{  1040,  1040,   750,    70,   750}
+    ,{  1040,  1040,   750,  -160,   750}
+    ,{  1040,  1040,   740,    70,   740}
+    ,{  1040,  1040,   750,  -160,   750}
+    ,{  1040,  1040,   740,    70,   740}
+    }
+   ,{{  1870,  1870,  1570,  -180,  1570}
+    ,{   130,   130,  -160, -1080,  -160}
+    ,{  1030,  1030,   730,  -180,   730}
+    ,{  1870,  1870,  1570,  -590,  1570}
+    ,{  1030,  1030,   730,  -180,   730}
+    }
+   ,{{  1040,  1040,   750,    70,   750}
+    ,{  1040,  1040,   750,  -160,   750}
+    ,{  1040,  1040,   740,    70,   740}
+    ,{  1040,  1040,   750,  -160,   750}
+    ,{   300,   300,  -230, -1150,  -230}
+    }
+   }
+  ,{{{  1570,  1560,  1570,  1560,  1570}
+    ,{  1040,  1030,  1040,  1030,  1040}
+    ,{   740,   730,   740,   730,   740}
+    ,{  1570,  1560,  1570,  1560,  1570}
+    ,{   740,   730,   740,   730,   740}
+    }
+   ,{{  1040,  1030,  1040,  1030,  1040}
+    ,{  1040,  1030,  1040,  1030,  1040}
+    ,{   730,   720,   730,   720,   730}
+    ,{  -110,  -360,  -110,  -360,  -110}
+    ,{   730,   720,   730,   720,   730}
+    }
+   ,{{   740,   730,   740,   730,   740}
+    ,{   740,   730,   740,   730,   740}
+    ,{   740,   730,   740,   730,   740}
+    ,{   740,   730,   740,   730,   740}
+    ,{   740,   730,   740,   730,   740}
+    }
+   ,{{  1570,  1560,  1570,  1560,  1570}
+    ,{    70,  -180,    70,  -180,    70}
+    ,{   730,   720,   730,   720,   730}
+    ,{  1570,  1560,  1570,  1560,  1570}
+    ,{   730,   720,   730,   720,   730}
+    }
+   ,{{   740,   730,   740,   730,   740}
+    ,{   740,   730,   740,   730,   740}
+    ,{   740,   730,   740,   730,   740}
+    ,{   740,   730,   740,   730,   740}
+    ,{  -240,  -250,  -240,  -250,  -240}
+    }
+   }
+  ,{{{  1870,   -50,  1570,  1870,  1570}
+    ,{  1870,   -50,  1040,  1870,  1040}
+    ,{  1570,  -110,   740,  1570,   740}
+    ,{  1570,  -340,  1570,  1570,  1570}
+    ,{  1570,  -110,   740,  1570,   740}
+    }
+   ,{{  1870,   -50,  1040,  1870,  1040}
+    ,{  1870,   -50,  1040,  1870,  1040}
+    ,{  1560,  -360,   730,  1560,   730}
+    ,{  -340, -1440,  -340,  -770,  -340}
+    ,{  1560,  -360,   730,  1560,   730}
+    }
+   ,{{  1570,  -110,   750,  1570,   750}
+    ,{  1570,  -340,   750,  1570,   750}
+    ,{  1570,  -110,   740,  1570,   740}
+    ,{  1570,  -340,   750,  1570,   750}
+    ,{  1570,  -110,   740,  1570,   740}
+    }
+   ,{{  1570,  -360,  1570,  1560,  1570}
+    ,{  -160, -1260,  -160,  -590,  -160}
+    ,{  1560,  -360,   730,  1560,   730}
+    ,{  1570,  -770,  1570,  -100,  1570}
+    ,{  1560,  -360,   730,  1560,   730}
+    }
+   ,{{  1570,  -110,   750,  1570,   750}
+    ,{  1570,  -340,   750,  1570,   750}
+    ,{  1570,  -110,   740,  1570,   740}
+    ,{  1570,  -340,   750,  1570,   750}
+    ,{  -230, -1330,  -230,  -660,  -230}
+    }
+   }
+  ,{{{  1570,  1560,  1570,  1560,   300}
+    ,{  1040,  1030,  1040,  1030,   300}
+    ,{   740,   730,   740,   730,  -240}
+    ,{  1570,  1560,  1570,  1560,  -230}
+    ,{   740,   730,   740,   730,  -240}
+    }
+   ,{{  1040,  1030,  1040,  1030,   300}
+    ,{  1040,  1030,  1040,  1030,   300}
+    ,{   730,   720,   730,   720,  -250}
+    ,{  -110,  -360,  -110,  -360, -1330}
+    ,{   730,   720,   730,   720,  -250}
+    }
+   ,{{   740,   730,   740,   730,  -230}
+    ,{   740,   730,   740,   730,  -230}
+    ,{   740,   730,   740,   730,  -240}
+    ,{   740,   730,   740,   730,  -230}
+    ,{   740,   730,   740,   730,  -240}
+    }
+   ,{{  1570,  1560,  1570,  1560,  -250}
+    ,{    70,  -180,    70,  -180, -1150}
+    ,{   730,   720,   730,   720,  -250}
+    ,{  1570,  1560,  1570,  1560,  -660}
+    ,{   730,   720,   730,   720,  -250}
+    }
+   ,{{   740,   730,   740,   730,  -230}
+    ,{   740,   730,   740,   730,  -230}
+    ,{   740,   730,   740,   730,  -240}
+    ,{   740,   730,   740,   730,  -230}
+    ,{  -240,  -250,  -240,  -250, -1220}
+    }
+   }
+  }
+ ,{{{{  2050,  2050,  1760,  1930,  1760}
+    ,{  1930,  1400,  1110,  1930,  1110}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{  2050,  2050,  1760,  1800,  1760}
+    ,{  1670,  1140,   850,  1670,   850}
+    }
+   ,{{  1930,  1400,  1110,  1930,  1110}
+    ,{  1930,  1400,  1110,  1930,  1110}
+    ,{  1650,  1120,   830,  1650,   830}
+    ,{     0,     0,   -60,  -310,   -60}
+    ,{  1650,  1120,   830,  1650,   830}
+    }
+   ,{{  1800,  1270,   980,  1800,   980}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{  1670,  1140,   850,  1670,   850}
+    }
+   ,{{  2050,  2050,  1760,  1740,  1760}
+    ,{  -300,  -300,  -360,  -610,  -360}
+    ,{  1650,  1120,   830,  1650,   830}
+    ,{  2050,  2050,  1760,  1740,  1760}
+    ,{  1650,  1120,   830,  1650,   830}
+    }
+   ,{{  1800,  1270,   980,  1800,   980}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{  1360,   830,   540,  1360,   540}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{   570,   570,    40,    20,    40}
+    }
+   }
+  ,{{{  2050,  2050,  1760,   300,  1760}
+    ,{  1400,  1400,  1110,   190,  1110}
+    ,{  1270,  1270,   980,   300,   980}
+    ,{  2050,  2050,  1760,    60,  1760}
+    ,{  1140,  1140,   850,   180,   850}
+    }
+   ,{{  1400,  1400,  1110,   190,  1110}
+    ,{  1400,  1400,  1110,   190,  1110}
+    ,{  1120,  1120,   830,   -80,   830}
+    ,{     0,     0,  -290, -1210,  -290}
+    ,{  1120,  1120,   830,   -80,   830}
+    }
+   ,{{  1270,  1270,   980,   300,   980}
+    ,{  1270,  1270,   980,    60,   980}
+    ,{  1270,  1270,   980,   300,   980}
+    ,{  1270,  1270,   980,    60,   980}
+    ,{  1140,  1140,   850,   180,   850}
+    }
+   ,{{  2050,  2050,  1760,   -80,  1760}
+    ,{  -300,  -300,  -590, -1510,  -590}
+    ,{  1120,  1120,   830,   -80,   830}
+    ,{  2050,  2050,  1760,  -400,  1760}
+    ,{  1120,  1120,   830,   -80,   830}
+    }
+   ,{{  1270,  1270,   980,    60,   980}
+    ,{  1270,  1270,   980,    60,   980}
+    ,{   830,   830,   540,  -130,   540}
+    ,{  1270,  1270,   980,    60,   980}
+    ,{   570,   570,    40,  -870,    40}
+    }
+   }
+  ,{{{  1750,  1740,  1750,  1740,  1750}
+    ,{  1100,  1090,  1100,  1090,  1100}
+    ,{   970,   960,   970,   960,   970}
+    ,{  1750,  1740,  1750,  1740,  1750}
+    ,{   840,   830,   840,   830,   840}
+    }
+   ,{{  1100,  1090,  1100,  1090,  1100}
+    ,{  1100,  1090,  1100,  1090,  1100}
+    ,{   820,   810,   820,   810,   820}
+    ,{   -60,  -310,   -60,  -310,   -60}
+    ,{   820,   810,   820,   810,   820}
+    }
+   ,{{   970,   960,   970,   960,   970}
+    ,{   970,   960,   970,   960,   970}
+    ,{   970,   960,   970,   960,   970}
+    ,{   970,   960,   970,   960,   970}
+    ,{   840,   830,   840,   830,   840}
+    }
+   ,{{  1750,  1740,  1750,  1740,  1750}
+    ,{  -360,  -610,  -360,  -610,  -360}
+    ,{   820,   810,   820,   810,   820}
+    ,{  1750,  1740,  1750,  1740,  1750}
+    ,{   820,   810,   820,   810,   820}
+    }
+   ,{{   970,   960,   970,   960,   970}
+    ,{   970,   960,   970,   960,   970}
+    ,{   530,   520,   530,   520,   530}
+    ,{   970,   960,   970,   960,   970}
+    ,{    30,    20,    30,    20,    30}
+    }
+   }
+  ,{{{  1930,   130,  1760,  1930,  1760}
+    ,{  1930,    10,  1110,  1930,  1110}
+    ,{  1800,   130,   980,  1800,   980}
+    ,{  1800,  -110,  1760,  1800,  1760}
+    ,{  1670,     0,   850,  1670,   850}
+    }
+   ,{{  1930,    10,  1110,  1930,  1110}
+    ,{  1930,    10,  1110,  1930,  1110}
+    ,{  1650,  -260,   830,  1650,   830}
+    ,{  -290, -1390,  -290,  -720,  -290}
+    ,{  1650,  -260,   830,  1650,   830}
+    }
+   ,{{  1800,   130,   980,  1800,   980}
+    ,{  1800,  -110,   980,  1800,   980}
+    ,{  1800,   130,   980,  1800,   980}
+    ,{  1800,  -110,   980,  1800,   980}
+    ,{  1670,     0,   850,  1670,   850}
+    }
+   ,{{  1760,  -260,  1760,  1650,  1760}
+    ,{  -590, -1690,  -590, -1020,  -590}
+    ,{  1650,  -260,   830,  1650,   830}
+    ,{  1760,  -580,  1760,    80,  1760}
+    ,{  1650,  -260,   830,  1650,   830}
+    }
+   ,{{  1800,  -110,   980,  1800,   980}
+    ,{  1800,  -110,   980,  1800,   980}
+    ,{  1360,  -310,   540,  1360,   540}
+    ,{  1800,  -110,   980,  1800,   980}
+    ,{    40, -1050,    40,  -380,    40}
+    }
+   }
+  ,{{{  1750,  1740,  1750,  1740,   360}
+    ,{  1100,  1090,  1100,  1090,   360}
+    ,{   970,   960,   970,   960,     0}
+    ,{  1750,  1740,  1750,  1740,     0}
+    ,{   840,   830,   840,   830,  -130}
+    }
+   ,{{  1100,  1090,  1100,  1090,   360}
+    ,{  1100,  1090,  1100,  1090,   360}
+    ,{   820,   810,   820,   810,  -150}
+    ,{   -60,  -310,   -60,  -310, -1280}
+    ,{   820,   810,   820,   810,  -150}
+    }
+   ,{{   970,   960,   970,   960,     0}
+    ,{   970,   960,   970,   960,     0}
+    ,{   970,   960,   970,   960,     0}
+    ,{   970,   960,   970,   960,     0}
+    ,{   840,   830,   840,   830,  -130}
+    }
+   ,{{  1750,  1740,  1750,  1740,  -150}
+    ,{  -360,  -610,  -360,  -610, -1580}
+    ,{   820,   810,   820,   810,  -150}
+    ,{  1750,  1740,  1750,  1740,  -470}
+    ,{   820,   810,   820,   810,  -150}
+    }
+   ,{{   970,   960,   970,   960,     0}
+    ,{   970,   960,   970,   960,     0}
+    ,{   530,   520,   530,   520,  -440}
+    ,{   970,   960,   970,   960,     0}
+    ,{    30,    20,    30,    20,  -940}
+    }
+   }
+  }
+ ,{{{{  2050,  2050,  1760,  1930,  1760}
+    ,{  1930,  1400,  1110,  1930,  1110}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{  2050,  2050,  1760,  1800,  1760}
+    ,{  1670,  1140,   850,  1670,   850}
+    }
+   ,{{  1930,  1400,  1110,  1930,  1110}
+    ,{  1930,  1400,  1110,  1930,  1110}
+    ,{  1650,  1120,   830,  1650,   830}
+    ,{   220,   220,   170,   -80,   170}
+    ,{  1650,  1120,   830,  1650,   830}
+    }
+   ,{{  1800,  1270,   980,  1800,   980}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{  1670,  1140,   850,  1670,   850}
+    }
+   ,{{  2050,  2050,  1760,  1740,  1760}
+    ,{   130,   130,    70,  -180,    70}
+    ,{  1650,  1120,   830,  1650,   830}
+    ,{  2050,  2050,  1760,  1740,  1760}
+    ,{  1650,  1120,   830,  1650,   830}
+    }
+   ,{{  1800,  1270,   980,  1800,   980}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{  1570,  1040,   740,  1570,   740}
+    ,{  1800,  1270,   980,  1800,   980}
+    ,{   570,   570,    40,    20,    40}
+    }
+   }
+  ,{{{  2050,  2050,  1760,   300,  1760}
+    ,{  1400,  1400,  1110,   190,  1110}
+    ,{  1270,  1270,   980,   300,   980}
+    ,{  2050,  2050,  1760,    60,  1760}
+    ,{  1140,  1140,   850,   180,   850}
+    }
+   ,{{  1400,  1400,  1110,   190,  1110}
+    ,{  1400,  1400,  1110,   190,  1110}
+    ,{  1120,  1120,   830,   -80,   830}
+    ,{   220,   220,   -70,  -980,   -70}
+    ,{  1120,  1120,   830,   -80,   830}
+    }
+   ,{{  1270,  1270,   980,   300,   980}
+    ,{  1270,  1270,   980,    60,   980}
+    ,{  1270,  1270,   980,   300,   980}
+    ,{  1270,  1270,   980,    60,   980}
+    ,{  1140,  1140,   850,   180,   850}
+    }
+   ,{{  2050,  2050,  1760,   -80,  1760}
+    ,{   130,   130,  -160, -1080,  -160}
+    ,{  1120,  1120,   830,   -80,   830}
+    ,{  2050,  2050,  1760,  -400,  1760}
+    ,{  1120,  1120,   830,   -80,   830}
+    }
+   ,{{  1270,  1270,   980,    70,   980}
+    ,{  1270,  1270,   980,    60,   980}
+    ,{  1040,  1040,   740,    70,   740}
+    ,{  1270,  1270,   980,    60,   980}
+    ,{   570,   570,    40,  -870,    40}
+    }
+   }
+  ,{{{  1750,  1740,  1750,  1740,  1750}
+    ,{  1100,  1090,  1100,  1090,  1100}
+    ,{   970,   960,   970,   960,   970}
+    ,{  1750,  1740,  1750,  1740,  1750}
+    ,{   840,   830,   840,   830,   840}
+    }
+   ,{{  1100,  1090,  1100,  1090,  1100}
+    ,{  1100,  1090,  1100,  1090,  1100}
+    ,{   820,   810,   820,   810,   820}
+    ,{   170,   -80,   170,   -80,   170}
+    ,{   820,   810,   820,   810,   820}
+    }
+   ,{{   970,   960,   970,   960,   970}
+    ,{   970,   960,   970,   960,   970}
+    ,{   970,   960,   970,   960,   970}
+    ,{   970,   960,   970,   960,   970}
+    ,{   840,   830,   840,   830,   840}
+    }
+   ,{{  1750,  1740,  1750,  1740,  1750}
+    ,{    70,  -180,    70,  -180,    70}
+    ,{   820,   810,   820,   810,   820}
+    ,{  1750,  1740,  1750,  1740,  1750}
+    ,{   820,   810,   820,   810,   820}
+    }
+   ,{{   970,   960,   970,   960,   970}
+    ,{   970,   960,   970,   960,   970}
+    ,{   740,   730,   740,   730,   740}
+    ,{   970,   960,   970,   960,   970}
+    ,{    30,    20,    30,    20,    30}
+    }
+   }
+  ,{{{  1930,   130,  1760,  1930,  1760}
+    ,{  1930,    10,  1110,  1930,  1110}
+    ,{  1800,   130,   980,  1800,   980}
+    ,{  1800,  -110,  1760,  1800,  1760}
+    ,{  1670,     0,   850,  1670,   850}
+    }
+   ,{{  1930,    10,  1110,  1930,  1110}
+    ,{  1930,    10,  1110,  1930,  1110}
+    ,{  1650,  -260,   830,  1650,   830}
+    ,{   -70, -1160,   -70,  -490,   -70}
+    ,{  1650,  -260,   830,  1650,   830}
+    }
+   ,{{  1800,   130,   980,  1800,   980}
+    ,{  1800,  -110,   980,  1800,   980}
+    ,{  1800,   130,   980,  1800,   980}
+    ,{  1800,  -110,   980,  1800,   980}
+    ,{  1670,     0,   850,  1670,   850}
+    }
+   ,{{  1760,  -260,  1760,  1650,  1760}
+    ,{  -160, -1260,  -160,  -590,  -160}
+    ,{  1650,  -260,   830,  1650,   830}
+    ,{  1760,  -580,  1760,    80,  1760}
+    ,{  1650,  -260,   830,  1650,   830}
+    }
+   ,{{  1800,  -110,   980,  1800,   980}
+    ,{  1800,  -110,   980,  1800,   980}
+    ,{  1570,  -110,   740,  1570,   740}
+    ,{  1800,  -110,   980,  1800,   980}
+    ,{    40, -1050,    40,  -380,    40}
+    }
+   }
+  ,{{{  1750,  1740,  1750,  1740,   360}
+    ,{  1100,  1090,  1100,  1090,   360}
+    ,{   970,   960,   970,   960,     0}
+    ,{  1750,  1740,  1750,  1740,     0}
+    ,{   840,   830,   840,   830,  -130}
+    }
+   ,{{  1100,  1090,  1100,  1090,   360}
+    ,{  1100,  1090,  1100,  1090,   360}
+    ,{   820,   810,   820,   810,  -150}
+    ,{   170,   -80,   170,   -80, -1050}
+    ,{   820,   810,   820,   810,  -150}
+    }
+   ,{{   970,   960,   970,   960,     0}
+    ,{   970,   960,   970,   960,     0}
+    ,{   970,   960,   970,   960,     0}
+    ,{   970,   960,   970,   960,     0}
+    ,{   840,   830,   840,   830,  -130}
+    }
+   ,{{  1750,  1740,  1750,  1740,  -150}
+    ,{    70,  -180,    70,  -180, -1150}
+    ,{   820,   810,   820,   810,  -150}
+    ,{  1750,  1740,  1750,  1740,  -470}
+    ,{   820,   810,   820,   810,  -150}
+    }
+   ,{{   970,   960,   970,   960,     0}
+    ,{   970,   960,   970,   960,     0}
+    ,{   740,   730,   740,   730,  -240}
+    ,{   970,   960,   970,   960,     0}
+    ,{    30,    20,    30,    20,  -940}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{  1350,   850,   720,  1350,   720}
+    ,{  1300,   650,   520,  1300,   520}
+    ,{  1350,   700,   570,  1350,   570}
+    ,{  1300,   850,   720,  1300,   720}
+    ,{  1250,   590,   460,  1250,   460}
+    }
+   ,{{  1160,   500,   400,  1160,   370}
+    ,{  1160,   500,   370,  1160,   370}
+    ,{   850,   190,    60,   850,    60}
+    ,{   400,   290,   400,    10,   160}
+    ,{   850,   190,    60,   850,    60}
+    }
+   ,{{  1300,   650,   520,  1300,   520}
+    ,{  1300,   650,   520,  1300,   520}
+    ,{  1290,   640,   510,  1290,   510}
+    ,{  1300,   650,   520,  1300,   520}
+    ,{  1250,   590,   460,  1250,   460}
+    }
+   ,{{   850,   850,   720,   850,   720}
+    ,{   120,     0,   120,  -270,  -120}
+    ,{   850,   190,    60,   850,    60}
+    ,{   850,   850,   720,   570,   720}
+    ,{   850,   190,    60,   850,    60}
+    }
+   ,{{  1350,   700,   570,  1350,   570}
+    ,{  1300,   650,   520,  1300,   520}
+    ,{  1350,   700,   570,  1350,   570}
+    ,{  1300,   650,   520,  1300,   520}
+    ,{   100,   100,  -270,  -420,  -270}
+    }
+   }
+  ,{{{   850,   850,   720,  -760,   720}
+    ,{   650,   650,   520, -1050,   520}
+    ,{   700,   700,   570,  -760,   570}
+    ,{   850,   850,   720, -1050,   720}
+    ,{   590,   590,   460,  -870,   460}
+    }
+   ,{{   500,   500,   370, -1200,   370}
+    ,{   500,   500,   370, -1200,   370}
+    ,{   190,   190,    60, -1510,    60}
+    ,{   290,   290,   160, -1410,   160}
+    ,{   190,   190,    60, -1510,    60}
+    }
+   ,{{   650,   650,   520,  -820,   520}
+    ,{   650,   650,   520, -1050,   520}
+    ,{   640,   640,   510,  -820,   510}
+    ,{   650,   650,   520, -1050,   520}
+    ,{   590,   590,   460,  -870,   460}
+    }
+   ,{{   850,   850,   720, -1510,   720}
+    ,{     0,     0,  -120, -1700,  -120}
+    ,{   190,   190,    60, -1510,    60}
+    ,{   850,   850,   720, -2110,   720}
+    ,{   190,   190,    60, -1510,    60}
+    }
+   ,{{   700,   700,   570,  -760,   570}
+    ,{   650,   650,   520, -1050,   520}
+    ,{   700,   700,   570,  -760,   570}
+    ,{   650,   650,   520, -1050,   520}
+    ,{   100,   100,  -270, -1840,  -270}
+    }
+   }
+  ,{{{   720,   570,   720,   570,   280}
+    ,{   520,   370,   520,   370,    80}
+    ,{   570,   420,   570,   420,   130}
+    ,{   720,   570,   720,   570,   280}
+    ,{   460,   310,   460,   310,    20}
+    }
+   ,{{   400,   220,   400,   220,   -40}
+    ,{   370,   220,   370,   220,   -60}
+    ,{    60,   -80,    60,   -80,  -370}
+    ,{   400,    10,   400,    10,   -40}
+    ,{    60,   -80,    60,   -80,  -370}
+    }
+   ,{{   520,   370,   520,   370,    80}
+    ,{   520,   370,   520,   370,    80}
+    ,{   510,   360,   510,   360,    70}
+    ,{   520,   370,   520,   370,    80}
+    ,{   460,   310,   460,   310,    20}
+    }
+   ,{{   720,   570,   720,   570,   280}
+    ,{   120,  -270,   120,  -270,  -320}
+    ,{    60,   -80,    60,   -80,  -370}
+    ,{   720,   570,   720,   570,   280}
+    ,{    60,   -80,    60,   -80,  -370}
+    }
+   ,{{   570,   420,   570,   420,   130}
+    ,{   520,   370,   520,   370,    80}
+    ,{   570,   420,   570,   420,   130}
+    ,{   520,   370,   520,   370,    80}
+    ,{  -270,  -420,  -270,  -420,  -710}
+    }
+   }
+  ,{{{  1350,  -460,   720,  1350,   720}
+    ,{  1300,  -750,   520,  1300,   520}
+    ,{  1350,  -460,   570,  1350,   570}
+    ,{  1300,  -750,   720,  1300,   720}
+    ,{  1250,  -570,   460,  1250,   460}
+    }
+   ,{{  1160,  -900,   370,  1160,   370}
+    ,{  1160,  -900,   370,  1160,   370}
+    ,{   850, -1210,    60,   850,    60}
+    ,{   160, -1110,   160,  -310,   160}
+    ,{   850, -1210,    60,   850,    60}
+    }
+   ,{{  1300,  -520,   520,  1300,   520}
+    ,{  1300,  -750,   520,  1300,   520}
+    ,{  1290,  -520,   510,  1290,   510}
+    ,{  1300,  -750,   520,  1300,   520}
+    ,{  1250,  -570,   460,  1250,   460}
+    }
+   ,{{   850, -1210,   720,   850,   720}
+    ,{  -120, -1400,  -120,  -590,  -120}
+    ,{   850, -1210,    60,   850,    60}
+    ,{   720, -1810,   720, -1000,   720}
+    ,{   850, -1210,    60,   850,    60}
+    }
+   ,{{  1350,  -460,   570,  1350,   570}
+    ,{  1300,  -750,   520,  1300,   520}
+    ,{  1350,  -460,   570,  1350,   570}
+    ,{  1300,  -750,   520,  1300,   520}
+    ,{  -270, -1540,  -270,  -740,  -270}
+    }
+   }
+  ,{{{   590,   570,   590,   570,  -320}
+    ,{   390,   370,   390,   370,  -320}
+    ,{   440,   420,   440,   420,  -360}
+    ,{   590,   570,   590,   570,  -420}
+    ,{   330,   310,   330,   310,  -470}
+    }
+   ,{{   270,   220,   270,   220,  -320}
+    ,{   240,   220,   240,   220,  -320}
+    ,{   -60,   -80,   -60,   -80,  -870}
+    ,{   270,    10,   270,    10,  -780}
+    ,{   -60,   -80,   -60,   -80,  -870}
+    }
+   ,{{   390,   370,   390,   370,  -420}
+    ,{   390,   370,   390,   370,  -420}
+    ,{   380,   360,   380,   360,  -420}
+    ,{   390,   370,   390,   370,  -420}
+    ,{   330,   310,   330,   310,  -470}
+    }
+   ,{{   590,   570,   590,   570,  -870}
+    ,{   -10,  -270,   -10,  -270, -1060}
+    ,{   -60,   -80,   -60,   -80,  -870}
+    ,{   590,   570,   590,   570, -1470}
+    ,{   -60,   -80,   -60,   -80,  -870}
+    }
+   ,{{   440,   420,   440,   420,  -360}
+    ,{   390,   370,   390,   370,  -420}
+    ,{   440,   420,   440,   420,  -360}
+    ,{   390,   370,   390,   370,  -420}
+    ,{  -400,  -420,  -400,  -420, -1210}
+    }
+   }
+  }
+ ,{{{{  1320,   850,   720,  1320,   720}
+    ,{  1320,   670,   540,  1320,   540}
+    ,{   870,   220,    90,   870,    90}
+    ,{   960,   850,   720,   960,   720}
+    ,{   870,   250,    90,   870,    90}
+    }
+   ,{{  1320,   670,   540,  1320,   540}
+    ,{  1320,   670,   540,  1320,   540}
+    ,{   870,   220,    90,   870,    90}
+    ,{  -410,  -520,  -410,  -800,  -650}
+    ,{   870,   220,    90,   870,    90}
+    }
+   ,{{   960,   300,   170,   960,   170}
+    ,{   960,   300,   170,   960,   170}
+    ,{   650,     0,  -130,   650,  -130}
+    ,{   960,   300,   170,   960,   170}
+    ,{   650,     0,  -130,   650,  -130}
+    }
+   ,{{   870,   850,   720,   870,   720}
+    ,{    70,   -40,    70,  -320,  -170}
+    ,{   870,   220,    90,   870,    90}
+    ,{   850,   850,   720,   570,   720}
+    ,{   870,   220,    90,   870,    90}
+    }
+   ,{{   960,   300,   170,   960,   170}
+    ,{   960,   300,   170,   960,   170}
+    ,{   340,  -310,  -440,   340,  -440}
+    ,{   960,   300,   170,   960,   170}
+    ,{   250,   250,  -110,  -260,  -110}
+    }
+   }
+  ,{{{   850,   850,   720, -1030,   720}
+    ,{   670,   670,   540, -1030,   540}
+    ,{   220,   220,    90, -1460,    90}
+    ,{   850,   850,   720, -1400,   720}
+    ,{   250,   250,    90, -1460,    90}
+    }
+   ,{{   670,   670,   540, -1030,   540}
+    ,{   670,   670,   540, -1030,   540}
+    ,{   220,   220,    90, -1480,    90}
+    ,{  -520,  -520,  -650, -2220,  -650}
+    ,{   220,   220,    90, -1480,    90}
+    }
+   ,{{   300,   300,   170, -1400,   170}
+    ,{   300,   300,   170, -1400,   170}
+    ,{     0,     0,  -130, -1460,  -130}
+    ,{   300,   300,   170, -1400,   170}
+    ,{     0,     0,  -130, -1460,  -130}
+    }
+   ,{{   850,   850,   720, -1480,   720}
+    ,{   -40,   -40,  -170, -1750,  -170}
+    ,{   220,   220,    90, -1480,    90}
+    ,{   850,   850,   720, -2110,   720}
+    ,{   220,   220,    90, -1480,    90}
+    }
+   ,{{   300,   300,   170, -1400,   170}
+    ,{   300,   300,   170, -1400,   170}
+    ,{  -310,  -310,  -440, -1770,  -440}
+    ,{   300,   300,   170, -1400,   170}
+    ,{   250,   250,  -110, -1690,  -110}
+    }
+   }
+  ,{{{   720,   570,   720,   570,   280}
+    ,{   540,   390,   540,   390,   100}
+    ,{    90,   -60,    90,   -60,  -350}
+    ,{   720,   570,   720,   570,   280}
+    ,{    90,   -60,    90,   -60,  -350}
+    }
+   ,{{   540,   390,   540,   390,   100}
+    ,{   540,   390,   540,   390,   100}
+    ,{    90,   -60,    90,   -60,  -350}
+    ,{  -410,  -800,  -410,  -800,  -850}
+    ,{    90,   -60,    90,   -60,  -350}
+    }
+   ,{{   170,    20,   170,    20,  -260}
+    ,{   170,    20,   170,    20,  -260}
+    ,{  -130,  -280,  -130,  -280,  -570}
+    ,{   170,    20,   170,    20,  -260}
+    ,{  -130,  -280,  -130,  -280,  -570}
+    }
+   ,{{   720,   570,   720,   570,   280}
+    ,{    70,  -320,    70,  -320,  -370}
+    ,{    90,   -60,    90,   -60,  -350}
+    ,{   720,   570,   720,   570,   280}
+    ,{    90,   -60,    90,   -60,  -350}
+    }
+   ,{{   170,    20,   170,    20,  -260}
+    ,{   170,    20,   170,    20,  -260}
+    ,{  -440,  -590,  -440,  -590,  -880}
+    ,{   170,    20,   170,    20,  -260}
+    ,{  -110,  -260,  -110,  -260,  -550}
+    }
+   }
+  ,{{{  1320,  -730,   720,  1320,   720}
+    ,{  1320,  -730,   540,  1320,   540}
+    ,{   870, -1160,    90,   870,    90}
+    ,{   960, -1100,   720,   960,   720}
+    ,{   870, -1160,    90,   870,    90}
+    }
+   ,{{  1320,  -730,   540,  1320,   540}
+    ,{  1320,  -730,   540,  1320,   540}
+    ,{   870, -1180,    90,   870,    90}
+    ,{  -650, -1920,  -650, -1120,  -650}
+    ,{   870, -1180,    90,   870,    90}
+    }
+   ,{{   960, -1100,   170,   960,   170}
+    ,{   960, -1100,   170,   960,   170}
+    ,{   650, -1160,  -130,   650,  -130}
+    ,{   960, -1100,   170,   960,   170}
+    ,{   650, -1160,  -130,   650,  -130}
+    }
+   ,{{   870, -1180,   720,   870,   720}
+    ,{  -170, -1450,  -170,  -640,  -170}
+    ,{   870, -1180,    90,   870,    90}
+    ,{   720, -1810,   720, -1000,   720}
+    ,{   870, -1180,    90,   870,    90}
+    }
+   ,{{   960, -1100,   170,   960,   170}
+    ,{   960, -1100,   170,   960,   170}
+    ,{   340, -1470,  -440,   340,  -440}
+    ,{   960, -1100,   170,   960,   170}
+    ,{  -110, -1390,  -110,  -580,  -110}
+    }
+   }
+  ,{{{   590,   570,   590,   570,  -160}
+    ,{   410,   390,   410,   390,  -160}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    ,{   590,   570,   590,   570,  -760}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    }
+   ,{{   410,   390,   410,   390,  -160}
+    ,{   410,   390,   410,   390,  -160}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    ,{  -540,  -800,  -540,  -800, -1590}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    }
+   ,{{    40,    20,    40,    20,  -760}
+    ,{    40,    20,    40,    20,  -760}
+    ,{  -260,  -280,  -260,  -280, -1070}
+    ,{    40,    20,    40,    20,  -760}
+    ,{  -260,  -280,  -260,  -280, -1070}
+    }
+   ,{{   590,   570,   590,   570,  -850}
+    ,{   -60,  -320,   -60,  -320, -1110}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    ,{   590,   570,   590,   570, -1470}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    }
+   ,{{    40,    20,    40,    20,  -760}
+    ,{    40,    20,    40,    20,  -760}
+    ,{  -570,  -590,  -570,  -590, -1380}
+    ,{    40,    20,    40,    20,  -760}
+    ,{  -240,  -260,  -240,  -260, -1050}
+    }
+   }
+  }
+ ,{{{{  1010,  1010,   880,   730,   880}
+    ,{   410,   -70,    40,   410,  -200}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{  1010,  1010,   880,   730,   880}
+    ,{   410,     0,  -370,   410,  -370}
+    }
+   ,{{   410,  -240,  -150,   410,  -370}
+    ,{   230,  -420,  -550,   230,  -550}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{  -150,  -260,  -150,  -540,  -390}
+    ,{   410,  -240,  -370,   410,  -370}
+    }
+   ,{{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    }
+   ,{{  1010,  1010,   880,   730,   880}
+    ,{    40,   -70,    40,  -350,  -200}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{  1010,  1010,   880,   730,   880}
+    ,{   410,  -240,  -370,   410,  -370}
+    }
+   ,{{   410,     0,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{     0,     0,  -370,  -520,  -370}
+    }
+   }
+  ,{{{  1010,  1010,   880, -1710,   880}
+    ,{   -70,   -70,  -200, -1770,  -200}
+    ,{  -240,  -240,  -370, -1710,  -370}
+    ,{  1010,  1010,   880, -1950,   880}
+    ,{     0,     0,  -370, -1710,  -370}
+    }
+   ,{{  -240,  -240,  -370, -1950,  -370}
+    ,{  -420,  -420,  -550, -2130,  -550}
+    ,{  -240,  -240,  -370, -1950,  -370}
+    ,{  -260,  -260,  -390, -1960,  -390}
+    ,{  -240,  -240,  -370, -1950,  -370}
+    }
+   ,{{  -240,  -240,  -370, -1710,  -370}
+    ,{  -240,  -240,  -370, -1950,  -370}
+    ,{  -240,  -240,  -370, -1710,  -370}
+    ,{  -240,  -240,  -370, -1950,  -370}
+    ,{  -240,  -240,  -370, -1710,  -370}
+    }
+   ,{{  1010,  1010,   880, -1770,   880}
+    ,{   -70,   -70,  -200, -1770,  -200}
+    ,{  -240,  -240,  -370, -1950,  -370}
+    ,{  1010,  1010,   880, -1950,   880}
+    ,{  -240,  -240,  -370, -1950,  -370}
+    }
+   ,{{     0,     0,  -370, -1710,  -370}
+    ,{  -240,  -240,  -370, -1950,  -370}
+    ,{  -240,  -240,  -370, -1710,  -370}
+    ,{  -240,  -240,  -370, -1950,  -370}
+    ,{     0,     0,  -370, -1950,  -370}
+    }
+   }
+  ,{{{   880,   730,   880,   730,   440}
+    ,{    40,  -350,    40,  -350,  -400}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    ,{   880,   730,   880,   730,   440}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    }
+   ,{{  -150,  -520,  -150,  -520,  -590}
+    ,{  -550,  -700,  -550,  -700,  -990}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    ,{  -150,  -540,  -150,  -540,  -590}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    }
+   ,{{  -370,  -520,  -370,  -520,  -810}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    }
+   ,{{   880,   730,   880,   730,   440}
+    ,{    40,  -350,    40,  -350,  -400}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    ,{   880,   730,   880,   730,   440}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    }
+   ,{{  -370,  -520,  -370,  -520,  -810}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    ,{  -370,  -520,  -370,  -520,  -810}
+    }
+   }
+  ,{{{   880, -1410,   880,   410,   880}
+    ,{   410, -1470,  -200,   410,  -200}
+    ,{   410, -1410,  -370,   410,  -370}
+    ,{   880, -1650,   880,   410,   880}
+    ,{   410, -1410,  -370,   410,  -370}
+    }
+   ,{{   410, -1650,  -370,   410,  -370}
+    ,{   230, -1830,  -550,   230,  -550}
+    ,{   410, -1650,  -370,   410,  -370}
+    ,{  -390, -1660,  -390,  -860,  -390}
+    ,{   410, -1650,  -370,   410,  -370}
+    }
+   ,{{   410, -1410,  -370,   410,  -370}
+    ,{   410, -1650,  -370,   410,  -370}
+    ,{   410, -1410,  -370,   410,  -370}
+    ,{   410, -1650,  -370,   410,  -370}
+    ,{   410, -1410,  -370,   410,  -370}
+    }
+   ,{{   880, -1470,   880,   410,   880}
+    ,{  -200, -1470,  -200,  -670,  -200}
+    ,{   410, -1650,  -370,   410,  -370}
+    ,{   880, -1650,   880,  -840,   880}
+    ,{   410, -1650,  -370,   410,  -370}
+    }
+   ,{{   410, -1410,  -370,   410,  -370}
+    ,{   410, -1650,  -370,   410,  -370}
+    ,{   410, -1410,  -370,   410,  -370}
+    ,{   410, -1650,  -370,   410,  -370}
+    ,{  -370, -1650,  -370,  -840,  -370}
+    }
+   }
+  ,{{{   750,   730,   750,   730, -1140}
+    ,{   -90,  -350,   -90,  -350, -1140}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{   750,   730,   750,   730, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    }
+   ,{{  -280,  -520,  -280,  -520, -1250}
+    ,{  -680,  -700,  -680,  -700, -1250}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -280,  -540,  -280,  -540, -1330}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    }
+   ,{{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    }
+   ,{{   750,   730,   750,   730, -1140}
+    ,{   -90,  -350,   -90,  -350, -1140}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{   750,   730,   750,   730, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    }
+   ,{{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    }
+   }
+  }
+ ,{{{{  1560,  1560,  1430,  1470,  1430}
+    ,{  1470,   820,   690,  1470,   690}
+    ,{   960,   310,   180,   960,   180}
+    ,{  1560,  1560,  1430,  1280,  1430}
+    ,{   960,   550,   180,   960,   180}
+    }
+   ,{{  1470,   820,   690,  1470,   690}
+    ,{  1470,   820,   690,  1470,   690}
+    ,{   960,   310,   180,   960,   180}
+    ,{    80,   -30,    80,  -310,  -160}
+    ,{   960,   310,   180,   960,   180}
+    }
+   ,{{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    }
+   ,{{  1560,  1560,  1430,  1280,  1430}
+    ,{   -90,  -200,   -90,  -480,  -330}
+    ,{   960,   310,   180,   960,   180}
+    ,{  1560,  1560,  1430,  1280,  1430}
+    ,{   960,   310,   180,   960,   180}
+    }
+   ,{{   960,   550,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   550,   550,   180,    30,   180}
+    }
+   }
+  ,{{{  1560,  1560,  1430,  -880,  1430}
+    ,{   820,   820,   690,  -880,   690}
+    ,{   310,   310,   180, -1150,   180}
+    ,{  1560,  1560,  1430, -1390,  1430}
+    ,{   550,   550,   180, -1150,   180}
+    }
+   ,{{   820,   820,   690,  -880,   690}
+    ,{   820,   820,   690,  -880,   690}
+    ,{   310,   310,   180, -1390,   180}
+    ,{   -30,   -30,  -160, -1730,  -160}
+    ,{   310,   310,   180, -1390,   180}
+    }
+   ,{{   310,   310,   180, -1150,   180}
+    ,{   310,   310,   180, -1390,   180}
+    ,{   310,   310,   180, -1150,   180}
+    ,{   310,   310,   180, -1390,   180}
+    ,{   310,   310,   180, -1150,   180}
+    }
+   ,{{  1560,  1560,  1430, -1390,  1430}
+    ,{  -200,  -200,  -330, -1900,  -330}
+    ,{   310,   310,   180, -1390,   180}
+    ,{  1560,  1560,  1430, -1390,  1430}
+    ,{   310,   310,   180, -1390,   180}
+    }
+   ,{{   550,   550,   180, -1150,   180}
+    ,{   310,   310,   180, -1390,   180}
+    ,{   310,   310,   180, -1150,   180}
+    ,{   310,   310,   180, -1390,   180}
+    ,{   550,   550,   180, -1390,   180}
+    }
+   }
+  ,{{{  1430,  1280,  1430,  1280,   990}
+    ,{   690,   540,   690,   540,   250}
+    ,{   180,    30,   180,    30,  -260}
+    ,{  1430,  1280,  1430,  1280,   990}
+    ,{   180,    30,   180,    30,  -260}
+    }
+   ,{{   690,   540,   690,   540,   250}
+    ,{   690,   540,   690,   540,   250}
+    ,{   180,    30,   180,    30,  -260}
+    ,{    80,  -310,    80,  -310,  -360}
+    ,{   180,    30,   180,    30,  -260}
+    }
+   ,{{   180,    30,   180,    30,  -260}
+    ,{   180,    30,   180,    30,  -260}
+    ,{   180,    30,   180,    30,  -260}
+    ,{   180,    30,   180,    30,  -260}
+    ,{   180,    30,   180,    30,  -260}
+    }
+   ,{{  1430,  1280,  1430,  1280,   990}
+    ,{   -90,  -480,   -90,  -480,  -530}
+    ,{   180,    30,   180,    30,  -260}
+    ,{  1430,  1280,  1430,  1280,   990}
+    ,{   180,    30,   180,    30,  -260}
+    }
+   ,{{   180,    30,   180,    30,  -260}
+    ,{   180,    30,   180,    30,  -260}
+    ,{   180,    30,   180,    30,  -260}
+    ,{   180,    30,   180,    30,  -260}
+    ,{   180,    30,   180,    30,  -260}
+    }
+   }
+  ,{{{  1470,  -580,  1430,  1470,  1430}
+    ,{  1470,  -580,   690,  1470,   690}
+    ,{   960,  -850,   180,   960,   180}
+    ,{  1430, -1090,  1430,   960,  1430}
+    ,{   960,  -850,   180,   960,   180}
+    }
+   ,{{  1470,  -580,   690,  1470,   690}
+    ,{  1470,  -580,   690,  1470,   690}
+    ,{   960, -1090,   180,   960,   180}
+    ,{  -160, -1430,  -160,  -630,  -160}
+    ,{   960, -1090,   180,   960,   180}
+    }
+   ,{{   960,  -850,   180,   960,   180}
+    ,{   960, -1090,   180,   960,   180}
+    ,{   960,  -850,   180,   960,   180}
+    ,{   960, -1090,   180,   960,   180}
+    ,{   960,  -850,   180,   960,   180}
+    }
+   ,{{  1430, -1090,  1430,   960,  1430}
+    ,{  -330, -1600,  -330,  -800,  -330}
+    ,{   960, -1090,   180,   960,   180}
+    ,{  1430, -1090,  1430,  -290,  1430}
+    ,{   960, -1090,   180,   960,   180}
+    }
+   ,{{   960,  -850,   180,   960,   180}
+    ,{   960, -1090,   180,   960,   180}
+    ,{   960,  -850,   180,   960,   180}
+    ,{   960, -1090,   180,   960,   180}
+    ,{   180, -1090,   180,  -290,   180}
+    }
+   }
+  ,{{{  1300,  1280,  1300,  1280,   -10}
+    ,{   560,   540,   560,   540,   -10}
+    ,{    50,    30,    50,    30,  -760}
+    ,{  1300,  1280,  1300,  1280,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    }
+   ,{{   560,   540,   560,   540,   -10}
+    ,{   560,   540,   560,   540,   -10}
+    ,{    50,    30,    50,    30,  -760}
+    ,{   -50,  -310,   -50,  -310, -1100}
+    ,{    50,    30,    50,    30,  -760}
+    }
+   ,{{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    }
+   ,{{  1300,  1280,  1300,  1280,  -760}
+    ,{  -220,  -480,  -220,  -480, -1270}
+    ,{    50,    30,    50,    30,  -760}
+    ,{  1300,  1280,  1300,  1280,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    }
+   ,{{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    }
+   }
+  }
+ ,{{{{  2050,  1930,  1800,  2050,  1800}
+    ,{  2050,  1400,  1270,  2050,  1270}
+    ,{  1750,  1100,   970,  1750,   970}
+    ,{  1930,  1930,  1800,  1760,  1800}
+    ,{  1750,  1100,   970,  1750,   970}
+    }
+   ,{{  2050,  1400,  1270,  2050,  1270}
+    ,{  2050,  1400,  1270,  2050,  1270}
+    ,{  1740,  1090,   960,  1740,   960}
+    ,{   130,    10,   130,  -260,  -110}
+    ,{  1740,  1090,   960,  1740,   960}
+    }
+   ,{{  1760,  1110,   980,  1760,   980}
+    ,{  1760,  1110,   980,  1760,   980}
+    ,{  1750,  1100,   970,  1750,   970}
+    ,{  1760,  1110,   980,  1760,   980}
+    ,{  1750,  1100,   970,  1750,   970}
+    }
+   ,{{  1930,  1930,  1800,  1740,  1800}
+    ,{   300,   190,   300,   -80,    60}
+    ,{  1740,  1090,   960,  1740,   960}
+    ,{  1930,  1930,  1800,  1650,  1800}
+    ,{  1740,  1090,   960,  1740,   960}
+    }
+   ,{{  1760,  1110,   980,  1760,   980}
+    ,{  1760,  1110,   980,  1760,   980}
+    ,{  1750,  1100,   970,  1750,   970}
+    ,{  1760,  1110,   980,  1760,   980}
+    ,{   360,   360,     0,  -150,     0}
+    }
+   }
+  ,{{{  1930,  1930,  1800,  -300,  1800}
+    ,{  1400,  1400,  1270,  -300,  1270}
+    ,{  1100,  1100,   970,  -360,   970}
+    ,{  1930,  1930,  1800,  -590,  1800}
+    ,{  1100,  1100,   970,  -360,   970}
+    }
+   ,{{  1400,  1400,  1270,  -300,  1270}
+    ,{  1400,  1400,  1270,  -300,  1270}
+    ,{  1090,  1090,   960,  -610,   960}
+    ,{    10,    10,  -110, -1690,  -110}
+    ,{  1090,  1090,   960,  -610,   960}
+    }
+   ,{{  1110,  1110,   980,  -360,   980}
+    ,{  1110,  1110,   980,  -590,   980}
+    ,{  1100,  1100,   970,  -360,   970}
+    ,{  1110,  1110,   980,  -590,   980}
+    ,{  1100,  1100,   970,  -360,   970}
+    }
+   ,{{  1930,  1930,  1800,  -610,  1800}
+    ,{   190,   190,    60, -1510,    60}
+    ,{  1090,  1090,   960,  -610,   960}
+    ,{  1930,  1930,  1800, -1020,  1800}
+    ,{  1090,  1090,   960,  -610,   960}
+    }
+   ,{{  1110,  1110,   980,  -360,   980}
+    ,{  1110,  1110,   980,  -590,   980}
+    ,{  1100,  1100,   970,  -360,   970}
+    ,{  1110,  1110,   980,  -590,   980}
+    ,{   360,   360,     0, -1580,     0}
+    }
+   }
+  ,{{{  1800,  1650,  1800,  1650,  1360}
+    ,{  1270,  1120,  1270,  1120,   830}
+    ,{   970,   820,   970,   820,   530}
+    ,{  1800,  1650,  1800,  1650,  1360}
+    ,{   970,   820,   970,   820,   530}
+    }
+   ,{{  1270,  1120,  1270,  1120,   830}
+    ,{  1270,  1120,  1270,  1120,   830}
+    ,{   960,   810,   960,   810,   520}
+    ,{   130,  -260,   130,  -260,  -310}
+    ,{   960,   810,   960,   810,   520}
+    }
+   ,{{   980,   830,   980,   830,   540}
+    ,{   980,   830,   980,   830,   540}
+    ,{   970,   820,   970,   820,   530}
+    ,{   980,   830,   980,   830,   540}
+    ,{   970,   820,   970,   820,   530}
+    }
+   ,{{  1800,  1650,  1800,  1650,  1360}
+    ,{   300,   -80,   300,   -80,  -130}
+    ,{   960,   810,   960,   810,   520}
+    ,{  1800,  1650,  1800,  1650,  1360}
+    ,{   960,   810,   960,   810,   520}
+    }
+   ,{{   980,   830,   980,   830,   540}
+    ,{   980,   830,   980,   830,   540}
+    ,{   970,   820,   970,   820,   530}
+    ,{   980,   830,   980,   830,   540}
+    ,{     0,  -150,     0,  -150,  -440}
+    }
+   }
+  ,{{{  2050,     0,  1800,  2050,  1800}
+    ,{  2050,     0,  1270,  2050,  1270}
+    ,{  1750,   -60,   970,  1750,   970}
+    ,{  1800,  -290,  1800,  1760,  1800}
+    ,{  1750,   -60,   970,  1750,   970}
+    }
+   ,{{  2050,     0,  1270,  2050,  1270}
+    ,{  2050,     0,  1270,  2050,  1270}
+    ,{  1740,  -310,   960,  1740,   960}
+    ,{  -110, -1390,  -110,  -580,  -110}
+    ,{  1740,  -310,   960,  1740,   960}
+    }
+   ,{{  1760,   -60,   980,  1760,   980}
+    ,{  1760,  -290,   980,  1760,   980}
+    ,{  1750,   -60,   970,  1750,   970}
+    ,{  1760,  -290,   980,  1760,   980}
+    ,{  1750,   -60,   970,  1750,   970}
+    }
+   ,{{  1800,  -310,  1800,  1740,  1800}
+    ,{    60, -1210,    60,  -400,    60}
+    ,{  1740,  -310,   960,  1740,   960}
+    ,{  1800,  -720,  1800,    80,  1800}
+    ,{  1740,  -310,   960,  1740,   960}
+    }
+   ,{{  1760,   -60,   980,  1760,   980}
+    ,{  1760,  -290,   980,  1760,   980}
+    ,{  1750,   -60,   970,  1750,   970}
+    ,{  1760,  -290,   980,  1760,   980}
+    ,{     0, -1280,     0,  -470,     0}
+    }
+   }
+  ,{{{  1670,  1650,  1670,  1650,   570}
+    ,{  1140,  1120,  1140,  1120,   570}
+    ,{   840,   820,   840,   820,    30}
+    ,{  1670,  1650,  1670,  1650,    40}
+    ,{   840,   820,   840,   820,    30}
+    }
+   ,{{  1140,  1120,  1140,  1120,   570}
+    ,{  1140,  1120,  1140,  1120,   570}
+    ,{   830,   810,   830,   810,    20}
+    ,{     0,  -260,     0,  -260, -1050}
+    ,{   830,   810,   830,   810,    20}
+    }
+   ,{{   850,   830,   850,   830,    40}
+    ,{   850,   830,   850,   830,    40}
+    ,{   840,   820,   840,   820,    30}
+    ,{   850,   830,   850,   830,    40}
+    ,{   840,   820,   840,   820,    30}
+    }
+   ,{{  1670,  1650,  1670,  1650,    20}
+    ,{   180,   -80,   180,   -80,  -870}
+    ,{   830,   810,   830,   810,    20}
+    ,{  1670,  1650,  1670,  1650,  -380}
+    ,{   830,   810,   830,   810,    20}
+    }
+   ,{{   850,   830,   850,   830,    40}
+    ,{   850,   830,   850,   830,    40}
+    ,{   840,   820,   840,   820,    30}
+    ,{   850,   830,   850,   830,    40}
+    ,{  -130,  -150,  -130,  -150,  -940}
+    }
+   }
+  }
+ ,{{{{  2120,  2120,  1990,  2120,  1990}
+    ,{  2120,  1470,  1340,  2120,  1340}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  2120,  2120,  1990,  1990,  1990}
+    ,{  1860,  1210,  1080,  1860,  1080}
+    }
+   ,{{  2120,  1470,  1340,  2120,  1340}
+    ,{  2120,  1470,  1340,  2120,  1340}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    ,{   180,    60,   180,  -210,   -60}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    }
+   ,{{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1860,  1210,  1080,  1860,  1080}
+    }
+   ,{{  2120,  2120,  1990,  1840,  1990}
+    ,{  -120,  -230,  -120,  -510,  -360}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    ,{  2120,  2120,  1990,  1840,  1990}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    }
+   ,{{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1550,   900,   770,  1550,   770}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{   640,   640,   270,   120,   270}
+    }
+   }
+  ,{{{  2120,  2120,  1990,  -120,  1990}
+    ,{  1470,  1470,  1340,  -230,  1340}
+    ,{  1340,  1340,  1210,  -120,  1210}
+    ,{  2120,  2120,  1990,  -360,  1990}
+    ,{  1210,  1210,  1080,  -250,  1080}
+    }
+   ,{{  1470,  1470,  1340,  -230,  1340}
+    ,{  1470,  1470,  1340,  -230,  1340}
+    ,{  1190,  1190,  1060,  -510,  1060}
+    ,{    60,    60,   -60, -1640,   -60}
+    ,{  1190,  1190,  1060,  -510,  1060}
+    }
+   ,{{  1340,  1340,  1210,  -120,  1210}
+    ,{  1340,  1340,  1210,  -360,  1210}
+    ,{  1340,  1340,  1210,  -120,  1210}
+    ,{  1340,  1340,  1210,  -360,  1210}
+    ,{  1210,  1210,  1080,  -250,  1080}
+    }
+   ,{{  2120,  2120,  1990,  -510,  1990}
+    ,{  -230,  -230,  -360, -1940,  -360}
+    ,{  1190,  1190,  1060,  -510,  1060}
+    ,{  2120,  2120,  1990,  -830,  1990}
+    ,{  1190,  1190,  1060,  -510,  1060}
+    }
+   ,{{  1340,  1340,  1210,  -360,  1210}
+    ,{  1340,  1340,  1210,  -360,  1210}
+    ,{   900,   900,   770,  -560,   770}
+    ,{  1340,  1340,  1210,  -360,  1210}
+    ,{   640,   640,   270, -1300,   270}
+    }
+   }
+  ,{{{  1990,  1840,  1990,  1840,  1550}
+    ,{  1340,  1190,  1340,  1190,   900}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{  1990,  1840,  1990,  1840,  1550}
+    ,{  1080,   930,  1080,   930,   640}
+    }
+   ,{{  1340,  1190,  1340,  1190,   900}
+    ,{  1340,  1190,  1340,  1190,   900}
+    ,{  1060,   910,  1060,   910,   620}
+    ,{   180,  -210,   180,  -210,  -260}
+    ,{  1060,   910,  1060,   910,   620}
+    }
+   ,{{  1210,  1060,  1210,  1060,   770}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{  1080,   930,  1080,   930,   640}
+    }
+   ,{{  1990,  1840,  1990,  1840,  1550}
+    ,{  -120,  -510,  -120,  -510,  -560}
+    ,{  1060,   910,  1060,   910,   620}
+    ,{  1990,  1840,  1990,  1840,  1550}
+    ,{  1060,   910,  1060,   910,   620}
+    }
+   ,{{  1210,  1060,  1210,  1060,   770}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{   770,   620,   770,   620,   330}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{   270,   120,   270,   120,  -170}
+    }
+   }
+  ,{{{  2120,   180,  1990,  2120,  1990}
+    ,{  2120,    60,  1340,  2120,  1340}
+    ,{  1990,   180,  1210,  1990,  1210}
+    ,{  1990,   -60,  1990,  1990,  1990}
+    ,{  1860,    50,  1080,  1860,  1080}
+    }
+   ,{{  2120,    60,  1340,  2120,  1340}
+    ,{  2120,    60,  1340,  2120,  1340}
+    ,{  1840,  -210,  1060,  1840,  1060}
+    ,{   -60, -1340,   -60,  -530,   -60}
+    ,{  1840,  -210,  1060,  1840,  1060}
+    }
+   ,{{  1990,   180,  1210,  1990,  1210}
+    ,{  1990,   -60,  1210,  1990,  1210}
+    ,{  1990,   180,  1210,  1990,  1210}
+    ,{  1990,   -60,  1210,  1990,  1210}
+    ,{  1860,    50,  1080,  1860,  1080}
+    }
+   ,{{  1990,  -210,  1990,  1840,  1990}
+    ,{  -360, -1640,  -360,  -830,  -360}
+    ,{  1840,  -210,  1060,  1840,  1060}
+    ,{  1990,  -530,  1990,   270,  1990}
+    ,{  1840,  -210,  1060,  1840,  1060}
+    }
+   ,{{  1990,   -60,  1210,  1990,  1210}
+    ,{  1990,   -60,  1210,  1990,  1210}
+    ,{  1550,  -260,   770,  1550,   770}
+    ,{  1990,   -60,  1210,  1990,  1210}
+    ,{   270, -1000,   270,  -200,   270}
+    }
+   }
+  ,{{{  1860,  1840,  1860,  1840,   640}
+    ,{  1210,  1190,  1210,  1190,   640}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1860,  1840,  1860,  1840,   270}
+    ,{   950,   930,   950,   930,   140}
+    }
+   ,{{  1210,  1190,  1210,  1190,   640}
+    ,{  1210,  1190,  1210,  1190,   640}
+    ,{   930,   910,   930,   910,   120}
+    ,{    50,  -210,    50,  -210, -1000}
+    ,{   930,   910,   930,   910,   120}
+    }
+   ,{{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   950,   930,   950,   930,   140}
+    }
+   ,{{  1860,  1840,  1860,  1840,   120}
+    ,{  -250,  -510,  -250,  -510, -1300}
+    ,{   930,   910,   930,   910,   120}
+    ,{  1860,  1840,  1860,  1840,  -200}
+    ,{   930,   910,   930,   910,   120}
+    }
+   ,{{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   640,   620,   640,   620,  -170}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   140,   120,   140,   120,  -670}
+    }
+   }
+  }
+ ,{{{{  2120,  2120,  1990,  2120,  1990}
+    ,{  2120,  1470,  1340,  2120,  1340}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  2120,  2120,  1990,  1990,  1990}
+    ,{  1860,  1210,  1080,  1860,  1080}
+    }
+   ,{{  2120,  1470,  1340,  2120,  1340}
+    ,{  2120,  1470,  1340,  2120,  1340}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    ,{   400,   290,   400,    10,   160}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    }
+   ,{{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1860,  1210,  1080,  1860,  1080}
+    }
+   ,{{  2120,  2120,  1990,  1840,  1990}
+    ,{   300,   190,   300,   -80,    60}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    ,{  2120,  2120,  1990,  1840,  1990}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    }
+   ,{{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1750,  1100,   970,  1750,   970}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{   640,   640,   270,   120,   270}
+    }
+   }
+  ,{{{  2120,  2120,  1990,  -120,  1990}
+    ,{  1470,  1470,  1340,  -230,  1340}
+    ,{  1340,  1340,  1210,  -120,  1210}
+    ,{  2120,  2120,  1990,  -360,  1990}
+    ,{  1210,  1210,  1080,  -250,  1080}
+    }
+   ,{{  1470,  1470,  1340,  -230,  1340}
+    ,{  1470,  1470,  1340,  -230,  1340}
+    ,{  1190,  1190,  1060,  -510,  1060}
+    ,{   290,   290,   160, -1410,   160}
+    ,{  1190,  1190,  1060,  -510,  1060}
+    }
+   ,{{  1340,  1340,  1210,  -120,  1210}
+    ,{  1340,  1340,  1210,  -360,  1210}
+    ,{  1340,  1340,  1210,  -120,  1210}
+    ,{  1340,  1340,  1210,  -360,  1210}
+    ,{  1210,  1210,  1080,  -250,  1080}
+    }
+   ,{{  2120,  2120,  1990,  -510,  1990}
+    ,{   190,   190,    60, -1510,    60}
+    ,{  1190,  1190,  1060,  -510,  1060}
+    ,{  2120,  2120,  1990,  -830,  1990}
+    ,{  1190,  1190,  1060,  -510,  1060}
+    }
+   ,{{  1340,  1340,  1210,  -360,  1210}
+    ,{  1340,  1340,  1210,  -360,  1210}
+    ,{  1100,  1100,   970,  -360,   970}
+    ,{  1340,  1340,  1210,  -360,  1210}
+    ,{   640,   640,   270, -1300,   270}
+    }
+   }
+  ,{{{  1990,  1840,  1990,  1840,  1550}
+    ,{  1340,  1190,  1340,  1190,   900}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{  1990,  1840,  1990,  1840,  1550}
+    ,{  1080,   930,  1080,   930,   640}
+    }
+   ,{{  1340,  1190,  1340,  1190,   900}
+    ,{  1340,  1190,  1340,  1190,   900}
+    ,{  1060,   910,  1060,   910,   620}
+    ,{   400,    10,   400,    10,   -40}
+    ,{  1060,   910,  1060,   910,   620}
+    }
+   ,{{  1210,  1060,  1210,  1060,   770}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{  1080,   930,  1080,   930,   640}
+    }
+   ,{{  1990,  1840,  1990,  1840,  1550}
+    ,{   300,   -80,   300,   -80,  -130}
+    ,{  1060,   910,  1060,   910,   620}
+    ,{  1990,  1840,  1990,  1840,  1550}
+    ,{  1060,   910,  1060,   910,   620}
+    }
+   ,{{  1210,  1060,  1210,  1060,   770}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{   970,   820,   970,   820,   530}
+    ,{  1210,  1060,  1210,  1060,   770}
+    ,{   270,   120,   270,   120,  -170}
+    }
+   }
+  ,{{{  2120,   180,  1990,  2120,  1990}
+    ,{  2120,    60,  1340,  2120,  1340}
+    ,{  1990,   180,  1210,  1990,  1210}
+    ,{  1990,   -60,  1990,  1990,  1990}
+    ,{  1860,    50,  1080,  1860,  1080}
+    }
+   ,{{  2120,    60,  1340,  2120,  1340}
+    ,{  2120,    60,  1340,  2120,  1340}
+    ,{  1840,  -210,  1060,  1840,  1060}
+    ,{   160, -1110,   160,  -310,   160}
+    ,{  1840,  -210,  1060,  1840,  1060}
+    }
+   ,{{  1990,   180,  1210,  1990,  1210}
+    ,{  1990,   -60,  1210,  1990,  1210}
+    ,{  1990,   180,  1210,  1990,  1210}
+    ,{  1990,   -60,  1210,  1990,  1210}
+    ,{  1860,    50,  1080,  1860,  1080}
+    }
+   ,{{  1990,  -210,  1990,  1840,  1990}
+    ,{    60, -1210,    60,  -400,    60}
+    ,{  1840,  -210,  1060,  1840,  1060}
+    ,{  1990,  -530,  1990,   270,  1990}
+    ,{  1840,  -210,  1060,  1840,  1060}
+    }
+   ,{{  1990,   -60,  1210,  1990,  1210}
+    ,{  1990,   -60,  1210,  1990,  1210}
+    ,{  1750,   -60,   970,  1750,   970}
+    ,{  1990,   -60,  1210,  1990,  1210}
+    ,{   270, -1000,   270,  -200,   270}
+    }
+   }
+  ,{{{  1860,  1840,  1860,  1840,   640}
+    ,{  1210,  1190,  1210,  1190,   640}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1860,  1840,  1860,  1840,   270}
+    ,{   950,   930,   950,   930,   140}
+    }
+   ,{{  1210,  1190,  1210,  1190,   640}
+    ,{  1210,  1190,  1210,  1190,   640}
+    ,{   930,   910,   930,   910,   120}
+    ,{   270,    10,   270,    10,  -780}
+    ,{   930,   910,   930,   910,   120}
+    }
+   ,{{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   950,   930,   950,   930,   140}
+    }
+   ,{{  1860,  1840,  1860,  1840,   120}
+    ,{   180,   -80,   180,   -80,  -870}
+    ,{   930,   910,   930,   910,   120}
+    ,{  1860,  1840,  1860,  1840,  -200}
+    ,{   930,   910,   930,   910,   120}
+    }
+   ,{{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   840,   820,   840,   820,    30}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   140,   120,   140,   120,  -670}
+    }
+   }
+  }
+ }
+,{{{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  ,{{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   ,{{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    ,{   INF,   INF,   INF,   INF,   INF}
+    }
+   }
+  }
+ ,{{{{  1350,   850,   720,  1350,   720}
+    ,{  1300,   650,   540,  1300,   520}
+    ,{  1350,   700,   570,  1350,   570}
+    ,{  1300,   850,   720,  1300,   720}
+    ,{  1250,   590,   460,  1250,   460}
+    }
+   ,{{  1160,   500,   400,  1160,   370}
+    ,{  1160,   500,   370,  1160,   370}
+    ,{   850,   190,    60,   850,    60}
+    ,{   400,   290,   400,    10,   170}
+    ,{   850,   190,    60,   850,    60}
+    }
+   ,{{  1300,   650,   520,  1300,   520}
+    ,{  1300,   650,   520,  1300,   520}
+    ,{  1290,   640,   510,  1290,   510}
+    ,{  1300,   650,   520,  1300,   520}
+    ,{  1250,   590,   460,  1250,   460}
+    }
+   ,{{   850,   850,   720,   850,   720}
+    ,{   540,     0,   540,  -270,  -120}
+    ,{   850,   190,    60,   850,    60}
+    ,{   850,   850,   720,   570,   720}
+    ,{   850,   190,    60,   850,    60}
+    }
+   ,{{  1350,   700,   570,  1350,   570}
+    ,{  1300,   650,   520,  1300,   520}
+    ,{  1350,   700,   570,  1350,   570}
+    ,{  1300,   650,   520,  1300,   520}
+    ,{   100,   100,  -270,  -230,  -270}
+    }
+   }
+  ,{{{   850,   850,   720,  -330,   720}
+    ,{   650,   650,   520,  -620,   520}
+    ,{   700,   700,   570,  -330,   570}
+    ,{   850,   850,   720,  -620,   720}
+    ,{   590,   590,   460,  -440,   460}
+    }
+   ,{{   500,   500,   370,  -770,   370}
+    ,{   500,   500,   370,  -770,   370}
+    ,{   190,   190,    60, -1070,    60}
+    ,{   290,   290,   160,  -980,   160}
+    ,{   190,   190,    60, -1080,    60}
+    }
+   ,{{   650,   650,   520,  -390,   520}
+    ,{   650,   650,   520,  -620,   520}
+    ,{   640,   640,   510,  -390,   510}
+    ,{   650,   650,   520,  -620,   520}
+    ,{   590,   590,   460,  -440,   460}
+    }
+   ,{{   850,   850,   720, -1080,   720}
+    ,{    10,     0,    10, -1270,  -120}
+    ,{   190,   190,    60, -1080,    60}
+    ,{   850,   850,   720, -1080,   720}
+    ,{   190,   190,    60, -1080,    60}
+    }
+   ,{{   700,   700,   570,  -330,   570}
+    ,{   650,   650,   520,  -620,   520}
+    ,{   700,   700,   570,  -330,   570}
+    ,{   650,   650,   520,  -620,   520}
+    ,{   100,   100,  -270, -1300,  -270}
+    }
+   }
+  ,{{{   720,   570,   720,   570,   480}
+    ,{   540,   370,   540,   370,   280}
+    ,{   570,   420,   570,   420,   340}
+    ,{   720,   570,   720,   570,   480}
+    ,{   460,   310,   460,   310,   230}
+    }
+   ,{{   400,   220,   400,   220,   170}
+    ,{   370,   220,   370,   220,   140}
+    ,{    60,   -80,    60,   -80,  -170}
+    ,{   400,    10,   400,    10,   170}
+    ,{    60,   -80,    60,   -80,  -170}
+    }
+   ,{{   520,   370,   520,   370,   280}
+    ,{   520,   370,   520,   370,   280}
+    ,{   510,   360,   510,   360,   280}
+    ,{   520,   370,   520,   370,   280}
+    ,{   460,   310,   460,   310,   230}
+    }
+   ,{{   720,   570,   720,   570,   480}
+    ,{   540,  -100,   540,  -270,  -120}
+    ,{    60,   -80,    60,   -80,  -170}
+    ,{   720,   570,   720,   570,   480}
+    ,{    60,   -80,    60,   -80,  -170}
+    }
+   ,{{   570,   420,   570,   420,   340}
+    ,{   520,   370,   520,   370,   280}
+    ,{   570,   420,   570,   420,   340}
+    ,{   520,   370,   520,   370,   280}
+    ,{  -270,  -420,  -270,  -420,  -500}
+    }
+   }
+  ,{{{  1350,  -230,   720,  1350,   720}
+    ,{  1300,  -530,   520,  1300,   520}
+    ,{  1350,  -230,   570,  1350,   570}
+    ,{  1300,  -530,   720,  1300,   720}
+    ,{  1250,  -340,   460,  1250,   460}
+    }
+   ,{{  1160,  -670,   370,  1160,   370}
+    ,{  1160,  -670,   370,  1160,   370}
+    ,{   850,  -980,    60,   850,    60}
+    ,{   160,  -890,   160,  -310,   160}
+    ,{   850,  -980,    60,   850,    60}
+    }
+   ,{{  1300,  -290,   520,  1300,   520}
+    ,{  1300,  -530,   520,  1300,   520}
+    ,{  1290,  -290,   510,  1290,   510}
+    ,{  1300,  -530,   520,  1300,   520}
+    ,{  1250,  -340,   460,  1250,   460}
+    }
+   ,{{   850,  -980,   720,   850,   720}
+    ,{  -120, -1170,  -120,  -590,  -120}
+    ,{   850,  -980,    60,   850,    60}
+    ,{   720, -1580,   720, -1000,   720}
+    ,{   850,  -980,    60,   850,    60}
+    }
+   ,{{  1350,  -230,   570,  1350,   570}
+    ,{  1300,  -530,   520,  1300,   520}
+    ,{  1350,  -230,   570,  1350,   570}
+    ,{  1300,  -530,   520,  1300,   520}
+    ,{  -230, -1320,  -270,  -230,  -270}
+    }
+   }
+  ,{{{   590,   570,   590,   570,   -90}
+    ,{   390,   370,   390,   370,   -90}
+    ,{   440,   420,   440,   420,  -360}
+    ,{   590,   570,   590,   570,  -420}
+    ,{   330,   310,   330,   310,  -470}
+    }
+   ,{{   270,   220,   270,   220,  -320}
+    ,{   240,   220,   240,   220,  -320}
+    ,{   -60,   -80,   -60,   -80,  -830}
+    ,{   270,    10,   270,    10,  -780}
+    ,{   -60,   -80,   -60,   -80,  -870}
+    }
+   ,{{   390,   370,   390,   370,   -90}
+    ,{   390,   370,   390,   370,   -90}
+    ,{   380,   360,   380,   360,  -420}
+    ,{   390,   370,   390,   370,  -420}
+    ,{   330,   310,   330,   310,  -470}
+    }
+   ,{{   590,   570,   590,   570,  -810}
+    ,{   -10,  -270,   -10,  -270,  -810}
+    ,{   -60,   -80,   -60,   -80,  -870}
+    ,{   590,   570,   590,   570, -1470}
+    ,{   -60,   -80,   -60,   -80,  -870}
+    }
+   ,{{   440,   420,   440,   420,  -360}
+    ,{   390,   370,   390,   370,  -420}
+    ,{   440,   420,   440,   420,  -360}
+    ,{   390,   370,   390,   370,  -420}
+    ,{  -400,  -420,  -400,  -420, -1210}
+    }
+   }
+  }
+ ,{{{{  1320,   850,   720,  1320,   720}
+    ,{  1320,   670,   540,  1320,   540}
+    ,{   870,   220,    90,   870,    90}
+    ,{   960,   850,   720,   960,   720}
+    ,{   870,   250,    90,   870,    90}
+    }
+   ,{{  1320,   670,   540,  1320,   540}
+    ,{  1320,   670,   540,  1320,   540}
+    ,{   870,   220,    90,   870,    90}
+    ,{  -410,  -520,  -410,  -800,  -640}
+    ,{   870,   220,    90,   870,    90}
+    }
+   ,{{   960,   300,   170,   960,   170}
+    ,{   960,   300,   170,   960,   170}
+    ,{   650,     0,  -130,   650,  -130}
+    ,{   960,   300,   170,   960,   170}
+    ,{   650,     0,  -130,   650,  -130}
+    }
+   ,{{   870,   850,   720,   870,   720}
+    ,{    70,   -40,    70,  -320,  -170}
+    ,{   870,   220,    90,   870,    90}
+    ,{   850,   850,   720,   570,   720}
+    ,{   870,   220,    90,   870,    90}
+    }
+   ,{{   960,   300,   170,   960,   170}
+    ,{   960,   300,   170,   960,   170}
+    ,{   340,  -310,  -440,   340,  -440}
+    ,{   960,   300,   170,   960,   170}
+    ,{   250,   250,   -90,  -260,  -110}
+    }
+   }
+  ,{{{   850,   850,   720,   540,   720}
+    ,{   670,   670,   540,    10,   540}
+    ,{   540,   220,    90,   540,    90}
+    ,{   850,   850,   720,  -970,   720}
+    ,{   250,   250,    90,  -810,    90}
+    }
+   ,{{   670,   670,   540,  -100,   540}
+    ,{   670,   670,   540,  -600,   540}
+    ,{   220,   220,    90,  -100,    90}
+    ,{  -520,  -520,  -650, -1790,  -650}
+    ,{   220,   220,    90, -1050,    90}
+    }
+   ,{{   540,   300,   170,   540,   170}
+    ,{   300,   300,   170,    10,   170}
+    ,{   540,     0,  -130,   540,  -130}
+    ,{   300,   300,   170,  -970,   170}
+    ,{     0,     0,  -130, -1030,  -130}
+    }
+   ,{{   850,   850,   720, -1050,   720}
+    ,{   -40,   -40,  -170, -1320,  -170}
+    ,{   220,   220,    90, -1050,    90}
+    ,{   850,   850,   720, -1680,   720}
+    ,{   220,   220,    90, -1050,    90}
+    }
+   ,{{   300,   300,   170,  -810,   170}
+    ,{   300,   300,   170,  -970,   170}
+    ,{  -310,  -310,  -440, -1340,  -440}
+    ,{   300,   300,   170,  -970,   170}
+    ,{   250,   250,   -90,  -810,  -110}
+    }
+   }
+  ,{{{   720,   570,   720,   570,   480}
+    ,{   540,   390,   540,   390,   300}
+    ,{    90,   -60,    90,   -60,  -140}
+    ,{   720,   570,   720,   570,   480}
+    ,{    90,   -60,    90,   -60,  -140}
+    }
+   ,{{   540,   390,   540,   390,   300}
+    ,{   540,   390,   540,   390,   300}
+    ,{    90,   -60,    90,   -60,  -140}
+    ,{  -410,  -800,  -410,  -800,  -640}
+    ,{    90,   -60,    90,   -60,  -140}
+    }
+   ,{{   170,    20,   170,    20,   -60}
+    ,{   170,    20,   170,    20,   -60}
+    ,{  -130,  -280,  -130,  -280,  -360}
+    ,{   170,    20,   170,    20,   -60}
+    ,{  -130,  -280,  -130,  -280,  -360}
+    }
+   ,{{   720,   570,   720,   570,   480}
+    ,{    70,  -320,    70,  -320,  -170}
+    ,{    90,   -60,    90,   -60,  -140}
+    ,{   720,   570,   720,   570,   480}
+    ,{    90,   -60,    90,   -60,  -140}
+    }
+   ,{{   170,    20,   170,    20,   -60}
+    ,{   170,    20,   170,    20,   -60}
+    ,{  -440,  -590,  -440,  -590,  -670}
+    ,{   170,    20,   170,    20,   -60}
+    ,{  -110,  -260,  -110,  -260,  -350}
+    }
+   }
+  ,{{{  1320,  -350,   720,  1320,   720}
+    ,{  1320,  -730,   540,  1320,   540}
+    ,{   870,  -350,    90,   870,    90}
+    ,{   960,  -870,   720,   960,   720}
+    ,{   870,  -940,    90,   870,    90}
+    }
+   ,{{  1320,  -350,   540,  1320,   540}
+    ,{  1320,  -730,   540,  1320,   540}
+    ,{   870,  -350,    90,   870,    90}
+    ,{  -650, -1920,  -650, -1120,  -650}
+    ,{   870,  -960,    90,   870,    90}
+    }
+   ,{{   960,  -870,   170,   960,   170}
+    ,{   960, -1100,   170,   960,   170}
+    ,{   650,  -940,  -130,   650,  -130}
+    ,{   960,  -870,   170,   960,   170}
+    ,{   650,  -940,  -130,   650,  -130}
+    }
+   ,{{   870,  -960,   720,   870,   720}
+    ,{  -170, -1450,  -170,  -640,  -170}
+    ,{   870,  -960,    90,   870,    90}
+    ,{   720, -1370,   720, -1000,   720}
+    ,{   870,  -960,    90,   870,    90}
+    }
+   ,{{   960,  -870,   170,   960,   170}
+    ,{   960,  -870,   170,   960,   170}
+    ,{   340, -1250,  -440,   340,  -440}
+    ,{   960,  -870,   170,   960,   170}
+    ,{  -110, -1360,  -110,  -580,  -110}
+    }
+   }
+  ,{{{   590,   570,   590,   570,  -160}
+    ,{   410,   390,   410,   390,  -160}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    ,{   590,   570,   590,   570,  -230}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    }
+   ,{{   410,   390,   410,   390,  -160}
+    ,{   410,   390,   410,   390,  -160}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    ,{  -540,  -800,  -540,  -800, -1520}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    }
+   ,{{    40,    20,    40,    20,  -400}
+    ,{    40,    20,    40,    20,  -400}
+    ,{  -260,  -280,  -260,  -280, -1070}
+    ,{    40,    20,    40,    20,  -760}
+    ,{  -260,  -280,  -260,  -280, -1070}
+    }
+   ,{{   590,   570,   590,   570,  -230}
+    ,{   -60,  -320,   -60,  -320, -1110}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    ,{   590,   570,   590,   570,  -230}
+    ,{   -40,   -60,   -40,   -60,  -850}
+    }
+   ,{{    40,    20,    40,    20,  -760}
+    ,{    40,    20,    40,    20,  -760}
+    ,{  -570,  -590,  -570,  -590, -1380}
+    ,{    40,    20,    40,    20,  -760}
+    ,{  -240,  -260,  -240,  -260, -1050}
+    }
+   }
+  }
+ ,{{{{  1010,  1010,   880,   730,   880}
+    ,{   410,   -30,    40,   410,  -190}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{  1010,  1010,   880,   730,   880}
+    ,{   410,     0,  -370,   410,  -370}
+    }
+   ,{{   410,   -70,  -150,   410,  -370}
+    ,{   230,   -70,  -550,   230,  -550}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{  -150,  -260,  -150,  -540,  -380}
+    ,{   410,  -240,  -370,   410,  -370}
+    }
+   ,{{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    }
+   ,{{  1010,  1010,   880,   730,   880}
+    ,{    40,   -30,    40,  -350,  -190}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{  1010,  1010,   880,   730,   880}
+    ,{   410,  -240,  -370,   410,  -370}
+    }
+   ,{{   410,     0,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{   410,  -240,  -370,   410,  -370}
+    ,{     0,     0,  -370,  -520,  -370}
+    }
+   }
+  ,{{{  1010,  1010,   880, -1280,   880}
+    ,{   -30,   -30,  -200, -1340,  -200}
+    ,{  -240,  -240,  -370, -1280,  -370}
+    ,{  1010,  1010,   880, -1520,   880}
+    ,{     0,     0,  -370, -1280,  -370}
+    }
+   ,{{   -70,   -70,  -370, -1520,  -370}
+    ,{   -70,   -70,  -550, -1700,  -550}
+    ,{  -240,  -240,  -370, -1520,  -370}
+    ,{  -260,  -260,  -390, -1530,  -390}
+    ,{  -240,  -240,  -370, -1520,  -370}
+    }
+   ,{{  -240,  -240,  -370, -1280,  -370}
+    ,{  -240,  -240,  -370, -1520,  -370}
+    ,{  -240,  -240,  -370, -1280,  -370}
+    ,{  -240,  -240,  -370, -1520,  -370}
+    ,{  -240,  -240,  -370, -1280,  -370}
+    }
+   ,{{  1010,  1010,   880, -1340,   880}
+    ,{   -30,   -30,  -200, -1340,  -200}
+    ,{  -240,  -240,  -370, -1520,  -370}
+    ,{  1010,  1010,   880, -1520,   880}
+    ,{  -240,  -240,  -370, -1520,  -370}
+    }
+   ,{{     0,     0,  -370, -1280,  -370}
+    ,{  -240,  -240,  -370, -1520,  -370}
+    ,{  -240,  -240,  -370, -1280,  -370}
+    ,{  -240,  -240,  -370, -1520,  -370}
+    ,{     0,     0,  -370, -1520,  -370}
+    }
+   }
+  ,{{{   880,   730,   880,   730,   640}
+    ,{    40,  -350,    40,  -350,  -190}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    ,{   880,   730,   880,   730,   640}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    }
+   ,{{  -150,  -520,  -150,  -520,  -380}
+    ,{  -550,  -700,  -550,  -700,  -790}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    ,{  -150,  -540,  -150,  -540,  -380}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    }
+   ,{{  -370,  -520,  -370,  -520,  -610}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    }
+   ,{{   880,   730,   880,   730,   640}
+    ,{    40,  -350,    40,  -350,  -190}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    ,{   880,   730,   880,   730,   640}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    }
+   ,{{  -370,  -520,  -370,  -520,  -610}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    ,{  -370,  -520,  -370,  -520,  -610}
+    }
+   }
+  ,{{{   880, -1180,   880,   410,   880}
+    ,{   410, -1250,  -200,   410,  -200}
+    ,{   410, -1180,  -370,   410,  -370}
+    ,{   880, -1420,   880,   410,   880}
+    ,{   410, -1180,  -370,   410,  -370}
+    }
+   ,{{   410, -1420,  -370,   410,  -370}
+    ,{   230, -1600,  -550,   230,  -550}
+    ,{   410, -1420,  -370,   410,  -370}
+    ,{  -390, -1440,  -390,  -860,  -390}
+    ,{   410, -1420,  -370,   410,  -370}
+    }
+   ,{{   410, -1180,  -370,   410,  -370}
+    ,{   410, -1420,  -370,   410,  -370}
+    ,{   410, -1180,  -370,   410,  -370}
+    ,{   410, -1420,  -370,   410,  -370}
+    ,{   410, -1180,  -370,   410,  -370}
+    }
+   ,{{   880, -1250,   880,   410,   880}
+    ,{  -200, -1250,  -200,  -670,  -200}
+    ,{   410, -1420,  -370,   410,  -370}
+    ,{   880, -1420,   880,  -840,   880}
+    ,{   410, -1420,  -370,   410,  -370}
+    }
+   ,{{   410, -1180,  -370,   410,  -370}
+    ,{   410, -1420,  -370,   410,  -370}
+    ,{   410, -1180,  -370,   410,  -370}
+    ,{   410, -1420,  -370,   410,  -370}
+    ,{  -370, -1420,  -370,  -840,  -370}
+    }
+   }
+  ,{{{   750,   730,   750,   730, -1140}
+    ,{   -90,  -350,   -90,  -350, -1140}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{   750,   730,   750,   730, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    }
+   ,{{  -280,  -520,  -280,  -520, -1250}
+    ,{  -680,  -700,  -680,  -700, -1250}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -280,  -540,  -280,  -540, -1330}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    }
+   ,{{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    }
+   ,{{   750,   730,   750,   730, -1140}
+    ,{   -90,  -350,   -90,  -350, -1140}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{   750,   730,   750,   730, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    }
+   ,{{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    ,{  -500,  -520,  -500,  -520, -1310}
+    }
+   }
+  }
+ ,{{{{  1560,  1560,  1430,  1470,  1430}
+    ,{  1470,   820,   690,  1470,   690}
+    ,{   960,   310,   180,   960,   180}
+    ,{  1560,  1560,  1430,  1280,  1430}
+    ,{   960,   550,   180,   960,   180}
+    }
+   ,{{  1470,   820,   690,  1470,   690}
+    ,{  1470,   820,   690,  1470,   690}
+    ,{   960,   310,   180,   960,   180}
+    ,{    80,   -30,    80,  -310,  -150}
+    ,{   960,   310,   180,   960,   180}
+    }
+   ,{{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    }
+   ,{{  1560,  1560,  1430,  1280,  1430}
+    ,{   -90,  -200,   -90,  -480,  -320}
+    ,{   960,   310,   180,   960,   180}
+    ,{  1560,  1560,  1430,  1280,  1430}
+    ,{   960,   310,   180,   960,   180}
+    }
+   ,{{   960,   550,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   960,   310,   180,   960,   180}
+    ,{   550,   550,   180,    30,   180}
+    }
+   }
+  ,{{{  1560,  1560,  1430,   -30,  1430}
+    ,{   820,   820,   690,   -30,   690}
+    ,{   310,   310,   180,  -720,   180}
+    ,{  1560,  1560,  1430,  -960,  1430}
+    ,{   550,   550,   180,  -720,   180}
+    }
+   ,{{   820,   820,   690,   -30,   690}
+    ,{   820,   820,   690,   -30,   690}
+    ,{   310,   310,   180,  -960,   180}
+    ,{   -30,   -30,  -160, -1300,  -160}
+    ,{   310,   310,   180,  -960,   180}
+    }
+   ,{{   310,   310,   180,  -720,   180}
+    ,{   310,   310,   180,  -960,   180}
+    ,{   310,   310,   180,  -720,   180}
+    ,{   310,   310,   180,  -960,   180}
+    ,{   310,   310,   180,  -720,   180}
+    }
+   ,{{  1560,  1560,  1430,  -960,  1430}
+    ,{  -200,  -200,  -330, -1470,  -330}
+    ,{   310,   310,   180,  -960,   180}
+    ,{  1560,  1560,  1430,  -960,  1430}
+    ,{   310,   310,   180,  -960,   180}
+    }
+   ,{{   550,   550,   180,  -720,   180}
+    ,{   310,   310,   180,  -960,   180}
+    ,{   310,   310,   180,  -720,   180}
+    ,{   310,   310,   180,  -960,   180}
+    ,{   550,   550,   180,  -960,   180}
+    }
+   }
+  ,{{{  1430,  1280,  1430,  1280,  1200}
+    ,{   690,   540,   690,   540,   450}
+    ,{   180,    30,   180,    30,   -50}
+    ,{  1430,  1280,  1430,  1280,  1200}
+    ,{   180,    30,   180,    30,   -50}
+    }
+   ,{{   690,   540,   690,   540,   450}
+    ,{   690,   540,   690,   540,   450}
+    ,{   180,    30,   180,    30,   -50}
+    ,{    80,  -310,    80,  -310,  -150}
+    ,{   180,    30,   180,    30,   -50}
+    }
+   ,{{   180,    30,   180,    30,   -50}
+    ,{   180,    30,   180,    30,   -50}
+    ,{   180,    30,   180,    30,   -50}
+    ,{   180,    30,   180,    30,   -50}
+    ,{   180,    30,   180,    30,   -50}
+    }
+   ,{{  1430,  1280,  1430,  1280,  1200}
+    ,{   -90,  -480,   -90,  -480,  -320}
+    ,{   180,    30,   180,    30,   -50}
+    ,{  1430,  1280,  1430,  1280,  1200}
+    ,{   180,    30,   180,    30,   -50}
+    }
+   ,{{   180,    30,   180,    30,   -50}
+    ,{   180,    30,   180,    30,   -50}
+    ,{   180,    30,   180,    30,   -50}
+    ,{   180,    30,   180,    30,   -50}
+    ,{   180,    30,   180,    30,   -50}
+    }
+   }
+  ,{{{  1470,  -360,  1430,  1470,  1430}
+    ,{  1470,  -360,   690,  1470,   690}
+    ,{   960,  -630,   180,   960,   180}
+    ,{  1430,  -870,  1430,   960,  1430}
+    ,{   960,  -630,   180,   960,   180}
+    }
+   ,{{  1470,  -360,   690,  1470,   690}
+    ,{  1470,  -360,   690,  1470,   690}
+    ,{   960,  -870,   180,   960,   180}
+    ,{  -160, -1210,  -160,  -630,  -160}
+    ,{   960,  -870,   180,   960,   180}
+    }
+   ,{{   960,  -630,   180,   960,   180}
+    ,{   960,  -870,   180,   960,   180}
+    ,{   960,  -630,   180,   960,   180}
+    ,{   960,  -870,   180,   960,   180}
+    ,{   960,  -630,   180,   960,   180}
+    }
+   ,{{  1430,  -870,  1430,   960,  1430}
+    ,{  -330, -1380,  -330,  -800,  -330}
+    ,{   960,  -870,   180,   960,   180}
+    ,{  1430,  -870,  1430,  -290,  1430}
+    ,{   960,  -870,   180,   960,   180}
+    }
+   ,{{   960,  -630,   180,   960,   180}
+    ,{   960,  -870,   180,   960,   180}
+    ,{   960,  -630,   180,   960,   180}
+    ,{   960,  -870,   180,   960,   180}
+    ,{   180,  -870,   180,  -290,   180}
+    }
+   }
+  ,{{{  1300,  1280,  1300,  1280,   -10}
+    ,{   560,   540,   560,   540,   -10}
+    ,{    50,    30,    50,    30,  -760}
+    ,{  1300,  1280,  1300,  1280,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    }
+   ,{{   560,   540,   560,   540,   -10}
+    ,{   560,   540,   560,   540,   -10}
+    ,{    50,    30,    50,    30,  -760}
+    ,{   -50,  -310,   -50,  -310, -1100}
+    ,{    50,    30,    50,    30,  -760}
+    }
+   ,{{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    }
+   ,{{  1300,  1280,  1300,  1280,  -760}
+    ,{  -220,  -480,  -220,  -480, -1270}
+    ,{    50,    30,    50,    30,  -760}
+    ,{  1300,  1280,  1300,  1280,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    }
+   ,{{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    ,{    50,    30,    50,    30,  -760}
+    }
+   }
+  }
+ ,{{{{  2050,  1930,  1800,  2050,  1800}
+    ,{  2050,  1400,  1270,  2050,  1270}
+    ,{  1750,  1100,   970,  1750,   970}
+    ,{  1930,  1930,  1800,  1760,  1800}
+    ,{  1750,  1100,   970,  1750,   970}
+    }
+   ,{{  2050,  1400,  1270,  2050,  1270}
+    ,{  2050,  1400,  1270,  2050,  1270}
+    ,{  1740,  1090,   960,  1740,   960}
+    ,{   130,    10,   130,  -260,  -110}
+    ,{  1740,  1090,   960,  1740,   960}
+    }
+   ,{{  1760,  1110,   980,  1760,   980}
+    ,{  1760,  1110,   980,  1760,   980}
+    ,{  1750,  1100,   970,  1750,   970}
+    ,{  1760,  1110,   980,  1760,   980}
+    ,{  1750,  1100,   970,  1750,   970}
+    }
+   ,{{  1930,  1930,  1800,  1740,  1800}
+    ,{   300,   190,   300,   -80,    70}
+    ,{  1740,  1090,   960,  1740,   960}
+    ,{  1930,  1930,  1800,  1650,  1800}
+    ,{  1740,  1090,   960,  1740,   960}
+    }
+   ,{{  1760,  1110,   980,  1760,   980}
+    ,{  1760,  1110,   980,  1760,   980}
+    ,{  1750,  1100,   970,  1750,   970}
+    ,{  1760,  1110,   980,  1760,   980}
+    ,{   360,   360,     0,  -150,     0}
+    }
+   }
+  ,{{{  1930,  1930,  1800,   130,  1800}
+    ,{  1400,  1400,  1270,   130,  1270}
+    ,{  1100,  1100,   970,    70,   970}
+    ,{  1930,  1930,  1800,  -160,  1800}
+    ,{  1100,  1100,   970,    70,   970}
+    }
+   ,{{  1400,  1400,  1270,   130,  1270}
+    ,{  1400,  1400,  1270,   130,  1270}
+    ,{  1090,  1090,   960,  -180,   960}
+    ,{    10,    10,  -110, -1260,  -110}
+    ,{  1090,  1090,   960,  -180,   960}
+    }
+   ,{{  1110,  1110,   980,    70,   980}
+    ,{  1110,  1110,   980,  -160,   980}
+    ,{  1100,  1100,   970,    70,   970}
+    ,{  1110,  1110,   980,  -160,   980}
+    ,{  1100,  1100,   970,    70,   970}
+    }
+   ,{{  1930,  1930,  1800,  -180,  1800}
+    ,{   190,   190,    60, -1080,    60}
+    ,{  1090,  1090,   960,  -180,   960}
+    ,{  1930,  1930,  1800,  -590,  1800}
+    ,{  1090,  1090,   960,  -180,   960}
+    }
+   ,{{  1110,  1110,   980,    70,   980}
+    ,{  1110,  1110,   980,  -160,   980}
+    ,{  1100,  1100,   970,    70,   970}
+    ,{  1110,  1110,   980,  -160,   980}
+    ,{   360,   360,     0, -1150,     0}
+    }
+   }
+  ,{{{  1800,  1650,  1800,  1650,  1570}
+    ,{  1270,  1120,  1270,  1120,  1040}
+    ,{   970,   820,   970,   820,   740}
+    ,{  1800,  1650,  1800,  1650,  1570}
+    ,{   970,   820,   970,   820,   740}
+    }
+   ,{{  1270,  1120,  1270,  1120,  1040}
+    ,{  1270,  1120,  1270,  1120,  1040}
+    ,{   960,   810,   960,   810,   730}
+    ,{   130,  -260,   130,  -260,  -110}
+    ,{   960,   810,   960,   810,   730}
+    }
+   ,{{   980,   830,   980,   830,   740}
+    ,{   980,   830,   980,   830,   740}
+    ,{   970,   820,   970,   820,   740}
+    ,{   980,   830,   980,   830,   740}
+    ,{   970,   820,   970,   820,   740}
+    }
+   ,{{  1800,  1650,  1800,  1650,  1570}
+    ,{   300,   -80,   300,   -80,    70}
+    ,{   960,   810,   960,   810,   730}
+    ,{  1800,  1650,  1800,  1650,  1570}
+    ,{   960,   810,   960,   810,   730}
+    }
+   ,{{   980,   830,   980,   830,   740}
+    ,{   980,   830,   980,   830,   740}
+    ,{   970,   820,   970,   820,   740}
+    ,{   980,   830,   980,   830,   740}
+    ,{     0,  -150,     0,  -150,  -240}
+    }
+   }
+  ,{{{  2050,   220,  1800,  2050,  1800}
+    ,{  2050,   220,  1270,  2050,  1270}
+    ,{  1750,   170,   970,  1750,   970}
+    ,{  1800,   -70,  1800,  1760,  1800}
+    ,{  1750,   170,   970,  1750,   970}
+    }
+   ,{{  2050,   220,  1270,  2050,  1270}
+    ,{  2050,   220,  1270,  2050,  1270}
+    ,{  1740,   -80,   960,  1740,   960}
+    ,{  -110, -1160,  -110,  -580,  -110}
+    ,{  1740,   -80,   960,  1740,   960}
+    }
+   ,{{  1760,   170,   980,  1760,   980}
+    ,{  1760,   -70,   980,  1760,   980}
+    ,{  1750,   170,   970,  1750,   970}
+    ,{  1760,   -70,   980,  1760,   980}
+    ,{  1750,   170,   970,  1750,   970}
+    }
+   ,{{  1800,   -80,  1800,  1740,  1800}
+    ,{    60,  -980,    60,  -400,    60}
+    ,{  1740,   -80,   960,  1740,   960}
+    ,{  1800,  -490,  1800,    80,  1800}
+    ,{  1740,   -80,   960,  1740,   960}
+    }
+   ,{{  1760,   170,   980,  1760,   980}
+    ,{  1760,   -70,   980,  1760,   980}
+    ,{  1750,   170,   970,  1750,   970}
+    ,{  1760,   -70,   980,  1760,   980}
+    ,{     0, -1050,     0,  -470,     0}
+    }
+   }
+  ,{{{  1670,  1650,  1670,  1650,   570}
+    ,{  1140,  1120,  1140,  1120,   570}
+    ,{   840,   820,   840,   820,    30}
+    ,{  1670,  1650,  1670,  1650,    40}
+    ,{   840,   820,   840,   820,    30}
+    }
+   ,{{  1140,  1120,  1140,  1120,   570}
+    ,{  1140,  1120,  1140,  1120,   570}
+    ,{   830,   810,   830,   810,    20}
+    ,{     0,  -260,     0,  -260, -1050}
+    ,{   830,   810,   830,   810,    20}
+    }
+   ,{{   850,   830,   850,   830,    40}
+    ,{   850,   830,   850,   830,    40}
+    ,{   840,   820,   840,   820,    30}
+    ,{   850,   830,   850,   830,    40}
+    ,{   840,   820,   840,   820,    30}
+    }
+   ,{{  1670,  1650,  1670,  1650,    20}
+    ,{   180,   -80,   180,   -80,  -870}
+    ,{   830,   810,   830,   810,    20}
+    ,{  1670,  1650,  1670,  1650,  -380}
+    ,{   830,   810,   830,   810,    20}
+    }
+   ,{{   850,   830,   850,   830,    40}
+    ,{   850,   830,   850,   830,    40}
+    ,{   840,   820,   840,   820,    30}
+    ,{   850,   830,   850,   830,    40}
+    ,{  -130,  -150,  -130,  -150,  -940}
+    }
+   }
+  }
+ ,{{{{  2120,  2120,  1990,  2120,  1990}
+    ,{  2120,  1470,  1340,  2120,  1340}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  2120,  2120,  1990,  1990,  1990}
+    ,{  1860,  1210,  1080,  1860,  1080}
+    }
+   ,{{  2120,  1470,  1340,  2120,  1340}
+    ,{  2120,  1470,  1340,  2120,  1340}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    ,{   180,    60,   180,  -210,   -60}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    }
+   ,{{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1860,  1210,  1080,  1860,  1080}
+    }
+   ,{{  2120,  2120,  1990,  1840,  1990}
+    ,{  -120,  -230,  -120,  -510,  -360}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    ,{  2120,  2120,  1990,  1840,  1990}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    }
+   ,{{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1550,   900,   770,  1550,   770}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{   640,   640,   270,   120,   270}
+    }
+   }
+  ,{{{  2120,  2120,  1990,   300,  1990}
+    ,{  1470,  1470,  1340,   190,  1340}
+    ,{  1340,  1340,  1210,   300,  1210}
+    ,{  2120,  2120,  1990,    60,  1990}
+    ,{  1210,  1210,  1080,   180,  1080}
+    }
+   ,{{  1470,  1470,  1340,   190,  1340}
+    ,{  1470,  1470,  1340,   190,  1340}
+    ,{  1190,  1190,  1060,   -80,  1060}
+    ,{    60,    60,   -60, -1210,   -60}
+    ,{  1190,  1190,  1060,   -80,  1060}
+    }
+   ,{{  1340,  1340,  1210,   300,  1210}
+    ,{  1340,  1340,  1210,    60,  1210}
+    ,{  1340,  1340,  1210,   300,  1210}
+    ,{  1340,  1340,  1210,    60,  1210}
+    ,{  1210,  1210,  1080,   180,  1080}
+    }
+   ,{{  2120,  2120,  1990,   -80,  1990}
+    ,{  -230,  -230,  -360, -1510,  -360}
+    ,{  1190,  1190,  1060,   -80,  1060}
+    ,{  2120,  2120,  1990,  -400,  1990}
+    ,{  1190,  1190,  1060,   -80,  1060}
+    }
+   ,{{  1340,  1340,  1210,    60,  1210}
+    ,{  1340,  1340,  1210,    60,  1210}
+    ,{   900,   900,   770,  -130,   770}
+    ,{  1340,  1340,  1210,    60,  1210}
+    ,{   640,   640,   270,  -870,   270}
+    }
+   }
+  ,{{{  1990,  1840,  1990,  1840,  1750}
+    ,{  1340,  1190,  1340,  1190,  1100}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{  1990,  1840,  1990,  1840,  1750}
+    ,{  1080,   930,  1080,   930,   840}
+    }
+   ,{{  1340,  1190,  1340,  1190,  1100}
+    ,{  1340,  1190,  1340,  1190,  1100}
+    ,{  1060,   910,  1060,   910,   820}
+    ,{   180,  -210,   180,  -210,   -60}
+    ,{  1060,   910,  1060,   910,   820}
+    }
+   ,{{  1210,  1060,  1210,  1060,   970}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{  1080,   930,  1080,   930,   840}
+    }
+   ,{{  1990,  1840,  1990,  1840,  1750}
+    ,{  -120,  -510,  -120,  -510,  -360}
+    ,{  1060,   910,  1060,   910,   820}
+    ,{  1990,  1840,  1990,  1840,  1750}
+    ,{  1060,   910,  1060,   910,   820}
+    }
+   ,{{  1210,  1060,  1210,  1060,   970}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{   770,   620,   770,   620,   530}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{   270,   120,   270,   120,    30}
+    }
+   }
+  ,{{{  2120,   400,  1990,  2120,  1990}
+    ,{  2120,   290,  1340,  2120,  1340}
+    ,{  1990,   400,  1210,  1990,  1210}
+    ,{  1990,   160,  1990,  1990,  1990}
+    ,{  1860,   270,  1080,  1860,  1080}
+    }
+   ,{{  2120,   290,  1340,  2120,  1340}
+    ,{  2120,   290,  1340,  2120,  1340}
+    ,{  1840,    10,  1060,  1840,  1060}
+    ,{   -60, -1110,   -60,  -530,   -60}
+    ,{  1840,    10,  1060,  1840,  1060}
+    }
+   ,{{  1990,   400,  1210,  1990,  1210}
+    ,{  1990,   160,  1210,  1990,  1210}
+    ,{  1990,   400,  1210,  1990,  1210}
+    ,{  1990,   160,  1210,  1990,  1210}
+    ,{  1860,   270,  1080,  1860,  1080}
+    }
+   ,{{  1990,    10,  1990,  1840,  1990}
+    ,{  -360, -1410,  -360,  -830,  -360}
+    ,{  1840,    10,  1060,  1840,  1060}
+    ,{  1990,  -310,  1990,   270,  1990}
+    ,{  1840,    10,  1060,  1840,  1060}
+    }
+   ,{{  1990,   160,  1210,  1990,  1210}
+    ,{  1990,   160,  1210,  1990,  1210}
+    ,{  1550,   -40,   770,  1550,   770}
+    ,{  1990,   160,  1210,  1990,  1210}
+    ,{   270,  -780,   270,  -200,   270}
+    }
+   }
+  ,{{{  1860,  1840,  1860,  1840,   640}
+    ,{  1210,  1190,  1210,  1190,   640}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1860,  1840,  1860,  1840,   270}
+    ,{   950,   930,   950,   930,   140}
+    }
+   ,{{  1210,  1190,  1210,  1190,   640}
+    ,{  1210,  1190,  1210,  1190,   640}
+    ,{   930,   910,   930,   910,   120}
+    ,{    50,  -210,    50,  -210, -1000}
+    ,{   930,   910,   930,   910,   120}
+    }
+   ,{{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   950,   930,   950,   930,   140}
+    }
+   ,{{  1860,  1840,  1860,  1840,   120}
+    ,{  -250,  -510,  -250,  -510, -1300}
+    ,{   930,   910,   930,   910,   120}
+    ,{  1860,  1840,  1860,  1840,  -200}
+    ,{   930,   910,   930,   910,   120}
+    }
+   ,{{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   640,   620,   640,   620,  -170}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   140,   120,   140,   120,  -670}
+    }
+   }
+  }
+ ,{{{{  2120,  2120,  1990,  2120,  1990}
+    ,{  2120,  1470,  1340,  2120,  1340}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  2120,  2120,  1990,  1990,  1990}
+    ,{  1860,  1210,  1080,  1860,  1080}
+    }
+   ,{{  2120,  1470,  1340,  2120,  1340}
+    ,{  2120,  1470,  1340,  2120,  1340}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    ,{   400,   290,   400,    10,   170}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    }
+   ,{{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1860,  1210,  1080,  1860,  1080}
+    }
+   ,{{  2120,  2120,  1990,  1840,  1990}
+    ,{   540,   190,   540,   -80,    70}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    ,{  2120,  2120,  1990,  1840,  1990}
+    ,{  1840,  1190,  1060,  1840,  1060}
+    }
+   ,{{  1990,  1340,  1210,  1990,  1210}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{  1750,  1100,   970,  1750,   970}
+    ,{  1990,  1340,  1210,  1990,  1210}
+    ,{   640,   640,   270,   120,   270}
+    }
+   }
+  ,{{{  2120,  2120,  1990,   540,  1990}
+    ,{  1470,  1470,  1340,   190,  1340}
+    ,{  1340,  1340,  1210,   540,  1210}
+    ,{  2120,  2120,  1990,    60,  1990}
+    ,{  1210,  1210,  1080,   180,  1080}
+    }
+   ,{{  1470,  1470,  1340,   190,  1340}
+    ,{  1470,  1470,  1340,   190,  1340}
+    ,{  1190,  1190,  1060,   -80,  1060}
+    ,{   290,   290,   160,  -980,   160}
+    ,{  1190,  1190,  1060,   -80,  1060}
+    }
+   ,{{  1340,  1340,  1210,   540,  1210}
+    ,{  1340,  1340,  1210,    60,  1210}
+    ,{  1340,  1340,  1210,   540,  1210}
+    ,{  1340,  1340,  1210,    60,  1210}
+    ,{  1210,  1210,  1080,   180,  1080}
+    }
+   ,{{  2120,  2120,  1990,   -80,  1990}
+    ,{   190,   190,    60, -1080,    60}
+    ,{  1190,  1190,  1060,   -80,  1060}
+    ,{  2120,  2120,  1990,  -400,  1990}
+    ,{  1190,  1190,  1060,   -80,  1060}
+    }
+   ,{{  1340,  1340,  1210,    70,  1210}
+    ,{  1340,  1340,  1210,    60,  1210}
+    ,{  1100,  1100,   970,    70,   970}
+    ,{  1340,  1340,  1210,    60,  1210}
+    ,{   640,   640,   270,  -810,   270}
+    }
+   }
+  ,{{{  1990,  1840,  1990,  1840,  1750}
+    ,{  1340,  1190,  1340,  1190,  1100}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{  1990,  1840,  1990,  1840,  1750}
+    ,{  1080,   930,  1080,   930,   840}
+    }
+   ,{{  1340,  1190,  1340,  1190,  1100}
+    ,{  1340,  1190,  1340,  1190,  1100}
+    ,{  1060,   910,  1060,   910,   820}
+    ,{   400,    10,   400,    10,   170}
+    ,{  1060,   910,  1060,   910,   820}
+    }
+   ,{{  1210,  1060,  1210,  1060,   970}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{  1080,   930,  1080,   930,   840}
+    }
+   ,{{  1990,  1840,  1990,  1840,  1750}
+    ,{   540,   -80,   540,   -80,    70}
+    ,{  1060,   910,  1060,   910,   820}
+    ,{  1990,  1840,  1990,  1840,  1750}
+    ,{  1060,   910,  1060,   910,   820}
+    }
+   ,{{  1210,  1060,  1210,  1060,   970}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{   970,   820,   970,   820,   740}
+    ,{  1210,  1060,  1210,  1060,   970}
+    ,{   270,   120,   270,   120,    30}
+    }
+   }
+  ,{{{  2120,   400,  1990,  2120,  1990}
+    ,{  2120,   290,  1340,  2120,  1340}
+    ,{  1990,   400,  1210,  1990,  1210}
+    ,{  1990,   160,  1990,  1990,  1990}
+    ,{  1860,   270,  1080,  1860,  1080}
+    }
+   ,{{  2120,   290,  1340,  2120,  1340}
+    ,{  2120,   290,  1340,  2120,  1340}
+    ,{  1840,    10,  1060,  1840,  1060}
+    ,{   160,  -890,   160,  -310,   160}
+    ,{  1840,    10,  1060,  1840,  1060}
+    }
+   ,{{  1990,   400,  1210,  1990,  1210}
+    ,{  1990,   160,  1210,  1990,  1210}
+    ,{  1990,   400,  1210,  1990,  1210}
+    ,{  1990,   160,  1210,  1990,  1210}
+    ,{  1860,   270,  1080,  1860,  1080}
+    }
+   ,{{  1990,    10,  1990,  1840,  1990}
+    ,{    60,  -980,    60,  -400,    60}
+    ,{  1840,    10,  1060,  1840,  1060}
+    ,{  1990,  -310,  1990,   270,  1990}
+    ,{  1840,    10,  1060,  1840,  1060}
+    }
+   ,{{  1990,   170,  1210,  1990,  1210}
+    ,{  1990,   160,  1210,  1990,  1210}
+    ,{  1750,   170,   970,  1750,   970}
+    ,{  1990,   160,  1210,  1990,  1210}
+    ,{   270,  -780,   270,  -200,   270}
+    }
+   }
+  ,{{{  1860,  1840,  1860,  1840,   640}
+    ,{  1210,  1190,  1210,  1190,   640}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1860,  1840,  1860,  1840,   270}
+    ,{   950,   930,   950,   930,   140}
+    }
+   ,{{  1210,  1190,  1210,  1190,   640}
+    ,{  1210,  1190,  1210,  1190,   640}
+    ,{   930,   910,   930,   910,   120}
+    ,{   270,    10,   270,    10,  -780}
+    ,{   930,   910,   930,   910,   120}
+    }
+   ,{{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   950,   930,   950,   930,   140}
+    }
+   ,{{  1860,  1840,  1860,  1840,   120}
+    ,{   180,   -80,   180,   -80,  -810}
+    ,{   930,   910,   930,   910,   120}
+    ,{  1860,  1840,  1860,  1840,  -200}
+    ,{   930,   910,   930,   910,   120}
+    }
+   ,{{  1080,  1060,  1080,  1060,   270}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   840,   820,   840,   820,    30}
+    ,{  1080,  1060,  1080,  1060,   270}
+    ,{   140,   120,   140,   120,  -670}
+    }
+   }
+  }
+ }};
diff --git a/C/ViennaRNA/inverse.c b/C/ViennaRNA/inverse.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/inverse.c
@@ -0,0 +1,528 @@
+/*
+		      search for sequences that
+		  fold into a given target structure
+
+			    c Ivo Hofacker
+			  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define TDIST 0     /* use tree distance */
+#define PF    1     /* include support for partiton function */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include <float.h>
+#if PF
+#include "ViennaRNA/part_func.h"
+#endif
+#include "ViennaRNA/fold.h"
+#if TDIST
+#include "ViennaRNA/dist_vars.h"
+#include "ViennaRNA/treedist.h"
+#include "ViennaRNA/RNAstruct.h"
+#endif
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/pair_mat.h"
+
+PRIVATE double  adaptive_walk(char *start, const char *target);
+PRIVATE void   shuffle(int *list, int len);
+PRIVATE void   make_start(char* start, const char *structure);
+PRIVATE void   make_ptable(const char *structure, int *table);
+PRIVATE void   make_pairset(void);
+PRIVATE double  mfe_cost(const char *, char*, const char *);
+PRIVATE double  pf_cost(const char *, char *, const char *);
+PRIVATE char  *aux_struct(const char* structure );
+
+/* for backward compatibility, make sure symbolset can hold 20 characters */
+PRIVATE char   default_alpha[21] = "AUGC";
+PUBLIC  char   *symbolset = default_alpha;
+PUBLIC  int    give_up = 0;
+PUBLIC  float  final_cost = 0; /* when to stop inverse_pf_fold */
+PUBLIC  int    inv_verbose=0;  /* print out substructure on which inverse_fold() fails */
+
+PRIVATE char   pairset[2*MAXALPHA+1];
+PRIVATE int    base, npairs;
+PRIVATE int    nc2;
+
+/*-------------------------------------------------------------------------*/
+PRIVATE int fold_type;
+#if TDIST
+PRIVATE Tree *T0;
+#endif
+PRIVATE double cost2;
+
+PRIVATE double adaptive_walk(char *start, const char *target)
+{
+#ifdef DUMMY
+   printf("%s\n%s %c\n", start, target, backtrack_type );
+   return 0.;
+#endif
+   int i,j,p,tt,w1,w2, n_pos, len, flag;
+   long  walk_len;
+   char *string, *string2, *cstring, *structure, *struct2;
+   int *mut_pos_list, mut_sym_list[MAXALPHA+1], mut_pair_list[2*MAXALPHA+1];
+   int *w1_list, *w2_list, mut_position, symbol, bp;
+   int *target_table, *test_table;
+   char cont;
+   double cost, current_cost, ccost2;
+   double (*cost_function)(const char *, char *, const char *);
+
+   len = strlen(start);
+   if (strlen(target)!=len) {
+      vrna_message_error("%s\n%s\nadaptive_walk: start and target have unequal length", start, target);
+   }
+   string    = (char *) vrna_alloc(sizeof(char)*(len+1));
+   cstring   = (char *) vrna_alloc(sizeof(char)*(len+1));
+   string2   = (char *) vrna_alloc(sizeof(char)*(len+1));
+   structure = (char *) vrna_alloc(sizeof(char)*(len+1));
+   struct2   = (char *) vrna_alloc(sizeof(char)*(len+1));
+   mut_pos_list = (int *) vrna_alloc(sizeof(int)*len);
+   w1_list = (int *) vrna_alloc(sizeof(int)*len);
+   w2_list = (int *) vrna_alloc(sizeof(int)*len);
+   target_table = (int *) vrna_alloc(sizeof(int)*len);
+   test_table = (int *) vrna_alloc(sizeof(int)*len);
+
+   make_ptable(target, target_table);
+
+   for (i=0; i<base; i++) mut_sym_list[i] = i;
+   for (i=0; i<npairs; i++) mut_pair_list[i] = i;
+
+   for (i=0; i<len; i++)
+      string[i] = (islower(start[i]))?toupper(start[i]):start[i];
+   walk_len = 0;
+
+   if (fold_type==0) cost_function = mfe_cost;
+   else cost_function = pf_cost;
+
+   cost = cost_function(string, structure, target);
+
+   if (fold_type==0) ccost2=cost2;
+   else { ccost2 = -1.; cost2=0; }
+
+   strcpy(cstring, string);
+   current_cost = cost;
+
+   if (cost>0) do {
+      cont=0;
+
+      if (fold_type==0) { /* min free energy fold */
+	 make_ptable(structure, test_table);
+	 for (j=w1=w2=flag=0; j<len; j++)
+	    if ((tt=target_table[j])!=test_table[j]) {
+	       if ((tt<j)&&(isupper(start[j]))) w1_list[w1++] = j;   /* incorrectly paired */
+	       if ((flag==0)&&(j>0))
+		  if ((target_table[j-1]<j-1)&&isupper(start[j-1]))
+			w2_list[w2++] = j-1;                  /* adjacent to incorrect position */
+	       if (w2>1) if (w2_list[w2-2]==w2_list[w2-1]) w2--;
+
+	       flag = 1;
+	    } else {
+	       if (flag==1) if ((tt<j)&&isupper(start[j]))
+		  w2_list[w2++] = j;                          /* adjacent to incorrect position */
+	       flag = 0;
+	    }
+	 shuffle(w1_list, w1);
+	 shuffle(w2_list, w2);
+	 for (j=n_pos=0; j<w1; j++) mut_pos_list[n_pos++] = w1_list[j];
+	 for (j=0; j<w2; j++) mut_pos_list[n_pos++] = w2_list[j];
+      } else { /* partition_function */
+	 for (j=n_pos=0; j<len; j++) if (isupper(start[j]))
+	    if (target_table[j]<=j) mut_pos_list[n_pos++] = j;
+	 shuffle(mut_pos_list, n_pos);
+      }
+
+      string2[0]='\0';
+      for (mut_position=0; mut_position<n_pos; mut_position++){
+
+	 strcpy(string, cstring);
+	 shuffle(mut_sym_list,  base);
+	 shuffle(mut_pair_list, npairs);
+
+	 i = mut_pos_list[mut_position];
+
+	 if (target_table[i]<0) /* unpaired base */
+	    for (symbol=0;symbol<base;symbol++) {
+
+	       if(cstring[i]==
+		  symbolset[mut_sym_list[symbol]]) continue;
+
+	       string[i] = symbolset[mut_sym_list[symbol]];
+
+	       cost = cost_function(string, structure, target);
+
+	       if ( cost + DBL_EPSILON < current_cost  ) break;
+	       if (( cost == current_cost)&&(cost2<ccost2)){
+		  strcpy(string2, string);
+		  strcpy(struct2, structure);
+		  ccost2 = cost2;
+	       }
+	    }
+	 else  /* paired base */
+	    for  (bp=0; bp<npairs; bp++) {
+	       j = target_table[i];
+	       p = mut_pair_list[bp]*2;
+	       if ((cstring[i] == pairset[p]) &&
+		   (cstring[j] == pairset[p+1]))
+		  continue;
+	       string[i] = pairset[p];
+	       string[j] = pairset[p+1];
+
+	       cost = cost_function(string, structure, target);
+
+	       if ( cost < current_cost ) break;
+	       if (( cost == current_cost)&&(cost2<ccost2)){
+		  strcpy(string2, string);
+		  strcpy(struct2, structure);
+		  ccost2 = cost2;
+	       }
+	    }
+
+	 if ( cost < current_cost ) {
+	    strcpy(cstring, string);
+	    current_cost = cost;
+	    ccost2 = cost2;
+	    walk_len++;
+	    if (cost>0) cont=1;
+	    break;
+	 }
+      }
+      if ((current_cost>0)&&(cont==0)&&(string2[0])) {
+	 /* no mutation that decreased cost was found,
+	    but the the sequence in string2 decreases cost2 while keeping
+	    cost constant */
+	 strcpy(cstring, string2);
+	 strcpy(structure, struct2);
+	 nc2++; cont=1;
+      }
+   } while (cont);
+
+   for (i=0; i<len; i++) if (isupper(start[i])) start[i]=cstring[i];
+
+#if TDIST
+   if (fold_type==0) { free_tree(T0); T0=NULL; }
+#endif
+   free(test_table);
+   free(target_table);
+   free(mut_pos_list);
+   free(w2_list);
+   free(w1_list);
+   free(struct2);
+   free(structure);
+   free(string2);
+   free(cstring);
+   free(string);
+
+   return current_cost;
+}
+
+/*-------------------------------------------------------------------------*/
+
+/* shuffle produces a ronaom list by doing len exchanges */
+PRIVATE void shuffle(int *list, int len)
+{
+   int i, rn;
+
+   for (i=0;i<len;i++) {
+     int temp;
+     rn = i + (int) (vrna_urn()*(len-i));   /* [i..len-1] */
+     /* swap element i and rn */
+     temp = list[i];
+     list[i] = list[rn];
+     list[rn] = temp;
+   }
+}
+
+/*-------------------------------------------------------------------------*/
+
+PRIVATE void make_ptable(const char *structure, int *table)
+{
+   int i,j,hx;
+   int *stack;
+
+   hx=0;
+   stack = (int *) vrna_alloc(sizeof(int)*(strlen(structure)+1));
+
+   for (i=0; i<strlen(structure); i++) {
+      switch (structure[i]) {
+       case '.':
+	 table[i]= -1;
+	 break;
+       case '(':
+	 stack[hx++]=i;
+	 break;
+       case ')':
+	 j = stack[--hx];
+	 if (hx<0) {
+	    vrna_message_error("%s\nunbalanced brackets in make_ptable", structure);
+	 }
+	 table[i]=j;
+	 table[j]=i;
+	 break;
+      }
+   }
+   if (hx!=0) {
+      vrna_message_error("%s\nunbalanced brackets in make_ptable", structure);
+   }
+   free(stack);
+}
+
+/*-------------------------------------------------------------------------*/
+
+#define WALK(i,j) \
+    strncpy(wstruct, structure+i, j-i+1); \
+    wstruct[j-i+1]='\0'; \
+    strncpy(wstring, string+i, j-i+1); \
+    wstring[j-i+1]='\0'; \
+    dist=adaptive_walk(wstring, wstruct); \
+    strncpy(string+i, wstring, j-i+1); \
+    if ((dist>0)&&(give_up)) goto adios
+
+PUBLIC float inverse_fold(char *start, char *structure)
+{
+   int i, j, jj, len, o;
+   int *pt;
+   char *string, *wstring, *wstruct, *aux;
+   double dist=0;
+
+   nc2 = j = o = fold_type = 0;
+
+   len = strlen(structure);
+   if (strlen(start)!=len) {
+      vrna_message_error("%s\n%s\ninverse_fold: start and structure have unequal length", start, structure);
+   }
+   string = (char *) vrna_alloc(len+1);
+   wstring = (char *) vrna_alloc(len+1);
+   wstruct = (char *) vrna_alloc(len+1);
+   pt = (int *) vrna_alloc(sizeof(int)*(len+2));
+   pt[len] = len+1;
+
+   aux = aux_struct(structure);
+   strcpy(string, start);
+   make_pairset();
+   make_start(string, structure);
+
+   make_ptable(structure, pt);
+
+   while (j<len) {
+      while ((j<len)&&(structure[j]!=')')) {
+	 if (aux[j]=='[') o++;
+	 if (aux[j]==']') o--;
+	 j++;
+      }
+      i=j;
+      while ((i>0) && structure[--i]!='(');
+      if (structure[i]=='.') { /* no pair found -> open chain */
+	WALK(0,len-1);
+      }
+
+      if (aux[i]!='[') { i--; j++;}
+      while (pt[j]==i) {
+	 backtrack_type='C';
+	 if (aux[i]!='[') {
+	    while (aux[--i]!='[');
+	    while (aux[++j]!=']');
+	    /* WALK(i,j); */
+	 }
+	 WALK(i,j);
+	 o--;
+	 jj = j; i--;
+	 while (aux[++j]=='.');
+	 while ((i>=0)&&(aux[i]=='.')) i--;
+	 if (pt[j]!=i) {
+	    backtrack_type = (o==0)? 'F' : 'M';
+	    if (j-jj>8) { WALK((i+1),(jj)); }
+	    WALK((i+1), (j-1));
+	    while ((i>=0) &&(aux[i]==']')) {
+	       i=pt[i]-1;
+	       while ((i>=0)&&(aux[i]=='.')) i--;
+	       WALK((i+1), (j-1));
+	    }
+	 }
+      }
+   }
+ adios:
+   backtrack_type='F';
+   if ((dist>0)&&(inv_verbose)) printf("%s\n%s\n", wstring, wstruct);
+   /*if ((dist==0)||(give_up==0))*/ strcpy(start, string);
+   free(wstring); free(wstruct);
+   free(string); free(aux);
+   free(pt);
+/*   if (dist>0) printf("%3d \n", nc2); */
+   return dist;
+}
+
+/*-------------------------------------------------------------------------*/
+
+PUBLIC float inverse_pf_fold(char *start, char *target)
+{
+   double dist;
+   int dang;
+
+   dang=dangles;
+   if (dangles!=0) dangles=2;
+
+   update_fold_params();    /* make sure there is a valid pair matrix */
+   make_pairset();
+   make_start(start, target);
+   fold_type=1;
+   do_backtrack = 0;
+   dist = adaptive_walk(start, target);
+   dangles=dang;
+   return (dist+final_cost);
+}
+
+/*-------------------------------------------------------------------------*/
+
+PRIVATE void make_start(char* start, const char *structure)
+{
+   int i,j,k,l,r,length;
+   int *table, *S, sym[MAXALPHA], ss;
+
+   length=strlen(start);
+   table = (int *) vrna_alloc(sizeof(int)*length);
+   S = (int *) vrna_alloc(sizeof(int)*length);
+
+   make_ptable(structure, table);
+   for (i=0; i<strlen(start); i++) S[i] = encode_char(toupper(start[i]));
+   for (i=0; i<strlen(symbolset); i++) sym[i] = i;
+
+   for (k=0; k<length; k++) {
+      if (table[k]<k) continue;
+      if (((vrna_urn()<0.5) && isupper(start[k])) ||
+	  islower(start[table[k]])) {
+	i = table[k]; j = k;
+      } else {
+	i = k; j = table[k];
+      }
+
+      if (!pair[S[i]][S[j]]) {   /* make a valid pair by mutating j */
+	shuffle(sym, (int) base);
+	for (l=0; l<base; l++) {
+	  ss = encode_char(symbolset[sym[l]]);
+	  if (pair[S[i]][ss]) break;
+	}
+	if (l==base) { /* nothing pairs start[i] */
+	  r = 2*vrna_int_urn(0, npairs-1);
+	  start[i] = pairset[r];
+	  start[j] = pairset[r+1];
+	} else start[j] = symbolset[sym[l]];
+      }
+   }
+   free(table);
+   free(S);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void make_pairset(void)
+{
+   int i,j;
+   int sym[MAXALPHA];
+
+   make_pair_matrix();
+   base = strlen(symbolset);
+
+   for (i=0; i< base; i++) sym[i] = encode_char(symbolset[i]);
+
+   for (i=npairs=0; i< base; i++)
+      for (j=0; j<base; j++)
+	 if (pair[sym[i]][sym[j]]) {
+	    pairset[npairs++] = symbolset[i];
+	    pairset[npairs++] = symbolset[j];
+	 }
+   npairs /= 2;
+   if (npairs==0) vrna_message_error("No pairs in this alphabet!");
+}
+/*---------------------------------------------------------------------------*/
+
+PRIVATE double mfe_cost(const char *string, char *structure, const char *target)
+{
+#if TDIST
+   Tree *T1;
+   char *xstruc;
+#endif
+   double energy, distance;
+
+   if (strlen(string)!=strlen(target)) {
+      vrna_message_error("%s\n%s\nunequal length in mfe_cost", string, target);
+   }
+   energy = fold(string, structure);
+#if TDIST
+   if (T0 == NULL) {
+      xstruc = expand_Full(target);
+      T0=make_tree(xstruc);
+      free(xstruc);
+   }
+
+   xstruc = expand_Full(structure);
+   T1=make_tree(xstruc);
+   distance = tree_edit_distance(T0,T1);
+   free(xstruc);
+   free_tree(T1);
+#else
+   distance = (double) vrna_bp_distance(target, structure);
+#endif
+   cost2 = energy_of_structure(string, target, 0) - energy;
+   return (double) distance;
+}
+/*---------------------------------------------------------------------------*/
+
+PRIVATE double pf_cost(const char *string, char *structure, const char *target)
+{
+#if PF
+   double  f, e;
+
+   f = pf_fold(string, structure);
+   e = energy_of_structure(string, target, 0);
+   return (double) (e-f-final_cost);
+#else
+   vrna_message_error("this version not linked with pf_fold");
+   return 0;
+#endif
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE char *aux_struct(const char* structure )
+{
+   int       *match_paren;
+   int          i, o, p;
+   char        *string;
+
+   string = (char *) vrna_alloc(sizeof(char)*(strlen(structure)+1));
+   match_paren = (int *) vrna_alloc(sizeof(int)*(strlen(structure)/2+1));
+   strcpy(string, structure);
+
+   i = o = 0;
+   while (string[i]) {
+      switch (string[i]) {
+       case '.': break;
+       case '(':
+	 match_paren[++o]=i;
+	 break;
+       case ')':
+	 p=i;
+	 while ((string[p+1]==')')&&(match_paren[o-1]==match_paren[o]-1)) {
+	    p++; o--;
+	 }
+	 string[p]=']';
+	 i=p;
+	 string[match_paren[o]]='[';
+	 o--;
+	 break;
+       default:
+	 vrna_message_error("Junk in structure at aux_structure\n");
+      }
+      i++;
+   }
+   free(match_paren);
+   return(string);
+}
diff --git a/C/ViennaRNA/inverse.h b/C/ViennaRNA/inverse.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/inverse.h
@@ -0,0 +1,68 @@
+#ifndef VIENNA_RNA_PACKAGE_INVERSE_H
+#define VIENNA_RNA_PACKAGE_INVERSE_H
+
+/**
+ *  @file     inverse.h
+ *  @ingroup  inverse_fold
+ *  @brief    Inverse folding routines
+ */
+
+/**
+ *  @addtogroup inverse_fold
+ *  @brief RNA sequence design
+ *  
+ *  @{
+ *  @ingroup  inverse_fold
+ */
+
+/**
+ *  \brief This global variable points to the allowed bases, initially "AUGC".
+ *  It can be used to design sequences from reduced alphabets.
+ */
+extern char *symbolset;
+/** when to stop inverse_pf_fold() */
+extern  float final_cost;
+/** default 0: try to minimize structure distance even if no exact solution can be found */
+extern  int   give_up;
+/** print out substructure on which inverse_fold() fails */
+extern  int   inv_verbose;
+
+/**
+ *  \brief Find sequences with predefined structure
+ * 
+ *  This function searches for a sequence with minimum free energy structure
+ *  provided in the parameter 'target', starting with sequence 'start'.
+ *  It returns 0 if the search was successful, otherwise a structure distance
+ *  in terms of the energy difference between the search result and the actual
+ *  target 'target' is returned. The found sequence is returned in 'start'.
+ *  If #give_up is set to 1, the function will return as soon as it is
+ *  clear that the search will be unsuccessful, this speeds up the algorithm
+ *  if you are only interested in exact solutions.
+ * 
+ *  \param  start   The start sequence
+ *  \param  target  The target secondary structure in dot-bracket notation
+ *  \return         The distance to the target in case a search was unsuccessful, 0 otherwise
+ */
+float inverse_fold( char *start,
+                    const char *target);
+
+/**
+ *  \brief Find sequence that maximizes probability of a predefined structure
+ * 
+ *  This function searches for a sequence with maximum probability to fold into
+ *  the provided structure 'target' using the partition function algorithm.
+ *  It returns \f$-kT \cdot \log(p)\f$ where \f$p\f$ is the frequency of 'target' in
+ *  the ensemble of possible structures. This is usually much slower than
+ *  inverse_fold().
+ * 
+ *  \param  start   The start sequence
+ *  \param  target  The target secondary structure in dot-bracket notation
+ *  \return         The distance to the target in case a search was unsuccessful, 0 otherwise
+ */
+float inverse_pf_fold(char *start,
+                      const char *target);
+
+/**
+ *  @}
+ */
+#endif
diff --git a/C/ViennaRNA/ligand.c b/C/ViennaRNA/ligand.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/ligand.c
@@ -0,0 +1,699 @@
+/*
+ * Reference implementation for including ligand binding to hairpins, or
+ * interior loops, with known sequence and/or structure motif, and
+ * binding free energy utilizing generic soft constraint feature
+ *
+ * (c) 2015 Ronny Lorenz - ViennaRNA Package
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/model.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/eval.h"
+#include "ViennaRNA/ligand.h"
+
+
+/*
+#################################
+# PRIVATE DATA STRUCTURES       #
+#################################
+*/
+
+typedef struct{
+  int i;
+  int j;
+  int k;
+  int l;
+} quadruple_position;
+
+typedef struct{
+  char  *seq_motif_5;
+  char  *seq_motif_3;
+  char  *struct_motif_5;
+  char  *struct_motif_3;
+  int   energy;
+  int   energy_alt;
+  int   pair_count;
+  vrna_basepair_t *pairs;
+
+  quadruple_position *positions;
+} ligand_data;
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+static void
+split_sequence( const char *string,
+                      char **seq1,
+                      char **seq2,
+                      int cp);
+
+static void
+correctMotifContribution( const char *seq,
+                          const char *struct_motif,
+                          const char *struct_motif_alt,
+                          int *contribution,
+                          int *contribution_alt,
+                          vrna_md_t *md);
+
+static void
+delete_ligand_data(void *data);
+
+static int
+AptamerContrib(int i, int j, int k, int l, char d, void *data);
+
+static int
+AptamerContribHairpin(int i, int j, int k, int l, char d, void *data);
+
+static FLT_OR_DBL
+expAptamerContrib(int i, int j, int k, int l, char d, void *data);
+
+static FLT_OR_DBL
+expAptamerContribHairpin(int i, int j, int k, int l, char d, void *data);
+
+static vrna_basepair_t *
+backtrack_int_motif(int i, int j, int k, int l, char d, void *data);
+
+static vrna_basepair_t *
+backtrack_hp_motif(int i, int j, int k, int l, char d, void *data);
+
+static quadruple_position *
+scanForMotif( const char *seq,
+              const char *motif1,
+              const char *motif2);
+
+static vrna_basepair_t *
+scanForPairs( const char  *motif5,
+              const char  *motif3,
+              int         *pair_count);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC int
+vrna_sc_detect_hi_motif(vrna_fold_compound_t *vc,
+                        const char *structure,
+                        int *i,
+                        int *j,
+                        int *k,
+                        int *l){
+
+  int p, q, n;
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+
+  if(vc && vc->sc && vc->sc->data){
+    n = vc->length;
+    ldata = (ligand_data *)vc->sc->data;
+
+    for(p = *i; p < n; p++){
+      for(pos = ldata->positions; pos->i; pos++){
+        if(pos->i == p){
+          /* check whether we find the motif in the provided structure */
+          int i_m, j_m, k_m, l_m;
+          i_m = pos->i;
+          j_m = pos->j;
+          k_m = pos->k;
+          l_m = pos->l;
+          for(q = 0; q < strlen(ldata->struct_motif_5); q++){
+            if(ldata->struct_motif_5[q] != structure[i_m+q-1])
+              break;
+          }
+          if(q == strlen(ldata->struct_motif_5)){ /* 5' motif detected */
+            if(k_m > 0){
+              for(q = 0; q < strlen(ldata->struct_motif_3); q++){
+                if(ldata->struct_motif_3[q] != structure[l_m+q-1])
+                  break;
+              }
+              if(q == strlen(ldata->struct_motif_3)){ /* 3' motif detected */
+                *i = i_m;
+                *j = j_m;
+                *k = k_m;
+                *l = l_m;
+                return 1;
+              }
+            } else {
+                *i = i_m;
+                *j = j_m;
+                *k = k_m;
+                *l = l_m;
+                return 1;
+            }
+          }
+        }
+      }
+    }
+      
+  }
+  return 0;
+}
+
+PUBLIC int
+vrna_sc_get_hi_motif( vrna_fold_compound_t *vc,
+                      int *i,
+                      int *j,
+                      int *k,
+                      int *l){
+
+  int p, n;
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+
+  if(vc && vc->sc && vc->sc->data){
+    n = vc->length;
+    ldata = (ligand_data *)vc->sc->data;
+
+    for(p = *i; p < n; p++){
+      for(pos = ldata->positions; pos->i; pos++){
+        if(pos->i == p){
+          *i = pos->i;
+          *j = pos->j;
+          *k = pos->k;
+          *l = pos->l;
+          return 1;
+        }
+      }
+    }
+  }
+  return 0;
+}
+
+PUBLIC int
+vrna_sc_add_hi_motif( vrna_fold_compound_t *vc,
+                      const char *seq,
+                      const char *structure,
+                      FLT_OR_DBL energy,
+                      unsigned int options){
+
+    int                   i, cp, cp2;
+    char                  *sequence, *motif, *motif_alt;
+    vrna_md_t             *md_p;
+    ligand_data           *ldata;
+
+    sequence              = NULL;
+    motif                 = NULL;
+    motif_alt             = NULL;
+    ldata                 = NULL;
+    md_p                  = NULL;
+
+    sequence  = vrna_cut_point_remove(seq, &cp);                /* ligand sequence motif  */
+    motif     = vrna_cut_point_remove(structure, &cp2);         /* ligand structure motif */
+
+    /* check for obvious inconsistencies in input sequence/structure motif */
+    if(cp != cp2){
+      vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: Cutpoint in sequence and structure motif differ!");
+      goto hi_motif_error;
+    } else if(strlen(seq) != strlen(structure)){
+      vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: length of sequence and structure motif differ!");
+      goto hi_motif_error;
+    }
+
+    /* create auxiliary soft constraints data structure */
+    ldata                 = vrna_alloc(sizeof(ligand_data));
+    ldata->seq_motif_5    = NULL;
+    ldata->seq_motif_3    = NULL;
+    ldata->struct_motif_5 = NULL;
+    ldata->struct_motif_3 = NULL;
+    ldata->positions      = NULL;
+    ldata->energy         = (int)(energy * 100.);
+
+    split_sequence(sequence, &(ldata->seq_motif_5), &(ldata->seq_motif_3), cp);
+    split_sequence(motif, &(ldata->struct_motif_5), &(ldata->struct_motif_3), cp);
+
+    motif_alt = vrna_alloc(sizeof(char) * (strlen(motif) + 1)); /* alternative structure motif */
+    memset(motif_alt, '.', strlen(motif) - 1);
+
+    if(cp > 0){
+      if((motif[0] != '(') || (motif[strlen(motif) - 1] != ')') || (motif[cp-2] != '(') || (motif[cp-1] != ')')){
+        vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: No closing and/or enclosed pair in interior loop motif!");
+        goto hi_motif_error;
+      }
+      /* construct corresponding alternative interior loop motif (....(&)...) */
+      motif_alt[0] = '(';
+      motif_alt[cp-2] = '(';
+      motif_alt[cp-1] = ')';
+      motif_alt[strlen(motif) - 1] = ')';
+      motif_alt[strlen(motif)] = '\0';
+
+      vrna_sc_add_bt(vc, &backtrack_int_motif);
+      vrna_sc_add_f(vc, &AptamerContrib);
+      vrna_sc_add_exp_f(vc, &expAptamerContrib);
+
+    } else {
+      if((motif[0] != '(') || (motif[strlen(motif) - 1] != ')')){
+        vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: No closing pair in hairpin motif!");
+        goto hi_motif_error;
+      }
+
+      /* construct corresponding alternative hairpin motif (....) */
+      motif_alt[0] = '(';
+      motif_alt[strlen(motif) - 1] = ')';
+      motif_alt[strlen(motif)] = '\0';
+
+      vrna_sc_add_bt(vc, &backtrack_hp_motif);
+      vrna_sc_add_f(vc, &AptamerContribHairpin);
+      vrna_sc_add_exp_f(vc, &expAptamerContribHairpin);
+    }
+
+    /* correct motif contributions */
+    if(vc->params)
+      md_p = &(vc->params->model_details);
+    else
+      md_p = &(vc->exp_params->model_details);
+
+    correctMotifContribution(seq, motif, motif_alt, &(ldata->energy), &(ldata->energy_alt), md_p);
+
+    /* scan for sequence motif positions */
+    ldata->positions = scanForMotif(vc->sequence, ldata->seq_motif_5, ldata->seq_motif_3);
+
+    /* scan for additional base pairs in the structure motif */
+    int pair_count = 0;
+    vrna_basepair_t *pairs = scanForPairs(ldata->struct_motif_5, ldata->struct_motif_3, &pair_count);
+    if((pair_count > 0) && (pairs == NULL)){ /* error while parsing structure motif */
+      vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: Error while parsing additional pairs in structure motif");
+      goto hi_motif_error;
+    }
+
+    ldata->pairs      = pairs;
+    ldata->pair_count = pair_count;
+
+    /* add generalized soft-constraint data structure and corresponding 'delete' function */
+    vrna_sc_add_data(vc, (void *)ldata, &delete_ligand_data);
+
+    free(sequence);
+    free(motif);
+    free(motif_alt);
+
+    return 1; /* success */
+
+/* exit with error */
+hi_motif_error:
+
+    free(sequence);
+    free(motif);
+    free(motif_alt);
+    delete_ligand_data(ldata);
+
+    return 0;
+}
+
+static void
+split_sequence( const char *string,
+                      char **seq1,
+                      char **seq2,
+                      int cp){
+
+  int l = (int)strlen(string);
+  *seq1 = NULL;
+  *seq2 = NULL;
+
+  if(cp > 0){
+    if(cp < l){
+      *seq1 = vrna_alloc(sizeof(char) * cp);
+      strncpy(*seq1, string, cp - 1);
+      (*seq1)[cp - 1] = '\0';
+      *seq2 = vrna_alloc(sizeof(char) * (l - cp + 2));
+      strncpy(*seq2, string + cp - 1, (l - cp + 1));
+      (*seq2)[l - cp + 1] = '\0';
+    }
+  } else {
+    *seq1 = vrna_alloc(sizeof(char) * (l+1));
+    strncpy(*seq1, string, l);
+    (*seq1)[l] = '\0';
+  }
+}
+
+static void
+correctMotifContribution( const char *seq,
+                          const char *struct_motif,
+                          const char *struct_motif_alt,
+                          int *contribution,
+                          int *contribution_alt,
+                          vrna_md_t *md){
+
+  float                 alt, corr, energy;
+  vrna_fold_compound_t  *tmp_vc;
+
+  tmp_vc  = vrna_fold_compound(seq, md, VRNA_OPTION_EVAL_ONLY);
+  alt     = vrna_eval_structure(tmp_vc, struct_motif_alt);
+  corr    = vrna_eval_structure(tmp_vc, struct_motif);
+  energy  = corr - alt;
+
+  *contribution     += (int)(energy * 100.);
+  *contribution_alt  = (int)(alt    * 100.);
+
+  vrna_fold_compound_free(tmp_vc);
+}
+
+static void
+delete_ligand_data(void *data){
+
+  ligand_data *ldata = (ligand_data *)data;
+
+  free(ldata->seq_motif_5);
+  free(ldata->seq_motif_3);
+  free(ldata->struct_motif_5);
+  free(ldata->struct_motif_3);
+  free(ldata->positions);
+  free(ldata->pairs);
+
+  free(data);
+}
+
+static int
+AptamerContrib(int i, int j, int k, int l, char d, void *data){
+
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+
+  if(d == VRNA_DECOMP_PAIR_IL){
+    ldata = (ligand_data *)data;
+    for(pos = ((ligand_data *)data)->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j) && (pos->k == k) && (pos->l == l)){
+        return ldata->energy;
+      }
+    }
+  }
+
+  return 0;
+}
+
+static int
+AptamerContribHairpin(int i, int j, int k, int l, char d, void *data){
+
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+
+  if(d == VRNA_DECOMP_PAIR_HP){
+    ldata = (ligand_data *)data;
+    for(pos = ((ligand_data *)data)->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j)){
+        return ldata->energy;
+      }
+    }
+  }
+
+  return 0;
+}
+
+static FLT_OR_DBL
+expAptamerContrib(int i, int j, int k, int l, char d, void *data){
+
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+  FLT_OR_DBL          exp_e;
+  double              kT;
+
+  exp_e = 1.;
+
+  if(d == VRNA_DECOMP_PAIR_IL){
+    ldata = (ligand_data *)data;
+    kT    = (37. + K0) * GASCONST;
+
+    for(pos = ldata->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j) && (pos->k == k) && (pos->l == l)){
+        exp_e =   (FLT_OR_DBL)exp((double) (-ldata->energy) * 10./kT);
+        exp_e +=  (FLT_OR_DBL)exp((double) (-ldata->energy_alt) * 10./kT); /* add alternative, i.e. unbound ligand */
+        break;
+      }
+    }
+  }
+
+  return exp_e;
+}
+
+static FLT_OR_DBL
+expAptamerContribHairpin(int i, int j, int k, int l, char d, void *data){
+
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+  FLT_OR_DBL          exp_e;
+  double              kT;
+
+  exp_e = 1.;
+
+  if(d == VRNA_DECOMP_PAIR_HP){
+    ldata = (ligand_data *)data;
+    kT    = (37. + K0) * GASCONST;
+
+    for(pos = ldata->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j)){
+        exp_e =   (FLT_OR_DBL)exp((double) (-ldata->energy) * 10./kT);
+        exp_e +=  (FLT_OR_DBL)exp((double) (-ldata->energy_alt) * 10./kT); /* add alternative, i.e. unbound ligand */
+        break;
+      }
+    }
+  }
+
+  return exp_e;
+}
+
+static vrna_basepair_t *
+backtrack_int_motif(int i, int j, int k, int l, char d, void *data){
+
+  int                 bp_size = 15;
+  vrna_basepair_t     *pairs = NULL;
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+
+  if(d == VRNA_DECOMP_PAIR_IL){
+    ldata = (ligand_data *)data;
+    for(pos = ldata->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j) && (pos->k == k) && (pos->l == l)){
+        /* found motif in our list, lets create pairs */
+        char  *ptr;
+#if 0
+        int   actual_size = 0;
+        pairs = vrna_alloc(sizeof(vrna_basepair_t) * bp_size);
+
+        for(ptr=ldata->struct_motif_5; *ptr != '\0'; ptr++, i++){
+          if(*ptr == '.'){
+            pairs[actual_size].i = pairs[actual_size].j = i;
+            actual_size++;
+            if(actual_size == bp_size){
+              bp_size *= 2;
+              pairs = vrna_realloc(pairs, sizeof(vrna_basepair_t) * bp_size);
+            }
+          }
+        }
+        for(ptr=ldata->struct_motif_3; *ptr != '\0'; ptr++, l++){
+          if(*ptr == '.'){
+            pairs[actual_size].i = pairs[actual_size].j = l;
+            actual_size++;
+            if(actual_size == bp_size){
+              bp_size *= 2;
+              pairs = vrna_realloc(pairs, sizeof(vrna_basepair_t) * bp_size);
+            }
+          }
+        }
+        pairs = vrna_realloc(pairs, sizeof(vrna_basepair_t) * (actual_size + 1));
+        pairs[actual_size].i = pairs[actual_size].j = -1;
+#else
+        pairs = vrna_alloc(sizeof(vrna_basepair_t) * (ldata->pair_count + 1));
+        vrna_basepair_t *pptr;
+        int             count;
+        for(count = 0,pptr = ldata->pairs; pptr && (pptr->i != 0); pptr++, count++){
+          pairs[count].i = (pptr->i < 0) ? j + pptr->i : i + pptr->i - 1;
+          pairs[count].j = (pptr->j < 0) ? j + pptr->j : i + pptr->j - 1;
+        }
+        pairs[count].i = pairs[count].j = 0;
+#endif
+
+        return pairs;
+      }
+    }
+  }
+
+  return pairs;
+}
+
+static vrna_basepair_t *
+backtrack_hp_motif(int i, int j, int k, int l, char d, void *data){
+
+  int                 count;
+  vrna_basepair_t     *pairs = NULL;
+  quadruple_position  *pos;
+  ligand_data         *ldata;
+  vrna_basepair_t     *pptr;
+
+  if(d == VRNA_DECOMP_PAIR_HP){
+    ldata = (ligand_data *)data;
+    for(pos = ldata->positions; pos->i; pos++){
+      if((pos->i == i) && (pos->j == j)){
+        /* found motif in our list, lets create pairs */
+        pairs = vrna_alloc(sizeof(vrna_basepair_t) * (ldata->pair_count + 1));
+        for(count = 0,pptr = ldata->pairs; pptr && (pptr->i != 0); pptr++, count++){
+          pairs[count].i = i + pptr->i - 1;
+          pairs[count].j = i + pptr->j - 1;
+        }
+        pairs[count].i = pairs[count].j = 0;
+        return pairs;
+      }
+    }
+  }
+
+  return pairs;
+}
+
+static quadruple_position *
+scanForMotif( const char *seq,
+              const char *motif1,
+              const char *motif2){
+
+  int   i, j, k, l, l1, l2, n, cnt, cnt2;
+  char  *ptr;
+  quadruple_position *pos;
+  
+  n     = (int) strlen(seq);
+  l1    = (int) strlen(motif1);
+  l2    = (motif2) ? (int) strlen(motif2) : 0;
+  cnt   = 0;
+  cnt2  = 5; /* initial guess how many matching motifs we might encounter */
+
+  pos = (quadruple_position *)vrna_alloc(sizeof(quadruple_position) * cnt2);
+
+  for(i = 0; i <= n - l1 - l2; i++){
+    if(seq[i] == motif1[0]){
+      for(j = i+1; j < i + l1; j++){
+        if(seq[j] == motif1[j-i]){
+          continue;
+        }
+        else goto next_i;
+      }
+      /* found 5' motif */
+      if(motif2){
+        for(k = j + 1; k <= n - l2; k++){
+          if(seq[k] == motif2[0]){
+            for(l = k + 1; l < k + l2; l++){
+              if(seq[l] == motif2[l-k]){
+                continue;
+              }
+              else goto next_k;
+            }
+            /* we found a quadruple, so store it */
+            pos[cnt].i   = i + 1;
+            pos[cnt].j   = l;
+            pos[cnt].k   = j;
+            pos[cnt++].l = k + 1;
+
+            /* allocate more memory if necessary */
+            if(cnt == cnt2){
+              cnt2 *= 2;
+              pos = (quadruple_position *)vrna_realloc(pos, sizeof(quadruple_position) * cnt2);
+            }
+          }
+/* early exit from l loop */
+next_k: continue;
+        }
+      } else { /* hairpin loop motif */
+        /* store it */
+        pos[cnt].i   = i + 1;
+        pos[cnt].j   = j;
+        pos[cnt].k   = 0;
+        pos[cnt++].l = 0;
+
+        /* allocate more memory if necessary */
+        if(cnt == cnt2){
+          cnt2 *= 2;
+          pos = (quadruple_position *)vrna_realloc(pos, sizeof(quadruple_position) * cnt2);
+        }
+      }
+    }
+/* early exit from j loop */
+next_i: continue;
+  }
+
+  /* reallocate to actual size */
+  pos = (quadruple_position *)vrna_realloc(pos, sizeof(quadruple_position) * (cnt + 1));
+
+  /* set end marker */
+  pos[cnt].i = pos[cnt].j = pos[cnt].k = pos[cnt].l = 0;
+
+  return pos;
+}
+
+static vrna_basepair_t *
+scanForPairs( const char  *motif5,
+              const char  *motif3,
+              int         *pair_count){
+
+  int             i, l5, l3, stack_size, stack_count, *stack;
+  vrna_basepair_t *pairs;
+
+  l5          = (motif5) ? strlen(motif5) : 0;
+  l3          = (motif3) ? strlen(motif3) : 0;
+  stack_count = 0;
+  stack_size  = l5 + l3 + 1;
+  *pair_count = 0;
+  stack       = vrna_alloc(sizeof(int)              * stack_size);
+  pairs       = vrna_alloc(sizeof(vrna_basepair_t)  * stack_size);
+
+  /* go through 5' side of structure motif */
+  for(i = 2; i < l5; i++){
+    if(motif5[i - 1] == '('){
+      stack[stack_count++] = i;
+    } else if(motif5[i - 1] == ')'){
+      pairs[*pair_count].i = stack[--stack_count];
+      pairs[*pair_count].j = i;
+      /* printf("5' p[%d, %d]\n", pairs[*pair_count].i, pairs[*pair_count].j); */
+      (*pair_count)++;
+      if(stack_count < 0){
+        vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: 5' structure motif contains unbalanced brackets");
+        free(stack);
+        free(pairs);
+        return NULL;
+      }
+    }
+  }
+
+  if(motif3){
+    for(i = 2; i < l3; i++){ /* go through 3' side of motif */
+      if(motif3[i-1] == '('){
+        stack[stack_count++] = -(l3 - i);
+      } else if(motif3[i-1] == ')'){
+        pairs[*pair_count].i = stack[--stack_count];
+        pairs[*pair_count].j = -(l3 - i);
+        /* printf("3' p[%d, %d]\n", pairs[*pair_count].i, pairs[*pair_count].j); */
+        (*pair_count)++;
+        if(stack_count < 0){
+          vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: 3' structure motif contains unbalanced brackets");
+          free(stack);
+          free(pairs);
+          return NULL;
+        }
+      }
+    }
+  }
+
+  if(stack_count != 0){
+    vrna_message_warning("vrna_sc_add_ligand_binding@ligand.c: structure motif contains unbalanced brackets");
+    (*pair_count)++;
+    free(stack);
+    free(pairs);
+    return NULL;
+  }
+
+  if(*pair_count > 0){
+    pairs = vrna_realloc(pairs, sizeof(vrna_basepair_t) * (*pair_count + 1));
+    pairs[*pair_count].i = pairs[*pair_count].j = 0;
+  } else {
+    free(pairs);
+    pairs = NULL;
+  }
+
+  free(stack);
+
+  return pairs;
+}
+
diff --git a/C/ViennaRNA/ligand.h b/C/ViennaRNA/ligand.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/ligand.h
@@ -0,0 +1,63 @@
+#ifndef VIENNA_RNA_PACKAGE_LIGAND_H
+#define VIENNA_RNA_PACKAGE_LIGAND_H
+
+/**
+ *  @file     ligand.h
+ *  @ingroup  ligands
+ *  @brief    Functions for incorporation of ligands binding to haipirn and interior loop motifs
+ */
+
+/**
+ *  @addtogroup ligands
+ *
+ *  @brief  This module covers functions that enable the incorporation of ligand binding
+ *  free energies to specific hairpin/interior loop motifs by means of generic soft constraints.
+ */
+#include <ViennaRNA/data_structures.h>
+
+
+/**
+ *  @brief  Add soft constraints for hairpin or interior loop binding motif
+ *
+ *  @ingroup  ligands
+ *
+ *  Here is an example that adds a theophylline binding motif. Free energy
+ *  contribution is derived from @f$k_d = 0.32 \mu mol / l @f$, taken from
+ *  Jenison et al. 1994
+ *  @code{.c}
+vrna_sc_add_hi_motif( vc,
+                      "GAUACCAG&CCCUUGGCAGC",
+                      "(...((((&)...)))...)",
+                      -9.22, VRNA_OPTION_DEFAULT); @endcode
+ *
+ *  @param  vc        The #vrna_fold_compound_t the motif is applied to
+ *  @param  seq       The sequence motif (may be interspaced by '&' character
+ *  @param  structure The structure motif (may be interspaced by '&' character
+ *  @param  energy    The free energy of the motif (e.g. binding free energy)
+ *  @param  options   Options
+ *  @return           non-zero value if application of the motif using soft constraints was successful
+ *  
+ */
+int
+vrna_sc_add_hi_motif( vrna_fold_compound_t *vc,
+                      const char *seq,
+                      const char *structure,
+                      FLT_OR_DBL energy,
+                      unsigned int options);
+
+int
+vrna_sc_detect_hi_motif(vrna_fold_compound_t *vc,
+                        const char *structure,
+                        int *i,
+                        int *j,
+                        int *k,
+                        int *l);
+
+int
+vrna_sc_get_hi_motif( vrna_fold_compound_t *vc,
+                      int *i,
+                      int *j,
+                      int *k,
+                      int *l);
+
+#endif
diff --git a/C/ViennaRNA/list.c b/C/ViennaRNA/list.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/list.c
@@ -0,0 +1,412 @@
+/*
+  $Log: list.c,v $
+  Revision 1.5  2003/07/14 13:36:58  ivo
+  use vrna_alloc() instead of malloc
+
+  Revision 1.4  2000/10/10 08:53:52  ivo
+  include dmalloc.h header if DMALLOC defined
+
+  Revision 1.4  2000/10/10 08:04:34  ivo
+  include dmalloc header id DMALLOC defined
+
+  Revision 1.3  1998/03/30 14:24:51  ivo
+  use RNA package utils.h
+
+  Revision 1.2  1997/10/09  19:01:50  steve
+  *** empty log message ***
+
+  Revision 1.1  1997/08/04 21:05:32  walter
+  Initial revision
+
+*/
+/*
+   (C) 1991 Kendall Bennett.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/list.h"
+
+#define PUBLIC
+PUBLIC void *
+lst_newnode (int size)
+/****************************************************************************
+*
+* Function:	lst_newnode
+* Parameters:	size - Amount of memory to allocate for node
+* Returns:      Pointer to the allocated node's user space.
+*
+* Description:	Allocates the memory required for a node, adding a small
+*		header at the start of the node. We return a reference to
+*		the user space of the node, as if it had been allocated via
+*		malloc().
+*
+****************************************************************************/
+{
+  LST_BUCKET *node;
+
+  node = (LST_BUCKET *) vrna_alloc(size + sizeof (LST_BUCKET));
+
+  return LST_USERSPACE (node);	/* Return pointer to user space */
+}
+
+PUBLIC void
+lst_freenode (void *node)
+/****************************************************************************
+*
+* Function:	lst_freenode
+* Parameters:	node - Node to free.
+*
+* Description:  Frees a node previously allocated with lst_newnode().
+*
+****************************************************************************/
+{
+  free (LST_HEADER (node));
+}
+
+PUBLIC LIST *
+lst_init (void)
+/****************************************************************************
+*
+* Function:	lst_init
+* Returns:      Pointer to a newly created list.
+*
+* Description:	Initialises a list and returns a pointer to it.
+*
+****************************************************************************/
+{
+  LIST *l;
+
+  if ((l = (LIST *) vrna_alloc(sizeof (LIST))) != NULL)
+    {
+      l->count = 0;
+      l->head = &(l->hz[0]);
+      l->z = &(l->hz[1]);
+      l->head->next = l->z->next = l->z;
+    }
+
+  return l;
+}
+
+PUBLIC void
+lst_kill (LIST * l, void (*freeNode) (void *node))
+/****************************************************************************
+*
+* Function:	lst_kill
+* Parameters:	l - List to kill
+*		freeNode - Pointer to user routine to free a node
+*
+* Description:	Kills the list l, by deleting all of the elements contained
+*		within the list one by one and then deleting the list
+*		itself. Note that we call the user supplied routine
+*		(*freeNode)() to free each list node. This allows the user
+*		program to perform any extra processing needed to kill each
+*		node (if each node contains pointers to other items on the
+*		heap for example). If no extra processing is required, just
+*		pass the address of lst_freenode(), ie:
+*
+*		lst_kill(myList,lst_freenode);
+*
+****************************************************************************/
+{
+  LST_BUCKET *n, *p;
+
+  n = l->head->next;
+  while (n != l->z)
+    {				/* Free all nodes in list  */
+      p = n;
+      n = n->next;
+      (*freeNode) (LST_USERSPACE (p));
+    }
+  free (l);			/* Free the list itself    */
+}
+
+PUBLIC void
+lst_insertafter (LIST * l, void *node, void *after)
+/****************************************************************************
+*
+* Function:	lst_insertafter
+* Parameters:	l - List to insert node into
+*		node - Pointer to user space of node to insert
+*		after - Pointer to user space of node to insert node after
+*
+* Description:	Inserts a new node into the list after the node 'after'. To
+*		insert a new node at the beginning of the list, user the
+*		macro LST_HEAD in place of 'after'. ie:
+*
+*		lst_insertafter(mylist,node,LST_HEAD(mylist));
+*
+****************************************************************************/
+{
+  LST_BUCKET *n = LST_HEADER (node), *a = LST_HEADER (after);
+
+  n->next = a->next;
+  a->next = n;
+  l->count++;
+}
+
+PUBLIC void *
+lst_deletenext (LIST * l, void *node)
+/****************************************************************************
+*
+* Function:	lst_deletenext
+* Parameters:	l - List to delete node from.
+*		node - Node to delete the next node from
+* Returns:	Pointer to the deleted node's userspace.
+*
+* Description:	Removes the node AFTER 'node' from the list l.
+*
+****************************************************************************/
+{
+  LST_BUCKET *n = LST_HEADER (node);
+
+  node = LST_USERSPACE (n->next);
+  n->next = n->next->next;
+  l->count--;
+  return node;
+}
+
+PUBLIC void *
+lst_first (LIST * l)
+/****************************************************************************
+*
+* Function:	lst_first
+* Parameters:	l - List to obtain first node from
+* Returns:	Pointer to first node in list, NULL if list is empty.
+*
+* Description:	Returns a pointer to the user space of the first node in
+*		the list. If the list is empty, we return NULL.
+*
+****************************************************************************/
+{
+  LST_BUCKET *n;
+
+  n = l->head->next;
+  return (n == l->z ? NULL : LST_USERSPACE (n));
+}
+
+PUBLIC void *
+lst_next (void *prev)
+/****************************************************************************
+*
+* Function:	lst_next
+* Parameters:	prev - Previous node in list to obtain next node from
+* Returns:	Pointer to the next node in the list, NULL at end of list.
+*
+* Description:	Returns a pointer to the user space of the next node in the
+*		list given a pointer to the user space of the previous node.
+*		If we have reached the end of the list, we return NULL. The
+*		end of the list is detected when the next pointer of a node
+*		points back to itself, as does the dummy last node's next
+*		pointer. This enables us to detect the end of the list
+*		without needed access to the list data structure itself.
+*
+*		NOTE:	We do no checking to ensure that 'prev' is NOT a
+*			NULL pointer.
+*
+****************************************************************************/
+{
+  LST_BUCKET *n = LST_HEADER (prev);
+
+  n = n->next;
+  return (n == n->next ? NULL : LST_USERSPACE (n));
+}
+
+/* Static globals required by merge()   */
+
+static LST_BUCKET *z;
+static int (*cmp) (void *, void *);
+
+static LST_BUCKET *
+merge (LST_BUCKET * a, LST_BUCKET * b, LST_BUCKET ** end)
+/****************************************************************************
+*
+* Function:	merge
+* Parameters:	a,b - Sublist's to merge
+* Returns:	Pointer to the merged sublists.
+*
+* Description:	Merges two sorted lists of nodes together into a single
+*		sorted list.
+*
+****************************************************************************/
+{
+  LST_BUCKET *c;
+
+  /* Go through the lists, merging them together in sorted order  */
+
+  c = z;
+  while (a != z && b != z)
+    {
+      if ((*cmp) (LST_USERSPACE (a), LST_USERSPACE (b)) <= 0)
+	{
+	  c->next = a;
+	  c = a;
+	  a = a->next;
+	}
+      else
+	{
+	  c->next = b;
+	  c = b;
+	  b = b->next;
+	}
+    };
+
+  /* If one of the lists is not exhausted, then re-attach it to the end
+   * of the newly merged list
+   */
+
+  if (a != z)
+    c->next = a;
+  if (b != z)
+    c->next = b;
+
+  /* Set *end to point to the end of the newly merged list        */
+
+  while (c->next != z)
+    c = c->next;
+  *end = c;
+
+  /* Determine the start of the merged lists, and reset z to point to
+   * itself
+   */
+
+  c = z->next;
+  z->next = z;
+  return c;
+}
+
+PUBLIC void
+lst_mergesort (LIST * l, int (*cmp_func) (void *, void *))
+/****************************************************************************
+*
+* Function:	lst_mergesort
+* Parameters:	l - List to merge sort
+*		cmp_func - Function to compare two user spaces
+*
+* Description:	Mergesort's all the nodes in the list. 'cmp' must point to
+*		a comparison function that can compare the user spaces of
+*		two different nodes. 'cmp' should work the same as
+*		strcmp(), in terms of the values it returns.
+*
+****************************************************************************/
+{
+  int i, N;
+  LST_BUCKET *a, *b;		/* Pointers to sublists to merge                */
+  LST_BUCKET *c;		/* Pointer to end of sorted sublists            */
+  LST_BUCKET *head;		/* Pointer to dummy head node for list          */
+  LST_BUCKET *todo;		/* Pointer to sublists yet to be sorted         */
+  LST_BUCKET *t;		/* Temporary                                                            */
+
+  /* Set up globals required by merge() and pointer to head       */
+
+  z = l->z;
+  cmp = cmp_func;
+  head = l->head;
+
+  for (N = 1, a = z; a != head->next; N = N + N)
+    {
+      todo = head->next;
+      c = head;
+      while (todo != z)
+	{
+
+	  /* Build first sublist to be merged, and splice from main list
+	   */
+
+	  a = t = todo;
+	  for (i = 1; i < N; i++)
+	    t = t->next;
+	  b = t->next;
+	  t->next = z;
+	  t = b;
+
+	  /* Build second sublist to be merged and splice from main list
+	   */
+
+	  for (i = 1; i < N; i++)
+	    t = t->next;
+	  todo = t->next;
+	  t->next = z;
+
+	  /* Merge the two sublists created, and set 'c' to point to the
+	   * end of the newly merged sublists.
+	   */
+
+	  c->next = merge (a, b, &t);
+	  c = t;
+	}
+    }
+}
+
+#ifdef LIST_TEST
+
+/*---------------------------------------------------------------*/
+/*---------------------------------------------------------------*/
+
+/* Simple program to test the list routines */
+
+typedef struct
+{
+  char name[40];
+  int age;
+}
+REC;
+
+/*---------------------------------------------------------------*/
+
+int
+my_cmp (REC * r1, REC * r2)
+{
+  return strcmp (r1->name, r2->name);
+}
+
+/*---------------------------------------------------------------*/
+
+void
+main (void)
+{
+  LIST *list;
+  int done = 0;
+  REC *rec;
+  char line[80];
+
+  list = lst_init ();
+
+  printf ("Type a list of names and ages. Empty line quits\n\n");
+
+  while (!done)
+    {
+      rec = lst_newnode (sizeof (REC));
+      gets (line);
+      if ((done = (line[0] == '\0')) != 1)
+	{
+	  strcpy (rec->name, line);
+	  gets (line);
+	  rec->age = atoi (line);
+	  lst_insertafter (list, rec, LST_HEAD (list));
+	}
+    };
+
+  printf ("\nThe list you typed in was:\n\n");
+
+  for (rec = lst_first (list); rec; rec = lst_next (rec))
+    printf ("Name: %s, Age: %d\n", rec->name, rec->age);
+
+  printf ("\nSorting the list...\n\n");
+
+  lst_mergesort (list, my_cmp);
+
+  for (rec = lst_first (list); rec; rec = lst_next (rec))
+    printf ("Name: %s, Age: %d\n", rec->name, rec->age);
+
+  lst_kill (list, lst_freenode);
+}
+
+/*---------------------------------------------------------------*/
+
+#endif
diff --git a/C/ViennaRNA/list.h b/C/ViennaRNA/list.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/list.h
@@ -0,0 +1,65 @@
+/*
+  $Log: list.h,v $
+  Revision 1.2  2000/10/10 08:50:01  ivo
+  some annotation for lclint
+
+  Revision 1.1  1997/08/04 21:05:32  walter
+  Initial revision
+
+*/
+
+#ifndef	__LIST_H
+#define	__LIST_H
+
+/*---------------------- Macros and type definitions ----------------------*/
+
+typedef struct LST_BUCKET {
+  struct LST_BUCKET *next;
+}
+LST_BUCKET;
+
+typedef struct {
+  int count;			/* Number of elements currently in list */
+  LST_BUCKET *head;		/* Pointer to head element of list      */
+  LST_BUCKET *z;		/* Pointer to last node of list         */
+  LST_BUCKET hz[2];		/* Space for head and z nodes           */
+}
+LIST;
+
+/* Return a pointer to the user space given the address of the header of
+ * a node.
+ */
+
+#define	LST_USERSPACE(h)	((void*)((LST_BUCKET*)(h) + 1))
+
+/* Return a pointer to the header of a node, given the address of the
+ * user space.
+ */
+
+#define	LST_HEADER(n)		((LST_BUCKET*)(n) - 1)
+
+/* Return a pointer to the user space of the list's head node. This user
+ * space does not actually exist, but it is useful to be able to address
+ * it to enable insertion at the start of the list.
+ */
+
+#define	LST_HEAD(l)		LST_USERSPACE((l)->head)
+
+/* Determine if a list is empty
+ */
+
+#define	LST_EMPTY(l)		((l)->count == 0)
+
+/*-------------------------- Function Prototypes --------------------------*/
+
+/*@only@*//*@out@*/ void *lst_newnode (int size);
+void lst_freenode (/*@only@*/ void *node);
+/*@only@*//*@out@*/  LIST *lst_init (void);
+void lst_kill (LIST * l, void (*freeNode) ());
+void lst_insertafter (LIST * l, /*@keep@*/ void *node, void *after);
+void *lst_deletenext (/*@only@*/ LIST * l, void *node);
+/*@dependent@*/ void *lst_first (LIST * l);
+/*@dependent@*/ void *lst_next (void *prev);
+void lst_mergesort (LIST * l, int (*cmp_func) ());
+
+#endif
diff --git a/C/ViennaRNA/loop_energies.h b/C/ViennaRNA/loop_energies.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/loop_energies.h
@@ -0,0 +1,41 @@
+#ifndef VIENNA_RNA_PACKAGE_LOOP_ENERGIES_H
+#define VIENNA_RNA_PACKAGE_LOOP_ENERGIES_H
+
+/**
+ *  @file     loop_energies.h
+ *  @ingroup  loops
+ *  @brief    Energy evaluation for MFE and partition function calculations
+ */
+
+/**
+ *  @{
+ *  @ingroup   loops
+ * 
+ *  <P>
+ *  This file contains functions for the calculation of the free energy @f$\Delta G@f$
+ *  of a hairpin- [ E_Hairpin() ] or interior-loop [ E_IntLoop()] .<BR>
+ *  The unit of the free energy returned is @f$10^{-2} * \mathrm{kcal}/\mathrm{mol}@f$
+ *  </P>
+ *  <P>
+ *  In case of computing the partition function, this file also supplies functions
+ *  which return the Boltzmann weights @f$e^{-\Delta G/kT} @f$ for a hairpin- [ exp_E_Hairpin() ]
+ *  or interior-loop [ exp_E_IntLoop() ].
+ *  </P>
+ */
+
+
+/* below we include the loop type specific energy evaluation functions */
+
+#include <ViennaRNA/exterior_loops.h>
+
+#include <ViennaRNA/hairpin_loops.h>
+
+#include <ViennaRNA/interior_loops.h>
+
+#include <ViennaRNA/multibranch_loops.h>
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/mfe.c b/C/ViennaRNA/mfe.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/mfe.c
@@ -0,0 +1,1259 @@
+/** \file **/
+
+/*
+                  minimum free energy
+                  RNA secondary structure prediction
+
+                  c Ivo Hofacker, Chrisoph Flamm
+                  original implementation by
+                  Walter Fontana
+                  g-quadruplex support and threadsafety
+                  by Ronny Lorenz
+
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/data_structures.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/structured_domains.h"
+#include "ViennaRNA/unstructured_domains.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/mfe.h"
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+#define MAXSECTORS        500     /* dimension for a backtrack array */
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+PRIVATE int           fill_arrays(vrna_fold_compound_t *vc);
+PRIVATE void          fill_arrays_circ(vrna_fold_compound_t *vc, sect bt_stack[], int *bt);
+PRIVATE void          backtrack(vrna_fold_compound_t *vc, vrna_bp_stack_t *bp_stack, sect bt_stack[], int s);
+
+PRIVATE int           fill_arrays_comparative(vrna_fold_compound_t *vc);
+PRIVATE void          fill_arrays_comparative_circ(vrna_fold_compound_t *vc, sect bt_stack[], int *bt);
+PRIVATE void          backtrack_comparative(vrna_fold_compound_t *vc, vrna_bp_stack_t *bp_stack, sect bt_stack[], int s);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC float
+vrna_mfe( vrna_fold_compound_t *vc,
+          char *structure){
+
+  char    *ss;
+  int     length, energy, s;
+  float   mfe;
+  sect    bt_stack[MAXSECTORS]; /* stack of partial structures for backtracking */
+  vrna_bp_stack_t   *bp;
+
+  s       = 0;
+  mfe     = (float)(INF/100.);
+
+  if(vc){
+    length  = (int) vc->length;
+
+    if(!vrna_fold_compound_prepare(vc, VRNA_OPTION_MFE)){
+      vrna_message_warning("vrna_mfe@mfe.c: Failed to prepare vrna_fold_compound");
+      return mfe;
+    }
+
+    /* call user-defined recursion status callback function */
+    if(vc->stat_cb)
+      vc->stat_cb(VRNA_STATUS_MFE_PRE, vc->auxdata);
+
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     energy = fill_arrays(vc);
+                                    if(vc->params->model_details.circ){
+                                      fill_arrays_circ(vc, bt_stack, &s);
+                                      energy = vc->matrices->Fc;
+                                    }
+                                    break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:  energy = fill_arrays_comparative(vc);
+                                    if(vc->params->model_details.circ){
+                                      fill_arrays_comparative_circ(vc, bt_stack, &s);
+                                      energy = vc->matrices->Fc;
+                                    }
+                                    break;
+
+      default:                      vrna_message_warning("unrecognized fold compound type");
+                                    return mfe;
+                                    break;
+    }
+
+
+    /* call user-defined recursion status callback function */
+    if(vc->stat_cb)
+      vc->stat_cb(VRNA_STATUS_MFE_POST, vc->auxdata);
+
+    if(structure && vc->params->model_details.backtrack){
+      bp = (vrna_bp_stack_t *)vrna_alloc(sizeof(vrna_bp_stack_t) * (4*(1+length/2))); /* add a guess of how many G's may be involved in a G quadruplex */
+
+      switch(vc->type){
+        case VRNA_FC_TYPE_COMPARATIVE:  backtrack_comparative(vc, bp, bt_stack, s);
+                                      break;
+
+        case VRNA_FC_TYPE_SINGLE:     /* fall through */
+
+        default:                      backtrack(vc, bp, bt_stack, s);
+                                      break;
+      }
+
+      ss = vrna_db_from_bp_stack(bp, length);
+      strncpy(structure, ss, length + 1);
+      free(ss);
+      free(bp);
+    }
+
+    if (vc->params->model_details.backtrack_type=='C')
+      mfe = (float) vc->matrices->c[vc->jindx[length]+1]/100.;
+    else if (vc->params->model_details.backtrack_type=='M')
+      mfe = (float) vc->matrices->fML[vc->jindx[length]+1]/100.;
+    else
+      mfe = (float) energy/100.;
+
+    if(vc->type == VRNA_FC_TYPE_COMPARATIVE)
+      mfe /= (float)vc->n_seq;
+  }
+
+  return mfe;
+}
+
+/**
+*** fill "c", "fML" and "f5" arrays and return  optimal energy
+**/
+PRIVATE int
+fill_arrays(vrna_fold_compound_t *vc){
+
+  unsigned char     type;
+  char              *ptype, *hard_constraints;
+  int               i, j, ij, length, energy, new_c, stackEnergy, no_close, turn,
+                    noGUclosure, noLP, uniq_ML, dangle_model, *indx, *my_f5,
+                    *my_c, *my_fML, *my_fM1, hc_decompose, *cc, *cc1, *Fmi, *DMLi,
+                    *DMLi1, *DMLi2;
+  vrna_param_t      *P;
+  vrna_mx_mfe_t     *matrices;
+  vrna_hc_t         *hc;
+  vrna_ud_t         *domains_up;
+
+  length            = (int)vc->length;
+  ptype             = vc->ptype;
+  indx              = vc->jindx;
+  P                 = vc->params;
+  noGUclosure       = P->model_details.noGUclosure;
+  noLP              = P->model_details.noLP;
+  uniq_ML           = P->model_details.uniq_ML;
+  dangle_model      = P->model_details.dangles;
+  turn              = P->model_details.min_loop_size;
+  hc                = vc->hc;
+  hard_constraints  = hc->matrix;
+  matrices          = vc->matrices;
+  my_f5             = matrices->f5;
+  my_c              = matrices->c;
+  my_fML            = matrices->fML;
+  my_fM1            = matrices->fM1;
+  domains_up        = vc->domains_up;
+
+  /* allocate memory for all helper arrays */
+  cc    = (int *) vrna_alloc(sizeof(int)*(length + 2)); /* auxilary arrays for canonical structures     */
+  cc1   = (int *) vrna_alloc(sizeof(int)*(length + 2)); /* auxilary arrays for canonical structures     */
+  Fmi   = (int *) vrna_alloc(sizeof(int)*(length + 1)); /* holds row i of fML (avoids jumps in memory)  */
+  DMLi  = (int *) vrna_alloc(sizeof(int)*(length + 1)); /* DMLi[j] holds  MIN(fML[i,k]+fML[k+1,j])      */
+  DMLi1 = (int *) vrna_alloc(sizeof(int)*(length + 1)); /*                MIN(fML[i+1,k]+fML[k+1,j])    */
+  DMLi2 = (int *) vrna_alloc(sizeof(int)*(length + 1)); /*                MIN(fML[i+2,k]+fML[k+1,j])    */
+
+  if((turn < 0) || (turn > length))
+    turn = length; /* does this make any sense? */
+
+  /* pre-processing ligand binding production rule(s) */
+  if(domains_up && domains_up->prod_cb)
+    domains_up->prod_cb(vc, domains_up->data);
+
+  /* prefill helper arrays */
+  for(j = 0; j <= length; j++){
+    Fmi[j] = DMLi[j] = DMLi1[j] = DMLi2[j] = INF;
+  }
+
+
+  /* prefill matrices with init contributions */
+  for(j = 1; j <= length; j++)
+    for(i = (j > turn ? (j - turn) : 1); i <= j; i++){
+      my_c[indx[j] + i] = my_fML[indx[j] + i] = INF;
+      if(uniq_ML)
+        my_fM1[indx[j] + i] = INF;
+    }
+
+  /* start recursion */
+
+  if (length <= turn){
+    /* clean up memory */
+    free(cc);
+    free(cc1);
+    free(Fmi);
+    free(DMLi);
+    free(DMLi1);
+    free(DMLi2);
+    /* return free energy of unfolded chain */
+    return 0;
+  }
+
+  for (i = length-turn-1; i >= 1; i--) { /* i,j in [1..length] */
+
+    for (j = i+turn+1; j <= length; j++) {
+      ij            = indx[j]+i;
+      type          = (unsigned char)ptype[ij];
+      hc_decompose  = hard_constraints[ij];
+      energy        = INF;
+
+      no_close = (((type==3)||(type==4))&&noGUclosure);
+
+      if (hc_decompose) {   /* we evaluate this pair */
+        new_c = INF;
+
+        if(!no_close){
+          /* check for hairpin loop */
+          energy = vrna_E_hp_loop(vc, i, j);
+          new_c = MIN2(new_c, energy);
+
+          /* check for multibranch loops */
+          energy  = vrna_E_mb_loop_fast(vc, i, j, DMLi1, DMLi2);
+          new_c   = MIN2(new_c, energy);
+        }
+
+        if(dangle_model == 3){ /* coaxial stacking */
+          energy  = E_mb_loop_stack(i, j, vc);
+          new_c   = MIN2(new_c, energy);
+        }
+
+        /* check for interior loops */
+        energy = vrna_E_int_loop(vc, i, j);
+        new_c = MIN2(new_c, energy);
+
+        /* remember stack energy for --noLP option */
+        if(noLP){
+          stackEnergy = vrna_E_stack(vc, i, j);
+          new_c       = MIN2(new_c, cc1[j-1]+stackEnergy);
+          cc[j]       = new_c;
+          my_c[ij]    = cc1[j-1]+stackEnergy;
+        } else {
+          my_c[ij]    = new_c;
+        }
+      } /* end >> if (pair) << */
+
+      else my_c[ij] = INF;
+
+      /* done with c[i,j], now compute fML[i,j] and fM1[i,j] */
+
+      my_fML[ij] = vrna_E_ml_stems_fast(vc, i, j, Fmi, DMLi);
+
+      if(uniq_ML){  /* compute fM1 for unique decomposition */
+        my_fM1[ij] = E_ml_rightmost_stem(i, j, vc);
+      }
+
+    } /* end of j-loop */
+
+    {
+      int *FF; /* rotate the auxilliary arrays */
+      FF = DMLi2; DMLi2 = DMLi1; DMLi1 = DMLi; DMLi = FF;
+      FF = cc1; cc1=cc; cc=FF;
+      for (j=1; j<=length; j++) {cc[j]=Fmi[j]=DMLi[j]=INF; }
+    }
+  } /* end of i-loop */
+
+  /* calculate energies of 5' fragments */
+  E_ext_loop_5(vc);
+
+  /* clean up memory */
+  free(cc);
+  free(cc1);
+  free(Fmi);
+  free(DMLi);
+  free(DMLi1);
+  free(DMLi2);
+
+  return my_f5[length];
+}
+
+#include "circfold.inc"
+
+
+/**
+*** the actual forward recursion to fill the energy arrays
+**/
+PRIVATE int
+fill_arrays_comparative(vrna_fold_compound_t *vc){
+
+  char              *hard_constraints;
+  unsigned short    **a2s;
+  short             **S, **S5, **S3;
+  int               i, j, turn, energy, stackEnergy, new_c, s, *type, tt, *cc,
+                    *cc1, *Fmi, *DMLi, *DMLi1, *DMLi2, n_seq, length, *indx,
+                    *c, *f5, *fML, *ggg, *pscore, dangle_model;
+  vrna_param_t      *P;
+  vrna_md_t         *md;
+  vrna_hc_t         *hc;
+  vrna_sc_t         **sc;
+
+  n_seq             = vc->n_seq;
+  length            = vc->length;
+  S                 = vc->S;
+  S5                = vc->S5;             /* S5[s][i] holds next base 5' of i in sequence s */
+  S3                = vc->S3;             /* Sl[s][i] holds next base 3' of i in sequence s */
+  a2s               = vc->a2s;
+  P                 = vc->params;
+  md                = &(P->model_details);
+  indx              = vc->jindx;          /* index for moving in the triangle matrices c[] and fMl[] */
+  c                 = vc->matrices->c;    /* energy array, given that i-j pair */
+  f5                = vc->matrices->f5;   /* energy of 5' end */
+  fML               = vc->matrices->fML;  /* multi-loop auxiliary energy array */
+  ggg               = vc->matrices->ggg;
+  pscore            = vc->pscore;         /* precomputed array of pair types */
+  dangle_model      = md->dangles;
+  turn              = md->min_loop_size;
+  hc                = vc->hc;
+  sc                = vc->scs;
+  hard_constraints  = hc->matrix;
+
+  /* allocate some memory for helper arrays */
+  type  = (int *) vrna_alloc(n_seq*sizeof(int));
+  cc    = (int *) vrna_alloc(sizeof(int)*(length+2)); /* linear array for calculating canonical structures */
+  cc1   = (int *) vrna_alloc(sizeof(int)*(length+2)); /*   "     "        */
+  Fmi   = (int *) vrna_alloc(sizeof(int)*(length+1)); /* holds row i of fML (avoids jumps in memory) */
+  DMLi  = (int *) vrna_alloc(sizeof(int)*(length+1)); /* DMLi[j] holds MIN(fML[i,k]+fML[k+1,j])  */
+  DMLi1 = (int *) vrna_alloc(sizeof(int)*(length+1)); /*             MIN(fML[i+1,k]+fML[k+1,j])  */
+  DMLi2 = (int *) vrna_alloc(sizeof(int)*(length+1)); /*             MIN(fML[i+2,k]+fML[k+1,j])  */
+
+
+  if((turn < 0) || (turn > length))
+    turn = length;
+
+  /* init energies */
+  for (j=1; j<=length; j++){
+    Fmi[j]=DMLi[j]=DMLi1[j]=DMLi2[j]=INF;
+    for (i=(j>turn?(j-turn):1); i<j; i++) {
+      c[indx[j]+i] = fML[indx[j]+i] = INF;
+    }
+  }
+
+  /* begin recursions */
+  for (i = length-turn-1; i >= 1; i--) { /* i,j in [1..length] */
+    for (j = i+turn+1; j <= length; j++) {
+      int ij, psc;
+      ij = indx[j]+i;
+
+      for (s=0; s<n_seq; s++) {
+        type[s] = md->pair[S[s][i]][S[s][j]];
+        if (type[s]==0) type[s]=7;
+      }
+
+      psc = pscore[indx[j]+i];
+      if (hard_constraints[ij]) {   /* a pair to consider */
+        new_c = INF;
+
+        /* hairpin ----------------------------------------------*/
+        energy  = vrna_E_hp_loop(vc, i, j);
+        new_c   = MIN2(new_c, energy);
+
+        /* check for multibranch loops */
+        energy  = vrna_E_mb_loop_fast(vc, i, j, DMLi1, DMLi2);
+        new_c   = MIN2(new_c, energy);
+
+        /* check for interior loops */
+        energy  = vrna_E_int_loop(vc, i, j);
+        new_c   = MIN2(new_c, energy);
+
+        /* remember stack energy for --noLP option */
+        if(md->noLP){
+          stackEnergy = vrna_E_stack(vc, i, j);
+          new_c       = MIN2(new_c, cc1[j-1]+stackEnergy);
+          cc[j]       = new_c - psc; /* add covariance bonnus/penalty */
+          c[ij]       = cc1[j-1] + stackEnergy - psc;
+        } else {
+          c[ij]       = new_c - psc; /* add covariance bonnus/penalty */
+        }
+      } /* end >> if (pair) << */
+
+      else c[ij] = INF;
+
+      /* done with c[i,j], now compute fML[i,j] */
+      fML[ij] = vrna_E_ml_stems_fast(vc, i, j, Fmi, DMLi);
+
+    } /* END for j */
+
+    {
+      int *FF; /* rotate the auxilliary arrays */
+      FF = DMLi2; DMLi2 = DMLi1; DMLi1 = DMLi; DMLi = FF;
+      FF = cc1; cc1=cc; cc=FF;
+      for (j=1; j<=length; j++) {cc[j]=Fmi[j]=DMLi[j]=INF; }
+    }
+  } /* END for i */
+  /* calculate energies of 5' and 3' fragments */
+
+  f5[0] = 0;
+  for(j = 1; j <= turn + 1; j++){
+    if(hc->up_ext[j]){
+      energy = f5[j-1];
+      if((energy < INF) && sc)
+        for(s=0;s < n_seq; s++){
+          if(sc[s]){
+            if(sc[s]->energy_up)
+              energy += sc[s]->energy_up[a2s[s][j]][1];
+          }
+        }
+    } else {
+      energy = INF;
+    }
+    f5[j] = energy;
+  }
+
+  switch(dangle_model){
+    case 0:   for(j = turn + 2; j <= length; j++){
+                f5[j] = INF;
+
+                if(hc->up_ext[j]){
+                  energy = f5[j-1];
+                  if((energy < INF) && sc)
+                    for(s=0; s < n_seq; s++){
+                      if(sc[s]){
+                        if(sc[s]->energy_up)
+                          energy += sc[s]->energy_up[a2s[s][j]][1];
+                      }
+                    }
+                  f5[j] = MIN2(f5[j], energy);
+                }
+
+                if (hard_constraints[indx[j]+1] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+                  if(c[indx[j]+1] < INF){
+                    energy = c[indx[j]+1];
+                    for(s = 0; s < n_seq; s++){
+                      tt = md->pair[S[s][1]][S[s][j]];
+                      if(tt==0) tt=7;
+                      energy += E_ExtLoop(tt, -1, -1, P);
+                    }
+                    f5[j] = MIN2(f5[j], energy);
+                  }
+
+                  if(md->gquad){
+                    if(ggg[indx[j]+1] < INF)
+                      f5[j] = MIN2(f5[j], ggg[indx[j]+1]);
+                  }
+                }
+
+                for(i = j - turn - 1; i > 1; i--){
+                  if(hard_constraints[indx[j]+i] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+                    if(c[indx[j]+i]<INF){
+                      energy = f5[i-1] + c[indx[j]+i];
+                      for(s = 0; s < n_seq; s++){
+                        tt = md->pair[S[s][i]][S[s][j]];
+                        if(tt==0) tt=7;
+                        energy += E_ExtLoop(tt, -1, -1, P);
+                      }
+                      f5[j] = MIN2(f5[j], energy);
+                    }
+
+                    if(md->gquad){
+                      if(ggg[indx[j]+i] < INF)
+                        f5[j] = MIN2(f5[j], f5[i-1] + ggg[indx[j]+i]);
+                    }
+                  }
+                }
+              }
+              break;
+
+    default:  for(j = turn + 2; j <= length; j++){
+                f5[j] = INF;
+
+                if(hc->up_ext[j]){
+                  energy = f5[j-1];
+                  if((energy < INF) && sc)
+                    for(s=0; s < n_seq; s++){
+                      if(sc[s]){
+                        if(sc[s]->energy_up)
+                          energy += sc[s]->energy_up[a2s[s][j]][1];
+                      }
+                    }
+                  f5[j] = MIN2(f5[j], energy);
+                }
+
+                if(hard_constraints[indx[j]+1] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+                  if (c[indx[j]+1]<INF) {
+                    energy = c[indx[j]+1];
+                    for(s = 0; s < n_seq; s++){
+                      tt = md->pair[S[s][1]][S[s][j]];
+                      if(tt==0) tt=7;
+                      energy += E_ExtLoop(tt, -1, (j<length) ? S3[s][j] : -1, P);
+                    }
+                    f5[j] = MIN2(f5[j], energy);
+                  }
+
+                  if(md->gquad){
+                    if(ggg[indx[j]+1] < INF)
+                      f5[j] = MIN2(f5[j], ggg[indx[j]+1]);
+                  }
+                }
+
+                for(i = j - turn - 1; i > 1; i--){
+                  if(hard_constraints[indx[j]+i] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+                    if (c[indx[j]+i]<INF) {
+                      energy = f5[i-1] + c[indx[j]+i];
+                      for(s = 0; s < n_seq; s++){
+                        tt = md->pair[S[s][i]][S[s][j]];
+                        if(tt==0) tt=7;
+                        energy += E_ExtLoop(tt, S5[s][i], (j < length) ? S3[s][j] : -1, P);
+                      }
+                      f5[j] = MIN2(f5[j], energy);
+                    }
+
+                    if(md->gquad){
+                      if(ggg[indx[j]+i] < INF)
+                        f5[j] = MIN2(f5[j], f5[i-1] + ggg[indx[j]+i]);
+                    }
+                  }
+                }
+              }
+              break;
+  }
+  free(type);
+  free(cc);
+  free(cc1);
+  free(Fmi);
+  free(DMLi);
+  free(DMLi1);
+  free(DMLi2);
+  return(f5[length]);
+}
+
+#include "ViennaRNA/alicircfold.inc"
+
+PUBLIC void
+vrna_backtrack_from_intervals(vrna_fold_compound_t *vc,
+                              vrna_bp_stack_t *bp_stack,
+                              sect bt_stack[],
+                              int s){
+
+  if(vc){
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:       backtrack(vc, bp_stack, bt_stack, s);
+                                      break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:  backtrack_comparative(vc, bp_stack, bt_stack, s);
+                                      break;
+    }
+  }
+}
+
+/**
+*** trace back through the "c", "f5" and "fML" arrays to get the
+*** base pairing list. No search for equivalent structures is done.
+*** This is fast, since only few structure elements are recalculated.
+***
+*** normally s=0.
+*** If s>0 then s items have been already pushed onto the bt_stack
+**/
+PRIVATE void
+backtrack(vrna_fold_compound_t *vc,
+          vrna_bp_stack_t *bp_stack,
+          sect bt_stack[],
+          int s){
+
+  unsigned char   type;
+  char            *string, *ptype, backtrack_type;
+  int             i, j, ij, k, length, no_close, b, *my_c, *indx, noLP, noGUclosure;
+  vrna_param_t    *P;
+
+  b               = 0;
+  length          = vc->length;
+  my_c            = vc->matrices->c;
+  indx            = vc->jindx;
+  P               = vc->params;
+  noLP            = P->model_details.noLP;
+  noGUclosure     = P->model_details.noGUclosure;
+  string          = vc->sequence;
+  ptype           = vc->ptype;
+  backtrack_type  = P->model_details.backtrack_type;
+
+  if (s==0) {
+    bt_stack[++s].i = 1;
+    bt_stack[s].j = length;
+    bt_stack[s].ml = (backtrack_type=='M') ? 1 : ((backtrack_type=='C')? 2: 0);
+  }
+  while (s>0) {
+    int ml, cij;
+    int canonical = 1;     /* (i,j) closes a canonical structure */
+
+    /* pop one element from stack */
+    i  = bt_stack[s].i;
+    j  = bt_stack[s].j;
+    ml = bt_stack[s--].ml;
+
+    switch(ml){
+      /* backtrack in f5 */
+      case 0:   {
+                  int p, q;
+                  if(vrna_BT_ext_loop_f5(vc, &j, &p, &q, bp_stack, &b)){
+                    if(j > 0){
+                      bt_stack[++s].i = 1;
+                      bt_stack[s].j   = j;
+                      bt_stack[s].ml  = 0;
+                    }
+                    if(p > 0){
+                      i = p;
+                      j = q;
+                      goto repeat1;
+                    }
+
+                    continue;
+                  } else {
+                    vrna_message_error("backtracking failed in f5 for sequence:\n%s\n", string);
+                  }
+                }
+                break;
+
+      /* trace back in fML array */
+      case 1:   {
+                  int p, q, comp1, comp2;
+                  if(vrna_BT_mb_loop_split(vc, &i, &j, &p, &q, &comp1, &comp2, bp_stack, &b)){
+                    if(i > 0){
+                      bt_stack[++s].i = i;
+                      bt_stack[s].j   = j;
+                      bt_stack[s].ml  = comp1;
+                    }
+                    if(p > 0){
+                      bt_stack[++s].i = p;
+                      bt_stack[s].j   = q;
+                      bt_stack[s].ml  = comp2;
+                    }
+
+                    continue;
+                  } else {
+                    vrna_message_error("backtracking failed in fML for sequence:\n%s\n", string);
+                  }
+                }
+                break;
+
+      /* backtrack in c */
+      case 2:   bp_stack[++b].i = i;
+                bp_stack[b].j   = j;
+                goto repeat1;
+
+      default:  vrna_message_error("Backtracking failed due to unrecognized DP matrix!");
+                break;
+    }
+
+  repeat1:
+
+    /*----- begin of "repeat:" -----*/
+    ij = indx[j]+i;
+
+    if (canonical)
+      cij = my_c[ij];
+
+    type = (unsigned char)ptype[ij];
+
+    if (noLP)
+      if(vrna_BT_stack(vc, &i, &j, &cij, bp_stack, &b)){
+        canonical = 0;
+        goto repeat1;
+      }
+
+    canonical = 1;
+
+    no_close = (((type==3)||(type==4))&&noGUclosure);
+
+    if (no_close) {
+      if (cij == FORBIDDEN) continue;
+    } else {
+      if(vrna_BT_hp_loop(vc, i, j, cij, bp_stack, &b))
+        continue;
+    }
+
+    if(vrna_BT_int_loop(vc, &i, &j, cij, bp_stack, &b)){
+      if(i < 0)
+        continue;
+      else
+        goto repeat1;
+    }
+
+    /* (i.j) must close a multi-loop */
+    int comp1, comp2;
+
+    if(vrna_BT_mb_loop(vc, &i, &j, &k, cij, &comp1, &comp2)){
+      bt_stack[++s].i = i;
+      bt_stack[s].j   = k;
+      bt_stack[s].ml  = comp1;
+      bt_stack[++s].i = k + 1;
+      bt_stack[s].j   = j;
+      bt_stack[s].ml  = comp2;
+    } else {
+      vrna_message_error("backtracking failed in repeat for sequence:\n%s\n", string);
+    }
+
+    /* end of repeat: --------------------------------------------------*/
+
+  } /* end of infinite while loop */
+
+  bp_stack[0].i = b;    /* save the total number of base pairs */
+}
+
+
+/**
+*** backtrack in the energy matrices to obtain a structure with MFE
+**/
+PRIVATE void
+backtrack_comparative(vrna_fold_compound_t *vc,
+                      vrna_bp_stack_t *bp_stack,
+                      sect bt_stack[],
+                      int s) {
+
+  /*------------------------------------------------------------------
+    trace back through the "c", "f5" and "fML" arrays to get the
+    base pairing list. No search for equivalent structures is done.
+    This inverts the folding procedure, hence it's very fast.
+    ------------------------------------------------------------------*/
+   /* normally s=0.
+     If s>0 then s items have been already pushed onto the sector stack */
+
+  unsigned short  **a2s;
+  short           **S, **S5, **S3, *S_cons;
+  int             i, j, k, p, q, turn, energy, en, c0, l1, minq, maxq,
+                  type_2, tt, mm, b, cov_en, *type, n_seq, length, *indx,
+                  *c, *f5, *fML, *pscore, *ggg, *rtype, dangle_model, with_gquad;
+  vrna_param_t    *P;
+  vrna_md_t       *md;
+  vrna_hc_t       *hc;
+  vrna_sc_t       **sc;
+
+  n_seq         = vc->n_seq;
+  length        = vc->length;
+  S             = vc->S;
+  S5            = vc->S5;     /*S5[s][i] holds next base 5' of i in sequence s*/
+  S3            = vc->S3;     /*Sl[s][i] holds next base 3' of i in sequence s*/
+  a2s           = vc->a2s;
+  P             = vc->params;
+  md            = &(P->model_details);
+  indx          = vc->jindx;     /* index for moving in the triangle matrices c[] and fMl[]*/
+  c             = vc->matrices->c;     /* energy array, given that i-j pair */
+  f5            = vc->matrices->f5;     /* energy of 5' end */
+  fML           = vc->matrices->fML;     /* multi-loop auxiliary energy array */
+  pscore        = vc->pscore;     /* precomputed array of pair types */
+  ggg           = vc->matrices->ggg;
+  S_cons        = vc->S_cons;
+  rtype         = &(md->rtype[0]);
+  dangle_model  = md->dangles;
+  with_gquad    = md->gquad;
+  hc            = vc->hc;
+  sc            = vc->scs;
+  turn          = md->min_loop_size;
+  b             = 0;
+  cov_en        = 0;
+
+  type  = (int *) vrna_alloc(n_seq*sizeof(int));
+
+  if((turn < 0) || (turn > length))
+    turn = length;
+
+  if (s==0) {
+    bt_stack[++s].i = 1;
+    bt_stack[s].j = length;
+    bt_stack[s].ml = (md->backtrack_type=='M') ? 1 : ((md->backtrack_type=='C')?2:0);
+  }
+  while (s>0) {
+    int ss, ml, fij, fi, cij, traced, i1, j1, jj=0, gq=0;
+    int canonical = 1;     /* (i,j) closes a canonical structure */
+    i  = bt_stack[s].i;
+    j  = bt_stack[s].j;
+    ml = bt_stack[s--].ml;   /* ml is a flag indicating if backtracking is to
+                              occur in the fML- (1) or in the f-array (0) */
+    if (ml==2) {
+      bp_stack[++b].i = i;
+      bp_stack[b].j   = j;
+      cov_en += pscore[indx[j]+i];
+      goto repeat1_comparative;
+    }
+
+    if (j < i+turn+1) continue; /* no more pairs in this interval */
+
+    if(ml != 0){
+      fij = fML[indx[j]+i];
+      fi  = (hc->up_ml[j]) ? fML[indx[j-1]+i] + n_seq*P->MLbase : INF;
+    } else {
+      fij = f5[j];
+      fi  = (hc->up_ext[j]) ? f5[j-1] : INF;
+    }
+
+    if(sc)
+      for(ss = 0; ss < n_seq; ss++)
+        if(sc[ss]){
+          if(sc[ss]->energy_up)
+            fi += sc[ss]->energy_up[a2s[ss][j]][1];
+        }
+
+    if (fij == fi) {  /* 3' end is unpaired */
+      bt_stack[++s].i = i;
+      bt_stack[s].j   = j-1;
+      bt_stack[s].ml  = ml;
+      continue;
+    }
+
+    if (ml == 0) { /* backtrack in f5 */
+      switch(dangle_model){
+        case 0:   /* j or j-1 is paired. Find pairing partner */
+                  for (i=j-turn-1,traced=0; i>=1; i--) {
+                    int en;
+                    jj = i-1;
+
+                    if (hc->matrix[indx[j] + i] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+                      en = c[indx[j]+i] + f5[i-1];
+                      for(ss = 0; ss < n_seq; ss++){
+                        type[ss] = md->pair[S[ss][i]][S[ss][j]];
+                        if (type[ss]==0) type[ss] = 7;
+                        en += E_ExtLoop(type[ss], -1, -1, P);
+                      }
+                      if (fij == en) traced=j;
+                    }
+
+                    if(with_gquad){
+                      if(fij == f5[i-1] + ggg[indx[j]+i]){
+                        /* found the decomposition */
+                        traced = j; jj = i - 1; gq = 1;
+                        break;
+                      }
+                    }
+
+                    if (traced) break;
+                  }
+                  break;
+        default:  /* j or j-1 is paired. Find pairing partner */
+                  for (i=j-turn-1,traced=0; i>=1; i--) {
+                    int en;
+                    jj = i-1;
+                    if (hc->matrix[indx[j] + i] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+                      en = c[indx[j]+i] + f5[i-1];
+                      for(ss = 0; ss < n_seq; ss++){
+                        type[ss] = md->pair[S[ss][i]][S[ss][j]];
+                        if (type[ss]==0) type[ss] = 7;
+                        en += E_ExtLoop(type[ss], (i>1) ? S5[ss][i]: -1, (j < length) ? S3[ss][j] : -1, P);
+                      }
+                      if (fij == en) traced=j;
+                    }
+
+                    if(with_gquad){
+                      if(fij == f5[i-1] + ggg[indx[j]+i]){
+                        /* found the decomposition */
+                        traced = j; jj = i - 1; gq = 1;
+                        break;
+                      }
+                    }
+
+                    if (traced) break;
+                  }
+                  break;
+      }
+
+      if (!traced) vrna_message_error("backtrack failed in f5");
+      /* push back the remaining f5 portion */
+      bt_stack[++s].i = 1;
+      bt_stack[s].j   = jj;
+      bt_stack[s].ml  = ml;
+
+      /* trace back the base pair found */
+      j=traced;
+
+      if(with_gquad && gq){
+        /* goto backtrace of gquadruplex */
+        goto repeat_gquad_comparative;
+      }
+
+      bp_stack[++b].i = i;
+      bp_stack[b].j   = j;
+      cov_en += pscore[indx[j]+i];
+      goto repeat1_comparative;
+    }
+    else { /* trace back in fML array */
+      if(hc->up_ml[i]){
+        en = fML[indx[j]+i+1] + n_seq * P->MLbase;
+
+        if(sc)
+          for(ss = 0; ss < n_seq; ss++)
+            if(sc[ss]){
+              if(sc[ss]->energy_up)
+                en += sc[ss]->energy_up[a2s[ss][i]][1];
+            }
+
+        if(en == fij) { /* 5' end is unpaired */
+          bt_stack[++s].i = i+1;
+          bt_stack[s].j   = j;
+          bt_stack[s].ml  = ml;
+          continue;
+        }
+      }
+
+      if(md->gquad){
+        if(fij == ggg[indx[j]+i] + n_seq * E_MLstem(0, -1, -1, P)){
+          /* go to backtracing of quadruplex */
+          goto repeat_gquad_comparative;
+        }
+      }
+
+      if(hc->matrix[indx[j] + i] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC){
+        cij = c[indx[j]+i];
+        if(dangle_model){
+          for(ss = 0; ss < n_seq; ss++){
+            tt = md->pair[S[ss][i]][S[ss][j]];
+            if(tt==0) tt=7;
+            cij += E_MLstem(tt, S5[ss][i], S3[ss][j], P);
+          }
+        }
+        else{
+          for(ss = 0; ss < n_seq; ss++){
+            tt = md->pair[S[ss][i]][S[ss][j]];
+            if(tt==0) tt=7;
+            cij += E_MLstem(tt, -1, -1, P);
+          }
+        }
+
+        if (fij==cij){
+          /* found a pair */
+          bp_stack[++b].i = i;
+          bp_stack[b].j   = j;
+          cov_en += pscore[indx[j]+i];
+          goto repeat1_comparative;
+        }
+      }
+
+      for (k = i+1+turn; k <= j-2-turn; k++)
+        if (fij == (fML[indx[k]+i]+fML[indx[j]+k+1]))
+          break;
+
+      bt_stack[++s].i = i;
+      bt_stack[s].j   = k;
+      bt_stack[s].ml  = ml;
+      bt_stack[++s].i = k+1;
+      bt_stack[s].j   = j;
+      bt_stack[s].ml  = ml;
+
+      if (k>j-2-turn) vrna_message_error("backtrack failed in fML");
+      continue;
+    }
+
+  repeat1_comparative:
+
+    /*----- begin of "repeat:" -----*/
+    if (canonical)  cij = c[indx[j]+i];
+
+    for (ss=0; ss<n_seq; ss++) {
+      type[ss] = md->pair[S[ss][i]][S[ss][j]];
+      if (type[ss]==0) type[ss] = 7;
+    }
+
+    if (md->noLP)
+      if (cij == c[indx[j]+i]) {
+        /* (i.j) closes canonical structures, thus
+           (i+1.j-1) must be a pair                */
+        for (ss=0; ss<n_seq; ss++) {
+          type_2 = md->pair[S[ss][j-1]][S[ss][i+1]];  /* j,i not i,j */
+          if (type_2==0) type_2 = 7;
+          cij -= P->stack[type[ss]][type_2];
+          if(sc){
+            if(sc[ss]->energy_bp)
+              cij -= sc[s]->energy_bp[indx[j] + i];
+          }
+        }
+        cij += pscore[indx[j]+i];
+        bp_stack[++b].i = i+1;
+        bp_stack[b].j   = j-1;
+        cov_en += pscore[indx[j-1]+i+1];
+        i++; j--;
+        canonical=0;
+        goto repeat1_comparative;
+      }
+    canonical = 1;
+    cij += pscore[indx[j]+i];
+
+    /* does (i,j) close a hairpin loop ? */
+    if(vrna_BT_hp_loop(vc, i, j, cij, bp_stack, &b))
+      continue;
+
+    for (p = i+1; p <= MIN2(j-2-turn,i+MAXLOOP+1); p++) {
+      minq = j-i+p-MAXLOOP-2;
+      if (minq<p+1+turn) minq = p+1+turn;
+      if(hc->up_int[i+1] < (p - i - 1)) break;
+
+      for (q = j-1; q >= minq; q--) {
+
+        if(hc->up_int[q+1] < (j - q - 1)) break;
+
+        if (c[indx[q]+p]>=INF) continue;
+
+        for (ss=energy=0; ss<n_seq; ss++) {
+          int u1 = a2s[ss][p-1] - a2s[ss][i];
+          int u2 = a2s[ss][j-1] - a2s[ss][q];
+          type_2 = md->pair[S[ss][q]][S[ss][p]];  /* q,p not p,q */
+          if (type_2==0) type_2 = 7;
+          energy += E_IntLoop(u1, u2, type[ss], type_2, S3[ss][i], S5[ss][j], S5[ss][p], S3[ss][q], P);
+
+        }
+
+        if(sc)
+          for(ss = 0; ss < n_seq; ss++)
+            if(sc[ss]){
+              int u1 = a2s[ss][p-1] - a2s[ss][i];
+              int u2 = a2s[ss][j-1] - a2s[ss][q];
+/*
+              int u1 = p - i - 1;
+              int u2 = j - q - 1;
+*/
+              if(u1 + u2 == 0)
+                if(sc[ss]->energy_stack){
+                  if(S[ss][i] && S[ss][j] && S[ss][p] && S[ss][q]){ /* don't allow gaps in stack */
+                    energy +=   sc[ss]->energy_stack[a2s[ss][i]]
+                              + sc[ss]->energy_stack[a2s[ss][p]]
+                              + sc[ss]->energy_stack[a2s[ss][q]]
+                              + sc[ss]->energy_stack[a2s[ss][j]];
+                  }
+                }
+              if(sc[ss]->energy_bp)
+                energy += sc[ss]->energy_bp[indx[j] + i];
+
+              if(sc[ss]->energy_up)
+                energy +=   sc[ss]->energy_up[a2s[ss][i] + 1][u1]
+                          + sc[ss]->energy_up[a2s[ss][q] + 1][u2];
+            }
+
+        traced = (cij == energy+c[indx[q]+p]);
+        if (traced) {
+          bp_stack[++b].i = p;
+          bp_stack[b].j   = q;
+          cov_en += pscore[indx[q]+p];
+          i = p, j = q;
+          goto repeat1_comparative;
+        }
+      }
+    }
+
+    /* end of repeat: --------------------------------------------------*/
+
+    /* (i.j) must close a multi-loop */
+
+    i1 = i+1;
+    j1 = j-1;
+
+    if(with_gquad){
+      /*
+        The case that is handled here actually resembles something like
+        an interior loop where the enclosing base pair is of regular
+        kind and the enclosed pair is not a canonical one but a g-quadruplex
+        that should then be decomposed further...
+      */
+      mm = 0;
+      for(ss=0;ss<n_seq;ss++){
+        tt = type[ss];
+        if(tt == 0) tt = 7;
+        if(dangle_model == 2)
+          mm += P->mismatchI[tt][S3[ss][i]][S5[ss][j]];
+        if(tt > 2)
+          mm += P->TerminalAU;
+      }
+
+      for(p = i + 2;
+        p < j - VRNA_GQUAD_MIN_BOX_SIZE;
+        p++){
+        if(S_cons[p] != 3) continue;
+        l1    = p - i - 1;
+        if(l1>MAXLOOP) break;
+        minq  = j - i + p - MAXLOOP - 2;
+        c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+        minq  = MAX2(c0, minq);
+        c0    = j - 1;
+        maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+        maxq  = MIN2(c0, maxq);
+        for(q = minq; q < maxq; q++){
+          if(S_cons[q] != 3) continue;
+          c0  = mm + ggg[indx[q] + p] + n_seq * P->internal_loop[l1 + j - q - 1];
+          if(cij == c0){
+            i=p;j=q;
+            goto repeat_gquad_comparative;
+          }
+        }
+      }
+      p = i1;
+      if(S_cons[p] == 3){
+        if(p < j - VRNA_GQUAD_MIN_BOX_SIZE){
+          minq  = j - i + p - MAXLOOP - 2;
+          c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
+          minq  = MAX2(c0, minq);
+          c0    = j - 3;
+          maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
+          maxq  = MIN2(c0, maxq);
+          for(q = minq; q < maxq; q++){
+            if(S_cons[q] != 3) continue;
+            if(cij == mm + ggg[indx[q] + p] + n_seq * P->internal_loop[j - q - 1]){
+              i = p; j=q;
+              goto repeat_gquad_comparative;
+            }
+          }
+        }
+      }
+      q = j1;
+      if(S_cons[q] == 3)
+        for(p = i1 + 3; p < j - VRNA_GQUAD_MIN_BOX_SIZE; p++){
+          l1    = p - i - 1;
+          if(l1>MAXLOOP) break;
+          if(S_cons[p] != 3) continue;
+          if(cij == mm + ggg[indx[q] + p] + n_seq * P->internal_loop[l1]){
+            i = p; j = q;
+            goto repeat_gquad_comparative;
+          }
+        }
+    }
+
+    if(hc->matrix[indx[j] + i] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+      mm = n_seq*P->MLclosing;
+      switch(dangle_model){
+        case 0:   for(ss = 0; ss < n_seq; ss++){
+                    tt = rtype[type[ss]];
+                    mm += E_MLstem(tt, -1, -1, P);
+                  }
+                  break;
+        default:  for(ss = 0; ss < n_seq; ss++){
+                    tt = rtype[type[ss]];
+                    mm += E_MLstem(tt, S5[ss][j], S3[ss][i], P);
+                  }
+                  break;
+      }
+
+      if(sc)
+        for(ss = 0; ss < n_seq; ss++)
+          if(sc[ss]){
+            if(sc[ss]->energy_bp)
+              mm += sc[ss]->energy_bp[indx[j] + i];
+          }
+
+      bt_stack[s+1].ml  = bt_stack[s+2].ml = 1;
+
+      for (k = i1+turn+1; k < j1-turn-1; k++){
+        if(cij == fML[indx[k]+i1] + fML[indx[j1]+k+1] + mm) break;
+      }
+
+      if (k<=j-3-turn) { /* found the decomposition */
+        bt_stack[++s].i = i1;
+        bt_stack[s].j   = k;
+        bt_stack[++s].i = k+1;
+        bt_stack[s].j   = j1;
+      } else {
+          vrna_message_error("backtracking failed in repeat");
+      }
+    } else
+      vrna_message_error("backtracking failed in repeat");
+
+    continue; /* this is a workarround to not accidentally proceed in the following block */
+
+  repeat_gquad_comparative:
+    /*
+      now we do some fancy stuff to backtrace the stacksize and linker lengths
+      of the g-quadruplex that should reside within position i,j
+    */
+    {
+      int cnt1, l[3], L, size;
+      size = j-i+1;
+
+      for(L=0; L < VRNA_GQUAD_MIN_STACK_SIZE;L++){
+        if(S_cons[i+L] != 3) break;
+        if(S_cons[j-L] != 3) break;
+      }
+
+      if(L == VRNA_GQUAD_MIN_STACK_SIZE){
+        /* continue only if minimum stack size starting from i is possible */
+        for(; L<=VRNA_GQUAD_MAX_STACK_SIZE;L++){
+          if(S_cons[i+L-1] != 3) break; /* break if no more consecutive G's 5' */
+          if(S_cons[j-L+1] != 3) break; /* break if no more consecutive G'1 3' */
+          for(    l[0] = VRNA_GQUAD_MIN_LINKER_LENGTH;
+                  (l[0] <= VRNA_GQUAD_MAX_LINKER_LENGTH)
+              &&  (size - 4*L - 2*VRNA_GQUAD_MIN_LINKER_LENGTH - l[0] >= 0);
+              l[0]++){
+            /* check whether we find the second stretch of consecutive G's */
+            for(cnt1 = 0; (cnt1 < L) && (S_cons[i+L+l[0]+cnt1] == 3); cnt1++);
+            if(cnt1 < L) continue;
+            for(    l[1] = VRNA_GQUAD_MIN_LINKER_LENGTH;
+                    (l[1] <= VRNA_GQUAD_MAX_LINKER_LENGTH)
+                &&  (size - 4*L - VRNA_GQUAD_MIN_LINKER_LENGTH - l[0] - l[1] >= 0);
+                l[1]++){
+              /* check whether we find the third stretch of consectutive G's */
+              for(cnt1 = 0; (cnt1 < L) && (S_cons[i+2*L+l[0]+l[1]+cnt1] == 3); cnt1++);
+              if(cnt1 < L) continue;
+
+              /*
+                the length of the third linker now depends on position j as well
+                as the other linker lengths... so we do not have to loop too much
+              */
+              l[2] = size - 4*L - l[0] - l[1];
+              if(l[2] < VRNA_GQUAD_MIN_LINKER_LENGTH) break;
+              if(l[2] > VRNA_GQUAD_MAX_LINKER_LENGTH) continue;
+              /* check for contribution */
+              if(ggg[indx[j]+i] == E_gquad_ali(i, L, l, (const short **)S, n_seq, P)){
+                int a;
+                /* fill the G's of the quadruplex into base pair stack */
+                for(a=0;a<L;a++){
+                  bp_stack[++b].i = i+a;
+                  bp_stack[b].j   = i+a;
+                  bp_stack[++b].i = i+L+l[0]+a;
+                  bp_stack[b].j   = i+L+l[0]+a;
+                  bp_stack[++b].i = i+L+l[0]+L+l[1]+a;
+                  bp_stack[b].j   = i+L+l[0]+L+l[1]+a;
+                  bp_stack[++b].i = i+L+l[0]+L+l[1]+L+l[2]+a;
+                  bp_stack[b].j   = i+L+l[0]+L+l[1]+L+l[2]+a;
+                }
+                goto repeat_gquad_comparative_exit;
+              }
+            }
+          }
+        }
+      }
+      vrna_message_error("backtracking failed in repeat_gquad_comparative");
+    }
+  repeat_gquad_comparative_exit:
+    __asm("nop");
+
+  }
+
+  bp_stack[0].i = b;    /* save the total number of base pairs */
+  free(type);
+}
+
diff --git a/C/ViennaRNA/mfe.h b/C/ViennaRNA/mfe.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/mfe.h
@@ -0,0 +1,119 @@
+#ifndef VIENNA_RNA_PACKAGE_MFE_H
+#define VIENNA_RNA_PACKAGE_MFE_H
+
+#include <stdio.h>
+#include <ViennaRNA/data_structures.h>
+
+/**
+ *  @brief Compute minimum free energy and an appropriate secondary
+ *  structure of an RNA sequence, or RNA sequence alignment
+ *
+ *  Depending on the type of the provided #vrna_fold_compound_t, this function
+ *  predicts the MFE for a single sequence, or a corresponding averaged MFE for
+ *  a sequence alignment. If backtracking is activated, it also constructs the
+ *  corresponding secondary structure, or consensus structure.
+ *  Therefore, the second parameter, @a structure, has to point to an allocated
+ *  block of memory with a size of at least @f$\mathrm{strlen}(\mathrm{sequence})+1@f$ to
+ *  store the backtracked MFE structure. (For consensus structures, this is the length of
+ *  the alignment + 1. If @p NULL is passed, no backtracking will be performed.
+ *
+ *  @ingroup mfe_fold
+ *
+ *  @note This function is polymorphic. It accepts #vrna_fold_compound_t of type
+ *        #VRNA_FC_TYPE_SINGLE, and #VRNA_FC_TYPE_COMPARATIVE.
+ *
+ *  @see #vrna_fold_compound_t, vrna_fold_compound(), vrna_fold(), vrna_circfold(),
+ *        vrna_fold_compound_comparative(), vrna_alifold(), vrna_circalifold()
+ *
+ *  @param vc             fold compound
+ *  @param structure      A pointer to the character array where the
+ *                        secondary structure in dot-bracket notation will be written to (Maybe NULL)
+ *
+ *  @return the minimum free energy (MFE) in kcal/mol
+ */
+float
+vrna_mfe(vrna_fold_compound_t *vc,
+          char *structure);
+
+/**
+ *  @brief Compute the minimum free energy of two interacting RNA molecules
+ *
+ *  The code is analog to the vrna_mfe() function.
+ *
+ *  @ingroup mfe_cofold
+ *
+ *  @param    vc  fold compound
+ *  @param    structure Will hold the barcket dot structure of the dimer molecule
+ *  @return   minimum free energy of the structure
+ */
+float vrna_mfe_dimer( vrna_fold_compound_t *vc,
+                      char *structure);
+
+/**
+ *  @brief Local MFE prediction using a sliding window approach.
+ *
+ *  Computes minimum free energy structures using a sliding window
+ *  approach, where base pairs may not span outside the window.
+ *  In contrast to vrna_mfe(), where a maximum base pair span
+ *  may be set using the #vrna_md_t.max_bp_span attribute and one
+ *  globally optimal structure is predicted, this function uses a
+ *  sliding window to retrieve all locally optimal structures within
+ *  each window.
+ *  The size of the sliding window is set in the #vrna_md_t.window_size
+ *  attribute, prior to the retrieval of the #vrna_fold_compound_t
+ *  using vrna_fold_compound() with option #VRNA_OPTION_WINDOW
+ *
+ *  The predicted structures are written on-the-fly, either to
+ *  stdout, if a NULL pointer is passed as file parameter, or to
+ *  the corresponding filehandle.
+ *
+ *  @ingroup local_mfe_fold
+ * 
+ *  @see  vrna_fold_compound(), vrna_mfe_window_zscore(), vrna_mfe(),
+ *        vrna_Lfold(), vrna_Lfoldz(),
+ *        #VRNA_OPTION_WINDOW, #vrna_md_t.max_bp_span, #vrna_md_t.window_size
+ *
+ *  @param  vc        The #vrna_fold_compound_t with preallocated memory for the DP matrices
+ *  @param  file      The output file handle where predictions are written to (maybe NULL)
+ */
+float vrna_mfe_window( vrna_fold_compound_t *vc, FILE *file);
+
+#ifdef USE_SVM
+/**
+ *  @brief Local MFE prediction using a sliding window approach (with z-score cut-off)
+ *
+ *  Computes minimum free energy structures using a sliding window
+ *  approach, where base pairs may not span outside the window.
+ *  This function is the z-score version of vrna_mfe_window(), i.e.
+ *  only predictions above a certain z-score cut-off value are
+ *  printed.
+ *  As for vrna_mfe_window(), the size of the sliding window is set in
+ *  the #vrna_md_t.window_size attribute, prior to the retrieval of
+ *  the #vrna_fold_compound_t using vrna_fold_compound() with option
+ *  #VRNA_OPTION_WINDOW.
+ *
+ *  The predicted structures are written on-the-fly, either to
+ *  stdout, if a NULL pointer is passed as file parameter, or to
+ *  the corresponding filehandle.
+ *
+ *  @ingroup local_mfe_fold
+ * 
+ *  @see  vrna_fold_compound(), vrna_mfe_window_zscore(), vrna_mfe(),
+ *        vrna_Lfold(), vrna_Lfoldz(),
+ *        #VRNA_OPTION_WINDOW, #vrna_md_t.max_bp_span, #vrna_md_t.window_size
+ *
+ *  @param  vc        The #vrna_fold_compound_t with preallocated memory for the DP matrices
+ *  @param  min_z     The minimal z-score for a predicted structure to appear in the output
+ *  @param  file      The output file handle where predictions are written to (maybe NULL)
+ */
+float vrna_mfe_window_zscore(vrna_fold_compound_t *vc, double min_z, FILE *file);
+#endif
+
+void
+vrna_backtrack_from_intervals(vrna_fold_compound_t *vc,
+                              vrna_bp_stack_t *bp_stack,
+                              sect bt_stack[],
+                              int s);
+
+
+#endif
diff --git a/C/ViennaRNA/mm.c b/C/ViennaRNA/mm.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/mm.c
@@ -0,0 +1,103 @@
+/*
+      Implementation of Nussinov Maximum Matching
+      Ronny Lorenz
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/params.h"
+
+/* the encoded string MUST have the length of the sequence at position 0!!! */
+PUBLIC unsigned int maximumMatching(const char *string){
+  unsigned int i, j, l, length, max = 0;
+  unsigned int *mm;            /* holds maximum matching on subsequence [i,j] */
+  short *encodedString = encode_sequence(string, 0);
+  int *iindx = vrna_idx_row_wise((unsigned) encodedString[0]);
+  make_pair_matrix();
+  length = (unsigned int)encodedString[0];
+  mm = (unsigned int *) vrna_alloc(sizeof(unsigned int)*((length*(length+1))/2+2));
+  for(j = 1; j<=length; j++)
+    for(i=(j>TURN?(j-TURN):1); i<j; i++)
+      mm[iindx[i]-j] = 0;
+  for(i=length-TURN-1;i>0; i--)
+    for(j=i+TURN+1; j<= length; j++){
+      max = mm[iindx[i]-j+1];
+      for(l=j-TURN-1; l>=i; l--)
+        if(pair[encodedString[l]][encodedString[j]])
+          max = MAX2(max, ((l>i) ? mm[iindx[i]-l+1] : 0) + 1 + mm[iindx[l+1]-j+1]);
+       mm[iindx[i]-j] = max;
+    }
+  max = mm[iindx[1]-length];
+  free(mm);
+  free(iindx);
+  free(encodedString);
+  return max;
+}
+
+/* the encoded string MUST have the length of the sequence at position 0!!! */
+PUBLIC unsigned int *maximumMatchingConstraint(const char *string, short *ptable){
+  unsigned int i, j, l, length, max = 0;
+  unsigned int *mm;            /* holds maximum matching on subsequence [i,j] */
+  short *encodedString = encode_sequence(string, 0);
+  int *iindx = vrna_idx_row_wise((unsigned) encodedString[0]);
+  make_pair_matrix();
+  length = (unsigned int)encodedString[0];
+  mm = (unsigned int *) vrna_alloc(sizeof(unsigned int)*((length*(length+1))/2+2));
+  for(j = 1; j<=length; j++)
+    for(i=(j>TURN?(j-TURN):1); i<j; i++)
+      mm[iindx[i]-j] = 0;
+  for(i=length-TURN-1;i>0; i--)
+    for(j=i+TURN+1; j<= length; j++){
+      max = mm[iindx[i]-j+1];
+      for(l=j-TURN-1; l>=i; l--){
+        if(pair[encodedString[l]][encodedString[j]]){
+          if(ptable[l] != j)
+            max = MAX2(max, ((l>i) ? mm[iindx[i]-l+1] : 0) + 1 + mm[iindx[l+1]-j+1]);
+        }
+      }
+      mm[iindx[i]-j] = max;
+    }
+  free(iindx);
+  free(encodedString);
+  return mm;
+}
+
+/* the encoded string MUST have the length of the sequence at position 0!!! */
+PUBLIC unsigned int *maximumMatching2Constraint(const char *string, short *ptable, short *ptable2){
+  unsigned int i, j, l, length, max = 0;
+  unsigned int *mm;            /* holds maximum matching on subsequence [i,j] */
+  short *encodedString = encode_sequence(string, 0);
+  int *iindx = vrna_idx_row_wise((unsigned) encodedString[0]);
+  make_pair_matrix();
+  length = (unsigned int)encodedString[0];
+  mm = (unsigned int *) vrna_alloc(sizeof(unsigned int)*((length*(length+1))/2+2));
+  for(j = 1; j<=length; j++)
+    for(i=(j>TURN?(j-TURN):1); i<j; i++)
+      mm[iindx[i]-j] = 0;
+  for(i=length-TURN-1;i>0; i--)
+    for(j=i+TURN+1; j<= length; j++){
+      max = mm[iindx[i]-j+1];
+      for(l=j-TURN-1; l>=i; l--){
+        if(pair[encodedString[l]][encodedString[j]]){
+          if(ptable[l] != j && ptable2[l] != j)
+            max = MAX2(max, ((l>i) ? mm[iindx[i]-l+1] : 0) + 1 + mm[iindx[l+1]-j+1]);
+        }
+      }
+      mm[iindx[i]-j] = max;
+    }
+  free(iindx);
+  free(encodedString);
+  return mm;
+}
+
diff --git a/C/ViennaRNA/mm.h b/C/ViennaRNA/mm.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/mm.h
@@ -0,0 +1,23 @@
+#ifndef VIENNA_RNA_PACKAGE_MM_H
+#define VIENNA_RNA_PACKAGE_MM_H
+
+/**
+ *
+ *  @file mm.h
+ *  @ingroup subopt_and_representatives
+ *  @brief Several Maximum Matching implementations
+ *
+ *  This file contains the declarations for several maximum matching implementations
+ */
+
+
+unsigned int  maximumMatching(const char *string);
+
+unsigned int *maximumMatchingConstraint(const char *string,
+                                        short *ptable);
+
+unsigned int *maximumMatching2Constraint( const char *string,
+                                          short *ptable,
+                                          short *ptable2);
+
+#endif
diff --git a/C/ViennaRNA/model.c b/C/ViennaRNA/model.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/model.c
@@ -0,0 +1,908 @@
+/*
+                  Model Details structure creation/modification/destruction
+
+                  This file contains everything which is necessary to
+                  obtain, modify, and destroy the model_details datastructure
+                  used in the folding recurrences throughout the ViennaRNA
+                  Package
+
+                  c Ronny Lorenx
+
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <limits.h>
+
+#include "ViennaRNA/energy_const.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/model.h"
+
+/*
+#################################
+# PRIVATE MACROS                #
+#################################
+*/
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*  below are the evil global variables that will vanish
+    as soon as we drop backward compatibility in ViennaRNA
+    Package v3
+*/
+
+double  temperature     = VRNA_MODEL_DEFAULT_TEMPERATURE;
+double  pf_scale        = VRNA_MODEL_DEFAULT_PF_SCALE;
+int     dangles         = VRNA_MODEL_DEFAULT_DANGLES;
+int     tetra_loop      = VRNA_MODEL_DEFAULT_SPECIAL_HP;
+int     noLonelyPairs   = VRNA_MODEL_DEFAULT_NO_LP;
+int     noGU            = VRNA_MODEL_DEFAULT_NO_GU;
+int     no_closingGU    = VRNA_MODEL_DEFAULT_NO_GU_CLOSURE;
+int     circ            = VRNA_MODEL_DEFAULT_CIRC;
+int     gquad           = VRNA_MODEL_DEFAULT_GQUAD;
+int     canonicalBPonly = VRNA_MODEL_DEFAULT_CANONICAL_BP;
+int     uniq_ML         = VRNA_MODEL_DEFAULT_UNIQ_ML;
+int     energy_set      = VRNA_MODEL_DEFAULT_ENERGY_SET;
+int     do_backtrack    = VRNA_MODEL_DEFAULT_COMPUTE_BPP;
+char    backtrack_type  = VRNA_MODEL_DEFAULT_BACKTRACK_TYPE;
+char    *nonstandards   = NULL;
+int     max_bp_span     = VRNA_MODEL_DEFAULT_MAX_BP_SPAN;
+int     oldAliEn        = VRNA_MODEL_DEFAULT_ALI_OLD_EN;
+int     ribo            = VRNA_MODEL_DEFAULT_ALI_RIBO;
+double  cv_fact         = VRNA_MODEL_DEFAULT_ALI_CV_FACT;
+double  nc_fact         = VRNA_MODEL_DEFAULT_ALI_NC_FACT;
+int     logML           = VRNA_MODEL_DEFAULT_LOG_ML;
+
+/* below are some more deprecated global symbols we need to get rid off */
+
+int         james_rule = 1;       /* interior loops of size 2 get energy 0.8Kcal and
+                                    no mismatches (no longer used) */
+char        *RibosumFile = NULL;  /* TODO: compile ribosums into program
+                                    Warning: this variable will vanish */
+int         csv = 0;              /*generate comma seperated output*/
+vrna_bp_stack_t       *base_pair = NULL;
+FLT_OR_DBL  *pr = NULL;           /* base pairing prob. matrix */
+int         *iindx = NULL;        /* pr[i,j] -> pr[iindx[i]-j] */
+int         fold_constrained = 0; /* fold with constraints */
+
+#endif
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+PRIVATE int rtype[8] = {0, 2, 1, 4, 3, 6, 5, 7};
+PRIVATE int BP_pair[NBASES][NBASES]=
+/* _  A  C  G  U  X  K  I */
+{{ 0, 0, 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 5, 0, 0, 5},
+ { 0, 0, 0, 1, 0, 0, 0, 0},
+ { 0, 0, 2, 0, 3, 0, 0, 0},
+ { 0, 6, 0, 4, 0, 0, 0, 6},
+ { 0, 0, 0, 0, 0, 0, 2, 0},
+ { 0, 0, 0, 0, 0, 1, 0, 0},
+ { 0, 6, 0, 0, 5, 0, 0, 0}};
+
+PRIVATE vrna_md_t defaults = {
+  VRNA_MODEL_DEFAULT_TEMPERATURE,
+  1.,
+  VRNA_MODEL_DEFAULT_DANGLES,
+  VRNA_MODEL_DEFAULT_SPECIAL_HP,
+  VRNA_MODEL_DEFAULT_NO_LP,
+  VRNA_MODEL_DEFAULT_NO_GU,
+  VRNA_MODEL_DEFAULT_NO_GU_CLOSURE,
+  VRNA_MODEL_DEFAULT_LOG_ML,
+  VRNA_MODEL_DEFAULT_CIRC,
+  VRNA_MODEL_DEFAULT_GQUAD,
+  VRNA_MODEL_DEFAULT_CANONICAL_BP,
+  VRNA_MODEL_DEFAULT_UNIQ_ML,
+  VRNA_MODEL_DEFAULT_ENERGY_SET,
+  VRNA_MODEL_DEFAULT_BACKTRACK,
+  VRNA_MODEL_DEFAULT_BACKTRACK_TYPE,
+  VRNA_MODEL_DEFAULT_COMPUTE_BPP,
+  {0},
+  VRNA_MODEL_DEFAULT_MAX_BP_SPAN,
+  TURN,
+  VRNA_MODEL_DEFAULT_WINDOW_SIZE,
+  VRNA_MODEL_DEFAULT_ALI_OLD_EN,
+  VRNA_MODEL_DEFAULT_ALI_RIBO,
+  VRNA_MODEL_DEFAULT_ALI_CV_FACT,
+  VRNA_MODEL_DEFAULT_ALI_NC_FACT,
+  1.07,
+  {0, 2, 1, 4, 3, 6, 5, 7},
+  {0, 1, 2, 3, 4, 3, 2, 0},
+  {
+    { 0, 0, 0, 0, 0, 0, 0, 0},
+    { 0, 0, 0, 0, 5, 0, 0, 5},
+    { 0, 0, 0, 1, 0, 0, 0, 0},
+    { 0, 0, 2, 0, 3, 0, 0, 0},
+    { 0, 6, 0, 4, 0, 0, 0, 6},
+    { 0, 0, 0, 0, 0, 0, 2, 0},
+    { 0, 0, 0, 0, 0, 1, 0, 0},
+    { 0, 6, 0, 0, 5, 0, 0, 0}
+  }
+};
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+/* Fill the base pair type encodings according to the model details */
+PRIVATE void fill_pair_matrices(vrna_md_t *md);
+PRIVATE void copy_nonstandards(vrna_md_t *md, const char *ns);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC vrna_md_t *
+vrna_md_copy( vrna_md_t       *md_to,
+              const vrna_md_t *md_from){
+
+  int i;
+  vrna_md_t *md;
+
+  md = NULL;
+
+  /* only process if md_from is non-NULL */
+  if(md_from){
+    if(!md_to){
+      /* create container to be filled */
+      md = (vrna_md_t *)vrna_alloc(sizeof(vrna_md_t));
+    } else {
+      /* or directly write to target */
+      md = md_to;
+    }
+
+    /* check if not the same object */
+    if(md_to != md_from){
+      /* copy simple members */
+      memcpy(md, md_from, sizeof(vrna_md_t));
+      /* copy arrays */
+      memcpy(md->rtype, &(md_from->rtype[0]), 8 * sizeof(int));
+      memcpy(md->alias, &(md_from->alias[0]), (MAXALPHA + 1) * sizeof(short));
+      memcpy(md->nonstandards, &(md_from->nonstandards[0]), 64 * sizeof(char));
+      /* copy matrices */
+      for(i = 0; i <= MAXALPHA; i++){
+        memcpy(md->pair[i], (md_from->pair[i]), (MAXALPHA + 1) * sizeof(int));
+      }
+    }
+  }
+
+  return md;
+}
+
+PUBLIC void
+vrna_md_set_default(vrna_md_t *md){
+
+  if(md) /* copy defaults */
+    vrna_md_copy(md, &defaults);
+}
+
+PUBLIC char *
+vrna_md_option_string(vrna_md_t  *md){
+  static char options[255];
+  *options = '\0';
+
+  if(md){
+    if(md->dangles != VRNA_MODEL_DEFAULT_DANGLES)
+      sprintf(options + strlen(options), "-d%d ", md->dangles);
+    if(!md->special_hp)
+      strcat(options, "-4 ");
+    if(md->noLP)
+      strcat(options, "--noLP ");
+    if(md->noGU)
+      strcat(options, "--noGU ");
+    if(md->noGUclosure)
+      strcat(options, "--noClosingGU ");
+    if(md->temperature != VRNA_MODEL_DEFAULT_TEMPERATURE)
+      sprintf(options + strlen(options), "-T %f ", md->temperature);
+  }
+
+  return options;
+}
+
+PRIVATE void
+copy_nonstandards(vrna_md_t *md, const char *ns){
+
+  unsigned int n = strlen(ns);
+  if(n < 64){
+    memcpy(md->nonstandards, ns, strlen(ns)*sizeof(char));
+    md->nonstandards[n] = '\0';
+  }
+}
+
+PUBLIC void
+vrna_md_set_nonstandards(vrna_md_t *md, const char *ns_bases){
+
+  const char    *c;
+  unsigned int  n;
+  int           i, sym;
+
+  if(md){
+    if(ns_bases){
+      n = strlen(ns_bases);
+      if(n < 33){ /* parse the ns_bases list */
+        c = ns_bases;
+        i = sym = 0;
+        if(*c == '-'){
+          sym=1;
+          c++;
+        }
+
+        while(*c != '\0'){
+          if(*c != ','){
+            md->nonstandards[i++] = *c++;
+            md->nonstandards[i++] = *c;
+            if((sym) && (*c != *(c-1))){
+              md->nonstandards[i++] = *c;
+              md->nonstandards[i++] = *(c-1);
+            }
+          }
+          c++;
+        }
+        md->nonstandards[i] = '\0';
+
+#ifdef  VRNA_BACKWARD_COMPAT
+        free(nonstandards);
+        nonstandards = vrna_alloc(33);
+        memcpy(nonstandards, &(md->nonstandards[0]), 33*sizeof(char));
+#endif
+      } else {
+        vrna_message_warning("vrna_md_set_nonstandards: list too long, dropping nonstandards!");
+      }
+    } else { /* remove nonstandards */
+      md->nonstandards[0] = '\0';
+#ifdef  VRNA_BACKWARD_COMPAT
+      free(nonstandards);
+      nonstandards = NULL;
+#endif
+    }
+
+    /* update pair/rtype/alias arrays accordingly */
+    vrna_md_update(md);
+  }
+}
+
+PUBLIC void
+vrna_md_defaults_reset(vrna_md_t *md_p){
+
+  int i = 0;
+
+  /* first, reset to factory defaults */
+  defaults.dangles           = VRNA_MODEL_DEFAULT_DANGLES;
+  defaults.special_hp        = VRNA_MODEL_DEFAULT_SPECIAL_HP;
+  defaults.noLP              = VRNA_MODEL_DEFAULT_NO_LP;
+  defaults.noGU              = VRNA_MODEL_DEFAULT_NO_GU;
+  defaults.noGUclosure       = VRNA_MODEL_DEFAULT_NO_GU_CLOSURE;
+  defaults.logML             = VRNA_MODEL_DEFAULT_LOG_ML;
+  defaults.gquad             = VRNA_MODEL_DEFAULT_GQUAD;
+  defaults.canonicalBPonly   = VRNA_MODEL_DEFAULT_CANONICAL_BP;
+  defaults.circ              = VRNA_MODEL_DEFAULT_CIRC;
+  defaults.uniq_ML           = VRNA_MODEL_DEFAULT_UNIQ_ML;
+  defaults.compute_bpp       = VRNA_MODEL_DEFAULT_COMPUTE_BPP;
+  defaults.backtrack         = VRNA_MODEL_DEFAULT_BACKTRACK;
+  defaults.backtrack_type    = VRNA_MODEL_DEFAULT_BACKTRACK_TYPE;
+  defaults.energy_set        = VRNA_MODEL_DEFAULT_ENERGY_SET;
+  defaults.max_bp_span       = VRNA_MODEL_DEFAULT_MAX_BP_SPAN;
+  defaults.min_loop_size     = TURN;
+  defaults.window_size       = VRNA_MODEL_DEFAULT_WINDOW_SIZE;
+  defaults.oldAliEn          = VRNA_MODEL_DEFAULT_ALI_OLD_EN;
+  defaults.ribo              = VRNA_MODEL_DEFAULT_ALI_RIBO;
+  defaults.cv_fact           = VRNA_MODEL_DEFAULT_ALI_CV_FACT;
+  defaults.nc_fact           = VRNA_MODEL_DEFAULT_ALI_NC_FACT;
+  defaults.temperature       = VRNA_MODEL_DEFAULT_TEMPERATURE;
+  defaults.betaScale         = VRNA_MODEL_DEFAULT_BETA_SCALE;
+  defaults.sfact             = 1.07;
+  defaults.nonstandards[0]   = '\0';
+
+  if(md_p){ /* now try to apply user settings */
+    /*
+        Note that we use wrapper functions here instead of
+        faster direct memory copy because we want to ensure
+        that model settings always comply to the constraints
+        we set in the wrappers
+    */
+    vrna_md_defaults_dangles(md_p->dangles);
+    vrna_md_defaults_special_hp(md_p->special_hp);
+    vrna_md_defaults_noLP(md_p->noLP);
+    vrna_md_defaults_noGU(md_p->noGU);
+    vrna_md_defaults_noGUclosure(md_p->noGUclosure);
+    vrna_md_defaults_logML(md_p->logML);
+    vrna_md_defaults_gquad(md_p->gquad);
+    defaults.canonicalBPonly = md_p->canonicalBPonly;
+    vrna_md_defaults_circ(md_p->circ);
+    vrna_md_defaults_uniq_ML(md_p->uniq_ML);
+    vrna_md_defaults_compute_bpp(md_p->compute_bpp);
+    vrna_md_defaults_backtrack(md_p->backtrack);
+    vrna_md_defaults_backtrack_type(md_p->backtrack_type);
+    vrna_md_defaults_energy_set(md_p->energy_set);
+    vrna_md_defaults_max_bp_span(md_p->max_bp_span);
+    vrna_md_defaults_min_loop_size(md_p->min_loop_size);
+    vrna_md_defaults_window_size(md_p->window_size);
+    vrna_md_defaults_oldAliEn(md_p->oldAliEn);
+    vrna_md_defaults_ribo(md_p->ribo);
+    vrna_md_defaults_cv_fact(md_p->cv_fact);
+    vrna_md_defaults_nc_fact(md_p->nc_fact);
+    vrna_md_defaults_temperature(md_p->temperature);
+    vrna_md_defaults_betaScale(md_p->betaScale);
+    vrna_md_defaults_sfact(md_p->sfact);
+    copy_nonstandards(&defaults, &(md_p->nonstandards[0]));
+  }
+
+  /* update pair/rtype/alias arrays accordingly */
+  vrna_md_update(&defaults);
+
+#ifdef  VRNA_BACKWARD_COMPAT
+  temperature     = defaults.temperature;
+  pf_scale        = VRNA_MODEL_DEFAULT_PF_SCALE;
+  dangles         = defaults.dangles;
+  tetra_loop      = defaults.special_hp;
+  noLonelyPairs   = defaults.noLP;
+  noGU            = defaults.noGU;
+  no_closingGU    = defaults.noGUclosure;
+  circ            = defaults.circ;
+  gquad           = defaults.gquad;
+  canonicalBPonly = defaults.canonicalBPonly;
+  uniq_ML         = defaults.uniq_ML;
+  energy_set      = defaults.energy_set;
+  do_backtrack    = defaults.compute_bpp;
+  backtrack_type  = defaults.backtrack_type;
+  nonstandards    = defaults.nonstandards;
+  max_bp_span     = defaults.max_bp_span;
+  oldAliEn        = defaults.oldAliEn;
+  ribo            = defaults.ribo;
+  cv_fact         = defaults.cv_fact;
+  nc_fact         = defaults.nc_fact;
+  logML           = defaults.logML;
+#endif
+}
+
+/* below are the setter functions for global default settings */
+
+PUBLIC void
+vrna_md_defaults_temperature(double T){
+
+  if(T >= -K0){
+    defaults.temperature = T;
+#ifdef VRNA_BACKWARD_COMPAT
+    temperature = T;
+#endif
+  } else
+    vrna_message_warning("vrna_md_defaults_temperature@model.c: Temperature out of range, T must be above absolute zero. Not changing anything!");
+}
+
+PUBLIC double
+vrna_md_defaults_temperature_get(void){
+
+  return defaults.temperature;
+}
+
+PUBLIC void
+vrna_md_defaults_betaScale(double b){
+
+  defaults.betaScale = b;
+}
+
+PUBLIC double
+vrna_md_defaults_betaScale_get(void){
+
+  return defaults.betaScale;
+}
+
+PUBLIC void
+vrna_md_defaults_dangles(int d){
+  if((d >= 0) && (d <= 3)){
+    defaults.dangles = d;
+#ifdef VRNA_BACKWARD_COMPAT
+    dangles = d;
+#endif
+  } else
+    vrna_message_warning("vrna_md_defaults_dangles@model.c: Dangles out of range, must be (0 <= d <= 3). Not changing anything!");
+}
+
+PUBLIC int
+vrna_md_defaults_dangles_get(void){
+
+  return defaults.dangles;
+}
+
+PUBLIC void
+vrna_md_defaults_special_hp(int flag){
+
+  defaults.special_hp = flag ? 1 : 0;
+#ifdef VRNA_BACKWARD_COMPAT
+  tetra_loop = defaults.special_hp;
+#endif
+}
+
+PUBLIC int
+vrna_md_defaults_special_hp_get(void){
+
+  return defaults.special_hp;
+}
+
+PUBLIC void
+vrna_md_defaults_noLP(int flag){
+
+  defaults.noLP = flag ? 1 : 0;
+#ifdef VRNA_BACKWARD_COMPAT
+  noLonelyPairs = defaults.noLP;
+#endif
+}
+
+PUBLIC int
+vrna_md_defaults_noLP_get(void){
+
+  return defaults.noLP;
+}
+
+PUBLIC void
+vrna_md_defaults_noGU(int flag){
+
+  defaults.noGU = flag ? 1 : 0;
+#ifdef VRNA_BACKWARD_COMPAT
+  noGU = defaults.noGU;
+#endif
+  /* update pair/rtype/alias arrays accordingly */
+  vrna_md_update(&defaults);
+}
+
+PUBLIC int
+vrna_md_defaults_noGU_get(void){
+
+  return defaults.noGU;
+}
+
+PUBLIC void
+vrna_md_defaults_noGUclosure(int flag){
+
+  defaults.noGUclosure = flag ? 1 : 0;
+#ifdef VRNA_BACKWARD_COMPAT
+  no_closingGU = defaults.noGUclosure;
+#endif
+}
+
+PUBLIC int
+vrna_md_defaults_noGUclosure_get(void){
+
+  return defaults.noGUclosure;
+}
+
+PUBLIC void
+vrna_md_defaults_logML(int flag){
+
+  defaults.logML = flag ? 1 : 0;
+#ifdef VRNA_BACKWARD_COMPAT
+  logML = defaults.logML;
+#endif
+}
+
+PUBLIC int
+vrna_md_defaults_logML_get(void){
+
+  return defaults.logML;
+}
+
+PUBLIC void
+vrna_md_defaults_circ(int flag){
+
+  defaults.circ = flag ? 1 : 0;
+#ifdef VRNA_BACKWARD_COMPAT
+  circ = defaults.circ;
+#endif
+}
+
+PUBLIC int
+vrna_md_defaults_circ_get(void){
+
+  return defaults.circ;
+}
+
+PUBLIC void
+vrna_md_defaults_gquad(int flag){
+
+  defaults.gquad = flag ? 1 : 0;
+#ifdef VRNA_BACKWARD_COMPAT
+  gquad = defaults.gquad;
+#endif
+}
+
+PUBLIC int
+vrna_md_defaults_gquad_get(void){
+
+  return defaults.gquad;
+}
+
+PUBLIC void
+vrna_md_defaults_uniq_ML(int flag){
+
+  defaults.uniq_ML = flag ? 1 : 0;
+#ifdef VRNA_BACKWARD_COMPAT
+  uniq_ML = defaults.uniq_ML;
+#endif
+}
+
+PUBLIC int
+vrna_md_defaults_uniq_ML_get(void){
+
+  return defaults.uniq_ML;
+}
+
+PUBLIC void
+vrna_md_defaults_energy_set(int e){
+
+  if((e >= 0) && (e <= 3)){
+    defaults.energy_set = e;
+#ifdef VRNA_BACKWARD_COMPAT
+    energy_set = e;
+#endif
+    /* update pair/rtype/alias arrays accordingly */
+    vrna_md_update(&defaults);
+  } else
+    vrna_message_warning("vrna_md_defaults_energy_set@model.c: Energy Set out of range, must be (0 <= e <= 3). Not changing anything!");
+}
+
+PUBLIC int
+vrna_md_defaults_energy_set_get(void){
+
+  return defaults.energy_set;
+}
+
+PUBLIC void
+vrna_md_defaults_backtrack(int flag){
+
+  defaults.backtrack = flag ? 1 : 0;
+}
+
+PUBLIC int
+vrna_md_defaults_backtrack_get(void){
+
+  return defaults.backtrack;
+}
+
+PUBLIC void
+vrna_md_defaults_backtrack_type(char t){
+
+  switch(t){
+    case 'M': /* fall through */
+    case 'C': /* fall through */
+    case 'F': defaults.backtrack_type = t;
+#ifdef VRNA_BACKWARD_COMPAT
+              backtrack_type = t;
+#endif
+              break;
+    default:  vrna_message_warning("vrna_md_defaults_backtrack_type@model.c: Backtrack type must be any of 'F', 'C', or 'M'. Not changing anything!");
+  }
+}
+
+PUBLIC char
+vrna_md_defaults_backtrack_type_get(void){
+
+  return defaults.backtrack_type;
+}
+
+PUBLIC void
+vrna_md_defaults_compute_bpp(int flag){
+
+  if((flag >= 0) && (flag <= 2)){
+    defaults.compute_bpp = flag;
+#ifdef VRNA_BACKWARD_COMPAT
+    do_backtrack = flag;
+#endif
+  } else
+    defaults.compute_bpp = 1;
+}
+
+PUBLIC int
+vrna_md_defaults_compute_bpp_get(void){
+
+  return defaults.compute_bpp;
+}
+
+PUBLIC void
+vrna_md_defaults_max_bp_span(int span){
+
+  defaults.max_bp_span = (span <= 0) ? -1 : span;
+#ifdef VRNA_BACKWARD_COMPAT
+  max_bp_span = defaults.max_bp_span;
+#endif
+}
+
+PUBLIC int
+vrna_md_defaults_max_bp_span_get(void){
+
+  return defaults.max_bp_span;
+}
+
+PUBLIC void
+vrna_md_defaults_min_loop_size(int size){
+
+  defaults.min_loop_size = (size < 0) ? 0 : size;
+}
+
+PUBLIC int
+vrna_md_defaults_min_loop_size_get(void){
+
+  return defaults.min_loop_size;
+}
+
+PUBLIC void
+vrna_md_defaults_window_size(int size){
+
+  defaults.window_size = (size <= 0) ? -1 : size;
+}
+
+PUBLIC int
+vrna_md_defaults_window_size_get(void){
+
+  return defaults.window_size;
+}
+
+PUBLIC void
+vrna_md_defaults_oldAliEn(int flag){
+
+  defaults.oldAliEn = flag ? 1 : 0;
+#ifdef VRNA_BACKWARD_COMPAT
+  oldAliEn = defaults.oldAliEn;
+#endif
+}
+
+PUBLIC int
+vrna_md_defaults_oldAliEn_get(void){
+
+  return defaults.oldAliEn;
+}
+
+PUBLIC void
+vrna_md_defaults_ribo(int flag){
+
+  defaults.ribo = flag ? 1 : 0;
+#ifdef VRNA_BACKWARD_COMPAT
+  ribo = defaults.ribo;
+#endif
+}
+
+PUBLIC int
+vrna_md_defaults_ribo_get(void){
+
+  return defaults.ribo;
+}
+
+PUBLIC void
+vrna_md_defaults_cv_fact(double factor){
+
+  defaults.cv_fact = factor;
+#ifdef VRNA_BACKWARD_COMPAT
+  cv_fact = factor;
+#endif
+}
+
+PUBLIC double
+vrna_md_defaults_cv_fact_get(void){
+
+  return defaults.cv_fact;
+}
+
+PUBLIC void
+vrna_md_defaults_nc_fact(double factor){
+
+  defaults.nc_fact = factor;
+#ifdef VRNA_BACKWARD_COMPAT
+  nc_fact = factor;
+#endif
+}
+
+PUBLIC double
+vrna_md_defaults_nc_fact_get(void){
+
+  return defaults.nc_fact;
+}
+
+PUBLIC void
+vrna_md_defaults_sfact(double factor){
+
+  defaults.sfact = factor;
+}
+
+PUBLIC double
+vrna_md_defaults_sfact_get(void){
+
+  return defaults.sfact;
+}
+
+
+PUBLIC void
+vrna_md_update(vrna_md_t *md){
+
+  if(md)
+    fill_pair_matrices(md);
+}
+
+
+/*
+    This function updates the pair/alias/rtype arrays according to model settings.
+    It should be called whenever there is a change in the following model settings:
+    - energy_set
+    - noGU
+    - nonstandards
+*/
+PRIVATE void
+fill_pair_matrices(vrna_md_t *md){
+
+  int i,j;
+
+  /* nullify everything */
+  for(i = 0;i <= MAXALPHA; i++)
+    memset(md->pair[i], 0, (MAXALPHA + 1) * sizeof(int));
+
+  memset(md->alias, 0, (MAXALPHA + 1) * sizeof(short));
+
+  /* start setting actual base pair type encodings */
+  switch(md->energy_set){
+    case  0:    for(i = 0; i < 5; i++)
+                  md->alias[i] = (short) i;
+
+                md->alias[5] = 3; /* X <-> G */
+                md->alias[6] = 2; /* K <-> C */
+                md->alias[7] = 0; /* I <-> default base '@' */
+
+                for(i = 0; i < NBASES; i++)
+                    for(j = 0; j < NBASES; j++)
+                      md->pair[i][j] = BP_pair[i][j];
+
+                if(md->noGU)
+                  md->pair[3][4] = md->pair[4][3] = 0;
+
+                if(md->nonstandards[0] != '\0') {  /* allow nonstandard bp's (encoded by type=7) */
+                   for(i = 0; i < (int)strlen(md->nonstandards); i += 2)
+                      md->pair[vrna_nucleotide_encode(md->nonstandards[i], md)]
+                        [vrna_nucleotide_encode(md->nonstandards[i+1], md)] = 7;
+                }
+
+                break;
+
+    case 1:     for(i = 1; i < MAXALPHA;){
+                  md->alias[i++] = 3;  /* A <-> G */
+                  md->alias[i++] = 2;  /* B <-> C */
+                }
+                for(i = 1; i < MAXALPHA; i++){
+                  md->pair[i][i+1] = 2;    /* AB <-> GC */
+                  i++;
+                  md->pair[i][i-1] = 1;    /* BA <-> CG */
+                }
+
+                break;
+
+    case 2:     for(i = 1; i < MAXALPHA;){
+                  md->alias[i++] = 1;  /* A <-> A*/
+                  md->alias[i++] = 4;  /* B <-> U */
+                }
+                for(i = 1; i < MAXALPHA; i++){
+                  md->pair[i][i+1] = 5;    /* AB <-> AU */
+                  i++;
+                  md->pair[i][i-1] = 6;    /* BA <-> UA */
+                }
+
+                break;
+
+    case 3:     for(i = 1; i < MAXALPHA - 2; ){
+                  md->alias[i++] = 3;  /* A <-> G */
+                  md->alias[i++] = 2;  /* B <-> C */
+                  md->alias[i++] = 1;  /* C <-> A */
+                  md->alias[i++] = 4;  /* D <-> U */
+                }
+                for(i = 1; i < MAXALPHA - 2; i++){
+                  md->pair[i][i+1] = 2;    /* AB <-> GC */
+                  i++;
+                  md->pair[i][i-1] = 1;    /* BA <-> CG */
+                  i++;
+                  md->pair[i][i+1] = 5;    /* CD <-> AU */
+                  i++;
+                  md->pair[i][i-1] = 6;    /* DC <-> UA */
+                }
+
+                break;
+
+    default:    vrna_message_error("Which energy_set are YOU using??");
+                break;
+  }
+
+  /* set the reverse base pair types */
+  for(i = 0; i <= MAXALPHA; i++){
+    for(j = 0; j <= MAXALPHA; j++){
+      md->rtype[md->pair[i][j]] = md->pair[j][i];
+    }
+  }
+
+  /* handle special cases separately */
+  md->rtype[0] = 0;
+  md->rtype[7] = 7;
+
+  /* was used for energy_set == 0
+  for(i = 0; i < NBASES; i++)
+      for(j = 0; j < NBASES; j++)
+       md->rtype[md->pair[i][j]] = md->pair[j][i];
+  */
+}
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC void
+set_model_details(vrna_md_t *md){
+
+  if(md){
+    /* make sure there are no uninitialized data fields */
+    memset(md, 0, sizeof(vrna_md_t));
+
+    md->dangles           = dangles;
+    md->special_hp        = tetra_loop;
+    md->noLP              = noLonelyPairs;
+    md->noGU              = noGU;
+    md->noGUclosure       = no_closingGU;
+    md->logML             = logML;
+    md->gquad             = gquad;
+    md->canonicalBPonly   = canonicalBPonly;
+    md->circ              = circ;
+    md->uniq_ML           = uniq_ML;
+    md->compute_bpp       = do_backtrack;
+    md->backtrack         = VRNA_MODEL_DEFAULT_BACKTRACK;
+    md->backtrack_type    = backtrack_type;
+    md->energy_set        = energy_set;
+    md->max_bp_span       = max_bp_span;
+    md->min_loop_size     = TURN;
+    md->window_size       = VRNA_MODEL_DEFAULT_WINDOW_SIZE;
+    md->oldAliEn          = oldAliEn;
+    md->ribo              = ribo;
+    md->cv_fact           = cv_fact;
+    md->nc_fact           = nc_fact;
+    md->temperature       = temperature;
+    md->betaScale         = VRNA_MODEL_DEFAULT_BETA_SCALE;
+    md->sfact             = 1.07;
+
+    if (nonstandards)
+      copy_nonstandards(md, nonstandards);
+
+    /* set default values for the pair/rtype[pair] stuff */
+    vrna_md_update(md);
+
+  }
+}
+
+
+PUBLIC char *
+option_string(void){
+
+  vrna_md_t md;
+  set_model_details(&md);
+
+  return vrna_md_option_string(&md);
+}
+
+
+#endif
+
+
diff --git a/C/ViennaRNA/model.h b/C/ViennaRNA/model.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/model.h
@@ -0,0 +1,879 @@
+#ifndef VIENNA_RNA_PACKAGE_MODEL_H
+#define VIENNA_RNA_PACKAGE_MODEL_H
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file     model.h
+ *  @ingroup  model_details
+ *  @brief    The model details data structure and its corresponding modifiers
+ */
+
+/**
+ *  @{
+ *  @ingroup   model_details
+ */
+
+#ifndef NBASES
+#define NBASES 8
+#endif
+
+/** @brief Typename for the model details data structure #vrna_md_s */
+typedef struct vrna_md_s  vrna_md_t;
+
+/**
+ *  @brief
+ *  @htmlonly Default temperature for structure prediction and free energy evaluation in &#176C @endhtmlonly
+ *  @latexonly Default temperature for structure prediction and free energy evaluation in $^\circ C$ @endlatexonly
+ *  @see  #vrna_md_t.temperature, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_TEMPERATURE    37.0
+
+/**
+ *  @brief  Default scaling factor for partition function computations
+ *  @see  #vrna_exp_param_t.pf_scale, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_PF_SCALE       -1
+
+/**
+ *  @brief  Default scaling factor for absolute thermodynamic temperature in Boltzmann factors
+ *  @see    #vrna_exp_param_t.alpha, #vrna_md_t.betaScale, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_BETA_SCALE     1.
+
+/** @brief  Default dangling end model
+ *  @see  #vrna_md_t.dangles, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_DANGLES        2
+
+/**
+ *  @brief  Default model behavior for lookup of special tri-, tetra-, and hexa-loops
+ *  @see    #vrna_md_t.special_hp, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_SPECIAL_HP     1
+
+/**
+ *  @brief  Default model behavior for so-called 'lonely pairs'
+ *  @see    #vrna_md_t.noLP, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_NO_LP          0
+
+/**
+ *  @brief  Default model behavior for G-U base pairs
+ *  @see    #vrna_md_t.noGU, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_NO_GU          0
+
+/**
+ *  @brief  Default model behavior for G-U base pairs closing a loop
+ *  @see    #vrna_md_t.noGUclosure, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_NO_GU_CLOSURE  0
+
+/**
+ *  @brief  Default model behavior to treat a molecule as a circular RNA (DNA)
+ *  @see    #vrna_md_t.circ, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_CIRC           0
+
+/**
+ *  @brief  Default model behavior regarding the treatment of G-Quadruplexes
+ *  @see    #vrna_md_t.gquad, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_GQUAD          0
+
+#define VRNA_MODEL_DEFAULT_CANONICAL_BP   0
+
+/**
+ *  @brief  Default behavior of the model regarding unique multi-branch loop decomposition
+ *  @see    #vrna_md_t.uniq_ML, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_UNIQ_ML        0
+
+/**
+ *  @brief  Default model behavior on which energy set to use
+ *  @see    #vrna_md_t.energy_set, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_ENERGY_SET     0
+
+/**
+ *  @brief  Default model behavior with regards to backtracking of structures
+ *  @see    #vrna_md_t.backtrack, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_BACKTRACK      1
+
+/**
+ *  @brief  Default model behavior on what type of backtracking to perform
+ *  @see    #vrna_md_t.backtrack_type, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_BACKTRACK_TYPE 'F'
+
+/**
+ *  @brief  Default model behavior with regards to computing base pair probabilities
+ *  @see    #vrna_md_t.compute_bpp, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_COMPUTE_BPP    1
+
+/**
+ *  @brief  Default model behavior for the allowed maximum base pair span
+ *  @see    #vrna_md_t.max_bp_span, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_MAX_BP_SPAN    -1
+
+/**
+ *  @brief  Default model behavior for the sliding window approach
+ *  @see    #vrna_md_t.window_size, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_WINDOW_SIZE    -1
+
+/**
+ *  @brief  Default model behavior on how to evaluate the energy contribution of multi-branch loops
+ *  @see    #vrna_md_t.logML, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_LOG_ML         0
+
+/**
+ *  @brief  Default model behavior for consensus structure energy evaluation
+ *  @see    #vrna_md_t.oldAliEn, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_ALI_OLD_EN     0
+
+/**
+ *  @brief  Default model behavior for consensus structure co-variance contribution assessment
+ *  @see    #vrna_md_t.ribo, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_ALI_RIBO       0
+
+/**
+ *  @brief  Default model behavior for weighting the co-variance score in consensus structure prediction
+ *  @see    #vrna_md_t.cv_fact, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_ALI_CV_FACT    1.
+
+/** @brief  Default model behavior for weighting the nucleotide conservation? in consensus structure prediction
+ *  @see    #vrna_md_t.nc_fact, vrna_md_defaults_reset(), vrna_md_set_default()
+ */
+#define VRNA_MODEL_DEFAULT_ALI_NC_FACT    1.
+
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+#ifndef MAXALPHA
+/**
+ *  @brief Maximal length of alphabet
+ */
+#define MAXALPHA              20
+#endif
+
+#endif
+
+/**
+ *  @brief The data structure that contains the complete model details used throughout the calculations
+ *
+ *  For convenience reasons, we provide the type name #vrna_md_t to address this data structure
+ *  without the use of the struct keyword
+ *
+ *  @see  vrna_md_set_default(), set_model_details(), vrna_md_update(), #vrna_md_t
+ *
+ */
+struct vrna_md_s {
+  double  temperature;                  /**<  @brief  The temperature used to scale the thermodynamic parameters */
+  double  betaScale;                    /**<  @brief  A scaling factor for the thermodynamic temperature of the Boltzmann factors */
+  int     dangles;                      /**<  @brief  Specifies the dangle model used in any energy evaluation (0,1,2 or 3)
+
+                                              If set to 0 no stabilizing energies are assigned to bases adjacent to
+                                              helices in free ends and multiloops (so called dangling ends). Normally
+                                              (dangles = 1) dangling end energies are assigned only to unpaired
+                                              bases and a base cannot participate simultaneously in two dangling ends. In
+                                              the partition function algorithm vrna_pf() these checks are neglected.
+                                              To provide comparability between free energy minimization and partition function
+                                              algorithms, the default setting is 2.
+                                              This treatment of dangling ends gives more favorable energies to helices
+                                              directly adjacent to one another, which can be beneficial since such
+                                              helices often do engage in stabilizing interactions through co-axial
+                                              stacking.\n
+                                              If set to 3 co-axial stacking is explicitly included for
+                                              adjacent helices in multiloops. The option affects only mfe folding
+                                              and energy evaluation (vrna_mfe() and vrna_eval_structure()), as
+                                              well as suboptimal folding (vrna_subopt()) via re-evaluation of energies.
+                                              Co-axial stacking with one intervening mismatch is not considered so far.
+                                              @note   Some function do not implement all dangle model but only a subset of
+                                                      (0,1,2,3). In particular, partition function algorithms can only handle
+                                                      0 and 2. Read the documentation of the particular recurrences or
+                                                      energy evaluation function for information about the provided dangle
+                                                      model.
+                                        */
+  int     special_hp;                   /**<  @brief  Include special hairpin contributions for tri, tetra and hexaloops */
+  int     noLP;                         /**<  @brief  Only consider canonical structures, i.e. no 'lonely' base pairs */
+  int     noGU;                         /**<  @brief  Do not allow GU pairs */
+  int     noGUclosure;                  /**<  @brief  Do not allow loops to be closed by GU pair */
+  int     logML;                        /**<  @brief  Use logarithmic scaling for multiloops */
+  int     circ;                         /**<  @brief  Assume RNA to be circular instead of linear */
+  int     gquad;                        /**<  @brief  Include G-quadruplexes in structure prediction */
+  int     canonicalBPonly;              /**<  @brief  remove non-canonical bp's from constraint structures  */
+  int     uniq_ML;                      /**<  @brief  Flag to ensure unique multi-branch loop decomposition during folding */
+  int     energy_set;                   /**<  @brief  Specifies the energy set that defines set of compatible base pairs */
+  int     backtrack;                    /**<  @brief  Specifies whether or not secondary structures should be backtraced */
+  char    backtrack_type;               /**<  @brief  Specifies in which matrix to backtrack */
+  int     compute_bpp;                  /**<  @brief  Specifies whether or not backward recursions for base pair probability (bpp) computation will be performed */
+  char    nonstandards[64];             /**<  @brief  contains allowed non standard bases */
+  int     max_bp_span;                  /**<  @brief  maximum allowed base pair span */
+
+  int     min_loop_size;                /**<  @brief  Minimum size of hairpin loops
+                                              @note The default value for this field is #TURN, however, it may
+                                              be 0 in cofolding context.
+                                        */
+  int     window_size;                  /**<  @brief  Size of the sliding window for locally optimal structure prediction */
+  int     oldAliEn;                     /**<  @brief  Use old alifold energy model */
+  int     ribo;                         /**<  @brief  Use ribosum scoring table in alifold energy model */
+  double  cv_fact;                      /**<  @brief  Co-variance scaling factor for consensus structure prediction */
+  double  nc_fact;                      /**<  @brief  Scaling factor to weight co-variance contributions of non-canonical pairs */
+  double  sfact;                        /**<  @brief  Scaling factor for partition function scaling */
+  int     rtype[8];                     /**<  @brief  Reverse base pair type array */
+  short   alias[MAXALPHA+1];            /**<  @brief  alias of an integer nucleotide representation */
+  int     pair[MAXALPHA+1][MAXALPHA+1]; /**<  @brief  Integer representation of a base pair */
+};
+
+
+/**
+ * @brief Apply default model details to a provided #vrna_md_t data structure
+ *
+ *  Use this function to initialize a #vrna_md_t data structure with
+ *  its default values
+ *
+ *  @param md A pointer to the data structure that is about to be initialized
+ */
+void
+vrna_md_set_default(vrna_md_t *md);
+
+/**
+ *  @brief Update the model details data structure
+ *
+ *  This function should be called after changing the vrna_md_t.energy_set attribute
+ *  since it re-initializes base pairing related arrays within the #vrna_md_t data
+ *  structure. In particular, #vrna_md_t.pair, #vrna_md_t.alias, and #vrna_md_t.rtype
+ *  are set to the values that correspond to the specified #vrna_md_t.energy_set
+ *  option
+ *
+ *  @see  #vrna_md_t, #vrna_md_t.energy_set, #vrna_md_t.pair, #vrna_md_t.rtype,
+ *        #vrna_md_t.alias, vrna_md_set_default()
+ */
+void
+vrna_md_update(vrna_md_t *md);
+
+/**
+ *  @brief Copy/Clone a #vrna_md_t model
+ *
+ *  Use this function to clone a given model either inplace (target container @p md_to
+ *  given) or create a copy by cloning the source model and returning it (@p md_to == NULL).
+ *
+ *  @param md_to    The model to be overwritten (if non-NULL and @p md_to != @p md_from)
+ *  @param md_from  The model to copy (if non-NULL)
+ *  @return         A pointer to the copy model (or NULL if @p md_from == NULL)
+ */
+vrna_md_t *
+vrna_md_copy( vrna_md_t       *md_to,
+              const vrna_md_t *md_from);
+
+/**
+ *  @brief  Get a corresponding commandline parameter string of the options in a #vrna_md_t
+ *
+ *  @note This function is not threadsafe!
+ */
+char *
+vrna_md_option_string(vrna_md_t  *md);
+
+void
+vrna_md_set_nonstandards(vrna_md_t *md, const char *ns_bases);
+
+/**
+ *  @brief  Reset the global default model details to a specific set of parameters, or their initial values
+ *
+ *  This function resets the global default model details to their initial values,
+ *  i.e. as specified by the ViennaRNA Package release, upon passing NULL as argument.
+ *  Alternatively it resets them according to a set of provided parameters.
+ *
+ *  @note The global default parameters affect all function calls of RNAlib where
+ *        model details are not explicitly provided. Hence, any change of them
+ *        is not considered threadsafe
+ *  @warning  This function first resets the global default settings to factory
+ *            defaults, and only then applies user provided settings (if any).
+ *            User settings that do not meet specifications are skipped.
+ *  @see  vrna_md_set_default(), #vrna_md_t
+ *
+ *  @param md_p A set of model details to use as global default (if NULL is passed, factory defaults are restored)
+ */
+void
+vrna_md_defaults_reset(vrna_md_t *md_p);
+
+/**
+ *  @brief  Set default temperature for energy evaluation of loops
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_TEMPERATURE
+ *  @param T  Temperature in centigrade
+ */
+void
+vrna_md_defaults_temperature(double T);
+
+/**
+ *  @brief  Get default temperature for energy evaluation of loops
+ *  @see vrna_md_defaults_temperature(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_TEMPERATURE
+ *  @return  The global default settings for temperature in centigrade
+ */
+double
+vrna_md_defaults_temperature_get(void);
+
+/**
+ *  @brief  Set default scaling factor of thermodynamic temperature in Boltzmann factors
+ *
+ *  Bolzmann factors are then computed as @f$ exp(-E / (b \cdot kT))@f$.
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BETA_SCALE
+ *  @param b  The scaling factor, default is 1.0
+ */
+void
+vrna_md_defaults_betaScale(double b);
+
+/**
+ *  @brief  Get default scaling factor of thermodynamic temperature in Boltzmann factors
+ *
+ *  @see vrna_md_defaults_betaScale(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BETA_SCALE
+ *  @return  The global default thermodynamic temperature scaling factor
+ */
+double
+vrna_md_defaults_betaScale_get(void);
+
+/**
+ *  @brief  Set default dangle model for structure prediction
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_DANGLES
+ *  @param d  The dangle model
+ */
+void
+vrna_md_defaults_dangles(int d);
+
+/**
+ *  @brief  Get default dangle model for structure prediction
+ *  @see vrna_md_defaults_dangles(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_DANGLES
+ *  @return The global default settings for the dangle model
+ */
+int
+vrna_md_defaults_dangles_get(void);
+
+/**
+ *  @brief  Set default behavior for lookup of tabulated free energies for special hairpin loops, such as Tri-, Tetra-, or Hexa-loops.
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_SPECIAL_HP
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_special_hp(int flag);
+
+/**
+ *  @brief  Get default behavior for lookup of tabulated free energies for special hairpin loops, such as Tri-, Tetra-, or Hexa-loops.
+ *  @see vrna_md_defaults_special_hp(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_SPECIAL_HP
+ *  @return  The global default settings for the treatment of special hairpin loops
+ */
+int
+vrna_md_defaults_special_hp_get(void);
+
+/**
+ *  @brief  Set default behavior for prediction of canonical secondary structures
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_LP
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_noLP(int flag);
+
+/**
+ *  @brief  Get default behavior for prediction of canonical secondary structures
+ *  @see vrna_md_defaults_noLP(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_LP
+ *  @return  The global default settings for predicting canonical secondary structures
+ */
+int
+vrna_md_defaults_noLP_get(void);
+
+/**
+ *  @brief  Set default behavior for treatment of G-U wobble pairs
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_GU
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_noGU(int flag);
+
+/**
+ *  @brief  Get default behavior for treatment of G-U wobble pairs
+ *  @see vrna_md_defaults_noGU(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_GU
+ *  @return The global default settings for treatment of G-U wobble pairs
+ */
+int
+vrna_md_defaults_noGU_get(void);
+
+/**
+ *  @brief  Set default behavior for G-U pairs as closing pair for loops
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_GU_CLOSURE
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_noGUclosure(int flag);
+
+/**
+ *  @brief  Get default behavior for G-U pairs as closing pair for loops
+ *  @see vrna_md_defaults_noGUclosure(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_NO_GU_CLOSURE
+ *  @return The global default settings for treatment of G-U pairs closing a loop
+ */
+int
+vrna_md_defaults_noGUclosure_get(void);
+
+/**
+ *  @brief  Set default behavior recomputing free energies of multi-branch loops using a logarithmic model
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_LOG_ML
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_logML(int flag);
+
+/**
+ *  @brief  Get default behavior recomputing free energies of multi-branch loops using a logarithmic model
+ *  @see vrna_md_defaults_logML(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_LOG_ML
+ *  @return The global default settings for logarithmic model in multi-branch loop free energy evaluation
+ */
+int
+vrna_md_defaults_logML_get(void);
+
+/**
+ *  @brief  Set default behavior whether input sequences are circularized
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_CIRC
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_circ(int flag);
+
+/**
+ *  @brief  Get default behavior whether input sequences are circularized
+ *  @see vrna_md_defaults_circ(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_CIRC
+ *  @return The global default settings for treating input sequences as circular
+ */
+int
+vrna_md_defaults_circ_get(void);
+
+/**
+ *  @brief  Set default behavior for treatment of G-Quadruplexes
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_GQUAD
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_gquad(int flag);
+
+/**
+ *  @brief  Get default behavior for treatment of G-Quadruplexes
+ *  @see vrna_md_defaults_gquad(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_GQUAD
+ *  @return The global default settings for treatment of G-Quadruplexes
+ */
+int
+vrna_md_defaults_gquad_get(void);
+
+/**
+ *  @brief  Set default behavior for creating additional matrix for unique multi-branch loop prediction
+ *  @note   Activating this option usually results in higher memory consumption!
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_UNIQ_ML
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_uniq_ML(int flag);
+
+/**
+ *  @brief  Get default behavior for creating additional matrix for unique multi-branch loop prediction
+ *  @see vrna_md_defaults_uniq_ML(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_UNIQ_ML
+ *  @return The global default settings for creating additional matrices for unique multi-branch loop prediction
+ */
+int
+vrna_md_defaults_uniq_ML_get(void);
+
+/**
+ *  @brief  Set default energy set
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ENERGY_SET
+ *  @param  e   Energy set (0, 1, 2, 3)
+ */
+void
+vrna_md_defaults_energy_set(int e);
+
+/**
+ *  @brief  Get default energy set
+ *  @see vrna_md_defaults_energy_set(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ENERGY_SET
+ *  @return The global default settings for the energy set
+ */
+int
+vrna_md_defaults_energy_set_get(void);
+
+/**
+ *  @brief  Set default behavior for whether to backtrack secondary structures
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BACKTRACK
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_backtrack(int flag);
+
+/**
+ *  @brief  Get default behavior for whether to backtrack secondary structures
+ *  @see vrna_md_defaults_backtrack(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BACKTRACK
+ *  @return The global default settings for backtracking structures
+ */
+int
+vrna_md_defaults_backtrack_get(void);
+
+/**
+ *  @brief  Set default backtrack type, i.e. which DP matrix is used
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BACKTRACK_TYPE
+ *  @param  t   The type ('F', 'C', or 'M')
+ */
+void
+vrna_md_defaults_backtrack_type(char t);
+
+/**
+ *  @brief  Get default backtrack type, i.e. which DP matrix is used
+ *  @see vrna_md_defaults_backtrack_type(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_BACKTRACK_TYPE
+ *  @return The global default settings that specify which DP matrix is used for backtracking
+ */
+char
+vrna_md_defaults_backtrack_type_get(void);
+
+/**
+ *  @brief  Set the default behavior for whether to compute base pair probabilities after partition function computation
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_COMPUTE_BPP
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_compute_bpp(int flag);
+
+/**
+ *  @brief  Get the default behavior for whether to compute base pair probabilities after partition function computation
+ *  @see vrna_md_defaults_compute_bpp(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_COMPUTE_BPP
+ *  @return The global default settings that specify whether base pair probabilities are computed together with partition function
+ */
+int
+vrna_md_defaults_compute_bpp_get(void);
+
+/**
+ *  @brief  Set default maximal base pair span
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_MAX_BP_SPAN
+ *  @param  span  Maximal base pair span
+ */
+void
+vrna_md_defaults_max_bp_span(int span);
+
+/**
+ *  @brief  Get default maximal base pair span
+ *  @see vrna_md_defaults_max_bp_span(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_MAX_BP_SPAN
+ *  @return The global default settings for maximum base pair span
+ */
+int
+vrna_md_defaults_max_bp_span_get(void);
+
+/**
+ *  @brief  Set default minimal loop size
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #TURN
+ *  @param  size  Minimal size, i.e. number of unpaired nucleotides for a hairpin loop
+ */
+void
+vrna_md_defaults_min_loop_size(int size);
+
+/**
+ *  @brief  Get default minimal loop size
+ *  @see vrna_md_defaults_min_loop_size(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #TURN
+ *  @return The global default settings for minimal size of hairpin loops
+ */
+int
+vrna_md_defaults_min_loop_size_get(void);
+
+/**
+ *  @brief  Set default window size for sliding window structure prediction approaches
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_WINDOW_SIZE
+ *  @param  size  The size of the sliding window
+ */
+void
+vrna_md_defaults_window_size(int size);
+
+/**
+ *  @brief  Get default window size for sliding window structure prediction approaches
+ *  @see vrna_md_defaults_window_size(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_WINDOW_SIZE
+ *  @return The global default settings for the size of the sliding window
+ */
+int
+vrna_md_defaults_window_size_get(void);
+
+/**
+ *  @brief  Set default behavior for whether to use old energy model for comparative structure prediction
+ *  @note   This option is outdated. Activating the old energy model usually results in worse consensus
+ *          structure predictions.
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_OLD_EN
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_oldAliEn(int flag);
+
+/**
+ *  @brief  Get default behavior for whether to use old energy model for comparative structure prediction
+ *  @see vrna_md_defaults_oldAliEn(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_OLD_EN
+ *  @return The global default settings for using old energy model for comparative structure prediction
+ */
+int
+vrna_md_defaults_oldAliEn_get(void);
+
+/**
+ *  @brief  Set default behavior for whether to use Ribosum Scoring in comparative structure prediction
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_RIBO
+ *  @param  flag  On/Off switch (0 = OFF, else = ON)
+ */
+void
+vrna_md_defaults_ribo(int flag);
+
+/**
+ *  @brief  Get default behavior for whether to use Ribosum Scoring in comparative structure prediction
+ *  @see vrna_md_defaults_ribo(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_RIBO
+ *  @return The global default settings for using Ribosum scoring in comparative structure prediction
+ */
+int
+vrna_md_defaults_ribo_get(void);
+
+/**
+ *  @brief  Set the default co-variance scaling factor used in comparative structure prediction
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_CV_FACT
+ *  @param  factor  The co-variance factor
+ */
+void
+vrna_md_defaults_cv_fact(double factor);
+
+/**
+ *  @brief  Get the default co-variance scaling factor used in comparative structure prediction
+ *  @see vrna_md_defaults_cv_fact(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_CV_FACT
+ *  @return The global default settings for the co-variance factor
+ */
+double
+vrna_md_defaults_cv_fact_get(void);
+
+/**
+ *  @brief
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_NC_FACT
+ *  @param factor
+ */
+void
+vrna_md_defaults_nc_fact(double factor);
+
+/**
+ *  @brief
+ *  @see vrna_md_defaults_nc_fact(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t, #VRNA_MODEL_DEFAULT_ALI_NC_FACT
+ *  @return
+ */
+double
+vrna_md_defaults_nc_fact_get(void);
+
+/**
+ *  @brief  Set the default scaling factor used to avoid under-/overflows in partition function computation
+ *  @see vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t
+ *  @param  factor  The scaling factor  (default: 1.07)
+ */
+void
+vrna_md_defaults_sfact(double factor);
+
+/**
+ *  @brief  Get the default scaling factor used to avoid under-/overflows in partition function computation
+ *  @see vrna_md_defaults_sfact(), vrna_md_defaults_reset(), vrna_md_set_default(), #vrna_md_t
+ *  @return The global default settings of the scaling factor
+ */
+double
+vrna_md_defaults_sfact_get(void);
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+#define model_detailsT        vrna_md_t               /* restore compatibility of struct rename */
+
+/* BEGIN deprecated global variables: */
+
+/**
+ *  @brief Rescale energy parameters to a temperature in degC.
+ * 
+ *  Default is 37C. You have to call the update_..._params() functions after
+ *  changing this parameter.
+ *  @deprecated   Use vrna_md_defaults_temperature(), and vrna_md_defaults_temperature_get()
+ *                to change, and read the global default temperature settings
+ *  @see vrna_md_defaults_temperature(), vrna_md_defaults_temperature_get(), vrna_md_defaults_reset()
+ */
+extern double temperature;
+
+/**
+ *  @brief A scaling factor used by pf_fold() to avoid overflows.
+ * 
+ *  Should be set to approximately @f$exp{((-F/kT)/length)}@f$, where @f$F@f$ is an estimate
+ *  for the ensemble free energy, for example the minimum free energy. You must
+ *  call update_pf_params() after changing this parameter.\n
+ *  If pf_scale is -1 (the default) , an estimate will be provided
+ *  automatically when computing partition functions, e.g. pf_fold()
+ *  The automatic estimate is usually insufficient for sequences more
+ *  than a few hundred bases long.
+ */
+extern double pf_scale;
+
+/**
+ *  @brief Switch the energy model for dangling end contributions (0, 1, 2, 3)
+ * 
+ *  If set to 0 no stabilizing energies are assigned to bases adjacent to
+ *  helices in free ends and multiloops (so called dangling ends). Normally
+ *  (dangles = 1) dangling end energies are assigned only to unpaired
+ *  bases and a base cannot participate simultaneously in two dangling ends. In
+ *  the partition function algorithm pf_fold() these checks are neglected.
+ *  If #dangles is set to 2, all folding routines will follow this convention.
+ *  This treatment of dangling ends gives more favorable energies to helices
+ *  directly adjacent to one another, which can be beneficial since such
+ *  helices often do engage in stabilizing interactions through co-axial
+ *  stacking.\n
+ *  If dangles = 3 co-axial stacking is explicitly included for
+ *  adjacent helices in multiloops. The option affects only mfe folding
+ *  and energy evaluation (fold() and energy_of_structure()), as
+ *  well as suboptimal folding (subopt()) via re-evaluation of energies.
+ *  Co-axial stacking with one intervening mismatch is not considered so far.
+ * 
+ *  Default is 2 in most algorithms, partition function algorithms can only handle 0 and 2
+ */
+extern int  dangles;
+
+/**
+ *  @brief Include special stabilizing energies for some tri-, tetra- and hexa-loops;
+ * 
+ *  default is 1.
+ */
+extern int  tetra_loop;
+
+/**
+ *  @brief Global switch to avoid/allow helices of length 1
+ * 
+ *  Disallow all pairs which can only occur as lonely pairs (i.e. as helix
+ *  of length 1). This avoids lonely base pairs in the predicted structures in
+ *  most cases.
+ */
+extern int    noLonelyPairs;
+
+/**
+ *  @brief Global switch to forbid/allow GU base pairs at all
+ */
+extern int  noGU;
+
+/**
+ *  @brief GU allowed only inside stacks if set to 1
+ */
+extern int  no_closingGU;
+
+/**
+ *  @brief backward compatibility variable.. this does not effect anything
+ */
+extern int  circ;
+
+/**
+ *  @brief Allow G-quadruplex formation
+ */
+extern int gquad;
+
+/**
+ *  Do not use this variable, it will eventually be removed in one of the next versions
+ */
+extern int canonicalBPonly;
+
+/**
+ *  @brief do ML decomposition uniquely (for subopt)
+ */
+extern  int uniq_ML;
+
+/**
+ *  @brief 0 = BP; 1=any with GC; 2=any with AU-parameter
+ * 
+ *  If set to 1 or 2: fold sequences from an artificial alphabet ABCD..., where A
+ *  pairs B, C pairs D, etc. using either GC (1) or AU parameters (2);
+ *  default is 0, you probably don't want to change it.
+ */
+extern int  energy_set;
+
+/**
+ *  @brief do backtracking, i.e. compute secondary structures or base pair probabilities
+ * 
+ *  If 0, do not calculate pair probabilities in pf_fold(); this is about
+ *  twice as fast. Default is 1.
+ */
+extern int    do_backtrack;
+
+/**
+ *  @brief A backtrack array marker for inverse_fold()
+ * 
+ *  If set to 'C': force (1,N) to be paired,
+ *  'M' fold as if the sequence were inside a multiloop. Otherwise ('F') the
+ *  usual mfe structure is computed.
+ */
+extern char backtrack_type;
+
+/**
+ *  @brief contains allowed non standard base pairs
+ * 
+ *  Lists additional base pairs that will be allowed to form in addition to
+ *  GC, CG, AU, UA, GU and UG. Nonstandard base pairs are given a stacking
+ *  energy of 0.
+ */
+extern char *nonstandards;
+
+/**
+ *  @brief Maximum allowed base pair span
+ *
+ *  A value of -1 indicates no restriction for distant base pairs.
+ */
+extern int max_bp_span;
+
+/**
+ *  @brief use old alifold energies (with gaps)
+ */
+extern int oldAliEn;
+
+/**
+ *  @brief use ribosum matrices
+ */
+extern int ribo;            
+
+extern double cv_fact;
+
+extern double nc_fact;
+
+/** @brief if nonzero use logarithmic ML energy in energy_of_struct  */
+extern  int logML;
+
+/* END deprecated global variables: */
+
+/**
+ * @brief Set default model details
+ *
+ *  Use this function if you wish to initialize a #vrna_md_t data structure with
+ *  its default values, i.e. the global model settings as provided by the deprecated
+ *  global variables.
+ *
+ *  @deprecated This function will vanish as soon as backward compatibility of
+ *              RNAlib is dropped (expected in version 3).
+ *              Use vrna_md_set_default() instead!
+ *
+ *  @param md A pointer to the data structure that is about to be initialized
+ */
+void
+set_model_details(vrna_md_t *md);
+
+char *
+option_string(void);
+
+#endif
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/model_avg.inc b/C/ViennaRNA/model_avg.inc
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/model_avg.inc
@@ -0,0 +1,1095 @@
+char* avg_model_string=
+"svm_type nu_svr\n"
+"kernel_type rbf\n"
+"gamma 6\n"
+"nr_class 2\n"
+"total_sv 1087\n"
+"rho 0.107628\n"
+"SV\n"
+"-0.2927223412287951 1:0.2 2:0.2 3:0.4 4:0 \n"
+"-0.2726129259719185 1:0.2 2:0.2 3:0.5 4:0 \n"
+"-0.4429394065483267 1:0.2 2:0.2 3:0.6 4:0 \n"
+"0.3450198571957915 1:0.2 2:0.2 3:0.8 4:0 \n"
+"1 1:0.2 2:0.25 3:0.2 4:0 \n"
+"0.9846600387002246 1:0.2 2:0.25 3:0.5 4:0 \n"
+"0.4361932664094919 1:0.2 2:0.3 3:0.6 4:0 \n"
+"0.08551999173355709 1:0.2 2:0.35 3:0.8 4:0 \n"
+"-0.459481107722125 1:0.2 2:0.45 3:0.5 4:0 \n"
+"-0.1858952118588858 1:0.2 2:0.45 3:0.7 4:0 \n"
+"-0.7957932783829218 1:0.2 2:0.55 3:0.2 4:0 \n"
+"0.201173403457083 1:0.2 2:0.65 3:0.2 4:0 \n"
+"0.8261023125933521 1:0.2 2:0.65 3:0.5 4:0 \n"
+"0.4516612607609173 1:0.2 2:0.7 3:0.4 4:0 \n"
+"-0.2168200098537659 1:0.2 2:0.8 3:0.4 4:0 \n"
+"0.5314932300947524 1:0.2 2:0.8 3:0.8 4:0 \n"
+"0.1894221561591226 1:0.22 2:0.20512821 3:0.18181818 4:0 \n"
+"0.04669279360300833 1:0.22 2:0.25641026 3:0.18181818 4:0 \n"
+"0.05442681853246129 1:0.22 2:0.35897436 3:0.81818182 4:0 \n"
+"0.09890021983512577 1:0.22 2:0.48717949 3:0.54545455 4:0 \n"
+"0.2686554290098279 1:0.22 2:0.48717949 3:0.81818182 4:0 \n"
+"1 1:0.22 2:0.64102564 3:0.18181818 4:0 \n"
+"0.1405848790116045 1:0.22 2:0.69230769 3:0.18181818 4:0 \n"
+"-0.5070959537201287 1:0.22 2:0.79487179 3:0.54545455 4:0 \n"
+"-0.2040998984440571 1:0.22 2:0.79487179 3:0.63636364 4:0 \n"
+"-0.277322771076097 1:0.26 2:0.18918919 3:0.76923077 4:0 \n"
+"-0.5122670878026421 1:0.26 2:0.81081081 3:0.23076923 4:0 \n"
+"-0.003446143251586718 1:0.26 2:0.81081081 3:0.30769231 4:0 \n"
+"-0.006051421981500459 1:0.26 2:0.81081081 3:0.69230769 4:0 \n"
+"-0.01320777229878266 1:0.28 2:0.19444444 3:0.71428571 4:0 \n"
+"-0.4538142175974276 1:0.28 2:0.30555556 3:0.21428571 4:0 \n"
+"0.0140336472877628 1:0.28 2:0.36111111 3:0.21428571 4:0 \n"
+"0.0522868337454891 1:0.28 2:0.36111111 3:0.35714286 4:0 \n"
+"0.1852481060118741 1:0.28 2:0.36111111 3:0.42857143 4:0 \n"
+"-0.4358393994624578 1:0.28 2:0.36111111 3:0.57142857 4:0 \n"
+"-0.2343703447951519 1:0.3 2:0.2 3:0.8 4:0 \n"
+"-0.9597395476970447 1:0.3 2:0.25714286 3:0.26666667 4:0 \n"
+"-0.5480748115196359 1:0.3 2:0.71428571 3:0.8 4:0 \n"
+"-0.1966895021798862 1:0.3 2:0.74285714 3:0.2 4:0 \n"
+"-0.986179782297503 1:0.32 2:0.26470588 3:0.1875 4:0 \n"
+"0.1264535134306515 1:0.32 2:0.44117647 3:0.1875 4:0 \n"
+"1 1:0.32 2:0.44117647 3:0.375 4:0 \n"
+"-0.893806904379465 1:0.32 2:0.5 3:0.4375 4:0 \n"
+"-0.7931835709843101 1:0.32 2:0.58823529 3:0.375 4:0 \n"
+"-0.8163156631224802 1:0.32 2:0.70588235 3:0.375 4:0 \n"
+"-0.003314954359327795 1:0.32 2:0.79411765 3:0.1875 4:0 \n"
+"-0.1456865474887121 1:0.32 2:0.79411765 3:0.8125 4:0 \n"
+"0.5610324283222747 1:0.36 2:0.1875 3:0.55555556 4:0 \n"
+"-0.04161722392425331 1:0.36 2:0.25 3:0.72222222 4:0 \n"
+"-1 1:0.36 2:0.3125 3:0.44444444 4:0 \n"
+"-0.5195901595075548 1:0.36 2:0.40625 3:0.77777778 4:0 \n"
+"0.2275848114312543 1:0.36 2:0.4375 3:0.55555556 4:0 \n"
+"-0.5854291383914952 1:0.36 2:0.65625 3:0.22222222 4:0 \n"
+"0.255909726051372 1:0.36 2:0.75 3:0.38888889 4:0 \n"
+"1 1:0.36 2:0.8125 3:0.38888889 4:0 \n"
+"0.3295257625292804 1:0.38 2:0.19354839 3:0.36842105 4:0 \n"
+"-0.004752910545565455 1:0.38 2:0.29032258 3:0.57894737 4:0 \n"
+"1 1:0.38 2:0.35483871 3:0.31578947 4:0 \n"
+"0.3159226403578163 1:0.38 2:0.48387097 3:0.36842105 4:0 \n"
+"-0.134250099024484 1:0.38 2:0.5483871 3:0.26315789 4:0 \n"
+"0.04990819092532525 1:0.4 2:0.2 3:0.2 4:0 \n"
+"0.04017129911346561 1:0.4 2:0.2 3:0.45 4:0 \n"
+"-0.08021509680003584 1:0.4 2:0.76666667 3:0.8 4:0 \n"
+"0.02158143681261617 1:0.4 2:0.8 3:0.5 4:0 \n"
+"0.3958409337285195 1:0.42 2:0.34482759 3:0.23809524 4:0 \n"
+"0.04041156896377561 1:0.42 2:0.4137931 3:0.28571429 4:0 \n"
+"0.1115032812474313 1:0.42 2:0.4137931 3:0.47619048 4:0 \n"
+"0.2759956991939458 1:0.42 2:0.55172414 3:0.47619048 4:0 \n"
+"-0.07685550118721433 1:0.42 2:0.55172414 3:0.80952381 4:0 \n"
+"-0.01256651815709847 1:0.42 2:0.68965517 3:0.38095238 4:0 \n"
+"0.7207276317326755 1:0.42 2:0.75862069 3:0.23809524 4:0 \n"
+"0.23452088756847 1:0.42 2:0.75862069 3:0.66666667 4:0 \n"
+"0.02788924007552103 1:0.42 2:0.79310345 3:0.61904762 4:0 \n"
+"0.604057819756918 1:0.46 2:0.18518519 3:0.2173913 4:0 \n"
+"0.247380746046661 1:0.46 2:0.18518519 3:0.7826087 4:0 \n"
+"0.08997914831911716 1:0.46 2:0.25925926 3:0.7826087 4:0 \n"
+"0.02932569922822849 1:0.46 2:0.44444444 3:0.34782609 4:0 \n"
+"0.1316585151236409 1:0.46 2:0.59259259 3:0.56521739 4:0 \n"
+"0.1193027227882259 1:0.46 2:0.59259259 3:0.69565217 4:0 \n"
+"0.02072600162046559 1:0.46 2:0.66666667 3:0.47826087 4:0 \n"
+"0.1272669594189013 1:0.46 2:0.7037037 3:0.73913043 4:0 \n"
+"0.2084687245068163 1:0.48 2:0.19230769 3:0.70833333 4:0 \n"
+"0.002138491324302674 1:0.48 2:0.34615385 3:0.58333333 4:0 \n"
+"0.7484445265964226 1:0.48 2:0.5 3:0.45833333 4:0 \n"
+"0.4116408785512746 1:0.48 2:0.65384615 3:0.20833333 4:0 \n"
+"0.02368313464240131 1:0.48 2:0.65384615 3:0.58333333 4:0 \n"
+"0.09027199755744481 1:0.48 2:0.80769231 3:0.58333333 4:0 \n"
+"0.00171413298196679 1:0.5 2:0.2 3:0.64 4:0 \n"
+"1 1:0.5 2:0.32 3:0.72 4:0 \n"
+"0.0227170077507995 1:0.5 2:0.36 3:0.4 4:0 \n"
+"0.7430323769767297 1:0.5 2:0.4 3:0.2 4:0 \n"
+"0.4282042375575376 1:0.5 2:0.44 3:0.72 4:0 \n"
+"0.7656604063598283 1:0.5 2:0.72 3:0.8 4:0 \n"
+"0.2609457667122108 1:0.5 2:0.8 3:0.64 4:0 \n"
+"0.2094594877840361 1:0.52 2:0.20833333 3:0.19230769 4:0 \n"
+"0.05380375239312347 1:0.52 2:0.20833333 3:0.76923077 4:0 \n"
+"-0.4325084912736846 1:0.52 2:0.25 3:0.61538462 4:0 \n"
+"-0.0793380554337809 1:0.52 2:0.33333333 3:0.46153846 4:0 \n"
+"-1 1:0.56 2:0.31818182 3:0.28571429 4:0 \n"
+"0.01668823635096308 1:0.56 2:0.63636364 3:0.35714286 4:0 \n"
+"-0.02738497985877556 1:0.58 2:0.28571429 3:0.48275862 4:0 \n"
+"-0.10680638899594 1:0.58 2:0.28571429 3:0.5862069 4:0 \n"
+"-0.01250723377023471 1:0.58 2:0.57142857 3:0.5862069 4:0 \n"
+"0.1106674059840921 1:0.58 2:0.66666667 3:0.20689655 4:0 \n"
+"-0.1149086920967255 1:0.58 2:0.66666667 3:0.55172414 4:0 \n"
+"-0.2613064173282288 1:0.58 2:0.71428571 3:0.48275862 4:0 \n"
+"-0.9687293441993543 1:0.58 2:0.71428571 3:0.5862069 4:0 \n"
+"-1 1:0.58 2:0.80952381 3:0.4137931 4:0 \n"
+"0.0536759694016334 1:0.6 2:0.2 3:0.36666667 4:0 \n"
+"-0.04285819561466013 1:0.6 2:0.2 3:0.6 4:0 \n"
+"-0.4389684809502345 1:0.6 2:0.25 3:0.4 4:0 \n"
+"-0.1867753580098935 1:0.6 2:0.25 3:0.53333333 4:0 \n"
+"-1 1:0.6 2:0.3 3:0.5 4:0 \n"
+"-1 1:0.6 2:0.35 3:0.53333333 4:0 \n"
+"0.0102195364872924 1:0.6 2:0.45 3:0.2 4:0 \n"
+"-0.1056748551941598 1:0.6 2:0.5 3:0.53333333 4:0 \n"
+"-0.03941368050015077 1:0.6 2:0.7 3:0.36666667 4:0 \n"
+"0.01122846326181984 1:0.62 2:0.21052632 3:0.48387097 4:0 \n"
+"-0.1093764012354553 1:0.62 2:0.31578947 3:0.25806452 4:0 \n"
+"-0.3452523390386049 1:0.62 2:0.36842105 3:0.25806452 4:0 \n"
+"0.001050308109887437 1:0.62 2:0.36842105 3:0.35483871 4:0 \n"
+"-0.06810597824396332 1:0.62 2:0.52631579 3:0.61290323 4:0 \n"
+"-0.4199678265352947 1:0.62 2:0.63157895 3:0.35483871 4:0 \n"
+"-0.44625697080628 1:0.62 2:0.73684211 3:0.48387097 4:0 \n"
+"-0.01358287824488296 1:0.62 2:0.78947368 3:0.4516129 4:0 \n"
+"-1 1:0.66 2:0.23529412 3:0.78787879 4:0 \n"
+"-0.4954658033850093 1:0.66 2:0.41176471 3:0.3030303 4:0 \n"
+"-0.4684521966805765 1:0.66 2:0.64705882 3:0.60606061 4:0 \n"
+"-0.2793322948198178 1:0.66 2:0.76470588 3:0.3030303 4:0 \n"
+"0.2849506022237858 1:0.66 2:0.82352941 3:0.45454545 4:0 \n"
+"0.2554007801619184 1:0.68 2:0.1875 3:0.41176471 4:0 \n"
+"0.1297831896837497 1:0.68 2:0.25 3:0.41176471 4:0 \n"
+"-0.03753335664157343 1:0.68 2:0.25 3:0.70588235 4:0 \n"
+"-0.02608031772002552 1:0.68 2:0.4375 3:0.26470588 4:0 \n"
+"-1 1:0.68 2:0.6875 3:0.26470588 4:0 \n"
+"-0.02281343883392093 1:0.68 2:0.75 3:0.26470588 4:0 \n"
+"0.07151312712204054 1:0.68 2:0.75 3:0.55882353 4:0 \n"
+"-1 1:0.68 2:0.75 3:0.64705882 4:0 \n"
+"0.6163938656707675 1:0.68 2:0.8125 3:0.41176471 4:0 \n"
+"0.05482582811772205 1:0.68 2:0.8125 3:0.64705882 4:0 \n"
+"-0.1252295600791277 1:0.7 2:0.26666667 3:0.25714286 4:0 \n"
+"-0.1454166861786485 1:0.7 2:0.46666667 3:0.65714286 4:0 \n"
+"-0.1324013043130206 1:0.7 2:0.73333333 3:0.25714286 4:0 \n"
+"-0.9445272199786531 1:0.7 2:0.73333333 3:0.8 4:0 \n"
+"1 1:0.72 2:0.21428571 3:0.44444444 4:0 \n"
+"1 1:0.72 2:0.21428571 3:0.5 4:0 \n"
+"0.9626047312933887 1:0.72 2:0.28571429 3:0.44444444 4:0 \n"
+"-0.4512578222546959 1:0.72 2:0.28571429 3:0.80555556 4:0 \n"
+"0.05137185671884451 1:0.72 2:0.5 3:0.38888889 4:0 \n"
+"0.02753015992226191 1:0.72 2:0.5 3:0.44444444 4:0 \n"
+"1 1:0.72 2:0.57142857 3:0.36111111 4:0 \n"
+"0.7224161439688335 1:0.72 2:0.64285714 3:0.44444444 4:0 \n"
+"-0.4538030422695079 1:0.72 2:0.71428571 3:0.25 4:0 \n"
+"0.9952961794932015 1:0.72 2:0.71428571 3:0.44444444 4:0 \n"
+"1 1:0.72 2:0.78571429 3:0.5 4:0 \n"
+"1 1:0.72 2:0.78571429 3:0.55555556 4:0 \n"
+"-1 1:0.76 2:0.16666667 3:0.28947368 4:0 \n"
+"0.7660150530906951 1:0.76 2:0.16666667 3:0.44736842 4:0 \n"
+"1 1:0.76 2:0.25 3:0.5 4:0 \n"
+"0.8071418590509907 1:0.76 2:0.25 3:0.65789474 4:0 \n"
+"1 1:0.76 2:0.33333333 3:0.39473684 4:0 \n"
+"1 1:0.76 2:0.33333333 3:0.44736842 4:0 \n"
+"1 1:0.76 2:0.33333333 3:0.5 4:0 \n"
+"0.003702315572620042 1:0.76 2:0.41666667 3:0.60526316 4:0 \n"
+"1 1:0.76 2:0.66666667 3:0.5 4:0 \n"
+"1 1:0.76 2:0.66666667 3:0.60526316 4:0 \n"
+"1 1:0.76 2:0.75 3:0.5 4:0 \n"
+"0.7595359045293272 1:0.76 2:0.83333333 3:0.21052632 4:0 \n"
+"1 1:0.76 2:0.83333333 3:0.39473684 4:0 \n"
+"0.1097435588968492 1:0.76 2:0.83333333 3:0.5 4:0 \n"
+"0.08137302450917316 1:0.78 2:0.18181818 3:0.20512821 4:0 \n"
+"1 1:0.78 2:0.18181818 3:0.74358974 4:0 \n"
+"1 1:0.78 2:0.27272727 3:0.46153846 4:0 \n"
+"0.3829037053297411 1:0.78 2:0.45454545 3:0.79487179 4:0 \n"
+"0.299550505687713 1:0.78 2:0.54545455 3:0.69230769 4:0 \n"
+"0.044287210520343 1:0.78 2:0.54545455 3:0.79487179 4:0 \n"
+"-0.5366216412686633 1:0.78 2:0.63636364 3:0.30769231 4:0 \n"
+"0.5647571890765837 1:0.78 2:0.72727273 3:0.41025641 4:0 \n"
+"0.01149507040932693 1:0.78 2:0.72727273 3:0.64102564 4:0 \n"
+"-0.04153684623206437 1:0.78 2:0.81818182 3:0.53846154 4:0 \n"
+"-0.007108344628630045 1:0.78 2:0.81818182 3:0.64102564 4:0 \n"
+"0.7459296102482841 1:0.78 2:0.81818182 3:0.74358974 4:0 \n"
+"1 1:0.8 2:0.2 3:0.2 4:0 \n"
+"-0.6031520655050495 1:0.8 2:0.2 3:0.3 4:0 \n"
+"-1 1:0.8 2:0.2 3:0.4 4:0 \n"
+"-0.007590751973352182 1:0.8 2:0.2 3:0.45 4:0 \n"
+"-1 1:0.8 2:0.2 3:0.5 4:0 \n"
+"-1 1:0.8 2:0.2 3:0.55 4:0 \n"
+"-1 1:0.8 2:0.2 3:0.6 4:0 \n"
+"0.2140711381845247 1:0.8 2:0.2 3:0.75 4:0 \n"
+"0.2914211623767319 1:0.8 2:0.2 3:0.8 4:0 \n"
+"0.3422740526001184 1:0.8 2:0.3 3:0.2 4:0 \n"
+"-1 1:0.8 2:0.3 3:0.45 4:0 \n"
+"-0.7318598706719721 1:0.8 2:0.3 3:0.6 4:0 \n"
+"0.002418582009178758 1:0.8 2:0.3 3:0.75 4:0 \n"
+"-1 1:0.8 2:0.4 3:0.35 4:0 \n"
+"-0.005074312666051498 1:0.8 2:0.4 3:0.55 4:0 \n"
+"0.2120811616220415 1:0.8 2:0.5 3:0.2 4:0 \n"
+"-0.1458147825770993 1:0.8 2:0.5 3:0.3 4:0 \n"
+"-0.1408059540929924 1:0.8 2:0.5 3:0.4 4:0 \n"
+"-1 1:0.8 2:0.5 3:0.5 4:0 \n"
+"0.2020908287310789 1:0.8 2:0.5 3:0.7 4:0 \n"
+"-0.03836311858537843 1:0.8 2:0.6 3:0.5 4:0 \n"
+"-0.05208260147723191 1:0.8 2:0.6 3:0.55 4:0 \n"
+"-1 1:0.8 2:0.6 3:0.6 4:0 \n"
+"1 1:0.8 2:0.7 3:0.2 4:0 \n"
+"-0.002616444284925962 1:0.8 2:0.7 3:0.55 4:0 \n"
+"0.03336205896390394 1:0.8 2:0.7 3:0.75 4:0 \n"
+"-1 1:0.8 2:0.8 3:0.35 4:0 \n"
+"-1 1:0.8 2:0.8 3:0.4 4:0 \n"
+"-1 1:0.8 2:0.8 3:0.45 4:0 \n"
+"-1 1:0.8 2:0.8 3:0.5 4:0 \n"
+"-1 1:0.8 2:0.8 3:0.6 4:0 \n"
+"0.6258957493805375 1:0.8 2:0.8 3:0.8 4:0 \n"
+"-0.05890383128415338 1:0.2 2:0.2 3:0.4 4:0.14285714 \n"
+"0.03647635472077591 1:0.2 2:0.25 3:0.8 4:0.14285714 \n"
+"0.1330384093878337 1:0.2 2:0.3 3:0.6 4:0.14285714 \n"
+"-0.4208995683100714 1:0.2 2:0.45 3:0.2 4:0.14285714 \n"
+"-0.557073487577243 1:0.2 2:0.45 3:0.55 4:0.14285714 \n"
+"-0.05778065221265551 1:0.2 2:0.5 3:0.2 4:0.14285714 \n"
+"-0.0821523965757199 1:0.2 2:0.5 3:0.7 4:0.14285714 \n"
+"-0.01106357914653276 1:0.2 2:0.5 3:0.75 4:0.14285714 \n"
+"0.2208509066786977 1:0.2 2:0.7 3:0.2 4:0.14285714 \n"
+"0.004213129842881305 1:0.2 2:0.7 3:0.65 4:0.14285714 \n"
+"0.1444509344431197 1:0.2 2:0.7 3:0.7 4:0.14285714 \n"
+"-0.007265625147452436 1:0.23 2:0.19480519 3:0.34782609 4:0.14285714 \n"
+"-0.007697160588386425 1:0.23 2:0.80519481 3:0.47826087 4:0.14285714 \n"
+"-0.1333712851609656 1:0.28 2:0.25 3:0.21428571 4:0.14285714 \n"
+"0.05187998291430889 1:0.28 2:0.40277778 3:0.28571429 4:0.14285714 \n"
+"-0.2538406552302359 1:0.28 2:0.80555556 3:0.21428571 4:0.14285714 \n"
+"-0.1271073815193153 1:0.3 2:0.2 3:0.8 4:0.14285714 \n"
+"-0.08926749735020217 1:0.3 2:0.25714286 3:0.76666667 4:0.14285714 \n"
+"-0.4203489420977766 1:0.3 2:0.8 3:0.76666667 4:0.14285714 \n"
+"-0.2747402138637966 1:0.33 2:0.25373134 3:0.21212121 4:0.14285714 \n"
+"-0.1393985966029691 1:0.33 2:0.25373134 3:0.63636364 4:0.14285714 \n"
+"-0.03086373130647553 1:0.33 2:0.25373134 3:0.78787879 4:0.14285714 \n"
+"-0.2729129562834839 1:0.33 2:0.40298507 3:0.75757576 4:0.14285714 \n"
+"-0.1025205733520323 1:0.33 2:0.74626866 3:0.78787879 4:0.14285714 \n"
+"-0.5839198127710407 1:0.35 2:0.6 3:0.2 4:0.14285714 \n"
+"0.1074730390951445 1:0.38 2:0.80645161 3:0.39473684 4:0.14285714 \n"
+"0.3552745806839843 1:0.38 2:0.80645161 3:0.60526316 4:0.14285714 \n"
+"0.01126243238999126 1:0.43 2:0.40350877 3:0.48837209 4:0.14285714 \n"
+"0.04038161021121418 1:0.43 2:0.80701754 3:0.69767442 4:0.14285714 \n"
+"0.2644052442057925 1:0.45 2:0.34545455 3:0.48888889 4:0.14285714 \n"
+"0.5316143238083944 1:0.45 2:0.4 3:0.55555556 4:0.14285714 \n"
+"0.153671635506366 1:0.45 2:0.65454545 3:0.44444444 4:0.14285714 \n"
+"0.001853029148417819 1:0.45 2:0.65454545 3:0.6 4:0.14285714 \n"
+"0.003474698564137756 1:0.48 2:0.80769231 3:0.70833333 4:0.14285714 \n"
+"0.04543394257623733 1:0.5 2:0.2 3:0.8 4:0.14285714 \n"
+"0.004201899525712433 1:0.5 2:0.54 3:0.6 4:0.14285714 \n"
+"0.0338300334523025 1:0.5 2:0.66 3:0.76 4:0.14285714 \n"
+"0.003604719473749735 1:0.5 2:0.8 3:0.3 4:0.14285714 \n"
+"-0.08350786336560617 1:0.53 2:0.25531915 3:0.30188679 4:0.14285714 \n"
+"0.005826885062962134 1:0.55 2:0.4 3:0.8 4:0.14285714 \n"
+"0.01275942950410902 1:0.55 2:0.64444444 3:0.2 4:0.14285714 \n"
+"-0.2646298131150417 1:0.55 2:0.71111111 3:0.49090909 4:0.14285714 \n"
+"0.08041238064858627 1:0.55 2:0.71111111 3:0.8 4:0.14285714 \n"
+"-0.02835087907106976 1:0.58 2:0.26190476 3:0.55172414 4:0.14285714 \n"
+"-0.4387425916769603 1:0.58 2:0.30952381 3:0.55172414 4:0.14285714 \n"
+"0.1919667661844888 1:0.58 2:0.35714286 3:0.75862069 4:0.14285714 \n"
+"-1 1:0.58 2:0.76190476 3:0.5 4:0.14285714 \n"
+"-0.1118421025622999 1:0.6 2:0.25 3:0.5 4:0.14285714 \n"
+"-0.5397389560549869 1:0.6 2:0.3 3:0.5 4:0.14285714 \n"
+"-0.1785796450980187 1:0.6 2:0.75 3:0.3 4:0.14285714 \n"
+"-0.02549557919331509 1:0.6 2:0.8 3:0.5 4:0.14285714 \n"
+"-0.1029820350882626 1:0.63 2:0.18918919 3:0.25396825 4:0.14285714 \n"
+"-0.4697941061773594 1:0.63 2:0.18918919 3:0.6031746 4:0.14285714 \n"
+"-0.4001830643737279 1:0.63 2:0.24324324 3:0.65079365 4:0.14285714 \n"
+"-0.1416780168834583 1:0.63 2:0.35135135 3:0.25396825 4:0.14285714 \n"
+"-0.4338506307544635 1:0.63 2:0.75675676 3:0.6031746 4:0.14285714 \n"
+"-0.04097893986667835 1:0.65 2:0.34285714 3:0.6 4:0.14285714 \n"
+"-0.3087974444328873 1:0.65 2:0.65714286 3:0.55384615 4:0.14285714 \n"
+"-0.377614746078065 1:0.65 2:0.74285714 3:0.49230769 4:0.14285714 \n"
+"-0.00772762918944356 1:0.68 2:0.1875 3:0.25 4:0.14285714 \n"
+"-0.369728605517054 1:0.68 2:0.25 3:0.20588235 4:0.14285714 \n"
+"-0.004000501889438193 1:0.68 2:0.34375 3:0.70588235 4:0.14285714 \n"
+"-0.07274170034356166 1:0.68 2:0.6875 3:0.25 4:0.14285714 \n"
+"-0.8184396606503874 1:0.68 2:0.75 3:0.20588235 4:0.14285714 \n"
+"-0.1363872683894876 1:0.68 2:0.8125 3:0.79411765 4:0.14285714 \n"
+"-1 1:0.7 2:0.2 3:0.25714286 4:0.14285714 \n"
+"-0.03118028369527123 1:0.7 2:0.2 3:0.75714286 4:0.14285714 \n"
+"-0.02181363186270414 1:0.7 2:0.26666667 3:0.2 4:0.14285714 \n"
+"-0.1113302533497955 1:0.73 2:0.18518519 3:0.20547945 4:0.14285714 \n"
+"1 1:0.73 2:0.25925926 3:0.45205479 4:0.14285714 \n"
+"-0.03442737834664072 1:0.73 2:0.2962963 3:0.24657534 4:0.14285714 \n"
+"-0.4178121191901863 1:0.73 2:0.33333333 3:0.79452055 4:0.14285714 \n"
+"0.9528580345965603 1:0.73 2:0.7037037 3:0.45205479 4:0.14285714 \n"
+"-0.2024630768603559 1:0.73 2:0.74074074 3:0.79452055 4:0.14285714 \n"
+"1 1:0.75 2:0.24 3:0.4 4:0.14285714 \n"
+"0.1244479011966203 1:0.75 2:0.24 3:0.6 4:0.14285714 \n"
+"-0.002202590904183391 1:0.75 2:0.24 3:0.8 4:0.14285714 \n"
+"-0.4228940084880581 1:0.75 2:0.32 3:0.25333333 4:0.14285714 \n"
+"0.01217370372007936 1:0.75 2:0.32 3:0.34666667 4:0.14285714 \n"
+"-0.001694578380018039 1:0.75 2:0.36 3:0.25333333 4:0.14285714 \n"
+"0.01572921427924467 1:0.75 2:0.44 3:0.4 4:0.14285714 \n"
+"0.04952274628581792 1:0.75 2:0.72 3:0.4 4:0.14285714 \n"
+"1 1:0.75 2:0.76 3:0.45333333 4:0.14285714 \n"
+"0.9407620893274501 1:0.75 2:0.76 3:0.54666667 4:0.14285714 \n"
+"0.9159871506295172 1:0.75 2:0.8 3:0.45333333 4:0.14285714 \n"
+"-0.4292340325390916 1:0.75 2:0.8 3:0.8 4:0.14285714 \n"
+"-0.1660503683447014 1:0.78 2:0.18181818 3:0.29487179 4:0.14285714 \n"
+"0.4084556146085806 1:0.78 2:0.40909091 3:0.65384615 4:0.14285714 \n"
+"-1 1:0.78 2:0.81818182 3:0.44871795 4:0.14285714 \n"
+"0.4081461388888754 1:0.8 2:0.2 3:0.2 4:0.14285714 \n"
+"-0.1138377046011816 1:0.8 2:0.2 3:0.35 4:0.14285714 \n"
+"-0.08204833433519138 1:0.8 2:0.2 3:0.4 4:0.14285714 \n"
+"-1 1:0.8 2:0.2 3:0.45 4:0.14285714 \n"
+"-0.002485088614037121 1:0.8 2:0.2 3:0.5 4:0.14285714 \n"
+"-1 1:0.8 2:0.2 3:0.55 4:0.14285714 \n"
+"0.2402871418260354 1:0.8 2:0.25 3:0.2 4:0.14285714 \n"
+"-0.5315970292804028 1:0.8 2:0.35 3:0.5 4:0.14285714 \n"
+"-0.1114097110919589 1:0.8 2:0.4 3:0.4 4:0.14285714 \n"
+"-0.01249520546891368 1:0.8 2:0.4 3:0.5 4:0.14285714 \n"
+"-0.2953993719277596 1:0.8 2:0.5 3:0.5 4:0.14285714 \n"
+"0.04302323505133746 1:0.8 2:0.55 3:0.2 4:0.14285714 \n"
+"-0.1892517932217734 1:0.8 2:0.55 3:0.45 4:0.14285714 \n"
+"-1 1:0.8 2:0.6 3:0.5 4:0.14285714 \n"
+"-0.07615250020872869 1:0.8 2:0.6 3:0.55 4:0.14285714 \n"
+"-0.06063302759572581 1:0.8 2:0.75 3:0.5 4:0.14285714 \n"
+"0.1129148440567782 1:0.8 2:0.75 3:0.65 4:0.14285714 \n"
+"-0.2346450853926897 1:0.8 2:0.8 3:0.4 4:0.14285714 \n"
+"-1 1:0.8 2:0.8 3:0.5 4:0.14285714 \n"
+"-1 1:0.8 2:0.8 3:0.55 4:0.14285714 \n"
+"0.2647835241855724 1:0.2 2:0.2 3:0.2 4:0.28571429 \n"
+"0.021681655614574 1:0.2 2:0.25 3:0.2 4:0.28571429 \n"
+"0.1368832376463672 1:0.2 2:0.25 3:0.6 4:0.28571429 \n"
+"0.01423844029360578 1:0.2 2:0.3 3:0.26666667 4:0.28571429 \n"
+"0.1899008202167059 1:0.2 2:0.3 3:0.8 4:0.28571429 \n"
+"0.1287169622780912 1:0.2 2:0.65 3:0.8 4:0.28571429 \n"
+"0.2578924180293748 1:0.2 2:0.7 3:0.2 4:0.28571429 \n"
+"0.08404345905705299 1:0.2 2:0.7 3:0.66666667 4:0.28571429 \n"
+"0.07439491108482238 1:0.2 2:0.7 3:0.8 4:0.28571429 \n"
+"-0.0006432778063540903 1:0.2 2:0.8 3:0.5 4:0.28571429 \n"
+"0.05858956823467007 1:0.22666667 2:0.44827586 3:0.26470588 4:0.28571429 \n"
+"0.01298937884942149 1:0.25333333 2:0.40178571 3:0.21052632 4:0.28571429 \n"
+"0.3882896025954724 1:0.25333333 2:0.44642857 3:0.26315789 4:0.28571429 \n"
+"-0.00911067268374835 1:0.25333333 2:0.80357143 3:0.21052632 4:0.28571429 \n"
+"0.009029008671931273 1:0.27333333 2:0.40366972 3:0.19512195 4:0.28571429 \n"
+"0.1418349141289324 1:0.27333333 2:0.44954128 3:0.29268293 4:0.28571429 \n"
+"0.008227725372700887 1:0.27333333 2:0.44954128 3:0.80487805 4:0.28571429 \n"
+"-0.04299167054302689 1:0.27333333 2:0.75229358 3:0.24390244 4:0.28571429 \n"
+"-0.006162251566841708 1:0.3 2:0.8 3:0.2 4:0.28571429 \n"
+"-0.09111327900633509 1:0.32666667 2:0.65346535 3:0.34693878 4:0.28571429 \n"
+"-0.0258054626265483 1:0.32666667 2:0.7029703 3:0.75510204 4:0.28571429 \n"
+"-0.02415259045870603 1:0.35333333 2:0.70103093 3:0.24528302 4:0.28571429 \n"
+"-0.1469180116478655 1:0.4 2:0.54444444 3:0.8 4:0.28571429 \n"
+"0.2833072553696485 1:0.42666667 2:0.34883721 3:0.59375 4:0.28571429 \n"
+"0.01355303406923013 1:0.42666667 2:0.39534884 3:0.546875 4:0.28571429 \n"
+"0.2290844196739131 1:0.42666667 2:0.65116279 3:0.546875 4:0.28571429 \n"
+"0.1178570908434999 1:0.45333333 2:0.19512195 3:0.54411765 4:0.28571429 \n"
+"0.06046243672977385 1:0.45333333 2:0.40243902 3:0.60294118 4:0.28571429 \n"
+"0.1423946457416378 1:0.45333333 2:0.80487805 3:0.39705882 4:0.28571429 \n"
+"0.007815430579740863 1:0.45333333 2:0.80487805 3:0.64705882 4:0.28571429 \n"
+"0.1924781143075323 1:0.47333333 2:0.20253165 3:0.70422535 4:0.28571429 \n"
+"0.1855963432528384 1:0.47333333 2:0.20253165 3:0.8028169 4:0.28571429 \n"
+"0.1640009200706116 1:0.47333333 2:0.69620253 3:0.1971831 4:0.28571429 \n"
+"0.3932828126755543 1:0.47333333 2:0.79746835 3:0.1971831 4:0.28571429 \n"
+"0.7186588869997429 1:0.5 2:0.2 3:0.2 4:0.28571429 \n"
+"0.0003513297812071051 1:0.5 2:0.2 3:0.34666667 4:0.28571429 \n"
+"0.1391389801747556 1:0.5 2:0.25333333 3:0.65333333 4:0.28571429 \n"
+"0.02330878996106901 1:0.5 2:0.25333333 3:0.8 4:0.28571429 \n"
+"0.1519866436548091 1:0.5 2:0.30666667 3:0.2 4:0.28571429 \n"
+"0.1186781443459868 1:0.5 2:0.34666667 3:0.74666667 4:0.28571429 \n"
+"0.1053191571248003 1:0.5 2:0.49333333 3:0.6 4:0.28571429 \n"
+"0.005010086400107649 1:0.5 2:0.54666667 3:0.49333333 4:0.28571429 \n"
+"0.5653119554363314 1:0.52666667 2:0.74647887 3:0.79746835 4:0.28571429 \n"
+"0.06787622926551946 1:0.52666667 2:0.8028169 3:0.74683544 4:0.28571429 \n"
+"0.001058097652629706 1:0.55333333 2:0.25373134 3:0.79518072 4:0.28571429 \n"
+"0.001766944959780314 1:0.55333333 2:0.40298507 3:0.79518072 4:0.28571429 \n"
+"0.5857686285893017 1:0.55333333 2:0.65671642 3:0.20481928 4:0.28571429 \n"
+"0.001017985380128487 1:0.57333333 2:0.203125 3:0.19767442 4:0.28571429 \n"
+"0.03512297285302611 1:0.57333333 2:0.296875 3:0.80232558 4:0.28571429 \n"
+"0.008309229153038602 1:0.57333333 2:0.34375 3:0.80232558 4:0.28571429 \n"
+"0.307063276071051 1:0.57333333 2:0.453125 3:0.19767442 4:0.28571429 \n"
+"0.1341512308934816 1:0.57333333 2:0.5 3:0.19767442 4:0.28571429 \n"
+"0.0483398403718592 1:0.57333333 2:0.65625 3:0.80232558 4:0.28571429 \n"
+"0.005577641881525733 1:0.6 2:0.5 3:0.2 4:0.28571429 \n"
+"-1 1:0.62666667 2:0.30357143 3:0.5 4:0.28571429 \n"
+"-0.1159527443159792 1:0.62666667 2:0.64285714 3:0.55319149 4:0.28571429 \n"
+"-0.3556519136527647 1:0.65333333 2:0.34615385 3:0.5 4:0.28571429 \n"
+"-0.5918258654696605 1:0.65333333 2:0.69230769 3:0.70408163 4:0.28571429 \n"
+"-0.1263493413988876 1:0.67333333 2:0.75510204 3:0.24752475 4:0.28571429 \n"
+"-0.001641870786415262 1:0.7 2:0.31111111 3:0.75238095 4:0.28571429 \n"
+"0.02380087741021985 1:0.72666667 2:0.19512195 3:0.44954128 4:0.28571429 \n"
+"1 1:0.72666667 2:0.19512195 3:0.49541284 4:0.28571429 \n"
+"0.03843513168876561 1:0.72666667 2:0.19512195 3:0.59633028 4:0.28571429 \n"
+"1 1:0.72666667 2:0.24390244 3:0.44954128 4:0.28571429 \n"
+"0.4678339575411229 1:0.72666667 2:0.29268293 3:0.34862385 4:0.28571429 \n"
+"1 1:0.72666667 2:0.29268293 3:0.44954128 4:0.28571429 \n"
+"0.01584004362090234 1:0.72666667 2:0.75609756 3:0.34862385 4:0.28571429 \n"
+"0.8621565629217485 1:0.72666667 2:0.80487805 3:0.59633028 4:0.28571429 \n"
+"0.687293686384469 1:0.75333333 2:0.18918919 3:0.49557522 4:0.28571429 \n"
+"1 1:0.75333333 2:0.18918919 3:0.60176991 4:0.28571429 \n"
+"1 1:0.75333333 2:0.24324324 3:0.45132743 4:0.28571429 \n"
+"0.01568821461940785 1:0.75333333 2:0.45945946 3:0.3539823 4:0.28571429 \n"
+"1 1:0.75333333 2:0.7027027 3:0.60176991 4:0.28571429 \n"
+"1 1:0.75333333 2:0.75675676 3:0.39823009 4:0.28571429 \n"
+"0.03834645770322982 1:0.75333333 2:0.75675676 3:0.49557522 4:0.28571429 \n"
+"0.006534719682771545 1:0.75333333 2:0.75675676 3:0.54867257 4:0.28571429 \n"
+"1 1:0.75333333 2:0.75675676 3:0.6460177 4:0.28571429 \n"
+"1 1:0.75333333 2:0.81081081 3:0.45132743 4:0.28571429 \n"
+"0.00329061097157861 1:0.75333333 2:0.81081081 3:0.54867257 4:0.28571429 \n"
+"0.1447348638769029 1:0.75333333 2:0.81081081 3:0.60176991 4:0.28571429 \n"
+"0.04806360024793592 1:0.75333333 2:0.81081081 3:0.6460177 4:0.28571429 \n"
+"0.6848522543397942 1:0.77333333 2:0.26470588 3:0.44827586 4:0.28571429 \n"
+"0.8313263807588944 1:0.77333333 2:0.26470588 3:0.60344828 4:0.28571429 \n"
+"0.0009807846298986874 1:0.77333333 2:0.5 3:0.39655172 4:0.28571429 \n"
+"0.8000565261146639 1:0.77333333 2:0.5 3:0.60344828 4:0.28571429 \n"
+"0.3970087667656403 1:0.77333333 2:0.58823529 3:0.44827586 4:0.28571429 \n"
+"0.246173505555486 1:0.77333333 2:0.64705882 3:0.39655172 4:0.28571429 \n"
+"0.06848815914870858 1:0.77333333 2:0.64705882 3:0.64655172 4:0.28571429 \n"
+"0.2166373327562426 1:0.77333333 2:0.70588235 3:0.35344828 4:0.28571429 \n"
+"0.001447740450808778 1:0.77333333 2:0.70588235 3:0.55172414 4:0.28571429 \n"
+"0.3759936878439463 1:0.77333333 2:0.76470588 3:0.39655172 4:0.28571429 \n"
+"0.01440033584811751 1:0.77333333 2:0.76470588 3:0.60344828 4:0.28571429 \n"
+"0.1145987394309219 1:0.77333333 2:0.79411765 3:0.64655172 4:0.28571429 \n"
+"0.7808280177979096 1:0.8 2:0.2 3:0.2 4:0.28571429 \n"
+"-0.01094982456318567 1:0.8 2:0.2 3:0.4 4:0.28571429 \n"
+"-1 1:0.8 2:0.2 3:0.45 4:0.28571429 \n"
+"-0.7993432355433207 1:0.8 2:0.2 3:0.5 4:0.28571429 \n"
+"0.1082260120851962 1:0.8 2:0.2 3:0.75 4:0.28571429 \n"
+"0.1440633092276004 1:0.8 2:0.5 3:0.2 4:0.28571429 \n"
+"-0.09759508856854318 1:0.8 2:0.5 3:0.5 4:0.28571429 \n"
+"0.3777344926585111 1:0.8 2:0.8 3:0.2 4:0.28571429 \n"
+"-0.07545914768242526 1:0.8 2:0.8 3:0.45 4:0.28571429 \n"
+"-1 1:0.8 2:0.8 3:0.5 4:0.28571429 \n"
+"-0.002156228737567375 1:0.8 2:0.8 3:0.55 4:0.28571429 \n"
+"0.4283076007228073 1:0.8 2:0.8 3:0.8 4:0.28571429 \n"
+"0.04449615215339716 1:0.2 2:0.2 3:0.2 4:0.42857143 \n"
+"-0.1320752029012897 1:0.2 2:0.45 3:0.2 4:0.42857143 \n"
+"-0.008173294645595859 1:0.2 2:0.45 3:0.45 4:0.42857143 \n"
+"-0.02861952088231923 1:0.2 2:0.45 3:0.55 4:0.42857143 \n"
+"-0.04285391432322713 1:0.2 2:0.45 3:0.75 4:0.42857143 \n"
+"-0.03667294100190568 1:0.2 2:0.5 3:0.2 4:0.42857143 \n"
+"-0.1060132208632206 1:0.2 2:0.5 3:0.75 4:0.42857143 \n"
+"0.02051146031102578 1:0.2 2:0.7 3:0.8 4:0.42857143 \n"
+"-0.01369795763331014 1:0.25 2:0.2 3:0.36 4:0.42857143 \n"
+"-0.001352778532604716 1:0.25 2:0.25333333 3:0.44 4:0.42857143 \n"
+"-0.03400937633471584 1:0.25 2:0.8 3:0.2 4:0.42857143 \n"
+"-0.005384325095049922 1:0.275 2:0.24827586 3:0.49090909 4:0.42857143 \n"
+"-0.0111263929259949 1:0.275 2:0.35172414 3:0.54545455 4:0.42857143 \n"
+"-0.01951469286690584 1:0.3 2:0.2 3:0.3 4:0.42857143 \n"
+"-0.1552811090343472 1:0.3 2:0.2 3:0.75 4:0.42857143 \n"
+"-0.0137987704448756 1:0.3 2:0.25 3:0.35 4:0.42857143 \n"
+"-0.1786137209424445 1:0.3 2:0.25 3:0.8 4:0.42857143 \n"
+"-0.01834540145898148 1:0.3 2:0.65 3:0.25 4:0.42857143 \n"
+"-0.2255387329099477 1:0.3 2:0.7 3:0.25 4:0.42857143 \n"
+"-0.02516095707745136 1:0.3 2:0.75 3:0.2 4:0.42857143 \n"
+"-0.07392356826959016 1:0.3 2:0.75 3:0.75 4:0.42857143 \n"
+"-0.04231250680862637 1:0.3 2:0.8 3:0.25 4:0.42857143 \n"
+"-0.007663882117388645 1:0.325 2:0.2 3:0.8 4:0.42857143 \n"
+"-0.7457320431438289 1:0.325 2:0.25185185 3:0.2 4:0.42857143 \n"
+"-0.005503494796048242 1:0.325 2:0.25185185 3:0.30769231 4:0.42857143 \n"
+"-0.001357273457763573 1:0.325 2:0.25185185 3:0.44615385 4:0.42857143 \n"
+"-0.02015869753707464 1:0.325 2:0.3037037 3:0.24615385 4:0.42857143 \n"
+"-0.04255692541375034 1:0.325 2:0.34814815 3:0.75384615 4:0.42857143 \n"
+"-0.05411001805859944 1:0.325 2:0.65185185 3:0.8 4:0.42857143 \n"
+"-0.08191081364503378 1:0.325 2:0.7037037 3:0.75384615 4:0.42857143 \n"
+"-0.05923912901288052 1:0.325 2:0.7037037 3:0.8 4:0.42857143 \n"
+"-0.03592875561387267 1:0.35 2:0.6 3:0.75714286 4:0.42857143 \n"
+"-0.02171630930494084 1:0.35 2:0.7 3:0.8 4:0.42857143 \n"
+"-0.001105494591186577 1:0.35 2:0.75384615 3:0.75714286 4:0.42857143 \n"
+"0.001216039687282729 1:0.4 2:0.8 3:0.4 4:0.42857143 \n"
+"0.05922077774052074 1:0.4 2:0.8 3:0.5 4:0.42857143 \n"
+"0.008878074635266964 1:0.425 2:0.2 3:0.64705882 4:0.42857143 \n"
+"0.00240311616155475 1:0.425 2:0.8 3:0.44705882 4:0.42857143 \n"
+"0.00212795440596023 1:0.425 2:0.8 3:0.55294118 4:0.42857143 \n"
+"0.003011615226619774 1:0.45 2:0.5 3:0.54444444 4:0.42857143 \n"
+"0.000889952066608308 1:0.475 2:0.2 3:0.65263158 4:0.42857143 \n"
+"0.2330519838926279 1:0.525 2:0.25263158 3:0.8 4:0.42857143 \n"
+"0.2166590972157478 1:0.525 2:0.74736842 3:0.8 4:0.42857143 \n"
+"0.001579206099347716 1:0.525 2:0.8 3:0.2 4:0.42857143 \n"
+"0.2059543629381529 1:0.55 2:0.4 3:0.8 4:0.42857143 \n"
+"0.3544032919837971 1:0.55 2:0.65555556 3:0.8 4:0.42857143 \n"
+"0.0008769784313698531 1:0.55 2:0.7 3:0.2 4:0.42857143 \n"
+"0.1654339889057651 1:0.575 2:0.70588235 3:0.8 4:0.42857143 \n"
+"-0.2791311562633449 1:0.575 2:0.75294118 3:0.45217391 4:0.42857143 \n"
+"0.01972528685563882 1:0.575 2:0.8 3:0.8 4:0.42857143 \n"
+"-0.001859120554721611 1:0.6 2:0.25 3:0.45 4:0.42857143 \n"
+"0.01521119394645598 1:0.6 2:0.7 3:0.8 4:0.42857143 \n"
+"-0.9223908503283474 1:0.625 2:0.25333333 3:0.496 4:0.42857143 \n"
+"-1 1:0.625 2:0.25333333 3:0.552 4:0.42857143 \n"
+"-0.2352518579793432 1:0.625 2:0.25333333 3:0.704 4:0.42857143 \n"
+"-0.0472020210341995 1:0.625 2:0.34666667 3:0.448 4:0.42857143 \n"
+"-0.1330625705416863 1:0.625 2:0.65333333 3:0.304 4:0.42857143 \n"
+"-0.104505740722707 1:0.625 2:0.65333333 3:0.4 4:0.42857143 \n"
+"-0.01211026267195599 1:0.625 2:0.70666667 3:0.448 4:0.42857143 \n"
+"-0.1624866852405818 1:0.625 2:0.74666667 3:0.304 4:0.42857143 \n"
+"-0.6755767835097863 1:0.625 2:0.74666667 3:0.496 4:0.42857143 \n"
+"-0.179727315540498 1:0.625 2:0.74666667 3:0.552 4:0.42857143 \n"
+"-0.1947022071502777 1:0.65 2:0.3 3:0.54615385 4:0.42857143 \n"
+"-0.1388364121640707 1:0.65 2:0.3 3:0.6 4:0.42857143 \n"
+"-0.3513782507249655 1:0.65 2:0.7 3:0.65384615 4:0.42857143 \n"
+"-0.001406497278172898 1:0.65 2:0.75714286 3:0.3 4:0.42857143 \n"
+"-0.0438949424857122 1:0.65 2:0.75714286 3:0.35384615 4:0.42857143 \n"
+"-0.5861222587895963 1:0.65 2:0.75714286 3:0.75384615 4:0.42857143 \n"
+"-0.0361440295670948 1:0.675 2:0.2 3:0.7037037 4:0.42857143 \n"
+"-0.03168218904821609 1:0.675 2:0.2 3:0.74814815 4:0.42857143 \n"
+"-0.003747695993699025 1:0.675 2:0.24615385 3:0.74814815 4:0.42857143 \n"
+"-0.04675371702530456 1:0.675 2:0.30769231 3:0.74814815 4:0.42857143 \n"
+"-0.8109528681711682 1:0.675 2:0.70769231 3:0.25185185 4:0.42857143 \n"
+"-0.8911076996529095 1:0.675 2:0.70769231 3:0.74814815 4:0.42857143 \n"
+"-0.2263163476346403 1:0.675 2:0.75384615 3:0.25185185 4:0.42857143 \n"
+"-0.1921678812639322 1:0.7 2:0.2 3:0.25 4:0.42857143 \n"
+"-0.007285272058103063 1:0.7 2:0.2 3:0.75 4:0.42857143 \n"
+"-1 1:0.7 2:0.25 3:0.75 4:0.42857143 \n"
+"-1 1:0.7 2:0.3 3:0.25 4:0.42857143 \n"
+"-0.0236018935393915 1:0.7 2:0.3 3:0.8 4:0.42857143 \n"
+"-0.5232369862086025 1:0.7 2:0.35 3:0.25 4:0.42857143 \n"
+"-0.8130657464326642 1:0.7 2:0.7 3:0.25 4:0.42857143 \n"
+"-0.004110223176895826 1:0.7 2:0.7 3:0.75 4:0.42857143 \n"
+"-1 1:0.725 2:0.2 3:0.24827586 4:0.42857143 \n"
+"0.1638768425151584 1:0.725 2:0.25454545 3:0.4 4:0.42857143 \n"
+"-0.7174604370704605 1:0.725 2:0.74545455 3:0.75172414 4:0.42857143 \n"
+"0.1372581740331562 1:0.725 2:0.8 3:0.55172414 4:0.42857143 \n"
+"0.01055705620778266 1:0.75 2:0.2 3:0.54666667 4:0.42857143 \n"
+"-0.0008443805696940013 1:0.75 2:0.3 3:0.25333333 4:0.42857143 \n"
+"0.001780525801334438 1:0.75 2:0.66 3:0.4 4:0.42857143 \n"
+"0.001675251116332548 1:0.75 2:0.76 3:0.4 4:0.42857143 \n"
+"0.01323754712913269 1:0.75 2:0.76 3:0.6 4:0.42857143 \n"
+"-0.411674530569151 1:0.8 2:0.2 3:0.4 4:0.42857143 \n"
+"-1 1:0.8 2:0.2 3:0.45 4:0.42857143 \n"
+"-1 1:0.8 2:0.2 3:0.5 4:0.42857143 \n"
+"-0.75461358794671 1:0.8 2:0.2 3:0.55 4:0.42857143 \n"
+"0.2987332118889874 1:0.8 2:0.2 3:0.8 4:0.42857143 \n"
+"-0.02227962965903978 1:0.8 2:0.25 3:0.5 4:0.42857143 \n"
+"-1 1:0.8 2:0.45 3:0.5 4:0.42857143 \n"
+"0.001181195808661355 1:0.8 2:0.5 3:0.2 4:0.42857143 \n"
+"-0.6161856681782628 1:0.8 2:0.5 3:0.5 4:0.42857143 \n"
+"0.01125340726895895 1:0.8 2:0.55 3:0.2 4:0.42857143 \n"
+"-1 1:0.8 2:0.6 3:0.5 4:0.42857143 \n"
+"0.03123703831069516 1:0.8 2:0.6 3:0.8 4:0.42857143 \n"
+"0.02521815927875169 1:0.8 2:0.7 3:0.65 4:0.42857143 \n"
+"0.07336201444913903 1:0.8 2:0.8 3:0.2 4:0.42857143 \n"
+"-0.01191244330449675 1:0.8 2:0.8 3:0.4 4:0.42857143 \n"
+"-1 1:0.8 2:0.8 3:0.45 4:0.42857143 \n"
+"-1 1:0.8 2:0.8 3:0.5 4:0.42857143 \n"
+"-1 1:0.8 2:0.8 3:0.55 4:0.42857143 \n"
+"0.002198590939771857 1:0.8 2:0.8 3:0.8 4:0.42857143 \n"
+"0.3194094591056422 1:0.2 2:0.2 3:0.2 4:0.57142857 \n"
+"0.2595885432610891 1:0.2 2:0.25 3:0.8 4:0.57142857 \n"
+"-0.1770491446174749 1:0.2 2:0.45 3:0.2 4:0.57142857 \n"
+"-0.01841316628279822 1:0.2 2:0.45 3:0.54 4:0.57142857 \n"
+"-0.01268408793050939 1:0.2 2:0.45 3:0.66 4:0.57142857 \n"
+"-0.001506635066443852 1:0.2 2:0.45 3:0.76 4:0.57142857 \n"
+"0.1061722873362782 1:0.2 2:0.7 3:0.2 4:0.57142857 \n"
+"0.02238808426242592 1:0.2 2:0.7 3:0.44 4:0.57142857 \n"
+"0.05702925024283817 1:0.2 2:0.7 3:0.8 4:0.57142857 \n"
+"0.02800424883592251 1:0.2 2:0.75 3:0.2 4:0.57142857 \n"
+"0.00829044182454871 1:0.2 2:0.75 3:0.8 4:0.57142857 \n"
+"-0.07003728618346666 1:0.276 2:0.24861878 3:0.69565217 4:0.57142857 \n"
+"-0.03781633793147846 1:0.3 2:0.25142857 3:0.74666667 4:0.57142857 \n"
+"-0.03358578288225392 1:0.3 2:0.8 3:0.2 4:0.57142857 \n"
+"-0.04833751100888517 1:0.324 2:0.20118343 3:0.80246914 4:0.57142857 \n"
+"-0.004432077490535249 1:0.324 2:0.69822485 3:0.75308642 4:0.57142857 \n"
+"-0.05375455051619905 1:0.324 2:0.69822485 3:0.80246914 4:0.57142857 \n"
+"-0.01037199916183614 1:0.324 2:0.75147929 3:0.19753086 4:0.57142857 \n"
+"-0.02998256884048648 1:0.324 2:0.75147929 3:0.75308642 4:0.57142857 \n"
+"-0.02065736240185986 1:0.324 2:0.79881657 3:0.24691358 4:0.57142857 \n"
+"0.009017946376014389 1:0.376 2:0.3974359 3:0.44680851 4:0.57142857 \n"
+"-0.03792786104854817 1:0.376 2:0.5 3:0.75531915 4:0.57142857 \n"
+"0.0193021194933604 1:0.376 2:0.80128205 3:0.44680851 4:0.57142857 \n"
+"0.0684274892586022 1:0.424 2:0.20138889 3:0.60377358 4:0.57142857 \n"
+"0.2600151072698819 1:0.424 2:0.45138889 3:0.54716981 4:0.57142857 \n"
+"5.458371023339161e-05 1:0.424 2:0.65277778 3:0.54716981 4:0.57142857 \n"
+"0.006734190379347979 1:0.452 2:0.40145985 3:0.60176991 4:0.57142857 \n"
+"0.005928042087922652 1:0.452 2:0.70072993 3:0.39823009 4:0.57142857 \n"
+"0.001302010514431515 1:0.452 2:0.80291971 3:0.3539823 4:0.57142857 \n"
+"0.1716399182562681 1:0.476 2:0.19847328 3:0.20168067 4:0.57142857 \n"
+"0.004898400991859377 1:0.476 2:0.19847328 3:0.54621849 4:0.57142857 \n"
+"0.007016443173052275 1:0.476 2:0.35114504 3:0.64705882 4:0.57142857 \n"
+"0.06625124834530353 1:0.476 2:0.45038168 3:0.54621849 4:0.57142857 \n"
+"0.1005455492686157 1:0.476 2:0.54961832 3:0.49579832 4:0.57142857 \n"
+"0.01483612926449989 1:0.476 2:0.80152672 3:0.74789916 4:0.57142857 \n"
+"0.1065167994688365 1:0.5 2:0.2 3:0.2 4:0.57142857 \n"
+"0.09720847552961118 1:0.5 2:0.4 3:0.2 4:0.57142857 \n"
+"0.007485338950095891 1:0.5 2:0.552 3:0.648 4:0.57142857 \n"
+"0.002147017645761106 1:0.5 2:0.6 3:0.552 4:0.57142857 \n"
+"0.06531942867022551 1:0.524 2:0.35294118 3:0.19847328 4:0.57142857 \n"
+"0.006154569430117123 1:0.524 2:0.45378151 3:0.64885496 4:0.57142857 \n"
+"0.02958516659478695 1:0.524 2:0.69747899 3:0.19847328 4:0.57142857 \n"
+"0.09955755650528754 1:0.524 2:0.69747899 3:0.80152672 4:0.57142857 \n"
+"0.013454134094283 1:0.552 2:0.34821429 3:0.20289855 4:0.57142857 \n"
+"0.01154884317034955 1:0.6 2:0.4 3:0.2 4:0.57142857 \n"
+"0.1814901818515004 1:0.6 2:0.45 3:0.2 4:0.57142857 \n"
+"0.01778765539520384 1:0.6 2:0.5 3:0.2 4:0.57142857 \n"
+"-0.01407976429396099 1:0.6 2:0.8 3:0.4 4:0.57142857 \n"
+"-0.04252902032675845 1:0.652 2:0.1954023 3:0.6993865 4:0.57142857 \n"
+"-0.03068500352356344 1:0.652 2:0.74712644 3:0.6993865 4:0.57142857 \n"
+"-0.6083678203330157 1:0.652 2:0.8045977 3:0.6993865 4:0.57142857 \n"
+"-0.01158786855433167 1:0.676 2:0.7037037 3:0.69822485 4:0.57142857 \n"
+"0.006589358912672718 1:0.7 2:0.2 3:0.45142857 4:0.57142857 \n"
+"-0.07604407913201865 1:0.7 2:0.30666667 3:0.74857143 4:0.57142857 \n"
+"1 1:0.724 2:0.20289855 3:0.39779006 4:0.57142857 \n"
+"0.6046517325982751 1:0.724 2:0.20289855 3:0.49723757 4:0.57142857 \n"
+"0.007487814143337811 1:0.724 2:0.20289855 3:0.55248619 4:0.57142857 \n"
+"1 1:0.724 2:0.24637681 3:0.44751381 4:0.57142857 \n"
+"1 1:0.724 2:0.24637681 3:0.49723757 4:0.57142857 \n"
+"0.1392614985523932 1:0.724 2:0.5942029 3:0.44751381 4:0.57142857 \n"
+"1 1:0.724 2:0.79710145 3:0.39779006 4:0.57142857 \n"
+"1 1:0.724 2:0.79710145 3:0.44751381 4:0.57142857 \n"
+"0.1595638987993646 1:0.752 2:0.19354839 3:0.5 4:0.57142857 \n"
+"0.1422554409883132 1:0.752 2:0.19354839 3:0.54787234 4:0.57142857 \n"
+"1 1:0.752 2:0.19354839 3:0.60106383 4:0.57142857 \n"
+"1 1:0.752 2:0.25806452 3:0.39893617 4:0.57142857 \n"
+"0.3887822230849074 1:0.752 2:0.25806452 3:0.45212766 4:0.57142857 \n"
+"0.06956178280044222 1:0.752 2:0.30645161 3:0.39893617 4:0.57142857 \n"
+"0.005715940517550058 1:0.752 2:0.30645161 3:0.45212766 4:0.57142857 \n"
+"1 1:0.752 2:0.30645161 3:0.5 4:0.57142857 \n"
+"0.2722823231726074 1:0.752 2:0.4516129 3:0.45212766 4:0.57142857 \n"
+"0.3807433019550806 1:0.752 2:0.4516129 3:0.60106383 4:0.57142857 \n"
+"0.6047846303389237 1:0.752 2:0.5 3:0.60106383 4:0.57142857 \n"
+"0.001450533209966512 1:0.752 2:0.5483871 3:0.60106383 4:0.57142857 \n"
+"1 1:0.752 2:0.59677419 3:0.39893617 4:0.57142857 \n"
+"0.04827236679779165 1:0.752 2:0.64516129 3:0.45212766 4:0.57142857 \n"
+"1 1:0.752 2:0.69354839 3:0.45212766 4:0.57142857 \n"
+"0.08940208276740273 1:0.752 2:0.69354839 3:0.54787234 4:0.57142857 \n"
+"1 1:0.752 2:0.75806452 3:0.39893617 4:0.57142857 \n"
+"0.4612764083531154 1:0.752 2:0.75806452 3:0.45212766 4:0.57142857 \n"
+"1 1:0.752 2:0.75806452 3:0.54787234 4:0.57142857 \n"
+"0.01697375620298083 1:0.752 2:0.80645161 3:0.35106383 4:0.57142857 \n"
+"1 1:0.752 2:0.80645161 3:0.60106383 4:0.57142857 \n"
+"0.8552689951465782 1:0.752 2:0.80645161 3:0.64893617 4:0.57142857 \n"
+"0.002058750620567353 1:0.776 2:0.25 3:0.35051546 4:0.57142857 \n"
+"0.2791953420144616 1:0.776 2:0.25 3:0.55154639 4:0.57142857 \n"
+"0.1345475101092208 1:0.776 2:0.60714286 3:0.55154639 4:0.57142857 \n"
+"0.0241993704714513 1:0.776 2:0.69642857 3:0.40206186 4:0.57142857 \n"
+"0.0472181252384726 1:0.776 2:0.69642857 3:0.59793814 4:0.57142857 \n"
+"1 1:0.776 2:0.75 3:0.55154639 4:0.57142857 \n"
+"0.03395003741916533 1:0.776 2:0.75 3:0.59793814 4:0.57142857 \n"
+"1 1:0.8 2:0.2 3:0.2 4:0.57142857 \n"
+"-1 1:0.8 2:0.2 3:0.45 4:0.57142857 \n"
+"-0.1242092245146457 1:0.8 2:0.2 3:0.5 4:0.57142857 \n"
+"0.1786413344038866 1:0.8 2:0.2 3:0.8 4:0.57142857 \n"
+"0.4091400004316592 1:0.8 2:0.26 3:0.2 4:0.57142857 \n"
+"0.00742547942417978 1:0.8 2:0.5 3:0.2 4:0.57142857 \n"
+"0.01278724384448108 1:0.8 2:0.5 3:0.8 4:0.57142857 \n"
+"0.1256056693092899 1:0.8 2:0.54 3:0.2 4:0.57142857 \n"
+"0.09351908825411137 1:0.8 2:0.54 3:0.8 4:0.57142857 \n"
+"0.0534087520144504 1:0.8 2:0.6 3:0.2 4:0.57142857 \n"
+"0.003715294731330602 1:0.8 2:0.66 3:0.2 4:0.57142857 \n"
+"0.5218686334988335 1:0.8 2:0.8 3:0.2 4:0.57142857 \n"
+"-1 1:0.8 2:0.8 3:0.45 4:0.57142857 \n"
+"-1 1:0.8 2:0.8 3:0.5 4:0.57142857 \n"
+"0.3981250007492238 1:0.8 2:0.8 3:0.8 4:0.57142857 \n"
+"0.111914151071369 1:0.2 2:0.2 3:0.2 4:0.71428571 \n"
+"0.0572968659716748 1:0.2 2:0.25 3:0.2 4:0.71428571 \n"
+"0.01642556358498197 1:0.2 2:0.25 3:0.65 4:0.71428571 \n"
+"0.1085607185550076 1:0.2 2:0.25 3:0.8 4:0.71428571 \n"
+"-0.0341926625013421 1:0.2 2:0.45 3:0.55 4:0.71428571 \n"
+"-0.004273388014296689 1:0.2 2:0.5 3:0.2 4:0.71428571 \n"
+"-0.08648430903727522 1:0.2 2:0.5 3:0.55 4:0.71428571 \n"
+"0.04882809343522567 1:0.2 2:0.65 3:0.8 4:0.71428571 \n"
+"0.4562746725305334 1:0.2 2:0.7 3:0.2 4:0.71428571 \n"
+"0.260165246465615 1:0.2 2:0.7 3:0.8 4:0.71428571 \n"
+"0.009893925228327161 1:0.2 2:0.75 3:0.8 4:0.71428571 \n"
+"-0.08760489234924247 1:0.22666667 2:0.5 3:0.45588235 4:0.71428571 \n"
+"-0.1604490166836893 1:0.3 2:0.25238095 3:0.2 4:0.71428571 \n"
+"-0.003799302824009101 1:0.3 2:0.5 3:0.54444444 4:0.71428571 \n"
+"-0.01820707994703404 1:0.3 2:0.8 3:0.2 4:0.71428571 \n"
+"-0.03212011092809838 1:0.32666667 2:0.5990099 3:0.20408163 4:0.71428571 \n"
+"-0.1284860740404501 1:0.32666667 2:0.6980198 3:0.79591837 4:0.71428571 \n"
+"-0.03778666116493984 1:0.32666667 2:0.75247525 3:0.79591837 4:0.71428571 \n"
+"-0.08976695657381151 1:0.35 2:0.25128205 3:0.2 4:0.71428571 \n"
+"-0.03461240375063271 1:0.35 2:0.4974359 3:0.2 4:0.71428571 \n"
+"-0.2564946033361808 1:0.35 2:0.4974359 3:0.75238095 4:0.71428571 \n"
+"-0.3289527913131878 1:0.35 2:0.65128205 3:0.2 4:0.71428571 \n"
+"-0.005834621800836946 1:0.37666667 2:0.44919786 3:0.75221239 4:0.71428571 \n"
+"-0.06601418968039603 1:0.37666667 2:0.59893048 3:0.20353982 4:0.71428571 \n"
+"0.1325883126580945 1:0.4 2:0.2 3:0.45 4:0.71428571 \n"
+"0.007099834614989514 1:0.4 2:0.2 3:0.6 4:0.71428571 \n"
+"-0.03288557767774457 1:0.4 2:0.45 3:0.8 4:0.71428571 \n"
+"-0.01610169893319351 1:0.4 2:0.55 3:0.8 4:0.71428571 \n"
+"0.0499916471847751 1:0.42666667 2:0.19767442 3:0.546875 4:0.71428571 \n"
+"0.1810843460054266 1:0.42666667 2:0.75 3:0.5 4:0.71428571 \n"
+"0.001304705389312695 1:0.42666667 2:0.80232558 3:0.3515625 4:0.71428571 \n"
+"0.001861585278038589 1:0.42666667 2:0.80232558 3:0.3984375 4:0.71428571 \n"
+"0.09567508481579026 1:0.45 2:0.2 3:0.7037037 4:0.71428571 \n"
+"0.0478926354752046 1:0.45 2:0.75151515 3:0.54814815 4:0.71428571 \n"
+"0.1901165809253822 1:0.45 2:0.8 3:0.45185185 4:0.71428571 \n"
+"0.008069465815773887 1:0.47666667 2:0.19745223 3:0.65034965 4:0.71428571 \n"
+"0.02478984948039777 1:0.47666667 2:0.19745223 3:0.6993007 4:0.71428571 \n"
+"0.02008348040737596 1:0.47666667 2:0.19745223 3:0.74825175 4:0.71428571 \n"
+"0.09168899443358429 1:0.47666667 2:0.40127389 3:0.6013986 4:0.71428571 \n"
+"0.005866005129628519 1:0.47666667 2:0.5477707 3:0.3986014 4:0.71428571 \n"
+"0.009189574360956201 1:0.47666667 2:0.70063694 3:0.4965035 4:0.71428571 \n"
+"0.2271731792895608 1:0.47666667 2:0.70063694 3:0.65034965 4:0.71428571 \n"
+"0.1474306008568293 1:0.47666667 2:0.80254777 3:0.2027972 4:0.71428571 \n"
+"0.1069337790091349 1:0.47666667 2:0.80254777 3:0.7972028 4:0.71428571 \n"
+"0.1079170756181302 1:0.5 2:0.2 3:0.2 4:0.71428571 \n"
+"0.07083610142076815 1:0.5 2:0.2 3:0.8 4:0.71428571 \n"
+"0.004248171588965004 1:0.5 2:0.35333333 3:0.7 4:0.71428571 \n"
+"0.00306381509111561 1:0.5 2:0.45333333 3:0.45333333 4:0.71428571 \n"
+"0.001605178427371508 1:0.5 2:0.8 3:0.65333333 4:0.71428571 \n"
+"0.09762752482872447 1:0.5 2:0.8 3:0.8 4:0.71428571 \n"
+"0.02212882185657961 1:0.52666667 2:0.64788732 3:0.75316456 4:0.71428571 \n"
+"0.6350511950273171 1:0.52666667 2:0.6971831 3:0.20253165 4:0.71428571 \n"
+"0.003907613576416047 1:0.55 2:0.34814815 3:0.2 4:0.71428571 \n"
+"0.009391064066700046 1:0.55 2:0.65185185 3:0.2 4:0.71428571 \n"
+"0.008595365174260964 1:0.55 2:0.74814815 3:0.2 4:0.71428571 \n"
+"0.04893072745915465 1:0.55 2:0.74814815 3:0.8 4:0.71428571 \n"
+"0.1407944454583921 1:0.57666667 2:0.2992126 3:0.79768786 4:0.71428571 \n"
+"0.001646072085742538 1:0.57666667 2:0.65354331 3:0.79768786 4:0.71428571 \n"
+"-0.1988222255072646 1:0.6 2:0.25 3:0.5 4:0.71428571 \n"
+"0.02225427678759917 1:0.6 2:0.45 3:0.2 4:0.71428571 \n"
+"0.0100299923681623 1:0.6 2:0.6 3:0.2 4:0.71428571 \n"
+"-0.4915091505419731 1:0.6 2:0.7 3:0.5 4:0.71428571 \n"
+"-0.3711495780622908 1:0.6 2:0.75 3:0.45 4:0.71428571 \n"
+"-0.03845899332892895 1:0.62666667 2:0.25 3:0.5 4:0.71428571 \n"
+"-0.5528550217424721 1:0.62666667 2:0.30357143 3:0.54787234 4:0.71428571 \n"
+"-1 1:0.62666667 2:0.69642857 3:0.45212766 4:0.71428571 \n"
+"-0.0453801768157095 1:0.62666667 2:0.75 3:0.5 4:0.71428571 \n"
+"-0.04344601505881177 1:0.65 2:0.24761905 3:0.4974359 4:0.71428571 \n"
+"-1 1:0.65 2:0.35238095 3:0.4974359 4:0.71428571 \n"
+"-0.02356862664658721 1:0.65 2:0.7047619 3:0.4974359 4:0.71428571 \n"
+"-0.005916016734369745 1:0.65 2:0.75238095 3:0.45128205 4:0.71428571 \n"
+"-0.006568492156637776 1:0.67666667 2:0.19587629 3:0.25123153 4:0.71428571 \n"
+"-0.00571572251300171 1:0.67666667 2:0.19587629 3:0.69950739 4:0.71428571 \n"
+"-0.6393647800651143 1:0.67666667 2:0.75257732 3:0.25123153 4:0.71428571 \n"
+"-0.04730638409328056 1:0.67666667 2:0.75257732 3:0.74876847 4:0.71428571 \n"
+"-1 1:0.7 2:0.2 3:0.25238095 4:0.71428571 \n"
+"-0.00801468598796504 1:0.7 2:0.25555556 3:0.25238095 4:0.71428571 \n"
+"-0.1556771855142582 1:0.7 2:0.25555556 3:0.7 4:0.71428571 \n"
+"-0.08609037470548392 1:0.7 2:0.3 3:0.25238095 4:0.71428571 \n"
+"-0.0006592782168926095 1:0.7 2:0.7 3:0.75238095 4:0.71428571 \n"
+"-0.548100129202025 1:0.72666667 2:0.19512195 3:0.25229358 4:0.71428571 \n"
+"0.002433618047258437 1:0.77666667 2:0.80597015 3:0.64806867 4:0.71428571 \n"
+"0.1374125643229005 1:0.8 2:0.2 3:0.2 4:0.71428571 \n"
+"-1 1:0.8 2:0.2 3:0.4 4:0.71428571 \n"
+"-1 1:0.8 2:0.2 3:0.45 4:0.71428571 \n"
+"-1 1:0.8 2:0.2 3:0.5 4:0.71428571 \n"
+"-0.4063530938003239 1:0.8 2:0.2 3:0.55 4:0.71428571 \n"
+"0.1229067831574859 1:0.8 2:0.2 3:0.8 4:0.71428571 \n"
+"-0.5903236281969014 1:0.8 2:0.45 3:0.45 4:0.71428571 \n"
+"-0.7667805710345437 1:0.8 2:0.45 3:0.5 4:0.71428571 \n"
+"0.01390305188007804 1:0.8 2:0.45 3:0.8 4:0.71428571 \n"
+"-0.654202641206025 1:0.8 2:0.55 3:0.5 4:0.71428571 \n"
+"0.02109459348954012 1:0.8 2:0.55 3:0.8 4:0.71428571 \n"
+"-0.7387868353096932 1:0.8 2:0.6 3:0.45 4:0.71428571 \n"
+"-0.3961607097878477 1:0.8 2:0.75 3:0.45 4:0.71428571 \n"
+"-0.1534140472868994 1:0.8 2:0.75 3:0.5 4:0.71428571 \n"
+"-1 1:0.8 2:0.8 3:0.45 4:0.71428571 \n"
+"-1 1:0.8 2:0.8 3:0.5 4:0.71428571 \n"
+"-1 1:0.8 2:0.8 3:0.55 4:0.71428571 \n"
+"0.08765777920042618 1:0.2 2:0.25 3:0.8 4:0.85714286 \n"
+"0.08919286126596852 1:0.2 2:0.3 3:0.25714286 4:0.85714286 \n"
+"0.09703004367426141 1:0.2 2:0.3 3:0.3 4:0.85714286 \n"
+"0.1472637320484911 1:0.2 2:0.35 3:0.3 4:0.85714286 \n"
+"-0.09760592158359327 1:0.2 2:0.5 3:0.5 4:0.85714286 \n"
+"0.1850534718090514 1:0.2 2:0.7 3:0.8 4:0.85714286 \n"
+"-0.02919463120537171 1:0.22571429 2:0.19926199 3:0.35443038 4:0.85714286 \n"
+"-0.02390267873826181 1:0.22571429 2:0.19926199 3:0.40506329 4:0.85714286 \n"
+"-0.1987959409198143 1:0.25142857 2:0.80152672 3:0.25 4:0.85714286 \n"
+"-0.06258182174702752 1:0.25142857 2:0.80152672 3:0.60227273 4:0.85714286 \n"
+"-0.3952138464800759 1:0.27428571 2:0.2007874 3:0.25 4:0.85714286 \n"
+"-0.1174746305523112 1:0.27428571 2:0.2007874 3:0.75 4:0.85714286 \n"
+"-0.1581544805209883 1:0.27428571 2:0.7992126 3:0.19791667 4:0.85714286 \n"
+"-0.003970112150672717 1:0.27428571 2:0.7992126 3:0.64583333 4:0.85714286 \n"
+"-0.003660671874936888 1:0.27428571 2:0.7992126 3:0.69791667 4:0.85714286 \n"
+"-0.03173894509918363 1:0.27428571 2:0.7992126 3:0.75 4:0.85714286 \n"
+"-0.03978435476465098 1:0.27428571 2:0.7992126 3:0.80208333 4:0.85714286 \n"
+"-0.01161530796436529 1:0.3 2:0.2 3:0.75238095 4:0.85714286 \n"
+"-0.2205029599099313 1:0.3 2:0.2 3:0.8 4:0.85714286 \n"
+"-0.4126568151660818 1:0.3 2:0.24897959 3:0.2 4:0.85714286 \n"
+"0.0931415116326673 1:0.3 2:0.4 3:0.3047619 4:0.85714286 \n"
+"-0.1744963593364133 1:0.3 2:0.70204082 3:0.2 4:0.85714286 \n"
+"-0.05752325652171417 1:0.3 2:0.70204082 3:0.24761905 4:0.85714286 \n"
+"-0.1761851064325156 1:0.3 2:0.75102041 3:0.2 4:0.85714286 \n"
+"-0.005817148993734977 1:0.3 2:0.8 3:0.24761905 4:0.85714286 \n"
+"-0.002679279758798603 1:0.32571429 2:0.25 3:0.20175439 4:0.85714286 \n"
+"-0.3221602003687812 1:0.32571429 2:0.25 3:0.79824561 4:0.85714286 \n"
+"-0.737361617428408 1:0.32571429 2:0.75 3:0.79824561 4:0.85714286 \n"
+"-0.003322686834884509 1:0.35142857 2:0.25110132 3:0.20325203 4:0.85714286 \n"
+"-0.02118102981646922 1:0.35142857 2:0.25110132 3:0.79674797 4:0.85714286 \n"
+"-0.1537205937635201 1:0.37428571 2:0.49771689 3:0.80152672 4:0.85714286 \n"
+"-0.02436208471438989 1:0.37428571 2:0.54794521 3:0.80152672 4:0.85714286 \n"
+"0.001465247310473992 1:0.4 2:0.35238095 3:0.35 4:0.85714286 \n"
+"-0.02514627941119762 1:0.4 2:0.54761905 3:0.8 4:0.85714286 \n"
+"0.0007528676692827168 1:0.42571429 2:0.19900498 3:0.4966443 4:0.85714286 \n"
+"0.09663760466820218 1:0.42571429 2:0.19900498 3:0.59731544 4:0.85714286 \n"
+"0.0250982158554981 1:0.42571429 2:0.34825871 3:0.59731544 4:0.85714286 \n"
+"0.1535762870533227 1:0.42571429 2:0.39800995 3:0.40268456 4:0.85714286 \n"
+"0.007813937418602163 1:0.42571429 2:0.39800995 3:0.44966443 4:0.85714286 \n"
+"0.04244592748379604 1:0.42571429 2:0.70149254 3:0.40268456 4:0.85714286 \n"
+"0.001251602678778133 1:0.42571429 2:0.80099502 3:0.34899329 4:0.85714286 \n"
+"0.03689287249224704 1:0.42571429 2:0.80099502 3:0.40268456 4:0.85714286 \n"
+"0.09634633942990406 1:0.42571429 2:0.80099502 3:0.55033557 4:0.85714286 \n"
+"0.1067483802779254 1:0.45142857 2:0.19791667 3:0.60126582 4:0.85714286 \n"
+"0.05194828423393814 1:0.45142857 2:0.40104167 3:0.34810127 4:0.85714286 \n"
+"0.00648325215856319 1:0.45142857 2:0.5 3:0.60126582 4:0.85714286 \n"
+"0.1462724065451693 1:0.45142857 2:0.55208333 3:0.55063291 4:0.85714286 \n"
+"0.251023909851048 1:0.45142857 2:0.59895833 3:0.44936709 4:0.85714286 \n"
+"0.09861577214730943 1:0.45142857 2:0.69791667 3:0.55063291 4:0.85714286 \n"
+"0.03816618341572179 1:0.45142857 2:0.80208333 3:0.39873418 4:0.85714286 \n"
+"0.09249947071339552 1:0.45142857 2:0.80208333 3:0.65189873 4:0.85714286 \n"
+"0.1282268295778642 1:0.47428571 2:0.40217391 3:0.34939759 4:0.85714286 \n"
+"0.001598595574615017 1:0.47428571 2:0.40217391 3:0.39759036 4:0.85714286 \n"
+"0.0027079213097985 1:0.47428571 2:0.5 3:0.39759036 4:0.85714286 \n"
+"0.01094000021594465 1:0.47428571 2:0.65217391 3:0.65060241 4:0.85714286 \n"
+"0.02298232609024991 1:0.47428571 2:0.70108696 3:0.65060241 4:0.85714286 \n"
+"0.4296933716061567 1:0.47428571 2:0.79891304 3:0.19879518 4:0.85714286 \n"
+"0.8343466157357079 1:0.5 2:0.2 3:0.2 4:0.85714286 \n"
+"0.2523643947897962 1:0.5 2:0.25142857 3:0.74857143 4:0.85714286 \n"
+"0.4142315803658484 1:0.5 2:0.4 3:0.6 4:0.85714286 \n"
+"0.3018496837736072 1:0.5 2:0.4 3:0.65142857 4:0.85714286 \n"
+"0.0002207790313124873 1:0.5 2:0.45142857 3:0.4 4:0.85714286 \n"
+"0.008990049650869711 1:0.5 2:0.6 3:0.6 4:0.85714286 \n"
+"0.05263990146615539 1:0.5 2:0.8 3:0.2 4:0.85714286 \n"
+"0.3216141071195111 1:0.52571429 2:0.19879518 3:0.79891304 4:0.85714286 \n"
+"0.3011568545021911 1:0.52571429 2:0.34939759 3:0.65217391 4:0.85714286 \n"
+"0.3548605104929952 1:0.52571429 2:0.34939759 3:0.75 4:0.85714286 \n"
+"0.01578506777975728 1:0.52571429 2:0.39759036 3:0.20108696 4:0.85714286 \n"
+"0.01715414279907337 1:0.52571429 2:0.75301205 3:0.20108696 4:0.85714286 \n"
+"0.5506114582683926 1:0.52571429 2:0.75301205 3:0.79891304 4:0.85714286 \n"
+"0.0009666660785980828 1:0.55142857 2:0.29936306 3:0.79792746 4:0.85714286 \n"
+"0.07844443501410032 1:0.55142857 2:0.35031847 3:0.20207254 4:0.85714286 \n"
+"0.002182260890589953 1:0.55142857 2:0.35031847 3:0.79792746 4:0.85714286 \n"
+"0.07956385038703545 1:0.55142857 2:0.5477707 3:0.20207254 4:0.85714286 \n"
+"0.3205002115948544 1:0.55142857 2:0.64968153 3:0.79792746 4:0.85714286 \n"
+"0.5635618037113714 1:0.55142857 2:0.70063694 3:0.79792746 4:0.85714286 \n"
+"0.01813744218617384 1:0.57428571 2:0.40268456 3:0.19900498 4:0.85714286 \n"
+"0.531148854251225 1:0.57428571 2:0.4966443 3:0.19900498 4:0.85714286 \n"
+"0.1228966024883945 1:0.57428571 2:0.55033557 3:0.19900498 4:0.85714286 \n"
+"0.08456581834615864 1:0.57428571 2:0.65100671 3:0.19900498 4:0.85714286 \n"
+"-0.2488456036209035 1:0.6 2:0.25 3:0.5 4:0.85714286 \n"
+"-0.4435084889722834 1:0.6 2:0.25 3:0.54761905 4:0.85714286 \n"
+"-0.8345928987551059 1:0.6 2:0.3 3:0.5 4:0.85714286 \n"
+"-0.2430580115790844 1:0.6 2:0.7 3:0.5 4:0.85714286 \n"
+"-0.07133136063096064 1:0.6 2:0.75 3:0.5 4:0.85714286 \n"
+"-0.1127187716029414 1:0.62571429 2:0.2519084 3:0.45205479 4:0.85714286 \n"
+"-0.01206280303133767 1:0.62571429 2:0.2519084 3:0.49771689 4:0.85714286 \n"
+"-1 1:0.62571429 2:0.2519084 3:0.54794521 4:0.85714286 \n"
+"-0.06617187775307089 1:0.62571429 2:0.29770992 3:0.49771689 4:0.85714286 \n"
+"-0.0211889620280756 1:0.62571429 2:0.64885496 3:0.49771689 4:0.85714286 \n"
+"-0.2358266303011922 1:0.62571429 2:0.70229008 3:0.30136986 4:0.85714286 \n"
+"-0.1174084939463452 1:0.62571429 2:0.70229008 3:0.54794521 4:0.85714286 \n"
+"-1 1:0.62571429 2:0.7480916 3:0.54794521 4:0.85714286 \n"
+"-0.5933492724293927 1:0.62571429 2:0.7480916 3:0.69863014 4:0.85714286 \n"
+"-0.2102256430661912 1:0.65142857 2:0.25409836 3:0.60087719 4:0.85714286 \n"
+"-0.002082227232839903 1:0.65142857 2:0.64754098 3:0.5 4:0.85714286 \n"
+"-0.02504777965716789 1:0.65142857 2:0.80327869 3:0.25 4:0.85714286 \n"
+"-0.1265138037680781 1:0.67428571 2:0.25438596 3:0.25 4:0.85714286 \n"
+"-0.09040048893231334 1:0.67428571 2:0.25438596 3:0.69915254 4:0.85714286 \n"
+"-1 1:0.67428571 2:0.25438596 3:0.75 4:0.85714286 \n"
+"-1 1:0.67428571 2:0.29824561 3:0.25 4:0.85714286 \n"
+"-0.124044199434486 1:0.67428571 2:0.29824561 3:0.69915254 4:0.85714286 \n"
+"-0.4712389738651734 1:0.67428571 2:0.64912281 3:0.69915254 4:0.85714286 \n"
+"-0.8985785571914334 1:0.67428571 2:0.70175439 3:0.25 4:0.85714286 \n"
+"-1 1:0.67428571 2:0.75438596 3:0.25 4:0.85714286 \n"
+"-0.02008988290526038 1:0.67428571 2:0.79824561 3:0.75 4:0.85714286 \n"
+"-0.06749479863679134 1:0.7 2:0.2 3:0.24897959 4:0.85714286 \n"
+"-0.2116589932740051 1:0.7 2:0.3047619 3:0.24897959 4:0.85714286 \n"
+"-0.01270680354331095 1:0.7 2:0.35238095 3:0.24897959 4:0.85714286 \n"
+"-0.2476868768683578 1:0.7 2:0.4 3:0.24897959 4:0.85714286 \n"
+"-1 1:0.7 2:0.7047619 3:0.75102041 4:0.85714286 \n"
+"-0.177226038197963 1:0.7 2:0.75238095 3:0.24897959 4:0.85714286 \n"
+"-0.7036854230085693 1:0.7 2:0.75238095 3:0.75102041 4:0.85714286 \n"
+"-0.002599878957436338 1:0.72571429 2:0.19791667 3:0.2519685 4:0.85714286 \n"
+"0.5553476751488744 1:0.72571429 2:0.19791667 3:0.4015748 4:0.85714286 \n"
+"-0.01002580419227577 1:0.72571429 2:0.25 3:0.2519685 4:0.85714286 \n"
+"-0.2980767656719146 1:0.72571429 2:0.25 3:0.7519685 4:0.85714286 \n"
+"-0.06719697119983729 1:0.72571429 2:0.30208333 3:0.7519685 4:0.85714286 \n"
+"-0.3275892093015475 1:0.72571429 2:0.35416667 3:0.2519685 4:0.85714286 \n"
+"-0.03050478002482472 1:0.72571429 2:0.69791667 3:0.7519685 4:0.85714286 \n"
+"0.09366558925133391 1:0.72571429 2:0.80208333 3:0.4015748 4:0.85714286 \n"
+"1 1:0.75142857 2:0.1954023 3:0.39923954 4:0.85714286 \n"
+"1 1:0.75142857 2:0.1954023 3:0.5513308 4:0.85714286 \n"
+"1 1:0.75142857 2:0.25287356 3:0.39923954 4:0.85714286 \n"
+"0.7548424542608771 1:0.75142857 2:0.25287356 3:0.4486692 4:0.85714286 \n"
+"0.5751555828244868 1:0.75142857 2:0.25287356 3:0.49809886 4:0.85714286 \n"
+"1 1:0.75142857 2:0.25287356 3:0.60076046 4:0.85714286 \n"
+"1 1:0.75142857 2:0.29885057 3:0.39923954 4:0.85714286 \n"
+"-0.1486200869932708 1:0.75142857 2:0.34482759 3:0.20152091 4:0.85714286 \n"
+"0.007660383136791137 1:0.75142857 2:0.34482759 3:0.60076046 4:0.85714286 \n"
+"0.3583576259088807 1:0.75142857 2:0.49425287 3:0.60076046 4:0.85714286 \n"
+"0.4801991654945708 1:0.75142857 2:0.55172414 3:0.39923954 4:0.85714286 \n"
+"0.8441041300991878 1:0.75142857 2:0.70114943 3:0.49809886 4:0.85714286 \n"
+"1 1:0.75142857 2:0.74712644 3:0.39923954 4:0.85714286 \n"
+"0.309917918662752 1:0.75142857 2:0.74712644 3:0.4486692 4:0.85714286 \n"
+"1 1:0.75142857 2:0.74712644 3:0.5513308 4:0.85714286 \n"
+"0.4119164281399212 1:0.75142857 2:0.8045977 3:0.39923954 4:0.85714286 \n"
+"0.02864435625264824 1:0.75142857 2:0.8045977 3:0.4486692 4:0.85714286 \n"
+"1 1:0.75142857 2:0.8045977 3:0.5513308 4:0.85714286 \n"
+"0.2090177831217086 1:0.77428571 2:0.20253165 3:0.60147601 4:0.85714286 \n"
+"0.2967601798030067 1:0.77428571 2:0.25316456 3:0.35055351 4:0.85714286 \n"
+"1 1:0.77428571 2:0.25316456 3:0.39852399 4:0.85714286 \n"
+"0.1226401752491351 1:0.77428571 2:0.25316456 3:0.5498155 4:0.85714286 \n"
+"0.1089346134758622 1:0.77428571 2:0.25316456 3:0.60147601 4:0.85714286 \n"
+"0.001536588079682942 1:0.77428571 2:0.35443038 3:0.64944649 4:0.85714286 \n"
+"0.07185555400458639 1:0.77428571 2:0.59493671 3:0.60147601 4:0.85714286 \n"
+"0.004484529922136751 1:0.77428571 2:0.59493671 3:0.64944649 4:0.85714286 \n"
+"0.001553007252178545 1:0.77428571 2:0.64556962 3:0.39852399 4:0.85714286 \n"
+"0.5407059569140784 1:0.77428571 2:0.69620253 3:0.39852399 4:0.85714286 \n"
+"0.1181015935779041 1:0.77428571 2:0.69620253 3:0.60147601 4:0.85714286 \n"
+"0.6534752253511928 1:0.77428571 2:0.74683544 3:0.35055351 4:0.85714286 \n"
+"0.05156169695670536 1:0.77428571 2:0.74683544 3:0.39852399 4:0.85714286 \n"
+"0.01684974695714773 1:0.77428571 2:0.74683544 3:0.5498155 4:0.85714286 \n"
+"1 1:0.77428571 2:0.74683544 3:0.60147601 4:0.85714286 \n"
+"0.6988842941285649 1:0.77428571 2:0.79746835 3:0.35055351 4:0.85714286 \n"
+"0.2257905895779414 1:0.77428571 2:0.79746835 3:0.60147601 4:0.85714286 \n"
+"0.1331604254747003 1:0.77428571 2:0.79746835 3:0.64944649 4:0.85714286 \n"
+"0.286561201541061 1:0.8 2:0.2 3:0.2 4:0.85714286 \n"
+"-1 1:0.8 2:0.2 3:0.45 4:0.85714286 \n"
+"-0.4446614518088314 1:0.8 2:0.2 3:0.5 4:0.85714286 \n"
+"0.009844897220184006 1:0.8 2:0.25714286 3:0.65 4:0.85714286 \n"
+"0.1947211367397144 1:0.8 2:0.4 3:0.65 4:0.85714286 \n"
+"0.2241666247189819 1:0.8 2:0.75714286 3:0.65 4:0.85714286 \n"
+"-0.2179287099307207 1:0.8 2:0.8 3:0.45 4:0.85714286 \n"
+"-1 1:0.8 2:0.8 3:0.5 4:0.85714286 \n"
+"0.7701382046363671 1:0.2 2:0.2 3:0.2 4:1 \n"
+"0.022912806676384 1:0.2 2:0.2 3:0.55 4:1 \n"
+"0.007204062692520255 1:0.2 2:0.2 3:0.65 4:1 \n"
+"0.03395401032147928 1:0.2 2:0.2 3:0.8 4:1 \n"
+"0.005299703845324283 1:0.2 2:0.25 3:0.55 4:1 \n"
+"0.003125880171505727 1:0.2 2:0.25 3:0.6 4:1 \n"
+"0.2783647026239084 1:0.2 2:0.25 3:0.8 4:1 \n"
+"-0.4716423808737542 1:0.2 2:0.45 3:0.2 4:1 \n"
+"-0.2734590453977904 1:0.2 2:0.45 3:0.7 4:1 \n"
+"-0.07028503477929243 1:0.2 2:0.5 3:0.2 4:1 \n"
+"-0.05017350694866365 1:0.2 2:0.5 3:0.75 4:1 \n"
+"0.5186546710497647 1:0.2 2:0.7 3:0.2 4:1 \n"
+"0.004645560524967936 1:0.2 2:0.7 3:0.45 4:1 \n"
+"0.001353172908302549 1:0.2 2:0.75 3:0.4 4:1 \n"
+"0.003406749978541838 1:0.2 2:0.75 3:0.5 4:1 \n"
+"0.08622486459118847 1:0.2 2:0.75 3:0.6 4:1 \n"
+"0.1017965163725525 1:0.2 2:0.75 3:0.8 4:1 \n"
+"0.07658942430814428 1:0.2 2:0.8 3:0.8 4:1 \n"
+"-0.4843176676550269 1:0.275 2:0.25172414 3:0.2 4:1 \n"
+"-0.006136227295083907 1:0.275 2:0.75172414 3:0.25454545 4:1 \n"
+"-0.001887771612514745 1:0.275 2:0.75172414 3:0.75454545 4:1 \n"
+"-0.002956545153611366 1:0.3 2:0.25 3:0.2 4:1 \n"
+"-0.05778072982023798 1:0.3 2:0.25 3:0.75 4:1 \n"
+"-0.1077811657290382 1:0.325 2:0.25185185 3:0.2 4:1 \n"
+"0.009278336488820262 1:0.325 2:0.44814815 3:0.35384615 4:1 \n"
+"-0.03188703124654534 1:0.325 2:0.7 3:0.25384615 4:1 \n"
+"-0.09743974820498237 1:0.35 2:0.7 3:0.25 4:1 \n"
+"-0.05242498313990111 1:0.35 2:0.75 3:0.25 4:1 \n"
+"0.03935646293484464 1:0.375 2:0.4 3:0.4 4:1 \n"
+"0.01629838011267691 1:0.375 2:0.4 3:0.45333333 4:1 \n"
+"0.1192411418537781 1:0.4 2:0.2 3:0.55 4:1 \n"
+"0.01485863724009909 1:0.4 2:0.4 3:0.35 4:1 \n"
+"0.1160490637113425 1:0.4 2:0.45 3:0.5 4:1 \n"
+"0.03299635349014299 1:0.4 2:0.8 3:0.55 4:1 \n"
+"0.007956533238726556 1:0.425 2:0.2 3:0.5 4:1 \n"
+"0.02024089914480534 1:0.425 2:0.44782609 3:0.44705882 4:1 \n"
+"0.02391431149676934 1:0.425 2:0.44782609 3:0.6 4:1 \n"
+"0.03174219641038035 1:0.425 2:0.8 3:0.4 4:1 \n"
+"0.02432377503766425 1:0.425 2:0.8 3:0.44705882 4:1 \n"
+"0.02363694053946517 1:0.45 2:0.8 3:0.55 4:1 \n"
+"0.001042736159722426 1:0.475 2:0.2 3:0.8 4:1 \n"
+"0.1447975643701009 1:0.475 2:0.44761905 3:0.2 4:1 \n"
+"0.1038593739161337 1:0.475 2:0.44761905 3:0.6 4:1 \n"
+"0.1844812132607302 1:0.475 2:0.8 3:0.2 4:1 \n"
+"0.04093814386745822 1:0.5 2:0.2 3:0.8 4:1 \n"
+"0.05142898821652411 1:0.5 2:0.4 3:0.2 4:1 \n"
+"0.002165661552251341 1:0.5 2:0.45 3:0.2 4:1 \n"
+"0.00519431839200823 1:0.5 2:0.5 3:0.2 4:1 \n"
+"0.1718653493752084 1:0.5 2:0.8 3:0.8 4:1 \n"
+"0.4049712339593572 1:0.525 2:0.2 3:0.2 4:1 \n"
+"0.14832728498623 1:0.525 2:0.2 3:0.8 4:1 \n"
+"0.01100027845534088 1:0.525 2:0.35263158 3:0.8 4:1 \n"
+"0.05651520976883886 1:0.525 2:0.54736842 3:0.2 4:1 \n"
+"0.06091146364266471 1:0.525 2:0.65263158 3:0.8 4:1 \n"
+"0.2762992443402494 1:0.55 2:0.45 3:0.8 4:1 \n"
+"0.5257993965504466 1:0.55 2:0.6 3:0.2 4:1 \n"
+"0.1938012762203732 1:0.55 2:0.65 3:0.8 4:1 \n"
+"-0.04732871121984281 1:0.575 2:0.3 3:0.44782609 4:1 \n"
+"-1 1:0.575 2:0.3 3:0.54782609 4:1 \n"
+"0.04876195737874708 1:0.575 2:0.44705882 3:0.2 4:1 \n"
+"-0.17247502590852 1:0.575 2:0.65294118 3:0.4 4:1 \n"
+"-0.02949564419735785 1:0.6 2:0.25 3:0.55 4:1 \n"
+"-0.07944313097997377 1:0.6 2:0.3 3:0.55 4:1 \n"
+"-0.007423242548971131 1:0.6 2:0.35 3:0.45 4:1 \n"
+"-0.006907327875827325 1:0.6 2:0.35 3:0.55 4:1 \n"
+"-0.006865100690315262 1:0.6 2:0.4 3:0.5 4:1 \n"
+"-0.003994656142166409 1:0.6 2:0.6 3:0.5 4:1 \n"
+"-0.2843697251301747 1:0.6 2:0.7 3:0.5 4:1 \n"
+"-0.1382891222607892 1:0.6 2:0.7 3:0.65 4:1 \n"
+"-0.1058950421548418 1:0.6 2:0.75 3:0.7 4:1 \n"
+"-0.01227909611307111 1:0.625 2:0.25333333 3:0.252 4:1 \n"
+"-0.04316747796113499 1:0.625 2:0.25333333 3:0.652 4:1 \n"
+"-0.1800465211948526 1:0.625 2:0.3 3:0.252 4:1 \n"
+"-0.3378602416990719 1:0.625 2:0.3 3:0.548 4:1 \n"
+"-0.02013321846626782 1:0.625 2:0.4 3:0.3 4:1 \n"
+"-0.03065237333546398 1:0.625 2:0.4 3:0.448 4:1 \n"
+"-0.003082092015115281 1:0.625 2:0.65333333 3:0.5 4:1 \n"
+"-1 1:0.625 2:0.65333333 3:0.548 4:1 \n"
+"-0.02311762179361539 1:0.625 2:0.65333333 3:0.652 4:1 \n"
+"-0.1084896037828497 1:0.625 2:0.7 3:0.252 4:1 \n"
+"-0.5375509877413922 1:0.625 2:0.7 3:0.3 4:1 \n"
+"-0.00480943170214846 1:0.625 2:0.7 3:0.5 4:1 \n"
+"-0.1318946959076682 1:0.625 2:0.75333333 3:0.3 4:1 \n"
+"-1 1:0.65 2:0.25 3:0.25 4:1 \n"
+"-0.004211555208391299 1:0.65 2:0.3 3:0.25 4:1 \n"
+"-0.2293400078540429 1:0.65 2:0.3 3:0.65 4:1 \n"
+"-0.004736591096826993 1:0.65 2:0.35 3:0.25 4:1 \n"
+"-0.001279831412365493 1:0.65 2:0.5 3:0.3 4:1 \n"
+"-0.001542137654182646 1:0.65 2:0.6 3:0.55 4:1 \n"
+"-0.1036915794062673 1:0.65 2:0.6 3:0.7 4:1 \n"
+"-1 1:0.65 2:0.65 3:0.25 4:1 \n"
+"-0.06551477716126226 1:0.65 2:0.7 3:0.25 4:1 \n"
+"-0.06613931630571263 1:0.65 2:0.7 3:0.7 4:1 \n"
+"-0.2895275908723252 1:0.65 2:0.75 3:0.75 4:1 \n"
+"-0.02432563932156021 1:0.65 2:0.8 3:0.7 4:1 \n"
+"-0.005489093884508384 1:0.675 2:0.2 3:0.25185185 4:1 \n"
+"-0.5101318600084738 1:0.675 2:0.25384615 3:0.75185185 4:1 \n"
+"-0.2925830051653954 1:0.675 2:0.3 3:0.75185185 4:1 \n"
+"-0.06702209214609454 1:0.675 2:0.35384615 3:0.25185185 4:1 \n"
+"-0.01050359350112916 1:0.675 2:0.65384615 3:0.25185185 4:1 \n"
+"-0.285954228358017 1:0.675 2:0.7 3:0.75185185 4:1 \n"
+"-0.2119976736847874 1:0.7 2:0.2 3:0.25 4:1 \n"
+"0.004210653049139839 1:0.7 2:0.2 3:0.45 4:1 \n"
+"0.3029701164850029 1:0.7 2:0.2 3:0.5 4:1 \n"
+"-0.07935876351705756 1:0.7 2:0.25 3:0.25 4:1 \n"
+"-0.005833378759883277 1:0.7 2:0.4 3:0.25 4:1 \n"
+"-0.7318370573478258 1:0.7 2:0.7 3:0.75 4:1 \n"
+"-1 1:0.725 2:0.2 3:0.25172414 4:1 \n"
+"0.002872605074246928 1:0.725 2:0.2 3:0.45172414 4:1 \n"
+"0.6026875636179937 1:0.725 2:0.2 3:0.5 4:1 \n"
+"0.8051189196894369 1:0.725 2:0.25454545 3:0.4 4:1 \n"
+"1 1:0.725 2:0.25454545 3:0.45172414 4:1 \n"
+"0.519762122601788 1:0.725 2:0.25454545 3:0.5 4:1 \n"
+"0.3401037185533743 1:0.725 2:0.3 3:0.45172414 4:1 \n"
+"0.9708763782257754 1:0.725 2:0.8 3:0.4 4:1 \n"
+"0.336159430127944 1:0.725 2:0.8 3:0.6 4:1 \n"
+"0.3181570100264368 1:0.75 2:0.2 3:0.6 4:1 \n"
+"1 1:0.75 2:0.25 3:0.4 4:1 \n"
+"1 1:0.75 2:0.25 3:0.45 4:1 \n"
+"0.2772796779742901 1:0.75 2:0.25 3:0.5 4:1 \n"
+"1 1:0.75 2:0.25 3:0.55 4:1 \n"
+"0.3047767591702688 1:0.75 2:0.25 3:0.6 4:1 \n"
+"0.008159285965778237 1:0.75 2:0.3 3:0.4 4:1 \n"
+"0.4273531419079107 1:0.75 2:0.3 3:0.6 4:1 \n"
+"0.04634433359752101 1:0.75 2:0.35 3:0.5 4:1 \n"
+"0.2057967253695801 1:0.75 2:0.6 3:0.4 4:1 \n"
+"1 1:0.75 2:0.6 3:0.55 4:1 \n"
+"0.8702115064058801 1:0.75 2:0.65 3:0.6 4:1 \n"
+"1 1:0.75 2:0.7 3:0.4 4:1 \n"
+"1 1:0.75 2:0.7 3:0.45 4:1 \n"
+"0.7128060380885816 1:0.75 2:0.7 3:0.5 4:1 \n"
+"1 1:0.75 2:0.7 3:0.55 4:1 \n"
+"1 1:0.75 2:0.7 3:0.6 4:1 \n"
+"0.3014104995700555 1:0.75 2:0.75 3:0.35 4:1 \n"
+"0.9481422857015841 1:0.75 2:0.75 3:0.4 4:1 \n"
+"1 1:0.75 2:0.8 3:0.6 4:1 \n"
+"0.06965804196080849 1:0.775 2:0.25555556 3:0.3516129 4:1 \n"
+"0.1681580499760123 1:0.775 2:0.34444444 3:0.6 4:1 \n"
+"0.01005580801730846 1:0.775 2:0.54444444 3:0.3516129 4:1 \n"
+"0.5914353948629942 1:0.775 2:0.6 3:0.4 4:1 \n"
+"0.02075841330356008 1:0.775 2:0.7 3:0.3516129 4:1 \n"
+"0.04709816856807648 1:0.775 2:0.7 3:0.6 4:1 \n"
+"1 1:0.8 2:0.2 3:0.2 4:1 \n"
+"-0.1463880022275328 1:0.8 2:0.2 3:0.3 4:1 \n"
+"-1 1:0.8 2:0.2 3:0.35 4:1 \n"
+"-1 1:0.8 2:0.2 3:0.4 4:1 \n"
+"-1 1:0.8 2:0.2 3:0.45 4:1 \n"
+"-1 1:0.8 2:0.2 3:0.5 4:1 \n"
+"-1 1:0.8 2:0.2 3:0.55 4:1 \n"
+"0.6319473117775735 1:0.8 2:0.2 3:0.8 4:1 \n"
+"1 1:0.8 2:0.25 3:0.2 4:1 \n"
+"-1 1:0.8 2:0.25 3:0.45 4:1 \n"
+"-1 1:0.8 2:0.25 3:0.5 4:1 \n"
+"0.009428333112103825 1:0.8 2:0.3 3:0.2 4:1 \n"
+"-0.2332948670645713 1:0.8 2:0.3 3:0.5 4:1 \n"
+"-0.1496338278930457 1:0.8 2:0.4 3:0.45 4:1 \n"
+"-0.5087834825808425 1:0.8 2:0.45 3:0.5 4:1 \n"
+"0.00192176388767527 1:0.8 2:0.5 3:0.2 4:1 \n"
+"-0.7111071952312533 1:0.8 2:0.5 3:0.45 4:1 \n"
+"-0.01444407952319081 1:0.8 2:0.5 3:0.5 4:1 \n"
+"0.07360896881238908 1:0.8 2:0.55 3:0.2 4:1 \n"
+"-1 1:0.8 2:0.55 3:0.5 4:1 \n"
+"0.2640513445664476 1:0.8 2:0.55 3:0.8 4:1 \n"
+"0.1122599329843315 1:0.8 2:0.6 3:0.2 4:1 \n"
+"-0.4434275352399362 1:0.8 2:0.6 3:0.5 4:1 \n"
+"0.03478630367088049 1:0.8 2:0.65 3:0.2 4:1 \n"
+"-1 1:0.8 2:0.65 3:0.5 4:1 \n"
+"-1 1:0.8 2:0.7 3:0.5 4:1 \n"
+"-1 1:0.8 2:0.75 3:0.45 4:1 \n"
+"-1 1:0.8 2:0.75 3:0.5 4:1 \n"
+"0.6796334291542261 1:0.8 2:0.8 3:0.2 4:1 \n"
+"-0.1698672787287688 1:0.8 2:0.8 3:0.35 4:1 \n"
+"-1 1:0.8 2:0.8 3:0.4 4:1 \n"
+"-1 1:0.8 2:0.8 3:0.45 4:1 \n"
+"-1 1:0.8 2:0.8 3:0.5 4:1 \n"
+"-1 1:0.8 2:0.8 3:0.55 4:1 \n"
+"-0.0310377630670289 1:0.8 2:0.8 3:0.6 4:1 \n"
+"0.6119531131910538 1:0.8 2:0.8 3:0.8 4:1 \n";
diff --git a/C/ViennaRNA/model_sd.inc b/C/ViennaRNA/model_sd.inc
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/model_sd.inc
@@ -0,0 +1,1068 @@
+char* sd_model_string=
+"svm_type nu_svr\n"
+"kernel_type rbf\n"
+"gamma 7\n"
+"nr_class 2\n"
+"total_sv 1060\n"
+"rho -0.187768\n"
+"SV\n"
+"-0.7363563768676624 1:0.2 2:0.2 3:0.2 4:0 \n"
+"-1 1:0.2 2:0.2 3:0.4 4:0 \n"
+"-0.5817626972471229 1:0.2 2:0.2 3:0.6 4:0 \n"
+"-0.4178464036231969 1:0.2 2:0.25 3:0.7 4:0 \n"
+"0.07807074474787239 1:0.2 2:0.3 3:0.4 4:0 \n"
+"0.9523642403699546 1:0.2 2:0.55 3:0.7 4:0 \n"
+"0.6398678471913775 1:0.2 2:0.65 3:0.2 4:0 \n"
+"-1 1:0.2 2:0.75 3:0.2 4:0 \n"
+"-1 1:0.2 2:0.75 3:0.4 4:0 \n"
+"-0.4313097127070922 1:0.2 2:0.75 3:0.6 4:0 \n"
+"-0.4870752319526939 1:0.2 2:0.75 3:0.8 4:0 \n"
+"-0.6950639820227301 1:0.22 2:0.20512821 3:0.72727273 4:0 \n"
+"0.9771153944690636 1:0.22 2:0.30769231 3:0.45454545 4:0 \n"
+"0.4925134087753923 1:0.22 2:0.41025641 3:0.18181818 4:0 \n"
+"-0.2487246380748831 1:0.22 2:0.79487179 3:0.18181818 4:0 \n"
+"-1 1:0.22 2:0.79487179 3:0.36363636 4:0 \n"
+"-0.6547084088405088 1:0.22 2:0.79487179 3:0.45454545 4:0 \n"
+"-1 1:0.26 2:0.18918919 3:0.69230769 4:0 \n"
+"0.6065056116371278 1:0.26 2:0.24324324 3:0.61538462 4:0 \n"
+"0.1644717660251948 1:0.26 2:0.40540541 3:0.76923077 4:0 \n"
+"1 1:0.26 2:0.7027027 3:0.30769231 4:0 \n"
+"0.9898992118889675 1:0.26 2:0.75675676 3:0.38461538 4:0 \n"
+"-0.9366794506156393 1:0.28 2:0.44444444 3:0.57142857 4:0 \n"
+"-1 1:0.28 2:0.55555556 3:0.5 4:0 \n"
+"0.8603145833954182 1:0.28 2:0.61111111 3:0.21428571 4:0 \n"
+"1 1:0.28 2:0.69444444 3:0.42857143 4:0 \n"
+"0.5396227936950618 1:0.3 2:0.2 3:0.4 4:0 \n"
+"1 1:0.3 2:0.31428571 3:0.66666667 4:0 \n"
+"1 1:0.3 2:0.71428571 3:0.4 4:0 \n"
+"-1 1:0.3 2:0.8 3:0.2 4:0 \n"
+"1 1:0.32 2:0.20588235 3:0.375 4:0 \n"
+"0.8363269611810621 1:0.32 2:0.26470588 3:0.1875 4:0 \n"
+"1 1:0.32 2:0.26470588 3:0.75 4:0 \n"
+"1 1:0.32 2:0.41176471 3:0.3125 4:0 \n"
+"-1 1:0.32 2:0.44117647 3:0.1875 4:0 \n"
+"1 1:0.32 2:0.5 3:0.4375 4:0 \n"
+"-1 1:0.32 2:0.55882353 3:0.8125 4:0 \n"
+"1 1:0.32 2:0.70588235 3:0.375 4:0 \n"
+"-0.2716257869415996 1:0.32 2:0.79411765 3:0.1875 4:0 \n"
+"1 1:0.36 2:0.25 3:0.72222222 4:0 \n"
+"0.9460857435038026 1:0.36 2:0.3125 3:0.44444444 4:0 \n"
+"1 1:0.36 2:0.3125 3:0.55555556 4:0 \n"
+"-1 1:0.36 2:0.34375 3:0.38888889 4:0 \n"
+"-1 1:0.36 2:0.40625 3:0.33333333 4:0 \n"
+"-1 1:0.36 2:0.5 3:0.44444444 4:0 \n"
+"0.4666911153940065 1:0.38 2:0.19354839 3:0.21052632 4:0 \n"
+"-0.3679093797612711 1:0.38 2:0.19354839 3:0.78947368 4:0 \n"
+"-1 1:0.38 2:0.25806452 3:0.31578947 4:0 \n"
+"-1 1:0.38 2:0.35483871 3:0.31578947 4:0 \n"
+"-0.5244997336393352 1:0.38 2:0.38709677 3:0.36842105 4:0 \n"
+"-0.5942033352043439 1:0.38 2:0.38709677 3:0.63157895 4:0 \n"
+"0.6553693633612112 1:0.38 2:0.5483871 3:0.26315789 4:0 \n"
+"1 1:0.38 2:0.5483871 3:0.57894737 4:0 \n"
+"-0.9532572502392046 1:0.38 2:0.61290323 3:0.42105263 4:0 \n"
+"-1 1:0.38 2:0.64516129 3:0.31578947 4:0 \n"
+"0.9181216030006814 1:0.38 2:0.70967742 3:0.21052632 4:0 \n"
+"0.8406182491140477 1:0.38 2:0.70967742 3:0.26315789 4:0 \n"
+"1 1:0.4 2:0.3 3:0.3 4:0 \n"
+"-0.9364696955414865 1:0.4 2:0.53333333 3:0.2 4:0 \n"
+"-1 1:0.4 2:0.6 3:0.35 4:0 \n"
+"-1 1:0.4 2:0.66666667 3:0.35 4:0 \n"
+"0.658077614573009 1:0.4 2:0.7 3:0.75 4:0 \n"
+"-0.9923478684628275 1:0.42 2:0.20689655 3:0.42857143 4:0 \n"
+"1 1:0.42 2:0.24137931 3:0.28571429 4:0 \n"
+"-1 1:0.42 2:0.24137931 3:0.80952381 4:0 \n"
+"0.2745417674520128 1:0.42 2:0.31034483 3:0.71428571 4:0 \n"
+"-1 1:0.42 2:0.34482759 3:0.47619048 4:0 \n"
+"-1 1:0.42 2:0.34482759 3:0.61904762 4:0 \n"
+"-0.8980326499738261 1:0.42 2:0.34482759 3:0.80952381 4:0 \n"
+"0.07029237206620208 1:0.42 2:0.4137931 3:0.76190476 4:0 \n"
+"1 1:0.42 2:0.44827586 3:0.47619048 4:0 \n"
+"0.01638387273179614 1:0.42 2:0.55172414 3:0.76190476 4:0 \n"
+"-0.9920292514815255 1:0.42 2:0.65517241 3:0.33333333 4:0 \n"
+"0.2902237946267846 1:0.42 2:0.65517241 3:0.66666667 4:0 \n"
+"1 1:0.42 2:0.75862069 3:0.76190476 4:0 \n"
+"0.1906634538436009 1:0.42 2:0.79310345 3:0.57142857 4:0 \n"
+"-0.04833178027831733 1:0.42 2:0.79310345 3:0.80952381 4:0 \n"
+"-0.3907742563155945 1:0.46 2:0.18518519 3:0.2173913 4:0 \n"
+"1 1:0.46 2:0.18518519 3:0.69565217 4:0 \n"
+"-1 1:0.46 2:0.2962963 3:0.30434783 4:0 \n"
+"-1 1:0.46 2:0.2962963 3:0.60869565 4:0 \n"
+"1 1:0.46 2:0.40740741 3:0.43478261 4:0 \n"
+"1 1:0.46 2:0.44444444 3:0.43478261 4:0 \n"
+"-1 1:0.46 2:0.44444444 3:0.56521739 4:0 \n"
+"-1 1:0.46 2:0.48148148 3:0.65217391 4:0 \n"
+"-1 1:0.46 2:0.55555556 3:0.60869565 4:0 \n"
+"1 1:0.46 2:0.55555556 3:0.65217391 4:0 \n"
+"0.8448819072349042 1:0.46 2:0.59259259 3:0.47826087 4:0 \n"
+"-0.3714223663291514 1:0.46 2:0.66666667 3:0.47826087 4:0 \n"
+"-1 1:0.46 2:0.66666667 3:0.65217391 4:0 \n"
+"0.4006138837863371 1:0.46 2:0.74074074 3:0.69565217 4:0 \n"
+"0.0538378782246542 1:0.46 2:0.81481481 3:0.30434783 4:0 \n"
+"-1 1:0.48 2:0.19230769 3:0.29166667 4:0 \n"
+"0.01972706150638374 1:0.48 2:0.30769231 3:0.20833333 4:0 \n"
+"-1 1:0.48 2:0.34615385 3:0.41666667 4:0 \n"
+"0.851940977873443 1:0.48 2:0.34615385 3:0.54166667 4:0 \n"
+"1 1:0.48 2:0.46153846 3:0.58333333 4:0 \n"
+"1 1:0.48 2:0.76923077 3:0.33333333 4:0 \n"
+"-1 1:0.48 2:0.80769231 3:0.79166667 4:0 \n"
+"0.08737037115441017 1:0.5 2:0.2 3:0.72 4:0 \n"
+"-0.4224730313050076 1:0.5 2:0.2 3:0.8 4:0 \n"
+"1 1:0.5 2:0.32 3:0.76 4:0 \n"
+"1 1:0.5 2:0.4 3:0.44 4:0 \n"
+"-1 1:0.5 2:0.44 3:0.44 4:0 \n"
+"0.6904008998969356 1:0.5 2:0.44 3:0.56 4:0 \n"
+"-1 1:0.5 2:0.44 3:0.6 4:0 \n"
+"-0.004380864230783311 1:0.5 2:0.64 3:0.56 4:0 \n"
+"-1 1:0.5 2:0.72 3:0.8 4:0 \n"
+"-1 1:0.5 2:0.8 3:0.48 4:0 \n"
+"-0.6346423135556399 1:0.52 2:0.20833333 3:0.80769231 4:0 \n"
+"0.9850633403914929 1:0.52 2:0.29166667 3:0.76923077 4:0 \n"
+"1 1:0.52 2:0.33333333 3:0.30769231 4:0 \n"
+"0.5949274112576541 1:0.52 2:0.33333333 3:0.46153846 4:0 \n"
+"1 1:0.52 2:0.41666667 3:0.26923077 4:0 \n"
+"1 1:0.52 2:0.45833333 3:0.30769231 4:0 \n"
+"0.08668357542314302 1:0.52 2:0.5 3:0.19230769 4:0 \n"
+"0.0517982341325497 1:0.52 2:0.5 3:0.65384615 4:0 \n"
+"1 1:0.52 2:0.54166667 3:0.46153846 4:0 \n"
+"-0.1280547510237239 1:0.52 2:0.66666667 3:0.19230769 4:0 \n"
+"-0.3356880461332991 1:0.52 2:0.66666667 3:0.34615385 4:0 \n"
+"-0.07575318986456843 1:0.56 2:0.18181818 3:0.60714286 4:0 \n"
+"1 1:0.56 2:0.27272727 3:0.39285714 4:0 \n"
+"-1 1:0.56 2:0.27272727 3:0.60714286 4:0 \n"
+"-1 1:0.56 2:0.31818182 3:0.21428571 4:0 \n"
+"-1 1:0.56 2:0.31818182 3:0.46428571 4:0 \n"
+"-0.2905756973820707 1:0.56 2:0.36363636 3:0.21428571 4:0 \n"
+"-1 1:0.56 2:0.36363636 3:0.46428571 4:0 \n"
+"1 1:0.56 2:0.36363636 3:0.53571429 4:0 \n"
+"-1 1:0.56 2:0.63636364 3:0.35714286 4:0 \n"
+"1 1:0.56 2:0.68181818 3:0.75 4:0 \n"
+"0.09348882192165238 1:0.56 2:0.77272727 3:0.64285714 4:0 \n"
+"1 1:0.56 2:0.77272727 3:0.75 4:0 \n"
+"0.3166998678005198 1:0.56 2:0.81818182 3:0.71428571 4:0 \n"
+"-0.4260517271618464 1:0.58 2:0.19047619 3:0.44827586 4:0 \n"
+"1 1:0.58 2:0.19047619 3:0.48275862 4:0 \n"
+"1 1:0.58 2:0.23809524 3:0.4137931 4:0 \n"
+"-0.9925301847251352 1:0.58 2:0.28571429 3:0.5862069 4:0 \n"
+"0.6497271665147746 1:0.58 2:0.42857143 3:0.4137931 4:0 \n"
+"1 1:0.58 2:0.66666667 3:0.75862069 4:0 \n"
+"1 1:0.58 2:0.80952381 3:0.4137931 4:0 \n"
+"-0.4717024472816282 1:0.58 2:0.80952381 3:0.44827586 4:0 \n"
+"0.2854282084898161 1:0.58 2:0.80952381 3:0.55172414 4:0 \n"
+"0.3310846395375033 1:0.6 2:0.35 3:0.43333333 4:0 \n"
+"1 1:0.6 2:0.35 3:0.5 4:0 \n"
+"1 1:0.6 2:0.35 3:0.53333333 4:0 \n"
+"-1 1:0.6 2:0.45 3:0.4 4:0 \n"
+"-1 1:0.6 2:0.5 3:0.6 4:0 \n"
+"1 1:0.6 2:0.55 3:0.6 4:0 \n"
+"1 1:0.6 2:0.6 3:0.3 4:0 \n"
+"0.8821905929437969 1:0.6 2:0.65 3:0.3 4:0 \n"
+"-1 1:0.6 2:0.65 3:0.66666667 4:0 \n"
+"1 1:0.6 2:0.65 3:0.76666667 4:0 \n"
+"-0.6060756704341599 1:0.6 2:0.65 3:0.8 4:0 \n"
+"1 1:0.6 2:0.7 3:0.4 4:0 \n"
+"1 1:0.6 2:0.7 3:0.43333333 4:0 \n"
+"-0.004793770874371793 1:0.6 2:0.8 3:0.8 4:0 \n"
+"1 1:0.62 2:0.21052632 3:0.29032258 4:0 \n"
+"1 1:0.62 2:0.21052632 3:0.70967742 4:0 \n"
+"1 1:0.62 2:0.21052632 3:0.74193548 4:0 \n"
+"0.0299021110057953 1:0.62 2:0.31578947 3:0.48387097 4:0 \n"
+"-1 1:0.62 2:0.42105263 3:0.5483871 4:0 \n"
+"-0.1545424353917149 1:0.62 2:0.42105263 3:0.80645161 4:0 \n"
+"1 1:0.62 2:0.47368421 3:0.74193548 4:0 \n"
+"-0.2581478467317246 1:0.62 2:0.52631579 3:0.38709677 4:0 \n"
+"0.5074921703322104 1:0.62 2:0.52631579 3:0.4516129 4:0 \n"
+"-0.3437154540569268 1:0.62 2:0.57894737 3:0.29032258 4:0 \n"
+"-1 1:0.62 2:0.57894737 3:0.80645161 4:0 \n"
+"-1 1:0.62 2:0.63157895 3:0.38709677 4:0 \n"
+"1 1:0.62 2:0.68421053 3:0.48387097 4:0 \n"
+"-0.2442209513782373 1:0.62 2:0.73684211 3:0.64516129 4:0 \n"
+"-1 1:0.62 2:0.78947368 3:0.70967742 4:0 \n"
+"-1 1:0.62 2:0.78947368 3:0.80645161 4:0 \n"
+"-1 1:0.66 2:0.17647059 3:0.63636364 4:0 \n"
+"-1 1:0.66 2:0.29411765 3:0.48484848 4:0 \n"
+"-1 1:0.66 2:0.35294118 3:0.45454545 4:0 \n"
+"0.1524267994692118 1:0.66 2:0.41176471 3:0.3030303 4:0 \n"
+"1 1:0.66 2:0.41176471 3:0.60606061 4:0 \n"
+"0.2791149611531762 1:0.66 2:0.47058824 3:0.75757576 4:0 \n"
+"1 1:0.66 2:0.52941176 3:0.24242424 4:0 \n"
+"-1 1:0.66 2:0.52941176 3:0.45454545 4:0 \n"
+"-1 1:0.66 2:0.58823529 3:0.21212121 4:0 \n"
+"-1 1:0.66 2:0.58823529 3:0.54545455 4:0 \n"
+"-1 1:0.66 2:0.70588235 3:0.36363636 4:0 \n"
+"-0.6436259558106683 1:0.66 2:0.76470588 3:0.21212121 4:0 \n"
+"-1 1:0.66 2:0.76470588 3:0.63636364 4:0 \n"
+"0.1271433494957664 1:0.68 2:0.1875 3:0.5 4:0 \n"
+"-1 1:0.68 2:0.1875 3:0.79411765 4:0 \n"
+"-1 1:0.68 2:0.25 3:0.41176471 4:0 \n"
+"-1 1:0.68 2:0.3125 3:0.55882353 4:0 \n"
+"1 1:0.68 2:0.3125 3:0.70588235 4:0 \n"
+"0.1480043942705204 1:0.68 2:0.375 3:0.70588235 4:0 \n"
+"-1 1:0.68 2:0.4375 3:0.35294118 4:0 \n"
+"0.9365230229594439 1:0.68 2:0.5625 3:0.5 4:0 \n"
+"-0.008516292609770578 1:0.68 2:0.6875 3:0.44117647 4:0 \n"
+"-1 1:0.68 2:0.6875 3:0.5 4:0 \n"
+"-1 1:0.68 2:0.75 3:0.58823529 4:0 \n"
+"1 1:0.68 2:0.8125 3:0.76470588 4:0 \n"
+"-0.001432571849798507 1:0.68 2:0.8125 3:0.79411765 4:0 \n"
+"-0.3554903896331749 1:0.7 2:0.26666667 3:0.54285714 4:0 \n"
+"1 1:0.7 2:0.46666667 3:0.34285714 4:0 \n"
+"-1 1:0.7 2:0.53333333 3:0.48571429 4:0 \n"
+"1 1:0.7 2:0.6 3:0.45714286 4:0 \n"
+"1 1:0.7 2:0.66666667 3:0.71428571 4:0 \n"
+"-1 1:0.7 2:0.66666667 3:0.8 4:0 \n"
+"-1 1:0.7 2:0.73333333 3:0.34285714 4:0 \n"
+"0.2070556056571206 1:0.72 2:0.21428571 3:0.30555556 4:0 \n"
+"-1 1:0.72 2:0.21428571 3:0.80555556 4:0 \n"
+"1 1:0.72 2:0.28571429 3:0.55555556 4:0 \n"
+"-0.9122445886983376 1:0.72 2:0.28571429 3:0.80555556 4:0 \n"
+"-1 1:0.72 2:0.42857143 3:0.44444444 4:0 \n"
+"1 1:0.72 2:0.64285714 3:0.30555556 4:0 \n"
+"-1 1:0.72 2:0.71428571 3:0.44444444 4:0 \n"
+"1 1:0.72 2:0.71428571 3:0.5 4:0 \n"
+"1 1:0.72 2:0.78571429 3:0.75 4:0 \n"
+"-1 1:0.72 2:0.78571429 3:0.80555556 4:0 \n"
+"1 1:0.76 2:0.16666667 3:0.76315789 4:0 \n"
+"-1 1:0.76 2:0.33333333 3:0.34210526 4:0 \n"
+"1 1:0.76 2:0.41666667 3:0.34210526 4:0 \n"
+"-1 1:0.76 2:0.41666667 3:0.5 4:0 \n"
+"0.3432488098085674 1:0.76 2:0.5 3:0.60526316 4:0 \n"
+"0.7462270587993467 1:0.76 2:0.75 3:0.34210526 4:0 \n"
+"1 1:0.76 2:0.75 3:0.71052632 4:0 \n"
+"0.3318962452637436 1:0.76 2:0.83333333 3:0.26315789 4:0 \n"
+"0.3948659537459074 1:0.76 2:0.83333333 3:0.71052632 4:0 \n"
+"0.2143333521924379 1:0.78 2:0.18181818 3:0.25641026 4:0 \n"
+"-0.3407614661319019 1:0.78 2:0.27272727 3:0.46153846 4:0 \n"
+"1 1:0.78 2:0.27272727 3:0.53846154 4:0 \n"
+"-1 1:0.78 2:0.27272727 3:0.58974359 4:0 \n"
+"-0.5288027535957321 1:0.78 2:0.27272727 3:0.69230769 4:0 \n"
+"1 1:0.78 2:0.36363636 3:0.30769231 4:0 \n"
+"1 1:0.78 2:0.45454545 3:0.46153846 4:0 \n"
+"-1 1:0.78 2:0.63636364 3:0.41025641 4:0 \n"
+"-0.04344357111417033 1:0.78 2:0.63636364 3:0.53846154 4:0 \n"
+"1 1:0.78 2:0.63636364 3:0.58974359 4:0 \n"
+"-1 1:0.78 2:0.63636364 3:0.69230769 4:0 \n"
+"0.1994254430552846 1:0.78 2:0.81818182 3:0.58974359 4:0 \n"
+"0.005659180594987566 1:0.78 2:0.81818182 3:0.69230769 4:0 \n"
+"0.8381087643483256 1:0.8 2:0.2 3:0.5 4:0 \n"
+"1 1:0.8 2:0.2 3:0.75 4:0 \n"
+"-0.184642318063764 1:0.8 2:0.2 3:0.8 4:0 \n"
+"1 1:0.8 2:0.3 3:0.45 4:0 \n"
+"-1 1:0.8 2:0.3 3:0.55 4:0 \n"
+"1 1:0.8 2:0.3 3:0.6 4:0 \n"
+"-1 1:0.8 2:0.4 3:0.25 4:0 \n"
+"0.585221005633252 1:0.8 2:0.5 3:0.5 4:0 \n"
+"-1 1:0.8 2:0.6 3:0.7 4:0 \n"
+"0.2941193604796581 1:0.8 2:0.6 3:0.8 4:0 \n"
+"0.1592012573097206 1:0.8 2:0.7 3:0.2 4:0 \n"
+"1 1:0.8 2:0.7 3:0.65 4:0 \n"
+"-0.05520193805896165 1:0.8 2:0.8 3:0.3 4:0 \n"
+"0.9676978202167011 1:0.8 2:0.8 3:0.5 4:0 \n"
+"-1 1:0.8 2:0.8 3:0.65 4:0 \n"
+"1 1:0.2 2:0.25 3:0.55 4:0.14285714 \n"
+"1 1:0.2 2:0.25 3:0.75 4:0.14285714 \n"
+"0.0135812449218331 1:0.2 2:0.25 3:0.8 4:0.14285714 \n"
+"-0.8026014410769956 1:0.2 2:0.3 3:0.4 4:0.14285714 \n"
+"-0.7685256146757016 1:0.2 2:0.3 3:0.6 4:0.14285714 \n"
+"0.9775756677521732 1:0.2 2:0.35 3:0.4 4:0.14285714 \n"
+"0.4012079565297025 1:0.2 2:0.35 3:0.8 4:0.14285714 \n"
+"0.084205326941587 1:0.2 2:0.4 3:0.2 4:0.14285714 \n"
+"-0.9325615875333091 1:0.2 2:0.6 3:0.25 4:0.14285714 \n"
+"-0.5090757378913543 1:0.2 2:0.6 3:0.55 4:0.14285714 \n"
+"0.3145545343993413 1:0.2 2:0.65 3:0.5 4:0.14285714 \n"
+"1 1:0.2 2:0.7 3:0.25 4:0.14285714 \n"
+"0.9013755166996397 1:0.2 2:0.7 3:0.5 4:0.14285714 \n"
+"0.6994024769900444 1:0.2 2:0.7 3:0.8 4:0.14285714 \n"
+"1 1:0.2 2:0.75 3:0.35 4:0.14285714 \n"
+"-0.6235990890611504 1:0.2 2:0.8 3:0.65 4:0.14285714 \n"
+"0.2958250027729296 1:0.23 2:0.4025974 3:0.30434783 4:0.14285714 \n"
+"-0.2192056942899054 1:0.23 2:0.4025974 3:0.34782609 4:0.14285714 \n"
+"-1 1:0.23 2:0.54545455 3:0.2173913 4:0.14285714 \n"
+"-1 1:0.23 2:0.5974026 3:0.34782609 4:0.14285714 \n"
+"0.8422731689814177 1:0.23 2:0.7012987 3:0.60869565 4:0.14285714 \n"
+"1 1:0.23 2:0.75324675 3:0.2173913 4:0.14285714 \n"
+"0.7191435535347683 1:0.23 2:0.75324675 3:0.26086957 4:0.14285714 \n"
+"0.8036040151192584 1:0.25 2:0.2 3:0.32 4:0.14285714 \n"
+"0.0531837268725287 1:0.25 2:0.2 3:0.48 4:0.14285714 \n"
+"0.07948171232753268 1:0.25 2:0.25333333 3:0.72 4:0.14285714 \n"
+"-1 1:0.25 2:0.30666667 3:0.48 4:0.14285714 \n"
+"1 1:0.25 2:0.4 3:0.24 4:0.14285714 \n"
+"-1 1:0.25 2:0.4 3:0.72 4:0.14285714 \n"
+"-1 1:0.25 2:0.65333333 3:0.32 4:0.14285714 \n"
+"-0.2889520237414525 1:0.25 2:0.8 3:0.2 4:0.14285714 \n"
+"1 1:0.28 2:0.25 3:0.60714286 4:0.14285714 \n"
+"1 1:0.28 2:0.69444444 3:0.60714286 4:0.14285714 \n"
+"1 1:0.28 2:0.75 3:0.21428571 4:0.14285714 \n"
+"-0.2464607732202429 1:0.3 2:0.25714286 3:0.2 4:0.14285714 \n"
+"-0.6712518318458536 1:0.3 2:0.35714286 3:0.4 4:0.14285714 \n"
+"-0.1282745858845328 1:0.3 2:0.5 3:0.3 4:0.14285714 \n"
+"-0.4303798348941193 1:0.3 2:0.6 3:0.36666667 4:0.14285714 \n"
+"0.3061341905860213 1:0.33 2:0.19402985 3:0.60606061 4:0.14285714 \n"
+"1 1:0.33 2:0.25373134 3:0.75757576 4:0.14285714 \n"
+"-1 1:0.33 2:0.34328358 3:0.60606061 4:0.14285714 \n"
+"-1 1:0.33 2:0.49253731 3:0.24242424 4:0.14285714 \n"
+"-0.1916075978069539 1:0.33 2:0.70149254 3:0.39393939 4:0.14285714 \n"
+"-0.8107959204598276 1:0.33 2:0.74626866 3:0.45454545 4:0.14285714 \n"
+"1 1:0.33 2:0.80597015 3:0.45454545 4:0.14285714 \n"
+"0.03383131775163409 1:0.33 2:0.80597015 3:0.60606061 4:0.14285714 \n"
+"1 1:0.35 2:0.44615385 3:0.48571429 4:0.14285714 \n"
+"-0.8410280016447177 1:0.35 2:0.6 3:0.65714286 4:0.14285714 \n"
+"-1 1:0.35 2:0.70769231 3:0.34285714 4:0.14285714 \n"
+"0.5900178416694913 1:0.38 2:0.19354839 3:0.34210526 4:0.14285714 \n"
+"-1 1:0.38 2:0.25806452 3:0.26315789 4:0.14285714 \n"
+"1 1:0.38 2:0.25806452 3:0.34210526 4:0.14285714 \n"
+"-0.7412654209023689 1:0.38 2:0.25806452 3:0.39473684 4:0.14285714 \n"
+"-1 1:0.38 2:0.30645161 3:0.5 4:0.14285714 \n"
+"-0.235475636679371 1:0.38 2:0.35483871 3:0.39473684 4:0.14285714 \n"
+"0.3141595494818585 1:0.38 2:0.40322581 3:0.5 4:0.14285714 \n"
+"-0.05407698055811676 1:0.38 2:0.40322581 3:0.55263158 4:0.14285714 \n"
+"1 1:0.38 2:0.4516129 3:0.28947368 4:0.14285714 \n"
+"-1 1:0.38 2:0.69354839 3:0.60526316 4:0.14285714 \n"
+"0.07137123820619147 1:0.38 2:0.75806452 3:0.71052632 4:0.14285714 \n"
+"1 1:0.4 2:0.45 3:0.25 4:0.14285714 \n"
+"0.413986588069465 1:0.4 2:0.45 3:0.55 4:0.14285714 \n"
+"0.3359383378486254 1:0.4 2:0.55 3:0.5 4:0.14285714 \n"
+"0.1256586161151745 1:0.4 2:0.65 3:0.7 4:0.14285714 \n"
+"0.00252607753861751 1:0.4 2:0.75 3:0.45 4:0.14285714 \n"
+"-0.2144156128093337 1:0.43 2:0.29824561 3:0.65116279 4:0.14285714 \n"
+"-0.7087597365855008 1:0.43 2:0.29824561 3:0.69767442 4:0.14285714 \n"
+"1 1:0.43 2:0.40350877 3:0.44186047 4:0.14285714 \n"
+"1 1:0.43 2:0.40350877 3:0.74418605 4:0.14285714 \n"
+"1 1:0.43 2:0.59649123 3:0.30232558 4:0.14285714 \n"
+"-1 1:0.43 2:0.64912281 3:0.30232558 4:0.14285714 \n"
+"-1 1:0.43 2:0.70175439 3:0.65116279 4:0.14285714 \n"
+"-1 1:0.45 2:0.25454545 3:0.44444444 4:0.14285714 \n"
+"-1 1:0.45 2:0.30909091 3:0.24444444 4:0.14285714 \n"
+"-1 1:0.45 2:0.34545455 3:0.71111111 4:0.14285714 \n"
+"1 1:0.45 2:0.45454545 3:0.44444444 4:0.14285714 \n"
+"0.5215742201315625 1:0.45 2:0.45454545 3:0.75555556 4:0.14285714 \n"
+"-0.05451925094449037 1:0.45 2:0.65454545 3:0.31111111 4:0.14285714 \n"
+"-0.2890098682620317 1:0.45 2:0.65454545 3:0.48888889 4:0.14285714 \n"
+"1 1:0.45 2:0.70909091 3:0.48888889 4:0.14285714 \n"
+"-0.9349799701267902 1:0.48 2:0.75 3:0.54166667 4:0.14285714 \n"
+"0.4758927948722542 1:0.48 2:0.75 3:0.79166667 4:0.14285714 \n"
+"-1 1:0.5 2:0.26 3:0.66 4:0.14285714 \n"
+"-1 1:0.5 2:0.4 3:0.54 4:0.14285714 \n"
+"-0.3058869998982018 1:0.5 2:0.44 3:0.4 4:0.14285714 \n"
+"-1 1:0.5 2:0.5 3:0.4 4:0.14285714 \n"
+"1 1:0.5 2:0.66 3:0.26 4:0.14285714 \n"
+"0.8303820099239545 1:0.53 2:0.19148936 3:0.75471698 4:0.14285714 \n"
+"1 1:0.53 2:0.25531915 3:0.20754717 4:0.14285714 \n"
+"0.1114349604130157 1:0.53 2:0.25531915 3:0.24528302 4:0.14285714 \n"
+"0.008105863078445264 1:0.53 2:0.29787234 3:0.79245283 4:0.14285714 \n"
+"1 1:0.53 2:0.44680851 3:0.24528302 4:0.14285714 \n"
+"-1 1:0.53 2:0.55319149 3:0.49056604 4:0.14285714 \n"
+"0.7086960866800173 1:0.53 2:0.55319149 3:0.79245283 4:0.14285714 \n"
+"0.3601005783740542 1:0.53 2:0.59574468 3:0.69811321 4:0.14285714 \n"
+"-0.3376548789646864 1:0.53 2:0.74468085 3:0.24528302 4:0.14285714 \n"
+"-1 1:0.55 2:0.31111111 3:0.4 4:0.14285714 \n"
+"1 1:0.55 2:0.35555556 3:0.49090909 4:0.14285714 \n"
+"-1 1:0.55 2:0.4 3:0.34545455 4:0.14285714 \n"
+"-1 1:0.55 2:0.44444444 3:0.45454545 4:0.14285714 \n"
+"-0.1014765660528771 1:0.55 2:0.44444444 3:0.65454545 4:0.14285714 \n"
+"1 1:0.55 2:0.48888889 3:0.6 4:0.14285714 \n"
+"-0.9063870089311084 1:0.55 2:0.71111111 3:0.34545455 4:0.14285714 \n"
+"1 1:0.55 2:0.71111111 3:0.49090909 4:0.14285714 \n"
+"-1 1:0.55 2:0.75555556 3:0.30909091 4:0.14285714 \n"
+"1 1:0.58 2:0.45238095 3:0.5 4:0.14285714 \n"
+"1 1:0.58 2:0.45238095 3:0.55172414 4:0.14285714 \n"
+"-1 1:0.58 2:0.45238095 3:0.65517241 4:0.14285714 \n"
+"-0.4973715725957024 1:0.58 2:0.5 3:0.20689655 4:0.14285714 \n"
+"-0.7771073676239159 1:0.58 2:0.54761905 3:0.29310345 4:0.14285714 \n"
+"1 1:0.58 2:0.69047619 3:0.29310345 4:0.14285714 \n"
+"0.08248852075435595 1:0.58 2:0.76190476 3:0.5 4:0.14285714 \n"
+"1 1:0.6 2:0.5 3:0.5 4:0.14285714 \n"
+"-1 1:0.6 2:0.6 3:0.5 4:0.14285714 \n"
+"1 1:0.6 2:0.65 3:0.45 4:0.14285714 \n"
+"-0.003486673199532867 1:0.6 2:0.7 3:0.65 4:0.14285714 \n"
+"0.1122273763084038 1:0.6 2:0.75 3:0.6 4:0.14285714 \n"
+"1 1:0.63 2:0.18918919 3:0.44444444 4:0.14285714 \n"
+"1 1:0.63 2:0.24324324 3:0.49206349 4:0.14285714 \n"
+"0.2321579262749023 1:0.63 2:0.2972973 3:0.55555556 4:0.14285714 \n"
+"-1 1:0.63 2:0.2972973 3:0.6031746 4:0.14285714 \n"
+"-0.01636137455530932 1:0.63 2:0.2972973 3:0.65079365 4:0.14285714 \n"
+"-1 1:0.63 2:0.40540541 3:0.34920635 4:0.14285714 \n"
+"-0.5597514498395699 1:0.63 2:0.45945946 3:0.6031746 4:0.14285714 \n"
+"-1 1:0.63 2:0.48648649 3:0.65079365 4:0.14285714 \n"
+"-1 1:0.63 2:0.59459459 3:0.6984127 4:0.14285714 \n"
+"0.06433561841474116 1:0.63 2:0.64864865 3:0.20634921 4:0.14285714 \n"
+"-0.07691991093928076 1:0.63 2:0.64864865 3:0.6984127 4:0.14285714 \n"
+"-0.01873148930413057 1:0.63 2:0.81081081 3:0.20634921 4:0.14285714 \n"
+"1 1:0.65 2:0.31428571 3:0.44615385 4:0.14285714 \n"
+"1 1:0.65 2:0.34285714 3:0.49230769 4:0.14285714 \n"
+"1 1:0.65 2:0.4 3:0.30769231 4:0.14285714 \n"
+"-1 1:0.65 2:0.45714286 3:0.35384615 4:0.14285714 \n"
+"-1 1:0.65 2:0.48571429 3:0.64615385 4:0.14285714 \n"
+"1 1:0.65 2:0.54285714 3:0.44615385 4:0.14285714 \n"
+"0.3480305908398122 1:0.65 2:0.65714286 3:0.4 4:0.14285714 \n"
+"0.6868904453565011 1:0.65 2:0.8 3:0.24615385 4:0.14285714 \n"
+"-0.1104392735732009 1:0.65 2:0.8 3:0.8 4:0.14285714 \n"
+"-1 1:0.68 2:0.1875 3:0.45588235 4:0.14285714 \n"
+"-1 1:0.68 2:0.3125 3:0.35294118 4:0.14285714 \n"
+"1 1:0.68 2:0.3125 3:0.39705882 4:0.14285714 \n"
+"0.9468809409993679 1:0.68 2:0.3125 3:0.70588235 4:0.14285714 \n"
+"-0.8960939004407403 1:0.68 2:0.40625 3:0.35294118 4:0.14285714 \n"
+"-1 1:0.68 2:0.4375 3:0.45588235 4:0.14285714 \n"
+"0.06760220585767736 1:0.68 2:0.65625 3:0.64705882 4:0.14285714 \n"
+"0.162399393019196 1:0.68 2:0.6875 3:0.54411765 4:0.14285714 \n"
+"0.3309947291828618 1:0.68 2:0.75 3:0.35294118 4:0.14285714 \n"
+"1 1:0.68 2:0.75 3:0.64705882 4:0.14285714 \n"
+"-1 1:0.7 2:0.2 3:0.35714286 4:0.14285714 \n"
+"-0.3113899174485042 1:0.7 2:0.2 3:0.5 4:0.14285714 \n"
+"0.710057180189838 1:0.7 2:0.2 3:0.75714286 4:0.14285714 \n"
+"1 1:0.7 2:0.36666667 3:0.5 4:0.14285714 \n"
+"1 1:0.7 2:0.4 3:0.44285714 4:0.14285714 \n"
+"1 1:0.7 2:0.5 3:0.44285714 4:0.14285714 \n"
+"-1 1:0.7 2:0.6 3:0.44285714 4:0.14285714 \n"
+"1 1:0.7 2:0.66666667 3:0.75714286 4:0.14285714 \n"
+"-1 1:0.7 2:0.8 3:0.44285714 4:0.14285714 \n"
+"0.7188623512484075 1:0.7 2:0.8 3:0.7 4:0.14285714 \n"
+"-0.7518566797217892 1:0.73 2:0.18518519 3:0.30136986 4:0.14285714 \n"
+"1 1:0.73 2:0.25925926 3:0.49315068 4:0.14285714 \n"
+"-1 1:0.73 2:0.33333333 3:0.64383562 4:0.14285714 \n"
+"0.06042968540423314 1:0.73 2:0.40740741 3:0.75342466 4:0.14285714 \n"
+"1 1:0.73 2:0.55555556 3:0.49315068 4:0.14285714 \n"
+"-1 1:0.73 2:0.55555556 3:0.64383562 4:0.14285714 \n"
+"1 1:0.73 2:0.59259259 3:0.75342466 4:0.14285714 \n"
+"-1 1:0.75 2:0.2 3:0.49333333 4:0.14285714 \n"
+"-0.6683909180333789 1:0.75 2:0.36 3:0.8 4:0.14285714 \n"
+"-1 1:0.75 2:0.48 3:0.4 4:0.14285714 \n"
+"-1 1:0.75 2:0.72 3:0.65333333 4:0.14285714 \n"
+"-0.4874925451625081 1:0.75 2:0.76 3:0.2 4:0.14285714 \n"
+"0.8632010530330415 1:0.78 2:0.18181818 3:0.3974359 4:0.14285714 \n"
+"-0.8522146967960993 1:0.78 2:0.18181818 3:0.6025641 4:0.14285714 \n"
+"-0.3865716017775887 1:0.78 2:0.27272727 3:0.29487179 4:0.14285714 \n"
+"-1 1:0.78 2:0.27272727 3:0.65384615 4:0.14285714 \n"
+"1 1:0.78 2:0.31818182 3:0.75641026 4:0.14285714 \n"
+"0.7293614336893464 1:0.78 2:0.40909091 3:0.20512821 4:0.14285714 \n"
+"0.05514930970405035 1:0.78 2:0.45454545 3:0.55128205 4:0.14285714 \n"
+"-1 1:0.78 2:0.5 3:0.44871795 4:0.14285714 \n"
+"1 1:0.78 2:0.5 3:0.5 4:0.14285714 \n"
+"0.3051973680621083 1:0.78 2:0.5 3:0.65384615 4:0.14285714 \n"
+"1 1:0.78 2:0.59090909 3:0.5 4:0.14285714 \n"
+"1 1:0.78 2:0.59090909 3:0.75641026 4:0.14285714 \n"
+"-1 1:0.78 2:0.68181818 3:0.34615385 4:0.14285714 \n"
+"-1 1:0.78 2:0.77272727 3:0.5 4:0.14285714 \n"
+"-1 1:0.8 2:0.25 3:0.3 4:0.14285714 \n"
+"1 1:0.8 2:0.3 3:0.35 4:0.14285714 \n"
+"-1 1:0.8 2:0.3 3:0.55 4:0.14285714 \n"
+"-1 1:0.8 2:0.3 3:0.65 4:0.14285714 \n"
+"1 1:0.8 2:0.35 3:0.75 4:0.14285714 \n"
+"0.248332642183202 1:0.8 2:0.4 3:0.2 4:0.14285714 \n"
+"-1 1:0.8 2:0.4 3:0.3 4:0.14285714 \n"
+"1 1:0.8 2:0.4 3:0.5 4:0.14285714 \n"
+"-0.009407532520902937 1:0.8 2:0.45 3:0.7 4:0.14285714 \n"
+"-1 1:0.8 2:0.5 3:0.55 4:0.14285714 \n"
+"-0.7145209728416626 1:0.8 2:0.6 3:0.6 4:0.14285714 \n"
+"1 1:0.8 2:0.65 3:0.45 4:0.14285714 \n"
+"-1 1:0.8 2:0.7 3:0.65 4:0.14285714 \n"
+"-0.6890954729149655 1:0.8 2:0.75 3:0.65 4:0.14285714 \n"
+"-1 1:0.2 2:0.2 3:0.8 4:0.28571429 \n"
+"-0.009153621697841157 1:0.2 2:0.25 3:0.6 4:0.28571429 \n"
+"-0.1313784341058974 1:0.2 2:0.3 3:0.2 4:0.28571429 \n"
+"-0.002479834842920828 1:0.2 2:0.35 3:0.43333333 4:0.28571429 \n"
+"0.4565628345544172 1:0.2 2:0.45 3:0.2 4:0.28571429 \n"
+"0.1383189806349542 1:0.2 2:0.55 3:0.5 4:0.28571429 \n"
+"-0.5164845584433336 1:0.2 2:0.6 3:0.7 4:0.28571429 \n"
+"0.0707607192624703 1:0.2 2:0.7 3:0.2 4:0.28571429 \n"
+"1 1:0.2 2:0.75 3:0.26666667 4:0.28571429 \n"
+"-1 1:0.2 2:0.8 3:0.2 4:0.28571429 \n"
+"-1 1:0.2 2:0.8 3:0.26666667 4:0.28571429 \n"
+"-0.2414697052861657 1:0.2 2:0.8 3:0.3 4:0.28571429 \n"
+"-1 1:0.2 2:0.8 3:0.36666667 4:0.28571429 \n"
+"-0.4444893268470444 1:0.2 2:0.8 3:0.53333333 4:0.28571429 \n"
+"-0.1956618504441442 1:0.2 2:0.8 3:0.8 4:0.28571429 \n"
+"-0.009805760377205651 1:0.22666667 2:0.19827586 3:0.5 4:0.28571429 \n"
+"-1 1:0.22666667 2:0.30172414 3:0.29411765 4:0.28571429 \n"
+"0.6454748818995671 1:0.22666667 2:0.5 3:0.41176471 4:0.28571429 \n"
+"-1 1:0.22666667 2:0.64655172 3:0.41176471 4:0.28571429 \n"
+"-0.6997076741276671 1:0.25333333 2:0.34821429 3:0.21052632 4:0.28571429 \n"
+"1 1:0.25333333 2:0.40178571 3:0.26315789 4:0.28571429 \n"
+"-0.04834090877712734 1:0.25333333 2:0.5 3:0.28947368 4:0.28571429 \n"
+"-0.02232260439728159 1:0.25333333 2:0.65178571 3:0.26315789 4:0.28571429 \n"
+"-0.3405173591588186 1:0.27333333 2:0.20183486 3:0.80487805 4:0.28571429 \n"
+"-0.3266420577485906 1:0.27333333 2:0.40366972 3:0.34146341 4:0.28571429 \n"
+"-0.4141392763783503 1:0.27333333 2:0.44954128 3:0.80487805 4:0.28571429 \n"
+"0.8758516620226078 1:0.27333333 2:0.75229358 3:0.29268293 4:0.28571429 \n"
+"1 1:0.27333333 2:0.79816514 3:0.48780488 4:0.28571429 \n"
+"1 1:0.3 2:0.4952381 3:0.48888889 4:0.28571429 \n"
+"-0.0215540361498599 1:0.3 2:0.55238095 3:0.31111111 4:0.28571429 \n"
+"-1 1:0.3 2:0.6 3:0.2 4:0.28571429 \n"
+"-0.2092678511592358 1:0.3 2:0.7047619 3:0.44444444 4:0.28571429 \n"
+"1 1:0.32666667 2:0.3960396 3:0.20408163 4:0.28571429 \n"
+"-0.2062452460202211 1:0.32666667 2:0.55445545 3:0.55102041 4:0.28571429 \n"
+"-0.9161086752999634 1:0.32666667 2:0.65346535 3:0.59183673 4:0.28571429 \n"
+"0.1806946055210689 1:0.37333333 2:0.5 3:0.25 4:0.28571429 \n"
+"-0.00868962573219461 1:0.4 2:0.2 3:0.2 4:0.28571429 \n"
+"-0.2393378447072121 1:0.4 2:0.2 3:0.65 4:0.28571429 \n"
+"1 1:0.4 2:0.44444444 3:0.6 4:0.28571429 \n"
+"1 1:0.4 2:0.54444444 3:0.4 4:0.28571429 \n"
+"-0.002414819981314899 1:0.4 2:0.8 3:0.8 4:0.28571429 \n"
+"-0.020036072540305 1:0.42666667 2:0.30232558 3:0.59375 4:0.28571429 \n"
+"0.03398685675855961 1:0.42666667 2:0.80232558 3:0.5 4:0.28571429 \n"
+"0.2112501195531246 1:0.45333333 2:0.30487805 3:0.39705882 4:0.28571429 \n"
+"-0.3883166443521887 1:0.45333333 2:0.69512195 3:0.29411765 4:0.28571429 \n"
+"-0.7831384196100754 1:0.45333333 2:0.80487805 3:0.35294118 4:0.28571429 \n"
+"1 1:0.47333333 2:0.4556962 3:0.29577465 4:0.28571429 \n"
+"0.3378134201057068 1:0.47333333 2:0.49367089 3:0.45070423 4:0.28571429 \n"
+"0.04082363374500229 1:0.47333333 2:0.59493671 3:0.54929577 4:0.28571429 \n"
+"-0.1532313631608456 1:0.5 2:0.2 3:0.25333333 4:0.28571429 \n"
+"0.1380902769140323 1:0.5 2:0.65333333 3:0.74666667 4:0.28571429 \n"
+"-0.01975576171928858 1:0.52666667 2:0.1971831 3:0.69620253 4:0.28571429 \n"
+"-1 1:0.52666667 2:0.45070423 3:0.20253165 4:0.28571429 \n"
+"-1 1:0.52666667 2:0.49295775 3:0.25316456 4:0.28571429 \n"
+"-0.3103618655012569 1:0.52666667 2:0.49295775 3:0.4556962 4:0.28571429 \n"
+"1 1:0.52666667 2:0.70422535 3:0.5443038 4:0.28571429 \n"
+"0.9381322913971272 1:0.55333333 2:0.34328358 3:0.4939759 4:0.28571429 \n"
+"-0.0994378374125251 1:0.55333333 2:0.40298507 3:0.20481928 4:0.28571429 \n"
+"-0.05038129662857919 1:0.55333333 2:0.40298507 3:0.34939759 4:0.28571429 \n"
+"-0.01254952373562108 1:0.55333333 2:0.44776119 3:0.20481928 4:0.28571429 \n"
+"-1 1:0.55333333 2:0.49253731 3:0.4939759 4:0.28571429 \n"
+"-0.2830598088943482 1:0.55333333 2:0.55223881 3:0.39759036 4:0.28571429 \n"
+"-1 1:0.55333333 2:0.74626866 3:0.60240964 4:0.28571429 \n"
+"1 1:0.57333333 2:0.453125 3:0.75581395 4:0.28571429 \n"
+"1 1:0.57333333 2:0.546875 3:0.25581395 4:0.28571429 \n"
+"1 1:0.57333333 2:0.796875 3:0.60465116 4:0.28571429 \n"
+"1 1:0.6 2:0.55 3:0.5 4:0.28571429 \n"
+"-0.2212560033820343 1:0.6 2:0.75 3:0.75555556 4:0.28571429 \n"
+"-0.1960173777076425 1:0.6 2:0.8 3:0.75555556 4:0.28571429 \n"
+"-1 1:0.62666667 2:0.44642857 3:0.44680851 4:0.28571429 \n"
+"-0.9474008171313877 1:0.62666667 2:0.55357143 3:0.75531915 4:0.28571429 \n"
+"0.320042701644004 1:0.62666667 2:0.64285714 3:0.55319149 4:0.28571429 \n"
+"0.5572991210357569 1:0.62666667 2:0.80357143 3:0.25531915 4:0.28571429 \n"
+"-0.01674810004851782 1:0.62666667 2:0.80357143 3:0.59574468 4:0.28571429 \n"
+"-0.9665533284427191 1:0.65333333 2:0.25 3:0.79591837 4:0.28571429 \n"
+"0.07370729259835491 1:0.65333333 2:0.34615385 3:0.29591837 4:0.28571429 \n"
+"-0.634320632020838 1:0.65333333 2:0.44230769 3:0.5 4:0.28571429 \n"
+"-1 1:0.65333333 2:0.55769231 3:0.79591837 4:0.28571429 \n"
+"0.6678250558289185 1:0.67333333 2:0.20408163 3:0.75247525 4:0.28571429 \n"
+"1 1:0.67333333 2:0.30612245 3:0.2970297 4:0.28571429 \n"
+"1 1:0.67333333 2:0.55102041 3:0.2970297 4:0.28571429 \n"
+"1 1:0.67333333 2:0.55102041 3:0.7029703 4:0.28571429 \n"
+"-1 1:0.67333333 2:0.69387755 3:0.65346535 4:0.28571429 \n"
+"1 1:0.67333333 2:0.75510204 3:0.6039604 4:0.28571429 \n"
+"-1 1:0.67333333 2:0.75510204 3:0.65346535 4:0.28571429 \n"
+"-0.03088693046397993 1:0.67333333 2:0.75510204 3:0.8019802 4:0.28571429 \n"
+"-1 1:0.7 2:0.4 3:0.4 4:0.28571429 \n"
+"-0.2665795502294132 1:0.7 2:0.48888889 3:0.4 4:0.28571429 \n"
+"-1 1:0.72666667 2:0.19512195 3:0.79816514 4:0.28571429 \n"
+"1 1:0.72666667 2:0.29268293 3:0.69724771 4:0.28571429 \n"
+"0.5562062357584229 1:0.72666667 2:0.34146341 3:0.55045872 4:0.28571429 \n"
+"0.3350906470285724 1:0.72666667 2:0.3902439 3:0.69724771 4:0.28571429 \n"
+"0.08458464490745297 1:0.72666667 2:0.48780488 3:0.30275229 4:0.28571429 \n"
+"0.1350030748690175 1:0.72666667 2:0.48780488 3:0.75229358 4:0.28571429 \n"
+"-0.1355959759370596 1:0.72666667 2:0.65853659 3:0.40366972 4:0.28571429 \n"
+"1 1:0.75333333 2:0.24324324 3:0.3539823 4:0.28571429 \n"
+"1 1:0.75333333 2:0.2972973 3:0.39823009 4:0.28571429 \n"
+"-0.01076458780598754 1:0.75333333 2:0.35135135 3:0.3539823 4:0.28571429 \n"
+"0.3325062184578695 1:0.75333333 2:0.40540541 3:0.60176991 4:0.28571429 \n"
+"0.02056886229053846 1:0.75333333 2:0.40540541 3:0.75221239 4:0.28571429 \n"
+"-1 1:0.75333333 2:0.54054054 3:0.79646018 4:0.28571429 \n"
+"-1 1:0.75333333 2:0.7027027 3:0.45132743 4:0.28571429 \n"
+"0.7225386657005112 1:0.77333333 2:0.26470588 3:0.75 4:0.28571429 \n"
+"-1 1:0.77333333 2:0.29411765 3:0.39655172 4:0.28571429 \n"
+"1 1:0.77333333 2:0.35294118 3:0.39655172 4:0.28571429 \n"
+"1 1:0.77333333 2:0.55882353 3:0.5 4:0.28571429 \n"
+"-0.0398919154630647 1:0.77333333 2:0.55882353 3:0.80172414 4:0.28571429 \n"
+"1 1:0.77333333 2:0.70588235 3:0.39655172 4:0.28571429 \n"
+"-0.3099185012768485 1:0.77333333 2:0.76470588 3:0.44827586 4:0.28571429 \n"
+"0.1517874822132456 1:0.77333333 2:0.79411765 3:0.25 4:0.28571429 \n"
+"-1 1:0.77333333 2:0.79411765 3:0.80172414 4:0.28571429 \n"
+"0.8484813143651385 1:0.8 2:0.2 3:0.4 4:0.28571429 \n"
+"0.07388690945811932 1:0.8 2:0.2 3:0.45 4:0.28571429 \n"
+"-0.373632180136441 1:0.8 2:0.2 3:0.6 4:0.28571429 \n"
+"0.7126087501272269 1:0.8 2:0.2 3:0.7 4:0.28571429 \n"
+"0.5129897115547946 1:0.8 2:0.26666667 3:0.4 4:0.28571429 \n"
+"-0.2368856415330242 1:0.8 2:0.3 3:0.8 4:0.28571429 \n"
+"-0.9909047365137956 1:0.8 2:0.36666667 3:0.6 4:0.28571429 \n"
+"-1 1:0.8 2:0.4 3:0.3 4:0.28571429 \n"
+"-1 1:0.8 2:0.43333333 3:0.6 4:0.28571429 \n"
+"1 1:0.8 2:0.5 3:0.5 4:0.28571429 \n"
+"0.747915267823167 1:0.8 2:0.53333333 3:0.2 4:0.28571429 \n"
+"-1 1:0.8 2:0.53333333 3:0.4 4:0.28571429 \n"
+"0.4684610012873625 1:0.8 2:0.6 3:0.5 4:0.28571429 \n"
+"-1 1:0.8 2:0.66666667 3:0.4 4:0.28571429 \n"
+"1 1:0.8 2:0.7 3:0.45 4:0.28571429 \n"
+"1 1:0.8 2:0.7 3:0.75 4:0.28571429 \n"
+"1 1:0.8 2:0.8 3:0.45 4:0.28571429 \n"
+"0.7667760031688282 1:0.8 2:0.8 3:0.75 4:0.28571429 \n"
+"0.4366790463419795 1:0.2 2:0.25 3:0.8 4:0.42857143 \n"
+"0.3572713472673389 1:0.2 2:0.35 3:0.8 4:0.42857143 \n"
+"0.05157729569715787 1:0.2 2:0.7 3:0.35 4:0.42857143 \n"
+"0.1437015156792416 1:0.2 2:0.7 3:0.8 4:0.42857143 \n"
+"0.1057391078643923 1:0.2 2:0.75 3:0.2 4:0.42857143 \n"
+"1 1:0.2 2:0.75 3:0.3 4:0.42857143 \n"
+"0.4022295227494483 1:0.2 2:0.75 3:0.7 4:0.42857143 \n"
+"-0.2603521454922373 1:0.2 2:0.8 3:0.45 4:0.42857143 \n"
+"-1 1:0.2 2:0.8 3:0.8 4:0.42857143 \n"
+"1 1:0.225 2:0.70322581 3:0.71111111 4:0.42857143 \n"
+"0.2930549178660014 1:0.25 2:0.2 3:0.3 4:0.42857143 \n"
+"0.06075958724395708 1:0.25 2:0.3 3:0.8 4:0.42857143 \n"
+"0.02473138698924355 1:0.275 2:0.35172414 3:0.2 4:0.42857143 \n"
+"0.9258466140296825 1:0.275 2:0.75172414 3:0.25454545 4:0.42857143 \n"
+"-0.3334464080350779 1:0.3 2:0.6 3:0.3 4:0.42857143 \n"
+"0.3738127282221404 1:0.325 2:0.25185185 3:0.70769231 4:0.42857143 \n"
+"0.4720824546089779 1:0.325 2:0.8 3:0.75384615 4:0.42857143 \n"
+"-0.5059930574106354 1:0.35 2:0.5 3:0.65714286 4:0.42857143 \n"
+"-0.570070026957038 1:0.375 2:0.352 3:0.34666667 4:0.42857143 \n"
+"-0.9127675552221619 1:0.375 2:0.552 3:0.34666667 4:0.42857143 \n"
+"0.05084456245536301 1:0.375 2:0.752 3:0.70666667 4:0.42857143 \n"
+"0.2253435845961116 1:0.4 2:0.2 3:0.75 4:0.42857143 \n"
+"-1 1:0.4 2:0.35 3:0.55 4:0.42857143 \n"
+"0.02857420325203806 1:0.425 2:0.70434783 3:0.44705882 4:0.42857143 \n"
+"0.537774891139509 1:0.45 2:0.2 3:0.5 4:0.42857143 \n"
+"-0.2396129229583656 1:0.45 2:0.5 3:0.44444444 4:0.42857143 \n"
+"1 1:0.45 2:0.75454545 3:0.34444444 4:0.42857143 \n"
+"-0.01947665695048613 1:0.475 2:0.44761905 3:0.65263158 4:0.42857143 \n"
+"-0.06355054168217732 1:0.475 2:0.75238095 3:0.65263158 4:0.42857143 \n"
+"-0.1023698115433003 1:0.475 2:0.8 3:0.2 4:0.42857143 \n"
+"-0.260002898212768 1:0.55 2:0.4 3:0.7 4:0.42857143 \n"
+"0.006775525698276211 1:0.55 2:0.44444444 3:0.54545455 4:0.42857143 \n"
+"-1 1:0.55 2:0.75555556 3:0.5 4:0.42857143 \n"
+"-0.8480186571824878 1:0.575 2:0.49411765 3:0.4 4:0.42857143 \n"
+"1 1:0.575 2:0.49411765 3:0.74782609 4:0.42857143 \n"
+"1 1:0.575 2:0.70588235 3:0.6 4:0.42857143 \n"
+"0.1938086729646508 1:0.6 2:0.3 3:0.75 4:0.42857143 \n"
+"1 1:0.6 2:0.5 3:0.35 4:0.42857143 \n"
+"0.002158969435392604 1:0.6 2:0.65 3:0.6 4:0.42857143 \n"
+"-0.86397623646373 1:0.625 2:0.2 3:0.8 4:0.42857143 \n"
+"1 1:0.625 2:0.25333333 3:0.752 4:0.42857143 \n"
+"-0.5026859450455132 1:0.625 2:0.4 3:0.648 4:0.42857143 \n"
+"-1 1:0.625 2:0.74666667 3:0.448 4:0.42857143 \n"
+"0.004427053303566669 1:0.65 2:0.2 3:0.54615385 4:0.42857143 \n"
+"1 1:0.65 2:0.4 3:0.35384615 4:0.42857143 \n"
+"0.1691176442758703 1:0.65 2:0.6 3:0.54615385 4:0.42857143 \n"
+"0.8639009881525169 1:0.65 2:0.65714286 3:0.25384615 4:0.42857143 \n"
+"1 1:0.675 2:0.24615385 3:0.74814815 4:0.42857143 \n"
+"0.001828468693192025 1:0.675 2:0.30769231 3:0.25185185 4:0.42857143 \n"
+"-1 1:0.675 2:0.30769231 3:0.45185185 4:0.42857143 \n"
+"-1 1:0.675 2:0.30769231 3:0.7037037 4:0.42857143 \n"
+"-1 1:0.675 2:0.44615385 3:0.7037037 4:0.42857143 \n"
+"-1 1:0.675 2:0.6 3:0.4 4:0.42857143 \n"
+"-0.7965613850269518 1:0.675 2:0.70769231 3:0.2 4:0.42857143 \n"
+"1 1:0.675 2:0.70769231 3:0.4962963 4:0.42857143 \n"
+"-0.4252722687880143 1:0.675 2:0.8 3:0.74814815 4:0.42857143 \n"
+"0.1450719021423953 1:0.7 2:0.2 3:0.35 4:0.42857143 \n"
+"-1 1:0.7 2:0.3 3:0.8 4:0.42857143 \n"
+"-0.09386434943975405 1:0.7 2:0.7 3:0.45 4:0.42857143 \n"
+"1 1:0.7 2:0.8 3:0.3 4:0.42857143 \n"
+"-1 1:0.7 2:0.8 3:0.5 4:0.42857143 \n"
+"0.6704062739379355 1:0.7 2:0.8 3:0.7 4:0.42857143 \n"
+"-1 1:0.725 2:0.2 3:0.49655172 4:0.42857143 \n"
+"-1 1:0.725 2:0.25454545 3:0.4 4:0.42857143 \n"
+"1 1:0.725 2:0.4 3:0.6 4:0.42857143 \n"
+"-1 1:0.725 2:0.54545455 3:0.30344828 4:0.42857143 \n"
+"-1 1:0.725 2:0.65454545 3:0.6 4:0.42857143 \n"
+"1 1:0.725 2:0.74545455 3:0.6 4:0.42857143 \n"
+"-0.9851987897531498 1:0.725 2:0.8 3:0.2 4:0.42857143 \n"
+"1 1:0.75 2:0.4 3:0.75333333 4:0.42857143 \n"
+"0.6146634558397266 1:0.75 2:0.6 3:0.7 4:0.42857143 \n"
+"-0.5077443792130245 1:0.75 2:0.66 3:0.65333333 4:0.42857143 \n"
+"1 1:0.75 2:0.66 3:0.75333333 4:0.42857143 \n"
+"0.5774658285198147 1:0.75 2:0.7 3:0.5 4:0.42857143 \n"
+"0.03261634404365939 1:0.75 2:0.8 3:0.25333333 4:0.42857143 \n"
+"0.1454829506812746 1:0.75 2:0.8 3:0.54666667 4:0.42857143 \n"
+"1 1:0.75 2:0.8 3:0.7 4:0.42857143 \n"
+"1 1:0.775 2:0.2 3:0.70322581 4:0.42857143 \n"
+"-0.8677231718298125 1:0.775 2:0.24444444 3:0.6 4:0.42857143 \n"
+"-0.1952018655833204 1:0.775 2:0.35555556 3:0.4 4:0.42857143 \n"
+"-0.3890047346408281 1:0.775 2:0.55555556 3:0.4 4:0.42857143 \n"
+"-0.01748297460381265 1:0.775 2:0.55555556 3:0.8 4:0.42857143 \n"
+"0.02535137763971316 1:0.775 2:0.75555556 3:0.3483871 4:0.42857143 \n"
+"-1 1:0.775 2:0.75555556 3:0.70322581 4:0.42857143 \n"
+"0.04041888343494857 1:0.8 2:0.2 3:0.5 4:0.42857143 \n"
+"-1 1:0.8 2:0.25 3:0.3 4:0.42857143 \n"
+"1 1:0.8 2:0.25 3:0.5 4:0.42857143 \n"
+"-1 1:0.8 2:0.3 3:0.6 4:0.42857143 \n"
+"-0.004157921718993903 1:0.8 2:0.4 3:0.35 4:0.42857143 \n"
+"0.8317551307043267 1:0.8 2:0.45 3:0.5 4:0.42857143 \n"
+"-0.004684526955486306 1:0.8 2:0.5 3:0.35 4:0.42857143 \n"
+"-0.03411606823771664 1:0.8 2:0.55 3:0.6 4:0.42857143 \n"
+"0.08549004309450049 1:0.8 2:0.6 3:0.65 4:0.42857143 \n"
+"-1 1:0.8 2:0.7 3:0.6 4:0.42857143 \n"
+"-0.5603259898836467 1:0.8 2:0.8 3:0.45 4:0.42857143 \n"
+"-0.248683869085667 1:0.2 2:0.2 3:0.8 4:0.57142857 \n"
+"-0.4435068371696607 1:0.2 2:0.3 3:0.5 4:0.57142857 \n"
+"-0.02614612852331612 1:0.2 2:0.35 3:0.6 4:0.57142857 \n"
+"0.549513470453233 1:0.2 2:0.45 3:0.44 4:0.57142857 \n"
+"0.1310224869014791 1:0.2 2:0.5 3:0.2 4:0.57142857 \n"
+"-0.2518864135271009 1:0.2 2:0.6 3:0.26 4:0.57142857 \n"
+"0.5732588312696995 1:0.2 2:0.7 3:0.2 4:0.57142857 \n"
+"-1 1:0.2 2:0.8 3:0.2 4:0.57142857 \n"
+"-0.1316570467674567 1:0.2 2:0.8 3:0.7 4:0.57142857 \n"
+"-0.07832078323597566 1:0.224 2:0.44845361 3:0.69642857 4:0.57142857 \n"
+"0.1545579400717304 1:0.224 2:0.70103093 3:0.80357143 4:0.57142857 \n"
+"-0.5516831168581388 1:0.252 2:0.59893048 3:0.55555556 4:0.57142857 \n"
+"-1 1:0.252 2:0.65240642 3:0.3968254 4:0.57142857 \n"
+"-0.1051219257679478 1:0.276 2:0.49723757 3:0.65217391 4:0.57142857 \n"
+"-0.04656017637359811 1:0.276 2:0.60220994 3:0.75362319 4:0.57142857 \n"
+"0.2267013047439382 1:0.276 2:0.80110497 3:0.5942029 4:0.57142857 \n"
+"0.02555419951336271 1:0.3 2:0.2 3:0.70666667 4:0.57142857 \n"
+"1 1:0.3 2:0.70285714 3:0.45333333 4:0.57142857 \n"
+"-0.004030793361216982 1:0.3 2:0.8 3:0.2 4:0.57142857 \n"
+"-0.2019590919288011 1:0.3 2:0.8 3:0.34666667 4:0.57142857 \n"
+"-0.2702371300494925 1:0.324 2:0.59763314 3:0.19753086 4:0.57142857 \n"
+"0.02911726719890843 1:0.352 2:0.25308642 3:0.60227273 4:0.57142857 \n"
+"1 1:0.352 2:0.5 3:0.54545455 4:0.57142857 \n"
+"0.120159090037537 1:0.376 2:0.19871795 3:0.55319149 4:0.57142857 \n"
+"-0.4870567741773891 1:0.4 2:0.5 3:0.8 4:0.57142857 \n"
+"-0.6398816697426281 1:0.4 2:0.6 3:0.4 4:0.57142857 \n"
+"1 1:0.424 2:0.45138889 3:0.3490566 4:0.57142857 \n"
+"0.3225747150594811 1:0.424 2:0.65277778 3:0.30188679 4:0.57142857 \n"
+"-1 1:0.424 2:0.79861111 3:0.60377358 4:0.57142857 \n"
+"-0.3501770185889966 1:0.452 2:0.49635036 3:0.60176991 4:0.57142857 \n"
+"0.987382344515616 1:0.452 2:0.54744526 3:0.54867257 4:0.57142857 \n"
+"-1 1:0.452 2:0.59854015 3:0.54867257 4:0.57142857 \n"
+"-0.3553346371671059 1:0.476 2:0.19847328 3:0.54621849 4:0.57142857 \n"
+"-0.02054932002366963 1:0.476 2:0.7480916 3:0.25210084 4:0.57142857 \n"
+"-0.1011297794658766 1:0.5 2:0.4 3:0.2 4:0.57142857 \n"
+"0.903827915244604 1:0.524 2:0.79831933 3:0.54961832 4:0.57142857 \n"
+"1 1:0.552 2:0.44642857 3:0.55072464 4:0.57142857 \n"
+"0.02610800579090693 1:0.552 2:0.65178571 3:0.44927536 4:0.57142857 \n"
+"-1 1:0.552 2:0.69642857 3:0.60144928 4:0.57142857 \n"
+"0.05126280856125113 1:0.576 2:0.5 3:0.65277778 4:0.57142857 \n"
+"0.4365498590176495 1:0.6 2:0.2 3:0.4 4:0.57142857 \n"
+"0.168156828489498 1:0.6 2:0.25 3:0.45333333 4:0.57142857 \n"
+"-0.5316033897367828 1:0.6 2:0.7 3:0.25333333 4:0.57142857 \n"
+"0.3990919785436484 1:0.624 2:0.79787234 3:0.75 4:0.57142857 \n"
+"-1 1:0.652 2:0.40229885 3:0.34969325 4:0.57142857 \n"
+"-1 1:0.652 2:0.49425287 3:0.49693252 4:0.57142857 \n"
+"0.009090282594725678 1:0.652 2:0.8045977 3:0.60122699 4:0.57142857 \n"
+"1 1:0.676 2:0.19753086 3:0.65088757 4:0.57142857 \n"
+"-1 1:0.676 2:0.24691358 3:0.44970414 4:0.57142857 \n"
+"1 1:0.676 2:0.65432099 3:0.49704142 4:0.57142857 \n"
+"-0.1966678137844305 1:0.676 2:0.80246914 3:0.49704142 4:0.57142857 \n"
+"-0.5375743443093622 1:0.7 2:0.30666667 3:0.6 4:0.57142857 \n"
+"-0.2757255542119076 1:0.7 2:0.30666667 3:0.8 4:0.57142857 \n"
+"1 1:0.7 2:0.34666667 3:0.49714286 4:0.57142857 \n"
+"1 1:0.7 2:0.45333333 3:0.49714286 4:0.57142857 \n"
+"1 1:0.7 2:0.6 3:0.54857143 4:0.57142857 \n"
+"0.6563317356723883 1:0.7 2:0.8 3:0.30285714 4:0.57142857 \n"
+"-0.5277498611765581 1:0.724 2:0.20289855 3:0.80110497 4:0.57142857 \n"
+"0.2253991767298014 1:0.724 2:0.24637681 3:0.29834254 4:0.57142857 \n"
+"1 1:0.724 2:0.4057971 3:0.75138122 4:0.57142857 \n"
+"1 1:0.724 2:0.55072464 3:0.24861878 4:0.57142857 \n"
+"-1 1:0.724 2:0.79710145 3:0.80110497 4:0.57142857 \n"
+"-0.9139287476476388 1:0.752 2:0.19354839 3:0.60106383 4:0.57142857 \n"
+"0.01510594093804324 1:0.752 2:0.30645161 3:0.5 4:0.57142857 \n"
+"-0.3765018769372125 1:0.752 2:0.35483871 3:0.79787234 4:0.57142857 \n"
+"0.05784418861773129 1:0.752 2:0.4516129 3:0.25 4:0.57142857 \n"
+"-1 1:0.752 2:0.5 3:0.60106383 4:0.57142857 \n"
+"-1 1:0.752 2:0.5483871 3:0.60106383 4:0.57142857 \n"
+"-1 1:0.752 2:0.75806452 3:0.45212766 4:0.57142857 \n"
+"-1 1:0.752 2:0.75806452 3:0.64893617 4:0.57142857 \n"
+"0.8773866125398948 1:0.776 2:0.19642857 3:0.5 4:0.57142857 \n"
+"1 1:0.776 2:0.19642857 3:0.75257732 4:0.57142857 \n"
+"-1 1:0.776 2:0.30357143 3:0.59793814 4:0.57142857 \n"
+"-1 1:0.776 2:0.30357143 3:0.64948454 4:0.57142857 \n"
+"0.8944113653306498 1:0.776 2:0.35714286 3:0.44845361 4:0.57142857 \n"
+"1 1:0.776 2:0.39285714 3:0.5 4:0.57142857 \n"
+"0.40295585925151 1:0.776 2:0.69642857 3:0.5 4:0.57142857 \n"
+"-1 1:0.776 2:0.75 3:0.35051546 4:0.57142857 \n"
+"1 1:0.776 2:0.80357143 3:0.29896907 4:0.57142857 \n"
+"0.5735811617234569 1:0.776 2:0.80357143 3:0.79896907 4:0.57142857 \n"
+"1 1:0.8 2:0.26 3:0.5 4:0.57142857 \n"
+"-0.004178710305404516 1:0.8 2:0.26 3:0.6 4:0.57142857 \n"
+"-1 1:0.8 2:0.26 3:0.65 4:0.57142857 \n"
+"0.4352646269774724 1:0.8 2:0.36 3:0.75 4:0.57142857 \n"
+"1 1:0.8 2:0.4 3:0.7 4:0.57142857 \n"
+"-0.8388704402027475 1:0.8 2:0.5 3:0.65 4:0.57142857 \n"
+"-1 1:0.8 2:0.54 3:0.65 4:0.57142857 \n"
+"0.5700763153796304 1:0.8 2:0.54 3:0.75 4:0.57142857 \n"
+"1 1:0.8 2:0.66 3:0.5 4:0.57142857 \n"
+"0.06095501860553268 1:0.8 2:0.8 3:0.75 4:0.57142857 \n"
+"0.1820322643164359 1:0.2 2:0.2 3:0.2 4:0.71428571 \n"
+"-0.3926416480088391 1:0.2 2:0.2 3:0.8 4:0.71428571 \n"
+"0.02606168692091194 1:0.2 2:0.45 3:0.2 4:0.71428571 \n"
+"0.6294920100913898 1:0.2 2:0.75 3:0.2 4:0.71428571 \n"
+"-0.04388624806780776 1:0.2 2:0.8 3:0.2 4:0.71428571 \n"
+"-0.238752128416839 1:0.2 2:0.8 3:0.5 4:0.71428571 \n"
+"-0.01897166667052623 1:0.2 2:0.8 3:0.8 4:0.71428571 \n"
+"-0.7256467153918188 1:0.22666667 2:0.25 3:0.20588235 4:0.71428571 \n"
+"0.001176557978518363 1:0.22666667 2:0.25 3:0.64705882 4:0.71428571 \n"
+"-0.06607514719955758 1:0.22666667 2:0.30172414 3:0.35294118 4:0.71428571 \n"
+"0.08546225442915459 1:0.22666667 2:0.40086207 3:0.35294118 4:0.71428571 \n"
+"-0.3354199807240861 1:0.22666667 2:0.59913793 3:0.25 4:0.71428571 \n"
+"0.08395321030371307 1:0.22666667 2:0.75 3:0.39705882 4:0.71428571 \n"
+"0.497639704713658 1:0.25 2:0.24888889 3:0.74666667 4:0.71428571 \n"
+"0.3261724365532827 1:0.25 2:0.44888889 3:0.2 4:0.71428571 \n"
+"-1 1:0.25 2:0.49777778 3:0.2 4:0.71428571 \n"
+"-0.01707142805405292 1:0.25 2:0.6 3:0.2 4:0.71428571 \n"
+"0.1965761796205795 1:0.27666667 2:0.19815668 3:0.39759036 4:0.71428571 \n"
+"1 1:0.27666667 2:0.40092166 3:0.20481928 4:0.71428571 \n"
+"0.01248479228711867 1:0.27666667 2:0.40092166 3:0.65060241 4:0.71428571 \n"
+"0.1681702669771042 1:0.3 2:0.54761905 3:0.54444444 4:0.71428571 \n"
+"0.5367880161492208 1:0.35 2:0.8 3:0.4 4:0.71428571 \n"
+"0.2786612702941667 1:0.37666667 2:0.7486631 3:0.20353982 4:0.71428571 \n"
+"0.001149715427723506 1:0.4 2:0.5 3:0.6 4:0.71428571 \n"
+"-0.04768988701739543 1:0.4 2:0.55 3:0.35 4:0.71428571 \n"
+"-0.003371292988313713 1:0.4 2:0.8 3:0.55 4:0.71428571 \n"
+"-0.004036417229161445 1:0.42666667 2:0.40116279 3:0.453125 4:0.71428571 \n"
+"0.0004850820523512712 1:0.42666667 2:0.40116279 3:0.75 4:0.71428571 \n"
+"0.198031177330325 1:0.45 2:0.44848485 3:0.45185185 4:0.71428571 \n"
+"-1 1:0.47666667 2:0.35031847 3:0.34965035 4:0.71428571 \n"
+"-0.3365812408602349 1:0.47666667 2:0.75159236 3:0.3986014 4:0.71428571 \n"
+"-0.1906757558265303 1:0.5 2:0.2 3:0.7 4:0.71428571 \n"
+"0.1218698027718366 1:0.5 2:0.25333333 3:0.3 4:0.71428571 \n"
+"-1 1:0.5 2:0.8 3:0.4 4:0.71428571 \n"
+"-0.934905502312028 1:0.52666667 2:0.3028169 3:0.5 4:0.71428571 \n"
+"1 1:0.52666667 2:0.64788732 3:0.70253165 4:0.71428571 \n"
+"1 1:0.55 2:0.8 3:0.55151515 4:0.71428571 \n"
+"1 1:0.57666667 2:0.4488189 3:0.35260116 4:0.71428571 \n"
+"0.198101648161742 1:0.57666667 2:0.65354331 3:0.39884393 4:0.71428571 \n"
+"-1 1:0.57666667 2:0.7007874 3:0.64739884 4:0.71428571 \n"
+"-1 1:0.6 2:0.4 3:0.65 4:0.71428571 \n"
+"1 1:0.6 2:0.7 3:0.5 4:0.71428571 \n"
+"0.7325164329539459 1:0.62666667 2:0.34821429 3:0.45212766 4:0.71428571 \n"
+"0.4325198612801907 1:0.65 2:0.3047619 3:0.3025641 4:0.71428571 \n"
+"1 1:0.65 2:0.3047619 3:0.4974359 4:0.71428571 \n"
+"-0.2123898748356873 1:0.65 2:0.6 3:0.4 4:0.71428571 \n"
+"0.200151570096095 1:0.65 2:0.7047619 3:0.65128205 4:0.71428571 \n"
+"-1 1:0.67666667 2:0.40206186 3:0.55172414 4:0.71428571 \n"
+"1 1:0.67666667 2:0.40206186 3:0.69950739 4:0.71428571 \n"
+"-0.0145641384238197 1:0.67666667 2:0.45360825 3:0.44827586 4:0.71428571 \n"
+"-0.0582741051205262 1:0.67666667 2:0.64948454 3:0.49753695 4:0.71428571 \n"
+"-1 1:0.67666667 2:0.64948454 3:0.60098522 4:0.71428571 \n"
+"0.09156037852307627 1:0.7 2:0.3 3:0.54761905 4:0.71428571 \n"
+"-1 1:0.7 2:0.4 3:0.4 4:0.71428571 \n"
+"1 1:0.7 2:0.6 3:0.7 4:0.71428571 \n"
+"-0.9734270597236109 1:0.7 2:0.65555556 3:0.4 4:0.71428571 \n"
+"-0.09505657552929996 1:0.7 2:0.7 3:0.7 4:0.71428571 \n"
+"-0.2020559135968502 1:0.7 2:0.75555556 3:0.8 4:0.71428571 \n"
+"1 1:0.72666667 2:0.30487805 3:0.75229358 4:0.71428571 \n"
+"1 1:0.72666667 2:0.35365854 3:0.55045872 4:0.71428571 \n"
+"-1 1:0.72666667 2:0.5 3:0.60091743 4:0.71428571 \n"
+"-0.001975648498656129 1:0.72666667 2:0.54878049 3:0.20183486 4:0.71428571 \n"
+"1 1:0.72666667 2:0.69512195 3:0.29816514 4:0.71428571 \n"
+"1 1:0.72666667 2:0.69512195 3:0.5 4:0.71428571 \n"
+"0.7658472620592398 1:0.75 2:0.25333333 3:0.4 4:0.71428571 \n"
+"-1 1:0.75 2:0.34666667 3:0.35111111 4:0.71428571 \n"
+"-0.6538221343856171 1:0.75 2:0.4 3:0.8 4:0.71428571 \n"
+"-1 1:0.75 2:0.49333333 3:0.35111111 4:0.71428571 \n"
+"-0.8726105719156585 1:0.75 2:0.65333333 3:0.4 4:0.71428571 \n"
+"-1 1:0.77666667 2:0.44776119 3:0.79828326 4:0.71428571 \n"
+"-1 1:0.77666667 2:0.49253731 3:0.39914163 4:0.71428571 \n"
+"1 1:0.77666667 2:0.59701493 3:0.49785408 4:0.71428571 \n"
+"-1 1:0.77666667 2:0.74626866 3:0.79828326 4:0.71428571 \n"
+"-0.4263801490057078 1:0.77666667 2:0.80597015 3:0.45064378 4:0.71428571 \n"
+"0.4888579561003693 1:0.77666667 2:0.80597015 3:0.69957082 4:0.71428571 \n"
+"-0.03963233589011183 1:0.8 2:0.2 3:0.25 4:0.71428571 \n"
+"-1 1:0.8 2:0.2 3:0.6 4:0.71428571 \n"
+"1 1:0.8 2:0.2 3:0.7 4:0.71428571 \n"
+"0.1927417663366641 1:0.8 2:0.2 3:0.75 4:0.71428571 \n"
+"-0.3511423409014227 1:0.8 2:0.25 3:0.6 4:0.71428571 \n"
+"-1 1:0.8 2:0.25 3:0.65 4:0.71428571 \n"
+"0.07271696019244377 1:0.8 2:0.25 3:0.75 4:0.71428571 \n"
+"-1 1:0.8 2:0.25 3:0.8 4:0.71428571 \n"
+"1 1:0.8 2:0.3 3:0.75 4:0.71428571 \n"
+"-0.01244373864368753 1:0.8 2:0.35 3:0.45 4:0.71428571 \n"
+"1 1:0.8 2:0.35 3:0.7 4:0.71428571 \n"
+"1 1:0.8 2:0.5 3:0.5 4:0.71428571 \n"
+"-0.1901462385849555 1:0.8 2:0.5 3:0.6 4:0.71428571 \n"
+"0.03049664724142667 1:0.8 2:0.5 3:0.75 4:0.71428571 \n"
+"-0.9981782114293078 1:0.8 2:0.55 3:0.65 4:0.71428571 \n"
+"0.217217679035339 1:0.8 2:0.55 3:0.75 4:0.71428571 \n"
+"1 1:0.8 2:0.6 3:0.5 4:0.71428571 \n"
+"1 1:0.8 2:0.65 3:0.75 4:0.71428571 \n"
+"-0.3121585368676181 1:0.8 2:0.7 3:0.3 4:0.71428571 \n"
+"-0.2114246245640124 1:0.8 2:0.7 3:0.6 4:0.71428571 \n"
+"1 1:0.8 2:0.8 3:0.7 4:0.71428571 \n"
+"-0.3264250562719014 1:0.2 2:0.3 3:0.5 4:0.85714286 \n"
+"0.1721577909312348 1:0.2 2:0.3 3:0.8 4:0.85714286 \n"
+"0.02237290455638955 1:0.2 2:0.75 3:0.75714286 4:0.85714286 \n"
+"-0.04063346670867544 1:0.2 2:0.8 3:0.8 4:0.85714286 \n"
+"0.2949674925775551 1:0.22571429 2:0.4501845 3:0.20253165 4:0.85714286 \n"
+"0.05059748362150073 1:0.22571429 2:0.70110701 3:0.20253165 4:0.85714286 \n"
+"0.00974147430624394 1:0.22571429 2:0.70110701 3:0.35443038 4:0.85714286 \n"
+"0.05359728039097782 1:0.22571429 2:0.74907749 3:0.20253165 4:0.85714286 \n"
+"-0.5427767004962329 1:0.22571429 2:0.80073801 3:0.20253165 4:0.85714286 \n"
+"0.02517280269224634 1:0.25142857 2:0.19847328 3:0.29545455 4:0.85714286 \n"
+"0.2531175068178947 1:0.25142857 2:0.19847328 3:0.45454545 4:0.85714286 \n"
+"0.1214485045248486 1:0.25142857 2:0.45038168 3:0.39772727 4:0.85714286 \n"
+"-0.04184775447037521 1:0.25142857 2:0.5 3:0.75 4:0.85714286 \n"
+"0.07181356363444506 1:0.25142857 2:0.7519084 3:0.75 4:0.85714286 \n"
+"-0.07677090596382211 1:0.27428571 2:0.5984252 3:0.25 4:0.85714286 \n"
+"0.2899873363461468 1:0.27428571 2:0.7519685 3:0.35416667 4:0.85714286 \n"
+"-0.03210334454583658 1:0.3 2:0.55102041 3:0.24761905 4:0.85714286 \n"
+"0.04019738535209839 1:0.32571429 2:0.19915254 3:0.25438596 4:0.85714286 \n"
+"0.2758328932311166 1:0.32571429 2:0.75 3:0.20175439 4:0.85714286 \n"
+"-0.07538357441516025 1:0.35142857 2:0.34801762 3:0.3495935 4:0.85714286 \n"
+"-0.1530495033856249 1:0.35142857 2:0.49779736 3:0.25203252 4:0.85714286 \n"
+"-0.01200589848831771 1:0.47428571 2:0.20108696 3:0.80120482 4:0.85714286 \n"
+"0.001405258802173882 1:0.47428571 2:0.40217391 3:0.25301205 4:0.85714286 \n"
+"0.007148346462949275 1:0.47428571 2:0.40217391 3:0.69879518 4:0.85714286 \n"
+"0.04582619911534432 1:0.5 2:0.25142857 3:0.34857143 4:0.85714286 \n"
+"-0.1280436464637393 1:0.5 2:0.25142857 3:0.4 4:0.85714286 \n"
+"-0.8166955006417755 1:0.5 2:0.4 3:0.65142857 4:0.85714286 \n"
+"-0.472255911507537 1:0.5 2:0.49714286 3:0.2 4:0.85714286 \n"
+"0.08487488917289589 1:0.5 2:0.6 3:0.54857143 4:0.85714286 \n"
+"0.09791022066040828 1:0.52571429 2:0.34939759 3:0.75 4:0.85714286 \n"
+"0.02822489308712915 1:0.52571429 2:0.34939759 3:0.79891304 4:0.85714286 \n"
+"-1 1:0.52571429 2:0.69879518 3:0.45108696 4:0.85714286 \n"
+"0.2832961749623599 1:0.55142857 2:0.19745223 3:0.5492228 4:0.85714286 \n"
+"0.3035493282269475 1:0.55142857 2:0.35031847 3:0.5492228 4:0.85714286 \n"
+"-0.6402989185447984 1:0.55142857 2:0.5477707 3:0.69948187 4:0.85714286 \n"
+"0.00843356042750215 1:0.55142857 2:0.64968153 3:0.60103627 4:0.85714286 \n"
+"0.001208088116783187 1:0.57428571 2:0.34899329 3:0.70149254 4:0.85714286 \n"
+"-0.1875150237355284 1:0.57428571 2:0.40268456 3:0.44776119 4:0.85714286 \n"
+"0.117039604604301 1:0.6 2:0.25 3:0.2 4:0.85714286 \n"
+"0.05319089432520391 1:0.6 2:0.25 3:0.7 4:0.85714286 \n"
+"1 1:0.6 2:0.35 3:0.75238095 4:0.85714286 \n"
+"0.9514758201606511 1:0.6 2:0.4 3:0.5 4:0.85714286 \n"
+"0.2401866515202046 1:0.6 2:0.55 3:0.3 4:0.85714286 \n"
+"0.2222768336608065 1:0.6 2:0.8 3:0.54761905 4:0.85714286 \n"
+"-0.2785429149403074 1:0.62571429 2:0.19847328 3:0.30136986 4:0.85714286 \n"
+"0.9334615972149889 1:0.62571429 2:0.19847328 3:0.69863014 4:0.85714286 \n"
+"0.01172676438724969 1:0.62571429 2:0.45038168 3:0.74885845 4:0.85714286 \n"
+"-0.008297074006891393 1:0.62571429 2:0.49618321 3:0.45205479 4:0.85714286 \n"
+"0.3689163082289157 1:0.62571429 2:0.64885496 3:0.54794521 4:0.85714286 \n"
+"0.03364762975177178 1:0.62571429 2:0.7480916 3:0.74885845 4:0.85714286 \n"
+"-1 1:0.65142857 2:0.30327869 3:0.60087719 4:0.85714286 \n"
+"-0.03892964296705419 1:0.65142857 2:0.59836066 3:0.64912281 4:0.85714286 \n"
+"1 1:0.65142857 2:0.75409836 3:0.29824561 4:0.85714286 \n"
+"-0.1643068803315308 1:0.65142857 2:0.80327869 3:0.79824561 4:0.85714286 \n"
+"-0.7014257688599326 1:0.67428571 2:0.20175439 3:0.80084746 4:0.85714286 \n"
+"0.3358891658992599 1:0.67428571 2:0.5 3:0.25 4:0.85714286 \n"
+"-0.9108367350182603 1:0.67428571 2:0.79824561 3:0.19915254 4:0.85714286 \n"
+"1 1:0.67428571 2:0.79824561 3:0.35169492 4:0.85714286 \n"
+"-1 1:0.7 2:0.2 3:0.49795918 4:0.85714286 \n"
+"0.7976438846306403 1:0.7 2:0.64761905 3:0.75102041 4:0.85714286 \n"
+"-1 1:0.7 2:0.75238095 3:0.4 4:0.85714286 \n"
+"-1 1:0.7 2:0.8 3:0.49795918 4:0.85714286 \n"
+"-1 1:0.72571429 2:0.25 3:0.7992126 4:0.85714286 \n"
+"0.9990140486475312 1:0.72571429 2:0.44791667 3:0.5 4:0.85714286 \n"
+"-0.4576182894624443 1:0.72571429 2:0.44791667 3:0.5511811 4:0.85714286 \n"
+"1 1:0.72571429 2:0.64583333 3:0.5 4:0.85714286 \n"
+"0.1284671564274821 1:0.72571429 2:0.80208333 3:0.3503937 4:0.85714286 \n"
+"0.0562616343931033 1:0.75142857 2:0.29885057 3:0.20152091 4:0.85714286 \n"
+"-1 1:0.75142857 2:0.65517241 3:0.39923954 4:0.85714286 \n"
+"1 1:0.75142857 2:0.8045977 3:0.39923954 4:0.85714286 \n"
+"-1 1:0.75142857 2:0.8045977 3:0.49809886 4:0.85714286 \n"
+"0.3283349980851147 1:0.77428571 2:0.25316456 3:0.4501845 4:0.85714286 \n"
+"-0.2628255262324025 1:0.77428571 2:0.25316456 3:0.64944649 4:0.85714286 \n"
+"0.04519543469978991 1:0.77428571 2:0.35443038 3:0.19926199 4:0.85714286 \n"
+"-0.5548910389776439 1:0.77428571 2:0.40506329 3:0.29889299 4:0.85714286 \n"
+"-0.1819244854992227 1:0.77428571 2:0.49367089 3:0.80073801 4:0.85714286 \n"
+"-0.2261995515985763 1:0.77428571 2:0.69620253 3:0.5498155 4:0.85714286 \n"
+"-0.5875371597530349 1:0.8 2:0.2 3:0.3 4:0.85714286 \n"
+"1 1:0.8 2:0.2 3:0.4 4:0.85714286 \n"
+"0.9679928604468668 1:0.8 2:0.2 3:0.7 4:0.85714286 \n"
+"-0.8199675619494869 1:0.8 2:0.25714286 3:0.6 4:0.85714286 \n"
+"0.2746574186008952 1:0.8 2:0.25714286 3:0.75 4:0.85714286 \n"
+"0.01599570118977579 1:0.8 2:0.35714286 3:0.75 4:0.85714286 \n"
+"0.0003079962876343023 1:0.8 2:0.4 3:0.45 4:0.85714286 \n"
+"0.8817029748186554 1:0.8 2:0.5 3:0.2 4:0.85714286 \n"
+"-1 1:0.8 2:0.5 3:0.65 4:0.85714286 \n"
+"1 1:0.8 2:0.5 3:0.75 4:0.85714286 \n"
+"-0.01504096111439584 1:0.8 2:0.54285714 3:0.4 4:0.85714286 \n"
+"1 1:0.8 2:0.6 3:0.5 4:0.85714286 \n"
+"-0.05410679227512152 1:0.8 2:0.6 3:0.7 4:0.85714286 \n"
+"-0.4041389476094161 1:0.8 2:0.65714286 3:0.2 4:0.85714286 \n"
+"-0.6027909101629991 1:0.8 2:0.65714286 3:0.65 4:0.85714286 \n"
+"-1 1:0.8 2:0.7 3:0.65 4:0.85714286 \n"
+"0.4332564748372804 1:0.8 2:0.8 3:0.55 4:0.85714286 \n"
+"-0.7003927070285001 1:0.2 2:0.3 3:0.25 4:1 \n"
+"-0.06910354774346347 1:0.2 2:0.6 3:0.65 4:1 \n"
+"0.4873476540844993 1:0.2 2:0.7 3:0.3 4:1 \n"
+"0.3372038850162719 1:0.2 2:0.7 3:0.75 4:1 \n"
+"-0.2191705202243991 1:0.2 2:0.8 3:0.2 4:1 \n"
+"-0.1421911754618049 1:0.2 2:0.8 3:0.35 4:1 \n"
+"-0.04755529004505616 1:0.2 2:0.8 3:0.5 4:1 \n"
+"-0.1749461836942537 1:0.2 2:0.8 3:0.55 4:1 \n"
+"-0.3540692384849451 1:0.2 2:0.8 3:0.8 4:1 \n"
+"0.003475495147750267 1:0.225 2:0.2 3:0.25555556 4:1 \n"
+"-0.2533755698754066 1:0.225 2:0.2 3:0.8 4:1 \n"
+"-0.01808204954455377 1:0.225 2:0.5483871 3:0.2 4:1 \n"
+"0.1131542358630616 1:0.225 2:0.7516129 3:0.2 4:1 \n"
+"1 1:0.25 2:0.4 3:0.25 4:1 \n"
+"0.005208902064179085 1:0.25 2:0.45 3:0.3 4:1 \n"
+"0.5184387422739661 1:0.25 2:0.5 3:0.45 4:1 \n"
+"-0.1219754693745881 1:0.25 2:0.55 3:0.3 4:1 \n"
+"0.0443710608928285 1:0.25 2:0.65 3:0.7 4:1 \n"
+"0.02725443724576113 1:0.25 2:0.75 3:0.65 4:1 \n"
+"0.2222698929090999 1:0.275 2:0.25172414 3:0.7 4:1 \n"
+"-1 1:0.275 2:0.6 3:0.4 4:1 \n"
+"0.0578267631983939 1:0.275 2:0.75172414 3:0.75454545 4:1 \n"
+"-0.08462997593777237 1:0.3 2:0.55 3:0.8 4:1 \n"
+"-0.1621759097692729 1:0.3 2:0.6 3:0.25 4:1 \n"
+"0.1423366293879199 1:0.325 2:0.2 3:0.25384615 4:1 \n"
+"0.002095748445047786 1:0.325 2:0.2 3:0.35384615 4:1 \n"
+"-0.2390748261882654 1:0.325 2:0.3 3:0.44615385 4:1 \n"
+"-0.3136484793830916 1:0.325 2:0.5 3:0.2 4:1 \n"
+"-0.02802074398665358 1:0.325 2:0.6 3:0.2 4:1 \n"
+"0.3916865144765236 1:0.325 2:0.75185185 3:0.5 4:1 \n"
+"0.06796491332444977 1:0.35 2:0.2 3:0.55 4:1 \n"
+"-0.1171174874823598 1:0.4 2:0.55 3:0.3 4:1 \n"
+"-0.007147836240104062 1:0.4 2:0.6 3:0.5 4:1 \n"
+"0.1090109422265258 1:0.4 2:0.8 3:0.3 4:1 \n"
+"-0.07426717382882767 1:0.45 2:0.3 3:0.5 4:1 \n"
+"1 1:0.45 2:0.6 3:0.35 4:1 \n"
+"-0.2331093046859784 1:0.5 2:0.5 3:0.6 4:1 \n"
+"-0.04677887718587526 1:0.525 2:0.25263158 3:0.5 4:1 \n"
+"0.5821866444070798 1:0.525 2:0.44736842 3:0.44761905 4:1 \n"
+"-1 1:0.525 2:0.54736842 3:0.44761905 4:1 \n"
+"0.05102011276926535 1:0.55 2:0.35 3:0.75 4:1 \n"
+"0.2478282150651829 1:0.55 2:0.45 3:0.8 4:1 \n"
+"0.2635471219318096 1:0.575 2:0.2 3:0.65217391 4:1 \n"
+"0.02259145533771266 1:0.575 2:0.3 3:0.25217391 4:1 \n"
+"-0.9940799302402182 1:0.575 2:0.3 3:0.6 4:1 \n"
+"1 1:0.575 2:0.5 3:0.54782609 4:1 \n"
+"0.2162257254251634 1:0.6 2:0.2 3:0.55 4:1 \n"
+"-0.7365889237859471 1:0.6 2:0.2 3:0.8 4:1 \n"
+"0.117831852673521 1:0.625 2:0.2 3:0.2 4:1 \n"
+"0.02533580308409877 1:0.625 2:0.2 3:0.752 4:1 \n"
+"-0.3142311994593642 1:0.625 2:0.45333333 3:0.448 4:1 \n"
+"0.02079799789547691 1:0.625 2:0.6 3:0.752 4:1 \n"
+"-0.06243873532213483 1:0.625 2:0.75333333 3:0.2 4:1 \n"
+"-0.3215397524754426 1:0.625 2:0.75333333 3:0.548 4:1 \n"
+"1 1:0.65 2:0.2 3:0.75 4:1 \n"
+"1 1:0.65 2:0.4 3:0.55 4:1 \n"
+"-0.4022336453302484 1:0.65 2:0.8 3:0.45 4:1 \n"
+"0.2307398622379147 1:0.675 2:0.3 3:0.7 4:1 \n"
+"-1 1:0.675 2:0.54615385 3:0.4 4:1 \n"
+"0.01192226814480389 1:0.675 2:0.65384615 3:0.8 4:1 \n"
+"0.3794281282232589 1:0.675 2:0.75384615 3:0.35185185 4:1 \n"
+"-0.3804339157141501 1:0.675 2:0.75384615 3:0.5 4:1 \n"
+"1 1:0.675 2:0.8 3:0.65185185 4:1 \n"
+"0.07740940465522768 1:0.7 2:0.25 3:0.75 4:1 \n"
+"-0.4590158891722865 1:0.7 2:0.3 3:0.4 4:1 \n"
+"-0.3775661965723483 1:0.7 2:0.6 3:0.65 4:1 \n"
+"-0.6104296247595336 1:0.7 2:0.75 3:0.8 4:1 \n"
+"-0.1290760653185081 1:0.7 2:0.8 3:0.45 4:1 \n"
+"-1 1:0.725 2:0.35454545 3:0.6 4:1 \n"
+"0.07487715290094314 1:0.725 2:0.44545455 3:0.5 4:1 \n"
+"-0.0203251935455067 1:0.725 2:0.44545455 3:0.8 4:1 \n"
+"0.2109534272345216 1:0.725 2:0.7 3:0.45172414 4:1 \n"
+"0.8576213948026701 1:0.725 2:0.75454545 3:0.6 4:1 \n"
+"-1 1:0.75 2:0.2 3:0.55 4:1 \n"
+"1 1:0.75 2:0.2 3:0.75 4:1 \n"
+"-0.9369049249478433 1:0.75 2:0.2 3:0.8 4:1 \n"
+"1 1:0.75 2:0.3 3:0.45 4:1 \n"
+"-1 1:0.75 2:0.4 3:0.8 4:1 \n"
+"0.6757376857040377 1:0.75 2:0.6 3:0.5 4:1 \n"
+"-1 1:0.75 2:0.65 3:0.8 4:1 \n"
+"0.3331602318609188 1:0.75 2:0.75 3:0.35 4:1 \n"
+"1 1:0.775 2:0.2 3:0.4516129 4:1 \n"
+"-0.5701534184990483 1:0.775 2:0.25555556 3:0.5483871 4:1 \n"
+"0.1150156974033225 1:0.775 2:0.4 3:0.4516129 4:1 \n"
+"1 1:0.775 2:0.6 3:0.7516129 4:1 \n"
+"-1 1:0.775 2:0.7 3:0.6516129 4:1 \n"
+"0.01718174475549202 1:0.775 2:0.8 3:0.2516129 4:1 \n"
+"-0.2052635276433671 1:0.8 2:0.25 3:0.25 4:1 \n"
+"-1 1:0.8 2:0.25 3:0.6 4:1 \n"
+"1 1:0.8 2:0.25 3:0.75 4:1 \n"
+"-0.04518204611438701 1:0.8 2:0.25 3:0.8 4:1 \n"
+"0.6768238613754204 1:0.8 2:0.3 3:0.45 4:1 \n"
+"-0.5138797159875904 1:0.8 2:0.35 3:0.25 4:1 \n"
+"0.0261438872042605 1:0.8 2:0.4 3:0.2 4:1 \n"
+"-0.004793297131704656 1:0.8 2:0.4 3:0.65 4:1 \n"
+"1 1:0.8 2:0.4 3:0.75 4:1 \n"
+"1 1:0.8 2:0.5 3:0.45 4:1 \n"
+"-0.3991872047745405 1:0.8 2:0.5 3:0.6 4:1 \n"
+"-1 1:0.8 2:0.5 3:0.65 4:1 \n"
+"0.2567252018577118 1:0.8 2:0.55 3:0.2 4:1 \n"
+"-0.8822601344526142 1:0.8 2:0.55 3:0.35 4:1 \n"
+"1 1:0.8 2:0.6 3:0.75 4:1 \n"
+"0.223252672606951 1:0.8 2:0.65 3:0.75 4:1 \n"
+"-0.3335795703441325 1:0.8 2:0.65 3:0.8 4:1 \n"
+"-0.5098200396284942 1:0.8 2:0.75 3:0.65 4:1 \n"
+"1 1:0.8 2:0.75 3:0.75 4:1 \n";
diff --git a/C/ViennaRNA/move_set.c b/C/ViennaRNA/move_set.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/move_set.c
@@ -0,0 +1,1138 @@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <limits.h>
+#include <time.h>
+
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/utils.h"
+
+#include "ViennaRNA/move_set.h"
+
+
+/* maximum degeneracy value - if degeneracy is greater than this, program segfaults */
+#define MAX_DEGEN 100
+#define MINGAP 3
+
+
+#define bool int
+#define true 1
+#define false 0
+
+/*
+#################################
+# PRIVATE DATA STRUCTURES       #
+#################################
+*/
+
+/* internal struct with moves, sequence, degeneracy and options*/
+typedef struct _Encoded {
+  /* sequence*/
+  short *s0;
+  short *s1;
+
+  const char  *seq;
+
+  /* moves*/
+  int   bp_left;
+  int   bp_right;
+  int   bp_left2;   /* if noLP is enabled (and for shift moves)*/
+  int   bp_right2;
+
+  /* options*/
+  int noLP;
+  int verbose_lvl;
+  int first;
+  int shift;
+
+  /* degeneracy*/
+  int begin_unpr;
+  int begin_pr;
+  int end_unpr;
+  int end_pr;
+  short *processed[MAX_DEGEN];
+  short *unprocessed[MAX_DEGEN];
+  int current_en;
+
+  /* moves in random (needs to be freed afterwards)*/
+  int *moves_from;
+  int *moves_to;
+  int num_moves;
+
+  /* function for flooding */
+  int (*funct) (struct_en*, struct_en*);
+
+
+} Encoded;
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+PRIVATE int cnt_move = 0;
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE int     compare(short *lhs, short *rhs);
+PRIVATE int     find_min(short *arr[MAX_DEGEN], int begin, int end);
+PRIVATE int     equals(const short *first, const short *second);
+PRIVATE int     count_move(void);
+PRIVATE int     lone_base(short *pt, int i);
+PRIVATE void    free_degen(Encoded *Enc);
+PRIVATE inline void do_move(short *pt, int bp_left, int bp_right);
+PRIVATE int     update_deepest(Encoded *Enc, struct_en *str, struct_en *min);
+PRIVATE int     deletions(Encoded *Enc, struct_en *str, struct_en *minim);
+PRIVATE inline  bool compat(char a, char b);
+PRIVATE inline  bool try_insert(const short *pt, const char *seq, int i, int j);
+PRIVATE inline  bool try_insert_seq(const char *seq, int i, int j);
+PRIVATE int     insertions(Encoded *Enc, struct_en *str, struct_en *minim);
+PRIVATE int     shifts(Encoded *Enc, struct_en *str, struct_en *minim);
+PRIVATE int     move_set(Encoded *Enc, struct_en *str);
+PRIVATE void    construct_moves(Encoded *Enc, short *structure);
+PRIVATE int     move_rset(Encoded *Enc, struct_en *str);
+PRIVATE int     find_lone_pair(short* str);
+
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PRIVATE int
+compare(short *lhs, short *rhs){
+
+  /* printf("%d ", (int)lhs[0]); */
+
+  int i=1;
+  char l=0,r=0;
+  while (i<=lhs[0]) {
+    l = (lhs[i]==0?'.':(lhs[i]<lhs[lhs[i]]?')':'('));
+    r = (rhs[i]==0?'.':(rhs[i]<rhs[rhs[i]]?')':'('));
+    if (l != r) break;
+    i++;
+  }
+
+  return (i<=lhs[0] && l>r);
+}
+
+PRIVATE int
+find_min(short *arr[MAX_DEGEN], int begin, int end){
+
+  short *min = arr[begin];
+  short min_num = begin;
+  int i;
+
+  for (i=begin+1; i<end; i++) {
+    if (compare(arr[i], min)) {
+      min = arr[i];
+      min_num = i;
+    }
+  }
+  return min_num;
+}
+
+PRIVATE int
+equals(const short *first, const short *second){
+
+  int i=1;
+  while (i<=first[0] && first[i]==second[i]) {
+    i++;
+  }
+  if (i>first[0]) return 1;
+  else return 0;
+}
+
+PUBLIC void
+copy_arr(short *dest, short *src){
+  if (!src || !dest) {
+    vrna_message_warning("Empty pointer in copying");
+    return;
+  }
+  memcpy(dest, src, sizeof(short)*(src[0]+1));
+}
+
+PUBLIC short *
+allocopy(short *src){
+  short *res = (short*) vrna_alloc(sizeof(short)*(src[0]+1));
+  copy_arr(res, src);
+  return res;
+}
+
+PRIVATE int
+count_move(void){
+
+  return cnt_move;
+}
+
+
+
+/* frees all things allocated by degeneracy...*/
+PRIVATE void
+free_degen(Encoded *Enc){
+
+  int i;
+  for (i=Enc->begin_unpr; i<Enc->end_unpr; i++) {
+    if (Enc->unprocessed[i]) {
+      free(Enc->unprocessed[i]);
+      Enc->unprocessed[i]=NULL;
+    }
+  }
+  for (i=Enc->begin_pr; i<Enc->end_pr; i++) {
+    if (Enc->processed[i]) {
+      free(Enc->processed[i]);
+      Enc->processed[i]=NULL;
+    }
+  }
+  Enc->begin_pr=0;
+  Enc->begin_unpr=0;
+  Enc->end_pr=0;
+  Enc->end_unpr=0;
+}
+
+PRIVATE inline void
+do_move(short *pt, int bp_left, int bp_right){
+
+  /* delete*/
+  if (bp_left<0) {
+    pt[-bp_left]=0;
+    pt[-bp_right]=0;
+  } else { /* insert*/
+    pt[bp_left]=bp_right;
+    pt[bp_right]=bp_left;
+  }
+}
+
+/* done with all structures along the way to deepest*/
+PRIVATE int
+update_deepest(Encoded *Enc, struct_en *str, struct_en *min){
+
+  /* apply move + get its energy*/
+  int tmp_en;
+  tmp_en = str->energy + energy_of_move_pt(str->structure, Enc->s0, Enc->s1, Enc->bp_left, Enc->bp_right);
+  do_move(str->structure, Enc->bp_left, Enc->bp_right);
+  if (Enc->bp_left2 != 0) {
+    tmp_en += energy_of_move_pt(str->structure, Enc->s0, Enc->s1, Enc->bp_left2, Enc->bp_right2);
+    do_move(str->structure, Enc->bp_left2, Enc->bp_right2);
+  }
+  int last_en = str->energy;
+  str->energy = tmp_en;
+
+
+  /* use f_point if we have it */
+  if (Enc->funct) {
+    int end = Enc->funct(str, min);
+
+    /*  undo moves */
+    if (Enc->bp_left2!=0) do_move(str->structure, -Enc->bp_left2, -Enc->bp_right2);
+    do_move(str->structure, -Enc->bp_left, -Enc->bp_right);
+    str->energy = last_en;
+    Enc->bp_left=0;
+    Enc->bp_right=0;
+    Enc->bp_left2=0;
+    Enc->bp_right2=0;
+
+    return (end?1:0);
+  }
+
+  if (Enc->verbose_lvl>1) { fprintf(stderr, "  "); print_str(stderr, str->structure); fprintf(stderr, " %d\n", tmp_en); }
+
+  /* better deepest*/
+  if (tmp_en < min->energy) {
+    min->energy = tmp_en;
+    copy_arr(min->structure, str->structure);
+
+    /* delete degeneracy*/
+    free_degen(Enc);
+
+    /* undo moves*/
+    if (Enc->bp_left2!=0) do_move(str->structure, -Enc->bp_left2, -Enc->bp_right2);
+    do_move(str->structure, -Enc->bp_left, -Enc->bp_right);
+    str->energy = last_en;
+    Enc->bp_left=0;
+    Enc->bp_right=0;
+    Enc->bp_left2=0;
+    Enc->bp_right2=0;
+    return 1;
+  }
+
+  /* degeneracy*/
+  if ((str->energy == min->energy) && (Enc->current_en == min->energy)) {
+    int found = 0;
+    int i;
+    for (i=Enc->begin_pr; i<Enc->end_pr; i++) {
+      if (equals(Enc->processed[i], str->structure)) {
+        found = 1;
+        break;
+      }
+    }
+    for (i=Enc->begin_unpr; !found && i<Enc->end_unpr; i++) {
+      if (equals(Enc->unprocessed[i], str->structure)) {
+        found = 1;
+        break;
+      }
+    }
+
+    if (!found) {
+      /* print_stren(stderr, str); // fprintf(stderr, " %6.2f\n", str->energy); */
+      Enc->unprocessed[Enc->end_unpr]=allocopy(str->structure);
+      Enc->end_unpr++;
+    }
+  }
+
+  /* undo moves*/
+  if (Enc->bp_left2!=0) do_move(str->structure, -Enc->bp_left2, -Enc->bp_right2);
+  do_move(str->structure, -Enc->bp_left, -Enc->bp_right);
+  str->energy = last_en;
+  Enc->bp_left=0;
+  Enc->bp_right=0;
+  Enc->bp_left2=0;
+  Enc->bp_right2=0;
+  return 0;
+}
+
+
+/* deletions move set*/
+PRIVATE int
+deletions(Encoded *Enc, struct_en *str, struct_en *minim){
+
+  int cnt = 0;
+  short *pt = str->structure;
+  int len = pt[0];
+  int i;
+
+  for (i=1; i<=len; i++) {
+    if (pt[i]>pt[pt[i]]) {  /* '('*/
+      Enc->bp_left=-i;
+      Enc->bp_right=-pt[i];
+
+      /*if nolp enabled, make (maybe) 2nd delete*/
+      if (Enc->noLP) {
+        int lone = -1;
+        if (lone_base(pt, i-1)) lone=i-1;
+        else if (lone_base(pt, i+1)) lone=i+1;
+        else if (lone_base(pt, pt[i]-1)) lone=pt[i]-1;
+        else if (lone_base(pt, pt[i]+1)) lone=pt[i]+1;
+
+        /* check*/
+        if (lone != -1 && (pt[lone]==0 || pt[pt[lone]]==0)) {
+          vrna_message_warning("pt[%d(or %d)]!=\'.\'", lone, pt[lone]);
+        }
+
+        if (lone != -1) {
+          Enc->bp_left2=-lone-1;
+          Enc->bp_right2=-pt[lone]-1;
+        }
+        if (!lone_base(pt, pt[lone]-1) && !lone_base(pt, pt[lone]+1)) {
+          cnt += update_deepest(Enc, str, minim);
+          /* in case useFirst is on and structure is found, end*/
+          if (Enc->first && cnt > 0) return cnt;
+        }
+      } else {  /* nolp not enabled*/
+        cnt += update_deepest(Enc, str, minim);
+        /* in case useFirst is on and structure is found, end*/
+        if (Enc->first && cnt > 0) return cnt;
+      }
+    }
+  }
+  return cnt;
+}
+
+  /* compatible base pair?*/
+PRIVATE inline bool
+compat(char a, char b){
+
+  if (a=='A' && b=='U') return true;
+  if (a=='C' && b=='G') return true;
+  if (a=='G' && b=='U') return true;
+  if (a=='U' && b=='A') return true;
+  if (a=='G' && b=='C') return true;
+  if (a=='U' && b=='G') return true;
+  /* and with T's*/
+  if (a=='A' && b=='T') return true;
+  if (a=='T' && b=='A') return true;
+  if (a=='G' && b=='T') return true;
+  if (a=='T' && b=='G') return true;
+  return false;
+}
+
+/* try insert base pair (i,j)*/
+PRIVATE inline bool
+try_insert(const short *pt, const char *seq, int i, int j){
+
+  if (i<=0 || j<=0 || i>pt[0] || j>pt[0]) return false;
+  return (j-i>MINGAP && pt[j]==0 && pt[i]==0 && compat(seq[i-1], seq[j-1]));
+}
+
+/*  try insert base pair (i,j) */
+PRIVATE inline bool
+try_insert_seq(const char *seq, int i, int j){
+  if (i<=0 || j<=0) return false;
+  return (j-i>MINGAP && compat(seq[i-1], seq[j-1]));
+}
+
+/* insertions move set*/
+PRIVATE int
+insertions(Encoded *Enc, struct_en *str, struct_en *minim){
+
+  int cnt = 0;
+  short *pt = str->structure;
+  int len = pt[0];
+  int i,j;
+
+  for (i=1; i<=len; i++) {
+    if (pt[i]==0) {
+      for (j=i+1; j<=len; j++) {
+        /* end if found closing bracket*/
+        if (pt[j]!=0 && pt[j]<j) break;  /*')'*/
+        if (pt[j]!=0 && pt[j]>j) {       /*'('*/
+          j = pt[j];
+          continue;
+        }
+        /* if conditions are met, do insert*/
+        if (try_insert(pt, Enc->seq, i, j)) {
+          Enc->bp_left=i;
+          Enc->bp_right=j;
+
+          if (Enc->noLP) {
+            /* if lone bases occur, try inserting one another base*/
+            if (lone_base(pt, i) || lone_base(pt, j)) {
+              /* inside*/
+              if (try_insert(pt, Enc->seq, i+1, j-1)) {
+                Enc->bp_left2=i+1;
+                Enc->bp_right2=j-1;
+                cnt += update_deepest(Enc, str, minim);
+                /* in case useFirst is on and structure is found, end*/
+                if (Enc->first && cnt > 0) return cnt;
+              } else  /*outside*/
+              if (try_insert(pt, Enc->seq, i-1, j+1)) {
+                Enc->bp_left2=i-1;
+                Enc->bp_right2=j+1;
+                cnt += update_deepest(Enc, str, minim);
+                /* in case useFirst is on and structure is found, end*/
+                if (Enc->first && cnt > 0) return cnt;
+              }
+            } else {
+              cnt += update_deepest(Enc, str, minim);
+              /* in case useFirst is on and structure is found, end*/
+              if (Enc->first && cnt > 0) return cnt;
+            }
+          } else {
+            cnt += update_deepest(Enc, str, minim);
+            /* in case useFirst is on and structure is found, end*/
+            if (Enc->first && cnt > 0) return cnt;
+          }
+        }
+      }
+    }
+  }
+  return cnt;
+}
+
+/*shift move set*/
+PRIVATE int
+shifts(Encoded *Enc, struct_en *str, struct_en *minim){
+
+  int cnt = 0;
+  int brack_num = 0;
+  short *pt = str->structure;
+  int len = pt[0];
+  int i, k;
+
+  for (i=1; i<=len; i++) {
+    if (pt[i]!=0 && pt[i]>i) {  /*'('*/
+      int j=pt[i];
+
+      /* outer switch left*/
+      if (Enc->verbose_lvl>1)
+        vrna_message_info(stderr, "%2d bracket %2d position, outer switch left", brack_num+1, i);
+      for (k=i-1; k>0; k--) {
+        if (pt[k]!=0 && pt[k]>k/*'('*/) break;
+        if (pt[k]!=0 && pt[k]<k/*')'*/) {
+          k = pt[k];
+          continue;
+        }
+        /* checks*/
+        if (pt[k]!=0) {
+          vrna_message_warning("\'%c\'should be \'.\' at pos %d!", pt[k], k);
+        }
+
+        /* switch (i,j) to (k,j)*/
+        if (j-k>MINGAP && compat(Enc->seq[k-1], Enc->seq[j-1])) {
+          Enc->bp_left=-i;
+          Enc->bp_right=-j;
+          Enc->bp_left2=k;
+          Enc->bp_right2=j;
+          cnt += update_deepest(Enc, str, minim);
+          /* in case useFirst is on and structure is found, end*/
+          if (Enc->first && cnt > 0) return cnt;
+        }
+
+        /* switch (i,j) to (k,i)*/
+        if (i-k>MINGAP && compat(Enc->seq[i-1], Enc->seq[k-1])) {
+          Enc->bp_left=-i;
+          Enc->bp_right=-j;
+          Enc->bp_left2=k;
+          Enc->bp_right2=i;
+          cnt += update_deepest(Enc, str, minim);
+          /* in case useFirst is on and structure is found, end*/
+          if (Enc->first && cnt > 0) return cnt;
+
+        }
+      }
+
+      /* outer switch right*/
+      if (Enc->verbose_lvl>1)
+        vrna_message_info(stderr, "%2d bracket %2d position, outer switch right", brack_num+1, i);
+      for (k=j+1; k<=len; k++) {
+        if (pt[k]!=0 && pt[k]<k/*')'*/) break;
+        if (pt[k]!=0 && pt[k]>k/*'('*/) {
+          k = pt[k];
+          continue;
+        }
+
+        /* check*/
+        if (pt[k]!=0) {
+          vrna_message_warning("\'%c\'should be \'.\' at pos %d!", pt[k], k);
+        }
+        /* switch (i,j) to (i,k)*/
+        if (k-i>MINGAP && compat(Enc->seq[i-1], Enc->seq[k-1])) {
+          Enc->bp_left=-i;
+          Enc->bp_right=-j;
+          Enc->bp_left2=i;
+          Enc->bp_right2=k;
+          cnt += update_deepest(Enc, str, minim);
+          /* in case useFirst is on and structure is found, end*/
+          if (Enc->first && cnt > 0) return cnt;
+        }
+        /* switch (i,j) to (j,k)*/
+        if (k-j>MINGAP && compat(Enc->seq[j-1], Enc->seq[k-1])) {
+          Enc->bp_left=-i;
+          Enc->bp_right=-j;
+          Enc->bp_left2=j;
+          Enc->bp_right2=k;
+          cnt += update_deepest(Enc, str, minim);
+          /* in case useFirst is on and structure is found, end*/
+          if (Enc->first && cnt > 0) return cnt;
+        }
+      }
+
+      if (Enc->verbose_lvl>1)
+        vrna_message_info(stderr, "%2d bracket %2d position, inner switch", brack_num+1, i);
+      /* inner switch*/
+      for (k=i+1; k<j; k++) {
+        /* jump to end of the sub-bracketing*/
+        if (pt[k]!=0 && pt[k]>k/*'('*/) {
+            k=pt[k];
+            continue;
+        }
+
+        /* left switch (i,j) to (k,j)*/
+        if (j-k>MINGAP && compat(Enc->seq[k-1], Enc->seq[j-1])) {
+          Enc->bp_left=-i;
+          Enc->bp_right=-j;
+          Enc->bp_left2=k;
+          Enc->bp_right2=j;
+          cnt += update_deepest(Enc, str, minim);
+          /* in case useFirst is on and structure is found, end*/
+          if (Enc->first && cnt > 0) return cnt;
+        }
+
+        /* right switch (i,j) to (i,k)*/
+        if (k-i>MINGAP && compat(Enc->seq[i-1], Enc->seq[k-1])) {
+          Enc->bp_left=-i;
+          Enc->bp_right=-j;
+          Enc->bp_left2=i;
+          Enc->bp_right2=k;
+          cnt += update_deepest(Enc, str, minim);
+          /* in case useFirst is on and structure is found, end*/
+          if (Enc->first && cnt > 0) return cnt;
+        }
+      } /* end inner switch for*/
+      brack_num++;
+    } /* end if (pt[i]=='(')*/
+  } /* end for in switches*/
+  return cnt;
+}
+
+/* move to deepest (or first) neighbour*/
+PRIVATE int
+move_set(Encoded *Enc, struct_en *str){
+
+  /* count how many times called*/
+  cnt_move++;
+
+  /* count better neighbours*/
+  int cnt = 0;
+
+  /* deepest descent*/
+  struct_en min;
+  min.structure = allocopy(str->structure);
+  min.energy = str->energy;
+  Enc->current_en = str->energy;
+
+  if (Enc->verbose_lvl>0) { fprintf(stderr, "  start of MS:\n  "); print_str(stderr, str->structure); fprintf(stderr, " %d\n\n", str->energy); }
+
+  /* if using first dont do all of them*/
+  bool end = false;
+  /* insertions*/
+  if (!end) cnt += insertions(Enc, str, &min);
+  if (Enc->first && cnt>0) end = true;
+  if (Enc->verbose_lvl>1) fprintf(stderr, "\n");
+
+  /* deletions*/
+  if (!end) cnt += deletions(Enc, str, &min);
+  if (Enc->first && cnt>0) end = true;
+
+  /* shifts (only if enabled + noLP disabled)*/
+  if (!end && Enc->shift && !Enc->noLP) {
+    cnt += shifts(Enc, str, &min);
+    if (Enc->first && cnt>0) end = true;
+  }
+
+  /* if degeneracy occurs, solve it!*/
+  if (!end && (Enc->end_unpr - Enc->begin_unpr)>0) {
+    Enc->processed[Enc->end_pr] = str->structure;
+    Enc->end_pr++;
+    str->structure = Enc->unprocessed[Enc->begin_unpr];
+    Enc->unprocessed[Enc->begin_unpr]=NULL;
+    Enc->begin_unpr++;
+    cnt += move_set(Enc, str);
+  } else {
+    /* write output to str*/
+    copy_arr(str->structure, min.structure);
+    str->energy = min.energy;
+  }
+  /* release minimal*/
+  free(min.structure);
+
+  /* resolve degeneracy in local minima*/
+  if ((Enc->end_pr - Enc->begin_pr)>0) {
+    Enc->processed[Enc->end_pr]=str->structure;
+    Enc->end_pr++;
+
+    int min = find_min(Enc->processed, Enc->begin_pr, Enc->end_pr);
+    short *tmp = Enc->processed[min];
+    Enc->processed[min] = Enc->processed[Enc->begin_pr];
+    Enc->processed[Enc->begin_pr] = tmp;
+    str->structure = Enc->processed[Enc->begin_pr];
+    Enc->begin_pr++;
+    free_degen(Enc);
+  }
+
+  if (Enc->verbose_lvl>1 && !(Enc->first)) { fprintf(stderr, "\n  end of MS:\n  "); print_str(stderr, str->structure); fprintf(stderr, " %d\n\n", str->energy); }
+
+  return cnt;
+}
+
+PRIVATE void
+construct_moves(Encoded *Enc, short *structure){
+
+  /* generate all possible moves (less than n^2)*/
+  Enc->num_moves = 0;
+  int i;
+  for (i=1; i<=structure[0]; i++) {
+    if (structure[i]!=0) {
+      if (structure[i]<i) continue;
+      Enc->moves_from[Enc->num_moves]=-i;
+      Enc->moves_to[Enc->num_moves]=-structure[i];
+      Enc->num_moves++;
+      /* fprintf(stderr, "add  d(%d, %d)\n", i, str.structure[i]); */
+    } else {
+      int j;
+      for (j=i+1; j<=structure[0]; j++) {
+        /* fprintf(stderr, "check (%d, %d)\n", i, j); */
+        if (structure[j]==0) {
+          if (try_insert_seq(Enc->seq,i,j)) {
+            Enc->moves_from[Enc->num_moves]=i;
+            Enc->moves_to[Enc->num_moves]=j;
+            Enc->num_moves++;
+            /* fprintf(stderr, "add  i(%d, %d)\n", i, j); */
+            continue;
+          }
+        } else if (structure[j]>j) { /*  '(' */
+          j = structure[j];
+        } else break;
+      }
+    }
+  }
+
+  /* permute them */
+  for (i=0; i<Enc->num_moves-1; i++) {
+    int rnd = rand();
+    rnd = rnd % (Enc->num_moves-i) + i;
+    int swp;
+    swp = Enc->moves_from[i];
+    Enc->moves_from[i]=Enc->moves_from[rnd];
+    Enc->moves_from[rnd]=swp;
+    swp = Enc->moves_to[i];
+    Enc->moves_to[i]=Enc->moves_to[rnd];
+    Enc->moves_to[rnd]=swp;
+  }
+}
+
+PRIVATE int
+move_rset(Encoded *Enc, struct_en *str){
+
+  /* count how many times called*/
+  cnt_move++;
+
+  /* count better neighbours*/
+  int cnt = 0;
+
+  /* deepest descent*/
+  struct_en min;
+  min.structure = allocopy(str->structure);
+  min.energy = str->energy;
+  Enc->current_en = str->energy;
+
+  if (Enc->verbose_lvl>0) { fprintf(stderr, "  start of MR:\n  "); print_str(stderr, str->structure); fprintf(stderr, " %d\n\n", str->energy); }
+
+  /*  construct and permute possible moves */
+  construct_moves(Enc, str->structure);
+
+  /* find first lower one*/
+  int i;
+  for (i=0; i<Enc->num_moves; i++) {
+    Enc->bp_left = Enc->moves_from[i];
+    Enc->bp_right = Enc->moves_to[i];
+    cnt = update_deepest(Enc, str, &min);
+    if (cnt) break;
+  }
+
+  /* if degeneracy occurs, solve it!*/
+  if (!cnt && (Enc->end_unpr - Enc->begin_unpr)>0) {
+    Enc->processed[Enc->end_pr] = str->structure;
+    Enc->end_pr++;
+    str->structure = Enc->unprocessed[Enc->begin_unpr];
+    Enc->unprocessed[Enc->begin_unpr]=NULL;
+    Enc->begin_unpr++;
+    cnt += move_rset(Enc, str);
+  } else {
+    /* write output to str*/
+    copy_arr(str->structure, min.structure);
+    str->energy = min.energy;
+  }
+  /* release minimal*/
+  free(min.structure);
+
+  /* resolve degeneracy in local minima*/
+  if ((Enc->end_pr - Enc->begin_pr)>0) {
+    Enc->processed[Enc->end_pr]=str->structure;
+    Enc->end_pr++;
+
+    int min = find_min(Enc->processed, Enc->begin_pr, Enc->end_pr);
+    short *tmp = Enc->processed[min];
+    Enc->processed[min] = Enc->processed[Enc->begin_pr];
+    Enc->processed[Enc->begin_pr] = tmp;
+    str->structure = Enc->processed[Enc->begin_pr];
+    Enc->begin_pr++;
+    free_degen(Enc);
+  }
+
+  return cnt;
+}
+
+/*check if base is lone*/
+PRIVATE int
+lone_base(short *pt, int i){
+
+  if (i<=0 || i>pt[0]) return 0;
+  /* is not a base pair*/
+  if (pt[i]==0) return 0;
+
+  /* base is lone:*/
+  if (i-1>0) {
+    /* is base pair and is the same bracket*/
+    if (pt[i-1]!=0 && ((pt[i-1]<pt[pt[i-1]]) == (pt[i]<pt[pt[i]]))) return 0;
+  }
+
+  if (i+1<=pt[0]) {
+    if (pt[i+1]!=0 && ((pt[i-1]<pt[pt[i-1]]) == (pt[i]<pt[pt[i]]))) return 0;
+  }
+
+  return 1;
+}
+
+/* if the structure has lone pairs*/
+PRIVATE int
+find_lone_pair(short* str){
+
+  int i;
+  for(i=1; i<str[0]; i++) {
+    if (str[i]==0) continue; /* '.'*/
+
+    if (str[i]>str[str[i]]) {  /* '('*/
+      if (i+1==str[0] || str[i+1]==0 || str[i+1]<str[str[i+1]]) {
+        return i;
+      } else while (i+1!=str[0] && str[i+1]!=0 && str[i+1]>str[str[i+1]]) i++;
+    }
+
+    if (str[i]<str[str[i]]) {  /* ')'*/
+      if (i+1==str[0] || str[i+1]==0 || str[i+1]>str[str[i+1]]) {
+        return i;
+      } else while (i+1!=str[0] && str[i+1]!=0 && str[i+1]<str[str[i+1]]) i++;
+    }
+  }
+
+  return -1;
+}
+
+PUBLIC int
+move_standard(char *seq,
+              char *struc,
+              enum MOVE_TYPE type,
+              int verbosity_level,
+              int shifts,
+              int noLP){
+
+  make_pair_matrix();
+
+  short int *s0 = encode_sequence(seq, 0);
+  short int *s1 = encode_sequence(seq, 1);
+  short int *str = vrna_ptable(struc);
+
+  int energy = 0;
+  switch (type){
+  case GRADIENT: energy = move_gradient(seq, str, s0, s1, verbosity_level, shifts, noLP); break;
+  case FIRST: energy = move_first(seq, str, s0, s1, verbosity_level, shifts, noLP); break;
+  case ADAPTIVE: energy = move_adaptive(seq, str, s0, s1, verbosity_level); break;
+  }
+
+  int i=1;
+  for (; i<=str[0]; i++) {
+    if (str[i]==0) struc[i-1]='.';
+    else if (str[i]>str[str[i]]) struc[i-1]='(';
+      else struc[i-1]=')';
+  }
+
+  free(s0);
+  free(s1);
+  free(str);
+
+  return energy;
+}
+
+PUBLIC int
+move_gradient(char *string,
+              short *ptable,
+              short *s,
+              short *s1,
+              int verbosity_level,
+              int shifts,
+              int noLP){
+
+  cnt_move = 0;
+
+  Encoded enc;
+  enc.seq = string;
+  enc.s0 = s;
+  enc.s1 = s1;
+
+  /* moves*/
+  enc.bp_left=0;
+  enc.bp_right=0;
+  enc.bp_left2=0;
+  enc.bp_right2=0;
+
+  /* options*/
+  enc.noLP=noLP;
+  enc.verbose_lvl=verbosity_level;
+  enc.first=0;
+  enc.shift=shifts;
+
+  /* degeneracy*/
+  enc.begin_unpr=0;
+  enc.begin_pr=0;
+  enc.end_unpr=0;
+  enc.end_pr=0;
+  enc.current_en=0;
+
+  /*  function */
+  enc.funct=NULL;
+
+  int i;
+  for (i=0; i<MAX_DEGEN; i++) enc.processed[i]=enc.unprocessed[i]=NULL;
+
+  struct_en str;
+  str.structure = allocopy(ptable);
+  str.energy = energy_of_structure_pt(enc.seq, str.structure, enc.s0, enc.s1, 0);
+
+  while (move_set(&enc, &str)!=0) {
+    free_degen(&enc);
+  }
+  free_degen(&enc);
+
+  copy_arr(ptable, str.structure);
+  free(str.structure);
+
+  return str.energy;
+}
+
+PUBLIC int
+move_first( char *string,
+            short *ptable,
+            short *s,
+            short *s1,
+            int verbosity_level,
+            int shifts,
+            int noLP){
+
+  cnt_move = 0;
+
+  Encoded enc;
+  enc.seq = string;
+  enc.s0 = s;
+  enc.s1 = s1;
+
+  /* moves*/
+  enc.bp_left=0;
+  enc.bp_right=0;
+  enc.bp_left2=0;
+  enc.bp_right2=0;
+
+  /* options*/
+  enc.noLP=noLP;
+  enc.verbose_lvl=verbosity_level;
+  enc.first=1;
+  enc.shift=shifts;
+
+  /* degeneracy*/
+  enc.begin_unpr=0;
+  enc.begin_pr=0;
+  enc.end_unpr=0;
+  enc.end_pr=0;
+  enc.current_en=0;
+
+  /*  function */
+  enc.funct=NULL;
+
+  int i;
+  for (i=0; i<MAX_DEGEN; i++) enc.processed[i]=enc.unprocessed[i]=NULL;
+
+  struct_en str;
+  str.structure = allocopy(ptable);
+  str.energy = energy_of_structure_pt(enc.seq, str.structure, enc.s0, enc.s1, 0);
+
+  while (move_set(&enc, &str)!=0) {
+    free_degen(&enc);
+  }
+  free_degen(&enc);
+
+  copy_arr(ptable, str.structure);
+  free(str.structure);
+
+  return str.energy;
+}
+
+PUBLIC int
+move_adaptive(char *string,
+              short *ptable,
+              short *s,
+              short *s1,
+              int verbosity_level){
+
+  srand(time(NULL));
+
+  cnt_move = 0;
+
+  Encoded enc;
+  enc.seq = string;
+  enc.s0 = s;
+  enc.s1 = s1;
+
+  /* moves*/
+  enc.bp_left=0;
+  enc.bp_right=0;
+  enc.bp_left2=0;
+  enc.bp_right2=0;
+
+  /* options*/
+  enc.noLP=0;
+  enc.verbose_lvl=verbosity_level;
+  enc.first=1;
+  enc.shift=0;
+
+  /* degeneracy*/
+  enc.begin_unpr=0;
+  enc.begin_pr=0;
+  enc.end_unpr=0;
+  enc.end_pr=0;
+  enc.current_en=0;
+
+  /*  function */
+  enc.funct=NULL;
+
+  /*  allocate memory for moves */
+  enc.moves_from = (int*) vrna_alloc(ptable[0]*ptable[0]*sizeof(int));
+  enc.moves_to = (int*) vrna_alloc(ptable[0]*ptable[0]*sizeof(int));
+
+  int i;
+  for (i=0; i<MAX_DEGEN; i++) enc.processed[i]=enc.unprocessed[i]=NULL;
+
+  struct_en str;
+  str.structure = allocopy(ptable);
+  str.energy = energy_of_structure_pt(enc.seq, str.structure, enc.s0, enc.s1, 0);
+
+  while (move_rset(&enc, &str)!=0) {
+    free_degen(&enc);
+  }
+  free_degen(&enc);
+
+  copy_arr(ptable, str.structure);
+  free(str.structure);
+  free(enc.moves_from);
+  free(enc.moves_to);
+
+  return str.energy;
+}
+
+PUBLIC int
+browse_neighs(char *seq,
+              char *struc,
+              int verbosity_level,
+              int shifts,
+              int noLP,
+              int (*funct) (struct_en*, struct_en*)){
+
+  make_pair_matrix();
+
+  short int *s0 = encode_sequence(seq, 0);
+  short int *s1 = encode_sequence(seq, 1);
+  short int *str = vrna_ptable(struc);
+
+  int res = browse_neighs_pt(seq, str, s0, s1, verbosity_level, shifts, noLP, funct);
+
+  free(s0);
+  free(s1);
+  free(str);
+
+  return res;
+}
+
+PUBLIC int
+browse_neighs_pt( char *string,
+                  short *ptable,
+                  short *s,
+                  short *s1,
+                  int verbosity_level,
+                  int shifts,
+                  int noLP,
+                  int (*funct) (struct_en*, struct_en*)){
+
+  cnt_move = 0;
+
+  Encoded enc;
+  enc.seq = string;
+  enc.s0 = s;
+  enc.s1 = s1;
+
+  /* moves*/
+  enc.bp_left=0;
+  enc.bp_right=0;
+  enc.bp_left2=0;
+  enc.bp_right2=0;
+
+  /* options*/
+  enc.noLP=noLP;
+  enc.verbose_lvl=verbosity_level;
+  enc.first=1;
+  enc.shift=shifts;
+
+  /* degeneracy*/
+  enc.begin_unpr=0;
+  enc.begin_pr=0;
+  enc.end_unpr=0;
+  enc.end_pr=0;
+  enc.current_en=0;
+
+  /*  function */
+  enc.funct=funct;
+
+  int i;
+  for (i=0; i<MAX_DEGEN; i++) enc.processed[i]=enc.unprocessed[i]=NULL;
+
+  struct_en str;
+  str.structure = allocopy(ptable);
+  str.energy = energy_of_structure_pt(enc.seq, str.structure, enc.s0, enc.s1, 0);
+
+  move_set(&enc, &str);
+  free_degen(&enc);
+
+  copy_arr(ptable, str.structure);
+  free(str.structure);
+
+  return str.energy;
+}
+
+/* printf*/
+PUBLIC void
+print_stren(FILE *out, struct_en *str) {
+  print_str(out, str->structure);
+  fprintf(out, " %6.2f\n", str->energy/100.0);
+}
+
+PUBLIC void
+print_str(FILE *out, short *str) {
+  int i;
+  for (i=1; i<=str[0]; i++) {
+    if (str[i]==0) fprintf(out, ".");
+    else if (str[i]<i) fprintf(out, ")");
+    else fprintf(out, "(");
+  }
+}
+
+
+#ifdef TEST_MOVESET
+/*  sample usage: */
+int main() {
+  char seq[20] = "ACCCCCCTCTGTAGGGGGA";
+  char str[20] = ".((.(.........).)).";
+
+  /*  move to the local minimum and display it */
+  int energy = move_standard(seq, str, GRADIENT, 0, 0, 0);
+  fprintf(stdout, "%s %6.2f\n\n", str, energy/100.0);
+
+  /* now create an array of every structure in neighbourhood of str structure */
+  struct_en *list = NULL;
+  int list_length = 0;
+
+  int get_list(struct_en *new_one, struct_en *old_one)
+  {
+    /*  enlarge the list */
+    list_length++;
+    list = (struct_en*) realloc(list, list_length*sizeof(struct_en));
+
+    /*  copy the structure */
+    list[list_length-1].energy = new_one->energy;
+    list[list_length-1].structure = allocopy(new_one->structure);
+
+    /*  we want to continue -> return 0 */
+    return 0;
+  }
+  browse_neighs(seq, str, 0, 0, 0, get_list);
+
+  /*  print them and free the memory: */
+  int i;
+  for (i=0; i<list_length; i++) {
+    print_stren(stdout, &list[i]);
+    free(list[i].structure);
+  }
+  free(list);
+
+  return 0;
+}
+
+#endif
diff --git a/C/ViennaRNA/move_set.h b/C/ViennaRNA/move_set.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/move_set.h
@@ -0,0 +1,91 @@
+#ifndef __MOVE_SET_H
+#define __MOVE_SET_H
+
+/**
+ *  @brief  Data structure for energy_of_move()
+ */
+typedef struct _struct_en{
+  int energy;        /* energy in 10kcal/mol*/
+  short *structure;  /* structure in energy_of_move format*/
+} struct_en;
+
+/* prints structure*/
+void print_stren(FILE *out, struct_en *str);
+void print_str(FILE *out, short *str);
+
+/* copying functions*/
+void copy_arr(short *dest, short *src); /*just copy*/
+short *allocopy(short *src);            /*copy and make space*/
+
+enum MOVE_TYPE {GRADIENT, FIRST, ADAPTIVE};
+
+/* walking methods (verbose_lvl 0-2, shifts = use shift moves? noLP = no lone pairs? (not compatible with shifts))
+    input:    seq - sequence
+              ptable - structure encoded with make_pair_table() from pair_mat.h
+              s, s1 - sequence encoded with encode_sequence from pair_mat.h
+    methods:  deepest - lowest energy structure is used
+              first - first found lower energy structure is used
+              rand - random lower energy structure is used
+    returns local minima structure in ptable and its energy in 10kcal/mol as output */
+
+int move_gradient( char *seq,
+                  short *ptable,
+                  short *s,
+                  short *s1,
+                  int verbosity_level,
+                  int shifts,
+                  int noLP);
+int move_first( char *seq,
+                short *ptable,
+                short *s,
+                short *s1,
+                int verbosity_level,
+                int shifts,
+                int noLP);
+int move_adaptive(  char *seq,
+                short *ptable,
+                short *s,
+                short *s1,
+                int verbosity_level);
+
+/* standardized method that encapsulates above "_pt" methods
+  input:  seq - sequence
+          struc - structure in dot-bracket notation
+          type - type of move selection according to MOVE_TYPE enum
+  return: energy of LM
+          structure of LM in struc in bracket-dot notation
+*/
+int move_standard(char *seq,
+                  char *struc,
+                  enum MOVE_TYPE type,
+                  int verbosity_level,
+                  int shifts,
+                  int noLP);
+
+
+/* browse_neighbours and perform funct function on each of them (used mainly for user specified flooding)
+    input:    seq - sequence
+              ptable - structure encoded with make_pair_table() from pair_mat.h
+              s, s1 - sequence encoded with encode_sequence from pair_mat.h
+              funct - function (structure from neighbourhood, structure from input) toperform on every structure in neigbourhood (if the function returns non-zero, the iteration through neighbourhood stops.)
+    returns energy of the structure funct sets as second argument*/
+int browse_neighs_pt( char *seq,
+                   short *ptable,
+                   short *s,
+                   short *s1,
+                   int verbosity_level,
+                   int shifts,
+                   int noLP,
+                   int (*funct) (struct_en*, struct_en*));
+
+int browse_neighs( char *seq,
+                   char *struc,
+                   int verbosity_level,
+                   int shifts,
+                   int noLP,
+                   int (*funct) (struct_en*, struct_en*));
+
+#endif
+
+
+
diff --git a/C/ViennaRNA/multibranch_loops.c b/C/ViennaRNA/multibranch_loops.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/multibranch_loops.c
@@ -0,0 +1,3072 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/exterior_loops.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/structured_domains.h"
+#include "ViennaRNA/unstructured_domains.h"
+#include "ViennaRNA/multibranch_loops.h"
+
+struct default_data {
+  int                       *idx;
+  char                      *mx;
+  int                       cp;
+  int                       *hc_up;
+  void                      *hc_dat;
+  vrna_callback_hc_evaluate *hc_f;
+};
+
+
+/*
+ #################################
+ # PRIVATE FUNCTION DECLARATIONS #
+ #################################
+ */
+
+PRIVATE int
+E_mb_loop_fast(vrna_fold_compound_t *vc,
+               int                  i,
+               int                  j,
+               int                  *dmli1,
+               int                  *dmli2);
+
+
+PRIVATE int
+E_mb_loop_fast_comparative(vrna_fold_compound_t *vc,
+                           int                  i,
+                           int                  j,
+                           int                  *dmli1,
+                           int                  *dmli2);
+
+
+PRIVATE FLT_OR_DBL
+exp_E_mb_loop_fast(vrna_fold_compound_t *vc,
+                   int                  i,
+                   int                  j,
+                   FLT_OR_DBL           *qqm1);
+
+
+PRIVATE FLT_OR_DBL
+exp_E_mb_loop_fast_comparative(vrna_fold_compound_t *vc,
+                               int                  i,
+                               int                  j,
+                               FLT_OR_DBL           *qqm1);
+
+
+PRIVATE int
+E_ml_stems_fast(vrna_fold_compound_t  *vc,
+                int                   i,
+                int                   j,
+                int                   *fmi,
+                int                   *dmli);
+
+
+PRIVATE int
+E_ml_stems_fast_comparative(vrna_fold_compound_t  *vc,
+                            int                   i,
+                            int                   j,
+                            int                   *fmi,
+                            int                   *dmli);
+
+
+PRIVATE int
+extend_fm_3p(int                  i,
+             int                  j,
+             int                  *fm,
+             vrna_fold_compound_t *vc);
+
+
+PRIVATE char
+hc_default(int  i,
+           int  j,
+           int  k,
+           int  l,
+           char d,
+           void *data);
+
+
+PRIVATE char
+hc_default_user(int   i,
+                int   j,
+                int   k,
+                int   l,
+                char  d,
+                void  *data);
+
+
+PRIVATE FLT_OR_DBL
+exp_E_ml_fast(vrna_fold_compound_t  *vc,
+              int                   i,
+              int                   j,
+              vrna_mx_pf_aux_ml_t   *aux_mx);
+
+
+PRIVATE FLT_OR_DBL
+exp_E_ml_fast_comparative(vrna_fold_compound_t  *vc,
+                          int                   i,
+                          int                   j,
+                          vrna_mx_pf_aux_ml_t   *aux_mx);
+
+
+/*
+ #################################
+ # BEGIN OF FUNCTION DEFINITIONS #
+ #################################
+ */
+PUBLIC int
+vrna_E_mb_loop_fast(vrna_fold_compound_t  *vc,
+                    int                   i,
+                    int                   j,
+                    int                   *dmli1,
+                    int                   *dmli2)
+{
+  int e = INF;
+
+  if (vc) {
+    switch (vc->type) {
+      case VRNA_FC_TYPE_SINGLE:
+        e = E_mb_loop_fast(vc, i, j, dmli1, dmli2);
+        break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:
+        e = E_mb_loop_fast_comparative(vc, i, j, dmli1, dmli2);
+        break;
+    }
+  }
+
+  return e;
+}
+
+
+PUBLIC int
+vrna_E_ml_stems_fast(vrna_fold_compound_t *vc,
+                     int                  i,
+                     int                  j,
+                     int                  *fmi,
+                     int                  *dmli)
+{
+  int e = INF;
+
+  if (vc) {
+    switch (vc->type) {
+      case VRNA_FC_TYPE_SINGLE:
+        e = E_ml_stems_fast(vc, i, j, fmi, dmli);
+        break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:
+        e = E_ml_stems_fast_comparative(vc, i, j, fmi, dmli);
+        break;
+    }
+  }
+
+  return e;
+}
+
+
+PUBLIC FLT_OR_DBL
+vrna_exp_E_mb_loop_fast(vrna_fold_compound_t  *vc,
+                        int                   i,
+                        int                   j,
+                        FLT_OR_DBL            *qqm1)
+{
+  FLT_OR_DBL q = 0.;
+
+  if (vc) {
+    switch (vc->type) {
+      case VRNA_FC_TYPE_SINGLE:
+        q = exp_E_mb_loop_fast(vc, i, j, qqm1);
+        break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:
+        q = exp_E_mb_loop_fast_comparative(vc, i, j, qqm1);
+        break;
+    }
+  }
+
+  return q;
+}
+
+
+PRIVATE int
+E_mb_loop_fast_comparative(vrna_fold_compound_t *vc,
+                           int                  i,
+                           int                  j,
+                           int                  *dmli1,
+                           int                  *dmli2)
+{
+  short                     **S, **S5, **S3;
+  int                       *indx, e, decomp, s, n_seq, dangle_model, *type;
+  vrna_param_t              *P;
+  vrna_md_t                 *md;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 **scs;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  n_seq         = vc->n_seq;
+  indx          = vc->jindx;
+  P             = vc->params;
+  md            = &(P->model_details);
+  hc            = vc->hc;
+  scs           = vc->scs;
+  dangle_model  = md->dangles;
+  e             = INF;
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ml;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+
+  /* multi-loop decomposition ------------------------*/
+  if (evaluate(i, j, i + 1, j - 1, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+    decomp = dmli1[j - 1];
+
+    type  = (int *)vrna_alloc(n_seq * sizeof(int));
+    S     = vc->S;
+    S5    = vc->S5;     /* S5[s][i] holds next base 5' of i in sequence s */
+    S3    = vc->S3;     /* Sl[s][i] holds next base 3' of i in sequence s */
+
+    for (s = 0; s < n_seq; s++) {
+      type[s] = md->pair[S[s][j]][S[s][i]];
+      if (type[s] == 0)
+        type[s] = 7;
+    }
+
+    if (dangle_model)
+      for (s = 0; s < n_seq; s++)
+        decomp += E_MLstem(type[s], S5[s][j], S3[s][i], P);
+    else
+      for (s = 0; s < n_seq; s++)
+        decomp += E_MLstem(type[s], -1, -1, P);
+    if (scs) {
+      for (s = 0; s < n_seq; s++) {
+        if (scs[s])
+          if (scs[s]->energy_bp)
+            decomp += scs[s]->energy_bp[indx[j] + i];
+      }
+    }
+
+    free(type);
+
+    e = decomp + n_seq * P->MLclosing;
+  }
+
+  return e;
+}
+
+
+PRIVATE int
+E_mb_loop_fast(vrna_fold_compound_t *vc,
+               int                  i,
+               int                  j,
+               int                  *dmli1,
+               int                  *dmli2)
+{
+  unsigned char             type, tt;
+  char                      *ptype;
+  short                     S_i1, S_j1, *S;
+  unsigned int              *sn;
+  int                       decomp, en, e, cp, *indx, *fc, ij, dangle_model, *rtype;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_param_t              *P;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  cp            = vc->cutpoint;
+  ptype         = vc->ptype;
+  S             = vc->sequence_encoding;
+  indx          = vc->jindx;
+  sn            = vc->strand_number;
+  hc            = vc->hc;
+  sc            = vc->sc;
+  fc            = vc->matrices->fc;
+  P             = vc->params;
+  ij            = indx[j] + i;
+  dangle_model  = P->model_details.dangles;
+  rtype         = &(P->model_details.rtype[0]);
+  type          = (unsigned char)ptype[ij];
+  /* init values */
+  e       = INF;
+  decomp  = INF;
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ml;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  if (cp < 0) {
+    S_i1  = S[i + 1];
+    S_j1  = S[j - 1];
+  } else {
+    S_i1  = (sn[i] == sn[i + 1]) ? S[i + 1] : -1;
+    S_j1  = (sn[j - 1] == sn[j]) ? S[j - 1] : -1;
+  }
+
+  if ((S_i1 >= 0) && (S_j1 >= 0)) {
+    /* regular multi branch loop */
+    /* new closing pair (i,j) with mb part [i+1,j-1] */
+    if (evaluate(i, j, i + 1, j - 1, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+      decomp  = dmli1[j - 1];
+      tt      = rtype[type];
+
+      if (tt == 0)
+        tt = 7;
+
+      if (decomp != INF) {
+        switch (dangle_model) {
+          /* no dangles */
+          case 0:
+            decomp += E_MLstem(tt, -1, -1, P);
+            if (sc) {
+              if (sc->energy_bp)
+                decomp += sc->energy_bp[ij];
+
+              if (sc->f)
+                decomp += sc->f(i, j, i + 1, j - 1, VRNA_DECOMP_PAIR_ML, sc->data);
+            }
+            break;
+
+          /* double dangles */
+          case 2:
+            decomp += E_MLstem(tt, S_j1, S_i1, P);
+            if (sc) {
+              if (sc->energy_bp)
+                decomp += sc->energy_bp[ij];
+
+              if (sc->f)
+                decomp += sc->f(i, j, i + 1, j - 1, VRNA_DECOMP_PAIR_ML, sc->data);
+            }
+            break;
+
+          /* normal dangles, aka dangles = 1 || 3 */
+          default:
+            decomp += E_MLstem(tt, -1, -1, P);
+            if (sc) {
+              if (sc->energy_bp)
+                decomp += sc->energy_bp[ij];
+
+              if (sc->f)
+                decomp += sc->f(i, j, i + 1, j - 1, VRNA_DECOMP_PAIR_ML, sc->data);
+            }
+            break;
+        }
+      }
+    }
+
+    if (dangle_model % 2) {
+      /* dangles == 1 || dangles == 3 */
+      /* new closing pair (i,j) with mb part [i+2,j-1] */
+      if (evaluate(i, j, i + 2, j - 1, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+        if (dmli2[j - 1] != INF) {
+          tt = rtype[type];
+
+          if (tt == 0)
+            tt = 7;
+
+          en = dmli2[j - 1] + E_MLstem(tt, -1, S_i1, P) + P->MLbase;
+          if (sc) {
+            if (sc->energy_up)
+              en += sc->energy_up[i + 1][1];
+
+            if (sc->energy_bp)
+              en += sc->energy_bp[ij];
+
+            if (sc->f)
+              en += sc->f(i, j, i + 2, j - 1, VRNA_DECOMP_PAIR_ML, sc->data);
+          }
+          decomp = MIN2(decomp, en);
+        }
+      }
+
+      /* new closing pair (i,j) with mb part [i+2.j-2] */
+      if (evaluate(i, j, i + 2, j - 2, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+        if (dmli2[j - 2] != INF) {
+          tt = rtype[type];
+
+          if (tt == 0)
+            tt = 7;
+
+          en = dmli2[j - 2] + E_MLstem(tt, S_j1, S_i1, P) + 2 * P->MLbase;
+          if (sc) {
+            if (sc->energy_up)
+              en += sc->energy_up[i + 1][1]
+                    + sc->energy_up[j - 1][1];
+
+            if (sc->energy_bp)
+              en += sc->energy_bp[ij];
+
+            if (sc->f)
+              en += sc->f(i, j, i + 2, j - 2, VRNA_DECOMP_PAIR_ML, sc->data);
+          }
+          decomp = MIN2(decomp, en);
+        }
+      }
+
+      /* new closing pair (i,j) with mb part [i+1, j-2] */
+      if (evaluate(i, j, i + 1, j - 2, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+        if (dmli1[j - 2] != INF) {
+          tt = rtype[type];
+
+          if (tt == 0)
+            tt = 7;
+
+          en = dmli1[j - 2] + E_MLstem(tt, S_j1, -1, P) + P->MLbase;
+          if (sc) {
+            if (sc->energy_up)
+              en += sc->energy_up[j - 1][1];
+
+            if (sc->energy_bp)
+              en += sc->energy_bp[ij];
+
+            if (sc->f)
+              en += sc->f(i, j, i + 1, j - 2, VRNA_DECOMP_PAIR_ML, sc->data);
+          }
+          decomp = MIN2(decomp, en);
+        }
+      }
+    } /* end if dangles % 2 */
+
+    if (decomp != INF)
+      e = decomp + P->MLclosing;
+  } /* end regular multibranch loop */
+
+  if (sn[i] != sn[j]) {
+    /* multibrach like cofold structure with cut somewhere between i and j */
+    if (evaluate(i, j, i + 1, j - 1, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+      if ((fc[i + 1] != INF) && (fc[j - 1] != INF)) {
+        decomp  = fc[i + 1] + fc[j - 1];
+        tt      = rtype[type];
+
+        if (tt == 0)
+          tt = 7;
+
+        switch (dangle_model) {
+          case 0:
+            decomp += E_ExtLoop(tt, -1, -1, P);
+            break;
+
+          case 2:
+            decomp += E_ExtLoop(tt, S_j1, S_i1, P);
+            break;
+
+          default:
+            decomp += E_ExtLoop(tt, -1, -1, P);
+            break;
+        }
+      }
+    }
+
+    if (dangle_model % 2) {
+      /* dangles == 1 || dangles == 3 */
+      if (evaluate(i, j, i + 2, j - 1, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+        if ((fc[i + 2] != INF) && (fc[j - 1] != INF)) {
+          tt = rtype[type];
+
+          if (tt == 0)
+            tt = 7;
+
+          en      = fc[i + 2] + fc[j - 1] + E_ExtLoop(tt, -1, S_i1, P);
+          decomp  = MIN2(decomp, en);
+        }
+      }
+
+      if (evaluate(i, j, i + 1, j - 2, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+        if ((fc[i + 1] != INF) && (fc[j - 2] != INF)) {
+          tt = rtype[type];
+
+          if (tt == 0)
+            tt = 7;
+
+          en      = fc[i + 1] + fc[j - 2] + E_ExtLoop(tt, S_j1, -1, P);
+          decomp  = MIN2(decomp, en);
+        }
+      }
+
+      if (evaluate(i, j, i + 2, j - 2, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+        if ((fc[i + 2] != INF) && (fc[j - 2] != INF)) {
+          tt = rtype[type];
+
+          if (tt == 0)
+            tt = 7;
+
+          en      = fc[i + 2] + fc[j - 2] + E_ExtLoop(tt, S_j1, S_i1, P);
+          decomp  = MIN2(decomp, en);
+        }
+      }
+    }
+
+    e = MIN2(e, decomp);
+  }
+  return e;
+}
+
+
+PUBLIC int
+E_mb_loop_stack(int                   i,
+                int                   j,
+                vrna_fold_compound_t  *vc)
+{
+  unsigned char             type, type_2;
+  char                      *ptype;
+  int                       e, decomp, en, i1k, k1j1, ij, k, *indx, *c, *fML, turn, *rtype;
+  vrna_param_t              *P;
+  vrna_md_t                 *md;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  indx  = vc->jindx;
+  hc    = vc->hc;
+  c     = vc->matrices->c;
+  fML   = vc->matrices->fML;
+  P     = vc->params;
+  md    = &(P->model_details);
+  turn  = md->min_loop_size;
+  ptype = vc->ptype;
+  rtype = &(md->rtype[0]);
+  sc    = vc->sc;
+  e     = INF;
+  ij    = indx[j] + i;
+  type  = ptype[ij];
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ml;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  if (evaluate(i, j, i + 1, j - 1, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+    if (type == 0)
+      type = 7;
+
+    decomp  = INF;
+    k1j1    = indx[j - 1] + i + 2 + turn + 1;
+    for (k = i + 2 + turn; k < j - 2 - turn; k++, k1j1++) {
+      i1k = indx[k] + i + 1;
+
+      if (evaluate(i, j, i + 1, k, VRNA_DECOMP_ML_COAXIAL, &hc_dat_local)) {
+        type_2 = rtype[(unsigned char)ptype[i1k]];
+
+        if (type_2 == 0)
+          type_2 = 7;
+
+        en = c[i1k] + P->stack[type][type_2] + fML[k1j1];
+        if (sc)
+          if (sc->f)
+            en += sc->f(i, j, i + 1, k, VRNA_DECOMP_ML_COAXIAL, sc->data);
+        decomp = MIN2(decomp, en);
+      }
+
+      if (evaluate(i, j, k + 1, j - 1, VRNA_DECOMP_ML_COAXIAL, &hc_dat_local)) {
+        type_2 = rtype[(unsigned char)ptype[k1j1]];
+
+        if (type_2 == 0)
+          type_2 = 7;
+
+        en = c[k1j1] + P->stack[type][type_2] + fML[i1k];
+        if (sc)
+          if (sc->f)
+            en += sc->f(i, j, k + 1, j - 1, VRNA_DECOMP_ML_COAXIAL, sc->data);
+        decomp = MIN2(decomp, en);
+      }
+    }
+    /* no TermAU penalty if coax stack */
+    decomp += 2 * P->MLintern[1] + P->MLclosing;
+    if (sc) {
+      if (sc->energy_bp)
+        decomp += sc->energy_bp[ij];
+      if (sc->f)
+        decomp += sc->f(i, j, i + 1, j - 1, VRNA_DECOMP_PAIR_ML, sc->data);
+    }
+    e = decomp;
+  }
+  return e;
+}
+
+
+PUBLIC int
+E_ml_rightmost_stem(int                   i,
+                    int                   j,
+                    vrna_fold_compound_t  *vc)
+{
+  if ((vc) && (vc->matrices) && (vc->matrices->fM1))
+    return extend_fm_3p(i, j, vc->matrices->fM1, vc);
+
+  return INF;
+}
+
+
+/*
+ * compose a multibranch loop part fm[i:j]
+ * by either c[i,j]/ggg[i,j] or fm[i:j-1]
+ *
+ * This function can be used for fM and fM1
+ */
+PRIVATE int
+extend_fm_3p(int                  i,
+             int                  j,
+             int                  *fm,
+             vrna_fold_compound_t *vc)
+{
+  short                     *S;
+  unsigned int              *sn;
+  int                       en, length, *indx, *c, *ggg, ij, type,
+                            dangle_model, with_gquad, e, u, k, cnt, with_ud;
+  vrna_param_t              *P;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_ud_t                 *domains_up;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  P             = vc->params;
+  length        = vc->length;
+  S             = vc->sequence_encoding;
+  indx          = vc->jindx;
+  sn            = vc->strand_number;
+  hc            = vc->hc;
+  sc            = vc->sc;
+  c             = vc->matrices->c;
+  ggg           = vc->matrices->ggg;
+  ij            = indx[j] + i;
+  type          = vc->ptype[ij];
+  dangle_model  = P->model_details.dangles;
+  with_gquad    = P->model_details.gquad;
+  domains_up    = vc->domains_up;
+  with_ud       = (domains_up && domains_up->energy_cb) ? 1 : 0;
+  e             = INF;
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ml;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  if (sn[i - 1] == sn[i]) {
+    if (sn[j] == sn[j + 1]) {
+      if (evaluate(i, j, i, j, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+        if (type == 0)
+          type = 7;
+
+        e = c[ij];
+        if (e != INF) {
+          switch (dangle_model) {
+            case 2:
+              e += E_MLstem(type, (i == 1) ? S[length] : S[i - 1], S[j + 1], P);
+              break;
+
+            default:
+              e += E_MLstem(type, -1, -1, P);
+              break;
+          }
+          if (sc)
+            if (sc->f)
+              e += sc->f(i, j, i, j, VRNA_DECOMP_ML_STEM, sc->data);
+        }
+      }
+
+      if (with_gquad) {
+        if (sn[i] == sn[j]) {
+          en  = ggg[ij] + E_MLstem(0, -1, -1, P);
+          e   = MIN2(e, en);
+        }
+      }
+    }
+
+    if (sn[j - 1] == sn[j]) {
+      if (evaluate(i, j, i, j - 1, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+        if (fm[indx[j - 1] + i] != INF) {
+          en = fm[indx[j - 1] + i] + P->MLbase;
+          if (sc) {
+            if (sc->energy_up)
+              en += sc->energy_up[j][1];
+            if (sc->f)
+              en += sc->f(i, j, i, j - 1, VRNA_DECOMP_ML_ML, sc->data);
+          }
+          e = MIN2(e, en);
+        }
+      }
+    }
+
+    if (with_ud) {
+      for (cnt = 0; cnt < domains_up->uniq_motif_count; cnt++) {
+        u = domains_up->uniq_motif_size[cnt];
+        k = j - u + 1;
+        if ((k > i) && (sn[j - u] == sn[j])) {
+          if (evaluate(i, j, i, k - 1, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+            if (fm[indx[k - 1] + i] != INF) {
+              en = domains_up->energy_cb(vc,
+                                         k, j,
+                                         VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                         domains_up->data);
+              if (en != INF) {
+                en += fm[indx[k - 1] + i]
+                      + u * P->MLbase;
+
+                if (sc) {
+                  if (sc->energy_up)
+                    en += sc->energy_up[k][u];
+                  if (sc->f)
+                    en += sc->f(i, j, i, k - 1, VRNA_DECOMP_ML_ML, sc->data);
+                }
+                e = MIN2(e, en);
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  return e;
+}
+
+
+PRIVATE int
+E_ml_stems_fast(vrna_fold_compound_t  *vc,
+                int                   i,
+                int                   j,
+                int                   *fmi,
+                int                   *dmli)
+{
+  char                      *ptype;
+  short                     *S;
+  unsigned int              *sn;
+  int                       k, en, decomp, mm5, mm3, type_2, k1j, stop, length, *indx,
+                            *c, *fm, ij, dangle_model, turn, type, *rtype, circular, cp, e, u,
+                            cnt, with_ud;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_param_t              *P;
+  vrna_ud_t                 *domains_up;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  length        = (int)vc->length;
+  ptype         = vc->ptype;
+  S             = vc->sequence_encoding;
+  indx          = vc->jindx;
+  sn            = vc->strand_number;
+  hc            = vc->hc;
+  sc            = vc->sc;
+  c             = vc->matrices->c;
+  fm            = vc->matrices->fML;
+  P             = vc->params;
+  ij            = indx[j] + i;
+  dangle_model  = P->model_details.dangles;
+  turn          = P->model_details.min_loop_size;
+  type          = ptype[ij];
+  rtype         = &(P->model_details.rtype[0]);
+  circular      = P->model_details.circ;
+  cp            = vc->cutpoint;
+  domains_up    = vc->domains_up;
+  with_ud       = (domains_up && domains_up->energy_cb) ? 1 : 0;
+  e             = INF;
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ml;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  /*
+   *  extension with one unpaired nucleotide at the right (3' site)
+   *  or full branch of (i,j)
+   */
+  e = extend_fm_3p(i, j, fm, vc);
+
+  /*
+   *  extension with one unpaired nucleotide at 5' site
+   *  and all other variants which are needed for odd
+   *  dangle models
+   */
+  if (sn[i - 1] == sn[i]) {
+    if (sn[i] == sn[i + 1]) {
+      if (evaluate(i, j, i + 1, j, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+        if (fm[ij + 1] != INF) {
+          en = fm[ij + 1] + P->MLbase;
+          if (sc) {
+            if (sc->energy_up)
+              en += sc->energy_up[i][1];
+            if (sc->f)
+              en += sc->f(i, j, i + 1, j, VRNA_DECOMP_ML_ML, sc->data);
+          }
+          e = MIN2(e, en);
+        }
+      }
+    }
+
+    /* extension with bound ligand on 5'site */
+    if (with_ud) {
+      for (cnt = 0; cnt < domains_up->uniq_motif_count; cnt++) {
+        u = domains_up->uniq_motif_size[cnt];
+        k = i + u - 1;
+        if ((k < j) && (sn[i] == sn[k + 1])) {
+          if (evaluate(i, j, k + 1, j, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+            if (fm[ij + u] != INF) {
+              en = domains_up->energy_cb(vc,
+                                         i, k,
+                                         VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                         domains_up->data);
+              if (en != INF) {
+                en += fm[ij + u]
+                      + u * P->MLbase;
+
+                if (sc) {
+                  if (sc->energy_up)
+                    en += sc->energy_up[i][u];
+                  if (sc->f)
+                    en += sc->f(i, j, k + 1, j, VRNA_DECOMP_ML_ML, sc->data);
+                }
+                e = MIN2(e, en);
+              }
+            }
+          }
+        }
+      }
+    }
+
+    if (dangle_model % 2) {
+      /* dangle_model = 1 || 3 */
+
+      mm5 = ((i > 1) || circular) ? S[i] : -1;
+      mm3 = ((j < length) || circular) ? S[j] : -1;
+
+      if (sn[i] == sn[i + 1]) {
+        if (evaluate(i, j, i + 1, j, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+          if (c[ij + 1] != INF) {
+            type = ptype[ij + 1];
+
+            if (type == 0)
+              type = 7;
+
+            en = c[ij + 1] + E_MLstem(type, mm5, -1, P) + P->MLbase;
+            if (sc) {
+              if (sc->energy_up)
+                en += sc->energy_up[i][1];
+              if (sc->f)
+                en += sc->f(i, j, i + 1, j, VRNA_DECOMP_ML_STEM, sc->data);
+            }
+            e = MIN2(e, en);
+          }
+        }
+      }
+
+      if (sn[j - 1] == sn[j]) {
+        if (evaluate(i, j, i, j - 1, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+          if (c[indx[j - 1] + i] != INF) {
+            type = ptype[indx[j - 1] + i];
+
+            if (type == 0)
+              type = 7;
+
+            en = c[indx[j - 1] + i] + E_MLstem(type, -1, mm3, P) + P->MLbase;
+            if (sc) {
+              if (sc->energy_up)
+                en += sc->energy_up[j][1];
+              if (sc->f)
+                en += sc->f(i, j, i, j - 1, VRNA_DECOMP_ML_STEM, sc->data);
+            }
+            e = MIN2(e, en);
+          }
+        }
+      }
+
+      if ((sn[j - 1] == sn[j]) && (sn[i] == sn[i + 1])) {
+        if (evaluate(i, j, i + 1, j - 1, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+          if (c[indx[j - 1] + i + 1] != INF) {
+            type = ptype[indx[j - 1] + i + 1];
+
+            if (type == 0)
+              type = 7;
+
+            en = c[indx[j - 1] + i + 1] + E_MLstem(type, mm5, mm3, P) + 2 * P->MLbase;
+            if (sc) {
+              if (sc->energy_up)
+                en += sc->energy_up[j][1] + sc->energy_up[i][1];
+              if (sc->f)
+                en += sc->f(i, j, i + 1, j - 1, VRNA_DECOMP_ML_STEM, sc->data);
+            }
+            e = MIN2(e, en);
+          }
+        }
+      }
+    } /* end special cases for dangles == 1 || dangles == 3 */
+  }
+
+  /* modular decomposition -------------------------------*/
+  k1j   = indx[j] + i + turn + 2;
+  stop  = (cp > 0) ? (cp - 1) : (j - 2 - turn);
+
+  /* duplicated code is faster than conditions in loop */
+  if (hc->f) {
+    if (sc && sc->f) {
+      for (decomp = INF, k = i + 1 + turn; k <= stop; k++, k1j++) {
+        if ((fmi[k] != INF) && (fm[k1j] != INF) && hc->f(i, j, k, k + 1, VRNA_DECOMP_ML_ML_ML, &hc_dat_local)) {
+          en      = fmi[k] + fm[k1j];
+          en      += sc->f(i, j, k, k + 1, VRNA_DECOMP_ML_ML_ML, sc->data);
+          decomp  = MIN2(decomp, en);
+        }
+      }
+      k++; k1j++;
+      for (; k <= j - 2 - turn; k++, k1j++) {
+        if ((fmi[k] != INF) && (fm[k1j] != INF) && hc->f(i, j, k, k + 1, VRNA_DECOMP_ML_ML_ML, &hc_dat_local)) {
+          en      = fmi[k] + fm[k1j];
+          en      += sc->f(i, j, k, k + 1, VRNA_DECOMP_ML_ML_ML, sc->data);
+          decomp  = MIN2(decomp, en);
+        }
+      }
+    } else {
+      for (decomp = INF, k = i + 1 + turn; k <= stop; k++, k1j++) {
+        if ((fmi[k] != INF) && (fm[k1j] != INF) && hc->f(i, j, k, k + 1, VRNA_DECOMP_ML_ML_ML, &hc_dat_local)) {
+          en      = fmi[k] + fm[k1j];
+          decomp  = MIN2(decomp, en);
+        }
+      }
+      k++; k1j++;
+      for (; k <= j - 2 - turn; k++, k1j++) {
+        if ((fmi[k] != INF) && (fm[k1j] != INF) && hc->f(i, j, k, k + 1, VRNA_DECOMP_ML_ML_ML, &hc_dat_local)) {
+          en      = fmi[k] + fm[k1j];
+          decomp  = MIN2(decomp, en);
+        }
+      }
+    }
+  } else {
+    if (sc && sc->f) {
+      for (decomp = INF, k = i + 1 + turn; k <= stop; k++, k1j++) {
+        if ((fmi[k] != INF) && (fm[k1j] != INF)) {
+          en      = fmi[k] + fm[k1j];
+          en      += sc->f(i, j, k, k + 1, VRNA_DECOMP_ML_ML_ML, sc->data);
+          decomp  = MIN2(decomp, en);
+        }
+      }
+      k++; k1j++;
+      for (; k <= j - 2 - turn; k++, k1j++) {
+        if ((fmi[k] != INF) && (fm[k1j] != INF)) {
+          en      = fmi[k] + fm[k1j];
+          en      += sc->f(i, j, k, k + 1, VRNA_DECOMP_ML_ML_ML, sc->data);
+          decomp  = MIN2(decomp, en);
+        }
+      }
+    } else {
+      for (decomp = INF, k = i + 1 + turn; k <= stop; k++, k1j++) {
+        if ((fmi[k] != INF) && (fm[k1j] != INF)) {
+          en      = fmi[k] + fm[k1j];
+          decomp  = MIN2(decomp, en);
+        }
+      }
+      k++; k1j++;
+      for (; k <= j - 2 - turn; k++, k1j++) {
+        if ((fmi[k] != INF) && (fm[k1j] != INF)) {
+          en      = fmi[k] + fm[k1j];
+          decomp  = MIN2(decomp, en);
+        }
+      }
+    }
+  }
+
+  dmli[j] = decomp;               /* store for use in fast ML decompositon */
+  e       = MIN2(e, decomp);
+
+  /* coaxial stacking */
+  if (dangle_model == 3) {
+    /* additional ML decomposition as two coaxially stacked helices */
+    int ik;
+    k1j = indx[j] + i + turn + 2;
+    for (decomp = INF, k = i + 1 + turn; k <= stop; k++, k1j++) {
+      ik = indx[k] + i;
+      if (evaluate(i, k, k + 1, j, VRNA_DECOMP_ML_COAXIAL_ENC, &hc_dat_local)) {
+        type    = rtype[(unsigned char)ptype[ik]];
+        type_2  = rtype[(unsigned char)ptype[k1j]];
+
+        if (type == 0)
+          type = 7;
+        if (type_2 == 0)
+          type_2 = 7;
+
+        en = c[ik] + c[k1j] + P->stack[type][type_2];
+        if (sc)
+          if (sc->f)
+            en += sc->f(i, k, k + 1, j, VRNA_DECOMP_ML_COAXIAL_ENC, sc->data);
+        decomp = MIN2(decomp, en);
+      }
+    }
+    k++; k1j++;
+    for (; k <= j - 2 - turn; k++, k1j++) {
+      ik = indx[k] + i;
+      if (evaluate(i, k, k + 1, j, VRNA_DECOMP_ML_COAXIAL_ENC, &hc_dat_local)) {
+        type    = rtype[(unsigned char)ptype[ik]];
+        type_2  = rtype[(unsigned char)ptype[k1j]];
+
+        if (type == 0)
+          type = 7;
+        if (type_2 == 0)
+          type_2 = 7;
+
+        en = c[ik] + c[k1j] + P->stack[type][type_2];
+        if (sc)
+          if (sc->f)
+            en += sc->f(i, k, k + 1, j, VRNA_DECOMP_ML_COAXIAL, sc->data);
+        decomp = MIN2(decomp, en);
+      }
+    }
+
+    decomp += 2 * P->MLintern[1];        /* no TermAU penalty if coax stack */
+#if 0
+    /*
+     * This is needed for Y shaped ML loops with coax stacking of
+     * interior pairts, but backtracking will fail if activated
+     */
+    DMLi[j] = MIN2(DMLi[j], decomp);
+    DMLi[j] = MIN2(DMLi[j], DMLi[j - 1] + P->MLbase);
+    DMLi[j] = MIN2(DMLi[j], DMLi1[j] + P->MLbase);
+    new_fML = MIN2(new_fML, DMLi[j]);
+#endif
+    e = MIN2(e, decomp);
+  }
+
+  fmi[j] = e;
+
+  return e;
+}
+
+
+PRIVATE int
+E_ml_stems_fast_comparative(vrna_fold_compound_t  *vc,
+                            int                   i,
+                            int                   j,
+                            int                   *fmi,
+                            int                   *dmli)
+{
+  char            *hard_constraints;
+  short           **S, **S5, **S3;
+  unsigned short  **a2s;
+  int             e, energy, *c, *fML, *ggg, ij, *indx, s, n_seq, k,
+                  dangle_model, decomp, turn, *type;
+  vrna_param_t    *P;
+  vrna_md_t       *md;
+  vrna_mx_mfe_t   *matrices;
+  vrna_hc_t       *hc;
+  vrna_sc_t       **scs;
+
+  n_seq             = vc->n_seq;
+  matrices          = vc->matrices;
+  P                 = vc->params;
+  md                = &(P->model_details);
+  c                 = matrices->c;
+  fML               = matrices->fML;
+  ggg               = matrices->ggg;
+  indx              = vc->jindx;
+  hc                = vc->hc;
+  scs               = vc->scs;
+  hard_constraints  = hc->matrix;
+  dangle_model      = md->dangles;
+  turn              = md->min_loop_size;
+  a2s               = vc->a2s;
+  ij                = indx[j] + i;
+  e                 = INF;
+
+  if (hc->up_ml[i]) {
+    energy = fML[ij + 1] + n_seq * P->MLbase;
+    if (scs) {
+      for (s = 0; s < n_seq; s++) {
+        if (scs[s])
+          if (scs[s]->energy_up)
+            energy += scs[s]->energy_up[a2s[s][i]][1];
+      }
+    }
+    e = MIN2(e, energy);
+  }
+
+  if (hc->up_ml[j]) {
+    energy = fML[indx[j - 1] + i] + n_seq * P->MLbase;
+    if (scs) {
+      for (s = 0; s < n_seq; s++) {
+        if (scs[s])
+          if (scs[s]->energy_up)
+            energy += scs[s]->energy_up[a2s[s][j]][1];
+      }
+    }
+    e = MIN2(e, energy);
+  }
+
+  if (hard_constraints[ij] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC) {
+    energy = c[ij];
+
+    type  = (int *)vrna_alloc(n_seq * sizeof(int));
+    S     = vc->S;
+    S5    = vc->S5;     /* S5[s][i] holds next base 5' of i in sequence s */
+    S3    = vc->S3;     /* Sl[s][i] holds next base 3' of i in sequence s */
+
+    for (s = 0; s < n_seq; s++) {
+      type[s] = md->pair[S[s][i]][S[s][j]];
+      if (type[s] == 0)
+        type[s] = 7;
+    }
+
+    if (dangle_model)
+      for (s = 0; s < n_seq; s++)
+        energy += E_MLstem(type[s], S5[s][i], S3[s][j], P);
+    else
+      for (s = 0; s < n_seq; s++)
+        energy += E_MLstem(type[s], -1, -1, P);
+    e = MIN2(e, energy);
+
+    if (md->gquad) {
+      decomp  = ggg[indx[j] + i] + n_seq * E_MLstem(0, -1, -1, P);
+      e       = MIN2(e, decomp);
+    }
+
+    free(type);
+  }
+
+
+  /* modular decomposition -------------------------------*/
+  for (decomp = INF, k = i + 1 + turn; k <= j - 2 - turn; k++)
+    decomp = MIN2(decomp, fmi[k] + fML[indx[j] + k + 1]);
+
+  dmli[j] = decomp; /* store for later use in ML decompositon */
+
+  e = MIN2(e, decomp);
+
+  fmi[j] = e; /* store for later use in ML decompositon */
+
+  return e;
+}
+
+
+PRIVATE FLT_OR_DBL
+exp_E_mb_loop_fast(vrna_fold_compound_t *vc,
+                   int                  i,
+                   int                  j,
+                   FLT_OR_DBL           *qqm1)
+{
+  unsigned char             type, tt;
+  char                      *ptype;
+  short                     *S1;
+  unsigned int              *sn;
+  int                       ij, k, kl, *my_iindx, *jindx, *rtype;
+  FLT_OR_DBL                qbt1, temp, qqqmmm, *qm, *scale, expMLclosing;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_exp_param_t          *pf_params;
+  vrna_md_t                 *md;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  my_iindx      = vc->iindx;
+  jindx         = vc->jindx;
+  sc            = vc->sc;
+  ptype         = vc->ptype;
+  S1            = vc->sequence_encoding;
+  qm            = vc->exp_matrices->qm;
+  scale         = vc->exp_matrices->scale;
+  pf_params     = vc->exp_params;
+  md            = &(pf_params->model_details);
+  ij            = jindx[j] + i;
+  sn            = vc->strand_number;
+  hc            = vc->hc;
+  expMLclosing  = pf_params->expMLclosing;
+  qbt1          = 0.;
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ml;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  /* multiple stem loop contribution */
+  if (evaluate(i, j, i + 1, j - 1, VRNA_DECOMP_PAIR_ML, &hc_dat_local) && (sn[i] == sn[i + 1]) && (sn[j - 1] == sn[j])) {
+    type  = (unsigned char)ptype[ij];
+    rtype = &(md->rtype[0]);
+    tt    = rtype[type];
+
+    if (tt == 0)
+      tt = 7;
+
+    qqqmmm = expMLclosing
+             * exp_E_MLstem(tt, S1[j - 1], S1[i + 1], pf_params)
+             * scale[2];
+
+    temp  = 0.0;
+    kl    = my_iindx[i + 1] - (i + 1);
+
+    if (sc) {
+      if (sc->exp_energy_bp)
+        qqqmmm *= sc->exp_energy_bp[my_iindx[i] - j];
+
+      if (sc->exp_f) {
+        qqqmmm *= sc->exp_f(i, j, i, j, VRNA_DECOMP_PAIR_ML, sc->data);
+
+        for (k = i + 2; k <= j - 1; k++, kl--) {
+          if (sn[k - 1] == sn[k]) {
+            temp += qm[kl]
+                    * qqm1[k]
+                    * sc->exp_f(i + 1, j - 1, k - 1, k, VRNA_DECOMP_ML_ML_ML, sc->data);
+          }
+        }
+      } else {
+        for (k = i + 2; k <= j - 1; k++, kl--) {
+          if (sn[k - 1] == sn[k])
+            temp += qm[kl]
+                    * qqm1[k];
+        }
+      }
+    } else {
+      for (k = i + 2; k <= j - 1; k++, kl--) {
+        if (sn[k - 1] == sn[k])
+          temp += qm[kl]
+                  * qqm1[k];
+      }
+    }
+
+    qbt1 += temp * qqqmmm;
+  }
+
+  return qbt1;
+}
+
+
+PRIVATE FLT_OR_DBL
+exp_E_mb_loop_fast_comparative(vrna_fold_compound_t *vc,
+                               int                  i,
+                               int                  j,
+                               FLT_OR_DBL           *qqm1)
+{
+  short                     **S, **S5, **S3;
+  int                       k, kl, *my_iindx, *types, n_seq, s;
+  FLT_OR_DBL                qbt1, temp, qqqmmm, *qm, *scale, expMLclosing;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 **scs;
+  vrna_exp_param_t          *pf_params;
+  vrna_md_t                 *md;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  my_iindx      = vc->iindx;
+  qm            = vc->exp_matrices->qm;
+  scale         = vc->exp_matrices->scale;
+  pf_params     = vc->exp_params;
+  md            = &(pf_params->model_details);
+  hc            = vc->hc;
+  expMLclosing  = pf_params->expMLclosing;
+  qbt1          = 0.;
+  types         = NULL;
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ml;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  /* multiple stem loop contribution */
+  if (evaluate(i, j, i + 1, j - 1, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+    S     = vc->S;
+    S5    = vc->S5;       /* S5[s][i] holds next base 5' of i in sequence s */
+    S3    = vc->S3;       /* Sl[s][i] holds next base 3' of i in sequence s */
+    scs   = vc->scs;
+    n_seq = vc->n_seq;
+    types = (int *)vrna_alloc(sizeof(int) * n_seq);
+
+    qqqmmm = 1.;
+
+    for (s = 0; s < n_seq; s++) {
+      types[s] = md->pair[S[s][j]][S[s][i]];
+      if (types[s] == 0)
+        types[s] = 7;
+    }
+
+    for (s = 0; s < n_seq; s++)
+      qqqmmm *= exp_E_MLstem(types[s], S5[s][j], S3[s][i], pf_params)
+                * expMLclosing;
+
+    if (scs) {
+      for (s = 0; s < n_seq; s++) {
+        if (scs[s])
+          if (scs[s]->exp_energy_bp)
+            qqqmmm *= scs[s]->exp_energy_bp[my_iindx[i] - j];
+      }
+    }
+
+    /* multi-loop loop contribution */
+    temp  = 0.;
+    kl    = my_iindx[i + 1] - (i + 1);
+
+    for (k = i + 2; k <= j - 1; k++, kl--)
+      temp += qm[kl] * qqm1[k];
+
+    temp *= scale[2];
+
+    qbt1 = temp * qqqmmm;
+  }
+
+  /* cleanup */
+  free(types);
+
+  return qbt1;
+}
+
+
+/*
+ #################################
+ # Backtracking functions below  #
+ #################################
+ */
+PUBLIC int
+vrna_BT_mb_loop_fake(vrna_fold_compound_t *vc,
+                     int                  *u,
+                     int                  *i,
+                     int                  *j,
+                     vrna_bp_stack_t      *bp_stack,
+                     int                  *stack_count)
+{
+  unsigned char type;
+  char          *ptype;
+  short         mm5, mm3, *S1;
+  unsigned int  *sn;
+  int           length, ii, jj, k, en, cp, fij, fi, *my_c, *my_fc, *my_ggg,
+                *idx, with_gquad, dangle_model, turn;
+  vrna_param_t  *P;
+  vrna_md_t     *md;
+  vrna_hc_t     *hc;
+  vrna_sc_t     *sc;
+
+  cp            = vc->cutpoint;
+  length        = vc->length;
+  P             = vc->params;
+  md            = &(P->model_details);
+  sn            = vc->strand_number;
+  hc            = vc->hc;
+  sc            = vc->sc;
+  S1            = vc->sequence_encoding;
+  ptype         = vc->ptype;
+  idx           = vc->jindx;
+  my_c          = vc->matrices->c;
+  my_fc         = vc->matrices->fc;
+  my_ggg        = vc->matrices->ggg;
+  turn          = md->min_loop_size;
+  with_gquad    = md->gquad;
+  dangle_model  = md->dangles;
+
+  ii  = *i;
+  jj  = *j;
+
+  if (ii < cp) {
+    /* 'lower' part (fc[i<cut,j=cut-1]) */
+
+    /* nibble off unpaired 5' bases */
+    do {
+      fij = my_fc[ii];
+      fi  = (hc->up_ext[ii]) ? my_fc[ii + 1] : INF;
+
+      if (sc)
+        if (sc->energy_up)
+          fi += sc->energy_up[ii][1];
+
+      if (++ii == jj)
+        break;
+    } while (fij == fi);
+    ii--;
+
+    if (jj < ii + turn + 2) {
+      /* no more pairs */
+      *u = *i = *j = -1;
+      return 1;
+    }
+
+    mm5 = (ii > 1 && (sn[ii - 1] == sn[ii])) ? S1[ii - 1] : -1;
+
+    /* i or i+1 is paired. Find pairing partner */
+    switch (dangle_model) {
+      case 0:
+        for (k = ii + turn + 1; k <= jj; k++) {
+          if (hc->matrix[idx[k] + ii] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+            type = (unsigned char)ptype[idx[k] + ii];
+
+            if (type == 0)
+              type = 7;
+
+            if (fij == my_fc[k + 1] + my_c[idx[k] + ii] + E_ExtLoop(type, -1, -1, P)) {
+              bp_stack[++(*stack_count)].i  = ii;
+              bp_stack[(*stack_count)].j    = k;
+              *u                            = k + 1;
+              *i                            = ii;
+              *j                            = k;
+              return 1;
+            }
+          }
+
+          if (with_gquad) {
+            if (fij == my_fc[k + 1] + my_ggg[idx[k] + ii]) {
+              *u  = k + 1;
+              *i  = *j = -1;
+              vrna_BT_gquad_mfe(vc, ii, k, bp_stack, stack_count);
+              return 1;
+            }
+          }
+        }
+        break;
+
+      case 2:
+        for (k = ii + turn + 1; k <= jj; k++) {
+          if (hc->matrix[idx[k] + ii] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+            mm3   = (sn[k] == sn[k + 1]) ? S1[k + 1] : -1;
+            type  = (unsigned char)ptype[idx[k] + ii];
+
+            if (type == 0)
+              type = 7;
+
+            if (fij == my_fc[k + 1] + my_c[idx[k] + ii] + E_ExtLoop(type, mm5, mm3, P)) {
+              bp_stack[++(*stack_count)].i  = ii;
+              bp_stack[(*stack_count)].j    = k;
+              *u                            = k + 1;
+              *i                            = ii;
+              *j                            = k;
+              return 1;
+            }
+          }
+
+          if (with_gquad) {
+            if (fij == my_fc[k + 1] + my_ggg[idx[k] + ii]) {
+              *u  = k + 1;
+              *i  = *j = -1;
+              vrna_BT_gquad_mfe(vc, ii, k, bp_stack, stack_count);
+              return 1;
+            }
+          }
+        }
+        break;
+
+      default:
+        for (k = ii + turn + 1; k <= jj; k++) {
+          if (hc->matrix[idx[k] + ii] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+            type = (unsigned char)ptype[idx[k] + ii];
+
+            if (type == 0)
+              type = 7;
+
+            if (fij == my_fc[k + 1] + my_c[idx[k] + ii] + E_ExtLoop(type, -1, -1, P)) {
+              bp_stack[++(*stack_count)].i  = ii;
+              bp_stack[(*stack_count)].j    = k;
+              *u                            = k + 1;
+              *i                            = ii;
+              *j                            = k;
+              return 1;
+            }
+            if (hc->up_ext[k + 1]) {
+              mm3 = (sn[k] == sn[k + 1]) ? S1[k + 1] : -1;
+              en  = my_c[idx[k] + ii];
+              if (sc)
+                if (sc->energy_up)
+                  en += sc->energy_up[k + 1][1];
+
+              if (fij == my_fc[k + 2] + en + E_ExtLoop(type, -1, mm3, P)) {
+                bp_stack[++(*stack_count)].i  = ii;
+                bp_stack[(*stack_count)].j    = k;
+                *u                            = k + 2;
+                *i                            = ii;
+                *j                            = k;
+                return 1;
+              }
+            }
+          }
+
+          if (with_gquad) {
+            if (fij == my_fc[k + 1] + my_ggg[idx[k] + ii]) {
+              *u  = k + 1;
+              *i  = *j = -1;
+              vrna_BT_gquad_mfe(vc, ii, k, bp_stack, stack_count);
+              return 1;
+            }
+          }
+
+          if (hc->matrix[idx[k] + ii + 1] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+            if (hc->up_ext[ii]) {
+              mm5   = (sn[ii] == sn[ii + 1]) ? S1[ii] : -1;
+              mm3   = (sn[k] == sn[k + 1]) ? S1[k + 1] : -1;
+              type  = ptype[idx[k] + ii + 1];
+
+              if (type == 0)
+                type = 7;
+
+              en = my_c[idx[k] + ii + 1];
+              if (sc)
+                if (sc->energy_up)
+                  en += sc->energy_up[ii][1];
+
+              if (fij == en + my_fc[k + 1] + E_ExtLoop(type, mm5, -1, P)) {
+                bp_stack[++(*stack_count)].i  = ii + 1;
+                bp_stack[(*stack_count)].j    = k;
+                *u                            = k + 1;
+                *i                            = ii + 1;
+                *j                            = k;
+                return 1;
+              }
+
+              if (k < jj) {
+                if (hc->up_ext[k + 1]) {
+                  if (sc)
+                    if (sc->energy_up)
+                      en += sc->energy_up[k + 1][1];
+
+                  if (fij == en + my_fc[k + 2] + E_ExtLoop(type, mm5, mm3, P)) {
+                    bp_stack[++(*stack_count)].i  = ii + 1;
+                    bp_stack[(*stack_count)].j    = k;
+                    *u                            = k + 2;
+                    *i                            = ii + 1;
+                    *j                            = k;
+                    return 1;
+                  }
+                }
+              }
+            }
+          }
+        }
+        break;
+    }
+  } else {
+    /* 'upper' part (fc[i=cut,j>cut]) */
+
+    /* nibble off unpaired 3' bases */
+    do {
+      fij = my_fc[jj];
+      fi  = (hc->up_ext[jj]) ? my_fc[jj - 1] : INF;
+
+      if (sc)
+        if (sc->energy_up)
+          fi += sc->energy_up[jj][1];
+
+      if (--jj == ii)
+        break;
+    } while (fij == fi);
+    jj++;
+
+    if (jj < ii + turn + 2) {
+      /* no more pairs */
+      *u = *i = *j = -1;
+      return 1;
+    }
+
+    /* j or j-1 is paired. Find pairing partner */
+    mm3 = ((jj < length) && (sn[jj] == sn[jj + 1])) ? S1[jj + 1] : -1;
+    switch (dangle_model) {
+      case 0:
+        for (k = jj - turn - 1; k >= ii; k--) {
+          if (with_gquad) {
+            if (fij == my_fc[k - 1] + my_ggg[idx[jj] + k]) {
+              *u  = k - 1;
+              *i  = *j = -1;
+              vrna_BT_gquad_mfe(vc, k, jj, bp_stack, stack_count);
+              return 1;
+            }
+          }
+
+          if (hc->matrix[idx[jj] + k] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+            type = (unsigned char)ptype[idx[jj] + k];
+
+            if (type == 0)
+              type = 7;
+
+            en = my_c[idx[jj] + k];
+            if (sn[k] != sn[jj])
+              en += P->DuplexInit;
+
+            if (fij == my_fc[k - 1] + en + E_ExtLoop(type, -1, -1, P)) {
+              bp_stack[++(*stack_count)].i  = k;
+              bp_stack[(*stack_count)].j    = jj;
+              *u                            = k - 1;
+              *i                            = k;
+              *j                            = jj;
+              return 1;
+            }
+          }
+        }
+        break;
+
+      case 2:
+        for (k = jj - turn - 1; k >= ii; k--) {
+          if (with_gquad) {
+            if (fij == my_fc[k - 1] + my_ggg[idx[jj] + k]) {
+              *u  = k - 1;
+              *i  = *j = -1;
+              vrna_BT_gquad_mfe(vc, k, jj, bp_stack, stack_count);
+              return 1;
+            }
+          }
+
+          if (hc->matrix[idx[jj] + k] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+            mm5   = ((k > 1) && (sn[k - 1] == sn[k])) ? S1[k - 1] : -1;
+            type  = (unsigned char)ptype[idx[jj] + k];
+
+            if (type == 0)
+              type = 7;
+
+            en = my_c[idx[jj] + k];
+            if (sn[k] != sn[jj])
+              en += P->DuplexInit;
+
+            if (fij == my_fc[k - 1] + en + E_ExtLoop(type, mm5, mm3, P)) {
+              bp_stack[++(*stack_count)].i  = k;
+              bp_stack[(*stack_count)].j    = jj;
+              *u                            = k - 1;
+              *i                            = k;
+              *j                            = jj;
+              return 1;
+            }
+          }
+        }
+        break;
+
+      default:
+        for (k = jj - turn - 1; k >= ii; k--) {
+          if (with_gquad) {
+            if (fij == my_fc[k - 1] + my_ggg[idx[jj] + k]) {
+              *u  = k - 1;
+              *i  = *j = -1;
+              vrna_BT_gquad_mfe(vc, k, jj, bp_stack, stack_count);
+              return 1;
+            }
+          }
+
+          if (hc->matrix[idx[jj] + k] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+            type = (unsigned char)ptype[idx[jj] + k];
+
+            if (type == 0)
+              type = 7;
+
+            en = my_c[idx[jj] + k];
+            if (sn[k] != sn[jj])
+              en += P->DuplexInit;
+
+            if (fij == my_fc[k - 1] + en + E_ExtLoop(type, -1, -1, P)) {
+              bp_stack[++(*stack_count)].i  = k;
+              bp_stack[(*stack_count)].j    = jj;
+              *u                            = k - 1;
+              *i                            = k;
+              *j                            = jj;
+              return 1;
+            }
+            if (hc->up_ext[k - 1]) {
+              if ((k > 1) && (sn[k - 1] == sn[k])) {
+                mm5 = S1[k - 1];
+                if (sc)
+                  if (sc->energy_up)
+                    en += sc->energy_up[k - 1][1];
+
+                if (fij == my_fc[k - 2] + en + E_ExtLoop(type, mm5, -1, P)) {
+                  bp_stack[++(*stack_count)].i  = k;
+                  bp_stack[(*stack_count)].j    = jj;
+                  *u                            = k - 2;
+                  *i                            = k;
+                  *j                            = jj;
+                  return 1;
+                }
+              }
+            }
+          }
+
+          if (hc->matrix[idx[jj - 1] + k] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) {
+            type = (unsigned char)ptype[idx[jj - 1] + k];
+
+            if (type == 0)
+              type = 7;
+
+            if (hc->up_ext[jj]) {
+              if (sn[jj - 1] == sn[jj]) {
+                mm3 = S1[jj];
+                en  = my_c[idx[jj - 1] + k];
+                if (sn[k] != sn[jj - 1])
+                  en += P->DuplexInit;         /* ??? */
+                if (sc)
+                  if (sc->energy_up)
+                    en += sc->energy_up[jj][1];
+
+                if (fij == en + my_fc[k - 1] + E_ExtLoop(type, -1, mm3, P)) {
+                  bp_stack[++(*stack_count)].i  = k;
+                  bp_stack[(*stack_count)].j    = jj - 1;
+                  *u                            = k - 1;
+                  *i                            = k;
+                  *j                            = jj - 1;
+                  return 1;
+                }
+
+                if (k > ii) {
+                  if (hc->up_ext[k - 1]) {
+                    mm5 = (sn[k - 1] == sn[k]) ? S1[k - 1] : -1;
+                    if (sc)
+                      if (sc->energy_up)
+                        en += sc->energy_up[k - 1][1];
+
+                    if (fij == my_fc[k - 2] + en + E_ExtLoop(type, mm5, mm3, P)) {
+                      bp_stack[++(*stack_count)].i  = k;
+                      bp_stack[(*stack_count)].j    = jj - 1;
+                      *u                            = k - 2;
+                      *i                            = k;
+                      *j                            = jj - 1;
+                      return 1;
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        break;
+    }
+  }
+
+  return 0;
+}
+
+
+PUBLIC int
+vrna_BT_mb_loop_split(vrna_fold_compound_t  *vc,
+                      int                   *i,
+                      int                   *j,
+                      int                   *k,
+                      int                   *l,
+                      int                   *component1,
+                      int                   *component2,
+                      vrna_bp_stack_t       *bp_stack,
+                      int                   *stack_count)
+{
+  unsigned char             type, type_2;
+  char                      *ptype;
+  short                     *S1;
+  int                       ij, ii, jj, fij, fi, u, en, *my_c, *my_fML, *my_ggg,
+                            turn, *idx, with_gquad, dangle_model, *rtype, kk, cnt,
+                            with_ud;
+  vrna_param_t              *P;
+  vrna_md_t                 *md;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_ud_t                 *domains_up;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  P           = vc->params;
+  md          = &(P->model_details);
+  hc          = vc->hc;
+  sc          = vc->sc;
+  idx         = vc->jindx;
+  ptype       = vc->ptype;
+  rtype       = &(md->rtype[0]);
+  S1          = vc->sequence_encoding;
+  domains_up  = vc->domains_up;
+
+  my_c          = vc->matrices->c;
+  my_fML        = vc->matrices->fML;
+  my_ggg        = vc->matrices->ggg;
+  turn          = md->min_loop_size;
+  with_gquad    = md->gquad;
+  with_ud       = (domains_up && domains_up->energy_cb) ? 1 : 0;
+  dangle_model  = md->dangles;
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ml;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  ii  = *i;
+  jj  = *j;
+
+  if (with_ud) {
+    /* nibble off unpaired stretches at 3' site */
+    do {
+      fij = my_fML[idx[jj] + ii];
+      fi  = INF;
+
+      /* process regular unpaired nucleotides (unbound by ligand) first */
+      if (evaluate(ii, jj, ii, jj - 1, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+        fi = my_fML[idx[jj - 1] + ii] + P->MLbase;
+
+        if (sc) {
+          if (sc->energy_up)
+            fi += sc->energy_up[jj][1];
+          if (sc->f)
+            fi += sc->f(ii, jj, ii, jj - 1, VRNA_DECOMP_ML_ML, sc->data);
+        }
+
+        if (jj == ii)
+          return 0; /* no more pairs */
+
+        if (fij == fi) {
+          jj--;
+          continue;
+        }
+      }
+
+      /* next try to nibble off ligand */
+      for (cnt = 0; cnt < domains_up->uniq_motif_count; cnt++) {
+        u   = domains_up->uniq_motif_size[cnt];
+        kk  = jj - u + 1;
+        if ((kk >= ii) && evaluate(ii, jj, ii, jj - u, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+          en = domains_up->energy_cb(vc,
+                                     kk, jj,
+                                     VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                     domains_up->data);
+
+          if (sc) {
+            if (sc->energy_up)
+              en += sc->energy_up[kk][u];
+            if (sc->f)
+              en += sc->f(ii, jj, ii, jj - u, VRNA_DECOMP_ML_ML, sc->data);
+          }
+
+          fi  = my_fML[idx[kk - 1] + ii] + u * P->MLbase;
+          fi  += en;
+
+          if (fij == fi) {
+            /* skip remaining motifs after first hit */
+            jj = kk - 1;
+            break;
+          }
+        }
+      }
+
+      if (jj < ii)
+        return 0; /* no more pairs */
+    } while (fij == fi);
+
+    /* nibble off unpaired stretches at 5' site */
+    do {
+      fij = my_fML[idx[jj] + ii];
+      fi  = INF;
+
+      /* again, process regular unpaired nucleotides (unbound by ligand) first */
+      if (evaluate(ii, jj, ii + 1, jj, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+        fi = my_fML[idx[jj] + ii + 1] + P->MLbase;
+
+        if (sc) {
+          if (sc->energy_up)
+            fi += sc->energy_up[ii][1];
+          if (sc->f)
+            fi += sc->f(ii, jj, ii + 1, jj, VRNA_DECOMP_ML_ML, sc->data);
+        }
+
+        if (ii + 1 == jj)
+          return 0; /* no more pairs */
+
+        if (fij == fi) {
+          ii++;
+          continue;
+        }
+      }
+
+      /* next try to nibble off ligand again */
+      for (cnt = 0; cnt < domains_up->uniq_motif_count; cnt++) {
+        u   = domains_up->uniq_motif_size[cnt];
+        kk  = ii + u - 1;
+        if ((kk <= jj) && evaluate(ii, jj, ii + u, jj, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+          en = domains_up->energy_cb(vc,
+                                     ii, kk,
+                                     VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                     domains_up->data);
+
+          if (sc) {
+            if (sc->energy_up)
+              en += sc->energy_up[ii][u];
+            if (sc->f)
+              en += sc->f(ii, jj, ii + u, jj, VRNA_DECOMP_ML_ML, sc->data);
+          }
+
+          fi  = my_fML[idx[jj] + kk + 1] + u * P->MLbase;
+          fi  += en;
+
+          if (fij == fi) {
+            /* skip remaining motifs after first hit */
+            ii = kk + 1;
+            break;
+          }
+        }
+      }
+
+      if (ii > jj)
+        return 0; /* no more pairs */
+    } while (fij == fi);
+  } else {
+    /* nibble off unpaired 3' bases */
+    do {
+      fij = my_fML[idx[jj] + ii];
+      fi  = INF;
+
+      if (evaluate(ii, jj, ii, jj - 1, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+        fi = my_fML[idx[jj - 1] + ii] + P->MLbase;
+
+        if (sc) {
+          if (sc->energy_up)
+            fi += sc->energy_up[jj][1];
+          if (sc->f)
+            fi += sc->f(ii, jj, ii, jj - 1, VRNA_DECOMP_ML_ML, sc->data);
+        }
+      }
+      if (--jj == 0)
+        break;
+    } while (fij == fi);
+    jj++;
+
+    /* nibble off unpaired 5' bases */
+    do {
+      fij = my_fML[idx[jj] + ii];
+      fi  = INF;
+
+      if (evaluate(ii, jj, ii + 1, jj, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+        fi = my_fML[idx[jj] + ii + 1] + P->MLbase;
+
+        if (sc) {
+          if (sc->energy_up)
+            fi += sc->energy_up[ii][1];
+          if (sc->f)
+            fi += sc->f(ii, jj, ii + 1, jj, VRNA_DECOMP_ML_ML, sc->data);
+        }
+      }
+      if (++ii == jj)
+        break;
+    } while (fij == fi);
+    ii--;
+
+    if (jj < ii + turn + 1) /* no more pairs */
+      return 0;
+  }
+
+  ij = idx[jj] + ii;
+
+  *component1 = *component2 = 1; /* split into two multi loop parts by default */
+
+  /* 1. test for single component */
+
+  if (with_gquad) {
+    if (fij == my_ggg[ij] + E_MLstem(0, -1, -1, P)) {
+      *i  = *j = -1;
+      *k  = *l = -1;
+      vrna_BT_gquad_mfe(vc, ii, jj, bp_stack, stack_count);
+      return 1;
+    }
+  }
+
+  type  = (unsigned char)ptype[ij];
+  en    = my_c[ij];
+
+  if (sc)
+    if (sc->f)
+      en += sc->f(ii, jj, ii, jj, VRNA_DECOMP_ML_STEM, sc->data);
+
+  switch (dangle_model) {
+    case 0:
+      if (evaluate(ii, jj, ii, jj, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+        if (type == 0)
+          type = 7;
+
+        if (fij == en + E_MLstem(type, -1, -1, P)) {
+          *i          = *j = -1;
+          *k          = ii;
+          *l          = jj;
+          *component2 = 2;          /* 2nd part is structure enclosed by base pair */
+          return 1;
+        }
+      }
+      break;
+
+    case 2:
+      if (evaluate(ii, jj, ii, jj, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+        if (type == 0)
+          type = 7;
+
+        if (fij == en + E_MLstem(type, S1[ii - 1], S1[jj + 1], P)) {
+          *i          = *j = -1;
+          *k          = ii;
+          *l          = jj;
+          *component2 = 2;
+          return 1;
+        }
+      }
+      break;
+
+    default:
+      if (evaluate(ii, jj, ii, jj, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+        if (type == 0)
+          type = 7;
+
+        if (fij == en + E_MLstem(type, -1, -1, P)) {
+          *i          = *j = -1;
+          *k          = ii;
+          *l          = jj;
+          *component2 = 2;
+          return 1;
+        }
+      }
+
+      if (evaluate(ii, jj, ii + 1, jj, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+        int tmp_en = fij;
+        if (sc) {
+          if (sc->energy_up)
+            tmp_en -= sc->energy_up[ii][1];
+          if (sc->f)
+            tmp_en -= sc->f(ii, jj, ii + 1, jj, VRNA_DECOMP_ML_STEM, sc->data);
+        }
+        type = (unsigned char)ptype[ij + 1];
+
+        if (type == 0)
+          type = 7;
+
+        if (tmp_en == my_c[ij + 1] + E_MLstem(type, S1[ii], -1, P) + P->MLbase) {
+          *i          = *j = -1;
+          *k          = ii + 1;
+          *l          = jj;
+          *component2 = 2;
+          return 1;
+        }
+      }
+
+      if (evaluate(ii, jj, ii, jj - 1, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+        int tmp_en = fij;
+        if (sc) {
+          if (sc->energy_up)
+            tmp_en -= sc->energy_up[jj][1];
+          if (sc->f)
+            tmp_en -= sc->f(ii, jj, ii, jj - 1, VRNA_DECOMP_ML_STEM, sc->data);
+        }
+        type = (unsigned char)ptype[idx[jj - 1] + ii];
+
+        if (type == 0)
+          type = 7;
+
+        if (tmp_en == my_c[idx[jj - 1] + ii] + E_MLstem(type, -1, S1[jj], P) + P->MLbase) {
+          *i          = *j = -1;
+          *k          = ii;
+          *l          = jj - 1;
+          *component2 = 2;
+          return 1;
+        }
+      }
+
+      if (evaluate(ii, jj, ii + 1, jj - 1, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+        int tmp_en = fij;
+        if (sc) {
+          if (sc->energy_up)
+            tmp_en -= sc->energy_up[ii][1] + sc->energy_up[jj][1];
+          if (sc->f)
+            tmp_en -= sc->f(ii, jj, ii + 1, jj - 1, VRNA_DECOMP_ML_STEM, sc->data);
+        }
+        type = (unsigned char)ptype[idx[jj - 1] + ii + 1];
+
+        if (type == 0)
+          type = 7;
+
+        if (tmp_en == my_c[idx[jj - 1] + ii + 1] + E_MLstem(type, S1[ii], S1[jj], P) + 2 * P->MLbase) {
+          *i          = *j = -1;
+          *k          = ii + 1;
+          *l          = jj - 1;
+          *component2 = 2;
+          return 1;
+        }
+      }
+
+      break;
+  }
+
+  /* 2. Test for possible split point */
+  for (u = ii + 1 + turn; u <= jj - 2 - turn; u++) {
+    en = my_fML[idx[u] + ii] + my_fML[idx[jj] + u + 1];
+    if (sc)
+      if (sc->f)
+        en += sc->f(ii, jj, u, u + 1, VRNA_DECOMP_ML_ML_ML, sc->data);
+    if (fij == en) {
+      *i  = ii;
+      *j  = u;
+      *k  = u + 1;
+      *l  = jj;
+      return 1;
+    }
+  }
+
+  /* 3. last chance! Maybe coax stack */
+  if (dangle_model == 3) {
+    int ik, k1j, tmp_en;
+    for (k1j = idx[jj] + ii + turn + 2, u = ii + 1 + turn; u <= jj - 2 - turn; u++, k1j++) {
+      ik = idx[u] + ii;
+      if (evaluate(ii, u, u + 1, jj, VRNA_DECOMP_ML_COAXIAL_ENC, &hc_dat_local)) {
+        type    = rtype[(unsigned char)ptype[ik]];
+        type_2  = rtype[(unsigned char)ptype[k1j]];
+
+        if (type == 0)
+          type = 7;
+        if (type_2 == 0)
+          type_2 = 7;
+
+        tmp_en = my_c[ik] + my_c[k1j] + P->stack[type][type_2] + 2 * P->MLintern[1];
+        if (sc)
+          if (sc->f)
+            tmp_en += sc->f(ii, u, u + 1, jj, VRNA_DECOMP_ML_COAXIAL, sc->data);
+        if (fij == tmp_en) {
+          *i          = ii;
+          *j          = u;
+          *k          = u + 1;
+          *l          = jj;
+          *component1 = *component2 = 2;
+          return 1;
+        }
+      }
+    }
+  }
+
+  return 0;
+}
+
+
+PUBLIC int
+vrna_BT_mb_loop(vrna_fold_compound_t  *vc,
+                int                   *i,
+                int                   *j,
+                int                   *k,
+                int                   en,
+                int                   *component1,
+                int                   *component2)
+{
+  unsigned char             type, type_2, tt;
+  char                      *ptype;
+  short                     s5, s3, *S1;
+  unsigned int              *sn;
+  int                       ij, p, q, r, e, tmp_en, cp, *idx, turn, dangle_model,
+                            *my_c, *my_fML, *my_fc, *rtype;
+  vrna_param_t              *P;
+  vrna_md_t                 *md;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  cp            = vc->cutpoint;
+  idx           = vc->jindx;
+  ij            = idx[*j] + *i;
+  S1            = vc->sequence_encoding;
+  P             = vc->params;
+  md            = &(P->model_details);
+  sn            = vc->strand_number;
+  hc            = vc->hc;
+  sc            = vc->sc;
+  my_c          = vc->matrices->c;
+  my_fML        = vc->matrices->fML;
+  my_fc         = vc->matrices->fc;
+  turn          = md->min_loop_size;
+  ptype         = vc->ptype;
+  rtype         = &(md->rtype[0]);
+  type          = (unsigned char)ptype[ij];
+  tt            = type;
+  type          = rtype[type];
+  dangle_model  = md->dangles;
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ml;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  p = *i + 1;
+  q = *j - 1;
+
+  r = q - turn - 1;
+
+  if (evaluate(*i, *j, p, q, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+    if (type == 0)
+      type = 7;
+    if (tt == 0)
+      tt = 7;
+
+    /* is it a fake multi-loop? */
+    /* NOTE: do we really want to evaluate it hard-constraint-wise as a multibranch loop? */
+    if (sn[*i] != sn[*j]) {
+      int ii, jj;
+      ii  = jj = 0;
+      e   = my_fc[p] + my_fc[q];
+      if (sc)
+        if (sc->energy_bp)
+          e += sc->energy_bp[ij];
+      s5  = (sn[q] == sn[*j]) ? S1[q] : -1;
+      s3  = (sn[*i] == sn[p]) ? S1[p] : -1;
+
+      switch (dangle_model) {
+        case 0:
+          if (en == e + E_ExtLoop(type, -1, -1, P))
+            ii = p, jj = q;
+          break;
+
+        case 2:
+          if (en == e + E_ExtLoop(type, s5, s3, P))
+            ii = p, jj = q;
+          break;
+
+        default:
+          if (en == e + E_ExtLoop(type, -1, -1, P)) {
+            ii = p, jj = q;
+            break;
+          }
+          if (hc->up_ext[p]) {
+            e = my_fc[p + 1] + my_fc[q];
+            if (sc) {
+              if (sc->energy_up)
+                e += sc->energy_up[p][1];
+              if (sc->energy_bp)
+                e += sc->energy_bp[ij];
+            }
+            if (en == e + E_ExtLoop(type, -1, s3, P)) {
+              ii = p + 1; jj = q;
+              break;
+            }
+          }
+          if (hc->up_ext[q]) {
+            e = my_fc[p] + my_fc[q - 1];
+            if (sc) {
+              if (sc->energy_up)
+                e += sc->energy_up[q][1];
+              if (sc->energy_bp)
+                e += sc->energy_bp[ij];
+            }
+            if (en == e + E_ExtLoop(type, s5, -1, P)) {
+              ii = p; jj = q - 1;
+              break;
+            }
+          }
+          if ((hc->up_ext[q]) && (hc->up_ext[p])) {
+            e = my_fc[p + 1] + my_fc[q - 1];
+            if (sc) {
+              if (sc->energy_up)
+                e += sc->energy_up[p][1] + sc->energy_up[q][1];
+              if (sc->energy_bp)
+                e += sc->energy_bp[ij];
+            }
+            if (en == e + E_ExtLoop(type, s5, s3, P)) {
+              ii = p + 1; jj = q - 1;
+              break;
+            }
+          }
+          break;
+      }
+
+      if (ii) {
+        /* found a decomposition */
+        *component1 = 3;
+        *i          = ii;
+        *k          = cp - 1;
+        *j          = jj;
+        *component2 = 4;
+        return 1;
+      }
+    }
+
+    /* true multi loop? */
+    *component1 = *component2 = 1;  /* both components are MB loop parts by default */
+
+    s5  = (sn[q] == sn[*j]) ? S1[q] : -1;
+    s3  = (sn[*i] == sn[p]) ? S1[p] : -1;
+
+    switch (dangle_model) {
+      case 0:
+        e = en - E_MLstem(type, -1, -1, P) - P->MLclosing;
+        if (sc) {
+          if (sc->energy_bp)
+            e -= sc->energy_bp[ij];
+          if (sc->f)
+            e -= sc->f(*i, *j, p, q, VRNA_DECOMP_PAIR_ML, sc->data);
+        }
+        for (r = *i + 2 + turn; r < *j - 2 - turn; ++r) {
+          if (evaluate(p, q, r, r + 1, VRNA_DECOMP_ML_ML_ML, &hc_dat_local)) {
+            tmp_en = my_fML[idx[r] + p] + my_fML[idx[q] + r + 1];
+            if (sc)
+              if (sc->f)
+                tmp_en += sc->f(p, q, r, r + 1, VRNA_DECOMP_ML_ML_ML, sc->data);
+            if (e == tmp_en)
+              break;
+          }
+        }
+        break;
+
+      case 2:
+        e = en - E_MLstem(type, s5, s3, P) - P->MLclosing;
+        if (sc) {
+          if (sc->energy_bp)
+            e -= sc->energy_bp[ij];
+          if (sc->f)
+            e -= sc->f(*i, *j, p, q, VRNA_DECOMP_PAIR_ML, sc->data);
+        }
+        for (r = p + turn + 1; r < q - turn - 1; ++r) {
+          if (evaluate(p, q, r, r + 1, VRNA_DECOMP_ML_ML_ML, &hc_dat_local)) {
+            tmp_en = my_fML[idx[r] + p] + my_fML[idx[q] + r + 1];
+            if (sc)
+              if (sc->f)
+                tmp_en += sc->f(p, q, r, r + 1, VRNA_DECOMP_ML_ML_ML, sc->data);
+            if (e == tmp_en)
+              break;
+          }
+        }
+        break;
+
+      default:
+        e = en - P->MLclosing;
+        if (sc)
+          if (sc->energy_bp)
+            e -= sc->energy_bp[ij];
+        for (r = p + turn + 1; r < q - turn - 1; ++r) {
+          if (evaluate(p, q, r, r + 1, VRNA_DECOMP_ML_ML_ML, &hc_dat_local)) {
+            tmp_en = my_fML[idx[r] + p] + my_fML[idx[q] + r + 1] + E_MLstem(type, -1, -1, P);
+            if (sc) {
+              if (sc->f) {
+                tmp_en  += sc->f(*i, *j, p, q, VRNA_DECOMP_PAIR_ML, sc->data);
+                tmp_en  += sc->f(p, q, r, r + 1, VRNA_DECOMP_ML_ML_ML, sc->data);
+              }
+            }
+            if (e == tmp_en)
+              break;
+          }
+
+          if (evaluate(*i, *j, p + 1, q, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+            if (evaluate(p + 1, q, r, r + 1, VRNA_DECOMP_ML_ML_ML, &hc_dat_local)) {
+              tmp_en = e;
+              if (sc) {
+                if (sc->energy_up)
+                  tmp_en -= sc->energy_up[p][1];
+                if (sc->f) {
+                  tmp_en  -= sc->f(*i, *j, p + 1, q, VRNA_DECOMP_PAIR_ML, sc->data);
+                  tmp_en  -= sc->f(p + 1, q, r, r + 1, VRNA_DECOMP_ML_ML_ML, sc->data);
+                }
+              }
+              if (tmp_en == my_fML[idx[r] + p + 1] + my_fML[idx[q] + r + 1] + E_MLstem(type, -1, s3, P) + P->MLbase) {
+                p += 1;
+                break;
+              }
+            }
+          }
+
+          if (evaluate(*i, *j, p, q - 1, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+            if (evaluate(p, q - 1, r, r + 1, VRNA_DECOMP_ML_ML_ML, &hc_dat_local)) {
+              tmp_en = e;
+              if (sc) {
+                if (sc->energy_up)
+                  tmp_en -= sc->energy_up[q][1];
+                if (sc->f) {
+                  tmp_en  -= sc->f(*i, *j, p, q - 1, VRNA_DECOMP_PAIR_ML, sc->data);
+                  tmp_en  -= sc->f(p, q - 1, r, r + 1, VRNA_DECOMP_ML_ML_ML, sc->data);
+                }
+              }
+              if (tmp_en == my_fML[idx[r] + p] + my_fML[idx[q - 1] + r + 1] + E_MLstem(type, s5, -1, P) + P->MLbase) {
+                q -= 1;
+                break;
+              }
+            }
+          }
+
+          if (evaluate(*i, *j, p + 1, q - 1, VRNA_DECOMP_PAIR_ML, &hc_dat_local)) {
+            if (evaluate(p + 1, q - 1, r, r + 1, VRNA_DECOMP_ML_ML_ML, &hc_dat_local)) {
+              tmp_en = e;
+              if (sc) {
+                if (sc->energy_up)
+                  tmp_en -= sc->energy_up[p][1] + sc->energy_up[q][1];
+                if (sc->f) {
+                  tmp_en  -= sc->f(*i, *j, p + 1, q - 1, VRNA_DECOMP_PAIR_ML, sc->data);
+                  tmp_en  -= sc->f(p + 1, q - 1, r, r + 1, VRNA_DECOMP_ML_ML_ML, sc->data);
+                }
+              }
+              if (tmp_en == my_fML[idx[r] + p + 1] + my_fML[idx[q - 1] + r + 1] + E_MLstem(type, s5, s3, P) + 2 * P->MLbase) {
+                p += 1;
+                q -= 1;
+                break;
+              }
+            }
+          }
+
+          /* coaxial stacking of (i.j) with (i+1.r) or (r.j-1) */
+          /* use MLintern[1] since coax stacked pairs don't get TerminalAU */
+          if (dangle_model == 3) {
+            tmp_en = e;
+            if (evaluate(*i, *j, p, r, VRNA_DECOMP_ML_COAXIAL, &hc_dat_local)) {
+              type_2 = rtype[(unsigned char)ptype[idx[r] + p]];
+
+              if (type_2 == 0)
+                type_2 = 7;
+
+              tmp_en = my_c[idx[r] + p] + P->stack[tt][type_2] + my_fML[idx[q] + r + 1];
+              if (sc) {
+                if (sc->f) {
+                  tmp_en  += sc->f(*i, *j, p, q, VRNA_DECOMP_PAIR_ML, sc->data);
+                  tmp_en  += sc->f(*i, *j, p, r, VRNA_DECOMP_ML_COAXIAL, sc->data);
+                }
+              }
+              if (e == tmp_en + 2 * P->MLintern[1]) {
+                *component1 = 2;
+                break;
+              }
+            }
+
+            if (evaluate(*i, *j, r + 1, q, VRNA_DECOMP_ML_COAXIAL, &hc_dat_local)) {
+              type_2 = rtype[(unsigned char)ptype[idx[q] + r + 1]];
+
+              if (type_2 == 0)
+                type_2 = 7;
+
+              tmp_en = my_c[idx[q] + r + 1] + P->stack[tt][type_2] + my_fML[idx[r] + p];
+              if (sc) {
+                if (sc->f) {
+                  tmp_en  += sc->f(*i, *j, p, q, VRNA_DECOMP_PAIR_ML, sc->data);
+                  tmp_en  += sc->f(*i, *j, r + 1, q, VRNA_DECOMP_ML_COAXIAL, sc->data);
+                }
+              }
+              if (e == tmp_en + 2 * P->MLintern[1]) {
+                *component2 = 2;
+                break;
+              }
+            }
+          }
+        }
+        break;
+    }
+  }
+
+  if (r <= *j - turn - 3) {
+    *i  = p;
+    *k  = r;
+    *j  = q;
+    return 1;
+  } else {
+#if 0
+    /* Y shaped ML loops fon't work yet */
+    if (dangle_model == 3) {
+      d5  = P->dangle5[tt][S1[j - 1]];
+      d3  = P->dangle3[tt][S1[i + 1]];
+      /* (i,j) must close a Y shaped ML loop with coax stacking */
+      if (cij == fML[indx[j - 2] + i + 2] + mm + d3 + d5 + P->MLbase + P->MLbase) {
+        i1  = i + 2;
+        j1  = j - 2;
+      } else if (cij == fML[indx[j - 2] + i + 1] + mm + d5 + P->MLbase) {
+        j1 = j - 2;
+      } else if (cij == fML[indx[j - 1] + i + 2] + mm + d3 + P->MLbase) {
+        i1 = i + 2;
+      } else /* last chance */
+      if (cij != fML[indx[j - 1] + i + 1] + mm + P->MLbase) {
+        fprintf(stderr, "backtracking failed in repeat");
+      }
+      /* if we arrive here we can express cij via fML[i1,j1]+dangles */
+      bt_stack[++s].i = i1;
+      bt_stack[s].j   = j1;
+    }
+#endif
+  }
+
+  return 0;
+}
+
+
+PUBLIC vrna_mx_pf_aux_ml_t *
+vrna_exp_E_ml_fast_init(vrna_fold_compound_t *vc)
+{
+  vrna_mx_pf_aux_ml_t *aux_mx = NULL;
+
+  if (vc) {
+    int         i, j, d, n, u, turn, ij, *iidx;
+    FLT_OR_DBL  *qm;
+
+    n     = (int)vc->length;
+    iidx  = vc->iindx;
+    turn  = vc->exp_params->model_details.min_loop_size;
+    qm    = vc->exp_matrices->qm;
+
+    /* allocate memory for helper arrays */
+    aux_mx            = (vrna_mx_pf_aux_ml_t *)vrna_alloc(sizeof(vrna_mx_pf_aux_ml_t));
+    aux_mx->qqm       = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 2));
+    aux_mx->qqm1      = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 2));
+    aux_mx->qqmu_size = 0;
+    aux_mx->qqmu      = NULL;
+
+    if (vc->type == VRNA_FC_TYPE_SINGLE) {
+      vrna_ud_t *domains_up = vc->domains_up;
+      int       with_ud     = (domains_up && domains_up->exp_energy_cb);
+      int       ud_max_size = 0;
+
+      /* pre-processing ligand binding production rule(s) and auxiliary memory */
+      if (with_ud) {
+        for (u = 0; u < domains_up->uniq_motif_count; u++)
+          if (ud_max_size < domains_up->uniq_motif_size[u])
+            ud_max_size = domains_up->uniq_motif_size[u];
+
+        aux_mx->qqmu_size = ud_max_size;
+        aux_mx->qqmu      = (FLT_OR_DBL **)vrna_alloc(sizeof(FLT_OR_DBL *) * (ud_max_size + 1));
+        for (u = 0; u <= ud_max_size; u++)
+          aux_mx->qqmu[u] = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n + 2));
+      }
+    }
+
+    for (d = 0; d <= turn; d++)
+      for (i = 1; i <= n - d; i++) {
+        j   = i + d;
+        ij  = iidx[i] - j;
+
+        if (j > n)
+          continue;
+
+        qm[ij] = 0.;
+      }
+  }
+
+  return aux_mx;
+}
+
+
+PUBLIC void
+vrna_exp_E_ml_fast_rotate(vrna_fold_compound_t  *vc,
+                          vrna_mx_pf_aux_ml_t   *aux_mx)
+{
+  if (vc && aux_mx) {
+    int         u;
+    FLT_OR_DBL  *tmp;
+
+    tmp           = aux_mx->qqm1;
+    aux_mx->qqm1  = aux_mx->qqm;
+    aux_mx->qqm   = tmp;
+
+    /* rotate auxiliary arrays for unstructured domains */
+    if (aux_mx->qqmu) {
+      tmp = aux_mx->qqmu[aux_mx->qqmu_size];
+      for (u = aux_mx->qqmu_size; u > 0; u--)
+        aux_mx->qqmu[u] = aux_mx->qqmu[u - 1];
+      aux_mx->qqmu[0] = tmp;
+    }
+  }
+}
+
+
+PUBLIC void
+vrna_exp_E_ml_fast_free(vrna_fold_compound_t  *vc,
+                        vrna_mx_pf_aux_ml_t   *aux_mx)
+{
+  if (vc && aux_mx) {
+    int u;
+
+    free(aux_mx->qqm);
+    free(aux_mx->qqm1);
+
+    if (aux_mx->qqmu) {
+      for (u = 0; u <= aux_mx->qqmu_size; u++)
+        free(aux_mx->qqmu[u]);
+
+      free(aux_mx->qqmu);
+    }
+
+    free(aux_mx);
+  }
+}
+
+
+PUBLIC FLT_OR_DBL
+vrna_exp_E_ml_fast(vrna_fold_compound_t *vc,
+                   int                  i,
+                   int                  j,
+                   vrna_mx_pf_aux_ml_t  *aux_mx)
+{
+  if (vc) {
+    switch (vc->type) {
+      case VRNA_FC_TYPE_SINGLE:
+        return exp_E_ml_fast(vc, i, j, aux_mx);
+        break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:
+        return exp_E_ml_fast_comparative(vc, i, j, aux_mx);
+        break;
+
+      default:
+        vrna_message_warning("vrna_exp_E_ml_fast@multibranch_loops.c: Unknown fold_compound type");
+        return 0.;
+        break;
+    }
+  } else {
+    return 0.;
+  }
+}
+
+
+PRIVATE FLT_OR_DBL
+exp_E_ml_fast(vrna_fold_compound_t  *vc,
+              int                   i,
+              int                   j,
+              vrna_mx_pf_aux_ml_t   *aux_mx)
+{
+  short                     *S1;
+  unsigned char             type;
+  int                       n, *iidx, k, ij, kl, maxk, ii, with_ud, u, circular, with_gquad, *hc_up_ml;
+  FLT_OR_DBL                qbt1, temp, *qm, *qb, *qqm, *qqm1, **qqmu, q_temp, q_temp2, *G, *expMLbase,
+                            expMLstem;
+  vrna_md_t                 *md;
+  vrna_exp_param_t          *pf_params;
+  vrna_ud_t                 *domains_up;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 *sc;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  n                   = (int)vc->length;
+  iidx                = vc->iindx;
+  ij                  = iidx[i] - j;
+  qqm                 = aux_mx->qqm;
+  qqm1                = aux_mx->qqm1;
+  qqmu                = aux_mx->qqmu;
+  qm                  = vc->exp_matrices->qm;
+  qb                  = vc->exp_matrices->qb;
+  G                   = vc->exp_matrices->G;
+  expMLbase           = vc->exp_matrices->expMLbase;
+  pf_params           = vc->exp_params;
+  md                  = &(pf_params->model_details);
+  hc                  = vc->hc;
+  sc                  = vc->sc;
+  domains_up          = vc->domains_up;
+  circular            = md->circ;
+  with_gquad          = md->gquad;
+  with_ud             = (domains_up && domains_up->exp_energy_cb);
+  hc_up_ml            = hc->up_ml;
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ml;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  qbt1    = 0;
+  q_temp  = 0.;
+
+  qqm[i] = 0.;
+
+  if (with_ud)
+    qqmu[0][i] = 0.;
+
+  if (with_gquad)
+    expMLstem = exp_E_MLstem(0, -1, -1, pf_params);
+
+  if (evaluate(i, j, i, j - 1, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+    q_temp = qqm1[i] * expMLbase[1];
+
+    if (sc) {
+      if (sc->exp_energy_up)
+        q_temp *= sc->exp_energy_up[j][1];
+
+      if (sc->exp_f)
+        q_temp *= sc->exp_f(i, j, i, j - 1, VRNA_DECOMP_ML_ML, sc->data);
+    }
+
+    if (with_ud) {
+      int cnt;
+      for (cnt = 0; cnt < domains_up->uniq_motif_count; cnt++) {
+        u = domains_up->uniq_motif_size[cnt];
+        if (j - u >= i) {
+          if (evaluate(i, j, i, j - u, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+            q_temp2 = qqmu[u][i]
+                      * domains_up->exp_energy_cb(vc,
+                                                  j - u + 1, j,
+                                                  VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MOTIF,
+                                                  domains_up->data)
+                      * expMLbase[u];
+
+            if (sc) {
+              if (sc->exp_energy_up)
+                q_temp2 *= sc->exp_energy_up[j - u + 1][u];
+              if (sc->exp_f)
+                q_temp2 *= sc->exp_f(i, j, i, j - 1, VRNA_DECOMP_ML_ML, sc->data);
+            }
+            q_temp += q_temp2;
+          }
+        }
+      }
+      qqmu[0][i] += q_temp;
+    }
+
+    qqm[i] += q_temp;
+  }
+
+  if (evaluate(i, j, i, j, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+    S1    = vc->sequence_encoding;
+    type  = md->pair[S1[i]][S1[j]];
+    if (type == 0)
+      type = 7;
+
+    qbt1 = qb[ij] * exp_E_MLstem(type, ((i > 1) || circular) ? S1[i - 1] : -1, ((j < n) || circular) ? S1[j + 1] : -1, pf_params);
+    if (sc)
+      if (sc->exp_f)
+        qbt1 *= sc->exp_f(i, j, i, j, VRNA_DECOMP_ML_STEM, sc->data);
+
+    qqm[i] += qbt1;
+
+    if (with_ud)
+      qqmu[0][i] += qbt1;
+  }
+
+  if (with_gquad) {
+    /*include gquads into qqm*/
+    qqm[i] += G[ij] * expMLstem;
+
+    if (with_ud)
+      qqmu[0][i] += G[ij] * expMLstem;
+  }
+
+  /*
+   *  construction of qm matrix containing multiple loop
+   *  partition function contributions from segment i,j
+   */
+  temp  = 0.0;
+  kl    = iidx[i] - j + 1; /* ii-k=[i,k-1] */
+  if (sc && sc->exp_f) {
+    for (k = j; k > i; k--, kl++) {
+      q_temp  = qm[kl] * qqm[k];
+      q_temp  *= sc->exp_f(i, j, k - 1, k, VRNA_DECOMP_ML_ML_ML, sc->data);
+      temp    += q_temp;
+    }
+  } else {
+    for (k = j; k > i; k--, kl++)
+      temp += qm[kl] * qqm[k];
+  }
+
+  maxk  = MIN2(i + hc_up_ml[i], j);
+  ii    = maxk - i; /* length of unpaired stretch */
+  if (with_ud) {
+    if (sc) {
+      for (k = maxk; k > i; k--, ii--) {
+        q_temp = expMLbase[ii]
+                 * qqm[k];
+
+        if (sc->exp_energy_up)
+          q_temp *= sc->exp_energy_up[i][ii];
+
+        if (sc->exp_f)
+          q_temp *= sc->exp_f(i, j, k, j, VRNA_DECOMP_ML_ML, sc->data);
+
+        temp  += q_temp;
+        temp  += q_temp
+                 * domains_up->exp_energy_cb(vc,
+                                             i, k - 1,
+                                             VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP,
+                                             domains_up->data);
+      }
+    } else {
+      for (k = maxk; k > i; k--, ii--) {
+        q_temp = expMLbase[ii]
+                 * qqm[k];
+
+        temp  += q_temp;
+        temp  += q_temp
+                 * domains_up->exp_energy_cb(vc,
+                                             i, k - 1,
+                                             VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP,
+                                             domains_up->data);
+      }
+    }
+  } else {
+    if (sc) {
+      for (k = maxk; k > i; k--, ii--) {
+        q_temp = expMLbase[ii] * qqm[k];
+        if (sc->exp_energy_up)
+          q_temp *= sc->exp_energy_up[i][ii];
+
+        if (sc->exp_f)
+          q_temp *= sc->exp_f(i, j, k, j, VRNA_DECOMP_ML_ML, sc->data);
+
+        temp += q_temp;
+      }
+    } else {
+      for (k = maxk; k > i; k--, ii--)
+        temp += expMLbase[ii] * qqm[k];
+    }
+  }
+
+  return temp + qqm[i];
+}
+
+
+PRIVATE FLT_OR_DBL
+exp_E_ml_fast_comparative(vrna_fold_compound_t  *vc,
+                          int                   i,
+                          int                   j,
+                          vrna_mx_pf_aux_ml_t   *aux_mx)
+{
+  unsigned char             type;
+  unsigned short            **a2s;
+  short                     **S, **S5, **S3;
+  int                       n, s, n_seq, *iidx, k, ij, kl, maxk, ii, circular, *hc_up_ml;
+  FLT_OR_DBL                qbt1, temp, *qm, *qb, *qqm, *qqm1, q_temp, *expMLbase;
+  vrna_md_t                 *md;
+  vrna_exp_param_t          *pf_params;
+  vrna_hc_t                 *hc;
+  vrna_sc_t                 **scs;
+  vrna_callback_hc_evaluate *evaluate;
+  struct default_data       hc_dat_local;
+
+  n         = (int)vc->length;
+  n_seq     = vc->n_seq;
+  iidx      = vc->iindx;
+  ij        = iidx[i] - j;
+  S         = vc->S;
+  S5        = vc->S5;               /* S5[s][i] holds next base 5' of i in sequence s */
+  S3        = vc->S3;               /* Sl[s][i] holds next base 3' of i in sequence s */
+  a2s       = vc->a2s;
+  qqm       = aux_mx->qqm;
+  qqm1      = aux_mx->qqm1;
+  qm        = vc->exp_matrices->qm;
+  qb        = vc->exp_matrices->qb;
+  expMLbase = vc->exp_matrices->expMLbase;
+  pf_params = vc->exp_params;
+  md        = &(pf_params->model_details);
+  hc        = vc->hc;
+  scs       = vc->scs;
+  circular  = md->circ;
+  hc_up_ml  = hc->up_ml;
+
+  hc_dat_local.idx    = vc->jindx;
+  hc_dat_local.mx     = hc->matrix;
+  hc_dat_local.hc_up  = hc->up_ml;
+  hc_dat_local.cp     = vc->cutpoint;
+
+  if (hc->f) {
+    evaluate            = &hc_default_user;
+    hc_dat_local.hc_f   = hc->f;
+    hc_dat_local.hc_dat = hc->data;
+  } else {
+    evaluate = &hc_default;
+  }
+
+  qbt1    = 0;
+  q_temp  = 0.;
+
+  qqm[i] = 0.;
+
+
+  if (evaluate(i, j, i, j - 1, VRNA_DECOMP_ML_ML, &hc_dat_local)) {
+    q_temp = qqm1[i] * expMLbase[1];
+
+    if (scs) {
+      for (s = 0; s < n_seq; s++) {
+        if (scs[s])
+          if (scs[s]->exp_energy_up)
+            q_temp *= scs[s]->exp_energy_up[a2s[s][j]][1];
+      }
+    }
+
+    qqm[i] += q_temp;
+  }
+
+  if (evaluate(i, j, i, j, VRNA_DECOMP_ML_STEM, &hc_dat_local)) {
+    q_temp = qb[ij];
+
+    for (s = 0; s < n_seq; s++) {
+      type = md->pair[S[s][i]][S[s][j]];
+      if (type == 0)
+        type = 7;
+
+      q_temp *= exp_E_MLstem(type, ((i > 1) || circular) ? S5[s][i] : -1, ((j < n) || circular) ? S3[s][j] : -1, pf_params);
+    }
+
+    qqm[i] += q_temp;
+  }
+
+
+  /*
+   *  construction of qm matrix containing multiple loop
+   *  partition function contributions from segment i,j
+   */
+  temp  = 0.0;
+  kl    = iidx[i] - j + 1; /* ii-k=[i,k-1] */
+  for (k = j; k > i; k--, kl++)
+    temp += qm[kl] * qqm[k];
+
+  maxk  = MIN2(i + hc_up_ml[i], j);
+  ii    = maxk - i; /* length of unpaired stretch */
+
+  if (scs) {
+    for (k = maxk; k > i; k--, ii--) {
+      q_temp = expMLbase[ii] * qqm[k];
+      for (s = 0; s < n_seq; s++) {
+        if (scs[s])
+          if (scs[s]->exp_energy_up)
+            q_temp *= scs[s]->exp_energy_up[a2s[s][i]][a2s[s][k] - a2s[s][i]];
+      }
+      temp += q_temp;
+    }
+  } else {
+    for (k = maxk; k > i; k--, ii--)
+      temp += expMLbase[ii] * qqm[k];
+  }
+
+  return temp + qqm[i];
+}
+
+
+PRIVATE char
+hc_default(int  i,
+           int  j,
+           int  k,
+           int  l,
+           char d,
+           void *data)
+{
+  int                 ij, kl, di, dj, u;
+  char                eval;
+  struct default_data *dat = (struct default_data *)data;
+
+  eval  = (char)0;
+  di    = k - i;
+  dj    = j - l;
+
+  switch (d) {
+    case VRNA_DECOMP_ML_ML_ML:
+      u     = l - k - 1;
+      eval  = (char)1;
+      if ((u != 0) && (dat->hc_up[k + 1] < u))
+        eval = (char)0;
+      break;
+
+    case VRNA_DECOMP_ML_ML:
+      eval = (char)1;
+      if ((di != 0) && (dat->hc_up[i] < di))
+        eval = (char)0;
+      if ((dj != 0) && (dat->hc_up[l + 1] < dj))
+        eval = (char)0;
+      break;
+
+    case VRNA_DECOMP_ML_STEM:
+      kl = dat->idx[l] + k;
+      if (dat->mx[kl] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC) {
+        eval = (char)1;
+        if ((di != 0) && (dat->hc_up[i] < di))
+          eval = (char)0;
+        if ((dj != 0) && (dat->hc_up[l + 1] < dj))
+          eval = (char)0;
+      }
+      break;
+
+    case VRNA_DECOMP_PAIR_ML:
+      ij = dat->idx[j] + i;
+      if (dat->mx[ij] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP) {
+        eval = (char)1;
+        di--; dj--;
+        if ((di != 0) && (dat->hc_up[i + 1] < di))
+          eval = (char)0;
+        if ((dj != 0) && (dat->hc_up[l + 1] < dj))
+          eval = (char)0;
+      }
+      break;
+
+    case VRNA_DECOMP_ML_COAXIAL:
+      kl = dat->idx[l] + k;
+      if (dat->mx[kl] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC)
+        eval = (char)1;
+      break;
+
+    case VRNA_DECOMP_ML_COAXIAL_ENC:
+      ij  = dat->idx[j] + i;
+      kl  = dat->idx[l] + k;
+      if ((dat->mx[ij] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC) && (dat->mx[kl] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC))
+        eval = (char)1;
+      break;
+
+    default:
+      nrerror("wtf");
+  }
+
+  return eval;
+}
+
+
+PRIVATE char
+hc_default_user(int   i,
+                int   j,
+                int   k,
+                int   l,
+                char  d,
+                void  *data)
+{
+  char                eval;
+  struct default_data *dat = (struct default_data *)data;
+
+  eval  = hc_default(i, j, k, l, d, data);
+  eval  = (dat->hc_f(i, j, k, l, d, dat->hc_dat)) ? eval : (char)0;
+
+  return eval;
+}
diff --git a/C/ViennaRNA/multibranch_loops.h b/C/ViennaRNA/multibranch_loops.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/multibranch_loops.h
@@ -0,0 +1,252 @@
+#ifndef VIENNA_RNA_PACKAGE_MULTIBRANCH_LOOPS_H
+#define VIENNA_RNA_PACKAGE_MULTIBRANCH_LOOPS_H
+
+#include <ViennaRNA/utils.h>
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+
+#ifdef __GNUC__
+# define INLINE inline
+#else
+# define INLINE
+#endif
+
+/**
+ *  @file     multibranch_loops.h
+ *  @ingroup  loops
+ *  @brief    Energy evaluation of multibranch loops for MFE and partition function calculations
+ */
+
+/**
+ *  @{
+ *  @ingroup  loops
+ *
+ */
+
+/**
+ *  @brief  Auxiliary helper arrays for fast exterior loop computations
+ *
+ *  @see vrna_exp_E_ml_fast_init(), vrna_exp_E_ml_fast_rotate(),
+ *  vrna_exp_E_ml_fast_free(), vrna_exp_E_ml_fast()
+ */
+typedef struct {
+  FLT_OR_DBL  *qqm;
+  FLT_OR_DBL  *qqm1;
+
+  int         qqmu_size;
+  FLT_OR_DBL  **qqmu;
+} vrna_mx_pf_aux_ml_t;
+
+
+/**
+ *  @def E_MLstem(A,B,C,D)
+ *  <H2>Compute the Energy contribution of a Multiloop stem</H2>
+ *  This definition is a wrapper for the E_Stem() funtion.
+ *  It is substituted by an E_Stem() funtion call with argument
+ *  extLoop=0, so the energy contribution returned reflects a
+ *  stem introduced in a multiloop.<BR>
+ *  As for the parameters B (si1) and C (sj1) of the substituted
+ *  E_Stem() function, you can inhibit to take 5'-, 3'-dangles
+ *  or mismatch contributions to be taken into account by passing
+ *  -1 to these parameters.
+ * 
+ *  @see    E_Stem()
+ *  @param  A The pair type of the stem-closing pair
+ *  @param  B The 5'-mismatching nucleotide
+ *  @param  C The 3'-mismatching nucleotide
+ *  @param  D The datastructure containing scaled energy parameters
+ *  @return   The energy contribution of the introduced multiloop stem
+ */
+PRIVATE INLINE int E_MLstem( int type,
+                              int si1,
+                              int sj1,
+                              vrna_param_t *P);
+
+/**
+ *  @def exp_E_MLstem(A,B,C,D)
+ *  This is the partition function variant of @ref E_MLstem()
+ *  @see E_MLstem()
+ *  @return The Boltzmann weighted energy contribution of the introduced multiloop stem
+ */
+PRIVATE INLINE FLT_OR_DBL exp_E_MLstem(int type,
+                                    int si1,
+                                    int sj1,
+                                    vrna_exp_param_t *P);
+
+
+
+/**
+ *  @brief Evaluate energy of a multi branch helices stacking onto closing pair (i,j)
+ *
+ *  Computes total free energy for coaxial stacking of (i.j) with (i+1.k) or (k+1.j-1)
+ */
+int E_mb_loop_stack(int i, int j, vrna_fold_compound_t *vc);
+
+/**
+ *  @brief  Backtrack the decomposition of a multi branch loop closed by @f$ (i,j) @f$
+ *
+ *  @param    vc          The #vrna_fold_compound_t filled with all relevant data for backtracking
+ *  @param    i           5' position of base pair closing the loop (will be set to 5' position
+ *                        of leftmost decomposed block upon successful backtracking)
+ *  @param    j           3' position of base pair closing the loop (will be set to 3' position
+ *                        of rightmost decomposed block upon successful backtracking)
+ *  @param    k           Split position that delimits leftmost from rightmost block, [i,k] and
+ *                        [k+1, j], respectively. (Will be set upon successful backtracking)
+ *  @param    en          The energy contribution of the substructure enclosed by @f$ (i,j) @f$
+ *  @param    component1  Type of leftmost block (1 = ML, 2 = C)
+ *  @param    component2  Type of rightmost block (1 = ML, 2 = C)
+ *  @returns              1, if backtracking succeeded, 0 otherwise.
+ */
+int
+vrna_BT_mb_loop(vrna_fold_compound_t *vc,
+                int *i,
+                int *j,
+                int *k,
+                int en,
+                int *component1,
+                int *component2);
+
+int
+vrna_E_mb_loop_fast(vrna_fold_compound_t *vc,
+                    int i,
+                    int j,
+                    int *dmli1,
+                    int *dmli2);
+
+int
+E_mb_loop_stack(int i,
+                int j,
+                vrna_fold_compound_t *vc);
+
+int
+E_ml_rightmost_stem(int i,
+                    int j,
+                    vrna_fold_compound_t *vc);
+
+int
+vrna_E_ml_stems_fast( vrna_fold_compound_t *vc,
+                      int i,
+                      int j,
+                      int *fmi,
+                      int *dmli);
+
+
+FLT_OR_DBL
+vrna_exp_E_mb_loop_fast( vrna_fold_compound_t *vc,
+                    int i,
+                    int j,
+                    FLT_OR_DBL *qqm1);
+
+
+vrna_mx_pf_aux_ml_t *
+vrna_exp_E_ml_fast_init(vrna_fold_compound_t *vc);
+
+
+void
+vrna_exp_E_ml_fast_rotate(vrna_fold_compound_t  *vc,
+                          vrna_mx_pf_aux_ml_t   *aux_mx);
+
+
+void
+vrna_exp_E_ml_fast_free(vrna_fold_compound_t  *vc,
+                          vrna_mx_pf_aux_ml_t *aux_mx);
+
+
+FLT_OR_DBL
+vrna_exp_E_ml_fast(vrna_fold_compound_t *vc,
+                   int                  i,
+                   int                  j,
+                   vrna_mx_pf_aux_ml_t  *aux_mx);
+
+/*
+#################################
+# Backtracking functions below  #
+#################################
+*/
+
+int
+vrna_BT_mb_loop_fake( vrna_fold_compound_t *vc,
+                      int *u,
+                      int *i,
+                      int *j,
+                      vrna_bp_stack_t *bp_stack,
+                      int *stack_count);
+
+int
+vrna_BT_mb_loop_split(vrna_fold_compound_t *vc,
+                      int *i,
+                      int *j,
+                      int *k,
+                      int *l,
+                      int *component1,
+                      int *component2,
+                      vrna_bp_stack_t *bp_stack,
+                      int *stack_count);
+
+int
+vrna_BT_mb_loop(vrna_fold_compound_t *vc,
+                int *i,
+                int *j,
+                int *k,
+                int en,
+                int *component1,
+                int *component2);
+
+/*
+########################################
+# BEGIN OF INLINE FUNCTION DEFINITIONS #
+########################################
+*/
+
+
+PRIVATE INLINE int E_MLstem(int type, int si1, int sj1, vrna_param_t *P){
+  int energy = 0;
+  if(si1 >= 0 && sj1 >= 0){
+    energy += P->mismatchM[type][si1][sj1];
+  }
+  else if (si1 >= 0){
+    energy += P->dangle5[type][si1];
+  }
+  else if (sj1 >= 0){
+    energy += P->dangle3[type][sj1];
+  }
+
+  if(type > 2)
+    energy += P->TerminalAU;
+
+  energy += P->MLintern[type];
+
+  return energy;
+}
+
+
+
+PRIVATE INLINE FLT_OR_DBL
+exp_E_MLstem( int type,
+              int si1,
+              int sj1,
+              vrna_exp_param_t *P){
+
+  double energy = 1.0;
+  if(si1 >= 0 && sj1 >= 0){
+    energy = P->expmismatchM[type][si1][sj1];
+  }
+  else if(si1 >= 0){
+    energy = P->expdangle5[type][si1];
+  }
+  else if(sj1 >= 0){
+    energy = P->expdangle3[type][sj1];
+  }
+
+  if(type > 2)
+    energy *= P->expTermAU;
+
+  energy *= P->expMLintern[type];
+  return (FLT_OR_DBL)energy;
+}
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/naview.c b/C/ViennaRNA/naview.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/naview.c
@@ -0,0 +1,1171 @@
+/*
+*   NAVIEW -- A program to make a modified radial drawing of an RNA
+*   secondary structure.
+*
+*   Copyright (c) 1988 Robert E. Bruccoleri
+*   Copying of this software, in whole or in part, is permitted
+*   provided that the copies are not made for commercial purposes,
+*   appropriate credit for the use of the software is given, this
+*   copyright notice appears, and notice is given that the copying
+*   is by permission of Robert E. Bruccoleri. Any other copying
+*   requires specific permission.
+*
+*   See R. Bruccoleri and G. Heinrich, Computer Applications in the
+*   Biosciences, 4, 167-173 (1988) for a full description.
+*
+*   In November 1997, Michael Zuker made a number of changes to bring
+*   naview up to modern standards. All functions defined in naview are
+*   now declared before main() with arguments and argument types.
+*   When functions are defined, their argument types are declared
+*   with the function and these definitions are removed after the '{'.
+*   The 'void' declaration was used as necessary for functions.
+*
+*   The troublesome na_scanf function was deleted and replaced by
+*   scanf. Finally, there is now no default for the minimum separation
+*   of bases. A floating point number must be entered. However, as
+*   before an entry < 0 will be moved up to 0 and an entry > 0.5
+*   will be reduced to 0.5.
+*
+*   Adapted for use as a subroutine in the Vienna RNA Package
+*   by Ivo Hofacker, May 1998:
+*   deleted output routines, replaced main() by naview_xy_coordinates(),
+*   which fills the X and Y arrays used by PS_rna_plot() etc.
+*   added ansi prototypes and fixed memory leaks.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/naview.h"
+
+typedef int LOGICAL;
+#define logical LOGICAL
+
+#define true 1
+#define false 0
+#define FATAL_ERROR 1
+#define SUCCESS 0
+
+#define type_alloc(type) (type *) vrna_alloc(sizeof(type))
+
+#define struct_alloc(structure_name) type_alloc(struct structure_name)
+
+#define add_double_list(head,tail,newp) {\
+	(newp)->next = (newp)->prev = NULL; \
+        if ((head) == NULL) (head) = (tail) = (newp); \
+	else { \
+	     (tail)->next = (newp); \
+	     (newp)->prev = (tail); \
+	     (tail) = (newp); \
+	     } \
+	}
+
+static double pi = 3.141592653589793;
+static double anum = 9999.0;
+
+
+
+/*
+*   Function data type definitions
+*/
+
+#define minf2(x1, x2) ((x1)<(x2))?(x1):(x2)
+#define maxf2(x1, x2) ((x1)>(x2))?(x1):(x2)
+
+static struct base {
+  int mate;
+  double x,y;
+  logical extracted;
+  struct region *region;
+} *bases;
+
+struct region {
+  int start1,end1,start2,end2;
+};
+
+struct loop {
+  int nconnection;
+  struct connection **connections;
+  int number;
+  int depth;
+  logical mark;
+  double x,y,radius;
+};
+
+struct connection {
+  struct loop *loop;
+  struct region *region;
+  int start,end;       /* Start and end form the 1st base pair of the region. */
+  double xrad,yrad,angle;
+  logical extruded;	  /* True if segment between this connection and
+			     the next must be extruded out of the circle */
+  logical broken;	  /* True if the extruded segment must be drawn long. */
+};
+
+static int nbase, nregion, loop_count;
+
+static struct loop *root, *loops;
+
+static struct region *regions;
+
+static struct loop *construct_loop(int ibase);
+
+struct radloop {
+  double radius;
+  int loopnumber;
+  struct radloop *next, *prev;
+};
+
+static struct radloop *rlphead;
+
+static double lencut;
+
+static logical debug = false;
+
+static void read_in_bases(short *pair_table);
+static void find_regions(void);
+static void dump_loops(void);
+static void find_central_loop(void);
+static void determine_depths(void);
+static void traverse_loop(struct loop *lp,struct connection *anchor_connection);
+static void determine_radius(struct loop *lp,double lencut);
+static void generate_region(struct connection *cp);
+static void construct_extruded_segment(struct connection *cp,struct connection *cpnext);
+static void find_center_for_arc(int n,double b,double *hp,double *thetap);
+static int depth(struct loop *lp);
+
+static logical connected_connection(struct connection *cp, struct connection *cpnext);
+static int    find_ic_middle(int icstart, int icend, struct connection *anchor_connection, struct connection *acp, struct loop *lp);
+
+
+
+int naview_xy_coordinates(short *pair_table, float *X, float *Y) {
+  int i;
+
+  nbase = pair_table[0]; /* length */
+  bases = (struct base *) vrna_alloc(sizeof(struct base)*(nbase+1));
+  regions = (struct region *) vrna_alloc(sizeof(struct region)*(nbase+1));
+  read_in_bases(pair_table);
+  lencut = 0.5;
+  rlphead = NULL;
+  find_regions();
+  loop_count = 0;
+  loops = (struct loop *) vrna_alloc(sizeof(struct loop)*(nbase+1));
+  construct_loop(0);
+  find_central_loop();
+  if (debug) dump_loops();
+
+  traverse_loop(root,NULL);
+  for (i=0; i<nbase; i++) {
+    X[i] = 100 + 15*bases[i+1].x;
+    Y[i] = 100 + 15*bases[i+1].y;
+  }
+  free(bases);
+  free(regions);
+  free(loops);
+  return nbase;
+}
+
+
+static void read_in_bases(short *pair_table)
+{
+  int i,npairs;
+
+  /* Set up an origin.  */
+  bases[0].mate = 0;
+  bases[0].extracted = false;
+  bases[0].x = anum;
+  bases[0].y = anum;
+
+  for (npairs=0,i=1; i<=nbase; i++) {
+    bases[i].extracted = false;
+    bases[i].x = anum;
+    bases[i].y = anum;
+    bases[i].mate = pair_table[i];
+    if ((int) pair_table[i]>i) npairs++;
+  }
+  if (npairs==0) { /* must have at least 1 pair to avoid segfault */
+    bases[1].mate=nbase;
+    bases[nbase].mate=1;
+  }
+}
+
+
+static void find_regions(void)
+/*
+*   Identifies the regions in the structure.
+*/
+
+{
+  int i,mate,nb1;
+  logical *mark;
+
+  nb1 = nbase + 1;
+  mark = (int *) vrna_alloc(sizeof(int)*nb1);
+  for (i = 0; i < nb1; i++) mark[i] = false;
+  nregion = 0;
+  for (i=0; i<=nbase; i++) {
+    if ( (mate = bases[i].mate) && !mark[i]) {
+      regions[nregion].start1 = i;
+      regions[nregion].end2 = mate;
+      mark[i] = true;
+      mark[mate] = true;
+      bases[i].region = bases[mate].region = &regions[nregion];
+      for (i++,mate--;
+	   i<mate && bases[i].mate == mate;
+	   i++,mate--) {
+	mark[i] = mark[mate] = true;
+	bases[i].region = bases[mate].region = &regions[nregion];
+      }
+      regions[nregion].end1 = --i;
+      regions[nregion].start2 = mate+1;
+      if (debug) {
+	if (nregion == 0) printf("\nRegions are:\n");
+	printf("Region %d is %d-%d and %d-%d with gap of %d.\n",
+	       nregion+1,regions[nregion].start1,regions[nregion].end1,
+	       regions[nregion].start2,regions[nregion].end2,
+	       regions[nregion].start2-regions[nregion].end1+1);
+      }
+      nregion++;
+    }
+  }
+  free(mark);
+}
+
+
+static struct loop *construct_loop(int ibase)
+/*
+*   Starting at residue ibase, recursively constructs the loop containing
+*   said base and all deeper bases.
+*/
+
+{
+  int i,mate;
+  struct loop *retloop,*lp;
+  struct connection *cp;
+  struct region *rp;
+  struct radloop *rlp;
+
+  retloop = &loops[loop_count++];
+  retloop->nconnection = 0;
+  retloop->connections = (struct connection **) vrna_alloc(sizeof(struct connection *));
+  retloop->depth = 0;
+  retloop->number = loop_count;
+  retloop->radius = 0.0;
+  for (rlp = rlphead;  rlp;  rlp = rlp->next)
+    if (rlp->loopnumber == loop_count) retloop->radius = rlp->radius;
+  i = ibase;
+  do {
+    if ((mate = bases[i].mate) != 0) {
+      rp = bases[i].region;
+      if (!bases[rp->start1].extracted) {
+	if (i == rp->start1) {
+	  bases[rp->start1].extracted = true;
+	  bases[rp->end1].extracted = true;
+	  bases[rp->start2].extracted = true;
+	  bases[rp->end2].extracted = true;
+	  lp = construct_loop(rp->end1 < nbase ? rp->end1+1 : 0);
+	}
+	else if (i == rp->start2){
+	  bases[rp->start2].extracted = true;
+	  bases[rp->end2].extracted = true;
+	  bases[rp->start1].extracted = true;
+	  bases[rp->end1].extracted = true;
+	  lp = construct_loop(rp->end2 < nbase ? rp->end2+1 : 0);
+	}
+	else {
+	  vrna_message_error("naview: Error detected in construct_loop. i = %d not found in region table.",i);
+	  exit(FATAL_ERROR);
+	}
+	retloop->connections = (struct connection **)
+	  realloc(retloop->connections,
+		  (++retloop->nconnection+1) *
+		  sizeof(struct connection *));
+	retloop->connections[retloop->nconnection-1] = cp =
+	  struct_alloc(connection);
+	retloop->connections[retloop->nconnection] = NULL;
+	cp->loop = lp;
+	cp->region = rp;
+	if (i == rp->start1) {
+	  cp->start = rp->start1;
+	  cp->end = rp->end2;
+	}
+	else {
+	  cp->start = rp->start2;
+	  cp->end = rp->end1;
+	}
+	cp->extruded = false;
+	cp->broken = false;
+	lp->connections = (struct connection **)
+	  realloc(lp->connections,
+		  (++lp->nconnection+1) *
+		  sizeof(struct connection *));
+	lp->connections[lp->nconnection-1] = cp =
+	  struct_alloc(connection);
+	lp->connections[lp->nconnection] = NULL;
+	cp->loop = retloop;
+	cp->region = rp;
+	if (i == rp->start1) {
+	  cp->start = rp->start2;
+	  cp->end = rp->end1;
+	}
+	else {
+	  cp->start = rp->start1;
+	  cp->end = rp->end2;
+	}
+	cp->extruded = false;
+	cp->broken = false;
+      }
+      i = mate;
+    }
+    if (++i > nbase) i = 0;
+  }
+  while (i != ibase);
+  return retloop;
+}
+
+
+static void dump_loops(void)
+/*
+*   Displays all the loops.
+*/
+
+{
+  int il,ilp,irp;
+  struct loop *lp;
+  struct connection *cp,**cpp;
+
+  printf("\nRoot loop is #%ld\n",(root-loops)+1);
+  for (il=0; il < loop_count; il++) {
+    lp = &loops[il];
+    printf("Loop %d has %d connections:\n",il+1,lp->nconnection);
+    for (cpp = lp->connections; (cp = *cpp); cpp++) {
+      ilp = (cp->loop - loops) + 1;
+      irp = (cp->region - regions) + 1;
+      printf("  Loop %d Region %d (%d-%d)\n",
+	     ilp,irp,cp->start,cp->end);
+    }
+  }
+}
+
+
+static void find_central_loop(void)
+/*
+*   Find node of greatest branching that is deepest.
+*/
+
+{
+  struct loop *lp;
+  int maxconn,maxdepth,i;
+
+  determine_depths();
+  maxconn = 0;
+  maxdepth = -1;
+
+  for (i=0; i<loop_count; i++) {
+    lp = &loops[i];
+    if (lp->nconnection > maxconn) {
+      maxdepth = lp->depth;
+      maxconn = lp->nconnection;
+      root = lp;
+    }
+    else if (lp->depth > maxdepth && lp->nconnection == maxconn) {
+      maxdepth = lp->depth;
+      root = lp;
+    }
+  }
+}
+
+
+static void determine_depths(void)
+/*
+*   Determine the depth of all loops.
+*/
+
+{
+  struct loop *lp;
+  int i,j;
+
+  for (i=0; i<loop_count; i++) {
+    lp = &loops[i];
+    for (j=0; j<loop_count; j++) loops[j].mark = false;
+    lp->depth = depth(lp);
+  }
+}
+
+
+
+static int depth(struct loop *lp)
+/*
+*   Determines the depth of loop, lp. Depth is defined as the minimum
+*   distance to a leaf loop where a leaf loop is one that has only one
+*   or no connections.
+*/
+
+{
+  struct connection *cp,**cpp;
+  int count,ret,d;
+
+  if (lp->nconnection <= 1) return 0;
+  if (lp->mark) return -1;
+  lp->mark = true;
+  count = 0;
+  ret = 0;
+  for (cpp=lp->connections; (cp = *cpp); cpp++) {
+    d = depth(cp->loop);
+    if (d >= 0) {
+      if (++count == 1) ret = d;
+      else if (ret > d) ret = d;
+    }
+  }
+  lp->mark = false;
+  return ret+1;
+}
+
+
+static void traverse_loop(struct loop *lp, struct connection *anchor_connection)
+/*
+*   This is the workhorse of the display program. The algorithm is
+*   recursive based on processing individual loops. Each base pairing
+*   region is displayed using the direction given by the circle diagram,
+*   and the connections between the regions is drawn by equally spaced
+*   points. The radius of the loop is set to minimize the square error
+*   for lengths between sequential bases in the loops. The "correct"
+*   length for base links is 1. If the least squares fitting of the
+*   radius results in loops being less than 1/2 unit apart, then that
+*   segment is extruded.
+*
+*   The variable, anchor_connection, gives the connection to the loop
+*   processed in an previous level of recursion.
+*/
+
+{
+  double xs,ys,xe,ye,xn,yn,angleinc,r;
+  double radius,xc,yc,xo,yo,astart,aend,a;
+  struct connection *cp,*cpnext,**cpp,*acp,*cpprev;
+  int i,j,n,ic;
+  double da,maxang;
+  int count,icstart,icend,icmiddle,icroot;
+  logical done,done_all_connections,rooted;
+  int sign;
+  double midx,midy,nrx,nry,mx,my,vx,vy,dotmv,nmidx,nmidy;
+  int icstart1,icup,icdown,icnext,direction;
+  double dan,dx,dy,rr;
+  double cpx,cpy,cpnextx,cpnexty,cnx,cny,rcn,rc,lnx,lny,rl,ac,acn,sx,sy,dcp;
+  int imaxloop;
+
+  angleinc = 2 * pi / (nbase+1);
+  acp = NULL;
+  icroot = -1;
+  for (cpp=lp->connections, ic = 0; (cp = *cpp); cpp++, ic++) {
+    /*	xs = cos(angleinc*cp->start);
+	ys = sin(angleinc*cp->start);
+	xe = cos(angleinc*cp->end);
+	ye = sin(angleinc*cp->end); */
+    xs = -sin(angleinc*cp->start);
+    ys = cos(angleinc*cp->start);
+    xe = -sin(angleinc*cp->end);
+    ye = cos(angleinc*cp->end);
+    xn = ye-ys;
+    yn = xs-xe;
+    r = sqrt(xn*xn + yn*yn);
+    cp->xrad = xn/r;
+    cp->yrad = yn/r;
+    cp->angle = atan2(yn,xn);
+    if (cp->angle < 0.0) cp->angle += 2*pi;
+    if (anchor_connection != NULL &&
+	anchor_connection->region == cp->region) {
+      acp = cp;
+      icroot = ic;
+    }
+  }
+
+ set_radius:
+  determine_radius(lp,lencut);
+  radius = lp->radius;
+  if (anchor_connection == NULL) xc = yc = 0.0;
+  else {
+    xo = (bases[acp->start].x+bases[acp->end].x) / 2.0;
+    yo = (bases[acp->start].y+bases[acp->end].y) / 2.0;
+    xc = xo - radius * acp->xrad;
+    yc = yo - radius * acp->yrad;
+  }
+
+  /*
+   *   The construction of the connectors will proceed in blocks of
+   *   connected connectors, where a connected connector pairs means
+   *   two connectors that are forced out of the drawn circle because they
+   *   are too close together in angle.
+   */
+
+  /*
+   *   First, find the start of a block of connected connectors
+   */
+
+  if (icroot == -1)
+    icstart = 0;
+  else icstart = icroot;
+  cp = lp->connections[icstart];
+  count = 0;
+  if (debug) printf("Now processing loop %d\n",lp->number);
+  done = false;
+  do {
+    j = icstart - 1;
+    if (j < 0) j = lp->nconnection - 1;
+    cpprev = lp->connections[j];
+    if (!connected_connection(cpprev,cp)) {
+      done = true;
+    }
+    else {
+      icstart = j;
+      cp = cpprev;
+    }
+    if (++count > lp->nconnection) {
+      /*
+       *  Here everything is connected. Break on maximum angular separation
+       *  between connections.
+       */
+      maxang = -1.0;
+      for (ic = 0;  ic < lp->nconnection;  ic++) {
+	j = ic + 1;
+	if (j >= lp->nconnection) j = 0;
+	cp = lp->connections[ic];
+	cpnext = lp->connections[j];
+	ac = cpnext->angle - cp->angle;
+	if (ac < 0.0) ac += 2*pi;
+	if (ac > maxang) {
+	  maxang = ac;
+	  imaxloop = ic;
+	}
+      }
+      icend = imaxloop;
+      icstart = imaxloop + 1;
+      if (icstart >= lp->nconnection) icstart = 0;
+      cp = lp->connections[icend];
+      cp->broken = true;
+      done = true;
+    }
+  } while    (!done);
+  done_all_connections = false;
+  icstart1 = icstart;
+  if (debug) printf("Icstart1 = %d\n",icstart1);
+  while (!done_all_connections) {
+    count = 0;
+    done = false;
+    icend = icstart;
+    rooted = false;
+    while (!done) {
+      cp = lp->connections[icend];
+      if (icend == icroot) rooted = true;
+      j = icend + 1;
+      if (j >= lp->nconnection) {
+	j = 0;
+      }
+      cpnext = lp->connections[j];
+      if (connected_connection(cp,cpnext)) {
+	if (++count >= lp->nconnection) break;
+	icend = j;
+      }
+      else {
+	done = true;
+      }
+    }
+    icmiddle = find_ic_middle(icstart,icend,anchor_connection,acp,lp);
+    ic = icup = icdown = icmiddle;
+    if (debug)
+      printf("IC start = %d  middle = %d  end = %d\n",
+	     icstart,icmiddle,icend);
+    done = false;
+    direction = 0;
+    while (!done) {
+      if (direction < 0) {
+	ic = icup;
+      }
+      else if (direction == 0) {
+	ic = icmiddle;
+      }
+      else {
+	ic = icdown;
+      }
+      if (ic >= 0) {
+	cp = lp->connections[ic];
+	if (anchor_connection == NULL || acp != cp) {
+	  if (direction == 0) {
+	    astart = cp->angle - asin(1.0/2.0/radius);
+	    aend = cp->angle + asin(1.0/2.0/radius);
+	    bases[cp->start].x = xc + radius*cos(astart);
+	    bases[cp->start].y = yc + radius*sin(astart);
+	    bases[cp->end].x = xc + radius*cos(aend);
+	    bases[cp->end].y = yc + radius*sin(aend);
+	  }
+	  else if (direction < 0) {
+	    j = ic + 1;
+	    if (j >= lp->nconnection) j = 0;
+	    cp = lp->connections[ic];
+	    cpnext = lp->connections[j];
+	    cpx = cp->xrad;
+	    cpy = cp->yrad;
+	    ac = (cp->angle + cpnext->angle) / 2.0;
+	    if (cp->angle > cpnext->angle) ac -= pi;
+	    cnx = cos(ac);
+	    cny = sin(ac);
+	    lnx = cny;
+	    lny = -cnx;
+	    da = cpnext->angle - cp->angle;
+	    if (da < 0.0) da += 2*pi;
+	    if (cp->extruded) {
+	      if (da <= pi/2) rl = 2.0;
+	      else rl = 1.5;
+	    }
+	    else {
+	      rl = 1.0;
+	    }
+	    bases[cp->end].x = bases[cpnext->start].x + rl*lnx;
+	    bases[cp->end].y = bases[cpnext->start].y + rl*lny;
+	    bases[cp->start].x = bases[cp->end].x + cpy;
+	    bases[cp->start].y = bases[cp->end].y - cpx;
+	  }
+	  else {
+	    j = ic - 1;
+	    if (j < 0) j = lp->nconnection - 1;
+	    cp = lp->connections[j];
+	    cpnext = lp->connections[ic];
+	    cpnextx = cpnext->xrad;
+	    cpnexty = cpnext->yrad;
+	    ac = (cp->angle + cpnext->angle) / 2.0;
+	    if (cp->angle > cpnext->angle) ac -= pi;
+	    cnx = cos(ac);
+	    cny = sin(ac);
+	    lnx = -cny;
+	    lny = cnx;
+	    da = cpnext->angle - cp->angle;
+	    if (da < 0.0) da += 2*pi;
+	    if (cp->extruded) {
+	      if (da <= pi/2) rl = 2.0;
+	      else rl = 1.5;
+	    }
+	    else {
+	      rl = 1.0;
+	    }
+	    bases[cpnext->start].x = bases[cp->end].x + rl*lnx;
+	    bases[cpnext->start].y = bases[cp->end].y + rl*lny;
+	    bases[cpnext->end].x = bases[cpnext->start].x - cpnexty;
+	    bases[cpnext->end].y = bases[cpnext->start].y + cpnextx;
+	  }
+	}
+      }
+      if (direction < 0) {
+	if (icdown == icend) {
+	  icdown = -1;
+	}
+	else if (icdown >= 0) {
+	  if (++icdown >= lp->nconnection) {
+	    icdown = 0;
+	  }
+	}
+	direction = 1;
+      }
+      else {
+	if (icup == icstart) icup = -1;
+	else if (icup >= 0) {
+	  if (--icup < 0) {
+	    icup = lp->nconnection - 1;
+	  }
+	}
+	direction = -1;
+      }
+      done = icup == -1 && icdown == -1;
+    }
+    icnext = icend + 1;
+    if (icnext >= lp->nconnection) icnext = 0;
+    if (icend != icstart && (! (icstart == icstart1 && icnext == icstart1))) {
+      /*
+       *	    Move the bases just constructed (or the radius) so
+       *	    that the bisector of the end points is radius distance
+       *	    away from the loop center.
+       */
+      cp = lp->connections[icstart];
+      cpnext = lp->connections[icend];
+      dx = bases[cpnext->end].x - bases[cp->start].x;
+      dy = bases[cpnext->end].y - bases[cp->start].y;
+      midx = bases[cp->start].x + dx/2.0;
+      midy = bases[cp->start].y + dy/2.0;
+      rr = sqrt(dx*dx + dy*dy);
+      mx = dx / rr;
+      my = dy / rr;
+      vx = xc - midx;
+      vy = yc - midy;
+      rr = sqrt(dx*dx + dy*dy);
+      vx /= rr;
+      vy /= rr;
+      dotmv = vx*mx + vy*my;
+      nrx = dotmv*mx - vx;
+      nry = dotmv*my - vy;
+      rr = sqrt(nrx*nrx + nry*nry);
+      nrx /= rr;
+      nry /= rr;
+      /*
+       *	    Determine which side of the bisector the center should be.
+       */
+      dx = bases[cp->start].x - xc;
+      dy = bases[cp->start].y - yc;
+      ac = atan2(dy,dx);
+      if (ac < 0.0) ac += 2*pi;
+      dx = bases[cpnext->end].x - xc;
+      dy = bases[cpnext->end].y - yc;
+      acn = atan2(dy,dx);
+      if (acn < 0.0) acn += 2*pi;
+      if (acn < ac) acn += 2*pi;
+      if (acn - ac > pi) sign = -1;
+      else sign = 1;
+      nmidx = xc + sign*radius*nrx;
+      nmidy = yc + sign*radius*nry;
+      if (rooted) {
+	xc -= nmidx - midx;
+	yc -= nmidy - midy;
+      }
+      else {
+	for (ic=icstart; ; ++ic >= lp->nconnection ? (ic = 0) : 0) {
+	  cp = lp->connections[ic];
+	  i = cp->start;
+	  bases[i].x += nmidx - midx;
+	  bases[i].y += nmidy - midy;
+	  i = cp->end;
+	  bases[i].x += nmidx - midx;
+	  bases[i].y += nmidy - midy;
+	  if (ic == icend) break;
+	}
+      }
+    }
+    icstart = icnext;
+    done_all_connections = icstart == icstart1;
+  }
+  for (ic=0; ic < lp->nconnection; ic++) {
+    cp = lp->connections[ic];
+    j = ic + 1;
+    if (j >= lp->nconnection) j = 0;
+    cpnext = lp->connections[j];
+    dx = bases[cp->end].x - xc;
+    dy = bases[cp->end].y - yc;
+    rc = sqrt(dx*dx + dy*dy);
+    ac = atan2(dy,dx);
+    if (ac < 0.0) ac += 2*pi;
+    dx = bases[cpnext->start].x - xc;
+    dy = bases[cpnext->start].y - yc;
+    rcn = sqrt(dx*dx + dy*dy);
+    acn = atan2(dy,dx);
+    if (acn < 0.0) acn += 2*pi;
+    if (acn < ac) acn += 2*pi;
+    dan = acn - ac;
+    dcp = cpnext->angle - cp->angle;
+    if (dcp <= 0.0) dcp += 2*pi;
+    if (fabs(dan-dcp) > pi) {
+      if (cp->extruded) {
+        vrna_message_warning("...from traverse_loop. Loop %d has crossed regions",
+                                    lp->number);
+      }
+      else if ((cpnext->start - cp->end) != 1) {
+	cp->extruded = true;
+	goto set_radius;	    /* Forever shamed */
+      }
+    }
+    if (cp->extruded) {
+      construct_extruded_segment(cp,cpnext);
+    }
+    else {
+      n = cpnext->start - cp->end;
+      if (n < 0) n += nbase + 1;
+      angleinc = dan / n;
+      for (j = 1;  j < n;  j++) {
+	i = cp->end + j;
+	if (i > nbase) i -= nbase + 1;
+	a = ac + j*angleinc;
+	rr = rc + (rcn-rc)*(a-ac)/dan;
+	bases[i].x = xc + rr*cos(a);
+	bases[i].y = yc + rr*sin(a);
+      }
+    }
+  }
+  for (ic=0; ic < lp->nconnection; ic++) {
+    if (icroot != ic) {
+      cp = lp->connections[ic];
+      generate_region(cp);
+      traverse_loop(cp->loop,cp);
+    }
+  }
+  n = 0;
+  sx = 0.0;
+  sy = 0.0;
+  for (ic = 0;  ic < lp->nconnection;  ic++) {
+    j = ic + 1;
+    if (j >= lp->nconnection) j = 0;
+    cp = lp->connections[ic];
+    cpnext = lp->connections[j];
+    n += 2;
+    sx += bases[cp->start].x + bases[cp->end].x;
+    sy += bases[cp->start].y + bases[cp->end].y;
+    if (!cp->extruded) {
+      for (j = cp->end + 1;  j != cpnext->start;  j++) {
+	if (j > nbase) j -= nbase + 1;
+	n++;
+	sx += bases[j].x;
+	sy += bases[j].y;
+      }
+    }
+  }
+  lp->x = sx / n;
+  lp->y = sy / n;
+
+  /* free connections (ih) */
+  for (ic = 0;  ic < lp->nconnection;  ic++)
+    free(lp->connections[ic]);
+  free(lp->connections);
+}
+
+
+
+static void determine_radius(struct loop *lp,double lencut)
+/*
+*   For the loop pointed to by lp, determine the radius of
+*   the loop that will ensure that each base around the loop will
+*   have a separation of at least lencut around the circle.
+*   If a segment joining two connectors will not support this separation,
+*   then the flag, extruded, will be set in the first of these
+*   two indicators. The radius is set in lp.
+*
+*   The radius is selected by a least squares procedure where the sum of the
+*   squares of the deviations of length from the ideal value of 1 is used
+*   as the error function.
+*/
+
+{
+  double mindit,ci,dt,sumn,sumd,radius,dit;
+  int i,j,end,start,imindit;
+  struct connection *cp,*cpnext;
+  static double rt2_2 = 0.7071068;
+
+  do {
+    mindit = 1.0e10;
+    for (sumd=0.0, sumn=0.0, i=0;
+	 i < lp->nconnection;
+	 i++) {
+      cp = lp->connections[i];
+      j = i + 1;
+      if (j >= lp->nconnection) j = 0;
+      cpnext = lp->connections[j];
+      end =  cp->end;
+      start = cpnext->start;
+      if (start < end) start += nbase + 1;
+      dt = cpnext->angle - cp->angle;
+      if (dt <= 0.0) dt += 2*pi;
+      if (!cp->extruded)
+	ci = start - end;
+      else {
+	if (dt <= pi/2) ci = 2.0;
+	else ci = 1.5;
+      }
+      sumn += dt * (1.0/ci + 1.0);
+      sumd += dt * dt / ci;
+      dit = dt/ci;
+      if (dit < mindit && !cp->extruded && ci > 1.0) {
+	mindit = dit;
+	imindit = i;
+      }
+    }
+    radius = sumn/sumd;
+    if (radius < rt2_2) radius = rt2_2;
+    if (mindit*radius < lencut) {
+      lp->connections[imindit]->extruded = true;
+    }
+  } while (mindit*radius < lencut);
+  if (lp->radius > 0.0)
+    radius = lp->radius;
+  else lp->radius = radius;
+}
+
+
+static logical    connected_connection(struct connection *cp, struct connection *cpnext)
+/*
+*   Determines if the connections cp and cpnext are connected
+*/
+
+{
+
+  if (cp->extruded) {
+    return true;
+  }
+  else if (cp->end+1 == cpnext->start) {
+    return true;
+  }
+  else {
+    return false;
+  }
+}
+
+
+static int    find_ic_middle(int icstart, int icend, struct connection *anchor_connection, struct connection *acp, struct loop *lp)
+/*
+*   Finds the middle of a set of connected connectors. This is normally
+*   the middle connection in the sequence except if one of the connections
+*   is the anchor, in which case that connection will be used.
+*/
+
+{
+  int count,ret,ic,i;
+  logical done;
+
+  count = 0;
+  ret = -1;
+  ic = icstart;
+  done = false;
+  while (!done) {
+    if (count++ > lp->nconnection * 2) {
+      printf("Infinite loop detected in find_ic_middle\n");
+      exit(FATAL_ERROR);
+    }
+    if (anchor_connection != NULL && lp->connections[ic] == acp) {
+      ret = ic;
+    }
+    done = ic == icend;
+    if (++ic >= lp->nconnection) {
+      ic = 0;
+    }
+  }
+  if (ret == -1) {
+    for (i=1, ic=icstart; i<(count+1)/2; i++) {
+      if (++ic >= lp->nconnection) ic = 0;
+    }
+    ret = ic;
+  }
+  return ret;
+}
+
+
+static void generate_region(struct connection *cp)
+/*
+*   Generates the coordinates for the base pairing region of a connection
+*   given the position of the starting base pair.
+*/
+
+{
+  int l,start,end,i,mate;
+  struct region *rp;
+
+  rp = cp->region;
+  l = 0;
+  if (cp->start == rp->start1) {
+    start = rp->start1;
+    end = rp->end1;
+  }
+  else {
+    start = rp->start2;
+    end = rp->end2;
+  }
+  if (bases[cp->start].x > anum - 100.0 ||
+      bases[cp->end].x > anum - 100.0) {
+    printf("Bad region passed to generate_region. Coordinates not defined.\n");
+    exit(FATAL_ERROR);
+  }
+  for (i=start+1; i<=end; i++) {
+    l++;
+    bases[i].x = bases[cp->start].x + l*cp->xrad;
+    bases[i].y = bases[cp->start].y + l*cp->yrad;
+    mate = bases[i].mate;
+    bases[mate].x = bases[cp->end].x + l*cp->xrad;
+    bases[mate].y = bases[cp->end].y + l*cp->yrad;
+  }
+}
+
+
+static void construct_circle_segment(int start, int end)
+/*
+*   Draws the segment of residue between the bases numbered start
+*   through end, where start and end are presumed to be part of a base
+*   pairing region. They are drawn as a circle which has a chord given
+*   by the ends of two base pairing regions defined by the connections.
+*/
+
+{
+  double dx,dy,rr,h,angleinc,midx,midy,xn,yn,nrx,nry,mx,my,a;
+  int l,j,i;
+
+  dx = bases[end].x - bases[start].x;
+  dy = bases[end].y - bases[start].y;
+  rr = sqrt(dx*dx + dy*dy);
+  l = end - start;
+  if (l < 0) l += nbase + 1;
+  if (rr >= l) {
+    dx /= rr;
+    dy /= rr;
+    for (j = 1;  j < l;  j++) {
+      i = start + j;
+      if (i > nbase) i -= nbase + 1;
+      bases[i].x = bases[start].x + dx*(double)j/(double)l;
+      bases[i].y = bases[start].y + dy*(double)j/(double)l;
+    }
+  }
+  else {
+    find_center_for_arc(l-1,rr,&h,&angleinc);
+    dx /= rr;
+    dy /= rr;
+    midx = bases[start].x + dx*rr/2.0;
+    midy = bases[start].y + dy*rr/2.0;
+    xn = dy;
+    yn = -dx;
+    nrx = midx + h*xn;
+    nry = midy + h*yn;
+    mx = bases[start].x - nrx;
+    my = bases[start].y - nry;
+    rr = sqrt(mx*mx + my*my);
+    a = atan2(my,mx);
+    for (j = 1;  j < l;  j++) {
+      i = start + j;
+      if (i > nbase) i -= nbase + 1;
+      bases[i].x = nrx + rr*cos(a+j*angleinc);
+      bases[i].y = nry + rr*sin(a+j*angleinc);
+    }
+  }
+}
+
+
+static void construct_extruded_segment(struct connection *cp, struct connection *cpnext)
+/*
+*   Constructs the segment between cp and cpnext as a circle if possible.
+*   However, if the segment is too large, the lines are drawn between
+*   the two connecting regions, and bases are placed there until the
+*   connecting circle will fit.
+*/
+
+{
+  double astart,aend1,aend2,aave,dx,dy,a1,a2,ac,rr,da,dac;
+  int start,end,n,nstart,nend;
+  logical collision;
+
+  astart = cp->angle;
+  aend2 = aend1 = cpnext->angle;
+  if (aend2 < astart) aend2 += 2*pi;
+  aave = (astart + aend2) / 2.0;
+  start = cp->end;
+  end = cpnext->start;
+  n = end - start;
+  if (n < 0) n += nbase + 1;
+  da = cpnext->angle - cp->angle;
+  if (da < 0.0) {
+    da += 2*pi;
+  }
+  if (n == 2) construct_circle_segment(start,end);
+  else {
+    dx = bases[end].x - bases[start].x;
+    dy = bases[end].y - bases[start].y;
+    rr = sqrt(dx*dx + dy*dy);
+    dx /= rr;
+    dy /= rr;
+    if (rr >= 1.5 && da <= pi/2) {
+      nstart = start + 1;
+      if (nstart > nbase) nstart -= nbase + 1;
+      nend = end - 1;
+      if (nend < 0) nend += nbase + 1;
+      bases[nstart].x = bases[start].x + 0.5*dx;
+      bases[nstart].y = bases[start].y + 0.5*dy;
+      bases[nend].x = bases[end].x - 0.5*dx;
+      bases[nend].y = bases[end].y - 0.5*dy;
+      start = nstart;
+      end = nend;
+    }
+    do {
+      collision = false;
+      construct_circle_segment(start,end);
+      nstart = start + 1;
+      if (nstart > nbase) nstart -= nbase + 1;
+      dx = bases[nstart].x - bases[start].x;
+      dy = bases[nstart].y - bases[start].y;
+      a1 = atan2(dy,dx);
+      if (a1 < 0.0) a1 += 2*pi;
+      dac = a1 - astart;
+      if (dac < 0.0) dac += 2*pi;
+      if (dac > pi) collision = true;
+      nend = end - 1;
+      if (nend < 0) nend += nbase + 1;
+      dx = bases[nend].x - bases[end].x;
+      dy = bases[nend].y - bases[end].y;
+      a2 = atan2(dy,dx);
+      if (a2 < 0.0) a2 += 2*pi;
+      dac = aend1 - a2;
+      if (dac < 0.0) dac += 2*pi;
+      if (dac > pi) collision = true;
+      if (collision) {
+	ac = minf2(aave,astart + 0.5);
+	bases[nstart].x = bases[start].x + cos(ac);
+	bases[nstart].y = bases[start].y + sin(ac);
+	start = nstart;
+	ac = maxf2(aave,aend2 - 0.5);
+	bases[nend].x = bases[end].x + cos(ac);
+	bases[nend].y = bases[end].y + sin(ac);
+	end = nend;
+	n -= 2;
+      }
+    } while    (collision && n > 1);
+  }
+}
+
+
+static void find_center_for_arc(int n,double b,double *hp,double *thetap)
+/*
+*   Given n points to be placed equidistantly and equiangularly on a
+*   polygon which has a chord of length, b, find the distance, h, from the
+*   midpoint of the chord for the center of polygon. Positive values
+*   mean the center is within the polygon and the chord, whereas
+*   negative values mean the center is outside the chord. Also, the
+*   radial angle for each polygon side is returned in theta.
+*
+*   The procedure uses a bisection algorithm to find the correct
+*   value for the center. Two equations are solved, the angles
+*   around the center must add to 2*pi, and the sides of the polygon
+*   excluding the chord must have a length of 1.
+*/
+
+{
+  double h,hhi,hlow,r,disc,theta,e,phi;
+  int iter;
+#define maxiter 500
+
+  hhi = (n+1) / pi;
+  hlow = - hhi - b/(n+1.000001-b);  /* changed to prevent div by zero if (ih) */
+  if (b<1) hlow = 0;  /* otherwise we might fail below (ih) */
+  iter = 0;
+  do {
+    h = (hhi + hlow) / 2.0;
+    r = sqrt(h*h + b*b/4.0);
+    /*  if (r<0.5) {r = 0.5; h = 0.5*sqrt(1-b*b);} */
+    disc = 1.0 - 0.5/(r*r);
+    if (fabs(disc) > 1.0) {
+      vrna_message_error("Unexpected large magnitude discriminant = %g %g", disc,r);
+      exit(FATAL_ERROR);
+    }
+    theta = acos(disc);
+    /*    theta = 2*acos(sqrt(1-1/(4*r*r))); */
+    phi = acos(h/r);
+    e = theta * (n+1) + 2*phi - 2*pi;
+    if (e > 0.0) {
+      hlow = h;
+    }
+    else {
+      hhi = h;
+    }
+  } while    (fabs(e) > 0.0001 && ++iter < maxiter);
+  if (iter >= maxiter) {
+    vrna_message_warning("Iteration failed in find_center_for_arc");
+    h = 0.0;
+    theta = 0.0;
+  }
+  *hp = h;
+  *thetap = theta;
+}
+
diff --git a/C/ViennaRNA/naview.h b/C/ViennaRNA/naview.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/naview.h
@@ -0,0 +1,24 @@
+#ifndef VIENNA_RNA_PACKAGE_NAVIEW_H
+#define VIENNA_RNA_PACKAGE_NAVIEW_H
+
+/**
+ *  @addtogroup   plotting_utils
+ *
+ *  @{
+ *
+ *  @file naview.h
+ *
+ */
+
+/**
+ *
+ */
+int naview_xy_coordinates(short *pair_table,
+                          float *X,
+                          float *Y);
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/pair_mat.h b/C/ViennaRNA/pair_mat.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/pair_mat.h
@@ -0,0 +1,153 @@
+#ifndef VIENNA_RNA_PACKAGE_PAIR_MAT_H
+#define VIENNA_RNA_PACKAGE_PAIR_MAT_H
+
+#include <ctype.h>
+#include <ViennaRNA/utils.h>
+#include <ViennaRNA/fold_vars.h>
+
+#define NBASES 8
+/*@notnull@*/
+
+static const char Law_and_Order[] = "_ACGUTXKI";
+static int BP_pair[NBASES][NBASES]=
+/* _  A  C  G  U  X  K  I */
+{{ 0, 0, 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 5, 0, 0, 5},
+ { 0, 0, 0, 1, 0, 0, 0, 0},
+ { 0, 0, 2, 0, 3, 0, 0, 0},
+ { 0, 6, 0, 4, 0, 0, 0, 6},
+ { 0, 0, 0, 0, 0, 0, 2, 0},
+ { 0, 0, 0, 0, 0, 1, 0, 0},
+ { 0, 6, 0, 0, 5, 0, 0, 0}};
+
+#define MAXALPHA 20       /* maximal length of alphabet */
+
+static short alias[MAXALPHA+1];
+static int pair[MAXALPHA+1][MAXALPHA+1];
+/* rtype[pair[i][j]]:=pair[j][i] */
+static int rtype[8] = {0, 2, 1, 4, 3, 6, 5, 7};
+
+#ifdef _OPENMP
+#pragma omp threadprivate(Law_and_Order, BP_pair, alias, pair, rtype)
+#endif
+
+/* for backward compatibility */
+#define ENCODE(c) encode_char(c)
+
+static int encode_char(char c) {
+  /* return numerical representation of base used e.g. in pair[][] */
+  int code;
+  if (energy_set>0) code = (int) (c-'A')+1;
+  else {
+    const char *pos;
+    pos = strchr(Law_and_Order, c);
+    if (pos==NULL) code=0;
+    else code = (int) (pos-Law_and_Order);
+    if (code>5) code = 0;
+    if (code>4) code--; /* make T and U equivalent */
+  }
+  return code;
+}
+
+/*@+boolint +charint@*/
+/*@null@*/
+extern char *nonstandards;
+
+static void make_pair_matrix(void)
+{
+   int i,j;
+
+   if (energy_set==0) {
+      for (i=0; i<5; i++) alias[i] = (short) i;
+      alias[5] = 3; /* X <-> G */
+      alias[6] = 2; /* K <-> C */
+      alias[7] = 0; /* I <-> default base '@' */
+      for (i=0; i<NBASES; i++) {
+          for (j=0; j<NBASES; j++)
+            pair[i][j] = BP_pair[i][j];
+      }
+      if (noGU) pair[3][4] = pair[4][3] =0;
+      if (nonstandards!=NULL) {  /* allow nonstandard bp's */
+         for (i=0; i<(int)strlen(nonstandards); i+=2)
+            pair[encode_char(nonstandards[i])]
+              [encode_char(nonstandards[i+1])]=7;
+      }
+      for (i=0; i<NBASES; i++) {
+          for (j=0; j<NBASES; j++)
+           rtype[pair[i][j]] = pair[j][i];
+      }
+   } else {
+      for (i=0; i<=MAXALPHA; i++) {
+         for (j=0; j<=MAXALPHA; j++)
+            pair[i][j] = 0;
+      }
+      if (energy_set==1) {
+         for (i=1; i<MAXALPHA;) {
+            alias[i++] = 3;  /* A <-> G */
+            alias[i++] = 2;  /* B <-> C */
+         }
+         for (i=1; i<MAXALPHA; i++) {
+            pair[i][i+1] = 2;    /* AB <-> GC */
+            i++;
+            pair[i][i-1] = 1;    /* BA <-> CG */
+         }
+      }
+      else if (energy_set==2) {
+        for (i=1; i<MAXALPHA;) {
+            alias[i++] = 1;  /* A <-> A*/
+            alias[i++] = 4;  /* B <-> U */
+         }
+         for (i=1; i<MAXALPHA; i++) {
+            pair[i][i+1] = 5;    /* AB <-> AU */
+            i++;
+            pair[i][i-1] = 6;    /* BA <-> UA */
+         }
+      }
+      else if (energy_set==3) {
+        for (i=1; i<MAXALPHA-2; ) {
+          alias[i++] = 3;  /* A <-> G */
+          alias[i++] = 2;  /* B <-> C */
+          alias[i++] = 1;  /* C <-> A */
+          alias[i++] = 4;  /* D <-> U */
+        }
+        for (i=1; i<MAXALPHA-2; i++) {
+          pair[i][i+1] = 2;    /* AB <-> GC */
+          i++;
+          pair[i][i-1] = 1;    /* BA <-> CG */
+          i++;
+          pair[i][i+1] = 5;    /* CD <-> AU */
+          i++;
+          pair[i][i-1] = 6;    /* DC <-> UA */
+        }
+      }
+      else vrna_message_error("What energy_set are YOU using??");
+      for (i=0; i<=MAXALPHA; i++) {
+        for (j=0; j<=MAXALPHA; j++)
+          rtype[pair[i][j]] = pair[j][i];
+      }
+   }
+}
+
+static short *encode_sequence(const char *sequence, short how){
+  unsigned int i,l = (unsigned int)strlen(sequence);
+  short         *S = (short *) vrna_alloc(sizeof(short)*(l+2));
+
+  switch(how){
+    /* standard encoding as always used for S */
+    case 0:   for(i=1; i<=l; i++) /* make numerical encoding of sequence */
+                S[i]= (short) encode_char(toupper(sequence[i-1]));
+              S[l+1] = S[1];
+              S[0] = (short) l;
+              break;
+    /* encoding for mismatches of nostandard bases (normally used for S1) */
+    case 1:   for(i=1; i<=l; i++)
+                S[i] = alias[(short) encode_char(toupper(sequence[i-1]))];
+              S[l+1] = S[1];
+              S[0] = S[l];
+              break;
+  }
+
+  return S;
+}
+
+#endif /* VIENNA_RNA_PACKAGE_PAIR_MAT_H */
diff --git a/C/ViennaRNA/params.c b/C/ViennaRNA/params.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/params.c
@@ -0,0 +1,889 @@
+/*
+
+                  c Ivo Hofacker
+
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/params.h"
+/**
+*** \file params.c
+*** <P>
+*** This file provides functions that return temperature scaled energy parameters and
+*** Boltzmann weights packed in datastructures
+*** </P>
+***/
+
+/*------------------------------------------------------------------------*/
+#define SCALE 10
+/**
+*** dangling ends should never be destabilizing, i.e. expdangle>=1<BR>
+*** specific heat needs smooth function (2nd derivative)<BR>
+*** we use a*(sin(x+b)+1)^2, with a=2/(3*sqrt(3)), b=Pi/6-sqrt(3)/2,
+*** in the interval b<x<sqrt(3)/2
+*/
+#define SMOOTH(X) ((X)/SCALE<-1.2283697)?0:(((X)/SCALE>0.8660254)?(X):\
+          SCALE*0.38490018*(sin((X)/SCALE-0.34242663)+1)*(sin((X)/SCALE-0.34242663)+1))
+
+/* #define SMOOTH(X) ((X)<0 ? 0 : (X)) */
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+PRIVATE vrna_param_t p;
+PRIVATE int id=-1;
+/* variables for partition function */
+PRIVATE vrna_exp_param_t pf;
+PRIVATE int pf_id=-1;
+
+#ifdef _OPENMP
+#pragma omp threadprivate(id, pf_id)
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+PRIVATE vrna_param_t      *get_scaled_params(vrna_md_t *md);
+PRIVATE vrna_exp_param_t  *get_scaled_exp_params(vrna_md_t *md, double pfs);
+PRIVATE vrna_exp_param_t  *get_exp_params_ali(vrna_md_t *md, unsigned int n_seq, double pfs);
+PRIVATE void              rescale_params(vrna_fold_compound_t *vc);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC vrna_param_t *
+vrna_params(vrna_md_t *md){
+
+  if(md){
+    return get_scaled_params(md);
+  } else {
+    vrna_md_t md;
+    vrna_md_set_default(&md);
+    return get_scaled_params(&md);
+  }
+}
+
+PUBLIC vrna_exp_param_t *
+vrna_exp_params(vrna_md_t *md){
+
+  if(md){
+    return  get_scaled_exp_params(md, -1.);
+  } else {
+    vrna_md_t md;
+    vrna_md_set_default(&md);
+    return get_scaled_exp_params(&md, -1.);
+  }
+}
+
+PUBLIC vrna_exp_param_t *
+vrna_exp_params_comparative(unsigned int n_seq, vrna_md_t *md){
+
+  if(md){
+    return  get_exp_params_ali(md, n_seq, -1.);
+  } else {
+    vrna_md_t md;
+    vrna_md_set_default(&md);
+    return get_exp_params_ali(&md, n_seq, -1.);
+  }
+}
+
+PUBLIC vrna_param_t *
+vrna_params_copy(vrna_param_t *par){
+
+  vrna_param_t *copy = NULL;
+  if(par){
+    copy = (vrna_param_t *) vrna_alloc(sizeof(vrna_param_t));
+    memcpy(copy, par, sizeof(vrna_param_t));
+  }
+  return copy;
+}
+
+PUBLIC vrna_exp_param_t *
+vrna_exp_params_copy(vrna_exp_param_t *par){
+
+  vrna_exp_param_t *copy = NULL;
+  if(par){
+    copy = (vrna_exp_param_t *) vrna_alloc(sizeof(vrna_exp_param_t));
+    memcpy(copy, par, sizeof(vrna_exp_param_t));
+  }
+  return copy;
+}
+
+PUBLIC void
+vrna_params_subst( vrna_fold_compound_t *vc,
+                    vrna_param_t *parameters){
+
+  if(vc){
+    if(vc->params)
+      free(vc->params);
+    if(parameters){
+      vc->params = vrna_params_copy(parameters);
+    } else {
+      switch(vc->type){
+        case VRNA_FC_TYPE_SINGLE:     /* fall through */
+
+        case VRNA_FC_TYPE_COMPARATIVE:  vc->params = vrna_params(NULL);
+                                      break;
+
+        default:                      break;
+      }
+    }
+  }
+}
+
+PUBLIC void
+vrna_params_reset(vrna_fold_compound_t *vc,
+                  vrna_md_t *md_p){
+
+  if(vc){
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     /* fall through */
+
+      case VRNA_FC_TYPE_COMPARATIVE:  if(vc->params)
+                                      free(vc->params);
+                                    vc->params = vrna_params(md_p);
+                                    break;
+
+      default:                      break;
+    }
+  }
+}
+
+PUBLIC void
+vrna_exp_params_reset(vrna_fold_compound_t *vc,
+                      vrna_md_t *md_p){
+
+  if(vc){
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     /* fall through */
+
+      case VRNA_FC_TYPE_COMPARATIVE:  if(vc->exp_params)
+                                      free(vc->exp_params);
+                                    vc->exp_params = vrna_exp_params(md_p);
+                                    break;
+
+      default:                      break;
+    }
+  }
+}
+
+PUBLIC void
+vrna_exp_params_subst(vrna_fold_compound_t *vc,
+                      vrna_exp_param_t *params){
+
+  if(vc){
+    if(vc->exp_params)
+      free(vc->exp_params);
+    if(params){
+      vc->exp_params = vrna_exp_params_copy(params);
+    } else {
+      switch(vc->type){
+        case VRNA_FC_TYPE_SINGLE:     vc->exp_params = vrna_exp_params(NULL);
+                                      if(vc->cutpoint > 0)
+                                        vc->exp_params->model_details.min_loop_size = 0;
+                                      break;
+
+        case VRNA_FC_TYPE_COMPARATIVE:  vc->exp_params = vrna_exp_params_comparative(vc->n_seq, NULL);
+                                      break;
+
+        default:                      break;
+      }
+    }
+    /* fill additional helper arrays for scaling etc. */
+    vrna_exp_params_rescale(vc, NULL);
+  }
+}
+
+PUBLIC void
+vrna_exp_params_rescale(vrna_fold_compound_t *vc,
+                        double *mfe){
+
+  vrna_exp_param_t  *pf;
+  double            kT;
+  vrna_md_t         *md;
+
+  if(vc){
+    
+    if(!vc->exp_params){
+      switch(vc->type){
+        case VRNA_FC_TYPE_SINGLE:
+          vc->exp_params = vrna_exp_params(&(vc->params->model_details));
+          break;
+        case VRNA_FC_TYPE_COMPARATIVE:
+          vc->exp_params = vrna_exp_params_comparative(vc->n_seq, &(vc->params->model_details));
+          break;
+      }
+    }
+
+    pf = vc->exp_params;
+    if(pf){
+      kT = pf->kT;
+      md = &(pf->model_details);
+
+      if(vc->type == VRNA_FC_TYPE_COMPARATIVE)
+        kT /= vc->n_seq;
+
+      if(mfe){
+        kT /= 1000.;
+        pf->pf_scale = exp(-(md->sfact * *mfe)/ kT / vc->length);
+      } else if(pf->pf_scale < 1.){  /* mean energy for random sequences: 184.3*length cal */
+        pf->pf_scale = exp(-(-185+(pf->temperature-37.)*7.27)/kT);
+      }
+      if(pf->pf_scale < 1.)
+        pf->pf_scale = 1.;
+      rescale_params(vc);
+    }
+  }
+}
+
+/*
+#####################################
+# BEGIN OF STATIC HELPER FUNCTIONS  #
+#####################################
+*/
+
+PRIVATE vrna_param_t *
+get_scaled_params(vrna_md_t *md){
+
+  unsigned int i,j,k,l;
+  double tempf;
+  vrna_param_t *params;
+
+  params  = (vrna_param_t *)vrna_alloc(sizeof(vrna_param_t));
+
+  params->model_details = *md;  /* copy over the model details */
+  params->temperature   = md->temperature;
+  tempf                 = ((params->temperature+K0)/Tmeasure);
+
+  for(i = VRNA_GQUAD_MIN_STACK_SIZE; i <= VRNA_GQUAD_MAX_STACK_SIZE; i++)
+    for(j = 3*VRNA_GQUAD_MIN_LINKER_LENGTH; j <= 3*VRNA_GQUAD_MAX_LINKER_LENGTH; j++){
+      double GQuadAlpha_T = (double)GQuadAlphadH - (double)(GQuadAlphadH - GQuadAlpha37) * tempf;
+      double GQuadBeta_T = (double)GQuadBetadH - (double)(GQuadBetadH - GQuadBeta37) * tempf;
+      params->gquad[i][j] = (int)GQuadAlpha_T*(i-1) + (int)(((double)GQuadBeta_T)*log(j - 2));
+    }
+
+  for (i=0; i<31; i++)
+    params->hairpin[i]  = hairpindH[i] - (hairpindH[i] - hairpin37[i])*tempf;
+  for (i=0; i<=MIN2(30,MAXLOOP); i++) {
+    params->bulge[i]          = bulgedH[i] - (bulgedH[i] - bulge37[i]) * tempf;
+    params->internal_loop[i]  = internal_loopdH[i] - (internal_loopdH[i] - internal_loop37[i]) * tempf;
+  }
+  params->lxc = lxc37*tempf;
+  for (; i<=MAXLOOP; i++) {
+    params->bulge[i] = params->bulge[30]+(int)(params->lxc*log((double)(i)/30.));
+    params->internal_loop[i] = params->internal_loop[30]+(int)(params->lxc*log((double)(i)/30.));
+  }
+
+  params->ninio[2] = niniodH - (niniodH - ninio37) * tempf;
+
+  params->TripleC = TripleCdH - (TripleCdH - TripleC37) * tempf;
+  params->MultipleCA = MultipleCAdH - (MultipleCAdH - MultipleCA37) * tempf;
+  params->MultipleCB = MultipleCBdH - (MultipleCBdH - MultipleCB37) * tempf;
+
+  for (i=0; (i*7)<strlen(Tetraloops); i++)
+    params->Tetraloop_E[i] = TetraloopdH[i] - (TetraloopdH[i]-Tetraloop37[i])*tempf;
+  for (i=0; (i*5)<strlen(Triloops); i++)
+    params->Triloop_E[i] =  TriloopdH[i] - (TriloopdH[i]-Triloop37[i])*tempf;
+  for (i=0; (i*9)<strlen(Hexaloops); i++)
+    params->Hexaloop_E[i] =  HexaloopdH[i] - (HexaloopdH[i]-Hexaloop37[i])*tempf;
+
+  params->TerminalAU = TerminalAUdH - (TerminalAUdH - TerminalAU37) * tempf;
+
+  params->DuplexInit = DuplexInitdH - (DuplexInitdH - DuplexInit37) *tempf;
+
+  params->MLbase = ML_BASEdH - (ML_BASEdH - ML_BASE37) * tempf;
+
+  for (i=0; i<=NBPAIRS; i++)
+    params->MLintern[i] = ML_interndH - (ML_interndH - ML_intern37) * tempf;
+
+  params->MLclosing = ML_closingdH - (ML_closingdH - ML_closing37) * tempf;
+
+
+  /* stacks    G(T) = H - [H - G(T0)]*T/T0 */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      params->stack[i][j] = stackdH[i][j] - (stackdH[i][j] - stack37[i][j])*tempf;
+
+  /* mismatches */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<5; j++)
+      for (k=0; k<5; k++) {
+        int mm;
+        params->mismatchI[i][j][k]    = mismatchIdH[i][j][k] - (mismatchIdH[i][j][k] - mismatchI37[i][j][k])*tempf;
+        params->mismatchH[i][j][k]    = mismatchHdH[i][j][k] - (mismatchHdH[i][j][k] - mismatchH37[i][j][k])*tempf;
+        params->mismatch1nI[i][j][k]  = mismatch1nIdH[i][j][k]-(mismatch1nIdH[i][j][k]-mismatch1nI37[i][j][k])*tempf;/* interior nx1 loops */
+        params->mismatch23I[i][j][k]  = mismatch23IdH[i][j][k]-(mismatch23IdH[i][j][k]-mismatch23I37[i][j][k])*tempf;/* interior 2x3 loops */
+        if(md->dangles){
+          mm                      = mismatchMdH[i][j][k] - (mismatchMdH[i][j][k] - mismatchM37[i][j][k])*tempf;
+          params->mismatchM[i][j][k]    = (mm > 0) ? 0 : mm;
+          mm                      = mismatchExtdH[i][j][k] - (mismatchExtdH[i][j][k] - mismatchExt37[i][j][k])*tempf;
+          params->mismatchExt[i][j][k]  = (mm > 0) ? 0 : mm;
+        }
+        else{
+          params->mismatchM[i][j][k] = params->mismatchExt[i][j][k] = 0;
+        }
+      }
+
+  /* dangles */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<5; j++) {
+      int dd;
+      dd = dangle5_dH[i][j] - (dangle5_dH[i][j] - dangle5_37[i][j])*tempf;
+      params->dangle5[i][j] = (dd>0) ? 0 : dd;  /* must be <= 0 */
+      dd = dangle3_dH[i][j] - (dangle3_dH[i][j] - dangle3_37[i][j])*tempf;
+      params->dangle3[i][j] = (dd>0) ? 0 : dd;  /* must be <= 0 */
+    }
+  /* interior 1x1 loops */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++)
+          params->int11[i][j][k][l] = int11_dH[i][j][k][l] - (int11_dH[i][j][k][l] - int11_37[i][j][k][l])*tempf;
+
+  /* interior 2x1 loops */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          int m;
+          for (m=0; m<5; m++)
+            params->int21[i][j][k][l][m] = int21_dH[i][j][k][l][m] - (int21_dH[i][j][k][l][m] - int21_37[i][j][k][l][m])*tempf;
+        }
+  /* interior 2x2 loops */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          int m,n;
+          for (m=0; m<5; m++)
+            for (n=0; n<5; n++)
+              params->int22[i][j][k][l][m][n] = int22_dH[i][j][k][l][m][n] - (int22_dH[i][j][k][l][m][n]-int22_37[i][j][k][l][m][n])*tempf;
+        }
+
+  strncpy(params->Tetraloops, Tetraloops, 281);
+  strncpy(params->Triloops, Triloops, 241);
+  strncpy(params->Hexaloops, Hexaloops, 361);
+
+  params->id = ++id;
+  return params;
+}
+
+PRIVATE vrna_exp_param_t *
+get_scaled_exp_params(vrna_md_t *md,
+                      double pfs){
+
+  unsigned  int i, j, k, l;
+  double        kT, TT;
+  double        GT;
+  vrna_exp_param_t     *pf;
+
+  pf                = (vrna_exp_param_t *)vrna_alloc(sizeof(vrna_exp_param_t));
+  pf->model_details = *md;
+  pf->temperature   = md->temperature;
+  pf->alpha         = md->betaScale;
+  pf->kT = kT       = md->betaScale * (md->temperature + K0) * GASCONST;   /* kT in cal/mol  */
+  pf->pf_scale      = pfs;
+  TT                = (md->temperature + K0) / (Tmeasure);
+
+  for(i = VRNA_GQUAD_MIN_STACK_SIZE; i <= VRNA_GQUAD_MAX_STACK_SIZE; i++)
+    for(j = 3*VRNA_GQUAD_MIN_LINKER_LENGTH; j <= 3*VRNA_GQUAD_MAX_LINKER_LENGTH; j++){
+      double GQuadAlpha_T = (double)GQuadAlphadH - (double)(GQuadAlphadH - GQuadAlpha37) * TT;
+      double GQuadBeta_T = (double)GQuadBetadH - (double)(GQuadBetadH - GQuadBeta37) * TT;
+      GT = ((double)GQuadAlpha_T)*((double)(i-1)) + ((double)GQuadBeta_T)*log(((double)j) - 2.);
+      pf->expgquad[i][j] = exp( -GT*10./kT);
+    }
+
+  /* loop energies: hairpins, bulges, interior, mulit-loops */
+  for (i=0; i<31; i++){
+    GT  = hairpindH[i] - (hairpindH[i] - hairpin37[i])*TT;
+    pf->exphairpin[i] = exp( -GT*10./kT);
+  }
+
+  for (i=0; i<=MIN2(30, MAXLOOP); i++) {
+    GT =  bulgedH[i]- (bulgedH[i] - bulge37[i])*TT;
+    pf->expbulge[i] = exp( -GT*10./kT);
+    GT =  internal_loopdH[i] - (internal_loopdH[i] - internal_loop37[i])*TT;
+    pf->expinternal[i] = exp( -GT*10./kT);
+  }
+  /* special case of size 2 interior loops (single mismatch) */
+  if (james_rule) pf->expinternal[2] = exp ( -80*10./kT);
+
+  pf->lxc = lxc37*TT;
+
+  GT =  DuplexInitdH - (DuplexInitdH - DuplexInit37)*TT;
+  pf->expDuplexInit = exp( -GT*10./kT);
+
+  for (i=31; i<=MAXLOOP; i++) {
+    GT = bulge37[30]*TT + (pf->lxc*log( i/30.));
+    pf->expbulge[i] = exp( -GT*10./kT);
+    GT = internal_loop37[30]*TT + (pf->lxc*log( i/30.));
+    pf->expinternal[i] = exp( -GT*10./kT);
+  }
+
+  GT = niniodH - (niniodH - ninio37)*TT;
+  for (j=0; j<=MAXLOOP; j++)
+      pf->expninio[2][j]=exp(-MIN2(MAX_NINIO,j*GT)*10./kT);
+
+  for (i=0; (i*7)<strlen(Tetraloops); i++) {
+    GT = TetraloopdH[i] - (TetraloopdH[i]-Tetraloop37[i])*TT;
+    pf->exptetra[i] = exp( -GT*10./kT);
+  }
+  for (i=0; (i*5)<strlen(Triloops); i++) {
+    GT = TriloopdH[i] - (TriloopdH[i]-Triloop37[i])*TT;
+    pf->exptri[i] = exp( -GT*10./kT);
+  }
+  for (i=0; (i*9)<strlen(Hexaloops); i++) {
+    GT = HexaloopdH[i] - (HexaloopdH[i]-Hexaloop37[i])*TT;
+    pf->exphex[i] = exp( -GT*10./kT);
+  }
+  GT =  ML_closingdH - (ML_closingdH - ML_closing37)*TT;
+  pf->expMLclosing = exp( -GT*10./kT);
+
+  for (i=0; i<=NBPAIRS; i++) {
+    GT =  ML_interndH - (ML_interndH - ML_intern37)*TT;
+    /* if (i>2) GT += TerminalAU; */
+    pf->expMLintern[i] = exp( -GT*10./kT);
+  }
+  GT = TerminalAUdH - (TerminalAUdH - TerminalAU37)*TT;
+  pf->expTermAU = exp(-GT*10./kT);
+
+  GT = ML_BASEdH - (ML_BASEdH - ML_BASE37)*TT;
+
+  pf->expMLbase=exp(-10.*GT/kT);
+
+
+  /* if dangles==0 just set their energy to 0,
+     don't let dangle energies become > 0 (at large temps),
+     but make sure go smoothly to 0                        */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=4; j++) {
+      if (md->dangles) {
+        GT = dangle5_dH[i][j] - (dangle5_dH[i][j] - dangle5_37[i][j])*TT;
+        pf->expdangle5[i][j] = exp(SMOOTH(-GT)*10./kT);
+        GT = dangle3_dH[i][j] - (dangle3_dH[i][j] - dangle3_37[i][j])*TT;
+        pf->expdangle3[i][j] =  exp(SMOOTH(-GT)*10./kT);
+      } else
+        pf->expdangle3[i][j] = pf->expdangle5[i][j] = 1;
+    }
+
+  /* stacking energies */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++) {
+      GT =  stackdH[i][j] - (stackdH[i][j] - stack37[i][j])*TT;
+      pf->expstack[i][j] = exp( -GT*10./kT);
+    }
+
+  /* mismatch energies */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<5; j++)
+      for (k=0; k<5; k++) {
+        GT =  mismatchIdH[i][j][k] - ( mismatchIdH[i][j][k] - mismatchI37[i][j][k])*TT;
+        pf->expmismatchI[i][j][k] = exp(-GT*10.0/kT);
+        GT = mismatch1nIdH[i][j][k] - (mismatch1nIdH[i][j][k] - mismatch1nI37[i][j][k])*TT;
+        pf->expmismatch1nI[i][j][k] = exp(-GT*10.0/kT);
+        GT = mismatchHdH[i][j][k] - (mismatchHdH[i][j][k] - mismatchH37[i][j][k])*TT;
+        pf->expmismatchH[i][j][k] = exp(-GT*10.0/kT);
+        if (md->dangles) {
+          GT = mismatchMdH[i][j][k] - (mismatchMdH[i][j][k] - mismatchM37[i][j][k])*TT;
+          pf->expmismatchM[i][j][k] = exp(SMOOTH(-GT)*10.0/kT);
+          GT = mismatchExtdH[i][j][k] - (mismatchExtdH[i][j][k] - mismatchExt37[i][j][k])*TT;
+          pf->expmismatchExt[i][j][k] = exp(SMOOTH(-GT)*10.0/kT);
+        }
+        else{
+          pf->expmismatchM[i][j][k] = pf->expmismatchExt[i][j][k] = 1.;
+        }
+        GT = mismatch23IdH[i][j][k] - (mismatch23IdH[i][j][k] - mismatch23I37[i][j][k])*TT;
+        pf->expmismatch23I[i][j][k] = exp(-GT*10.0/kT);
+      }
+
+  /* interior lops of length 2 */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          GT = int11_dH[i][j][k][l] -
+            (int11_dH[i][j][k][l] - int11_37[i][j][k][l])*TT;
+          pf->expint11[i][j][k][l] = exp(-GT*10./kT);
+        }
+  /* interior 2x1 loops */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          int m;
+          for (m=0; m<5; m++) {
+            GT = int21_dH[i][j][k][l][m] -
+              (int21_dH[i][j][k][l][m] - int21_37[i][j][k][l][m])*TT;
+            pf->expint21[i][j][k][l][m] = exp(-GT*10./kT);
+          }
+        }
+
+  /* interior 2x2 loops */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          int m,n;
+          for (m=0; m<5; m++)
+            for (n=0; n<5; n++) {
+              GT = int22_dH[i][j][k][l][m][n] -
+                (int22_dH[i][j][k][l][m][n]-int22_37[i][j][k][l][m][n])*TT;
+              pf->expint22[i][j][k][l][m][n] = exp(-GT*10./kT);
+            }
+        }
+
+  strncpy(pf->Tetraloops, Tetraloops, 281);
+  strncpy(pf->Triloops, Triloops, 241);
+  strncpy(pf->Hexaloops, Hexaloops, 361);
+
+  return pf;
+}
+
+PRIVATE vrna_exp_param_t *
+get_exp_params_ali( vrna_md_t *md,
+                    unsigned int n_seq,
+                    double pfs){
+
+  /* scale energy parameters and pre-calculate Boltzmann weights */
+  unsigned int  i, j, k, l;
+  double        kTn, TT;
+  double        GT;
+  vrna_exp_param_t     *pf;
+
+  pf                = (vrna_exp_param_t *)vrna_alloc(sizeof(vrna_exp_param_t));
+  pf->model_details = *md;
+  pf->alpha         = md->betaScale;
+  pf->temperature   = md->temperature;
+  pf->pf_scale      = pfs;
+  pf->kT = kTn      = ((double)n_seq)*md->betaScale*(md->temperature+K0)*GASCONST;   /* kT in cal/mol  */
+  TT                = (md->temperature+K0)/(Tmeasure);
+
+
+   /* loop energies: hairpins, bulges, interior, mulit-loops */
+  for (i=0; i<31; i++) {
+    GT =  hairpindH[i] - (hairpindH[i] - hairpin37[i])*TT;
+    pf->exphairpin[i] = exp( -GT*10./kTn);
+  }
+  /*add penalty for too short hairpins*/
+  for (i=0; i<3; i++) {
+    GT= 600/*Penalty*/*TT;
+    pf->exphairpin[i] = exp( -GT*10./kTn);
+  }
+
+  for (i=0; i<=MIN2(30, MAXLOOP); i++) {
+    GT =  bulgedH[i]- (bulgedH[i] - bulge37[i])*TT;
+    pf->expbulge[i] = exp( -GT*10./kTn);
+    GT =  internal_loopdH[i] - (internal_loopdH[i] - internal_loop37[i])*TT;
+    pf->expinternal[i] = exp( -GT*10./kTn);
+  }
+  /* special case of size 2 interior loops (single mismatch) */
+  if (james_rule) pf->expinternal[2] = exp ( -80*10./kTn);
+
+  pf->lxc = lxc37*TT;
+
+  GT =  DuplexInitdH - (DuplexInitdH - DuplexInit37)*TT;
+  pf->expDuplexInit = exp( -GT*10./kTn);
+
+  for (i=31; i<=MAXLOOP; i++) {
+    GT = bulge37[30]*TT + (pf->lxc*log( i/30.));
+    pf->expbulge[i] = exp( -GT*10./kTn);
+    GT = internal_loop37[30]*TT + (pf->lxc*log( i/30.));
+    pf->expinternal[i] = exp( -GT*10./kTn);
+  }
+
+  GT = niniodH - (niniodH - ninio37)*TT;
+  for (j=0; j<=MAXLOOP; j++)
+    pf->expninio[2][j]=exp(-MIN2(MAX_NINIO,j*GT)*10./kTn);
+
+  for (i=0; (i*7)<strlen(Tetraloops); i++) {
+    GT = TetraloopdH[i] - (TetraloopdH[i]-Tetraloop37[i])*TT;
+    pf->exptetra[i] = exp( -GT*10./kTn);
+  }
+  for (i=0; (i*5)<strlen(Triloops); i++) {
+    GT = TriloopdH[i] - (TriloopdH[i]-Triloop37[i])*TT;
+    pf->exptri[i] = exp( -GT*10./kTn);
+  }
+  for (i=0; (i*9)<strlen(Hexaloops); i++) {
+    GT = HexaloopdH[i] - (HexaloopdH[i]-Hexaloop37[i])*TT;
+    pf->exphex[i] = exp( -GT*10./kTn);
+  }
+  GT =  ML_closingdH - (ML_closingdH - ML_closing37)*TT;
+  pf->expMLclosing = exp( -GT*10./kTn);
+
+  for (i=0; i<=NBPAIRS; i++) { /* includes AU penalty */
+    GT =  ML_interndH - (ML_interndH - ML_intern37)*TT;
+    /* if (i>2) GT += TerminalAU; */
+    pf->expMLintern[i] = exp( -GT*10./kTn);
+  }
+  GT = TerminalAUdH - (TerminalAUdH - TerminalAU37)*TT;
+  pf->expTermAU = exp(-GT*10./kTn);
+
+  GT = ML_BASEdH - (ML_BASEdH - ML_BASE37)*TT;
+  pf->expMLbase=exp(-10.*GT/(kTn/n_seq));
+
+
+  /* if dangle_model==0 just set their energy to 0,
+     don't let dangle energies become > 0 (at large temps),
+     but make sure go smoothly to 0                        */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=4; j++) {
+      if (md->dangles) {
+        GT = dangle5_dH[i][j] - (dangle5_dH[i][j] - dangle5_37[i][j])*TT;
+        pf->expdangle5[i][j] = exp(SMOOTH(-GT)*10./kTn);
+        GT = dangle3_dH[i][j] - (dangle3_dH[i][j] - dangle3_37[i][j])*TT;
+        pf->expdangle3[i][j] =  exp(SMOOTH(-GT)*10./kTn);
+      } else
+        pf->expdangle3[i][j] = pf->expdangle5[i][j] = 1;
+    }
+
+  /* stacking energies */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++) {
+      GT =  stackdH[i][j] - (stackdH[i][j] - stack37[i][j])*TT;
+      pf->expstack[i][j] = exp( -GT*10./kTn);
+    }
+
+  /* mismatch energies */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<5; j++)
+      for (k=0; k<5; k++) {
+        GT =  mismatchIdH[i][j][k] - ( mismatchIdH[i][j][k] - mismatchI37[i][j][k])*TT;
+        pf->expmismatchI[i][j][k] = exp(-GT*10.0/kTn);
+        GT = mismatch1nIdH[i][j][k] - (mismatch1nIdH[i][j][k] - mismatch1nI37[i][j][k])*TT;
+        pf->expmismatch1nI[i][j][k] = exp(-GT*10.0/kTn);
+        GT = mismatchHdH[i][j][k] - (mismatchHdH[i][j][k] - mismatchH37[i][j][k])*TT;
+        pf->expmismatchH[i][j][k] = exp(-GT*10.0/kTn);
+        if (md->dangles) {
+          GT = mismatchMdH[i][j][k] - (mismatchMdH[i][j][k] - mismatchM37[i][j][k])*TT;
+          pf->expmismatchM[i][j][k] = exp(SMOOTH(-GT)*10.0/kTn);
+          GT = mismatchExtdH[i][j][k] - (mismatchExtdH[i][j][k] - mismatchExt37[i][j][k])*TT;
+          pf->expmismatchExt[i][j][k] = exp(SMOOTH(-GT)*10.0/kTn);
+        }
+        else{
+          pf->expmismatchM[i][j][k] = pf->expmismatchExt[i][j][k] = 1.;
+        }
+        GT = mismatch23IdH[i][j][k] - (mismatch23IdH[i][j][k] - mismatch23I37[i][j][k])*TT;
+        pf->expmismatch23I[i][j][k] = exp(-GT*10.0/kTn);
+      }
+
+
+  /* interior lops of length 2 */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          GT = int11_dH[i][j][k][l] -
+            (int11_dH[i][j][k][l] - int11_37[i][j][k][l])*TT;
+          pf->expint11[i][j][k][l] = exp(-GT*10./kTn);
+        }
+  /* interior 2x1 loops */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          int m;
+          for (m=0; m<5; m++) {
+            GT = int21_dH[i][j][k][l][m] -
+              (int21_dH[i][j][k][l][m] - int21_37[i][j][k][l][m])*TT;
+            pf->expint21[i][j][k][l][m] = exp(-GT*10./kTn);
+          }
+        }
+
+  /* interior 2x2 loops */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          int m,n;
+          for (m=0; m<5; m++)
+            for (n=0; n<5; n++) {
+              GT = int22_dH[i][j][k][l][m][n] -
+                (int22_dH[i][j][k][l][m][n]-int22_37[i][j][k][l][m][n])*TT;
+              pf->expint22[i][j][k][l][m][n] = exp(-GT*10./kTn);
+            }
+        }
+
+  strncpy(pf->Tetraloops, Tetraloops, 281);
+  strncpy(pf->Triloops, Triloops, 241);
+  strncpy(pf->Hexaloops, Hexaloops, 361);
+
+  return pf;
+}
+
+PRIVATE void
+rescale_params(vrna_fold_compound_t *vc){
+
+  int           i;
+  vrna_exp_param_t  *pf = vc->exp_params;
+  vrna_mx_pf_t      *m  = vc->exp_matrices;
+
+  if(m && pf){
+    m->scale[0] = 1.;
+    m->scale[1] = (FLT_OR_DBL)(1./pf->pf_scale);
+    m->expMLbase[0] = 1;
+    m->expMLbase[1] = (FLT_OR_DBL)(pf->expMLbase / pf->pf_scale);
+    for (i=2; i<=vc->length; i++) {
+      m->scale[i] = m->scale[i/2]*m->scale[i-(i/2)];
+      m->expMLbase[i] = (FLT_OR_DBL)pow(pf->expMLbase, (double)i) * m->scale[i];
+    }
+  }
+}
+
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC vrna_param_t *
+scale_parameters(void){
+
+  vrna_md_t md;
+  set_model_details(&md);
+  return vrna_params(&md);
+}
+
+PUBLIC vrna_param_t *
+get_scaled_parameters(double temp,
+                      vrna_md_t md){
+
+  md.temperature = temp;
+  return get_scaled_params(&md);
+}
+
+PUBLIC vrna_exp_param_t *
+get_boltzmann_factors(double temp,
+                      double betaScale,
+                      vrna_md_t md,
+                      double pfs){
+
+  md.temperature  = temp;
+  md.betaScale    = betaScale;
+  pf_scale        = pfs;
+
+  return get_scaled_exp_params(&md, pfs);
+}
+
+PUBLIC vrna_exp_param_t *
+get_scaled_pf_parameters(void){
+
+  vrna_md_t         md;
+  vrna_exp_param_t  *pf;
+
+  set_model_details(&md);
+
+  pf = vrna_exp_params(&md);
+  pf->pf_scale = pf_scale;
+
+  return pf;
+}
+
+PUBLIC vrna_exp_param_t *
+get_boltzmann_factors_ali(unsigned int n_seq,
+                         double temp,
+                         double betaScale,
+                         vrna_md_t md,
+                         double pfs){
+
+  md.temperature  = temp;
+  md.betaScale    = betaScale;
+  pf_scale        = pfs;
+
+  return get_exp_params_ali(&md, n_seq, pfs);
+  
+}
+
+PUBLIC vrna_exp_param_t *
+get_scaled_alipf_parameters(unsigned int n_seq){
+
+  vrna_md_t  md;
+
+  set_model_details(&md);
+
+  return get_exp_params_ali(&md, n_seq, pf_scale);
+}
+
+PUBLIC vrna_exp_param_t *
+get_boltzmann_factor_copy(vrna_exp_param_t *par){
+
+  return vrna_exp_params_copy(par);
+}
+
+PUBLIC vrna_param_t *get_parameter_copy(vrna_param_t *par){
+
+  return vrna_params_copy(par);
+}
+
+PUBLIC vrna_param_t *copy_parameters(void){
+  vrna_param_t *copy;
+  if (p.id != id){
+    vrna_md_t md;
+    set_model_details(&md);
+    return vrna_params(&md);
+  } else {
+    copy = (vrna_param_t *) vrna_alloc(sizeof(vrna_param_t));
+    memcpy(copy, &p, sizeof(vrna_param_t));
+  }
+  return copy;
+}
+
+PUBLIC vrna_param_t *set_parameters(vrna_param_t *dest){
+  memcpy(&p, dest, sizeof(vrna_param_t));
+  return &p;
+}
+
+PUBLIC vrna_exp_param_t *copy_pf_param(void){
+  vrna_exp_param_t *copy;
+  if (pf.id != pf_id){
+    vrna_md_t md;
+    set_model_details(&md);
+    copy = vrna_exp_params(&md);
+    copy->pf_scale = pf_scale;
+    return copy;
+  }
+  else{
+    copy = (vrna_exp_param_t *) vrna_alloc(sizeof(vrna_exp_param_t));
+    memcpy(copy, &pf, sizeof(vrna_exp_param_t));
+  }
+  return copy;
+}
+
+PUBLIC vrna_exp_param_t *set_pf_param(vrna_param_t *dest){
+  memcpy(&pf, dest, sizeof(vrna_exp_param_t));
+  return &pf;
+}
+
+PUBLIC vrna_exp_param_t *scale_pf_parameters(void){
+  vrna_md_t         md;
+  vrna_exp_param_t  *pf;
+
+  set_model_details(&md);
+
+  pf = vrna_exp_params(&md);
+  pf->pf_scale = pf_scale;
+
+  return pf;
+}
+
+#endif
+
diff --git a/C/ViennaRNA/params.h b/C/ViennaRNA/params.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/params.h
@@ -0,0 +1,479 @@
+#ifndef VIENNA_RNA_PACKAGE_PARAMS_H
+#define VIENNA_RNA_PACKAGE_PARAMS_H
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file     params.h
+ *  @ingroup  energy_parameters
+ *  @brief    Functions to deal with sets of energy parameters
+ */
+
+/**
+ *  @addtogroup energy_parameters
+ *  @brief All relevant functions to retrieve and copy pre-calculated energy parameter sets as well as
+ *  reading/writing the energy parameter set from/to file(s).
+ *
+ *  This module covers all relevant functions for pre-calculation of the energy parameters
+ *  necessary for the folding routines provided by RNAlib. Furthermore, the energy parameter set
+ *  in the RNAlib can be easily exchanged by a user-defined one. It is also possible to write the
+ *  current energy parameter set into a text file.
+ *  @{
+ *  @ingroup  energy_parameters
+ */
+
+/** @brief Typename for the free energy parameter data structure #vrna_params */
+typedef struct  vrna_param_s       vrna_param_t;
+/** @brief Typename for the Boltzmann factor data structure #vrna_exp_params */
+typedef struct  vrna_exp_param_s   vrna_exp_param_t;
+
+#include <ViennaRNA/energy_const.h>
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/model.h>
+
+#define   VRNA_GQUAD_MAX_STACK_SIZE     7
+#define   VRNA_GQUAD_MIN_STACK_SIZE     2
+#define   VRNA_GQUAD_MAX_LINKER_LENGTH  15
+#define   VRNA_GQUAD_MIN_LINKER_LENGTH  1
+#define   VRNA_GQUAD_MIN_BOX_SIZE       ((4*VRNA_GQUAD_MIN_STACK_SIZE)+(3*VRNA_GQUAD_MIN_LINKER_LENGTH))
+#define   VRNA_GQUAD_MAX_BOX_SIZE       ((4*VRNA_GQUAD_MAX_STACK_SIZE)+(3*VRNA_GQUAD_MAX_LINKER_LENGTH))
+
+/**
+ *  @brief The datastructure that contains temperature scaled energy parameters.
+ */
+struct vrna_param_s {
+  int     id;
+  int     stack[NBPAIRS+1][NBPAIRS+1];
+  int     hairpin[31];
+  int     bulge[MAXLOOP+1];
+  int     internal_loop[MAXLOOP+1];
+  int     mismatchExt[NBPAIRS+1][5][5];
+  int     mismatchI[NBPAIRS+1][5][5];
+  int     mismatch1nI[NBPAIRS+1][5][5];
+  int     mismatch23I[NBPAIRS+1][5][5];
+  int     mismatchH[NBPAIRS+1][5][5];
+  int     mismatchM[NBPAIRS+1][5][5];
+  int     dangle5[NBPAIRS+1][5];
+  int     dangle3[NBPAIRS+1][5];
+  int     int11[NBPAIRS+1][NBPAIRS+1][5][5];
+  int     int21[NBPAIRS+1][NBPAIRS+1][5][5][5];
+  int     int22[NBPAIRS+1][NBPAIRS+1][5][5][5][5];
+  int     ninio[5];
+  double  lxc;
+  int     MLbase;
+  int     MLintern[NBPAIRS+1];
+  int     MLclosing;
+  int     TerminalAU;
+  int     DuplexInit;
+  int     Tetraloop_E[200];
+  char    Tetraloops[1401];
+  int     Triloop_E[40];
+  char    Triloops[241];
+  int     Hexaloop_E[40];
+  char    Hexaloops[1801];
+  int     TripleC;
+  int     MultipleCA;
+  int     MultipleCB;
+  int     gquad [VRNA_GQUAD_MAX_STACK_SIZE + 1]
+                [3*VRNA_GQUAD_MAX_LINKER_LENGTH + 1];
+
+  double  temperature;            /**<  @brief  Temperature used for loop contribution scaling */
+
+  vrna_md_t model_details;   /**<  @brief  Model details to be used in the recursions */
+};
+
+/**
+ *  @brief  The data structure that contains temperature scaled Boltzmann weights of the energy parameters.
+ */
+struct vrna_exp_param_s {
+  int     id;   /**<  @brief  An identifier for the data structure
+                      @deprecated This attribute will be removed in version 3
+                */
+  double  expstack[NBPAIRS+1][NBPAIRS+1];
+  double  exphairpin[31];
+  double  expbulge[MAXLOOP+1];
+  double  expinternal[MAXLOOP+1];
+  double  expmismatchExt[NBPAIRS+1][5][5];
+  double  expmismatchI[NBPAIRS+1][5][5];
+  double  expmismatch23I[NBPAIRS+1][5][5];
+  double  expmismatch1nI[NBPAIRS+1][5][5];
+  double  expmismatchH[NBPAIRS+1][5][5];
+  double  expmismatchM[NBPAIRS+1][5][5];
+  double  expdangle5[NBPAIRS+1][5];
+  double  expdangle3[NBPAIRS+1][5];
+  double  expint11[NBPAIRS+1][NBPAIRS+1][5][5];
+  double  expint21[NBPAIRS+1][NBPAIRS+1][5][5][5];
+  double  expint22[NBPAIRS+1][NBPAIRS+1][5][5][5][5];
+  double  expninio[5][MAXLOOP+1];
+  double  lxc;
+  double  expMLbase;
+  double  expMLintern[NBPAIRS+1];
+  double  expMLclosing;
+  double  expTermAU;
+  double  expDuplexInit;
+  double  exptetra[40];
+  double  exptri[40];
+  double  exphex[40];
+  char    Tetraloops[1401];
+  double  expTriloop[40];
+  char    Triloops[241];
+  char    Hexaloops[1801];
+  double  expTripleC;
+  double  expMultipleCA;
+  double  expMultipleCB;
+  double  expgquad[VRNA_GQUAD_MAX_STACK_SIZE + 1]
+                  [3*VRNA_GQUAD_MAX_LINKER_LENGTH + 1];
+
+  double  kT;
+  double  pf_scale;     /**<  @brief    Scaling factor to avoid over-/underflows */
+
+  double  temperature;  /**<  @brief    Temperature used for loop contribution scaling */
+  double  alpha;        /**<  @brief    Scaling factor for the thermodynamic temperature
+                              @details  This allows for temperature scaling in Boltzmann
+                                        factors independently from the energy contributions.
+                                        The resulting Boltzmann factors are then computed by
+                                        @f$ e^{-E/(\alpha \cdot K \cdot T)} @f$
+                        */
+
+  vrna_md_t model_details; /**<  @brief  Model details to be used in the recursions */
+
+};
+
+
+/**
+ *  @brief  Get a data structure containing prescaled free energy parameters
+ *
+ *  If a NULL pointer is passed for the model details parameter, the default
+ *  model parameters are stored within the requested #vrna_param_t structure.
+ *
+ *  @see #vrna_md_t, vrna_md_set_default(), vrna_exp_params()
+ *
+ *  @param  md  A pointer to the model details to store inside the structure (Maybe NULL)
+ *  @return     A pointer to the memory location where the requested parameters are stored
+ */
+vrna_param_t *
+vrna_params(vrna_md_t *md);
+
+/**
+ *  @brief Get a copy of the provided free energy parameters
+ *
+ *  If NULL is passed as parameter, a default set of energy parameters is created
+ *  and returned.
+ *
+ *  @see vrna_params(), #vrna_param_t
+ *
+ *  @param  par   The free energy parameters that are to be copied (Maybe NULL)
+ *  @return       A copy or a default set of the (provided) parameters
+ */
+vrna_param_t *
+vrna_params_copy(vrna_param_t *par);
+
+/**
+ *  @brief  Get a data structure containing prescaled free energy parameters
+ *          already transformed to Boltzmann factors
+ *
+ *  This function returns a data structure that contains all necessary precomputed
+ *  energy contributions for each type of loop.
+ *
+ *  In contrast to vrna_params(), the free energies within this data structure
+ *  are stored as their Boltzmann factors, i.e.
+ *
+ *  @f$ exp(-E / kT) @f$
+ *
+ *  where @f$ E @f$ is the free energy.
+ *
+ *  If a NULL pointer is passed for the model details parameter, the default
+ *  model parameters are stored within the requested #vrna_exp_param_t structure.
+ *
+ *  @see #vrna_md_t, vrna_md_set_default(), vrna_params(), vrna_rescale_pf_params()
+ *
+ *  @param  md  A pointer to the model details to store inside the structure (Maybe NULL)
+ *  @return     A pointer to the memory location where the requested parameters are stored
+ */
+vrna_exp_param_t *
+vrna_exp_params(vrna_md_t *md);
+
+/**
+ *  @brief  Get a data structure containing prescaled free energy parameters
+ *          already transformed to Boltzmann factors (alifold version)
+ *
+ *  If a NULL pointer is passed for the model details parameter, the default
+ *  model parameters are stored within the requested #vrna_exp_param_t structure.
+ *
+ *  @see #vrna_md_t, vrna_md_set_default(), vrna_exp_params(), vrna_params()
+ *
+ *  @param  n_seq   The number of sequences in the alignment
+ *  @param  md      A pointer to the model details to store inside the structure (Maybe NULL)
+ *  @return         A pointer to the memory location where the requested parameters are stored
+ */
+vrna_exp_param_t *
+vrna_exp_params_comparative(unsigned int n_seq,
+                            vrna_md_t *md);
+
+/**
+ *  @brief Get a copy of the provided free energy parameters (provided as Boltzmann factors)
+ *
+ *  If NULL is passed as parameter, a default set of energy parameters is created
+ *  and returned.
+ *
+ *  @see vrna_exp_params(), #vrna_exp_param_t
+ *
+ *  @param  par   The free energy parameters that are to be copied (Maybe NULL)
+ *  @return       A copy or a default set of the (provided) parameters
+ */
+vrna_exp_param_t *
+vrna_exp_params_copy(vrna_exp_param_t *par);
+
+/**
+ *  @brief  Update/Reset energy parameters data structure within a #vrna_fold_compound_t
+ *
+ *  Passing NULL as second argument leads to a reset of the energy parameters within
+ *  vc to their default values. Otherwise, the energy parameters provided will be copied
+ *  over into vc.
+ *
+ *  @see vrna_params_reset(), #vrna_param_t, #vrna_md_t, vrna_params()
+ *
+ *  @param  vc    The #vrna_fold_compound_t that is about to receive updated energy parameters
+ *  @param  par   The energy parameters used to substitute those within vc (Maybe NULL)
+ */
+void
+vrna_params_subst( vrna_fold_compound_t *vc,
+                    vrna_param_t *par);
+
+/**
+ *  @brief Update the energy parameters for subsequent partition function computations
+ *
+ *  This function can be used to properly assign new energy parameters for partition
+ *  function computations to a #vrna_fold_compound_t. For this purpose, the data of the
+ *  provided pointer `params`  will be copied into `vc` and a recomputation of the partition
+ *  function scaling factor is issued, if the `pf_scale` attribute of `params` is less than `1.0`.
+ *
+ *  Passing NULL as second argument leads to a reset of the energy parameters within
+ *  vc to their default values
+ *
+ *  @see vrna_exp_params_reset(), vrna_exp_params_rescale(), #vrna_exp_param_t, #vrna_md_t,
+ *  vrna_exp_params()
+ *
+ *  @param  vc      The fold compound data structure
+ *  @param  params  A pointer to the new energy parameters
+ */
+void
+vrna_exp_params_subst(vrna_fold_compound_t *vc,
+                      vrna_exp_param_t *params);
+
+/**
+ *  @brief Rescale Boltzmann factors for partition function computations
+ *
+ *  This function may be used to (automatically) rescale the Boltzmann factors used
+ *  in partition function computations. Since partition functions over subsequences
+ *  can easily become extremely large, the RNAlib internally rescales them to avoid
+ *  numerical over- and/or underflow. Therefore, a proper scaling factor @f$s@f$ needs to
+ *  be chosen that in turn is then used to normalize the corresponding
+ *  partition functions @f$\hat{q}[i,j] = q[i,j] / s^{(j-i+1)}@f$.
+ *
+ *  This function provides two ways to automatically adjust the scaling
+ *  factor.
+ *  1. Automatic guess
+ *  2. Automatic adjustment according to MFE
+ *
+ *  Passing `NULL` as second parameter activates the _automatic guess mode_. Here,
+ *  the scaling factor is recomputed according to a mean free energy of `184.3*length` cal
+ *  for random sequences.
+ *  @note This recomputation only takes place if the `pf_scale` attribute of the
+ *  `exp_params` data structure contained in `vc` has a value below `1.0`.
+ *
+ *  On the other hand, if the MFE for a sequence is known, it can be used to recompute
+ *  a more robust scaling factor, since it represents the lowest free energy of the entire
+ *  ensemble of structures, i.e. the highest Boltzmann factor. To activate this second
+ *  mode of _automatic adjustment according to MFE_, a pointer to the MFE value needs to
+ *  be passed as second argument. This value is then taken to compute the scaling factor
+ *  as @f$ s = exp((sfact * MFE) / kT / length )@f$, where sfact is an additional
+ *  scaling weight located in the vrna_md_t data structure of `exp_params` in `vc`.
+ *
+ *  The computed scaling factor @f$s@f$ will be stored as `pf_scale` attribute of the
+ *  `exp_params` data structure in `vc`.
+ *
+ *  @see vrna_exp_params_subst(), vrna_md_t, vrna_exp_param_t, #vrna_fold_compound_t
+ *
+ *  @param  vc  The fold compound data structure
+ *  @param  mfe A pointer to the MFE (in kcal/mol) or NULL
+ */
+void
+vrna_exp_params_rescale(vrna_fold_compound_t *vc,
+                        double *mfe);
+
+/**
+ *  @brief  Reset free energy parameters within a #vrna_fold_compound_t
+ *          according to provided, or default model details
+ *
+ *  This function allows one to rescale free energy parameters for subsequent structure
+ *  prediction or evaluation according to a set of model details, e.g. temperature
+ *  values. To do so, the caller provides either a pointer to a set of model details
+ *  to be used for rescaling, or NULL if global default setting should be used.
+ *
+ *  @see vrna_exp_params_reset(), vrna_params_subs()
+ *  @param  vc    The fold compound data structure
+ *  @param  md_p  A pointer to the new model details (or NULL for reset to defaults)
+ */
+void vrna_params_reset( vrna_fold_compound_t *vc,
+                        vrna_md_t *md_p);
+
+/**
+ *  @brief  Reset Boltzmann factors for partition function computations
+ *          within a #vrna_fold_compound_t according to provided, or
+ *          default model details
+ *
+ *  This function allows one to rescale Boltzmann factors for subsequent partition
+ *  function computations according to a set of model details, e.g. temperature
+ *  values. To do so, the caller provides either a pointer to a set of model details
+ *  to be used for rescaling, or NULL if global default setting should be used.
+ *
+ *  @see vrna_params_reset(), vrna_exp_params_subst(), vrna_exp_params_rescale()
+ *  @param  vc    The fold compound data structure
+ *  @param  md_p  A pointer to the new model details (or NULL for reset to defaults)
+ */
+void vrna_exp_params_reset( vrna_fold_compound_t *vc,
+                            vrna_md_t *md_p);
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief Old typename of #vrna_param_s
+ *  @deprecated Use #vrna_param_t instead!
+*/
+typedef struct vrna_param_s     paramT;
+
+/**
+ *  @brief Old typename of #vrna_exp_param_s
+ *  @deprecated Use #vrna_exp_param_t instead!
+*/
+typedef struct vrna_exp_param_s pf_paramT;
+
+DEPRECATED(vrna_param_t *get_parameter_copy(vrna_param_t *par));
+
+/**
+ *  get a data structure of type @ref vrna_exp_param_t which contains
+ *  the Boltzmann weights of several energy parameters scaled
+ *  according to the current temperature
+ *
+ *  @deprecated Use vrna_exp_params() instead!
+ *
+ *  @return The data structure containing Boltzmann weights for use in partition function calculations
+ */
+DEPRECATED(vrna_exp_param_t *get_scaled_pf_parameters(void));
+
+/**
+ *  @brief Get precomputed Boltzmann factors of the loop type
+ *  dependent energy contributions with independent thermodynamic
+ *  temperature
+ *
+ *  This function returns a data structure that contains
+ *  all necessary precalculated Boltzmann factors for each
+ *  loop type contribution.<br>
+ *  In contrast to get_scaled_pf_parameters(), this function
+ *  enables setting of independent temperatures for both, the
+ *  individual energy contributions as well as the thermodynamic
+ *  temperature used in
+ *  @f$ exp(-\Delta G / kT) @f$
+ *
+ *  @deprecated Use vrna_exp_params() instead!
+ *
+ *  @see get_scaled_pf_parameters(), get_boltzmann_factor_copy()
+ *
+ *  @param  temperature   The temperature in degrees Celcius used for (re-)scaling the energy contributions
+ *  @param  betaScale     A scaling value that is used as a multiplication factor for the absolute
+ *                        temperature of the system
+ *  @param  md            The model details to be used
+ *  @param  pf_scale      The scaling factor for the Boltzmann factors
+ *  @return               A set of precomputed Boltzmann factors
+ */
+DEPRECATED(vrna_exp_param_t *get_boltzmann_factors(double temperature, double betaScale, vrna_md_t md, double pf_scale));
+
+/**
+ *  @brief Get a copy of already precomputed Boltzmann factors
+ *
+ *  @deprecated Use vrna_exp_params_copy() instead!
+ *
+ *  @see get_boltzmann_factors(), get_scaled_pf_parameters()
+ *
+ *  @param  parameters  The input data structure that shall be copied
+ *  @return             A copy of the provided Boltzmann factor data set
+ */
+DEPRECATED(vrna_exp_param_t *get_boltzmann_factor_copy(vrna_exp_param_t *parameters));
+
+/**
+ *  @brief Get precomputed Boltzmann factors of the loop type
+ *  dependent energy contributions (alifold variant)
+ *
+ *  @deprecated Use vrna_exp_params_comparative() instead!
+ *
+ */
+DEPRECATED(vrna_exp_param_t *get_scaled_alipf_parameters(unsigned int n_seq));
+
+/**
+ *  @brief Get precomputed Boltzmann factors of the loop type
+ *  dependent energy contributions (alifold variant) with
+ *  independent thermodynamic temperature
+ *
+ *  @deprecated Use vrna_exp_params_comparative() instead!
+ *
+ */
+DEPRECATED(vrna_exp_param_t *get_boltzmann_factors_ali(unsigned int n_seq, double temperature, double betaScale, vrna_md_t md, double pf_scale));
+
+/**
+ * @brief Get precomputed energy contributions for all the known loop types
+ *
+ *  @note OpenMP: This function relies on several global model settings variables and thus is
+ *        not to be considered threadsafe. See get_scaled_parameters() for a completely threadsafe
+ *        implementation.
+ *
+ *  @deprecated Use vrna_params() instead!
+ *
+ * @return     A set of precomputed energy contributions
+ */
+DEPRECATED(vrna_param_t *scale_parameters(void));
+
+/**
+ * @brief Get precomputed energy contributions for all the known loop types
+ *
+ *  Call this function to retrieve precomputed energy contributions, i.e. scaled
+ *  according to the temperature passed. Furthermore, this function assumes a
+ *  data structure that contains the model details as well, such that subsequent
+ *  folding recursions are able to retrieve the correct model settings
+ *
+ *  @deprecated Use vrna_params() instead!
+ *
+ *  @see #vrna_md_t, set_model_details()
+ *
+ *  @param temperature  The temperature in degrees Celcius
+ *  @param md           The model details
+ *  @return             precomputed energy contributions and model settings
+ */
+DEPRECATED(vrna_param_t *get_scaled_parameters(double temperature, vrna_md_t md));
+
+DEPRECATED(vrna_param_t     *copy_parameters(void));
+DEPRECATED(vrna_param_t     *set_parameters(vrna_param_t *dest));
+DEPRECATED(vrna_exp_param_t *scale_pf_parameters(void));
+DEPRECATED(vrna_exp_param_t *copy_pf_param(void));
+DEPRECATED(vrna_exp_param_t *set_pf_param(vrna_param_t *dest));
+
+#endif
+
+/**
+ *  @}
+ */
+
+
+
+#endif
diff --git a/C/ViennaRNA/part_func.c b/C/ViennaRNA/part_func.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/part_func.c
@@ -0,0 +1,1241 @@
+/*
+                  partiton function for RNA secondary structures
+
+                  Ivo L Hofacker + Ronny Lorenz
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <float.h>    /* #defines FLT_MAX ... */
+#include <limits.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/mfe.h"
+#include "ViennaRNA/part_func.h"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+PUBLIC  int         st_back = 0;
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/* some backward compatibility stuff */
+PRIVATE vrna_fold_compound_t  *backward_compat_compound = NULL;
+PRIVATE int                 backward_compat           = 0;
+
+#ifdef _OPENMP
+
+#pragma omp threadprivate(backward_compat_compound, backward_compat)
+
+#endif
+
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE void  pf_circ(vrna_fold_compound_t *vc);
+PRIVATE void  pf_linear(vrna_fold_compound_t *vc);
+PRIVATE void  alipf_linear(vrna_fold_compound_t *vc);
+PRIVATE void  wrap_alipf_circ(vrna_fold_compound_t *vc, char *structure);
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+PRIVATE float
+wrap_pf_fold( const char *sequence,
+              char *structure,
+              vrna_exp_param_t *parameters,
+              int calculate_bppm,
+              int is_constrained,
+              int is_circular);
+
+#endif
+
+PRIVATE double
+wrap_mean_bp_distance(FLT_OR_DBL *p,
+                      int length,
+                      int *index,
+                      int turn);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC float
+vrna_pf_fold( const char *seq,
+              char *structure,
+              vrna_plist_t **pl){
+
+  float                 free_energy;
+  double                mfe;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vrna_md_set_default(&md);
+
+  /* no need to backtrack MFE structure */
+  md.backtrack = 0;
+
+  if(!pl){ /* no need for pair probability computations if we do not store them somewhere */
+    md.compute_bpp = 0;
+  }
+
+  vc  = vrna_fold_compound(seq, &md, 0);
+  mfe = (double)vrna_pf(vc, NULL);
+  vrna_exp_params_rescale(vc, &mfe);
+  free_energy = vrna_pf(vc, structure);
+
+  /* fill plist */
+  if(pl){
+    *pl = vrna_plist_from_probs(vc, /*cut_off:*/ 1e-6);
+  }
+
+  vrna_fold_compound_free(vc);
+
+  return free_energy;
+}
+
+PUBLIC float
+vrna_pf_circfold( const char *seq,
+                  char *structure,
+                  vrna_plist_t **pl){
+
+  float                 free_energy;
+  double                mfe;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vrna_md_set_default(&md);
+  md.circ = 1;
+
+  /* no need to backtrack MFE structure */
+  md.backtrack = 0;
+
+  if(!pl){ /* no need for pair probability computations if we do not store them somewhere */
+    md.compute_bpp = 0;
+  }
+
+  vc  = vrna_fold_compound(seq, &md, 0);
+  mfe = (double)vrna_mfe(vc, NULL);
+  vrna_exp_params_rescale(vc, &mfe);
+  free_energy = vrna_pf(vc, structure);
+
+  /* fill plist */
+  if(pl){
+    *pl = vrna_plist_from_probs(vc, /*cut_off:*/ 1e-6);
+  }
+
+  vrna_fold_compound_free(vc);
+
+  return free_energy;
+}
+
+PUBLIC float
+vrna_pf(vrna_fold_compound_t  *vc,
+        char                  *structure){
+
+  int               n;
+  FLT_OR_DBL        Q;
+  double            free_energy;
+  vrna_md_t         *md;
+  vrna_exp_param_t  *params;
+  vrna_mx_pf_t      *matrices;
+
+  free_energy = (float)(INF/100.);
+
+  if(vc){
+    /* make sure, everything is set up properly to start partition function computations */
+    if(!vrna_fold_compound_prepare(vc, VRNA_OPTION_PF)){
+      vrna_message_warning("vrna_pf@part_func.c: Failed to prepare vrna_fold_compound");
+      return free_energy;
+    }
+
+    n         = vc->length;
+    params    = vc->exp_params;
+    matrices  = vc->exp_matrices;
+    md        = &(params->model_details);
+
+#ifdef _OPENMP
+/* Explicitly turn off dynamic threads */
+    omp_set_dynamic(0);
+#endif
+
+#ifdef SUN4
+    nonstandard_arithmetic();
+#else
+#ifdef HP9
+    fpsetfastmode(1);
+#endif
+#endif
+
+    /* call user-defined recursion status callback function */
+    if(vc->stat_cb)
+      vc->stat_cb(VRNA_STATUS_PF_PRE, vc->auxdata);
+
+    switch(vc->type){
+      case VRNA_FC_TYPE_SINGLE:     /* do the linear pf fold and fill all matrices  */
+                                    pf_linear(vc);
+
+                                    if(md->circ)
+                                      pf_circ(vc); /* do post processing step for circular RNAs */
+
+                                    break;
+
+      case VRNA_FC_TYPE_COMPARATIVE:  /* do the linear pf fold and fill all matrices  */
+                                    alipf_linear(vc);
+
+                                    /* calculate post processing step for circular  */
+                                    /* RNAs                                         */
+                                    if(md->circ)
+                                      wrap_alipf_circ(vc, structure);
+
+                                    break;
+
+      default:                      vrna_message_warning("vrna_pf@part_func.c: Unrecognized fold compound type");
+                                    return free_energy;
+                                    break;
+    }
+
+
+    /* call user-defined recursion status callback function */
+    if(vc->stat_cb)
+      vc->stat_cb(VRNA_STATUS_PF_POST, vc->auxdata);
+
+    /* calculate base pairing probability matrix (bppm)  */
+    if(md->compute_bpp){
+      vrna_pairing_probs(vc, structure);
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+      /*
+      *  Backward compatibility:
+      *  This block may be removed if deprecated functions
+      *  relying on the global variable "pr" vanish from within the package!
+      */
+      pr = matrices->probs;
+      /*
+       {
+        if(pr) free(pr);
+        pr = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * ((n+1)*(n+2)/2));
+        memcpy(pr, probs, sizeof(FLT_OR_DBL) * ((n+1)*(n+2)/2));
+      }
+      */
+
+#endif
+
+    }
+
+    if (md->backtrack_type=='C')
+      Q = matrices->qb[vc->iindx[1]-n];
+    else if (md->backtrack_type=='M')
+      Q = matrices->qm[vc->iindx[1]-n];
+    else Q = (md->circ) ? matrices->qo : matrices->q[vc->iindx[1]-n];
+
+    /* ensemble free energy in Kcal/mol              */
+    if (Q<=FLT_MIN)
+      vrna_message_warning("pf_scale too large");
+
+    switch(vc->type){
+      case VRNA_FC_TYPE_COMPARATIVE:  free_energy = (-log(Q)-n*log(params->pf_scale))*params->kT/(1000.0 * vc->n_seq);
+                                    break;
+
+      case VRNA_FC_TYPE_SINGLE:     /* fall through */
+
+      default:                      free_energy = (-log(Q)-n*log(params->pf_scale))*params->kT/1000.0;
+                                    break;
+    }
+
+#ifdef SUN4
+    standard_arithmetic();
+#else
+#ifdef HP9
+    fpsetfastmode(0);
+#endif
+#endif
+  }
+
+  return free_energy;
+}
+
+PRIVATE void
+pf_linear(vrna_fold_compound_t *vc){
+
+  char                *hard_constraints;
+  int                 n, i,j, k, ij, d, *my_iindx, *jindx, with_gquad, turn,
+                      with_ud, hc_decompose;
+  FLT_OR_DBL          temp, Qmax, qbt1, *q, *qb, *qm, *qm1, *q1k, *qln;
+  double              max_real;
+  vrna_ud_t           *domains_up;
+  vrna_md_t           *md;
+  vrna_hc_t           *hc;
+  vrna_mx_pf_t        *matrices;
+  vrna_mx_pf_aux_el_t *aux_mx_el;
+  vrna_mx_pf_aux_ml_t *aux_mx_ml;
+  vrna_exp_param_t    *pf_params;
+
+  n                 = vc->length;
+  my_iindx          = vc->iindx;
+  jindx             = vc->jindx;
+  matrices          = vc->exp_matrices;
+  pf_params         = vc->exp_params;
+  hc                = vc->hc;
+  domains_up        = vc->domains_up;
+  q                 = matrices->q;
+  qb                = matrices->qb;
+  qm                = matrices->qm;
+  qm1               = matrices->qm1;
+  q1k               = matrices->q1k;
+  qln               = matrices->qln;
+  md                = &(pf_params->model_details);
+  with_gquad        = md->gquad;
+  turn              = md->min_loop_size;
+  hard_constraints  = hc->matrix;
+
+  with_ud           = (domains_up && domains_up->exp_energy_cb);
+  Qmax              = 0;
+
+  max_real = (sizeof(FLT_OR_DBL) == sizeof(float)) ? FLT_MAX : DBL_MAX;
+
+  if (with_ud && domains_up->exp_prod_cb)
+    domains_up->exp_prod_cb(vc, domains_up->data);
+
+  if(with_gquad){
+    free(vc->exp_matrices->G);
+    vc->exp_matrices->G = get_gquad_pf_matrix(vc->sequence_encoding2, vc->exp_matrices->scale, vc->exp_params);
+  }
+
+  /* init auxiliary arrays for fast exterior/multibranch loops */
+  aux_mx_el = vrna_exp_E_ext_fast_init(vc);
+  aux_mx_ml = vrna_exp_E_ml_fast_init(vc);
+
+  /*array initialization ; qb,qm,q
+    qb,qm,q (i,j) are stored as ((n+1-i)*(n-i) div 2 + n+1-j */
+  for (d=0; d<=turn; d++)
+    for (i=1; i<=n-d; i++) {
+      j=i+d;
+      ij = my_iindx[i]-j;
+      qb[ij] = 0.0;
+    }
+
+  for (j = turn + 2; j <= n; j++) {
+    for (i = j - turn - 1; i >= 1; i--) {
+      /* construction of partition function of segment i,j */
+      /* firstly that given i binds j : qb(i,j) */
+      ij            = my_iindx[i] - j;
+      hc_decompose  = hard_constraints[jindx[j] + i];
+      qbt1          = 0;
+
+      if(hc_decompose){
+        /* process hairpin loop(s) */
+        qbt1 += vrna_exp_E_hp_loop(vc, i, j);
+        /* process interior loop(s) */
+        qbt1 += vrna_exp_E_int_loop(vc, i, j);
+        /* process multibranch loop(s) */
+        qbt1 += vrna_exp_E_mb_loop_fast(vc, i, j, aux_mx_ml->qqm1);
+      }
+      qb[ij] = qbt1;
+
+      /* Multibranch loop */
+      qm[ij] = vrna_exp_E_ml_fast(vc, i, j, aux_mx_ml);
+
+      if (qm1)
+        qm1[jindx[j] + i] = aux_mx_ml->qqm[i]; /* for stochastic backtracking and circfold */
+
+      /* Exterior loop */
+      q[ij] = temp = vrna_exp_E_ext_fast(vc, i, j, aux_mx_el);
+
+      if (temp>Qmax) {
+        Qmax = temp;
+        if (Qmax>max_real/10.)
+          vrna_message_warning("Q close to overflow: %d %d %g", i,j,temp);
+      }
+      if (temp>=max_real) {
+        vrna_message_error("overflow in pf_fold while calculating q[%d,%d]\n"
+                                  "use larger pf_scale", i,j);
+      }
+    }
+
+    /* rotate auxiliary arrays */
+    vrna_exp_E_ext_fast_rotate(vc, aux_mx_el);
+    vrna_exp_E_ml_fast_rotate(vc, aux_mx_ml);
+
+  }
+
+  /* prefill linear qln, q1k arrays */
+  if(q1k && qln){
+    for (k=1; k<=n; k++) {
+      q1k[k] = q[my_iindx[1] - k];
+      qln[k] = q[my_iindx[k] - n];
+    }
+    q1k[0] = 1.0;
+    qln[n+1] = 1.0;
+  }
+
+  /* free memory occupied by auxiliary arrays for fast exterior/multibranch loops */
+  vrna_exp_E_ml_fast_free(vc, aux_mx_ml);
+  vrna_exp_E_ext_fast_free(vc, aux_mx_el);
+}
+
+/* calculate partition function for circular case */
+/* NOTE: this is the postprocessing step ONLY     */
+/* You have to call pf_linear first to calculate  */
+/* complete circular case!!!                      */
+PRIVATE void
+pf_circ(vrna_fold_compound_t *vc){
+
+  char              *ptype;
+  short             *S1;
+  int               u, p, q, k, l, turn, n, *my_iindx, *jindx, *rtype;
+  FLT_OR_DBL        *scale, *qb, *qm, *qm1, *qm2, qo, qho, qio, qmo,
+                    qbt1, qot, expMLclosing;
+  vrna_exp_param_t  *pf_params;
+  vrna_mx_pf_t      *matrices;
+
+  n             = vc->length;
+  matrices      = vc->exp_matrices;
+  my_iindx      = vc->iindx;
+  jindx         = vc->jindx;
+  ptype         = vc->ptype;
+  S1            = vc->sequence_encoding;
+  pf_params     = vc->exp_params;
+  qb            = matrices->qb;
+  qm            = matrices->qm;
+  qm1           = matrices->qm1;
+  qm2           = matrices->qm2;
+  scale         = matrices->scale;
+  expMLclosing  = pf_params->expMLclosing;
+  turn          = pf_params->model_details.min_loop_size;
+  rtype         = &(pf_params->model_details.rtype[0]);
+  qo = qho = qio = qmo = 0.;
+
+  /* construct qm2 matrix from qm1 entries  */
+  for(k=1; k<n-turn-1; k++){
+    qot = 0.;
+    for (u=k+turn+1; u<n-turn-1; u++)
+      qot += qm1[jindx[u]+k]*qm1[jindx[n]+(u+1)];
+    qm2[k] = qot;
+   }
+
+  for(p = 1; p < n; p++){
+    for(q = p + turn + 1; q <= n; q++){
+      int type;
+      /* 1. get exterior hairpin contribution  */
+      qbt1 = qb[my_iindx[p]-q] * vrna_exp_E_hp_loop(vc, q, p);
+      qho += qbt1;
+
+      u = n-q + p-1;
+      if (u<turn) continue;
+      type = ptype[jindx[q] + p];
+      if (!type) continue;
+       /* cause we want to calc the exterior loops, we need the reversed pair type from now on  */
+      type=rtype[type];
+
+
+      /* 2. exterior interior loops, i "define" the (k,l) pair as "outer pair"  */
+      /* so "outer type" is rtype[type[k,l]] and inner type is type[p,q]        */
+      qot = 0.;
+      for(k=q+1; k < n; k++){
+        int ln1, lstart;
+        ln1 = k - q - 1;
+        if(ln1+p-1>MAXLOOP) break;
+        lstart = ln1+p-1+n-MAXLOOP;
+        if(lstart<k+turn+1) lstart = k + turn + 1;
+        for(l=lstart;l <= n; l++){
+          int ln2, type2;
+          ln2 = (p - 1) + (n - l);
+
+          if((ln1+ln2) > MAXLOOP) continue;
+
+          type2 = ptype[jindx[l] + k];
+          if(!type2) continue;
+          qio += qb[my_iindx[p]-q] * qb[my_iindx[k]-l] * exp_E_IntLoop(ln2, ln1, rtype[type2], type, S1[l+1], S1[k-1], S1[p-1], S1[q+1], pf_params) * scale[ln1+ln2];
+        }
+      } /* end of kl double loop */
+    }
+  } /* end of pq double loop */
+
+  /* 3. Multiloops  */
+  for(k=turn+2; k<n-2*turn-3; k++)
+    qmo += qm[my_iindx[1]-k] * qm2[k+1] * expMLclosing;
+
+  /* add an additional pf of 1.0 to take the open chain into account too */
+  qo = qho + qio + qmo + 1.0*scale[n];
+
+  matrices->qo    = qo;
+  matrices->qho   = qho;
+  matrices->qio   = qio;
+  matrices->qmo   = qmo;
+
+}
+
+
+PUBLIC int
+vrna_pf_float_precision(void){
+
+  return (sizeof(FLT_OR_DBL) == sizeof(float));
+}
+
+
+PRIVATE void
+alipf_linear( vrna_fold_compound_t *vc){
+
+  char                *hard_constraints;
+  int                 i,j, ij, jij, d, turn, n, *my_iindx, *jindx, *pscore;
+  FLT_OR_DBL          temp, Qmax, qbt1, *q, *qb, *qm, *qm1;
+  double              kTn, max_real;
+  vrna_exp_param_t    *pf_params;
+  vrna_mx_pf_t        *matrices;
+  vrna_mx_pf_aux_el_t *aux_mx_el;
+  vrna_mx_pf_aux_ml_t *aux_mx_ml;
+  vrna_md_t           *md;
+  vrna_hc_t           *hc;
+
+  n                 = vc->length;
+  pf_params         = vc->exp_params;
+  matrices          = vc->exp_matrices;
+  hc                = vc->hc;
+  my_iindx          = vc->iindx;
+  jindx             = vc->jindx;
+  pscore            = vc->pscore;     /* precomputed array of pair types */
+  md                = &(pf_params->model_details);
+  q                 = matrices->q;
+  qb                = matrices->qb;
+  qm                = matrices->qm;
+  qm1               = matrices->qm1;
+  hard_constraints  = hc->matrix;
+  turn              = md->min_loop_size;
+  kTn               = pf_params->kT/10.;   /* kT in cal/mol  */
+  Qmax              = 0.;
+
+  max_real          = (sizeof(FLT_OR_DBL) == sizeof(float)) ? FLT_MAX : DBL_MAX;
+
+  /* init auxiliary arrays for fast exterior/multibranch loops */
+  aux_mx_el = vrna_exp_E_ext_fast_init(vc);
+  aux_mx_ml = vrna_exp_E_ml_fast_init(vc);
+
+  /* array initialization ; qb,qm,q
+     qb,qm,q (i,j) are stored as ((n+1-i)*(n-i) div 2 + n+1-j */
+
+  for (d = 0; d <= turn; d++)
+    for (i = 1; i <= n - d; i++) {
+      j       = i + d;
+      ij      = my_iindx[i]-j;
+      qb[ij]  = 0.0;
+    }
+
+  for (j = turn + 2; j <= n; j++) {
+    for (i = j - turn - 1; i >= 1; i--) {
+      int psc;
+      /* construction of partition function for segment i,j */
+      /* calculate pf given that i and j pair: qb(i,j)      */
+      ij  = my_iindx[i] - j;
+      jij = jindx[j] + i;
+
+      psc   = pscore[jij];
+      qbt1  = 0.;
+
+      if (hard_constraints[jij]) {
+        /* process hairpin loop(s) */
+        qbt1 += vrna_exp_E_hp_loop(vc, i, j);
+        /* process interior loop(s) */
+        qbt1 += vrna_exp_E_int_loop(vc, i, j);
+        /* process multibranch loop(s) */
+        qbt1 += vrna_exp_E_mb_loop_fast(vc, i, j, aux_mx_ml->qqm1);
+
+        qbt1 *= exp(psc/kTn);
+      }
+
+      qb[ij] = qbt1;
+
+      /* Multibranch loop */
+      qm[ij] = vrna_exp_E_ml_fast(vc, i, j, aux_mx_ml);
+
+      if (qm1)
+        qm1[jindx[j] + i] = aux_mx_ml->qqm[i]; /* for stochastic backtracking and circfold */
+
+      /* Exterior loop */
+      q[ij] = temp = vrna_exp_E_ext_fast(vc, i, j, aux_mx_el);
+
+      if (temp > Qmax) {
+        Qmax = temp;
+        if (Qmax > max_real/10.)
+          vrna_message_warning("Q close to overflow: %d %d %g", i,j,temp);
+      }
+      if (temp >= max_real) {
+        vrna_message_error("overflow in pf_fold while calculating q[%d,%d]\n"
+                                  "use larger pf_scale", i,j);
+      }
+    }
+
+    /* rotate auxiliary arrays */
+    vrna_exp_E_ext_fast_rotate(vc, aux_mx_el);
+    vrna_exp_E_ml_fast_rotate(vc, aux_mx_ml);
+  }
+
+  /* free memory occupied by auxiliary arrays for fast exterior/multibranch loops */
+  vrna_exp_E_ml_fast_free(vc, aux_mx_ml);
+  vrna_exp_E_ext_fast_free(vc, aux_mx_el);
+}
+
+/* calculate partition function for circular case   */
+/* NOTE: this is the postprocessing step ONLY        */
+/* You have to call alipf_linear first to calculate  */
+/* circular case!!!                                  */
+
+PRIVATE void
+wrap_alipf_circ(vrna_fold_compound_t *vc,
+                char *structure){
+
+  char              **Ss, *hard_constraints;
+  unsigned short    **a2s;
+  short             **S, **S5, **S3;
+  int               u, p, q, pq, k, l, s, *type, n_seq, n, *my_iindx, *jindx, *rtype;
+  FLT_OR_DBL        qbt1, qot, qo, qho, qio, qmo, *qb, *qm, *qm1, *qm2, *scale,
+                    expMLclosing;
+  vrna_exp_param_t  *pf_params;
+  vrna_mx_pf_t      *matrices;
+  vrna_md_t         *md;
+  vrna_hc_t         *hc;
+  vrna_sc_t         **sc;
+
+  n_seq             = vc->n_seq;
+  n                 = vc->length;
+  S                 = vc->S;
+  S5                = vc->S5;     /* S5[s][i] holds next base 5' of i in sequence s */
+  S3                = vc->S3;     /* Sl[s][i] holds next base 3' of i in sequence s */
+  Ss                = vc->Ss;
+  a2s               = vc->a2s;
+  pf_params         = vc->exp_params;
+  matrices          = vc->exp_matrices;
+  my_iindx          = vc->iindx;
+  jindx             = vc->jindx;
+  hc                = vc->hc;
+  sc                = vc->scs;
+  qb                = matrices->qb;
+  qm                = matrices->qm;
+  qm1               = matrices->qm1;
+  qm2               = matrices->qm2;
+  scale             = matrices->scale;
+  expMLclosing      = pf_params->expMLclosing;
+  md                = &(pf_params->model_details);
+  hard_constraints  = hc->matrix;
+  rtype             = &(md->rtype[0]);
+  qo = qho = qio = qmo = 0.;
+
+  type  = (int *)vrna_alloc(sizeof(int) * n_seq);
+
+  /* calculate the qm2 matrix  */
+  for(k=1; k<n-TURN; k++){
+    qot = 0.;
+    for (u=k+TURN+1; u<n-TURN-1; u++)
+      qot += qm1[jindx[u]+k]*qm1[jindx[n]+(u+1)];
+    qm2[k] = qot;
+  }
+
+  for(p=1;p<n;p++){
+    for(q=p+TURN+1;q<=n;q++){
+      u = n-q + p-1;
+      if (u<TURN) continue;
+      pq  = jindx[q] + p;
+
+      if(!hard_constraints[pq]) continue;
+
+      for(s = 0; s < n_seq; s++){
+        type[s] = md->pair[S[s][p]][S[s][q]];
+        if (type[s]==0) type[s]=7;
+      }
+
+      /* 1. exterior hairpin contribution  */
+      /* Note, that we do not scale Hairpin Energy by u+2 but by u cause the scale  */
+      /* for the closing pair was already done in the forward recursion              */
+      if(hard_constraints[pq] & VRNA_CONSTRAINT_CONTEXT_HP_LOOP){
+        if(hc->up_hp[q+1] > u){
+          for (qbt1=1,s=0; s<n_seq; s++) {
+            int rt;
+            char loopseq[10];
+            u   = a2s[s][n] - a2s[s][q] + a2s[s][p] - 1;
+            rt  = rtype[type[s]];
+
+            if (u<9){
+              strcpy(loopseq , Ss[s] + a2s[s][q] - 1);
+              strncat(loopseq, Ss[s], a2s[s][p]);
+            }
+            qbt1 *= exp_E_Hairpin(u, rt, S3[s][q], S5[s][p], loopseq, pf_params);
+          }
+          if(sc)
+            for(s = 0; s < n_seq; s++){
+              if(sc[s]){
+                if(sc[s]->exp_energy_up){
+                  qbt1 *=   ((p > 1) ? sc[s]->exp_energy_up[1][a2s[s][p]-1] : 1.)
+                          * ((q < n) ? sc[s]->exp_energy_up[a2s[s][q]+1][a2s[s][n] - a2s[s][q]] : 1.);
+                }
+              }
+            }
+          qho += qb[my_iindx[p]-q] * qbt1 * scale[u];
+        }
+      }
+      /* 2. exterior interior loop contribution*/
+
+      if(hard_constraints[pq] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){
+        for(k=q+1; k < n; k++){
+          int ln1, lstart;
+          ln1 = k - q - 1;
+          if(ln1 + p - 1 > MAXLOOP)
+            break;
+          if(hc->up_int[q+1] < ln1)
+            break;
+
+          lstart = ln1+p-1+n-MAXLOOP;
+          if(lstart<k+TURN+1) lstart = k + TURN + 1;
+          for(l=lstart;l <= n; l++){
+            int ln2, type_2;
+
+            ln2 = (p - 1) + (n - l);
+
+            if(!(hard_constraints[jindx[l]+k] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP))
+              continue;
+            if((ln1+ln2) > MAXLOOP)
+              continue;
+            if(hc->up_int[l+1] < ln2)
+              continue;
+
+            FLT_OR_DBL qloop=1.;
+            if (qb[my_iindx[k]-l]==0.){ qloop=0.; continue;}
+
+            for (s=0; s<n_seq; s++){
+              int ln1a = a2s[s][k] - 1 - a2s[s][q];
+              int ln2a = a2s[s][n] - a2s[s][l] + a2s[s][p] - 1;
+              int rt = rtype[type[s]];
+              type_2 = md->pair[S[s][l]][S[s][k]];
+              if (type_2 == 0) type_2 = 7;
+              qloop *= exp_E_IntLoop(ln1a, ln2a, rt, type_2, S3[s][q], S5[s][p], S5[s][k], S3[s][l], pf_params);
+            }
+            if(sc)
+              for(s = 0; s < n_seq; s++){
+                int ln1a = a2s[s][k] - 1 - a2s[s][q];
+                int ln2a = a2s[s][n] - a2s[s][l] + a2s[s][p] - 1;
+                if(sc[s]){
+                  if((ln1a+ln2a == 0) && (sc[s]->exp_energy_stack)){
+                    if(S[s][p] && S[s][q] && S[s][k] && S[s][l]){ /* don't allow gaps in stack */
+                      qloop *=    sc[s]->exp_energy_stack[a2s[s][p]]
+                                * sc[s]->exp_energy_stack[a2s[s][q]]
+                                * sc[s]->exp_energy_stack[a2s[s][k]]
+                                * sc[s]->exp_energy_stack[a2s[s][l]];
+                    }
+                  }
+                  if(sc[s]->exp_energy_up)
+                    qloop *=    sc[s]->exp_energy_up[a2s[s][q] + 1][ln1a]
+                              * ((l < n) ? sc[s]->exp_energy_up[a2s[s][l]+1][a2s[s][n] - a2s[s][l]] : 1.)
+                              * ((p > 1) ? sc[s]->exp_energy_up[1][a2s[s][p]-1] : 1.);
+                }
+              }
+
+            qio += qb[my_iindx[p]-q] * qb[my_iindx[k]-l] * qloop * scale[ln1+ln2];
+          }
+        } /* end of kl double loop */
+      }
+    }
+  } /* end of pq double loop */
+
+  /* 3. exterior multiloop contribution  */
+  for(k=TURN+2; k<n-2*TURN-3; k++)
+    qmo += qm[my_iindx[1]-k] * qm2[k+1] * pow(expMLclosing,n_seq);
+
+  /* add additional pf of 1.0 to take open chain into account */
+  qo = qho + qio + qmo;
+  if(hc->up_ext[1] >= n)
+     qo += 1.0 * scale[n];
+
+  matrices->qo    = qo;
+  matrices->qho   = qho;
+  matrices->qio   = qio;
+  matrices->qmo   = qmo;
+
+  free(type);
+}
+
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+PRIVATE double
+wrap_mean_bp_distance(FLT_OR_DBL *p,
+                      int length,
+                      int *index,
+                      int turn){
+
+  int         i,j;
+  double      d = 0.;
+
+  /* compute the mean base pair distance in the thermodynamic ensemble */
+  /* <d> = \sum_{a,b} p_a p_b d(S_a,S_b)
+     this can be computed from the pair probs p_ij as
+     <d> = \sum_{ij} p_{ij}(1-p_{ij}) */
+
+  for (i=1; i<=length; i++)
+    for (j=i+turn+1; j<=length; j++)
+      d += p[index[i]-j] * (1-p[index[i]-j]);
+
+  return 2*d;
+}
+
+PRIVATE float
+wrap_pf_fold( const char *sequence,
+              char *structure,
+              vrna_exp_param_t *parameters,
+              int calculate_bppm,
+              int is_constrained,
+              int is_circular){
+
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vc = NULL;
+
+  /* we need vrna_exp_param_t datastructure to correctly init default hard constraints */
+  if(parameters)
+    md = parameters->model_details;
+  else{
+    set_model_details(&md); /* get global default parameters */
+  }
+  md.circ         = is_circular;
+  md.compute_bpp  = calculate_bppm;
+
+  vc = vrna_fold_compound(sequence, &md, VRNA_OPTION_DEFAULT);
+
+  /* prepare exp_params and set global pf_scale */
+  vc->exp_params = vrna_exp_params(&md);
+  vc->exp_params->pf_scale = pf_scale;
+
+  if(is_constrained && structure){
+    unsigned int constraint_options = 0;
+    constraint_options |= VRNA_CONSTRAINT_DB
+                          | VRNA_CONSTRAINT_DB_PIPE
+                          | VRNA_CONSTRAINT_DB_DOT
+                          | VRNA_CONSTRAINT_DB_X
+                          | VRNA_CONSTRAINT_DB_ANG_BRACK
+                          | VRNA_CONSTRAINT_DB_RND_BRACK;
+
+    vrna_constraints_add(vc, (const char *)structure, constraint_options);
+  }
+
+  if(backward_compat_compound && backward_compat)
+    vrna_fold_compound_free(backward_compat_compound);
+
+  backward_compat_compound  = vc;
+  backward_compat           = 1;
+  iindx = backward_compat_compound->iindx;
+
+  return vrna_pf(vc, structure);
+}
+
+PUBLIC vrna_plist_t *
+stackProb(double cutoff){
+
+  if(!(backward_compat_compound && backward_compat)){
+    vrna_message_error("stackProb: run pf_fold() first!");
+  } else if( !backward_compat_compound->exp_matrices->probs){
+    vrna_message_error("stackProb: probs==NULL!");
+  }
+
+  return vrna_stack_prob(backward_compat_compound, cutoff);
+}
+
+PUBLIC char *
+centroid( int length,
+          double *dist) {
+
+  if (pr==NULL)
+    vrna_message_error("pr==NULL. You need to call pf_fold() before centroid()");
+
+  return vrna_centroid_from_probs(length, dist, pr);
+}
+
+
+PUBLIC double
+mean_bp_dist(int length) {
+
+  /* compute the mean base pair distance in the thermodynamic ensemble */
+  /* <d> = \sum_{a,b} p_a p_b d(S_a,S_b)
+     this can be computed from the pair probs p_ij as
+     <d> = \sum_{ij} p_{ij}(1-p_{ij}) */
+
+  int     i, j, *my_iindx;
+  double  d = 0;
+
+  if (pr==NULL)
+    vrna_message_error("pr==NULL. You need to call pf_fold() before mean_bp_dist()");
+
+  my_iindx = vrna_idx_row_wise(length);
+
+  for (i=1; i<=length; i++)
+    for (j=i+TURN+1; j<=length; j++)
+      d += pr[my_iindx[i]-j] * (1-pr[my_iindx[i]-j]);
+
+  free(my_iindx);
+  return 2*d;
+}
+
+/* get the free energy of a subsequence from the q[] array */
+PUBLIC double
+get_subseq_F( int i,
+              int j){
+
+  if(backward_compat_compound)
+    if(backward_compat_compound->exp_matrices)
+      if(backward_compat_compound->exp_matrices->q){
+        int               *my_iindx   = backward_compat_compound->iindx;
+        vrna_exp_param_t  *pf_params  = backward_compat_compound->exp_params;
+        FLT_OR_DBL        *q          = backward_compat_compound->exp_matrices->q;
+        return ((-log(q[my_iindx[i]-j])-(j-i+1)*log(pf_params->pf_scale))*pf_params->kT/1000.0);
+      }
+
+  vrna_message_error("call pf_fold() to fill q[] array before calling get_subseq_F()");
+  return 0.; /* we will never get to this point */
+}
+
+
+
+/*----------------------------------------------------------------------*/
+PUBLIC double
+expHairpinEnergy( int u,
+                  int type,
+                  short si1,
+                  short sj1,
+                  const char *string) {
+
+/* compute Boltzmann weight of a hairpin loop, multiply by scale[u+2] */
+
+  vrna_exp_param_t *pf_params = backward_compat_compound->exp_params;
+
+  double q, kT;
+  kT = pf_params->kT;   /* kT in cal/mol  */
+  if(u <= 30)
+    q = pf_params->exphairpin[u];
+  else
+    q = pf_params->exphairpin[30] * exp( -(pf_params->lxc*log( u/30.))*10./kT);
+  if ((tetra_loop)&&(u==4)) {
+    char tl[7]={0}, *ts;
+    strncpy(tl, string, 6);
+    if ((ts=strstr(pf_params->Tetraloops, tl)))
+      return (pf_params->exptetra[(ts-pf_params->Tetraloops)/7]);
+  }
+  if ((tetra_loop)&&(u==6)) {
+    char tl[9]={0}, *ts;
+    strncpy(tl, string, 6);
+    if ((ts=strstr(pf_params->Hexaloops, tl)))
+      return  (pf_params->exphex[(ts-pf_params->Hexaloops)/9]);
+  }
+  if (u==3) {
+    char tl[6]={0}, *ts;
+    strncpy(tl, string, 5);
+    if ((ts=strstr(pf_params->Triloops, tl)))
+      return (pf_params->exptri[(ts-pf_params->Triloops)/6]);
+    if (type>2)
+      q *= pf_params->expTermAU;
+  }
+  else /* no mismatches for tri-loops */
+    q *= pf_params->expmismatchH[type][si1][sj1];
+
+  return q;
+}
+
+PUBLIC double
+expLoopEnergy(int u1,
+              int u2,
+              int type,
+              int type2,
+              short si1,
+              short sj1,
+              short sp1,
+              short sq1) {
+
+/* compute Boltzmann weight of interior loop,
+   multiply by scale[u1+u2+2] for scaling */
+  double z=0;
+  int no_close = 0;
+  vrna_exp_param_t *pf_params = backward_compat_compound->exp_params;
+
+
+  if ((no_closingGU) && ((type2==3)||(type2==4)||(type==2)||(type==4)))
+    no_close = 1;
+
+  if ((u1==0) && (u2==0)) /* stack */
+    z = pf_params->expstack[type][type2];
+  else if (no_close==0) {
+    if ((u1==0)||(u2==0)) { /* bulge */
+      int u;
+      u = (u1==0)?u2:u1;
+      z = pf_params->expbulge[u];
+      if (u2+u1==1) z *= pf_params->expstack[type][type2];
+      else {
+        if (type>2) z *= pf_params->expTermAU;
+        if (type2>2) z *= pf_params->expTermAU;
+      }
+    }
+    else {     /* interior loop */
+      if (u1+u2==2) /* size 2 is special */
+        z = pf_params->expint11[type][type2][si1][sj1];
+      else if ((u1==1) && (u2==2))
+        z = pf_params->expint21[type][type2][si1][sq1][sj1];
+      else if ((u1==2) && (u2==1))
+        z = pf_params->expint21[type2][type][sq1][si1][sp1];
+      else if ((u1==2) && (u2==2))
+        z = pf_params->expint22[type][type2][si1][sp1][sq1][sj1];
+      else if (((u1==2)&&(u2==3))||((u1==3)&&(u2==2))){ /*2-3 is special*/
+        z = pf_params->expinternal[5]*
+          pf_params->expmismatch23I[type][si1][sj1]*
+          pf_params->expmismatch23I[type2][sq1][sp1];
+        z *= pf_params->expninio[2][1];
+      }
+      else if ((u1==1)||(u2==1)) {  /*1-n is special*/
+        z = pf_params->expinternal[u1+u2]*
+          pf_params->expmismatch1nI[type][si1][sj1]*
+          pf_params->expmismatch1nI[type2][sq1][sp1];
+        z *= pf_params->expninio[2][abs(u1-u2)];
+      }
+      else {
+        z = pf_params->expinternal[u1+u2]*
+          pf_params->expmismatchI[type][si1][sj1]*
+          pf_params->expmismatchI[type2][sq1][sp1];
+        z *= pf_params->expninio[2][abs(u1-u2)];
+      }
+    }
+  }
+  return z;
+}
+
+PUBLIC void
+init_pf_circ_fold(int length){
+/* DO NOTHING */
+}
+
+PUBLIC void
+init_pf_fold(int length){
+/* DO NOTHING */
+}
+
+/**
+*** Allocate memory for all matrices and other stuff
+**/
+PUBLIC void
+free_pf_arrays(void){
+
+  if(backward_compat_compound && backward_compat){
+    vrna_fold_compound_free(backward_compat_compound);
+    backward_compat_compound  = NULL;
+    backward_compat           = 0;
+    iindx = NULL;
+  }
+}
+
+PUBLIC FLT_OR_DBL *
+export_bppm(void){
+
+  if(backward_compat_compound)
+    if(backward_compat_compound->exp_matrices)
+      if(backward_compat_compound->exp_matrices->probs)
+        return backward_compat_compound->exp_matrices->probs;
+
+  return NULL;
+}
+
+/*-------------------------------------------------------------------------*/
+/* make arrays used for pf_fold available to other routines */
+PUBLIC int
+get_pf_arrays(short **S_p,
+              short **S1_p,
+              char **ptype_p,
+              FLT_OR_DBL **qb_p,
+              FLT_OR_DBL **qm_p,
+              FLT_OR_DBL **q1k_p,
+              FLT_OR_DBL **qln_p){
+
+  if(backward_compat_compound){
+    if(backward_compat_compound->exp_matrices)
+      if(backward_compat_compound->exp_matrices->qb){
+        *S_p      = backward_compat_compound->sequence_encoding2;
+        *S1_p     = backward_compat_compound->sequence_encoding;
+        *ptype_p  = backward_compat_compound->ptype_pf_compat;
+        *qb_p     = backward_compat_compound->exp_matrices->qb;
+        *qm_p     = backward_compat_compound->exp_matrices->qm;
+        *q1k_p    = backward_compat_compound->exp_matrices->q1k;
+        *qln_p    = backward_compat_compound->exp_matrices->qln;
+        return 1;
+      }
+  }
+  return 0;
+}
+
+/*-----------------------------------------------------------------*/
+PUBLIC float
+pf_fold(const char *sequence,
+        char *structure){
+
+  return wrap_pf_fold(sequence, structure, NULL, do_backtrack, fold_constrained, 0);
+}
+
+PUBLIC float
+pf_circ_fold( const char *sequence,
+              char *structure){
+
+  return wrap_pf_fold(sequence, structure, NULL, do_backtrack, fold_constrained, 1);
+}
+
+PUBLIC float
+pf_fold_par(const char *sequence,
+            char *structure,
+            vrna_exp_param_t *parameters,
+            int calculate_bppm,
+            int is_constrained,
+            int is_circular){
+
+  return wrap_pf_fold(sequence, structure, parameters, calculate_bppm, is_constrained, is_circular);
+}
+
+PUBLIC char *
+pbacktrack(char *seq){
+
+  int n = (int)strlen(seq);
+  return vrna_pbacktrack5(backward_compat_compound, n);
+}
+
+PUBLIC char *
+pbacktrack5(char *seq,
+            int length){
+
+  /* the seq parameter must no differ to the one stored globally anyway, so we just ignore it */
+  return vrna_pbacktrack5(backward_compat_compound, length);
+}
+
+PUBLIC char *
+pbacktrack_circ(char *seq){
+
+  char      *structure;
+  vrna_md_t *md;
+
+  structure = NULL;
+
+  if(backward_compat_compound){
+    md = &(backward_compat_compound->exp_params->model_details);
+    if(md->circ && backward_compat_compound->exp_matrices->qm2){
+      structure = vrna_pbacktrack(backward_compat_compound);
+    }
+  }
+
+  return structure;
+}
+
+PUBLIC void
+update_pf_params(int length){
+
+  if(backward_compat_compound && backward_compat){
+    vrna_md_t         md;
+    set_model_details(&md);
+    vrna_exp_params_reset(backward_compat_compound, &md);
+
+    /* compatibility with RNAup, may be removed sometime */
+    pf_scale = backward_compat_compound->exp_params->pf_scale;
+  }
+}
+
+PUBLIC void
+update_pf_params_par( int length,
+                      vrna_exp_param_t *parameters){
+
+  if(backward_compat_compound && backward_compat){
+    vrna_md_t         md;
+    if(parameters){
+      vrna_exp_params_subst(backward_compat_compound, parameters);
+    } else {
+      set_model_details(&md);
+      vrna_exp_params_reset(backward_compat_compound, &md);
+    }
+
+    /* compatibility with RNAup, may be removed sometime */
+    pf_scale = backward_compat_compound->exp_params->pf_scale;
+  }
+}
+
+PUBLIC char *
+get_centroid_struct_gquad_pr( int length,
+                              double *dist){
+
+  return vrna_centroid(backward_compat_compound, dist);
+}
+
+PUBLIC void
+assign_plist_gquad_from_pr( vrna_plist_t **pl,
+                            int length, /* ignored */
+                            double cut_off){
+
+  if(!backward_compat_compound){
+    *pl = NULL;
+  } else if( !backward_compat_compound->exp_matrices->probs){
+    *pl = NULL;
+  } else {
+    *pl = vrna_plist_from_probs(backward_compat_compound, cut_off);
+  }
+}
+
+PUBLIC double
+mean_bp_distance(int length){
+
+  if(backward_compat_compound)
+    if(backward_compat_compound->exp_matrices)
+      if(backward_compat_compound->exp_matrices->probs)
+        return vrna_mean_bp_distance(backward_compat_compound);
+
+  vrna_message_error("mean_bp_distance: you need to call vrna_pf_fold first");
+  return 0.; /* we will never get to this point */
+}
+
+PUBLIC double
+mean_bp_distance_pr(int length,
+                    FLT_OR_DBL *p){
+
+  double d=0;
+  int *index = vrna_idx_row_wise((unsigned int) length);
+
+  if (p==NULL)
+    vrna_message_error("p==NULL. You need to supply a valid probability matrix for mean_bp_distance_pr()");
+
+  d = wrap_mean_bp_distance(p, length, index, TURN);
+
+  free(index);
+  return d;
+}
+
+#endif
diff --git a/C/ViennaRNA/part_func.h b/C/ViennaRNA/part_func.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/part_func.h
@@ -0,0 +1,489 @@
+#ifndef VIENNA_RNA_PACKAGE_PART_FUNC_H
+#define VIENNA_RNA_PACKAGE_PART_FUNC_H
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+#include <ViennaRNA/centroid.h>
+#include <ViennaRNA/equilibrium_probs.h>
+#include <ViennaRNA/boltzmann_sampling.h>
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file     part_func.h
+ *  @ingroup  pf_fold
+ *  @brief    Partition function implementations
+ * 
+ *  This file includes (almost) all function declarations within the <b>RNAlib</b> that are related to
+ *  Partion function folding...
+ */
+
+/*
+#################################################
+# PARTITION FUNCTION COMPUTATION                #
+#################################################
+*/
+
+/**
+ *  @brief Compute the partition function @f$Q@f$ for a given RNA sequence, or sequence alignment
+ *
+ *  If @a structure is not a NULL pointer on input, it contains on
+ *  return a string consisting of the letters " . , | { } ( ) " denoting
+ *  bases that are essentially unpaired, weakly paired, strongly paired without
+ *  preference, weakly upstream (downstream) paired, or strongly up-
+ *  (down-)stream paired bases, respectively.
+ *  If the parameter calculate_bppm is set to 0 base pairing probabilities will not
+ *  be computed (saving CPU time), otherwise after calculations took place #pr will
+ *  contain the probability that bases @a i and @a j pair.
+ * 
+ *  @ingroup pf_fold
+ *
+ *  @note This function is polymorphic. It accepts #vrna_fold_compound_t of type
+ *        #VRNA_FC_TYPE_SINGLE, and #VRNA_FC_TYPE_COMPARATIVE.
+ *
+ *  @see #vrna_fold_compound_t, vrna_fold_compound(), vrna_pf_fold(), vrna_pf_circfold(),
+ *        vrna_fold_compound_comparative(), vrna_pf_alifold(), vrna_pf_circalifold(),
+ *        vrna_db_from_probs(), vrna_exp_params(), vrna_aln_pinfo()
+ *
+ *  @param[in,out]  vc              The fold compound data structure
+ *  @param[in,out]  structure       A pointer to the character array where position-wise pairing propensity
+ *                                  will be stored. (Maybe NULL)
+ *  @return         The Gibbs free energy of the ensemble (@f$G = -RT \cdot \log(Q) @f$) in kcal/mol
+ */
+float vrna_pf(vrna_fold_compound_t *vc, char *structure);
+
+/**
+ *  @brief  Compute Partition function @f$Q@f$ (and base pair probabilities) for an RNA
+ *          sequence using a comparative method
+ *
+ *  @ingroup pf_fold
+ *
+ *  This simplified interface to vrna_pf() computes the partition function and, if required,
+ *  base pair probabilities for an RNA sequence using default options. Memory required for
+ *  dynamic programming (DP) matrices will be allocated and free'd on-the-fly. Hence, after return of
+ *  this function, the recursively filled matrices are not available any more for any post-processing.
+ *
+ *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
+ *  you require other conditions than specified by the default model details, use vrna_pf(),
+ *  and the data structure #vrna_fold_compound_t instead.
+ *
+ *  @see vrna_pf_circfold(), vrna_pf(), vrna_fold_compound(), #vrna_fold_compound_t
+ *
+ *  @param sequence   RNA sequence
+ *  @param structure  A pointer to the character array where position-wise pairing propensity
+ *                    will be stored. (Maybe NULL)
+ *  @param pl         A pointer to a list of #vrna_plist_t to store pairing probabilities (Maybe NULL)
+ *  @return The Gibbs free energy of the ensemble (@f$G = -RT \cdot \log(Q) @f$) in kcal/mol
+ */
+float vrna_pf_fold(const char *sequence, char *structure, vrna_plist_t **pl);
+
+/**
+ *  @brief  Compute Partition function @f$Q@f$ (and base pair probabilities) for a circular
+ *          RNA sequences using a comparative method
+ *
+ *  @ingroup pf_fold
+ *
+ *  This simplified interface to vrna_pf() computes the partition function and, if required,
+ *  base pair probabilities for a circular RNA sequence using default options. Memory required for
+ *  dynamic programming (DP) matrices will be allocated and free'd on-the-fly. Hence, after return of
+ *  this function, the recursively filled matrices are not available any more for any post-processing.
+ *
+ *  @note In case you want to use the filled DP matrices for any subsequent post-processing step, or
+ *  you require other conditions than specified by the default model details, use vrna_pf(),
+ *  and the data structure #vrna_fold_compound_t instead.
+ *
+ *  Folding of circular RNA sequences is handled as a post-processing step of the forward
+ *  recursions. See @cite hofacker:2006 for further details.
+ *
+ *  @see vrna_pf_fold(), vrna_pf(), vrna_fold_compound(), #vrna_fold_compound_t
+ *
+ *  @param sequence  A circular RNA sequence
+ *  @param structure  A pointer to the character array where position-wise pairing propensity
+ *                    will be stored. (Maybe NULL)
+ *  @param pl         A pointer to a list of #vrna_plist_t to store pairing probabilities (Maybe NULL)
+ *  @return The Gibbs free energy of the ensemble (@f$G = -RT \cdot \log(Q) @f$) in kcal/mol
+ */
+float vrna_pf_circfold(const char *sequence, char *structure, vrna_plist_t **pl);
+
+/*
+#################################################
+# OTHER PARTITION FUNCTION RELATED DECLARATIONS #
+#################################################
+*/
+
+/**
+ *  @brief  Find out whether partition function computations are using
+ *          single precision floating points
+ *
+ *  @see #FLT_OR_DBL
+ *  @return  1 if single precision is used, 0 otherwise
+ */
+int vrna_pf_float_precision(void);
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*
+#################################################
+# DEPRECATED FUNCTIONS                          #
+#################################################
+*/
+
+/**
+ *  @brief Flag indicating that auxilary arrays are needed throughout the computations. This is essential for stochastic backtracking
+ *
+ *  Set this variable to 1 prior to a call of pf_fold() to ensure that all matrices needed for stochastic backtracking
+ *  are filled in the forward recursions
+ *
+ *  @deprecated   set the @e uniq_ML flag in #vrna_md_t before passing it to vrna_fold_compound().
+ *
+ *  @ingroup subopt_stochbt
+ *
+ *  @see pbacktrack(), pbacktrack_circ
+ */
+extern  int st_back;
+
+/**
+ *  @brief Compute the partition function @f$Q@f$ for a given RNA sequence
+ *
+ *  If @a structure is not a NULL pointer on input, it contains on
+ *  return a string consisting of the letters " . , | { } ( ) " denoting
+ *  bases that are essentially unpaired, weakly paired, strongly paired without
+ *  preference, weakly upstream (downstream) paired, or strongly up-
+ *  (down-)stream paired bases, respectively.
+ *  If #fold_constrained is not 0, the @a structure string is
+ *  interpreted on input as a list of constraints for the folding. The
+ *  character "x" marks bases that must be unpaired, matching brackets " ( ) "
+ *  denote base pairs, all other characters are ignored. Any pairs
+ *  conflicting with the constraint will be forbidden. This is usually sufficient
+ *  to ensure the constraints are honored.
+ *  If the parameter calculate_bppm is set to 0 base pairing probabilities will not
+ *  be computed (saving CPU time), otherwise after calculations took place #pr will
+ *  contain the probability that bases @a i and @a j pair.
+ * 
+ *  @ingroup pf_fold
+ *
+ *  @deprecated Use vrna_pf() instead
+ *
+ *  @note           The global array #pr is deprecated and the user who wants the calculated
+ *                  base pair probabilities for further computations is advised to use the function
+ *                  export_bppm()
+ *  @post           After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors.
+ *                  Depending on whether the global variable #do_backtrack was set the base pair probabilities are already
+ *                  computed and may be accessed for further usage via the export_bppm() function.
+ *                  A call of free_pf_arrays() will free all memory allocated by this function.
+ *                  Successive calls will first free previously allocated memory before starting the computation.
+ *  @see            vrna_pf(), bppm_to_structure(), export_bppm(), vrna_exp_params(), free_pf_arrays()
+ *  @param[in]      sequence        The RNA sequence input
+ *  @param[in,out]  structure       A pointer to a char array where a base pair probability information can be stored in a
+ *                                  pseudo-dot-bracket notation (may be NULL, too)
+ *  @param[in]      parameters      Data structure containing the precalculated Boltzmann factors
+ *  @param[in]      calculate_bppm  Switch to Base pair probability calculations on/off (0==off)
+ *  @param[in]      is_constrained  Switch to indicate that a structure contraint is passed via the structure argument (0==off)
+ *  @param[in]      is_circular     Switch to (de-)activate postprocessing steps in case RNA sequence is circular (0==off)
+ *  @return         The Gibbs free energy of the ensemble (@f$G = -RT \cdot \log(Q) @f$) in kcal/mol
+ */
+DEPRECATED(float   pf_fold_par(  const char *sequence,
+                      char *structure,
+                      vrna_exp_param_t *parameters,
+                      int calculate_bppm,
+                      int is_constrained,
+                      int is_circular));
+
+/**
+ *  @brief Compute the partition function @f$Q@f$ of an RNA sequence
+ * 
+ *  If @a structure is not a NULL pointer on input, it contains on
+ *  return a string consisting of the letters " . , | { } ( ) " denoting
+ *  bases that are essentially unpaired, weakly paired, strongly paired without
+ *  preference, weakly upstream (downstream) paired, or strongly up-
+ *  (down-)stream paired bases, respectively.
+ *  If #fold_constrained is not 0, the @a structure string is
+ *  interpreted on input as a list of constraints for the folding. The
+ *  character "x" marks bases that must be unpaired, matching brackets " ( ) "
+ *  denote base pairs, all other characters are ignored. Any pairs
+ *  conflicting with the constraint will be forbidden. This is usually sufficient
+ *  to ensure the constraints are honored.
+ *  If #do_backtrack has been set to 0 base pairing probabilities will not
+ *  be computed (saving CPU time), otherwise #pr will contain the probability
+ *  that bases @a i and @a j pair.
+ * 
+ *  @ingroup pf_fold
+ *
+ *  @note   The global array #pr is deprecated and the user who wants the calculated
+ *          base pair probabilities for further computations is advised to use the function
+ *          export_bppm().
+ *  @note   @b OpenMP:
+ *          This function is not entirely threadsafe. While the recursions are working on their
+ *          own copies of data the model details for the recursions are determined from the global
+ *          settings just before entering the recursions. Consider using pf_fold_par() for a
+ *          really threadsafe implementation.
+ *  @pre    This function takes its model details from the global variables provided in @e RNAlib
+ *  @post   After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors.
+ *          Depending on whether the global variable #do_backtrack was set the base pair probabilities are already
+ *          computed and may be accessed for further usage via the export_bppm() function.
+ *          A call of free_pf_arrays() will free all memory allocated by this function.
+ *          Successive calls will first free previously allocated memory before starting the computation.
+ *  @see    pf_fold_par(), pf_circ_fold(), bppm_to_structure(), export_bppm()
+ *  @param sequence   The RNA sequence input
+ *  @param structure  A pointer to a char array where a base pair probability information can be stored in a pseudo-dot-bracket notation (may be NULL, too)
+ *  @return           The Gibbs free energy of the ensemble (@f$G = -RT \cdot \log(Q) @f$) in kcal/mol
+ */
+DEPRECATED(float   pf_fold(const char *sequence,
+                char *structure));
+
+/**
+ *  @brief Compute the partition function of a circular RNA sequence
+ * 
+ *  @ingroup pf_fold
+ *
+ *  @note           The global array #pr is deprecated and the user who wants the calculated
+ *                  base pair probabilities for further computations is advised to use the function
+ *                  export_bppm().
+ *  @note           @b OpenMP:
+ *                  This function is not entirely threadsafe. While the recursions are working on their
+ *                  own copies of data the model details for the recursions are determined from the global
+ *                  settings just before entering the recursions. Consider using pf_fold_par() for a
+ *                  really threadsafe implementation.
+ *  @pre            This function takes its model details from the global variables provided in @e RNAlib
+ *  @post           After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors.
+ *                  Depending on whether the global variable #do_backtrack was set the base pair probabilities are already
+ *                  computed and may be accessed for further usage via the export_bppm() function.
+ *                  A call of free_pf_arrays() will free all memory allocated by this function.
+ *                  Successive calls will first free previously allocated memory before starting the computation.
+ *  @see            vrna_pf()
+ *  @deprecated     Use vrna_pf() instead!
+ *  @param[in]      sequence   The RNA sequence input
+ *  @param[in,out]  structure  A pointer to a char array where a base pair probability information can be
+ *                  stored in a pseudo-dot-bracket notation (may be NULL, too)
+ *  @return         The Gibbs free energy of the ensemble (@f$G = -RT \cdot \log(Q) @f$) in kcal/mol
+ */
+DEPRECATED(float   pf_circ_fold( const char *sequence,
+                      char *structure));
+
+/**
+ *  @brief Sample a secondary structure from the Boltzmann ensemble according its probability
+ *
+ *  @ingroup subopt_stochbt
+ *  @pre    #st_back has to be set to 1 before calling pf_fold() or pf_fold_par()
+ *  @pre    pf_fold_par() or pf_fold() have to be called first to fill the partition function matrices
+ *
+ *  @param  sequence  The RNA sequence
+ *  @return           A sampled secondary structure in dot-bracket notation
+ */
+DEPRECATED(char    *pbacktrack(char *sequence));
+
+DEPRECATED(char    *pbacktrack5(char *sequence, int length));
+
+/**
+ *  @brief Sample a secondary structure of a circular RNA from the Boltzmann ensemble according its probability
+ * 
+ *  This function does the same as @ref pbacktrack() but assumes the RNA molecule to be circular
+ *
+ *  @ingroup subopt_stochbt
+
+ *  @pre    #st_back has to be set to 1 before calling pf_fold() or pf_fold_par()
+ *  @pre    pf_fold_par() or pf_circ_fold() have to be called first to fill the partition function matrices
+ *
+ *  @deprecated Use vrna_pbacktrack() instead.
+ *
+ *  @param  sequence  The RNA sequence
+ *  @return           A sampled secondary structure in dot-bracket notation
+ */
+DEPRECATED(char    *pbacktrack_circ(char *sequence));
+
+/**
+ *  @brief Free arrays for the partition function recursions
+ *
+ *  Call this function if you want to free all allocated memory associated with
+ *  the partition function forward recursion.
+ *  @note Successive calls of pf_fold(), pf_circ_fold() already check if they should free
+ *  any memory from a previous run.
+ *  @note <b>OpenMP notice:</b><br>
+ *  This function should be called before leaving a thread in order to avoid leaking memory
+ *  
+ *  @deprecated See vrna_fold_compound_t and its related functions for how to free memory
+ *  occupied by the dynamic programming matrices
+ *
+ *  @ingroup pf_fold
+ *
+ *  @post   All memory allocated by pf_fold_par(), pf_fold() or pf_circ_fold() will be free'd
+ *  @see    pf_fold_par(), pf_fold(), pf_circ_fold()
+ */
+DEPRECATED(void  free_pf_arrays(void));
+
+/**
+ *  @brief Recalculate energy parameters
+ * 
+ *  Call this function to recalculate the pair matrix and energy parameters
+ *  after a change in folding parameters like #temperature
+ *
+ *  @deprecated Use vrna_exp_params_subst() instead
+ *  @ingroup pf_fold
+ *
+ */
+DEPRECATED(void  update_pf_params(int length));
+
+/**
+ *  @brief Recalculate energy parameters
+ *
+ *  @deprecated Use vrna_exp_params_subst() instead
+ *  @ingroup pf_fold
+ *
+ */
+DEPRECATED(void update_pf_params_par(int length, vrna_exp_param_t *parameters));
+
+/**
+ *  @brief Get a pointer to the base pair probability array
+ *  @ingroup  pf_fold
+ *
+ *  Accessing the base pair probabilities for a pair (i,j) is achieved by
+ *  @code
+ *  FLT_OR_DBL *pr  = export_bppm();
+ *  pr_ij           = pr[iindx[i]-j];
+ *  @endcode
+ *
+ *  @pre      Call pf_fold_par(), pf_fold() or pf_circ_fold() first to fill the base pair probability array
+ *
+ *  @see pf_fold(), pf_circ_fold(), vrna_idx_row_wise()
+ *
+ *  @return A pointer to the base pair probability array
+ */
+DEPRECATED(FLT_OR_DBL  *export_bppm(void));
+
+
+/**
+ *  @brief Get the pointers to (almost) all relavant computation arrays used in partition function computation
+ *
+ *  @ingroup    pf_fold
+ *  @pre        In order to assign meaningful pointers, you have to call pf_fold_par() or pf_fold() first!
+ *  @see        pf_fold_par(), pf_fold(), pf_circ_fold()
+ *  @param[out] S_p       A pointer to the 'S' array (integer representation of nucleotides)
+ *  @param[out] S1_p      A pointer to the 'S1' array (2nd integer representation of nucleotides)
+ *  @param[out] ptype_p   A pointer to the pair type matrix
+ *  @param[out] qb_p      A pointer to the Q<sup>B</sup> matrix
+ *  @param[out] qm_p      A pointer to the Q<sup>M</sup> matrix
+ *  @param[out] q1k_p     A pointer to the 5' slice of the Q matrix (@f$q1k(k) = Q(1, k)@f$)
+ *  @param[out] qln_p     A pointer to the 3' slice of the Q matrix (@f$qln(l) = Q(l, n)@f$)
+ *  @return     Non Zero if everything went fine, 0 otherwise
+ */
+DEPRECATED(int get_pf_arrays(short **S_p,
+                  short **S1_p,
+                  char **ptype_p,
+                  FLT_OR_DBL **qb_p,
+                  FLT_OR_DBL **qm_p,
+                  FLT_OR_DBL **q1k_p,
+                  FLT_OR_DBL **qln_p));
+
+/**
+ *  @brief Get the free energy of a subsequence from the q[] array
+ */
+DEPRECATED(double get_subseq_F(int i, int j));
+
+
+/**
+ *  @brief Get the mean base pair distance of the last partition function computation
+ * 
+ *  @ingroup pf_fold
+ *
+ *  @deprecated Use vrna_mean_bp_distance() or vrna_mean_bp_distance_pr() instead!
+ *  @see vrna_mean_bp_distance(), vrna_mean_bp_distance_pr()
+ * 
+ *  @param    length
+ *  @return  mean base pair distance in thermodynamic ensemble
+ */
+DEPRECATED(double  mean_bp_distance(int length));
+
+/**
+ *  @brief Get the mean base pair distance in the thermodynamic ensemble
+ * 
+ *  This is a threadsafe implementation of @ref mean_bp_dist() !
+ * 
+ *  @f$<d> = \sum_{a,b} p_a p_b d(S_a,S_b)@f$\n
+ *  this can be computed from the pair probs @f$p_ij@f$ as\n
+ *  @f$<d> = \sum_{ij} p_{ij}(1-p_{ij})@f$
+ * 
+ *  @deprecated Use vrna_mean_bp_distance() or vrna_mean_bp_distance_pr() instead!
+ * 
+ *  @ingroup pf_fold
+ *
+ *  @param length The length of the sequence
+ *  @param pr     The matrix containing the base pair probabilities
+ *  @return       The mean pair distance of the structure ensemble
+ */
+DEPRECATED(double mean_bp_distance_pr(int length, FLT_OR_DBL *pr));
+
+/**
+ *  @brief  Get the probability of stacks
+ *
+ *  @deprecated   Use vrna_stack_prob() instead!
+ */
+DEPRECATED(vrna_plist_t *stackProb(double cutoff));
+
+
+/**
+ *  @brief Allocate space for pf_fold()
+ * 
+ *  @deprecated This function is obsolete and will be removed soon!
+ */
+DEPRECATED(void init_pf_fold(int length));
+
+/**
+ *  @deprecated This function is deprecated and should not be used anymore as it is not threadsafe!
+ *  @see get_centroid_struct_pl(), get_centroid_struct_pr()
+ */
+DEPRECATED(char *centroid(int length, double *dist));
+
+/**
+ *  @deprecated This function is deprecated and should not be used anymore as it is not threadsafe!
+ *  @see vrna_centroid(), vrna_centroid_from_probs(), vrna_centroid_from_plist()
+ */
+DEPRECATED(char *get_centroid_struct_gquad_pr(int length,
+                                  double *dist));
+
+/**
+ *  get the mean pair distance of ensemble
+ * 
+ *  @deprecated This function is not threadsafe and should not be used anymore. Use @ref mean_bp_distance() instead!
+ */
+DEPRECATED(double mean_bp_dist(int length));
+
+/**
+ *  @deprecated Use @ref exp_E_IntLoop() from loop_energies.h instead
+ */
+DEPRECATED(double expLoopEnergy(int u1,
+                                int u2,
+                                int type,
+                                int type2,
+                                short si1,
+                                short sj1,
+                                short sp1,
+                                short sq1));
+
+/**
+ *  @deprecated Use exp_E_Hairpin() from loop_energies.h instead
+ */
+DEPRECATED(double expHairpinEnergy( int u,
+                                    int type,
+                                    short si1,
+                                    short sj1,
+                                    const char *string));
+
+/* this doesn't work if free_pf_arrays() is called before */
+DEPRECATED(void assign_plist_gquad_from_pr(vrna_plist_t **pl,
+                                int length,
+                                double cut_off));
+
+#endif
+
+#endif
diff --git a/C/ViennaRNA/part_func_co.c b/C/ViennaRNA/part_func_co.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/part_func_co.c
@@ -0,0 +1,1473 @@
+/*
+                  partiton function for RNA secondary structures
+
+                  Ivo L Hofacker
+                  Stephan Bernhart
+                  Ronny Lorenz
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <float.h>    /* #defines FLT_MAX ... */
+#include <limits.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/structure_utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/PS_dot.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/part_func.h"
+#include "ViennaRNA/part_func_co.h"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+int     mirnatog      = 0;
+double  F_monomer[2]  = {0,0}; /* free energies of the two monomers */
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/* some backward compatibility stuff */
+PRIVATE vrna_fold_compound_t  *backward_compat_compound = NULL;
+PRIVATE int                 backward_compat           = 0;
+
+#ifdef _OPENMP
+
+#pragma omp threadprivate(backward_compat_compound, backward_compat)
+
+#endif
+
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE void    pf_co(vrna_fold_compound_t *vc);
+PRIVATE void    pf_co_bppm(vrna_fold_compound_t *vc, char *structure);
+PRIVATE double  *Newton_Conc(double ZAB, double ZAA, double ZBB, double concA, double concB,double* ConcVec);
+PRIVATE vrna_dimer_pf_t wrap_co_pf_fold(char *sequence,
+                                char *structure,
+                                vrna_exp_param_t *parameters,
+                                int calculate_bppm,
+                                int is_constrained);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+/*
+*****************************************
+* BEGIN backward compatibility wrappers *
+*****************************************
+*/
+
+PRIVATE vrna_dimer_pf_t
+wrap_co_pf_fold(char *sequence,
+                char *structure,
+                vrna_exp_param_t *parameters,
+                int calculate_bppm,
+                int is_constrained){
+
+  int                 length;
+  char                *seq;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t           md;
+
+  vc      = NULL;
+  length  = strlen(sequence);
+
+  /* we need vrna_exp_param_t datastructure to correctly init default hard constraints */
+  if(parameters)
+    md = parameters->model_details;
+  else{
+    set_model_details(&md); /* get global default parameters */
+  }
+  md.compute_bpp    = calculate_bppm;
+  md.min_loop_size  = 0;
+
+  seq = (char *)vrna_alloc(sizeof(char) * (length + 2));
+  if(cut_point > -1){
+    int i;
+    for(i = 0; i < cut_point-1; i++)
+      seq[i] = sequence[i];
+    seq[i] = '&';
+    for(;i<(int)length;i++)
+      seq[i+1] = sequence[i];
+  } else { /* this ensures the allocation of all cofold matrices via vrna_fold_compound_t */
+    free(seq);
+    seq = strdup(sequence);
+  }
+
+  vc = vrna_fold_compound(seq, &md, VRNA_OPTION_PF | VRNA_OPTION_HYBRID);
+
+  if(is_constrained && structure){
+    unsigned int constraint_options = 0;
+    constraint_options |= VRNA_CONSTRAINT_DB
+                          | VRNA_CONSTRAINT_DB_PIPE
+                          | VRNA_CONSTRAINT_DB_DOT
+                          | VRNA_CONSTRAINT_DB_X
+                          | VRNA_CONSTRAINT_DB_ANG_BRACK
+                          | VRNA_CONSTRAINT_DB_RND_BRACK;
+
+    vrna_constraints_add(vc, (const char *)structure, constraint_options);
+  }
+
+  if(backward_compat_compound)
+    vrna_fold_compound_free(backward_compat_compound);
+
+  backward_compat_compound = vc;
+  backward_compat           = 1;
+  iindx = backward_compat_compound->iindx;
+
+  free(seq);
+  return vrna_pf_dimer(vc, structure);
+}
+
+/*
+*****************************************
+* END backward compatibility wrappers   *
+*****************************************
+*/
+
+PUBLIC vrna_dimer_pf_t
+vrna_pf_dimer(vrna_fold_compound_t *vc,
+              char *structure){
+
+  int             n;
+  FLT_OR_DBL      Q;
+  vrna_dimer_pf_t         X;
+  double          free_energy;
+  char            *sequence;
+  vrna_md_t       *md;
+  vrna_exp_param_t  *params;
+  vrna_mx_pf_t      *matrices;
+
+  if(!vrna_fold_compound_prepare(vc, VRNA_OPTION_PF | VRNA_OPTION_HYBRID)){
+    vrna_message_warning("vrna_pf_dimer@part_func_co.c: Failed to prepare vrna_fold_compound");
+    X.FA = X.FB = X.FAB = X.F0AB = X.FcAB  = 0;
+    return X;
+  }
+
+  params    = vc->exp_params;
+  n         = vc->length;
+  md        = &(params->model_details);
+  matrices  = vc->exp_matrices;
+  sequence  = vc->sequence;
+
+#ifdef _OPENMP
+/* Explicitly turn off dynamic threads */
+  omp_set_dynamic(0);
+#endif
+
+#ifdef SUN4
+  nonstandard_arithmetic();
+#else
+#ifdef HP9
+  fpsetfastmode(1);
+#endif
+#endif
+
+  /* call user-defined recursion status callback function */
+  if(vc->stat_cb)
+    vc->stat_cb(VRNA_STATUS_PF_PRE, vc->auxdata);
+
+  pf_co(vc);
+
+  /* call user-defined recursion status callback function */
+  if(vc->stat_cb)
+    vc->stat_cb(VRNA_STATUS_PF_POST, vc->auxdata);
+
+  if (md->backtrack_type=='C')
+    Q = matrices->qb[vc->iindx[1]-n];
+  else if (md->backtrack_type=='M')
+    Q = matrices->qm[vc->iindx[1]-n];
+  else Q = matrices->q[vc->iindx[1]-n];
+
+  /* ensemble free energy in Kcal/mol */
+  if (Q<=FLT_MIN)
+    vrna_message_warning("pf_scale too large");
+  free_energy = (-log(Q)-n*log(params->pf_scale))*params->kT/1000.0;
+  /* in case we abort because of floating point errors */
+  if(n>1600)
+    vrna_message_info(stderr, "free energy = %8.2f", free_energy);
+  /*probability of molecules being bound together*/
+
+  /*Computation of "real" Partition function*/
+  /*Need that for concentrations*/
+  if (vc->cutpoint > 0){
+    double kT, QAB, QToT, Qzero;
+    kT = params->kT/1000.0;
+    Qzero = matrices->q[vc->iindx[1] - n];
+    QAB = (matrices->q[vc->iindx[1] - n]- matrices->q[vc->iindx[1] - (vc->cutpoint - 1)] * matrices->q[vc->iindx[vc->cutpoint] - n]) * params->expDuplexInit;
+    /*correction for symmetry*/
+    if((n - (vc->cutpoint - 1) * 2) == 0){
+      if((strncmp(sequence, sequence + vc->cutpoint - 1, vc->cutpoint - 1)) == 0){
+        QAB/=2;
+      }
+    }
+
+    QToT    = matrices->q[vc->iindx[1] - (vc->cutpoint - 1)] * matrices->q[vc->iindx[vc->cutpoint] - n] + QAB;
+    X.FAB   = -kT * (log(QToT) + n * log(params->pf_scale));
+    X.F0AB  = -kT * (log(Qzero)+ n * log(params->pf_scale));
+    X.FcAB  = (QAB>1e-17) ? -kT * (log(QAB) + n * log(params->pf_scale)) : 999;
+    X.FA    = -kT * (log(matrices->q[vc->iindx[1] - (vc->cutpoint - 1)]) + (vc->cutpoint - 1) * log(params->pf_scale));
+    X.FB    = -kT * (log(matrices->q[vc->iindx[vc->cutpoint] - n]) + (n - vc->cutpoint + 1) * log(params->pf_scale));
+
+    /* printf("QAB=%.9f\tQtot=%.9f\n",QAB/scale[n],QToT/scale[n]);*/
+  }
+  else {
+    X.FA    = X.FB = X.FAB = X.F0AB = free_energy;
+    X.FcAB  = 0;
+  }
+
+  /* backtracking to construct binding probabilities of pairs*/
+  if(md->compute_bpp){
+    pf_co_bppm(vc, structure);
+    /*
+    *  Backward compatibility:
+    *  This block may be removed if deprecated functions
+    *  relying on the global variable "pr" vanish from within the package!
+    */
+    pr = vc->exp_matrices->probs;
+    /*
+    {
+      if(pr) free(pr);
+      pr = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * ((n+1)*(n+2)/2));
+      memcpy(pr, probs, sizeof(FLT_OR_DBL) * ((n+1)*(n+2)/2));
+    }
+    */
+  }
+
+#ifdef SUN4
+  standard_arithmetic();
+#else
+#ifdef HP9
+  fpsetfastmode(0);
+#endif
+#endif
+
+  return X;
+}
+
+/* forward recursion of pf cofolding */
+PRIVATE void
+pf_co(vrna_fold_compound_t *vc){
+
+  unsigned int      *sn;
+  int               n, i,j,k,l, ij, kl, u,u1,u2,ii, type, type_2, tt, cp, turn, maxk, minl;
+  FLT_OR_DBL        *qqm = NULL, *qqm1 = NULL, *qq = NULL, *qq1 = NULL;
+  FLT_OR_DBL        temp, q_temp, Qmax=0;
+  FLT_OR_DBL        qbt1, *tmp;
+  FLT_OR_DBL        *q, *qb, *qm, *qm1;
+  FLT_OR_DBL        *scale;
+  FLT_OR_DBL        *expMLbase;
+  short             *S1;
+          short s5, s3;
+  int               *my_iindx, *jindx;
+  char              *ptype, *sequence;
+  vrna_md_t         *md;
+  vrna_hc_t         *hc;
+  vrna_sc_t         *sc;
+  FLT_OR_DBL        expMLclosing;
+  int               noGUclosure;
+  double            max_real;
+  int               *rtype;
+  vrna_exp_param_t  *pf_params;
+  vrna_mx_pf_t      *matrices;
+  int               hc_decompose;
+  char              *hard_constraints;
+  int               *hc_up_ext;
+  int               *hc_up_hp;
+  int               *hc_up_int;
+  int               *hc_up_ml;
+
+  sequence          = vc->sequence;
+  S1                = vc->sequence_encoding;
+  n                 = vc->length;
+  cp                = vc->cutpoint;
+  my_iindx          = vc->iindx;
+  jindx             = vc->jindx;
+  ptype             = vc->ptype;
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  sn                = vc->strand_number;
+  rtype             = &(md->rtype[0]);
+  hc                = vc->hc;
+  sc                = vc->sc;
+  expMLclosing      = pf_params->expMLclosing;
+  noGUclosure       = md->noGUclosure;
+  matrices          = vc->exp_matrices;
+  turn              = md->min_loop_size;
+
+  q                 = matrices->q;
+  qb                = matrices->qb;
+  qm                = matrices->qm;
+  qm1               = matrices->qm1;
+  scale             = matrices->scale;
+  expMLbase         = matrices->expMLbase;
+
+  hard_constraints  = hc->matrix;
+  hc_up_ext         = hc->up_ext;
+  hc_up_hp          = hc->up_hp;
+  hc_up_int         = hc->up_int;
+  hc_up_ml          = hc->up_ml;
+
+  max_real          = (sizeof(FLT_OR_DBL) == sizeof(float)) ? FLT_MAX : DBL_MAX;
+
+  /* allocate memory for helper arrays */
+  qq        = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+  qq1       = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+  qqm       = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+  qqm1      = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+
+  /* hard code min_loop_size to 0, since we can not be sure yet that this is already the case */
+  turn = 0;
+
+  /*array initialization ; qb,qm,q
+    qb,qm,q (i,j) are stored as ((n+1-i)*(n-i) div 2 + n+1-j */
+
+  /* for (d=0; d<=TURN; d++) */
+  for (i=1; i<=n/*-d*/; i++) {
+      ij      = my_iindx[i]-i;
+      if(hc_up_ext[i]){
+        q[ij] = scale[1];
+
+        if(sc){
+          if(sc->exp_energy_up)
+            q[ij] *= sc->exp_energy_up[i][1];
+          if(sc->exp_f)
+            q[ij] *= sc->exp_f(i, i, i, i, VRNA_DECOMP_EXT_UP, sc->data);
+        }
+      } else {
+        q[ij] = 0.;
+      }
+
+      qb[ij]  = qm[ij] = 0.0;
+    }
+
+  for (i=0; i<=n; i++)
+    qq[i] = qq1[i] = qqm[i] = qqm1[i] = 0;
+
+  for (j = turn + 2; j <= n; j++) {
+    for (i = j - turn - 1; i >= 1; i--) {
+      /* construction of partition function of segment i,j */
+      /* firstly that given i binds j : qb(i,j) */
+      u             = j - i - 1;
+      ij            = my_iindx[i] - j;
+      type          = (unsigned char)ptype[jindx[j] + i];
+      hc_decompose  = hard_constraints[jindx[j] + i];
+      qbt1          = 0;
+      q_temp        = 0.;
+
+      if(hc_decompose){
+        /* process hairpin loop(s) */
+        qbt1 += vrna_exp_E_hp_loop(vc, i, j);
+        qbt1 += vrna_exp_E_int_loop(vc, i, j);
+        qbt1 += vrna_exp_E_mb_loop_fast(vc, i, j, qqm1);
+
+        qb[ij] = qbt1;
+      } else  /* end if allowed to be paired */
+        qb[ij] = 0.0;
+
+      /* construction of qqm matrix containing final stem
+         contributions to multiple loop partition function
+         from segment i,j */
+      qqm[i] = 0.;
+
+      if(hc_up_ml[j]){
+        if (sn[j] == sn[j - 1]) {
+          q_temp  =  qqm1[i] * expMLbase[1];
+
+          if(sc){
+            if(sc->exp_energy_up)
+              q_temp *= sc->exp_energy_up[j][1];
+
+            if(sc->exp_f)
+              q_temp *= sc->exp_f(i, j, i, j-1, VRNA_DECOMP_ML_ML, sc->data);
+          }
+
+          qqm[i] = q_temp;
+        }
+      }
+
+      if(hc_decompose & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC){
+        if ((sn[i] == sn[i - 1]) && (sn[j + 1] == sn[j])) {
+          tt = type;
+
+          if(tt == 0)
+            tt = 7;
+
+          qbt1    =   qb[ij];
+          qbt1    *=  exp_E_MLstem(tt, (i>1) ? S1[i-1] : -1, (j<n) ? S1[j+1] : -1, pf_params);
+          if(sc){
+            if(sc->exp_f)
+              q_temp *= sc->exp_f(i, j, i, j, VRNA_DECOMP_ML_STEM, sc->data);
+          }
+          qqm[i]  +=  qbt1;
+        }
+      }
+
+      if (qm1) qm1[jindx[j]+i] = qqm[i]; /* for stochastic backtracking */
+
+
+      /*construction of qm matrix containing multiple loop
+        partition function contributions from segment i,j */
+      temp  = 0.0;
+      kl = my_iindx[i] - j + 1; /* ii-k=[i,k-1] */
+
+      if (sc && sc->exp_f) {
+        if (j >= cp) {
+          for (k = j; k > MAX2(i, cp); k--, kl++) {
+            q_temp = qm[kl] * qqm[k];
+            q_temp *= sc->exp_f(i, j, k - 1, k, VRNA_DECOMP_ML_ML_ML, sc->data);
+            temp += q_temp;
+          }
+          for (; k > i; k--, kl++) {
+            q_temp = qm[kl] * qqm[k];
+            q_temp *= sc->exp_f(i, j, k - 1, k, VRNA_DECOMP_ML_ML_ML, sc->data);
+            temp += q_temp;
+          }
+        } else {
+          for (k = j; k > i; k--, kl++) {
+            q_temp = qm[kl] * qqm[k];
+            q_temp *= sc->exp_f(i, j, k - 1, k, VRNA_DECOMP_ML_ML_ML, sc->data);
+            temp += q_temp;
+          }
+        }
+      } else { /* without soft-constraints */
+        if (j >= cp) {
+          for (k = j; k > MAX2(i, cp); k--, kl++)
+            temp += qm[kl] * qqm[k];
+          for (; k > i; k--, kl++)
+            temp += qm[kl] * qqm[k];
+        } else {
+          for (k = j; k > i; k--, kl++)
+            temp += qm[kl] * qqm[k];
+        }
+      }
+
+      maxk = MIN2(i + hc_up_ml[i], j);
+      if (i < cp) { /* we must not have the strand border within the unpaired segment */
+        maxk = MIN2(maxk, cp - 1);
+      }
+
+      u = 1; /* length of unpaired stretch */
+
+      if (sc) {
+        for (k = i + 1; k <= maxk; k++, u++){
+          q_temp = expMLbase[u] * qqm[k];
+
+          if(sc->exp_energy_up)
+            q_temp *= sc->exp_energy_up[i][u];
+
+          if(sc->exp_f)
+            q_temp *= sc->exp_f(i, j, k, j, VRNA_DECOMP_ML_ML, sc->data);
+
+          temp += q_temp;
+        }
+      } else { /* without soft-constraints */
+        for (k = i + 1; k <= maxk; k++, u++)
+          temp += expMLbase[u] * qqm[k];
+      }
+
+      qm[ij] = (temp + qqm[i]);
+
+      /*auxiliary matrix qq for cubic order q calculation below */
+      qbt1 = 0.;
+
+      if(hc_decompose & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+        tt = type;
+
+        if(tt == 0)
+          tt = 7;
+        s5 = ((i > 1) && (sn[i] == sn[i - 1])) ? S1[i - 1] : -1;
+        s3 = ((j < n) && (sn[j + 1] == sn[j])) ? S1[j + 1] : -1;
+        qbt1 =  qb[ij] * exp_E_ExtLoop(tt, s5, s3, pf_params);
+        if(sc){
+          if(sc->exp_f)
+            qbt1 *= sc->exp_f(i, j, i, j, VRNA_DECOMP_EXT_STEM, sc->data);
+        }
+     }
+
+      if(hc_up_ext[j]){
+        q_temp = qq1[i] * scale[1];
+
+        if(sc){
+          if(sc->exp_energy_up)
+            q_temp *= sc->exp_energy_up[j][1];
+
+          if(sc->exp_f)
+            q_temp *= sc->exp_f(i, j, i, j-1, VRNA_DECOMP_EXT_EXT, sc->data);
+        }
+
+        qbt1 += q_temp;
+      }
+      qq[i] = qbt1;
+
+       /*construction of partition function for segment i,j */
+      temp = qq[i];
+
+      /* the whole stretch [i,j] is unpaired */
+      if(hc_up_ext[i] >= (j-i+1)){
+        q_temp = 1.0 * scale[j-i+1];
+
+        if(sc){
+          if(sc->exp_energy_up)
+            q_temp *= sc->exp_energy_up[i][j-i+1];
+
+          if(sc->exp_f)
+            q_temp *= sc->exp_f(i, j, i, j, VRNA_DECOMP_EXT_UP, sc->data);
+        }
+
+        temp += q_temp;
+      }
+
+      kl = my_iindx[i] - i;
+
+      if (sc && sc->exp_f) {
+        for (k=i; k<j; k++, kl--){
+          q_temp = q[kl] * qq[k+1];
+          q_temp *= sc->exp_f(i, j, k, k+1, VRNA_DECOMP_EXT_EXT_EXT, sc->data);
+          temp += q_temp;
+        }
+      } else {
+        for (k=i; k<j; k++, kl--)
+          temp += q[kl] * qq[k+1];
+      }
+
+      q[ij] = temp;
+
+      if (temp>Qmax) {
+        Qmax = temp;
+        if (Qmax>max_real/10.)
+          vrna_message_warning("Q close to overflow: %d %d %g", i,j,temp);
+      }
+      if (temp>=max_real) {
+        vrna_message_error("overflow in co_pf_fold while calculating q[%d,%d]\n"
+                                  "use larger pf_scale", i,j);
+      }
+    }
+    tmp = qq1;  qq1 =qq;  qq =tmp;
+    tmp = qqm1; qqm1=qqm; qqm=tmp;
+  }
+
+  /* clean up */
+  free(qq);
+  free(qq1);
+  free(qqm);
+  free(qqm1);
+
+}
+
+/* backward recursion of pf cofolding */
+PRIVATE void
+pf_co_bppm(vrna_fold_compound_t *vc, char *structure){
+
+  unsigned int      *sn;
+  int               n, i,j,k,l, ij, kl, ii, ll, lj, u1, u2, type, type_2, tt, turn, ov=0, *my_iindx, *jindx, cp;
+  FLT_OR_DBL        temp, Qmax=0, prm_MLb, tmp2, ppp;
+  FLT_OR_DBL        prmt,prmt1, *expMLbase;
+  FLT_OR_DBL        *tmp;
+  FLT_OR_DBL        expMLclosing, *probs, *q1k, *qln, *q, *qb, *qm, *scale;
+  double            max_real;
+  vrna_exp_param_t  *pf_params;
+  vrna_md_t         *md;
+  short             *S, *S1, s5, s3;
+  char              *ptype;
+  vrna_hc_t         *hc;
+  vrna_sc_t         *sc;
+  vrna_mx_pf_t      *matrices;
+  char              *sequence;
+  char              *hard_constraints;
+  int               *hc_up_ext;
+  int               *hc_up_hp;
+  int               *hc_up_int;
+  int               *hc_up_ml;
+  int               *rtype;
+
+  sequence          = vc->sequence;
+  n                 = vc->length;
+  cp                = vc->cutpoint;
+  pf_params         = vc->exp_params;
+  md                = &(pf_params->model_details);
+  expMLclosing      = pf_params->expMLclosing;
+  S                 = vc->sequence_encoding2;
+  S1                = vc->sequence_encoding;
+  sn                = vc->strand_number;
+  jindx             = vc->jindx;
+  my_iindx          = vc->iindx;
+  ptype             = vc->ptype;
+  rtype             = &(md->rtype[0]);
+  turn              = md->min_loop_size;
+
+  matrices          = vc->exp_matrices;
+  probs             = matrices->probs;
+  scale             = matrices->scale;
+  q1k               = matrices->q1k;
+  qln               = matrices->qln;
+  q                 = matrices->q;
+  qb                = matrices->qb;
+  qm                = matrices->qm;
+  expMLbase         = matrices->expMLbase;
+
+  hc                = vc->hc;
+  sc                = vc->sc;
+
+  hard_constraints  = hc->matrix;
+  hc_up_ext         = hc->up_ext;
+  hc_up_hp          = hc->up_hp;
+  hc_up_int         = hc->up_int;
+  hc_up_ml          = hc->up_ml;
+
+  /* hard code min_loop_size to 0, since we can not be sure yet that this is already the case */
+  turn = 0;
+
+  max_real      = (sizeof(FLT_OR_DBL) == sizeof(float)) ? FLT_MAX : DBL_MAX;
+
+  /* backtracking to construct binding probabilities of pairs*/
+  if ((S != NULL) && (S1 != NULL)) {
+    FLT_OR_DBL   *Qlout, *Qrout;
+    FLT_OR_DBL *prm_l  = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+    FLT_OR_DBL *prm_l1 = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+    FLT_OR_DBL *prml   = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*(n+2));
+
+    Qmax  = 0;
+    Qrout = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (n+2));
+    Qlout = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * (cp+2));
+
+    for (k=1; k<=n; k++) {
+      q1k[k] = q[my_iindx[1] - k];
+      qln[k] = q[my_iindx[k] - n];
+    }
+    q1k[0] = 1.0;
+    qln[n+1] = 1.0;
+
+    /* 1. exterior pair i,j and initialization of pr array */
+    for (i=1; i<=n; i++) {
+      for (j=i; j<=MIN2(i + turn, n); j++)
+        probs[my_iindx[i]-j] = 0;
+
+      for (j = i + turn + 1; j <= n; j++){
+        ij = my_iindx[i]-j;
+        if((hard_constraints[jindx[j] + i] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP) && (qb[ij] > 0.)){
+          type  = ptype[jindx[j] + i];
+
+          if(type == 0)
+            type = 7;
+
+          s5 = ((i > 1) && (sn[i] == sn[i - 1])) ? S1[i - 1] : -1;
+          s3 = ((j < n) && (sn[j + 1] == sn[j])) ? S1[j + 1] : -1;
+          probs[ij] = q1k[i - 1] * qln[j + 1] / q1k[n];
+          probs[ij] *= exp_E_ExtLoop(type, s5, s3, pf_params);
+          if(sc){
+            if(sc->exp_f){
+              probs[ij] *= sc->exp_f(1, n, i, j, VRNA_DECOMP_EXT_STEM_OUTSIDE, sc->data);
+            }
+          }
+        } else
+          probs[ij] = 0;
+      }
+    }
+
+    for(l = n; l > turn + 1; l--){
+
+      /* 2. bonding k,l as substem of 2:loop enclosed by i,j */
+      for(k = 1; k < l - turn; k++){
+        kl      = my_iindx[k]-l;
+        type_2  = (unsigned char)ptype[jindx[l] + k];
+        type_2  = rtype[type_2];
+
+        if(qb[kl]==0.) continue;
+
+        if(hard_constraints[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC){
+
+          if(type_2 == 0)
+            type_2 = 7;
+
+          for(i = MAX2(1, k - MAXLOOP - 1); i <= k - 1; i++){
+            u1 = k - i - 1;
+            if(hc_up_int[i+1] < u1) continue;
+
+            for(j = l + 1; j <= MIN2(l + MAXLOOP - k + i + 2, n); j++){
+              u2 = j-l-1;
+              if(hc_up_int[l+1] < u2) break;
+
+              ij = my_iindx[i] - j;
+              if(hard_constraints[jindx[j] + i] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){
+
+                if ((sn[k] == sn[i]) && (sn[j] == sn[l])) {
+                  type = (unsigned char)ptype[jindx[j] + i];
+                  if(probs[ij] > 0){
+
+                    if(type == 0)
+                      type = 7;
+
+                    tmp2  = probs[ij]
+                            * scale[u1 + u2 + 2]
+                            * exp_E_IntLoop(u1, u2, type, type_2, S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params);
+
+                    if(sc){
+                      if(sc->exp_energy_up)
+                        tmp2 *=   sc->exp_energy_up[i+1][u1]
+                                * sc->exp_energy_up[l+1][u2];
+
+                      if(sc->exp_energy_bp)
+                        tmp2 *=   sc->exp_energy_bp[ij];
+
+                      if(sc->exp_energy_stack){
+                        if((i+1 == k) && (j-1 == l)){
+                          tmp2 *=   sc->exp_energy_stack[i]
+                                  * sc->exp_energy_stack[k]
+                                  * sc->exp_energy_stack[l]
+                                  * sc->exp_energy_stack[j];
+                        }
+                      }
+
+                      if(sc->exp_f)
+                        tmp2 *= sc->exp_f(i, j, k, l, VRNA_DECOMP_PAIR_IL, sc->data);
+                    }
+
+                    probs[kl] += tmp2;
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+
+      /* 3. bonding k,l as substem of multi-loop enclosed by i,j */
+      prm_MLb = 0.;
+      if ((l < n) && (sn[l + 1] == sn[l]))
+        for (k = 2; k < l - turn; k++) {
+          kl    = my_iindx[k] - l;
+          i     = k - 1;
+          prmt  = prmt1 = 0.0;
+
+          ii    = my_iindx[i];     /* ii-j=[i,j]     */
+          ll    = my_iindx[l+1];   /* ll-j=[l+1,j] */
+          tt    = (unsigned char)ptype[jindx[l+1] + i];
+          tt    = rtype[tt];
+          if (sn[k] == sn[i]) {
+            if(hard_constraints[jindx[l+1] + i] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+
+              if(tt == 0)
+                tt = 7;
+
+              prmt1 = probs[ii-(l+1)]
+                      * expMLclosing
+                      * exp_E_MLstem(tt, S1[l], S1[i+1], pf_params);
+
+              if(sc){
+                /* which decompositions are covered here? => (i, l+1) -> enclosing pair, (k,l) -> enclosed pair, */
+                if(sc->exp_energy_bp)
+                  prmt1 *= sc->exp_energy_bp[ii - (l+1)];
+
+/*
+                if(sc->exp_f)
+                  prmt1 *= sc->exp_f(i, l+1, k, l, , sc->data);
+*/
+              }
+            }
+            ij = my_iindx[i] - (l+2);
+            lj = my_iindx[l+1]-(l+1);
+
+            for(j = l + 2; j <= n; j++, ij--, lj--){
+              if(hard_constraints[jindx[j] + i] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP){
+                if (sn[j] == sn[j - 1]) { /*??*/
+                  tt    =   (unsigned char)ptype[jindx[j] + i];
+                  tt    =   rtype[tt];
+
+                  if(tt == 0)
+                    tt = 7;
+
+                  /* which decomposition is covered here? =>
+                    i + 1 = k < l < j:
+                    (i,j)       -> enclosing pair
+                    (k, l)      -> enclosed pair
+                    (l+1, j-1)  -> multiloop part with at least one stem
+                  */
+                  ppp = probs[ii-j]
+                        * exp_E_MLstem(tt, S1[j-1], S1[i+1], pf_params)
+                        * qm[ll-(j-1)];
+
+                  if(sc){
+                    if(sc->exp_energy_bp)
+                      ppp *= sc->exp_energy_bp[ij];
+/*
+                    if(sc->exp_f)
+                      ppp *= sc->exp_f(i, j, l+1, j-1, , sc->data);
+*/
+                  }
+                  prmt += ppp;
+                }
+              }
+            }
+          }
+          prmt *= expMLclosing;
+
+          tt        =   ptype[jindx[l] + k];
+
+          prml[ i]  =   prmt;
+
+          /* l+1 is unpaired */
+          if(hc->up_ml[l+1]){
+            ppp = prm_l1[i] * expMLbase[1];
+            if(sc){
+              if(sc->exp_energy_up)
+                ppp *= sc->exp_energy_up[l+1][1];
+
+/*
+              if(sc_exp_f)
+                ppp *= sc->exp_f(, sc->data);
+*/
+            }
+            prm_l[i] = ppp + prmt1;
+          } else {
+            prm_l[i] = prmt1;
+          }
+
+          /* i is unpaired */
+          if(hc->up_ml[i]){
+            ppp = prm_MLb*expMLbase[1];
+            if(sc){
+              if(sc->exp_energy_up)
+                ppp *= sc->exp_energy_up[i][1];
+
+/*
+              if(sc->exp_f)
+                ppp *= sc->exp_f(, sc->data);
+*/
+            }
+
+            prm_MLb = ppp + prml[i];
+            /* same as:    prm_MLb = 0;
+               for (i=1; i<=k-1; i++) prm_MLb += prml[i]*expMLbase[k-i-1]; */
+
+          } else {
+            prm_MLb = prml[i];
+          }
+          prml[i] = prml[ i] + prm_l[i];
+
+          if (qb[kl] == 0.) continue;
+
+          if(hard_constraints[jindx[l] + k] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC){
+            temp = prm_MLb;
+
+            for (i=1;i<=k-2; i++) {
+              if ((sn[i + 1] == sn[i]) && (sn[k] == sn[k - 1])) {
+                temp += prml[i]*qm[my_iindx[i+1] - (k-1)];
+              }
+            }
+
+            if(tt == 0)
+              tt = 7;
+
+            s5 = ((k > 1) && (sn[k] == sn[k - 1])) ? S1[k - 1] : -1;
+            s3 = ((l < n) && (sn[l + 1] == sn[l])) ? S1[l + 1] : -1;
+            temp *= exp_E_MLstem(tt, s5, s3, pf_params) * scale[2];
+            probs[kl] += temp;
+
+            if (probs[kl]>Qmax) {
+              Qmax = probs[kl];
+              if (Qmax>max_real/10.)
+                vrna_message_warning("P close to overflow: %d %d %g %g",
+                                            i, j, probs[kl], qb[kl]);
+            }
+            if (probs[kl]>=max_real) {
+              ov++;
+              probs[kl]=FLT_MAX;
+            }
+          }
+        } /* end for (k=..) multloop*/
+      else  /* set prm_l to 0 to get prm_l1 to be 0 */
+        for (i=0; i<=n; i++) prm_l[i]=0;
+
+      tmp = prm_l1; prm_l1=prm_l; prm_l=tmp;
+
+      /*computation of .(..(...)..&..). type features?*/
+      if (cp<=0) continue;            /* no .(..(...)..&..). type features*/
+      if ((l==n)||(l<=2)) continue;   /* no .(..(...)..&..). type features*/
+      /*new version with O(n^3)??*/
+      if (l>cp) {
+        if (l<n) {
+          int t,kt;
+          for (t=n; t>l; t--) {
+            for (k=1; k<cp; k++) {
+              int samestrand;
+              kt    = my_iindx[k]-t;
+
+              samestrand = (sn[k + 1] == sn[k]) ? 1 : 0;
+              type  = rtype[(unsigned char)ptype[jindx[t] + k]];
+
+              if(type == 0)
+                type = 7;
+
+              temp  = probs[kt]
+                      * exp_E_ExtLoop(type, S1[t-1], samestrand ? S1[k+1] : -1, pf_params)
+                      * scale[2];
+
+              if (l+1<t)
+                temp    *=  q[my_iindx[l+1]-(t-1)];
+
+              if (samestrand)
+                temp    *=  q[my_iindx[k+1]-(cp-1)];
+
+              Qrout[l]  +=  temp;
+            }
+          }
+        }
+        for (k=l-1; k>=cp; k--) {
+          if (qb[my_iindx[k]-l]) {
+            kl        =   my_iindx[k]-l;
+            type      =   ptype[jindx[l] + k];
+            temp      =   Qrout[l];
+
+            if(type == 0)
+              type = 7;
+
+            temp      *=  exp_E_ExtLoop(type, (k>cp) ? S1[k-1] : -1, (l < n) ? S1[l+1] : -1, pf_params);
+            if (k>cp)
+              temp    *=  q[my_iindx[cp]-(k-1)];
+            probs[kl] +=  temp;
+          }
+        }
+      }
+      else if (l==cp ) {
+        int t, sk,s;
+        for (t=2; t<cp;t++) {
+          for (s=1; s<t; s++) {
+            for (k=cp; k<=n; k++) {
+              sk=my_iindx[s]-k;
+              if (qb[sk]) {
+                int samestrand;
+                samestrand = (sn[k] == sn[k - 1]) ? 1 : 0;
+                type      =   rtype[(unsigned char)ptype[jindx[k] + s]];
+
+                if(type == 0)
+                  type = 7;
+
+                temp      =   probs[sk]
+                              * exp_E_ExtLoop(type, samestrand ? S1[k - 1] : -1, S1[s + 1], pf_params)
+                              * scale[2];
+                if (s+1<t)
+                  temp    *=  q[my_iindx[s+1]-(t-1)];
+                if (samestrand)
+                  temp    *=  q[my_iindx[cp]-(k-1)];
+                Qlout[t]  +=  temp;
+              }
+            }
+          }
+        }
+      }
+      else if (l<cp) {
+        for (k=1; k<l; k++) {
+          if (qb[my_iindx[k]-l]) {
+            type    =   ptype[jindx[l] + k];
+            temp    =   Qlout[k];
+
+            if(type == 0)
+              type = 7;
+
+            temp    *=  exp_E_ExtLoop(type, (k>1) ? S1[k-1] : -1, (l<(cp-1)) ? S1[l+1] : -1, pf_params);
+            if (l+1<cp)
+              temp  *=  q[my_iindx[l+1]-(cp-1)];
+            probs[my_iindx[k]-l]  +=  temp;
+          }
+        }
+      }
+    }  /* end for (l=..)   */
+    free(Qlout);
+    free(Qrout);
+    for (i=1; i<=n; i++)
+      for (j=i+turn+1; j<=n; j++) {
+        ij        =   my_iindx[i]-j;
+        probs[ij] *=  qb[ij];
+      }
+
+    if (structure!=NULL){
+      char *s = vrna_db_from_probs(probs, (unsigned int)n);
+      memcpy(structure, s, n);
+      structure[n] = '\0';
+      free(s);
+    }
+
+    /* clean up */
+    free(prm_l);
+    free(prm_l1);
+    free(prml);
+
+  }   /* end if (do_backtrack)*/
+
+  if(ov > 0)
+    vrna_message_warning("%d overflows occurred while backtracking;\n"
+                                "you might try a smaller pf_scale than %g\n",
+                                ov, pf_params->pf_scale);
+}
+
+PUBLIC void
+vrna_pf_dimer_probs(double FAB,
+                    double FA,
+                    double FB,
+                    vrna_plist_t *prAB,
+                    const vrna_plist_t *prA,
+                    const vrna_plist_t *prB,
+                    int Alength,
+                    const vrna_exp_param_t *exp_params) {
+
+  /*computes binding probabilities and dimer free energies*/
+  int         i, j;
+  double      pAB;
+  double      mykT;
+  const vrna_plist_t *lp2;
+  vrna_plist_t       *lp1;
+  int         offset;
+
+  mykT = exp_params->kT/1000.;
+
+  /* pair probabilities in pr are relative to the null model (without DuplexInit) */
+
+  /*Compute probabilities pAB, pAA, pBB*/
+
+  pAB = 1. - exp((1/mykT)*(FAB-FA-FB));
+
+  /* compute pair probabilities given that it is a dimer */
+  /* AB dimer */
+  offset  = 0;
+  lp2     = prA;
+  if (pAB>0)
+    for (lp1=prAB; lp1->j>0; lp1++) {
+      float pp=0;
+      i = lp1->i;
+      j = lp1->j;
+      while (offset+lp2->i < i && lp2->i>0) lp2++;
+      if (offset+lp2->i == i)
+        while ((offset+lp2->j) < j  && (lp2->j>0)) lp2++;
+      if (lp2->j == 0) {lp2=prB; offset=Alength;}/* jump to next list */
+      if ((offset+lp2->i==i) && (offset+lp2->j ==j)) {
+        pp = lp2->p;
+        lp2++;
+      }
+      lp1->p=(lp1->p-(1-pAB)*pp)/pAB;
+      if(lp1->p < 0.){
+        vrna_message_warning("vrna_co_pf_probs: numeric instability detected, probability below zero!");
+        lp1->p = 0.;
+      }
+    }
+
+  return;
+}
+
+PRIVATE double *
+Newton_Conc(double KAB,
+            double KAA,
+            double KBB,
+            double concA,
+            double concB,
+            double* ConcVec){
+
+  double  TOL, EPS, xn, yn, det, cA, cB;
+  int     i;
+
+  i       = 0;
+  /*Newton iteration for computing concentrations*/
+  cA      = concA;
+  cB      = concB;
+  TOL     = 1e-6; /*Tolerance for convergence*/
+  ConcVec = (double*)vrna_alloc(5*sizeof(double)); /* holds concentrations */
+  do {
+    /* det = (4.0 * KAA * cA + KAB *cB + 1.0) * (4.0 * KBB * cB + KAB *cA + 1.0) - (KAB *cB) * (KAB *cA); */
+    det = 1 + 16. *KAA*KBB*cA*cB + KAB*(cA+cB) + 4.*KAA*cA + 4.*KBB*cB + 4.*KAB*(KBB*cB*cB + KAA*cA*cA);
+    /* xn  = ( (2.0 * KBB * cB*cB + KAB *cA *cB + cB - concB) * (KAB *cA) -
+       (2.0 * KAA * cA*cA + KAB *cA *cB + cA - concA) * (4.0 * KBB * cB + KAB *cA + 1.0) ) /det; */
+    xn  = ( (2.0 * KBB * cB*cB + cB - concB) * (KAB *cA) - KAB*cA*cB*(4. * KBB*cB + 1.) -
+	    (2.0 * KAA * cA*cA + cA - concA) * (4.0 * KBB * cB + KAB *cA + 1.0) ) /det;
+    /* yn  = ( (2.0 * KAA * cA*cA + KAB *cA *cB + cA - concA) * (KAB *cB) -
+       (2.0 * KBB * cB*cB + KAB *cA *cB + cB - concB) * (4.0 * KAA * cA + KAB *cB + 1.0) ) /det; */
+    yn  = ( (2.0 * KAA * cA*cA + cA - concA) * (KAB *cB) - KAB*cA*cB*(4. * KAA*cA + 1.) -
+            (2.0 * KBB * cB*cB + cB - concB) * (4.0 * KAA * cA + KAB *cB + 1.0) ) /det;
+    EPS = fabs(xn/cA) + fabs(yn/cB);
+    cA += xn;
+    cB += yn;
+    i++;
+    if (i>10000) {
+      vrna_message_warning("Newton did not converge after %d steps!!",i);
+      break;
+    }
+  } while(EPS>TOL);
+
+  ConcVec[0] = cA*cB*KAB ;/*AB concentration*/
+  ConcVec[1] = cA*cA*KAA ;/*AA concentration*/
+  ConcVec[2] = cB*cB*KBB ;/*BB concentration*/
+  ConcVec[3] = cA;        /* A concentration*/
+  ConcVec[4] = cB;        /* B concentration*/
+
+  return ConcVec;
+}
+
+PUBLIC vrna_dimer_conc_t *
+vrna_pf_dimer_concentrations(double FcAB,
+                              double FcAA,
+                              double FcBB,
+                              double FEA,
+                              double FEB,
+                              const double *startconc,
+                              const vrna_exp_param_t *exp_params){
+
+  /*takes an array of start concentrations, computes equilibrium concentrations of dimers, monomers, returns array of concentrations in strucutre vrna_dimer_conc_t*/
+  double            *ConcVec;
+  int               i;
+  vrna_dimer_conc_t *Concentration;
+  double            KAA, KAB, KBB, kT;
+
+  kT            = exp_params->kT/1000.;
+  Concentration = (vrna_dimer_conc_t *)vrna_alloc(20*sizeof(vrna_dimer_conc_t));
+ /* Compute equilibrium constants */
+  /* again note the input free energies are not from the null model (without DuplexInit) */
+
+  KAA = exp(( 2.0 * FEA - FcAA)/kT);
+  KBB = exp(( 2.0 * FEB - FcBB)/kT);
+  KAB = exp(( FEA + FEB - FcAB)/kT);
+  /* printf("Kaa..%g %g %g\n", KAA, KBB, KAB); */
+  for (i=0; ((startconc[i]!=0)||(startconc[i+1]!=0));i+=2) {
+    ConcVec                 = Newton_Conc(KAB, KAA, KBB, startconc[i], startconc[i+1], ConcVec);
+    Concentration[i/2].A0   = startconc[i];
+    Concentration[i/2].B0   = startconc[i+1];
+    Concentration[i/2].ABc  = ConcVec[0];
+    Concentration[i/2].AAc  = ConcVec[1];
+    Concentration[i/2].BBc  = ConcVec[2];
+    Concentration[i/2].Ac   = ConcVec[3];
+    Concentration[i/2].Bc   = ConcVec[4];
+
+    if (!(((i+2)/2)%20))  {
+      Concentration = (vrna_dimer_conc_t *)vrna_realloc(Concentration,((i+2)/2+20)*sizeof(vrna_dimer_conc_t));
+    }
+    free(ConcVec);
+  }
+
+  return Concentration;
+}
+
+
+#if 0
+/*
+  stochastic backtracking in pf_fold arrays
+  returns random structure S with Boltzman probabilty
+  p(S) = exp(-E(S)/kT)/Z
+*/
+PRIVATE void
+backtrack_qm1(vrna_fold_compound_t *vc,
+              int i,
+              int j,
+              char *pstruc){
+
+  /* i is paired to l, i<l<j; backtrack in qm1 to find l */
+  int           ii, l, type, *jindx, *my_iindx, *rtype, turn;
+  double        qt, r;
+  FLT_OR_DBL    *qm, *qm1, *qb, *expMLbase;
+  short         *S1;
+  char          *ptype;
+  vrna_md_t     *md;
+
+  vrna_exp_param_t  *pf_params;
+  vrna_mx_pf_t      *matrices;
+
+  pf_params     = vc->exp_params;
+  md            = &(pf_params->model_details);
+  S1            = vc->sequence_encoding;
+  ptype         = vc->ptype;
+  rtype         = &(md->rtype[0]);
+  turn          = md->min_loop_size;
+
+  matrices      = vc->exp_matrices;
+  qb            = matrices->qb;
+  qm            = matrices->qm;
+  qm1           = matrices->qm1;
+  expMLbase     = matrices->expMLbase;
+
+  jindx         = vc->jindx;
+  my_iindx      = vc->iindx;
+
+  r   = vrna_urn() * qm1[jindx[j]+i];
+  ii  = my_iindx[i];
+  for (qt=0., l=i+turn+1; l<=j; l++) {
+    type = ptype[jindx[l] + i];
+    if (type)
+      qt +=  qb[ii-l]*exp_E_MLstem(type, S1[i-1], S1[l+1], pf_params) * expMLbase[j-l];
+    if (qt>=r) break;
+  }
+  if (l>j) vrna_message_error("backtrack failed in qm1");
+  backtrack(vc, i,l, pstruc);
+}
+
+PRIVATE void
+backtrack(vrna_fold_compound_t *vc,
+          int i,
+          int j,
+          char *pstruc){
+
+  int           *jindx, *my_iindx, *rtype, turn;
+  FLT_OR_DBL    *qm, *qm1, *qb, *expMLbase, *scale;
+  vrna_exp_param_t  *pf_params;
+  vrna_mx_pf_t      *matrices;
+  short         *S1;
+  char          *ptype, *sequence;
+  int           noGUclosure;
+  vrna_md_t     *md;
+
+  sequence      = vc->sequence;
+  pf_params     = vc->exp_params;
+  md            = &(pf_params->model_details);
+  S1            = vc->sequence_encoding;
+  ptype         = vc->ptype;
+  rtype         = &(md->rtype[0]);
+  turn          = md->min_loop_size;
+
+  matrices      = vc->exp_matrices;
+  qb            = matrices->qb;
+  qm            = matrices->qm;
+  qm1           = matrices->qm1;
+  expMLbase     = matrices->expMLbase;
+  scale         = matrices->scale;
+  jindx         = vc->jindx;
+  my_iindx      = vc->iindx;
+  noGUclosure   = pf_params->model_details.noGUclosure;
+
+  do {
+    double r, qbt1;
+    int k, l, type, u, u1;
+
+    pstruc[i-1] = '('; pstruc[j-1] = ')';
+
+    r     = vrna_urn() * qb[my_iindx[i]-j];
+    type  = ptype[jindx[j] + i];
+    u     = j - i - 1;
+    /*hairpin contribution*/
+    if (((type==3)||(type==4))&&noGUclosure) qbt1 = 0;
+    else
+      qbt1 = exp_E_Hairpin(u, type, S1[i+1], S1[j-1], sequence+i-1, pf_params)*scale[u+2];
+
+    if (qbt1>r) return; /* found the hairpin we're done */
+
+    for (k=i+1; k<=MIN2(i+MAXLOOP+1,j-turn-2); k++) {
+      u1 = k-i-1;
+      for (l=MAX2(k+turn+1,j-1-MAXLOOP+u1); l<j; l++) {
+        int type_2;
+        type_2 = ptype[jindx[l] + k];
+        if (type_2) {
+          type_2  =   rtype[type_2];
+          qbt1    +=  qb[my_iindx[k]-l] *
+            exp_E_IntLoop(u1, j-l-1, type, type_2,
+                          S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params)*scale[u1+j-l+1];
+        }
+        if (qbt1 > r) break;
+      }
+      if (qbt1 > r) break;
+    }
+    if (l<j) {
+      i=k; j=l;
+    }
+    else break;
+  } while (1);
+
+  /* backtrack in multi-loop */
+  {
+    double r, qt;
+    int k, ii, jj;
+
+    i++; j--;
+    /* find the first split index */
+    ii = my_iindx[i]; /* ii-j=[i,j] */
+    jj = jindx[j]; /* jj+i=[j,i] */
+    for (qt=0., k=i+1; k<j; k++) qt += qm[ii-(k-1)]*qm1[jj+k];
+    r = vrna_urn() * qt;
+    for (qt=0., k=i+1; k<j; k++) {
+      qt += qm[ii-(k-1)]*qm1[jj+k];
+      if (qt>=r) break;
+    }
+    if (k>=j) vrna_message_error("backtrack failed, can't find split index ");
+
+    backtrack_qm1(vc, k, j, pstruc);
+
+    j = k-1;
+    while (j>i) {
+      /* now backtrack  [i ... j] in qm[] */
+      jj  = jindx[j];
+      ii  = my_iindx[i];
+      r   = vrna_urn() * qm[ii - j];
+      qt  = qm1[jj+i]; k=i;
+      if (qt<r)
+        for (k=i+1; k<=j; k++) {
+          qt += (qm[ii-(k-1)]+expMLbase[k-i])*qm1[jj+k];
+          if (qt >= r) break;
+        }
+      if (k>j) vrna_message_error("backtrack failed in qm");
+
+      backtrack_qm1(vc, k,j, pstruc);
+
+      if (k<i+turn) break; /* no more pairs */
+      r = vrna_urn() * (qm[ii-(k-1)] + expMLbase[k-i]);
+      if (expMLbase[k-i] >= r) break; /* no more pairs */
+      j = k-1;
+    }
+  }
+}
+
+#endif
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC vrna_dimer_pf_t
+co_pf_fold(char *sequence, char *structure){
+
+  return wrap_co_pf_fold(sequence, structure, NULL, do_backtrack, fold_constrained);
+}
+
+PUBLIC vrna_dimer_pf_t
+co_pf_fold_par( char *sequence,
+                char *structure,
+                vrna_exp_param_t *parameters,
+                int calculate_bppm,
+                int is_constrained){
+
+  return wrap_co_pf_fold(sequence, structure, parameters, calculate_bppm, is_constrained);
+}
+
+
+PUBLIC vrna_plist_t *
+get_plist(vrna_plist_t *pl,
+          int length,
+          double cut_off){
+
+  int i, j,n, count, *my_iindx;
+
+  my_iindx = backward_compat_compound->iindx;
+  /*get pair probibilities out of pr array*/
+  count=0;
+  n=2;
+  for (i=1; i<length; i++) {
+    for (j=i+1; j<=length; j++) {
+      if (pr[my_iindx[i]-j]<cut_off) continue;
+      if (count==n*length-1) {
+        n*=2;
+        pl=(vrna_plist_t *)vrna_realloc(pl,n*length*sizeof(vrna_plist_t));
+      }
+      pl[count].i=i;
+      pl[count].j=j;
+      pl[count++].p=pr[my_iindx[i]-j];
+      /*      printf("gpl: %2d %2d %.9f\n",i,j,pr[my_iindx[i]-j]);*/
+    }
+  }
+  pl[count].i=0;
+  pl[count].j=0; /*->??*/
+  pl[count++].p=0.;
+  pl=(vrna_plist_t *)vrna_realloc(pl,(count)*sizeof(vrna_plist_t));
+  return pl;
+}
+
+PUBLIC void
+compute_probabilities(double FAB,
+                      double FA,
+                      double FB,
+                      vrna_plist_t *prAB,
+                      vrna_plist_t *prA,
+                      vrna_plist_t *prB,
+                      int Alength) {
+
+  if(backward_compat_compound && backward_compat){
+    vrna_pf_dimer_probs(FAB, FA, FB, prAB, (const vrna_plist_t *)prA, (const vrna_plist_t *)prB, Alength, (const vrna_exp_param_t *)backward_compat_compound->exp_params);
+  }
+}
+
+PUBLIC vrna_dimer_conc_t *
+get_concentrations( double FcAB,
+                    double FcAA,
+                    double FcBB,
+                    double FEA,
+                    double FEB,
+                    double *startconc){
+
+  return vrna_pf_dimer_concentrations(FcAB, FcAA, FcBB, FEA, FEB, (const double *)startconc, (const vrna_exp_param_t *)backward_compat_compound->exp_params);
+}
+
+PUBLIC void
+init_co_pf_fold(int length){
+
+ /* DO NOTHING */
+}
+
+PUBLIC void
+free_co_pf_arrays(void){
+
+  if(backward_compat_compound && backward_compat){
+    vrna_fold_compound_free(backward_compat_compound);
+    backward_compat_compound  = NULL;
+    backward_compat           = 0;
+  }
+}
+
+PUBLIC FLT_OR_DBL *
+export_co_bppm(void){
+
+  if(backward_compat_compound)
+    return backward_compat_compound->exp_matrices->probs;
+  else
+    return NULL;
+}
+
+/*----------------------------------------------------------------------*/
+PUBLIC void
+update_co_pf_params(int length){
+
+  if(backward_compat_compound && backward_compat){
+    vrna_md_t         md;
+    set_model_details(&md);
+    vrna_exp_params_reset(backward_compat_compound, &md);
+
+    /* compatibility with RNAup, may be removed sometime */
+    pf_scale = backward_compat_compound->exp_params->pf_scale;
+  }
+}
+
+PUBLIC void
+update_co_pf_params_par(int length,
+                        vrna_exp_param_t *parameters){
+
+  if(backward_compat_compound && backward_compat){
+    vrna_md_t         md;
+    if(parameters){
+      vrna_exp_params_subst(backward_compat_compound, parameters);
+    } else {
+      set_model_details(&md);
+      vrna_exp_params_reset(backward_compat_compound, &md);
+    }
+
+    /* compatibility with RNAup, may be removed sometime */
+    pf_scale = backward_compat_compound->exp_params->pf_scale;
+  }
+}
+
diff --git a/C/ViennaRNA/part_func_co.h b/C/ViennaRNA/part_func_co.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/part_func_co.h
@@ -0,0 +1,358 @@
+#ifndef VIENNA_RNA_PACKAGE_PART_FUNC_CO_H
+#define VIENNA_RNA_PACKAGE_PART_FUNC_CO_H
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file     part_func_co.h
+ *  @ingroup  pf_fold cofold pf_cofold
+ *  @brief    Partition function for two RNA sequences
+ */
+
+/**
+ *  @addtogroup pf_cofold
+ *  @brief Partition Function Cofolding
+ *
+ *  To simplify the implementation the partition function computation is done
+ *  internally in a null model that does not include the duplex initiation
+ *  energy, i.e. the entropic penalty for producing a dimer from two
+ *  monomers). The resulting free energies and pair probabilities are initially
+ *  relative to that null model. In a second step the free energies can be
+ *  corrected to include the dimerization penalty, and the pair probabilities
+ *  can be divided into the conditional pair probabilities given that a re
+ *  dimer is formed or not formed. See @cite bernhart:2006 for further details.
+ *
+ *  As for folding one RNA molecule, this computes the partition function
+ *  of all possible structures and the base pair probabilities. Uses the
+ *  same global #pf_scale variable to avoid overflows.
+ *
+ *  To simplify the implementation the partition function computation is done
+ *  internally in a null model that does not include the duplex initiation
+ *  energy, i.e. the entropic penalty for producing a dimer from two
+ *  monomers). The resulting free energies and pair probabilities are initially
+ *  relative to that null model. In a second step the free energies can be
+ *  corrected to include the dimerization penalty, and the pair probabilities
+ *  can be divided into the conditional pair probabilities given that a re
+ *  dimer is formed or not formed.
+ *
+ *  After computing the partition functions of all possible dimeres one
+ *  can compute the probabilities of base pairs, the concentrations out of
+ *  start concentrations and sofar and soaway.
+ *
+ *  Dimer formation is inherently concentration dependent. Given the free
+ *  energies of the monomers A and B and dimers AB, AA, and BB one can compute
+ *  the equilibrium concentrations, given input concentrations of A and B, see
+ *  e.g. Dimitrov & Zuker (2004)
+ *
+ *  @{
+ *  @ingroup  pf_cofold
+ */
+
+/** @brief Typename for the data structure that stores the dimer partition functions, #vrna_dimer_pf_s, as returned by vrna_pf_dimer() */
+typedef struct vrna_dimer_pf_s  vrna_dimer_pf_t;
+
+/** @brief Typename for the data structure that stores the dimer concentrations, #vrna_dimer_conc_s, as required by vrna_pf_dimer_concentration() */
+typedef struct vrna_dimer_conc_s  vrna_dimer_conc_t;
+
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief Backward compatibility typedef for #vrna_dimer_pf_s
+ */
+typedef struct vrna_dimer_pf_s    cofoldF;
+
+/**
+ *  @brief Backward compatibility typedef for #vrna_dimer_conc_s
+ */
+typedef struct vrna_dimer_conc_s  ConcEnt;
+
+#endif
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+
+/**
+ *  @brief Toggles no intrabp in 2nd mol
+ */
+extern int    mirnatog;
+
+/**
+ *  @brief Free energies of the two monomers
+ */
+extern double F_monomer[2];
+
+/**
+ *  @brief  Data structure returned by vrna_pf_dimer()
+ */
+struct vrna_dimer_pf_s {
+  /* free energies for: */
+  double F0AB;  /**< @brief Null model without DuplexInit */
+  double FAB;   /**< @brief all states with DuplexInit correction */
+  double FcAB;  /**< @brief true hybrid states only */
+  double FA;    /**< @brief monomer A */
+  double FB;    /**< @brief monomer B */
+};
+
+/**
+ *  @brief  Data structure for concentration dependency computations
+ */
+struct vrna_dimer_conc_s {
+  double A0;    /**< @brief start concentration A */
+  double B0;    /**< @brief start concentration B */
+  double ABc;   /**< @brief End concentration AB */
+  double AAc;
+  double BBc;
+  double Ac;
+  double Bc;
+};
+
+/**
+ *  @brief  Calculate partition function and base pair probabilities of
+ *          nucleic acid/nucleic acid dimers
+ *
+ *  This is the cofold partition function folding.
+ *
+ *  @see    vrna_fold_compound() for how to retrieve the necessary data structure
+ *
+ *  @param  vc        the fold compound data structure
+ *  @param  structure Will hold the structure or constraints
+ *  @return           vrna_dimer_pf_t structure containing a set of energies needed for
+ *                    concentration computations.
+ */
+vrna_dimer_pf_t
+vrna_pf_dimer(vrna_fold_compound_t *vc,
+              char *structure);
+
+/**
+ *  @brief Compute Boltzmann probabilities of dimerization without homodimers
+ *
+ *  Given the pair probabilities and free energies (in the null model) for a
+ *  dimer AB and the two constituent monomers A and B, compute the conditional pair
+ *  probabilities given that a dimer AB actually forms.
+ *  Null model pair probabilities are given as a list as produced by
+ *  vrna_plist_from_probs(), the dimer probabilities 'prAB' are modified in place.
+ *
+ *  @param FAB        free energy of dimer AB
+ *  @param FA         free energy of monomer A
+ *  @param FB         free energy of monomer B
+ *  @param prAB       pair probabilities for dimer
+ *  @param prA        pair probabilities monomer
+ *  @param prB        pair probabilities monomer
+ *  @param Alength    Length of molecule A
+ *  @param exp_params The precomputed Boltzmann factors
+ */
+void  vrna_pf_dimer_probs(double FAB,
+                          double FA,
+                          double FB,
+                          vrna_plist_t *prAB,
+                          const vrna_plist_t *prA,
+                          const vrna_plist_t *prB,
+                          int Alength,
+                          const vrna_exp_param_t *exp_params);
+
+/**
+ *  @brief Given two start monomer concentrations a and b, compute the
+ *  concentrations in thermodynamic equilibrium of all dimers and the monomers.
+ *
+ *  This function takes an array  'startconc' of input concentrations with alternating
+ *  entries for the initial concentrations of molecules A and B (terminated by
+ *  two zeroes), then computes the resulting equilibrium concentrations
+ *  from the free energies for the dimers. Dimer free energies should be the
+ *  dimer-only free energies, i.e. the FcAB entries from the #vrna_dimer_pf_t struct.
+ *
+ *  @param FcAB       Free energy of AB dimer (FcAB entry)
+ *  @param FcAA       Free energy of AA dimer (FcAB entry)
+ *  @param FcBB       Free energy of BB dimer (FcAB entry)
+ *  @param FEA        Free energy of monomer A
+ *  @param FEB        Free energy of monomer B
+ *  @param startconc  List of start concentrations [a0],[b0],[a1],[b1],...,[an][bn],[0],[0]
+ *  @param exp_params The precomputed Boltzmann factors
+ *  @return vrna_dimer_conc_t array containing the equilibrium energies and start concentrations
+ */
+vrna_dimer_conc_t *vrna_pf_dimer_concentrations(double FcAB,
+                                      double FcAA,
+                                      double FcBB,
+                                      double FEA,
+                                      double FEB,
+                                      const double *startconc,
+                                      const vrna_exp_param_t *exp_params);
+
+/**
+ *  @}
+ */
+
+/*
+#################################################
+# DEPRECATED FUNCTIONS                          #
+#################################################
+*/
+
+/**
+ *  @brief Calculate partition function and base pair probabilities
+ *
+ *  This is the cofold partition function folding. The second molecule starts
+ *  at the #cut_point nucleotide.
+ *
+ *  @note OpenMP: Since this function relies on the global parameters
+ *        #do_backtrack, #dangles, #temperature and #pf_scale it is not
+ *        threadsafe according to concurrent changes in these variables!
+ *        Use co_pf_fold_par() instead to circumvent this issue.
+ *
+ *  @deprecated{Use vrna_pf_dimer() instead!}
+ *
+ *  @param  sequence  Concatenated RNA sequences
+ *  @param  structure Will hold the structure or constraints
+ *  @return           vrna_dimer_pf_t structure containing a set of energies needed for
+ *                    concentration computations.
+ */
+DEPRECATED(vrna_dimer_pf_t co_pf_fold( char *sequence, char *structure));
+
+/**
+ *  @brief Calculate partition function and base pair probabilities
+ *
+ *  This is the cofold partition function folding. The second molecule starts
+ *  at the #cut_point nucleotide.
+ *
+ *  @deprecated Use vrna_pf_dimer() instead!
+ *
+ *  @see get_boltzmann_factors(), co_pf_fold()
+ *
+ *  @param sequence       Concatenated RNA sequences
+ *  @param structure      Pointer to the structure constraint
+ *  @param parameters     Data structure containing the precalculated Boltzmann factors
+ *  @param calculate_bppm Switch to turn Base pair probability calculations on/off (0==off)
+ *  @param is_constrained Switch to indicate that a structure contraint is passed via the
+ *                        structure argument (0==off)
+ *  @return               vrna_dimer_pf_t structure containing a set of energies needed for
+ *                        concentration computations.
+ */
+DEPRECATED(vrna_dimer_pf_t co_pf_fold_par(char *sequence, char *structure, vrna_exp_param_t *parameters, int calculate_bppm, int is_constrained));
+
+/**
+ *  DO NOT USE THIS FUNCTION ANYMORE
+ *  @deprecated{ This function is deprecated and will be removed soon!}
+ *  use assign_plist_from_pr() instead!
+ */
+DEPRECATED(vrna_plist_t  *get_plist( vrna_plist_t *pl,
+                              int length,
+                              double cut_off));
+
+/**
+ *  @brief Compute Boltzmann probabilities of dimerization without homodimers
+ *
+ *  Given the pair probabilities and free energies (in the null model) for a
+ *  dimer AB and the two constituent monomers A and B, compute the conditional pair
+ *  probabilities given that a dimer AB actually forms.
+ *  Null model pair probabilities are given as a list as produced by
+ *  assign_plist_from_pr(), the dimer probabilities 'prAB' are modified in place.
+ *
+ *  @deprecated{ Use vrna_pf_dimer_probs() instead!}
+ *
+ *  @param FAB      free energy of dimer AB
+ *  @param FEA      free energy of monomer A
+ *  @param FEB      free energy of monomer B
+ *  @param prAB     pair probabilities for dimer
+ *  @param prA      pair probabilities monomer
+ *  @param prB      pair probabilities monomer
+ *  @param Alength  Length of molecule A
+ */
+DEPRECATED(void compute_probabilities(double FAB, double FEA, double FEB, vrna_plist_t  *prAB, vrna_plist_t  *prA, vrna_plist_t  *prB, int Alength));
+
+/**
+ *  @brief Given two start monomer concentrations a and b, compute the
+ *  concentrations in thermodynamic equilibrium of all dimers and the monomers.
+ *
+ *  This function takes an array  'startconc' of input concentrations with alternating
+ *  entries for the initial concentrations of molecules A and B (terminated by
+ *  two zeroes), then computes the resulting equilibrium concentrations
+ *  from the free energies for the dimers. Dimer free energies should be the
+ *  dimer-only free energies, i.e. the FcAB entries from the #vrna_dimer_pf_t struct.
+ *
+ *  @deprecated{ Use vrna_pf_dimer_concentrations() instead!}
+ *
+ *  @param FEAB       Free energy of AB dimer (FcAB entry)
+ *  @param FEAA       Free energy of AA dimer (FcAB entry)
+ *  @param FEBB       Free energy of BB dimer (FcAB entry)
+ *  @param FEA        Free energy of monomer A
+ *  @param FEB        Free energy of monomer B
+ *  @param startconc  List of start concentrations [a0],[b0],[a1],[b1],...,[an][bn],[0],[0]
+ *  @return vrna_dimer_conc_t array containing the equilibrium energies and start concentrations
+ */
+DEPRECATED(vrna_dimer_conc_t *get_concentrations(double FEAB, double FEAA, double FEBB, double FEA, double FEB, double *startconc));
+
+/**
+ *  DO NOT USE THIS FUNCTION ANYMORE
+ *  @deprecated{ This function is deprecated and will be removed soon!}
+ */
+DEPRECATED(void   init_co_pf_fold(int length));
+
+/**
+ *  @brief Get a pointer to the base pair probability array
+ *
+ *  Accessing the base pair probabilities for a pair (i,j) is achieved by
+ *  @verbatim FLT_OR_DBL *pr = export_bppm(); pr_ij = pr[iindx[i]-j]; @endverbatim
+ *
+ *  @deprecated This function is deprecated and will be removed soon! The base pair
+ *              probability array is available through the #vrna_fold_compound_t data
+ *              structure, and its associated #vrna_mx_pf_t member.
+ *
+ *  @see vrna_idx_row_wise()
+ *  @return A pointer to the base pair probability array
+ */
+DEPRECATED(FLT_OR_DBL *export_co_bppm(void));
+
+/**
+ *  @brief Free the memory occupied by co_pf_fold()
+ *
+ *  @deprecated This function will be removed for the new API soon!
+ *              See vrna_pf_dimer(), vrna_fold_compound(), and
+ *              vrna_fold_compound_free() for an alternative
+ */
+DEPRECATED(void free_co_pf_arrays(void));
+
+/**
+ *  @brief Recalculate energy parameters
+ *
+ *  This function recalculates all energy parameters given
+ *  the current model settings.
+ *
+ *  @deprecated   Use vrna_exp_params_subst() instead!
+ *
+ *  @param    length      Length of the current RNA sequence
+ */
+DEPRECATED(void update_co_pf_params(int length));
+
+/**
+ *  @brief Recalculate energy parameters
+ *
+ *  This function recalculates all energy parameters given
+ *  the current model settings.
+ *  It's second argument can either be NULL or a data structure
+ *  containing the precomputed Boltzmann factors. In the first
+ *  scenario, the necessary data structure will be created automatically
+ *  according to the current global model settings, i.e. this
+ *  mode might not be threadsafe.
+ *  However, if the provided data structure is not NULL, threadsafety
+ *  for the model parameters #dangles, #pf_scale and #temperature is regained, since their
+ *  values are taken from this data structure during subsequent calculations.
+ *
+ *  @deprecated   Use vrna_exp_params_subst() instead!
+ *
+ *  @param    length      Length of the current RNA sequence
+ *  @param    parameters  data structure containing the precomputed Boltzmann factors
+ */
+DEPRECATED(void update_co_pf_params_par(int length, vrna_exp_param_t *parameters));
+
+#endif
diff --git a/C/ViennaRNA/part_func_up.c b/C/ViennaRNA/part_func_up.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/part_func_up.c
@@ -0,0 +1,1466 @@
+/*
+                  partiton function for RNA secondary structures
+
+                  Ivo L Hofacker
+
+                  Vienna RNA package
+*/
+/*
+  $Log: part_func_up.c,v $
+  Revision 1.4  2008/07/04 14:27:36  ivo
+  Modify output (again)
+
+  Revision 1.3  2008/05/08 14:11:55  ivo
+  minor output changes
+
+  Revision 1.2  2007/12/13 10:19:54  ivo
+  major RNAup update from Ulli
+
+  Revision 1.1  2007/04/30 15:13:13  ivo
+  merge RNAup into package
+
+  Revision 1.11  2006/07/17 11:11:43  ulim
+  removed all globals from fold_vars.h,c, cleaned code
+
+  Revision 1.10  2006/07/12 09:19:29  ulim
+  global variables w, incr3 and incr5 are now local
+
+  Revision 1.9  2006/07/11 12:45:02  ulim
+  remove redundancy in function pf_interact(...)
+
+  Revision 1.8  2006/03/08 15:26:37  ulim
+  modified -o[1|2], added meaningful default
+
+  Revision 1.5  2006/01/23 11:27:04  ulim
+  include file into new package version. cleaned it
+
+  Revision 1.2  2005/07/29 15:13:37  ulim
+  put the function, calculating the probability of an unpaired region in
+  an RNA and the function calculating the prob. of interaction between 2 RNAs
+  in a seperate file (pf_two.c)
+
+  Revision 1.1  2005/07/26 13:27:12  ulim
+  Initial revision
+
+  Revision 1.2  2005/07/01 13:14:57  ulim
+  fixed error in scaling, included new commandline options -incr5, -incr3 to
+  allow a variable number of unpaired positions 5' and 3' of the site of
+  interaction between the two RNAs
+
+  Revision 1.1  2005/04/19 08:16:38  ulim
+  Initial revision
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <float.h>    /* #defines FLT_MAX ... */
+#include <unistd.h>
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/part_func.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/part_func_up.h"
+#include "ViennaRNA/duplex.h"
+
+
+#define CO_TURN 0
+#define ZERO(A) (fabs(A) < DBL_EPSILON)
+#define EQUAL(A,B) (fabs((A)-(B)) < 1000*DBL_EPSILON)
+#define ISOLATED  256.0
+/* #define NUMERIC 1 */
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+PRIVATE short       *S=NULL, *S1=NULL, *SS=NULL, *SS2=NULL;
+PRIVATE vrna_exp_param_t   *Pf = NULL;/* use this structure for all the exp-arrays*/
+PRIVATE FLT_OR_DBL  *qb=NULL, *qm=NULL, *prpr=NULL; /* add arrays for pf_unpaired()*/
+PRIVATE FLT_OR_DBL  *probs=NULL;
+PRIVATE FLT_OR_DBL  *q1k=NULL, *qln=NULL;
+PRIVATE double      *qqm2=NULL, *qq_1m2=NULL, *qqm=NULL, *qqm1=NULL;
+PRIVATE FLT_OR_DBL  *scale=NULL, *expMLbase=NULL;
+PRIVATE char        *ptype=NULL; /* precomputed array of pair types */
+PRIVATE int         init_length;  /* length in last call to init_pf_fold()*/
+PRIVATE double      init_temp; /* temperature in last call to scale_pf_params */
+PRIVATE int         *my_iindx = NULL;
+/* make iptypes array for intermolecular constrains (ipidx for indexing)*/
+
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE pu_out      *get_u_vals(pu_contrib *p_c,
+                                int **unpaired_values,
+                                char *select_contrib);
+
+PRIVATE int         plot_free_pu_out( pu_out* res,
+                                      interact *pint,
+                                      char *ofile,
+                                      char *head);
+
+PRIVATE void        scale_stru_pf_params(unsigned int length);
+
+PRIVATE void        init_pf_two(int length);
+
+PRIVATE void        scale_int(const char *s,
+                              const char *sl,
+                              double *sc_int);
+
+PRIVATE void        encode_seq( const char *s1,
+                                const char *s2);
+
+PRIVATE constrain   *get_ptypes_up(char *S,
+                                const char *structure);
+
+PRIVATE void        get_up_arrays(unsigned int length);
+
+PRIVATE void        free_up_arrays(void);
+
+PRIVATE void        set_encoded_seq(const char *sequence,
+                                    short **S,
+                                    short **S1);
+
+PRIVATE void        get_interact_arrays(unsigned int n1,
+                                        unsigned int n2,
+                                        pu_contrib *p_c,
+                                        pu_contrib *p_c2,
+                                        int w,
+                                        int incr5,
+                                        int incr3,
+                                        double ***p_c_S,
+                                        double ***p_c2_S);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC pu_contrib *get_pu_contrib_struct(unsigned int n, unsigned int w){
+  unsigned int i;
+  pu_contrib  *pu = (pu_contrib *)vrna_alloc(sizeof(pu_contrib));
+  pu->length      = n;
+  pu->w           = w;
+  /* contributions to probability of being unpaired witihin a(n)
+   H hairpin,
+   I interior loop,
+   M muliloop,
+   E exterior loop*/
+  /* pu_test->X[i][j] where i <= j and i [1...n], j = [1...w[ */
+  pu->H           = (double **)vrna_alloc(sizeof(double *) * (n + 1));
+  pu->I           = (double **)vrna_alloc(sizeof(double *) * (n + 1));
+  pu->M           = (double **)vrna_alloc(sizeof(double *) * (n + 1));
+  pu->E           = (double **)vrna_alloc(sizeof(double *) * (n + 1));
+  for(i=0;i<=n;i++){
+    pu->H[i]  = (double *)vrna_alloc(sizeof(double) * (w + 1));
+    pu->I[i]  = (double *)vrna_alloc(sizeof(double) * (w + 1));
+    pu->M[i]  = (double *)vrna_alloc(sizeof(double) * (w + 1));
+    pu->E[i]  = (double *)vrna_alloc(sizeof(double) * (w + 1));
+  }
+  return pu;
+}
+
+PUBLIC  void
+free_pu_contrib(pu_contrib *pu){
+
+  free_pu_contrib_struct(pu);
+}
+
+PUBLIC  void
+free_pu_contrib_struct(pu_contrib *pu){
+
+  unsigned int i;
+  if(pu != NULL){
+    for(i=0;i<=pu->length;i++){
+      free(pu->H[i]);
+      free(pu->I[i]);
+      free(pu->M[i]);
+      free(pu->E[i]);
+    }
+    free(pu->H);
+    free(pu->I);
+    free(pu->M);
+    free(pu->E);
+    free(pu);
+  }
+}
+
+/* you have to call pf_fold(sequence, structure); befor pf_unstru */
+PUBLIC pu_contrib *pf_unstru(char *sequence, int w){
+  int           n, i, j, v, k, l, o, p, ij, kl, po, u, u1, d, type, type_2, tt;
+  unsigned int  size;
+  double        temp, tqm2;
+  double        qbt1, *tmp, sum_l, *sum_M;
+  double        *store_H, *store_Io, **store_I2o; /* hairp., interior contribs */
+  double        *store_M_qm_o,*store_M_mlbase;    /* multiloop contributions */
+  pu_contrib    *pu_test;
+
+  sum_l           = 0.0;
+  temp            = 0;
+  n               = (int) strlen(sequence);
+  sum_M           = (double *)  vrna_alloc((n+1) * sizeof(double));
+  pu_test         = get_pu_contrib_struct((unsigned)n, (unsigned)w);
+  size            = ((n+1)*(n+2))>>1;
+
+  get_up_arrays((unsigned) n);
+  init_pf_two(n);
+
+  /* init everything */
+  for (d=0; d<=TURN; d++)
+    for (i=1; i<=n-d; i++){
+      j=i+d;
+      ij = my_iindx[i]-j;
+      if(d < w) {
+        pu_test->H[i][d]=pu_test->I[i][d]=pu_test->M[i][d]=pu_test->E[i][d]=0.;
+      }
+    }
+
+
+  for (i=0; i<size; i++)
+    prpr[i]= probs[i];
+
+  sum_M[0] = 0.;
+  for (i=1; i<=n; i++){
+    /* set auxillary arrays to 0, reuse qqm and qqm1, reuse qqm2 and qq_1m2*/
+    sum_M[i] = qqm[i] = qqm1[i] = qqm2[i] = qq_1m2[i] = 0;
+    for (j=i+TURN+1; j<=n; j++){
+      ij = my_iindx[i]-j;
+      /* i need the part_func of all structures outside bp[ij] */
+      if(qb[ij] > 0.0) prpr[ij]= (probs[ij]/qb[ij]);
+    }
+  }
+
+  /* alloc even more memory */
+  store_I2o = (double **)vrna_alloc(sizeof(double *) * (n + 1)); /* for p,k */
+  for(i=0;i<=n;i++)
+    store_I2o[i] = (double *)vrna_alloc(sizeof(double) * (MAXLOOP + 2));
+
+  /* expMLbase[i-p]*dangles_po */
+  store_M_mlbase = (double *)vrna_alloc(sizeof(double) * (size + 1));
+
+  /* 2. exterior bp (p,o) encloses unpaired region [i,i+w[*/
+  for (o=TURN+2;o<=n; o++) {
+    double sum_h;
+    /*allocate space for arrays to store different contributions to H, I & M */
+    store_H       = (double *)vrna_alloc(sizeof(double) * (o+2));
+    /* unpaired between ]l,o[ */
+    store_Io      = (double *)vrna_alloc(sizeof(double) * (o+2));
+    /* qm[p+1,i-1]*dangles_po */
+    store_M_qm_o  = (double *)vrna_alloc(sizeof(double) * (n+1));
+
+    for (p=o-TURN-1; p>=1; p--) {
+      /* construction of partition function of segment [p,o], given that
+         an unpaired region [i,i+w[ exists within [p,o] */
+      u = o-p-1;
+      po = my_iindx[p]-o;
+      type = ptype[po];
+      if(type){
+
+        /*hairpin contribution*/
+        if (((type==3)||(type==4))&&no_closingGU)
+          temp = 0.;
+        else
+          temp = prpr[po] * exp_E_Hairpin(u, type, S1[p+1], S1[o-1], sequence+p-1, Pf) * scale[u+2];
+        /* all H contribs are collect for the longest unpaired region */
+        store_H[p+1] = temp;
+
+        /* interior loops with interior pair k,l and an unpaired region of
+         length w between p and k || l and o*/
+        for (k=p+1; k<=MIN2(p+MAXLOOP+1,o-TURN-2); k++) {
+          u1    = k-p-1;
+          sum_l = 0.;
+          for (l=MAX2(k+TURN+1,o-1-MAXLOOP+u1); l<o; l++) {
+            kl      = my_iindx[k]-l;
+            type_2  = ptype[kl];
+            if((l+1) < o) store_Io[l+1] += sum_l;
+
+            temp=0.;
+            if (type_2){
+              type_2 = rtype[type_2];
+              temp = prpr[po] * qb[kl] * exp_E_IntLoop(u1, o-l-1, type, type_2, S1[p+1], S1[o-1], S1[k-1], S1[l+1], Pf) *scale[u1+o-l+1];
+              if((l+1) < o) store_Io[l+1] += temp; /* unpaired region between ]l,o[ */
+              sum_l += temp;
+            } /* end of if pair(k,l) */
+          } /* end of l */
+          /* unpaired in region ]p,k[  */
+          for(i=p+1;i <= k-1;i++)
+            store_I2o[i][MIN2(w-1,k-i-1)] += sum_l;
+        } /* end of k */
+      } /*end of if(type) test for bp (p,o) */
+
+      /* multiple stem loop contribution
+         calculate qm2[my_iindx[i]-j] in the course of the calculation
+         of the multiple stem loop contribution:
+         advantage: you save memory:
+         instead of a (n+1)*n array for qqm2 you only need 2*n arrays
+         disadvantage: you have to use two times the op-loop for the full
+         multiloop contribution
+         first op-loop: index o goes from 1...n and
+                        index p from o-TURN-1 ... 1
+         second op-loop: index o goes from n...1 and
+                         index p from o+TURN+1 ... n !!
+         HERE index o goes from 1...n and index p o-TURN-1 ... 1 ,
+         we calculate the contributions to multiple stem loop
+         where exp(i+w-1-p)*(qqm2 values between i+w and o-1)
+         AND qm[iindex[p+1]-(i-1)]*exp(beta*w)*qm[iindex[i+w]-(o-1)]
+         you have to recalculate of qqm matrix containing final stem
+         contributions to multiple loop partition function
+         from segment p,o */
+
+      /* recalculate qqm[]
+         qqm[p] := (contribution with exact one loop in region (p,o)*/
+      qqm[p]  = qqm1[p] * expMLbase[1];
+      if(type){
+        qbt1    =   qb[po] * exp_E_MLstem(type, (p>1) ? S1[p-1] : -1, (o<n) ? S1[o+1] : -1, Pf);
+        qqm[p]  +=  qbt1;
+        /* reverse dangles for prpr[po]*... */
+        temp    =   0.;
+        tt      =   rtype[type];
+        temp    =   prpr[po] * exp_E_MLstem(tt, S1[o-1], S1[p+1], Pf) * scale[2] * Pf->expMLclosing;
+        for(i=p+1; i < o; i++) {
+          int p1i = (p+1) < (i-1)  ? my_iindx[p+1]-(i-1)  : 0;
+          /*unpaired region expMLbase[i-p] left of structured
+            region qq_1m2[i+1]*/
+          /* @expMLbase:  note distance of i-p == i-(p+1)+1 */
+          store_M_mlbase[my_iindx[p+1]-i] += expMLbase[i-p] * temp * qq_1m2[i+1];
+          /* structured region qm[p1i] left of unpaired region */
+          /* contribition for unpaired region is added after the p-loop */
+          store_M_qm_o[i] += qm[p1i] * temp;
+        } /*end of for i ... */
+      }
+
+      for(tqm2 = 0., i=p+1; i < o; i++)
+        tqm2  +=  qm[my_iindx[p]-i] * qqm[i+1];
+
+      /* qqm2[p] contrib with at least 2 loops in region (p,o) */
+      qqm2[p] = tqm2;
+    } /* end for (p=..) */
+
+    for(sum_h = 0., i=1; i < o; i++) {
+      int max_v, vo;
+      sum_h +=  store_H[i];
+      max_v =   MIN2(w-1,o-i-1);
+      for(v=max_v; v >= 0; v--){
+        /* Hairpins */
+        pu_test->H[i][v] += sum_h;/* store_H[i][v] + store_H[i][max_v]; */
+        /* Interior loops: unpaired region between  ]l,o[ calculated here !*/
+        /* unpaired region between ]p,k[ collected after after o-loop */
+        if(v <= MIN2(max_v,MAXLOOP)) {
+          pu_test->I[i][v] += store_Io[i]; /* ]l,o[ */
+        }
+        /* Multiloops:*/
+        /* unpaired region [i,v] between structured regions ]p,i[ and ]v,o[. */
+        /* store_M_qm_o[i] = part. funct over all structured regions ]p,i[ */
+        vo = (i+v+1) <= (o-1) ? my_iindx[i+v+1]-(o-1): 0;
+        pu_test->M[i][v] += store_M_qm_o[i]*expMLbase[v+1]*qm[vo];
+      }
+    }
+    tmp = qqm1; qqm1=qqm; qqm=tmp;
+    tmp = qqm2; qqm2=qq_1m2; qq_1m2=tmp;
+
+    free(store_Io);
+    free(store_H);
+    free(store_M_qm_o);
+  }/* end for (o=..) */
+
+  for(i=1; i < n; i++) {
+    int     max_v;
+    double  sum_iv;
+    sum_iv  = 0.;
+    max_v   = MIN2(w-1,n-i);
+    for(v=n; v >=0; v--) {
+      if(v <= MIN2(max_v,MAXLOOP)) {
+        /* all unpaired regions [i,v] between p and k in interior loops */
+        /* notice v runs from max_v -> 0, sum_iv sums all int. l. contribs */
+        /* for each x, v < x =< max_v, since they contribute to [i,v] */
+        sum_iv            += store_I2o[i][v];
+        pu_test->I[i][v]  += sum_iv;
+      }
+      /* all unpaired region [i,v] for a fixed v, given that */
+      /* region ]v,o[ contains at least 2 structures qq_1m2[v+1]; */
+      if(v >= i) {
+        sum_M[v] += store_M_mlbase[my_iindx[i]-v];
+        if(v-i<=max_v) {
+          pu_test->M[i][v-i] += sum_M[v];
+        }
+      }
+    }
+  }
+
+  for(i=0;i<=n;i++) {
+    free(store_I2o[i]);
+  }
+  free(store_I2o);
+
+  for (i=1; i<=n; i++) {
+    /* set auxillary arrays to 0 */
+    qqm[i] = qqm1[i] = qqm2[i] = qq_1m2[i] = 0;
+  }
+
+  /* 2. exterior bp (p,o) encloses unpaired region [i,j]
+     HERE index o goes from n...1 and index p from o+TURN+1 ... n,
+     that is, we add the one multiloop contribution that we
+     could not calculate before  */
+
+/* is free'ing plus allocating faster than looping over all entries an setting them to 0? */
+#if 0
+  free(store_M_mlbase);
+  store_M_mlbase = (double *) vrna_alloc(sizeof(double) * (size + 1));
+#else
+  /* this should be the fastest way to set everything to 0 */
+  memset(store_M_mlbase, 0, sizeof(double) * (size + 1));
+#endif
+
+  for (o=n-TURN-1;o>=1; o--) {
+    for (p=o+TURN+1; p<=n; p++) {
+      po    = my_iindx[o]-p;
+      type  = ptype[po];
+      /* recalculate of qqm matrix containing final stem
+         contributions to multiple loop partition function
+         from segment [o,p] */
+      qqm[p] = qqm1[p] * expMLbase[1];
+      if (type) {
+        qbt1 = qb[po];
+        qbt1 *= exp_E_MLstem(type, (o>1) ? S1[o-1] : -1, (p<n) ? S1[p+1] : -1, Pf);
+        qqm[p] += qbt1;
+        /* revers dangles for prpr[po]...  */
+        temp=0.;
+        tt=rtype[type];
+        temp = prpr[po]*exp_E_MLstem(tt, S1[p-1], S1[o+1], Pf) * Pf->expMLclosing * scale[2];
+      }
+      tqm2=0.;
+      for(i=o+1; i < p; i++) {
+        tqm2+=qqm[i]*qm[my_iindx[i+1]-p];
+
+        if(type !=0) {
+          /* structured region qq_1m2[i-1] left of unpaired r. expMLbase[p-i]*/
+          /* @expMLbase:  note distance of p-i == p+1-i+1 */
+           store_M_mlbase[my_iindx[i]-p+1] +=  qq_1m2[i-1]*expMLbase[p-i]*temp;
+        }
+      }/*end of for i ....*/
+      qqm2[p] = tqm2;
+    }/* end for (p=..) */
+    tmp = qqm1; qqm1=qqm; qqm=tmp;
+    tmp = qqm2; qqm2=qq_1m2; qq_1m2=tmp;
+  }/* end for (o=..) */
+  /* now collect the missing multiloop contributions */
+  for(i=0;i<=n;i++) { sum_M[i]=0.; }
+  for(i=1; i<=n;i++) {
+    int v_max = MIN2(w-1,n-i);
+    for(v=n; v>=i; v--){
+      sum_M[i]  += store_M_mlbase[my_iindx[i]-v];
+      if ((v-i <= v_max) ) {
+        pu_test->M[i][v-i] += sum_M[i];
+      }
+    }
+  }
+
+  /* 1. region [i,j] exterior to all loops */
+  for (i=1; i<=n; i++) {
+    for(j=i; j<MIN2(i+w,n+1);j++){
+      ij=my_iindx[i]-j;
+      temp=q1k[i-1]*1*scale[j-i+1]*qln[j+1]/q1k[n];
+      pu_test->E[i][j-i]+=temp;
+
+    }
+  }
+
+  free(sum_M);
+  free(store_M_mlbase);
+  free_up_arrays();
+  return pu_test;
+}
+
+
+PRIVATE void  get_interact_arrays(unsigned int n1,
+                                  unsigned int n2,
+                                  pu_contrib *p_c,
+                                  pu_contrib *p_c2,
+                                  int w,
+                                  int incr5,
+                                  int incr3,
+                                  double ***p_c_S,
+                                  double ***p_c2_S){
+
+  unsigned int i;
+  int pc_size, j;
+  *p_c_S = (double **)vrna_alloc(sizeof(double *)*(n1+1));
+
+  for (i=1; i<=n1; i++){
+    pc_size = MIN2((w + incr5 + incr3), (int)n1);
+    (*p_c_S)[i] = (double *)vrna_alloc(sizeof(double) * (pc_size + 1));
+    for (j=0; j < pc_size; j++)
+      (*p_c_S)[i][j] = p_c->H[i][j] + p_c->I[i][j] + p_c->M[i][j] + p_c->E[i][j];
+  }
+
+  if(p_c2 != NULL){
+    (*p_c2_S) = (double **)vrna_alloc(sizeof(double *) * (n2 + 1));
+    for (i=1; i<=n2; i++){
+      pc_size = MIN2(w, (int)n2);
+      (*p_c2_S)[i]  = (double *)vrna_alloc(sizeof(double) * (pc_size + 2));
+      for (j=0; j < pc_size; j++)
+        (*p_c2_S)[i][j] = p_c2->H[i][j] + p_c2->I[i][j] + p_c2->M[i][j] + p_c2->E[i][j];
+    }
+  }
+}
+
+/*------------------------------------------------------------------------*/
+/* s1 is the longer seq */
+PUBLIC interact *pf_interact( const char *s1,
+                              const char *s2,
+                              pu_contrib *p_c,
+                              pu_contrib *p_c2,
+                              int w,
+                              char *cstruc,
+                              int incr3,
+                              int incr5){
+
+  int         i, j, k,l,n1,n2,add_i5,add_i3, pc_size;
+  double      temp, Z, rev_d, E, Z2,**p_c_S, **p_c2_S, int_scale;
+  FLT_OR_DBL  ****qint_4, **qint_ik;
+  /* PRIVATE double **pint; array for pf_up() output */
+  interact    *Int;
+  double      G_min, G_is,Gi_min;
+  int         gi,gj,gk,gl,ci,cj,ck,cl,prev_k,prev_l;
+  FLT_OR_DBL  **int_ik;
+  double      Z_int, temp_int, temppfs;
+  double      const_scale, const_T;
+  constrain   *cc = NULL;  /* constrains for cofolding */
+  char        *Seq, *i_long,*i_short,*pos=NULL; /* short seq appended to long one */
+  /* int ***pu_jl; */ /* positions of interaction in the short RNA */
+
+  G_min = G_is = Gi_min = 100.0;
+  gi = gj = gk = gl = ci = cj = ck = cl = 0;
+
+  n1      = (int) strlen(s1);
+  n2      = (int) strlen(s2);
+  prev_k  = 1;
+  prev_l  = n2;
+
+  i_long  = (char *) vrna_alloc(sizeof(char)*(n1+1));
+  i_short = (char *) vrna_alloc(sizeof(char)*(n2+1));
+  Seq     = (char *) vrna_alloc(sizeof(char)*(n1+n2+2));
+
+  strcpy(Seq,s1);
+  strcat(Seq,s2);
+
+  set_encoded_seq(s1, &S, &S1);
+  set_encoded_seq(s2, &SS, &SS2);
+
+  cc = get_ptypes_up(Seq,cstruc);
+
+  get_interact_arrays(n1, n2, p_c, p_c2, w, incr5, incr3, &p_c_S, &p_c2_S);
+
+  /*array for pf_up() output */
+  Int = (interact *) vrna_alloc(sizeof(interact)*1);
+  Int->Pi = (double *) vrna_alloc(sizeof(double)*(n1+2));
+  Int->Gi = (double *) vrna_alloc(sizeof(double)*(n1+2));
+
+  /* use a different scaling for pf_interact*/
+  scale_int(s2, s1, &int_scale);
+
+  /* set the global scale array and the global variable pf_scale to the
+     values used to scale the interaction, keep their former values !! */
+  temppfs = pf_scale;
+  pf_scale = int_scale;
+
+  /* in order to scale expLoopEnergy correctly call*/
+  /* we also pass twice the seq-length to avoid bogus access to scale[] array */
+  scale_stru_pf_params((unsigned) 2*n1);
+
+  qint_ik = (FLT_OR_DBL **) vrna_alloc(sizeof(FLT_OR_DBL *) * (n1+1));
+  for (i=1; i<=n1; i++) {
+    qint_ik[i] = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * (n1+1));
+  }
+/* int_ik */
+  int_ik = (FLT_OR_DBL **) vrna_alloc(sizeof(FLT_OR_DBL *) * (n1+1));
+  for (i=1; i<=n1; i++) {
+    int_ik[i] = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * (n1+1));
+  }
+  Z_int=0.;
+  /*  Gint = ( -log(int_ik[gk][gi])-( ((int) w/2)*log(pf_scale)) )*((Pf->temperature+K0)*GASCONST/1000.0); */
+  const_scale = ((int) w/2)*log(pf_scale);
+  const_T = (Pf->kT/1000.0);
+  encode_seq(s1, s2);
+  /* static  short *S~S1, *S1~SS1, *SS~S2, *SS2; */
+  for (i=0; i<=n1; i++) {
+    Int->Pi[i]=Int->Gi[i]=0.;
+  }
+  E=0.;
+  Z=0.;
+
+  if ( fold_constrained && cstruc != NULL) {
+    pos = strchr(cstruc,'|');
+    if(pos) {
+      ci=ck=cl=cj=0;
+      /* long seq              & short seq
+         .........||..|||||....&....||||...  w = maximal interaction length
+                 ck       ci       cj  cl    */
+      strncpy(i_long,cstruc,n1);
+      i_long[n1] = '\0';
+      strncpy(i_short,&cstruc[n1],n2);
+      i_short[n2] ='\0';
+      pos = strchr(i_long,'|');
+      if(pos) ck = (int) (pos-i_long)+1; /* k */
+      pos = strrchr(i_long,'|');
+      if(pos) ci = (int) (pos-i_long)+1; /* i */
+      pos = strrchr(i_short,'|');
+      if(pos) cl = (int) (pos-i_short)+1; /* l */
+      pos = strchr(i_short,'|');
+      if(pos) cj = (int) (pos-i_short)+1; /* j */
+
+      if(ck > 0 && ci > 0 && ci-ck+1 > w) {
+        vrna_message_warning("distance between constrains in longer seq, %d, larger than -w = %d",ci-ck+1,w);
+        vrna_message_error("pf_interact: could not satisfy all constraints");
+      }
+      if(cj > 0 && cl > 0 && cl-cj+1 > w) {
+        vrna_message_warning("distance between constrains in shorter seq, %d, larger than -w = %d",cl-cj+1,w);
+        vrna_message_error("pf_interact: could not satisfy all constraints");
+      }
+    }
+
+  } else if ( fold_constrained && cstruc == NULL) {
+    vrna_message_error("option -C selected, but no constrained structure given\n");
+  }
+  if(fold_constrained) pos = strchr(cstruc,'|');
+
+  /*  qint_4[i][j][k][l] contribution that region (k-i) in seq1 (l=n1)
+      is paired to region (l-j) in seq 2(l=n2) that is
+      a region closed by bp k-l  and bp i-j */
+  qint_4 = (FLT_OR_DBL ****) vrna_alloc(sizeof(FLT_OR_DBL ***) * (n1+1));
+
+  /* qint_4[i][j][k][l] */
+  for (i=1; i<=n1; i++) {
+    int end_k;
+    end_k = i-w;
+    if(fold_constrained && pos && ci) end_k= MAX2(i-w, ci-w);
+    /* '|' constrains for long sequence: index i from 1 to n1 (5' to 3')*/
+    /* interaction has to include 3' most '|' constrain, ci */
+    if(fold_constrained && pos && ci && i==1 && i<ci)
+      i= ci-w+1 > 1 ? ci-w+1 : 1;
+    /* interaction has to include 5' most '|' constrain, ck*/
+    if(fold_constrained && pos && ck && i > ck+w-1) break;
+
+    /* note: qint_4[i] will be freed before we allocate qint_4[i+1] */
+    qint_4[i] = (FLT_OR_DBL ***) vrna_alloc(sizeof(FLT_OR_DBL **) * (n2+1));
+    for (j=n2; j>0; j--) {
+      qint_4[i][j] = (FLT_OR_DBL **) vrna_alloc(sizeof(FLT_OR_DBL*) * (w+1));
+      for (k=0; k<=w; k++) {
+        qint_4[i][j][k] = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL) * (w+1));
+      }
+    }
+
+     prev_k=1;
+    for (j=n2; j>0; j--) {
+      int type, type2,end_l;
+      end_l = j+w;
+      if(fold_constrained && pos && ci) end_l= MIN2(cj+w,j+w);
+      /* '|' constrains for short sequence: index j from n2 to 1 (3' to 5')*/
+      /* interaction has to include 5' most '|' constrain, cj */
+      if(fold_constrained && pos && cj && j==n2 && j>cj)
+        j = cj+w-1 > n2 ? n2 : cj+w-1;
+      /* interaction has to include 3' most '|' constrain, cl*/
+      if(fold_constrained && pos && cl && j < cl-w+1) break;
+      type = cc->ptype[cc->indx[i]-(n1+j)];
+      qint_4[i][j][0][0] = type ? Pf->expDuplexInit : 0;
+
+      if (!type) continue;
+      qint_4[i][j][0][0] *= exp_E_ExtLoop(type, (i>1) ? S1[i-1] : -1, (j<n2) ? SS2[j+1] : -1, Pf);
+
+      rev_d = exp_E_ExtLoop(rtype[type], (j>1) ? SS2[j-1] : -1, (i<n1) ? S1[i+1] : -1, Pf);
+
+      /* add inc5 and incr3 */
+      if((i-incr5) > 0 ) add_i5=i-incr5;
+      else add_i5=1;
+      add_i3=incr3;
+      pc_size = MIN2((w+incr3+incr5),n1);
+      if(incr3 < pc_size) add_i3=incr3;
+      else add_i3=pc_size-1;
+
+      /* only one bp (no interior loop) */
+      if(p_c2 == NULL) {/* consider only structure of longer seq. */
+        qint_ik[i][i]+=qint_4[i][j][0][0]*rev_d*p_c_S[add_i5][add_i3]*scale[((int) w/2)];
+        Z+=qint_4[i][j][0][0]*rev_d*p_c_S[add_i5][add_i3]*scale[((int) w/2)];
+      } else {/* consider structures of both seqs. */
+        qint_ik[i][i]+=qint_4[i][j][0][0]*rev_d*p_c_S[add_i5][add_i3]*p_c2_S[j][0]*scale[((int) w/2)];
+        Z+=qint_4[i][j][0][0]*rev_d*p_c_S[add_i5][add_i3]*p_c2_S[j][0]*scale[((int) w/2)];
+      }
+
+/* int_ik */
+      /* check deltaG_ges = deltaG_int + deltaG_unstr; */
+      int_ik[i][i]+=qint_4[i][j][0][0]*rev_d*scale[((int) w/2)];
+      Z_int+=qint_4[i][j][0][0]*rev_d*scale[((int) w/2)];
+      temp_int=0.;
+
+      temp=0.;
+      prev_l = n2;
+      for (k=i-1; k>end_k && k>0; k--) {
+        if (fold_constrained && pos && cstruc[k-1] == '|' && k > prev_k)
+          prev_k=k;
+        for (l=j+1; l< end_l && l<=n2; l++) {
+          int a,b,ia,ib,isw;
+          double scalew, tt, intt;
+
+          type2 = cc->ptype[cc->indx[k]-(n1+l)];
+          /* '|' : l HAS TO be paired: not pair (k,x) where x>l allowed */
+          if(fold_constrained && pos && cstruc[n1+l-1] == '|' && l < prev_l)
+            prev_l=l; /*break*/
+          if(fold_constrained && pos && (k<=ck || i>=ci) && !type2) continue;
+          if(fold_constrained && pos && ((cstruc[k-1] == '|') || (cstruc[n1+l-1] == '|')) && !type2) break;
+
+          if (!type2) continue;
+          /* to save memory keep only qint_4[i-w...i][][][] in memory
+             use indices qint_4[i][j][a={0,1,...,w-1}][b={0,1,...,w-1}] */
+          a=i-k;/* k -> a from 1...w-1*/
+          b=l-j;/* l -> b from 1...w-1 */
+
+          /* scale everything to w/2 */
+          isw = ((int) w/2);
+          if ((a+b) < isw ){
+            scalew = ( scale[isw - (a+b)] );
+          } else if ( (a+b) > isw ) {
+            scalew = 1/( scale[(a+b) - isw] );
+          } else {
+            scalew = 1;
+          }
+
+          if (i-k+l-j-2<=MAXLOOP) {
+            if(k >= prev_k && l <= prev_l) { /* don't violate constrains */
+              E = exp_E_IntLoop(i-k-1,l-j-1, type2, rtype[type],
+                                S1[k+1], SS2[l-1], S1[i-1], SS2[j+1], Pf) *
+                                scale[i-k+l-j]; /* add *scale[u1+u2+2] */
+
+              qint_4[i][j][a][b] += ( qint_4[k][l][0][0]*E);
+
+              /* use ia and ib to go from a....w-1 and from b....w-1  */
+              ia=ib=1;
+              while((a+ia)<w && i-(a+ia)>=1 && (b+ib)<w && (j+b+ib)<=n2) {
+                int iaa,ibb;
+
+                qint_4[i][j][a+ia][b+ib] += qint_4[k][l][ia][ib]*E;
+
+                iaa=ia+1;
+                while(a+iaa<w && i-(a+iaa)>=1) {
+                  qint_4[i][j][a+iaa][b+ib] += qint_4[k][l][iaa][ib]*E;
+                  ++iaa;
+                }
+
+                ibb=ib+1;
+                while( (b+ibb)<w && (j+b+ibb)<=n2 ) {
+                  qint_4[i][j][a+ia][b+ibb] += qint_4[k][l][ia][ibb]*E;
+                  ++ibb;
+                }
+                ++ia;
+                ++ib;
+              }
+            }
+          }
+          /* '|' constrain in long sequence */
+          /* collect interactions starting before 5' most '|' constrain */
+          if ( fold_constrained && pos && ci && i < ci) continue;
+          /* collect interactions ending after 3' most '|' constrain*/
+          if ( fold_constrained && pos && ck &&  k > ck) continue;
+          /* '|' constrain in short sequence */
+          /* collect interactions starting before 5' most '|' constrain */
+          if ( fold_constrained && pos && cj && j > cj) continue;
+          /* collect interactions ending after 3' most '|' constrain*/
+          if ( fold_constrained && pos && cl && l < cl) continue;
+
+          /* scale everything to w/2*/
+          /* qint_ik[k][i] all interactions where k and i both are paired */
+          /* substract incr5 from k */
+          if(k-incr5 > 0) add_i5=k-incr5;
+          else add_i5=1;
+          /* add incr3 to i */
+          pc_size = MIN2((w+incr3+incr5),n1);
+          if(i-k+incr3 < pc_size) add_i3=i-k+incr3;
+          else add_i3=pc_size-1;
+
+          if(p_c2 == NULL) {/* consider only structure of longer seq. */
+            tt = qint_4[i][j][a][b]*p_c_S[add_i5][add_i3]*scalew*rev_d;
+          } else { /* consider structures of both seqs. */
+            tt = qint_4[i][j][a][b]*p_c_S[add_i5][add_i3]*p_c2_S[j][b]*scalew*rev_d;
+          }
+          temp+= tt;
+          qint_ik[k][i]+= tt;
+          /* int_ik */
+          /* check deltaG_ges = deltaG_int + deltaG_unstr; */
+          intt = qint_4[i][j][a][b]*scalew*rev_d;
+          temp_int += intt;
+          int_ik[k][i]+= intt;
+          G_is = (-log(tt)-const_scale)*(const_T);
+          if (G_is < G_min || EQUAL(G_is,G_min)) {
+            G_min = G_is;
+            Gi_min =(-log(intt)-const_scale)*(const_T);
+            gi=i;
+            gj=j;
+            gk=k;
+            gl=l;
+          }
+        }
+      }
+      Z+=temp;
+      /* int_ik */
+      Z_int+=temp_int;
+    }
+
+    /* free qint_4 values not needed any more */
+    if(i > w) {
+      int bla;
+      bla=i-w;
+      if (fold_constrained && pos && ci && i-w < ci-w+1) continue;
+      if (fold_constrained && pos && ci) bla = MAX2(ci-w+1,i-w);
+      for (j=n2; j>0; j--) {
+        for (k=0; k<=w; k++){
+          free(qint_4[bla][j][k]);
+        }
+        free(qint_4[bla][j]);
+      }
+      free(qint_4[bla]);
+      qint_4[bla] = NULL;
+    }
+  }
+
+
+  Z2=0.0;
+  for (i=1; i<=n1; i++) {
+    for (k=i; k<=n1 && k<i+w; k++) {
+      Z2+=qint_ik[i][k];
+      for(l=i;l<=k;l++) {
+        /* Int->Pi[l]: prob that position l is within a paired region */
+        /* qint_ik[i][k] as well as Z are scaled to scale[((int) w/2) */
+        Int->Pi[l]+=qint_ik[i][k]/Z;
+        /* Int->Gi[l]: minimal delta G at position [l] */
+        Int->Gi[l]=MIN2(Int->Gi[l],
+                       ( -log(qint_ik[i][k])-( ((int) w/2)*log(pf_scale)) )*
+                       (Pf->kT/1000.0) );
+      }
+    }
+  }
+  if(n1 > w){
+    int start_i,end_i;
+    start_i = n1-w+1;
+    end_i=n1;
+    if (fold_constrained && pos && ci) {
+      /* a break in the k loop might result in unfreed values */
+      start_i = ci-w+1 < n1-w+1 ? ci-w+1 : n1-w+1;
+      start_i = start_i > 0 ? start_i : 1;
+      /* start_i = ck; */
+      end_i = ck+w-1 > n1 ? n1 : ck+w-1;
+    }
+    for (i=start_i; i<=end_i; i++) {
+      if(qint_4[i] == NULL ) continue;
+      for (j=n2; j>0; j--) {
+        for (k=0; k<=w; k++) {
+          free(qint_4[i][j][k]);
+        }
+        free(qint_4[i][j]);
+      }
+      free(qint_4[i]);
+    }
+    free(qint_4);
+  } else {
+    int start_i,end_i;
+    start_i = 1;
+    end_i=n1;
+    if (fold_constrained && pos) {
+      start_i = ci-w+1 > 0 ? ci-w+1 : 1;
+      end_i = ck+w-1 > n1 ? n1 : ck+w-1;
+    }
+
+    for (i=start_i; i<=end_i; i++) {
+      for (j=n2; j>0; j--) {
+        for (k=0; k<=w; k++) {
+          free(qint_4[i][j][k]);
+        }
+        free(qint_4[i][j]);
+      }
+      free(qint_4[i]);
+    }
+    free(qint_4);
+  }
+  if(fold_constrained && (gi==0 || gk==0 ||  gl==0 || gj==0)) {
+    vrna_message_error("pf_interact: could not satisfy all constraints");
+  }
+  /* fill structure interact */
+  Int->length = n1;
+  Int->i = gi;
+  Int->j = gj;
+  Int->k = gk;
+  Int->l = gl;
+  Int->Gikjl = G_min;
+  Int->Gikjl_wo = Gi_min;
+
+  free(i_long);
+  free(i_short);
+
+  for (i=1; i<=n1; i++) {
+    free(int_ik[i]);
+  }
+  free(int_ik);
+  for (i=1; i<=n1; i++) {
+    free(qint_ik[i]);
+  }
+  free(qint_ik);
+
+  /* reset the global variables pf_scale and scale to their original values */
+  pf_scale = temppfs;/* reset pf_scale */
+  scale_stru_pf_params((unsigned) n1);/* reset the scale array */
+  free_pf_arrays(); /* for arrays for pf_fold(...) */
+
+  if(expMLbase != NULL) {
+    free(expMLbase);
+    expMLbase = NULL;
+  }
+  if(scale != NULL) {
+    free(scale);
+    scale = NULL;
+  }
+  for (i=1; i<=n1; i++) {
+    free(p_c_S[i]);
+  }
+  free(p_c_S);
+  if(p_c2 != NULL) {
+    for (i=1; i<=n2; i++) {
+      free(p_c2_S[i]);
+    }
+    free(p_c2_S);
+  }
+  free(Seq);
+  free(cc->indx);
+  free(cc->ptype);
+  free(cc);
+  return(Int);
+}
+/*------------------------------------------------------------------------*/
+/* use an extra scale for pf_interact, here sl is the longer sequence */
+PRIVATE void scale_int(const char *s, const char *sl, double *sc_int){
+  int       n,nl;
+  duplexT   mfe;
+  double    kT;
+
+  n         = strlen(s);
+  nl        = strlen(sl);
+
+  free(expMLbase);
+  free(scale);
+
+  expMLbase = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*((nl+1)*2));
+  scale     = (FLT_OR_DBL *) vrna_alloc(sizeof(FLT_OR_DBL)*((nl+1)*2));
+
+  /* use RNA duplex to get a realistic estimate for the best possible
+     interaction energy between the short RNA s and its target sl */
+  mfe = duplexfold(s,sl);
+
+  kT = Pf->kT/1000.0;   /* in Kcal */
+
+  /* sc_int is similar to pf_scale: i.e. one time the scale */
+  *sc_int = exp(-(mfe.energy)/kT/n);
+
+  /* free the structure returned by duplexfold */
+  free(mfe.structure);
+}
+
+/*----------------------------------------------------------------------*/
+/* init_pf_two(n) :gets the arrays, that you need, from part_func.c */
+/* get_pf_arrays(&S, &S1, &ptype, &qb, &qm, &q1k, &qln);*/
+/* init_pf_fold(), update_pf_params, encode_char(), make_ptypes() are called by pf_fold() */
+PRIVATE void init_pf_two(int length){
+#ifdef SUN4
+  nonstandard_arithmetic();
+#else
+#ifdef HP9
+  fpsetfastmode(1);
+#endif
+#endif
+  make_pair_matrix();
+
+  /* gets the arrays, that we need, from part_func.c */
+  if(!get_pf_arrays(&S, &S1, &ptype, &qb, &qm, &q1k, &qln))
+    vrna_message_error("init_pf_two: pf_fold() has to be called before calling pf_unstru()\n");
+  /* get a pointer to the base pair probs */
+  probs = export_bppm();
+
+  scale_stru_pf_params((unsigned) length);
+
+  init_length=length;
+  if(init_temp != Pf->temperature)
+    vrna_message_error("init_pf_two: inconsistency with temperature");
+}
+
+PRIVATE void  get_up_arrays(unsigned int length){
+  unsigned int l1 = length + 1;
+  unsigned int l2 = length + 2;
+  prpr      = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL)  * ((l1*l2)>>1));
+  expMLbase = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL)  * l2);
+  scale     = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL)  * l2);
+  qqm2      = (double *)    vrna_alloc(sizeof(double)      * l2);
+  qq_1m2    = (double *)    vrna_alloc(sizeof(double)      * l2);
+  qqm       = (double *)    vrna_alloc(sizeof(double)      * l2);
+  qqm1      = (double *)    vrna_alloc(sizeof(double)      * l2);
+  my_iindx  = vrna_idx_row_wise(length);
+}
+
+PRIVATE void  free_up_arrays(void){
+  if(prpr       != NULL){ free(prpr);       prpr      = NULL;}
+  if(expMLbase  != NULL){ free(expMLbase);  expMLbase = NULL;}
+  if(scale      != NULL){ free(scale);      scale     = NULL;}
+  if(qqm        != NULL){ free(qqm);        qqm       = NULL;}
+  if(qqm1       != NULL){ free(qqm1);       qqm1      = NULL;}
+  if(qqm2       != NULL){ free(qqm2);       qqm2      = NULL;}
+  if(qq_1m2     != NULL){ free(qq_1m2);     qq_1m2    = NULL;}
+  if(my_iindx   != NULL){ free(my_iindx);   my_iindx  = NULL;}
+}
+
+PUBLIC void free_interact(interact *pin) {
+  if(S != NULL && pin != NULL){
+    free(S);
+    S=NULL;
+  }
+  if(S1 != NULL && pin != NULL){
+    free(S1);
+    S1=NULL;
+  }
+  if(pin != NULL){
+    free(pin->Pi);
+    free(pin->Gi);
+    free(pin);
+    pin=NULL;
+  }
+}
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void encode_seq(const char *s1, const char *s2) {
+  unsigned int i,l;
+
+  l = strlen(s1);
+  /* S and S1 are freed by free_pf_arrays(); ! */
+  S = (short *) vrna_alloc(sizeof(short)*(l+1));
+  S1= (short *) vrna_alloc(sizeof(short)*(l+1));
+  /* S1 exists only for the special X K and I bases and energy_set!=0 */
+  S[0] = l;
+  for (i=1; i<=l; i++) { /* make numerical encoding of sequence */
+    S[i]= (short) encode_char(toupper(s1[i-1]));
+    S1[i] = alias[S[i]];   /* for mismatches of nostandard bases */
+  }
+  if(s2 != NULL) {
+    l = strlen(s2);
+    /* SS2 exists only for the special X K and I bases and energy_set!=0 */
+    SS[0] = l;
+    for (i=1; i<=l; i++) { /* make numerical encoding of sequence */
+      SS[i]= (short) encode_char(toupper(s2[i-1]));
+      SS2[i] = alias[SS[i]];   /* for mismatches of nostandard bases */
+    }
+  }
+}
+
+/*-------------------------------------------------------------------------*/
+ /* scale energy parameters and pre-calculate Boltzmann weights:
+  most of this is done in structure Pf see params.c,h (function:
+  get_scaled_pf_parameters(), only arrays scale and expMLbase are handled here*/
+PRIVATE void scale_stru_pf_params(unsigned int length)
+{
+  unsigned int i;
+  double  kT;
+
+
+  /* Do this only at the first call for get_scaled_pf_parameters()
+     and/or if temperature has changed*/
+  if(init_temp != temperature) {
+    if(Pf) free(Pf);
+    vrna_md_t   md;
+    set_model_details(&md);
+    Pf=vrna_exp_params(&md);
+  }
+
+  init_temp = Pf->temperature;
+
+  kT = Pf->kT;   /* kT in cal/mol  */
+
+   /* scaling factors (to avoid overflows) */
+  if (pf_scale == -1) { /* mean energy for random sequences: 184.3*length cal */
+    pf_scale = exp(-(-185+(Pf->temperature-37.)*7.27)/kT);
+    if (pf_scale<1) pf_scale=1;
+  }
+  Pf->pf_scale = pf_scale;
+  scale[0] = 1.;
+  scale[1] = 1./pf_scale;
+  expMLbase[0] = 1;
+  expMLbase[1] = Pf->expMLbase/pf_scale;
+  for (i=2; i<=length+1; i++) {
+    scale[i] = scale[i/2]*scale[i-(i/2)];
+    expMLbase[i] = pow(Pf->expMLbase, (double)i) * scale[i];
+  }
+}
+/*-------------------------------------------------------------------------*/
+/* make a results structure containing all u-values & the header */
+PUBLIC pu_out *get_u_vals(pu_contrib *p_c, int **unpaired_values, char *select_contrib) {
+  int i, j, k, l, num_u_vals,count,contribs,size,w,len;
+  int S,E,H,I,M;
+  int off_S, off_E, off_H, off_I, off_M;
+  /* double **p_cont,**p_cont_sh, dG_u; p_u AND its contributions */
+  pu_out* u_results;
+
+  len = p_c->length;
+
+  /* number of different -u values */
+  for (num_u_vals = 0, i = 1; i <= unpaired_values[0][0]; i++) {
+    j = unpaired_values[i][0];
+    do num_u_vals++; while(++j <= unpaired_values[i][1]);
+  }
+  /* check which contributions ([-c "SHIME"] ) are desired by the user,
+     set the offset for each contribution */
+  contribs = 0;
+  S = E = H = I = M = 0;
+  off_S = off_E = off_H = off_I = off_M = 0;
+  if(strchr(select_contrib, 'S')) {
+    S=1;
+    off_S = contribs;
+    ++contribs;
+  }
+  if(strchr(select_contrib, 'E')) {
+    E=1;
+    off_E = contribs;
+    ++contribs;
+  }
+  if(strchr(select_contrib, 'H')) {
+    H=1;
+    off_H = contribs;
+    ++contribs;
+  }
+  if(strchr(select_contrib, 'I')) {
+    I=1;
+    off_I = contribs;
+    ++contribs;
+  }
+  if(strchr(select_contrib, 'M')) {
+    M=1;
+    off_M = contribs;
+    ++contribs;
+  }
+
+  if(contribs > 5) {
+    vrna_message_error("get_u_vals: error with contribs!");
+  }
+  /* allocate the results structure */
+  u_results = (pu_out *) vrna_alloc(1*sizeof(pu_out));
+  u_results->len = len; /* sequence length */
+  /*num_u_vals differnet -u values, contribs [-c "SHIME"] */
+  u_results->u_vals = num_u_vals;
+  u_results->contribs = contribs;
+  /* add 1 column for position within the sequence and
+     add 1 column for the free energy of interaction values */
+  /* header e.g. u3I (contribution for u3 interior loops */
+  size = 1 + (num_u_vals*contribs) + 1;
+  u_results->header = (char **) vrna_alloc((size+1)*sizeof(char*));
+  for(i=0;i<(size+1);i++){
+    u_results->header[i] = (char *) vrna_alloc(10*sizeof(char));
+  }
+  /* different free energies for all  -u and -c combinations */
+  u_results->u_values = (double**) vrna_alloc((size+1) *sizeof(double*));
+  for(i=0;i<(size+1);i++){
+    /* position within the sequence  */
+    u_results->u_values[i] = (double*) vrna_alloc((len+3)*sizeof(double));
+  }
+  /* write the position within the sequence in the u_results array
+     at column zerro */
+  sprintf(u_results->header[0],"pos");
+  for(i=0;i<=len;i++){
+    /* add the position*/
+    u_results->u_values[0][i] = i;
+  }
+  /* go over the different -u values, u_vals[] listy of different -u values*/
+  for (count = k = 1; k <= unpaired_values[0][0]; k++) {
+    l = unpaired_values[k][0];
+    do{
+      int offset; /* offset for the respective -u value (depents on the number
+                   of the -u value and on the numbers of contribs */
+
+      offset = ((count - 1) * contribs) + 1; /* first colum is the position */
+      /* set the current value of -u : here we call it w */
+      w = l; /* set w to the actual -u value */
+      if(w > len) break; /* corr caro */
+      /* make the header - look which contribitions are wanted */
+      if(S) sprintf(u_results->header[offset+off_S],"u%dS",w);
+      if(E) sprintf(u_results->header[offset+off_E],"u%dE",w);
+      if(H) sprintf(u_results->header[offset+off_H],"u%dH",w);
+      if(I) sprintf(u_results->header[offset+off_I],"u%dI",w);
+      if(M) sprintf(u_results->header[offset+off_M],"u%dM",w);
+
+      if(p_c != NULL) {
+        for (i=1; i<=len; i++) { /* for each position */
+          /* w goes form j to i (intervall end at i) */
+          for (j=i; j < MIN2((i+w),len+1); j++) { /* for each -u value < w
+                                                this is not necessay ->
+                                                calculate j from i and w
+                                                : (j-i+1) == w */
+            double blubb;
+            /* if (j-i+1) == w we have the -u = w value wanted */
+            if( (j-i+1) == w && i+w-1 <= len) {
+              blubb = p_c->H[i][j-i]+p_c->I[i][j-i]+p_c->M[i][j-i]+p_c->E[i][j-i];
+
+              /* printf("len %d  blubb %.3f \n",len, blubb); */
+              if(S) u_results->u_values[offset+off_S][i+w-1]+=blubb;
+              if(E) u_results->u_values[offset+off_E][i+w-1]+=p_c->E[i][j-i];
+              if(H) u_results->u_values[offset+off_H][i+w-1]+=p_c->H[i][j-i];
+              if(I) u_results->u_values[offset+off_I][i+w-1]+=p_c->I[i][j-i];
+              if(M) u_results->u_values[offset+off_M][i+w-1]+=p_c->M[i][j-i];
+
+            }
+            if(i<w && (j-i+1) != w && i+w-1 > len &&  i+w-1 < len+3) {
+              if(S) u_results->u_values[offset+off_S][i+w-1]=-1;
+              if(E) u_results->u_values[offset+off_E][i+w-1]=-1;
+              if(H) u_results->u_values[offset+off_H][i+w-1]=-1;
+              if(I) u_results->u_values[offset+off_I][i+w-1]=-1;
+              if(M) u_results->u_values[offset+off_M][i+w-1]=-1;
+            }
+          }
+        }
+      } else return(NULL); /* error */
+      count++;
+    } while(++l <= unpaired_values[k][1]);
+  }
+  return(u_results); /*success*/
+}
+/* plot the results structure */
+/* when plotting the results for the target seq we add a header */
+/* when plotting the results for the interaction partner u want no header,
+   set s1 to NULL to avoid plotting the header */
+/* currently we plot the free energies to a file: the probability of
+   being unpaired for region [i,j], p_u[i,j], is related to the free
+   energy to open region [i,j], dG_u[i,j] by:
+   dG_u[i,j] = -log(p_u[i,j])*(temperature+K0)*GASCONST/1000.0; */
+PUBLIC int plot_free_pu_out(pu_out* res, interact *pint, char *ofile, char *head) {
+  int size,s,i,len;
+  double dG_u;
+  char nan[4], *time, dg[11];
+  FILE *wastl;
+  double  kT = Pf->kT;
+  wastl = fopen(ofile,"a");
+  if (wastl==NULL) {
+    vrna_message_warning("p_cont: can't open %s for Up_plot", ofile);
+    return(0);
+  }
+  sprintf(dg,"dG");
+
+  /* printf("T=%.16f \n(temperature+K0)*GASCONST/1000.0 = %.16f\n",temperature,(temperature+K0)*GASCONST/1000.0); */
+
+  /* write the header of the output file:  */
+  /*  # timestamp commandlineaufruf   */
+  /*  # length and name of first sequence (target) */
+  /*  # first seq */
+  /*  # length and name of second sequence (interaction partner) */
+  /*  # second seq */
+  /* the next line is the output for the target: colums
+     position in target | dG_unpaired values for target | interaction energy */
+  /*  # pos   u1S   u1H  dg */
+  /*  values for target */
+  /* if -b was choosen: the next lines are the dG_unpaired values for
+     the interaction partner */
+  /*  # pos   u1S   u1H  */
+  /*  values for the interaction partner */
+
+  /* print header, if nh is zerro */
+  if(head){
+    time = vrna_time_stamp();
+    fprintf(wastl,"# %s\n", time);
+    fprintf(wastl,"%s\n",head);
+  }
+  fprintf(wastl,"# ");
+  /* }  else { fprintf(wastl," "); } close if before  */
+  len  = res->len;
+  size = res->u_vals * res->contribs;
+
+  sprintf(nan,"NA");
+  nan[2] = '\0';
+
+  for(i=0;i<=len; i++) {
+    for(s=0;s<=size+1;s++) { /* that is for different contribution */
+      if ( i== 0 && s > size && pint != NULL)
+        fprintf(wastl,"%8s  ",dg);
+      if(i != 0) {
+        if(s>0 && s<=size) {
+          if(res->u_values[s][i] > 0.0) {
+            dG_u = -log(res->u_values[s][i])*kT/1000.0;
+            fprintf(wastl,"%8.3f  ",dG_u);
+          } else { /* no p_u value was defined print nan*/
+            fprintf(wastl,"%8s  ",nan);
+          }
+
+        } else if (s > size && pint != NULL) {
+          fprintf(wastl,"%8.3f  ",pint->Gi[i]);
+        } else if (s == 0) {
+          fprintf(wastl,"%8.0f  ",res->u_values[s][i]);
+        }
+      } else {
+        if(s>1) {
+          fprintf(wastl,"%8s  ",res->header[s]);
+        } else {
+          fprintf(wastl,"%7s  ",res->header[s]);
+        }
+      }
+    }
+    fprintf(wastl,"\n");
+  }
+  fclose(wastl);
+  /*free pu_out* res */
+  if(res != NULL) {
+    for(i=0;i<=(size+2);i++) {
+      free(res->u_values[i]);
+      free(res->header[i]);
+    }
+    free(res->u_values);
+    free(res->header);
+    free(res);
+    res = NULL;
+  }
+
+  return(1); /* success */
+}
+
+PUBLIC int Up_plot(pu_contrib *p_c, pu_contrib *p_c_sh, interact *pint, char *ofile, int **unpaired_values, char *select_contrib, char *head, unsigned int mode) {
+  pu_out *dada;
+  int ret;
+  /* check what case we have */
+
+  /* upmode = 1 only one seq */
+  /* if(p_c != NULL && pint == NULL) { */
+  if(mode & RNA_UP_MODE_1){
+    dada = get_u_vals(p_c,unpaired_values,select_contrib);
+    ret = plot_free_pu_out(dada,NULL,ofile,head);
+
+  /* upmode > 1 cofolding */
+  /* } else if (p_c != NULL && pint != NULL) { */
+  } else if(mode & RNA_UP_MODE_2) {
+    dada = get_u_vals(p_c,unpaired_values,select_contrib);
+    ret = plot_free_pu_out(dada,pint,ofile,head);
+
+  /* upmode = 3  cofolding*/
+  /* } else if (p_c == NULL && p_c_sh != NULL) { */
+  }
+  if(mode & RNA_UP_MODE_3) {
+    dada  = get_u_vals(p_c,unpaired_values, select_contrib);
+    ret   = plot_free_pu_out(dada, pint, ofile, head);
+
+    dada = get_u_vals(p_c_sh, unpaired_values, select_contrib);
+    ret = plot_free_pu_out(dada,NULL,ofile, NULL);
+  }
+  return(ret);
+}
+
+/*-------------------------------------------------------------------------*/
+/* copy from part_func_co.c */
+PRIVATE constrain *get_ptypes_up(char *Seq, const char *structure) {
+  int n,i,j,k,l, length;
+  constrain *con;
+  short *s, *s1;
+
+  length = strlen(Seq);
+  make_pair_matrix();
+  con = (constrain *) vrna_alloc(sizeof(constrain));
+  con->indx = (int *) vrna_alloc(sizeof(int)*(length+1));
+  for (i=1; i<=length; i++) {
+    con->indx[i] = ((length+1-i)*(length-i))/2 +length+1;
+  }
+  con->ptype = (char *) vrna_alloc(sizeof(char)*((length+1)*(length+2)/2));
+
+  set_encoded_seq((const char *)Seq, &s, &s1);
+
+  n=s[0];
+  for (k=1; k<=n-CO_TURN-1; k++)
+    for (l=1; l<=2; l++) {
+      int type,ntype=0,otype=0;
+      i=k; j = i+CO_TURN+l; if (j>n) continue;
+      type = pair[s[i]][s[j]];
+      while ((i>=1)&&(j<=n)) {
+        if ((i>1)&&(j<n)) ntype = pair[s[i-1]][s[j+1]];
+        if (noLonelyPairs && (!otype) && (!ntype))
+          type = 0; /* i.j can only form isolated pairs */
+        con->ptype[con->indx[i]-j] = (char) type;
+        otype =  type;
+        type  = ntype;
+        i--; j++;
+      }
+    }
+
+  if (fold_constrained&&(structure!=NULL)) {
+    int hx, *stack;
+    char type;
+    stack = (int *) vrna_alloc(sizeof(int)*(n+1));
+    for(hx=0, j=1; j<=n; j++) {
+      switch (structure[j-1]) {
+      case 'x': /* can't pair */
+        for (l=1; l<j-CO_TURN; l++) con->ptype[con->indx[l]-j] = 0;
+        for (l=j+CO_TURN+1; l<=n; l++) con->ptype[con->indx[j]-l] = 0;
+        break;
+      case '(':
+        stack[hx++]=j;
+        /* fallthrough */
+      case '<': /* pairs upstream */
+        break;
+      case ')':
+        if (hx<=0) {
+          vrna_message_error("1. unbalanced brackets in constraints\n%s", structure);
+        }
+        i = stack[--hx];
+        type = con->ptype[con->indx[i]-j];
+        /* don't allow pairs i<k<j<l */
+        for (k=i; k<=j; k++)
+          for (l=j; l<=n; l++) con->ptype[con->indx[k]-l] = 0;
+        /* don't allow pairs k<i<l<j */
+        for (k=1; k<=i; k++)
+          for (l=i; l<=j; l++) con->ptype[con->indx[k]-l] = 0;
+        con->ptype[con->indx[i]-j] = (type==0)?7:type;
+      case '>': /* pairs downstream */
+        break;
+      }
+    }
+    if (hx!=0) {
+      vrna_message_error("2. unbalanced brackets in constraint string\n%s", structure);
+    }
+    free(stack);
+  }
+  free(s);
+  free(s1);
+  return con;
+}
+PRIVATE  void  set_encoded_seq(const char *sequence, short **S, short **S1){
+  unsigned int i,l;
+  l = strlen(sequence);
+  if(S!= NULL){
+    *S  = (short *)vrna_alloc(sizeof(short) * (l + 2));
+    for(i=1; i<=l; i++) /* make numerical encoding of sequence */
+      (*S)[i]= (short) encode_char(toupper(sequence[i-1]));
+    (*S)[l+1] = (*S)[1];
+    (*S)[0]   = (short) l;
+  }
+  /* S1 exists only for the special X K and I bases and energy_set!=0 */
+  if(S1 != NULL){
+    *S1 = (short *)vrna_alloc(sizeof(short) * (l + 2));
+    for(i=1; i<=l; i++) /* make numerical encoding of sequence */
+      (*S1)[i]  = alias[(short) encode_char(toupper(sequence[i-1]))]; /* for mismatches of nostandard bases */
+    /* for circular folding add first base at position n+1 and last base at position 0 in S1 */
+    (*S1)[l+1]  = (*S1)[1];
+    (*S1)[0]    = (*S1)[l];
+  }
+}
diff --git a/C/ViennaRNA/part_func_up.h b/C/ViennaRNA/part_func_up.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/part_func_up.h
@@ -0,0 +1,149 @@
+#ifndef VIENNA_RNA_PACKAGE_PART_FUNC_UP_H
+#define VIENNA_RNA_PACKAGE_PART_FUNC_UP_H
+
+#include <ViennaRNA/data_structures.h>
+
+#define   RNA_UP_MODE_1   1U
+#define   RNA_UP_MODE_2   2U
+#define   RNA_UP_MODE_3   4U
+
+/**
+ *  @file     part_func_up.h
+ *  @ingroup  pf_fold cofold pf_cofold
+ *  @brief    Implementations for accessibility and RNA-RNA interaction as a stepwise process
+ */
+
+/**
+ *  @addtogroup up_cofold
+ *  @brief      RNA-RNA interaction as a stepwise process
+ *
+ * 
+ *  In this approach to cofolding the interaction between two RNA molecules is
+ *  seen as a stepwise process. In a first step, the target molecule has to
+ *  adopt a structure in which a binding site is accessible. In a second step,
+ *  the ligand molecule will hybridize with a region accessible to an
+ *  interaction. Consequently the algorithm is designed as a two step process:
+ *  The first step is the calculation of the probability
+ *  that a region within the target is unpaired, or equivalently, the
+ *  calculation of the free energy needed to expose a region. In the second step
+ *  we compute the free energy of an interaction for every possible binding site.
+ *  @{
+ *  @ingroup  up_cofold
+ */
+
+/**
+ *  @brief Calculate the partition function over all unpaired regions
+ *  of a maximal length.
+ * 
+ *  You have to call function pf_fold() providing the same sequence before calling
+ *  pf_unstru(). If you want to calculate unpaired regions for a constrained structure, set
+ *  variable 'structure' in function 'pf_fold()' to the constrain string.
+ *  It returns a #pu_contrib struct containing four arrays of dimension
+ *  [i = 1 to length(sequence)][j = 0 to u-1] containing all possible contributions
+ *  to the probabilities of unpaired regions of maximum length u.
+ *  Each array in #pu_contrib contains one of the contributions to the
+ *  total probability of being unpaired: The probability of being unpaired
+ *  within an exterior loop is in array #pu_contrib->E, the probability
+ *  of being unpaired within a hairpin loop is in array #pu_contrib->H,
+ *  the probability of being unpaired within an interior loop is in array
+ *  #pu_contrib->I and probability of being unpaired within a multi-loop
+ *  is in array #pu_contrib->M. The total probability of being unpaired
+ *  is the sum of the four arrays of #pu_contrib.
+ * 
+ *  This function frees everything allocated automatically. To
+ *  free the output structure call free_pu_contrib().
+ * 
+ *  @param sequence
+ *  @param max_w
+ *  @return
+ */
+pu_contrib *pf_unstru(char *sequence,
+                      int max_w);
+
+/**
+ *  @brief Calculates the probability of a local interaction between two sequences.
+ * 
+ *  The function considers the probability that the
+ *  region of interaction is unpaired within 's1' and 's2'. The
+ *  longer sequence has to be given as 's1'. The shorter sequence has to
+ *  be given as 's2'. Function pf_unstru() has to be called
+ *  for 's1' and 's2', where the probabilities of  being unpaired
+ *  have to be given in 'p_c' and 'p_c2', respectively. If you do
+ *  not want to include the probabilities of  being unpaired for 's2' set
+ *  'p_c2' to NULL. If variable 'cstruc' is not NULL,
+ *  constrained folding is done: The available constrains for intermolecular
+ *  interaction are: '.' (no constrain), 'x' (the base has no intermolecular
+ *  interaction) and '|' (the corresponding base has to be paired
+ *  intermolecularily).\n
+ *  The parameter 'w' determines the maximal length of the interaction. The
+ *  parameters 'incr5' and 'incr3' allows inclusion of
+ *  unpaired residues left ('incr5') and right ('incr3') of the region
+ *  of interaction in 's1'. If the 'incr' options are used, function
+ *  pf_unstru() has to be called with
+ *  w=w+incr5+incr3 for the longer sequence 's1'.
+ * 
+ *  It returns a structure of type #interact which
+ *  contains the probability of the best local interaction including residue i
+ *  in Pi and the minimum free energy in Gi, where i is the position in sequence
+ *  's1'. The member Gikjl of structure #interact is
+ *  the best interaction between region [k,i] k<i in longer sequence
+ *  's1' and region [j,l] j<l in 's2'. Gikjl_wo is Gikjl without the
+ *  probability of beeing unpaired.\n
+ *  Use free_interact() to free the returned structure, all
+ *  other stuff is freed inside pf_interact().
+ * 
+ *  @param  s1
+ *  @param  s2
+ *  @param  p_c
+ *  @param  p_c2
+ *  @param  max_w
+ *  @param  cstruc
+ *  @param  incr3
+ *  @param  incr5
+ *  @return
+ */
+interact *pf_interact(const char *s1,
+                      const char *s2,
+                      pu_contrib *p_c,
+                      pu_contrib *p_c2,
+                      int max_w,
+                      char *cstruc,
+                      int incr3,
+                      int incr5);
+
+/**
+ *  @brief Frees the output of function pf_interact().
+ */
+void free_interact(interact *pin);
+
+/**
+ *  @brief
+ */
+int Up_plot(pu_contrib *p_c,
+            pu_contrib *p_c_sh,
+            interact *pint,
+            char *ofile,
+            int **unpaired_values,
+            char *select_contrib,
+            char *head,
+            unsigned int mode);
+
+/**
+ *  @brief
+ */
+pu_contrib  *get_pu_contrib_struct( unsigned int n,
+                                    unsigned int w);
+
+/**
+ *  @brief Frees the output of function pf_unstru().
+ */
+void        free_pu_contrib_struct(pu_contrib *pu);
+
+void
+free_pu_contrib(pu_contrib *pu);
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/perturbation_fold.c b/C/ViennaRNA/perturbation_fold.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/perturbation_fold.c
@@ -0,0 +1,493 @@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "perturbation_fold.h"
+#include "eval.h"
+#include "fold_vars.h"
+#include "constraints.h"
+#include "fold.h"
+#include "part_func.h"
+#include "utils.h"
+#include "params.h"
+
+#include <assert.h>
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef WITH_GSL
+#include <gsl/gsl_multimin.h>
+#endif
+
+static void calculate_probability_unpaired(vrna_fold_compound_t *vc, double *probability)
+{
+  int length = vc->length;
+  FLT_OR_DBL *probs = vc->exp_matrices->probs;
+  int *iidx = vc->iindx;
+  int i, j;
+
+  for (i = 0; i <= length; ++i)
+    probability[i] = 1;
+
+  for (i = 1; i <= length; ++i)
+    for (j = i + 1; j <= length; ++j)
+    {
+      probability[i] -= probs[iidx[i]-j];
+      probability[j] -= probs[iidx[i]-j];
+    }
+}
+
+static double calculate_norm(double *vector, int length)
+{
+  double sum = 0;
+  int i;
+
+  for (i = 1; i <= length; ++i)
+    sum += vector[i] * vector[i];
+
+  return sqrt(sum);
+}
+
+static void addSoftConstraint(vrna_fold_compound_t *vc, const double *epsilon, int length)
+{
+  vrna_sc_t *sc;
+  int i, j;
+  double kT = vc->exp_params->kT / 1000;
+
+  sc = vrna_alloc(sizeof(vrna_sc_t));
+
+  sc->exp_energy_up = vrna_alloc(sizeof(FLT_OR_DBL*) * (length + 2));
+  sc->exp_energy_up[0] = vrna_alloc(1);
+  for (i = 1; i <= length; ++i)
+    sc->exp_energy_up[i] = vrna_alloc(sizeof(FLT_OR_DBL) * (length - i + 2));
+
+  for (i = 1; i <= length; ++i)
+  {
+    sc->exp_energy_up[i][0] = 1;
+    for (j = 1; j <= length - i + 1; ++j)
+      sc->exp_energy_up[i][j] = sc->exp_energy_up[i][j-1] * exp(-(epsilon[i + j - 1]) / kT);
+  }
+
+  /* also add sc for MFE computation */
+  sc->energy_up = vrna_alloc(sizeof(int*) * (length + 2));
+  sc->energy_up[0] = vrna_alloc(sizeof(int));
+  for (i = 1; i <= length; ++i)
+    sc->energy_up[i] = vrna_alloc(sizeof(int) * (length - i + 2));
+
+  for (i = 1; i <= length; ++i){
+    sc->energy_up[i][0] = 0;
+    for (j = 1; j <= length - i + 1; ++j)
+      sc->energy_up[i][j] = sc->energy_up[i][j-1] + (epsilon[i + j - 1]*100.);
+  }
+
+  vc->sc = sc;
+}
+
+static double evaluate_objective_function_contribution(double value, int objective_function)
+{
+  if (objective_function == VRNA_OBJECTIVE_FUNCTION_QUADRATIC)
+    return value * value;
+  if (objective_function == VRNA_OBJECTIVE_FUNCTION_ABSOLUTE)
+    return fabs(value);
+
+  assert(0);
+  return 0;
+}
+
+static double evaluate_perturbation_vector_score(vrna_fold_compound_t *vc, const double *epsilon, const double *q_prob_unpaired, double sigma_squared, double tau_squared, int objective_function)
+{
+  double kT, ret = 0;
+  double ret2 = 0.;
+  double *p_prob_unpaired;
+  int i;
+  int length = vc->length;
+
+  /* calculate pairing probabilty in the pertubated energy model */
+  p_prob_unpaired = vrna_alloc(sizeof(double) * (length + 1));
+
+  addSoftConstraint(vc, epsilon, length);
+
+  vc->exp_params->model_details.compute_bpp = 1;
+
+  /* get new (constrained) MFE to scale pf computations properly */
+  double mfe = (double)vrna_mfe(vc, NULL);
+  vrna_exp_params_rescale(vc, &mfe);
+
+  vrna_pf(vc, NULL);
+
+  calculate_probability_unpaired(vc, p_prob_unpaired);
+
+  vrna_sc_remove(vc);
+
+  
+  for (i = 1; i <= length; ++i)
+  {
+    /* add penalty for pertubation energies */
+    ret += evaluate_objective_function_contribution(epsilon[i], objective_function) / tau_squared;
+
+    /* add penalty for mismatches between observed and predicted probabilities */
+    if (q_prob_unpaired[i] >= 0) /* ignore positions with missing data */
+      ret2 += evaluate_objective_function_contribution(p_prob_unpaired[i] - q_prob_unpaired[i], objective_function) / sigma_squared;
+  }
+
+  vrna_message_info(stderr, "Score: pertubation: %g\tdiscrepancy: %g", ret, ret2);
+  free(p_prob_unpaired);
+
+  return ret + ret2;
+}
+
+static void pairing_probabilities_from_restricted_pf(vrna_fold_compound_t *vc, const double *epsilon, double *prob_unpaired, double **conditional_prob_unpaired)
+{
+  int length = vc->length;
+  int i;
+
+  addSoftConstraint(vc, epsilon, length);
+  vc->exp_params->model_details.compute_bpp = 1;
+
+  /* get new (constrained) MFE to scale pf computations properly */
+  double mfe = (double)vrna_mfe(vc, NULL);
+  vrna_exp_params_rescale(vc, &mfe);
+
+  vrna_pf(vc, NULL);
+
+  calculate_probability_unpaired(vc, prob_unpaired);
+
+#ifdef _OPENMP
+  #pragma omp parallel for private(i)
+#endif
+  for (i = 1; i <= length; ++i)
+  {
+    vrna_fold_compound_t *restricted_vc;
+    char *hc_string;
+    unsigned int constraint_options = VRNA_CONSTRAINT_DB
+                                      | VRNA_CONSTRAINT_DB_PIPE
+                                      | VRNA_CONSTRAINT_DB_DOT
+                                      | VRNA_CONSTRAINT_DB_X
+                                      | VRNA_CONSTRAINT_DB_ANG_BRACK
+                                      | VRNA_CONSTRAINT_DB_RND_BRACK;
+
+    hc_string = vrna_alloc(sizeof(char) * (length + 1));
+    memset(hc_string, '.', length);
+    hc_string[i - 1] = 'x';
+
+    restricted_vc = vrna_fold_compound(vc->sequence, &(vc->exp_params->model_details), VRNA_OPTION_PF);
+    vrna_constraints_add(restricted_vc, hc_string, constraint_options);
+    free(hc_string);
+
+    vrna_exp_params_subst(restricted_vc, vc->exp_params);
+
+    vrna_pf(restricted_vc, NULL);
+    calculate_probability_unpaired(restricted_vc, conditional_prob_unpaired[i]);
+
+    restricted_vc->sc = NULL;
+    vrna_fold_compound_free(restricted_vc);
+  }
+
+  vrna_sc_remove(vc);
+}
+
+static void pairing_probabilities_from_sampling(vrna_fold_compound_t *vc, const double *epsilon, int sample_size, double *prob_unpaired, double **conditional_prob_unpaired)
+{
+  double kT;
+  int length = vc->length;
+  int i, j, s;
+  st_back = 1; /* is this really required? */
+
+  addSoftConstraint(vc, epsilon, length);
+
+  vc->exp_params->model_details.compute_bpp = 0;
+
+  /* get new (constrained) MFE to scale pf computations properly */
+  double mfe = (double)vrna_mfe(vc, NULL);
+  vrna_exp_params_rescale(vc, &mfe);
+
+  vrna_pf(vc, NULL);
+
+
+#ifdef _OPENMP
+  #pragma omp parallel for private(s)
+#endif
+  for (s = 0; s < sample_size; ++s)
+  {
+    char *sample = vrna_pbacktrack(vc);
+
+#ifdef _OPENMP
+    #pragma omp critical
+#endif
+    {
+      for (i = 1; i <= length; ++i)
+      {
+        if (sample[i-1] != '.')
+          continue;
+
+        ++prob_unpaired[i];
+
+        for (j = 1; j <= length; ++j)
+          if (sample[j-1] == '.')
+            ++conditional_prob_unpaired[i][j];
+      }
+    }
+
+    free(sample);
+  }
+
+  for (i = 1; i <= length; ++i)
+  {
+    if (prob_unpaired[i])
+      for (j = 1; j <= length; ++j)
+        conditional_prob_unpaired[i][j] /= prob_unpaired[i];
+
+    prob_unpaired[i] /= sample_size;
+
+    assert(prob_unpaired[i] >= 0 && prob_unpaired[i] <= 1);
+  }
+
+  vrna_sc_remove(vc);
+}
+
+static void allocateProbabilityArrays(double **unpaired, double ***conditional_unpaired, int length)
+{
+  int i;
+
+  *unpaired = vrna_alloc(sizeof(double) * (length + 1));
+  *conditional_unpaired = vrna_alloc(sizeof(double*) * (length + 1));
+
+  for (i = 1; i <= length; ++i)
+    (*conditional_unpaired)[i] = vrna_alloc(sizeof(double) * (length + 1));
+}
+
+static void freeProbabilityArrays(double *unpaired, double **conditional_unpaired, int length)
+{
+  int i;
+
+  free(unpaired);
+  for (i = 1; i <= length; ++i)
+    free(conditional_unpaired[i]);
+  free(conditional_unpaired);
+}
+
+static void evaluate_perturbation_vector_gradient(vrna_fold_compound_t *vc, const double *epsilon, const double *q_prob_unpaired, double sigma_squared, double tau_squared, int objective_function, int sample_size, double *gradient)
+{
+  double *p_prob_unpaired;
+  double **p_conditional_prob_unpaired;
+  int i, mu;
+  int length = vc->length;
+  double kT = vc->exp_params->kT / 1000;
+
+  allocateProbabilityArrays(&p_prob_unpaired, &p_conditional_prob_unpaired, length);
+
+  if (sample_size > 0)
+    pairing_probabilities_from_sampling(vc, epsilon, sample_size, p_prob_unpaired, p_conditional_prob_unpaired);
+  else
+    pairing_probabilities_from_restricted_pf(vc, epsilon, p_prob_unpaired, p_conditional_prob_unpaired);
+
+  for (mu = 1; mu <= length; ++mu)
+  {
+    double sum = 0;
+
+    if (objective_function == VRNA_OBJECTIVE_FUNCTION_QUADRATIC)
+    {
+      for (i = 1; i <= length; ++i)
+      {
+        if (q_prob_unpaired[i] < 0) /* ignore positions with missing data */
+          continue;
+
+        sum += (p_prob_unpaired[i] - q_prob_unpaired[i])
+               * p_prob_unpaired[i] * (p_prob_unpaired[mu] - p_conditional_prob_unpaired[i][mu])
+               / sigma_squared;
+      }
+
+      gradient[mu] = 2 * (epsilon[mu] / tau_squared + sum/kT);
+    }
+    else if (objective_function == VRNA_OBJECTIVE_FUNCTION_ABSOLUTE)
+    {
+      for (i = 1; i <= length; ++i)
+        if (q_prob_unpaired[i] >= 0 && p_prob_unpaired[i] != q_prob_unpaired[i])
+          sum += (p_prob_unpaired[i] * (p_prob_unpaired[mu] - p_conditional_prob_unpaired[i][mu])) / kT
+                 / sigma_squared
+                 * (p_prob_unpaired[i] > q_prob_unpaired[i] ? 1. : -1.);
+
+      if (epsilon[mu])
+        sum += (epsilon[mu] > 0 ? 1. : -1.) / tau_squared;
+
+      gradient[mu] = sum;
+    }
+  }
+
+  freeProbabilityArrays(p_prob_unpaired, p_conditional_prob_unpaired, length);
+}
+
+#ifdef WITH_GSL
+typedef struct parameters_gsl {
+  vrna_fold_compound_t *vc;
+  const double *q_prob_unpaired;
+  double sigma_squared;
+  double tau_squared;
+  int objective_function;
+  int sample_size;
+} parameters_gsl;
+
+static double f_gsl(const gsl_vector *x, void *params)
+{
+  parameters_gsl *p = params;
+
+  return evaluate_perturbation_vector_score(p->vc, x->data, p->q_prob_unpaired, p->sigma_squared, p->tau_squared, p->objective_function);
+}
+
+static void df_gsl(const gsl_vector *x, void *params, gsl_vector *df)
+{
+  parameters_gsl *p = params;
+
+  gsl_vector_set(df, 0, 0);
+  evaluate_perturbation_vector_gradient(p->vc, x->data, p->q_prob_unpaired, p->sigma_squared, p->tau_squared, p->objective_function, p->sample_size, df->data);
+}
+
+static void fdf_gsl(const gsl_vector *x, void *params, double *f, gsl_vector *g)
+{
+  *f = f_gsl(x, params);
+  df_gsl(x, params, g);
+}
+#endif /* WITH_GSL */
+
+PUBLIC void
+vrna_sc_minimize_pertubation(vrna_fold_compound_t *vc,
+                              const double *q_prob_unpaired,
+                              int objective_function,
+                              double sigma_squared,
+                              double tau_squared,
+                              int algorithm,
+                              int sample_size,
+                              double *epsilon,
+                              double initialStepSize,
+                              double minStepSize,
+                              double minImprovement,
+                              double minimizerTolerance,
+                              progress_callback callback){
+
+  int iteration_count = 0;
+  const int max_iterations = 100;
+  int length = vc->length;
+
+#ifdef WITH_GSL
+  const gsl_multimin_fdfminimizer_type *minimizer_type = 0;
+
+  struct {int type; const gsl_multimin_fdfminimizer_type *gsl_type;} algorithms[] = {{VRNA_MINIMIZER_CONJUGATE_FR, gsl_multimin_fdfminimizer_conjugate_fr},
+                                                                                     {VRNA_MINIMIZER_CONJUGATE_PR, gsl_multimin_fdfminimizer_conjugate_pr},
+                                                                                     {VRNA_MINIMIZER_VECTOR_BFGS, gsl_multimin_fdfminimizer_vector_bfgs},
+                                                                                     {VRNA_MINIMIZER_VECTOR_BFGS2, gsl_multimin_fdfminimizer_vector_bfgs2},
+                                                                                     {VRNA_MINIMIZER_STEEPEST_DESCENT, gsl_multimin_fdfminimizer_steepest_descent},
+                                                                                     {0, NULL}};
+  int i;
+  for (i = 0; algorithms[i].type; ++i)
+    if (algorithms[i].type == algorithm)
+    {
+      minimizer_type = algorithms[i].gsl_type;
+      break;
+    }
+
+  if (minimizer_type)
+  {
+    parameters_gsl parameters;
+    gsl_multimin_function_fdf fdf;
+    gsl_multimin_fdfminimizer *minimizer;
+    gsl_vector *vector;
+
+    int status;
+
+    parameters.vc = vc;
+    parameters.q_prob_unpaired = q_prob_unpaired;
+    parameters.sigma_squared = sigma_squared;
+    parameters.tau_squared = tau_squared;
+    parameters.objective_function = objective_function;
+    parameters.sample_size = sample_size;
+
+    fdf.n = length + 1;
+    fdf.f = &f_gsl;
+    fdf.df = &df_gsl;
+    fdf.fdf = &fdf_gsl;
+    fdf.params = (void*)&parameters;
+
+    minimizer = gsl_multimin_fdfminimizer_alloc(minimizer_type, length + 1);
+    vector = gsl_vector_calloc(length + 1);
+
+    /* gsl_multimin_fdfminimizer_set(minimizer, &fdf, vector, 0.01, 1e-4); */
+    gsl_multimin_fdfminimizer_set(minimizer, &fdf, vector, initialStepSize, minimizerTolerance);
+
+    if (callback)
+      callback(0, minimizer->f, minimizer->x->data);
+
+    do
+    {
+      ++iteration_count;
+      status = gsl_multimin_fdfminimizer_iterate(minimizer);
+
+      if (callback)
+        callback(iteration_count, minimizer->f, minimizer->x->data);
+
+      if (status)
+        break;
+
+      status = gsl_multimin_test_gradient(minimizer->gradient, minimizerTolerance);
+    }
+    while (status == GSL_CONTINUE && iteration_count < max_iterations);
+
+    memcpy(epsilon, minimizer->x->data, sizeof(double) * (length + 1));
+
+    gsl_multimin_fdfminimizer_free(minimizer);
+    gsl_vector_free(vector);
+
+    return;
+  }
+#endif /* WITH_GSL */
+
+  double improvement;
+  const double min_improvement = minImprovement;
+
+  double *new_epsilon = vrna_alloc(sizeof(double) * (length + 1));
+  double *gradient = vrna_alloc(sizeof(double) * (length + 1));
+
+  double score = evaluate_perturbation_vector_score(vc, epsilon, q_prob_unpaired, sigma_squared, tau_squared, objective_function);
+
+  if (callback)
+    callback(0, score, epsilon);
+
+  do
+  {
+    double new_score;
+    double step_size;
+
+    ++iteration_count;
+
+    evaluate_perturbation_vector_gradient(vc, epsilon, q_prob_unpaired, sigma_squared, tau_squared, objective_function, sample_size, gradient);
+
+    /*    step_size = 0.5 / calculate_norm(gradient, length);*/
+    step_size = initialStepSize;
+
+    do
+    {
+      int i;
+      for (i = 1; i <= length; ++i)
+        new_epsilon[i] = epsilon[i] - step_size * gradient[i];
+
+      new_score = evaluate_perturbation_vector_score(vc, new_epsilon, q_prob_unpaired, sigma_squared, tau_squared, objective_function);
+      improvement = 1 - new_score / score;
+      step_size /= 2;
+    } while ((improvement < min_improvement) && (step_size >= minStepSize));
+
+    if (new_score > score)
+      break;
+
+    if (callback)
+      callback(iteration_count, new_score, new_epsilon);
+
+    score = new_score;
+    memcpy(epsilon, new_epsilon, sizeof(double) * (length+1));
+  } while (improvement >= min_improvement && iteration_count < max_iterations);
+
+  free(gradient);
+  free(new_epsilon);
+}
+
diff --git a/C/ViennaRNA/perturbation_fold.h b/C/ViennaRNA/perturbation_fold.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/perturbation_fold.h
@@ -0,0 +1,151 @@
+#ifndef VIENNA_RNA_PACKAGE_PERTURBATION_FOLD_H
+#define VIENNA_RNA_PACKAGE_PERTURBATION_FOLD_H
+
+#include "data_structures.h"
+
+/**
+ *  @file perturbation_fold.h
+ *  @brief Find a vector of perturbation energies that minimizes the discripancies between predicted and observed pairing probabilities and the amount of neccessary adjustments
+ *  @ingroup perturbation
+ */
+
+/**
+ *  @addtogroup perturbation
+ *  @brief Find a vector of perturbation energies that minimizes the discripancies between predicted and observed pairing probabilities and the amount of neccessary adjustments
+ */
+
+/**
+ * @brief Use the sum of squared aberrations as objective function
+ *
+ * @f$ F(\vec\epsilon) = \sum_{i = 1}^n{ \frac{\epsilon_i^2}{\tau^2} } + \sum_{i = 1}^n{ \frac{(p_i(\vec\epsilon) - q_i)^2}{\sigma^2} } \to min @f$
+ *
+ * @ingroup perturbation
+ */
+#define VRNA_OBJECTIVE_FUNCTION_QUADRATIC 0
+
+/**
+ * @brief Use the sum of absolute aberrations as objective function
+ *
+ * @f$ F(\vec\epsilon) = \sum_{i = 1}^n{ \frac{|\epsilon_i|}{\tau^2} } + \sum_{i = 1}^n{ \frac{|p_i(\vec\epsilon) - q_i|}{\sigma^2} } \to min @f$
+ *
+ * @ingroup perturbation
+ */
+#define VRNA_OBJECTIVE_FUNCTION_ABSOLUTE 1
+
+/**
+ * @brief Use a custom implementation of the gradient descent algorithm to minimize the objective function
+ *
+ * @ingroup perturbation
+ */
+#define VRNA_MINIMIZER_DEFAULT 0
+
+/**
+ * @brief Use the GNU Scientific Library implementation of the Fletcher-Reeves conjugate gradient algorithm to minimize the objective function
+ *
+ * Please note that this algorithm can only be used when the GNU Scientific Library is available on your system
+ *
+ * @ingroup perturbation
+ */
+#define VRNA_MINIMIZER_CONJUGATE_FR 1
+
+/**
+ * @brief Use the GNU Scientific Library implementation of the Polak-Ribiere conjugate gradient algorithm to minimize the objective function
+ *
+ * Please note that this algorithm can only be used when the GNU Scientific Library is available on your system
+ *
+ * @ingroup perturbation
+ */
+#define VRNA_MINIMIZER_CONJUGATE_PR 2
+
+/**
+ * @brief Use the GNU Scientific Library implementation of the vector Broyden-Fletcher-Goldfarb-Shanno algorithm to minimize the objective function
+ *
+ * Please note that this algorithm can only be used when the GNU Scientific Library is available on your system
+ *
+ * @ingroup perturbation
+ */
+#define VRNA_MINIMIZER_VECTOR_BFGS 3
+
+/**
+ * @brief Use the GNU Scientific Library implementation of the vector Broyden-Fletcher-Goldfarb-Shanno algorithm to minimize the objective function
+ *
+ * Please note that this algorithm can only be used when the GNU Scientific Library is available on your system
+ *
+ * @ingroup perturbation
+ */
+#define VRNA_MINIMIZER_VECTOR_BFGS2 4
+
+/**
+ * @brief Use the GNU Scientific Library implementation of the steepest descent algorithm to minimize the objective function
+ *
+ * Please note that this algorithm can only be used when the GNU Scientific Library is available on your system
+ *
+ * @ingroup perturbation
+ */
+#define VRNA_MINIMIZER_STEEPEST_DESCENT 5
+
+/**
+ * @brief Callback for following the progress of the minimization process
+ *
+ * @param iteration The number of the current iteration
+ * @param score     The score of the objective function
+ * @param epsilon   The perturbation vector yielding the reported score
+ *
+ * @ingroup perturbation
+ */
+typedef void (*progress_callback)(int iteration, double score, double *epsilon);
+
+/**
+ *  @brief Find a vector of perturbation energies that minimizes the discripancies between predicted and observed pairing probabilities and the amount of neccessary adjustments
+ *
+ *  Use an iterative minimization algorithm to find a vector of perturbation energies whose incorporation as soft constraints shifts the predicted
+ *  pairing probabilities closer to the experimentally observed probabilities.
+ *  The algorithm aims to minimize an objective function that penalizes discripancies between predicted and observed pairing probabilities and energy model adjustments,
+ *  i.e. an appropriate vector of perturbation energies satisfies
+ *  @f[
+ *  F(\vec\epsilon) = \sum_{\mu}{ \frac{\epsilon_{\mu}^2}{\tau^2} } + \sum_{i =
+ *  1}^n{ \frac{(p_i(\vec\epsilon) - q_i)^2}{\sigma^2} } \to \min.
+ *  @f]
+ *
+ *  An initialized fold compound and an array containing the observed probability for each nucleotide to be unbound are required as input data.
+ *  The parameters objective_function, sigma_squared and tau_squared are responsible for adjusting the aim of the objective function.
+ *  Dependend on which type of objective function is selected, either squared or absolute aberrations are contributing to the objective function.
+ *  The ratio of the parameters sigma_squared and tau_squared can be used to adjust the algorithm to find a solution either close to the thermodynamic prediction
+ *  (sigma_squared >> tau_squared) or close to the experimental data (tau_squared >> sigma_squared).
+ *  The minimization can be performed by makeing use of a custom gradient descent implementation or using one of the minimizing algorithms provided by the GNU Scientific Library.
+ *  All algorithms require the evaluation of the gradient of the objective function, which includes the evaluation of conditional pairing probabilites.
+ *  Since an exact evaluation is expensive, the probabilities can also be estimated from sampling by setting an appropriate sample size.
+ *  The found vector of perturbation energies will be stored in the array epsilon.
+ *  The progress of the minimization process can be tracked by implementing and passing a callback function.
+ *
+ *  @see For further details we refere to @cite washietl:2012.
+ *  @ingroup perturbation
+ *
+ *  @param vc                 Pointer to a fold compound
+ *  @param q_prob_unpaired    Pointer to an array containing the probability to be unpaired for each nucleotide
+ *  @param objective_function The type of objective function to be used (VRNA_OBJECTIVE_FUNCTION_QUADRATIC / VRNA_OBJECTIVE_FUNCTION_LINEAR)
+ *  @param sigma_squared      A factor used for weighting the objective function.
+ *                            More weight on this factor will lead to a solution close to the null vector.
+ *  @param tau_squared        A factor used for weighting the objective function.
+ *                            More weight on this factor will lead to a solution close to the data provided in q_prob_unpaired.
+ *  @param algorithm          The minimization algorithm (VRNA_MINIMIZER_*)
+ *  @param sample_size        The number of sampled sequences used for estimating the pairing probabilities. A value <= 0 will lead to an exact evaluation.
+ *  @param epsilon            A pointer to an array used for storing the calculated vector of perturbation energies
+ *  @param callback           A pointer to a callback function used for reporting the current minimization progress
+ *
+ */
+void vrna_sc_minimize_pertubation(vrna_fold_compound_t *vc,
+                                  const double *q_prob_unpaired,
+                                  int objective_function,
+                                  double sigma_squared,
+                                  double tau_squared,
+                                  int algorithm,
+                                  int sample_size,
+                                  double *epsilon,
+                                  double initialStepSize,
+                                  double minStepSize,
+                                  double minImprovement,
+                                  double minimizerTolerance,
+                                  progress_callback callback);
+
+#endif
diff --git a/C/ViennaRNA/plex.c b/C/ViennaRNA/plex.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/plex.c
@@ -0,0 +1,3040 @@
+/*
+           compute the duplex structure of two RNA strands,
+                allowing only inter-strand base pairs.
+         see cofold() for computing hybrid structures without
+                             restriction.
+                             Ivo Hofacker
+                          Vienna RNA package
+
+*/
+
+
+/*
+  library containing the function used in rnaplex
+  the program rnaplex uses the following function
+  Lduplexfold: finds high scoring segments
+  it stores the end-position of these segments in an array
+  and call then for each of these positions the duplexfold function
+  which allows one to make backtracking for each of the high scoring position
+  It allows one to find suboptimal partially overlapping (depends on a a parameter)
+  duplexes between a long RNA and a shorter one.
+  Contrarly to RNAduplex, the energy model is not in E~log(N),
+  where N is the length of an interial loop but used an affine model,
+  where the extension and begin parameter are fitted to the energy
+  parameter used by RNAduplex. This allows one to check for duplex between a short RNA(20nt)
+  and a long one at the speed of 1Mnt/s. At this speed the whole genome (3Gnt) can be analyzed for one siRNA
+  in about 50 minutes.
+  The algorithm is based on an idea by Durbin and Eddy:when the alginment reach a value larger than a
+  given threshold this value is stored in an array. When the alignment score goes
+  then under this threshold, the alignemnent begin from this value, in that way the backtracking allow us
+  to find all non-overlapping high-scoring segments.
+  For more information check "durbin, biological sequence analysis"
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/plex.h"
+#include "ViennaRNA/ali_plex.h"
+#include "ViennaRNA/loop_energies.h"
+/* #################SIMD############### */
+
+/* int subopt_sorted=0; */
+
+#define PUBLIC
+#define PRIVATE static
+
+#define STACK_BULGE1  1   /* stacking energies for bulges of size 1 */
+#define NEW_NINIO     1   /* new asymetry penalty */
+#define ARRAY 32          /*array size*/
+#define UNIT 100
+#define MINPSCORE -2 * UNIT
+
+/**
+*** Macro that define indices for the Single Array approach defined in FLduplexfold_XS->gain of 20% in runtime
+*** so that everything is done in a 1D array.
+*** input is idx for i, j for j and the length of the query RNA
+*** 1D is divided in 6 subarrays, one for each number of allowed state
+*** The length of each subarray is 5*L. 5 the maximal stored distance on the target sequence,
+*** L is the length of the query sequence
+**/
+#define LCI(i,j,l)      ((i     )*l + j)
+#define LINI(i,j,l)     ((i +  5)*l + j)
+#define LBXI(i,j,l)     ((i + 10)*l + j)
+#define LBYI(i,j,l)     ((i + 15)*l + j)
+#define LINIX(i,j,l)    ((i + 20)*l + j)
+#define LINIY(i,j,l)    ((i + 25)*l + j)
+
+PRIVATE void  encode_seqs(const char *s1, const char *s2);
+PRIVATE short *encode_seq(const char *seq);
+PRIVATE void  update_dfold_params(void);
+/**
+*** duplexfold(_XS)/backtrack(_XS) computes duplex interaction with standard energy and considers extension_cost
+*** find_max(_XS)/plot_max(_XS) find suboptimals and MFE
+*** fduplexfold(_XS) computes duplex in a plex way
+**/
+PRIVATE duplexT duplexfold(const char *s1, const char *s2, const int extension_cost);
+PRIVATE char * backtrack(int i, int j, const int extension_cost);
+PRIVATE void   find_max(const int *position, const int *position_j, const int delta, const int threshold, const int length, const char *s1, const char *s2, const int extension_cost, const int fast,const int il_a, const int il_b, const int b_a, const int b_b);
+PRIVATE void   plot_max(const int max, const int max_pos, const int max_pos_j, const int alignment_length, const char *s1, const char *s2, const int extension_cost, const int fast,const int il_a, const int il_b, const int b_a, const int b_b);
+
+/* PRIVATE duplexT duplexfold_XS(const char *s1, const char *s2,const int **access_s1, const int **access_s2, const int i_pos, const int j_pos, const int threshold); */
+PRIVATE duplexT duplexfold_XS(const char *s1, const char *s2,const int **access_s1, const int **access_s2, const int i_pos, const int j_pos, const int threshold, const int i_flag, const int j_flag);
+/* PRIVATE char *   backtrack_XS(int i, int j, const int** access_s1, const int** access_s2); */
+PRIVATE char *backtrack_XS(int i, int j, const int **access_s1,const int **access_s2,const int i_flag, const int j_flag );
+PRIVATE void find_max_XS(const int *position, const int *position_j,const int delta, const int threshold, const int alignment_length,
+                         const char *s1, const char *s2, const int **access_s1, const int **access_s2, const int fast,const int il_a, const int il_b, const int b_a, const int b_b);
+PRIVATE void plot_max_XS(const int max, const int max_pos, const int max_pos_j, const int alignment_length, const char *s1, const char *s2, const int **access_s1, const int **access_s2, const int fast,const int il_a, const int il_b, const int b_a, const int b_b);
+PRIVATE duplexT fduplexfold(const char *s1, const char *s2, const int extension_cost, const int il_a, const int il_b, const int b_a, const int b_b);
+PRIVATE char *fbacktrack(int i, int j, const int extension_cost,const int il_a, const int il_b, const int b_a, const int b_b, int *dG);
+PRIVATE duplexT fduplexfold_XS(const char *s1, const char *s2, const int **access_s1, const int **access_s2, const int i_pos, const int j_pos, const int threshold,const int il_a, const int il_b, const int b_a, const int b_b);
+PRIVATE char * fbacktrack_XS(int i, int j, const int **access_s1, const int **access_s2, const int i_pos, const int j_pos, const int il_a, const int il_b, const int b_a, const int b_b, int *dGe, int *dGeplex, int *dGx, int *dGy);
+
+
+
+/*@unused@*/
+
+#define MAXSECTORS      500     /* dimension for a backtrack array */
+#define LOCALITY        0.      /* locality parameter for base-pairs */
+
+PRIVATE vrna_param_t *P = NULL;
+
+/**
+*** energy array used in fduplexfold and fduplexfold_XS
+*** We do not use the 1D array here as it is not time critical
+*** It also makes the code more readable
+*** c -> stack;in -> interior loop;bx/by->bulge;inx/iny->1xn loops
+**/
+
+PRIVATE int   **c=NULL, **in=NULL, **bx=NULL, **by=NULL, **inx=NULL, **iny=NULL;
+
+/**
+*** S1, SS1, ... contains the encoded sequence for target and query
+*** n1, n2, n3, n4 contains target and query length
+**/
+
+PRIVATE short  *S1=NULL, *SS1=NULL, *S2=NULL, *SS2=NULL;/*contains the sequences*/
+PRIVATE int   n1,n2;    /* sequence lengths */
+PRIVATE int n3, n4; /*sequence length for the duplex*/;
+
+
+/*-----------------------------------------------------------------------duplexfold_XS---------------------------------------------------------------------------*/
+
+/**
+*** duplexfold_XS is the pendant to the duplex function as defined in duplex.c
+*** but takes the accessibility into account. It is similar to the MFE version of RNAup
+*** The only approximation made is that target 3' end - query 5' end base pair is known
+*** s1,s2 are the query and target sequence; access_s1, access_s2 are the accessibility
+*** profiles, i_pos, j_pos are the coordinates of the closing pair.
+**/
+
+
+
+PRIVATE duplexT duplexfold_XS(const char *s1, const char *s2, const int **access_s1, const int **access_s2, const int i_pos, const int j_pos, const int threshold, const int i_flag, const int j_flag) {
+  int i, j,p,q, Emin=INF, l_min=0, k_min=0;
+  char *struc;
+  vrna_md_t   md;
+
+  struc=NULL;
+  duplexT mfe;
+  n3 = (int) strlen(s1);
+  n4 = (int) strlen(s2);
+
+  set_model_details(&md);
+
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    update_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+
+  c = (int **) vrna_alloc(sizeof(int *) * (n3+1));
+  for (i=0; i<=n3; i++) c[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+  for (i=0; i<=n3; i++){
+    for(j=0;j<=n4;j++){
+      c[i][j]=INF;
+    }
+  }
+  encode_seqs(s1, s2);
+  int type, type2, type3, E, k,l;
+  i=n3-i_flag; j=1+j_flag;
+  type = pair[S1[i]][S2[j]];
+  if(!type){
+    printf("Error during initialization of the duplex in duplexfold_XS\n");
+    mfe.structure=NULL;
+    mfe.energy = INF;
+    return mfe;
+  }
+  c[i][j] = P->DuplexInit;
+  /**  if (type>2) c[i][j] += P->TerminalAU;
+  ***  c[i][j]+=P->dangle3[rtype[type]][SS1[i+1]];
+  ***  c[i][j]+=P->dangle5[rtype[type]][SS2[j-1]];
+  *** The three above lines are replaced by the line below
+  **/
+
+
+  c[i][j] += E_ExtLoop(rtype[type], (j_flag ? SS2[j-1] : -1) , (i_flag ? SS1[i+1] : -1),  P);
+
+/*   if(j_flag ==0 && i_flag==0){ */
+/*     c[i][j] += E_ExtLoop(rtype[type], -1 , -1 , P); */
+/*   }else if(j_flag ==0 && i_flag==1){ */
+/*     c[i][j] += E_ExtLoop(rtype[type], -1 , SS1[i+1], P); */
+/*   }else if(j_flag ==1 && i_flag==0){ */
+/*     c[i][j] += E_ExtLoop(rtype[type], SS2[j-1] , -1, P); */
+/*   }else { */
+/*     c[i][j] += E_ExtLoop(rtype[type], SS2[j-1] , SS1[i+1], P); */
+/*   } */
+  /*  Just in case we have only one bp, we initialize ... */
+  /*  k_min, l_min and Emin */
+  k_min=i; l_min=j;Emin=c[i][j];
+  for (k=i; k>1 ; k--) {
+    if(k<i) c[k+1][0]=INF;
+    for (l=j; l<=n4-1; l++) {
+      if(!(k==i && l==j)){
+        c[k][l]=INF;
+      }
+      type2 = pair[S1[k]][S2[l]];
+      if (!type2) continue;
+      for (p=k+1; p<= n3 - i_flag && p<k+MAXLOOP-1; p++) {
+        for (q = l-1; q >= 1+j_flag; q--) {
+          if (p-k+l-q-2>MAXLOOP) break;
+          type3=pair[S1[p]][S2[q]];
+          if(!type3) continue;
+          E = E_IntLoop(p-k-1, l-q-1, type2, rtype[type3],SS1[k+1], SS2[l-1], SS1[p-1], SS2[q+1],P);
+          c[k][l] = MIN2(c[k][l], c[p][q]+E);
+        }
+      }
+      E = c[k][l];
+      E+=access_s1[i-k+1][i_pos]+access_s2[l-1][j_pos+(l-1)-1];
+      /**if (type2>2) E += P->TerminalAU;
+      ***if (k>1) E += P->dangle5[type2][SS1[k-1]];
+      ***if (l<n4) E += P->dangle3[type2][SS2[l+1]];
+      *** Replaced by the line below
+      **/
+      E+=E_ExtLoop(type2, (k>1) ? SS1[k-1] : -1, (l<n4) ? SS2[l+1] : -1, P);
+
+      if (E<Emin) {
+        Emin=E; k_min=k; l_min=l;
+      }
+    }
+  }
+
+  if(Emin  > threshold){
+    mfe.energy=INF;
+    mfe.ddG=INF;
+    mfe.structure=NULL;
+    for (i=0; i<=n3; i++) free(c[i]);
+    free(c);
+    free(S1); free(S2); free(SS1); free(SS2);
+    return mfe;
+  } else{
+    struc = backtrack_XS(k_min, l_min, access_s1, access_s2, i_flag, j_flag);
+  }
+
+
+  /**
+  *** find best dangles combination
+  **/
+  int dx_5, dx_3, dy_5, dy_3,dGx,dGy,bonus_x;
+  dx_5=0; dx_3=0; dy_5=0; dy_3=0;dGx=0;dGy=0;bonus_x=0;
+  /* x--------x */
+  /*  |||||||| */
+  /* x--------x */
+   dGx = access_s1[i-k_min+1][i_pos];dx_3=0; dx_5=0;bonus_x=0;
+   dGy = access_s2[l_min-j+1][j_pos + (l_min-1)];
+
+  mfe.tb=i_pos -9 - i + k_min -1 -dx_5;
+  mfe.te=i_pos -9 -1 + dx_3;
+  mfe.qb=j_pos -9 -1 - dy_5;
+  mfe.qe=j_pos + l_min -3 -9 + dy_3;
+  mfe.ddG=(double) Emin * 0.01;
+  mfe.dG1=(double) dGx*0.01 ;
+  mfe.dG2=(double) dGy*0.01 ;
+
+  mfe.energy= mfe.ddG - mfe.dG1 - mfe.dG2;
+
+  mfe.structure = struc;
+  for (i=0; i<=n3; i++) free(c[i]);
+  free(c);
+  free(S1); free(S2); free(SS1); free(SS2);
+  return mfe;
+}
+
+
+
+
+
+
+PRIVATE char *backtrack_XS(int i, int j, const int **access_s1,const int **access_s2, const int i_flag, const int j_flag) {
+  /* backtrack structure going backwards from i, and forwards from j
+     return structure in bracket notation with & as separator */
+  int k, l, type, type2, E, traced, i0, j0;
+  char *st1, *st2, *struc;
+  st1 = (char *) vrna_alloc(sizeof(char)*(n3+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n4+1));
+  i0=i;/*MAX2(i-1,1);*/j0=j;/*MIN2(j+1,n4);*/
+  while (i<=n3-i_flag && j>=1+j_flag) {
+    E = c[i][j]; traced=0;
+    st1[i-1] = '(';
+    st2[j-1] = ')';
+    type = pair[S1[i]][S2[j]];
+    if (!type) vrna_message_error("backtrack failed in fold duplex bli");
+    for (k=i+1; k<=n3 && k>i-MAXLOOP-2; k++) {
+      for (l=j-1; l>=1; l--) {
+        int LE;
+        if (i-k+l-j-2>MAXLOOP) break;
+        type2 = pair[S1[k]][S2[l]];
+        if (!type2) continue;
+        LE = E_IntLoop(k-i-1, j-l-1, type, rtype[type2], SS1[i+1], SS2[j-1], SS1[k-1], SS2[l+1],P);
+        if (E == c[k][l]+LE) {
+          traced=1;
+          i=k; j=l;
+          break;
+        }
+      }
+      if (traced) break;
+    }
+    if (!traced) {
+#if 0
+      if (i<n3) E -= P->dangle3[rtype[type]][SS1[i+1]];/* +access_s1[1][i+1]; */
+      if (j>1)  E -= P->dangle5[rtype[type]][SS2[j-1]];/* +access_s2[1][j+1]; */
+      if (type>2) E -= P->TerminalAU;
+#endif
+      E -= E_ExtLoop(rtype[type], SS2[j-1] , SS1[i+1], P);
+      break;
+      if (E != P->DuplexInit) {
+        vrna_message_error("backtrack failed in fold duplex bal");
+      } else break;
+    }
+  }
+  /* if (i<n3)  i++; */
+  /* if (j>1)   j--; */
+  struc = (char *) vrna_alloc(i-i0+1+j0-j+1+2);
+  for (k=MAX2(i0,1); k<=i; k++) if (!st1[k-1]) st1[k-1] = '.';
+  for (k=j; k<=j0; k++) if (!st2[k-1]) st2[k-1] = '.';
+  strcpy(struc, st1+MAX2(i0-1,0)); strcat(struc, "&");
+  strcat(struc, st2+j-1);
+  free(st1); free(st2);
+  return struc;
+}
+
+
+/**
+*** fduplexfold(_XS) computes the interaction based on the plex energy model.
+*** Faster than duplex approach, but not standard model compliant
+*** We use the standard matrix (c, in, etc..., because we backtrack)
+**/
+
+PRIVATE duplexT fduplexfold_XS(const char *s1, const char *s2, const int **access_s1, const int **access_s2, const int i_pos, const int j_pos, const int threshold,const int il_a, const int il_b, const int b_a, const int b_b) {
+  /**
+  *** i,j recursion index
+  *** Emin, i_min, j_min MFE position and energy
+  *** mfe struc duplex structure
+  **/
+  int i, j, Emin, i_min, j_min,l1;
+  duplexT mfe;
+  char *struc;
+  /**
+  *** bext=b_a bulge extension parameter for linear model
+  *** iopen=il_b interior opening for linear model
+  *** iext_s=2*il_a asymmetric extension for interior loop
+  *** iext_ass=60+il_a symmetric extension for interior loop
+  *** min_colonne=INF; max score of a row
+  *** i_length;
+  *** max_pos; position of best hit during recursion on target
+  *** max_pos_j; position of best hit during recursion on query
+  *** temp; temp variable for min_colonne
+  *** min_j_colonne; position of the minimum on query in row j
+  *** max=INF; absolute MFE
+  *** n3,n4 length of target and query
+  *** DJ contains the accessibility penalty for the query sequence
+  *** maxPenalty contains the maximum penalty
+  **/
+  int bopen=b_b;
+  int bext=b_a;
+  int iopen=il_b;
+  int iext_s=2*il_a;/* iext_s 2 nt nucleotide extension of interior loop, on i and j side */
+  int iext_ass=50+il_a;/* iext_ass assymetric extension of interior loop, either on i or on j side. */
+  int min_colonne=INF; /* enthaelt das maximum einer kolonne */
+  int i_length;
+  int max_pos;/* get position of the best hit */
+  int max_pos_j;
+  int temp=INF;
+  int min_j_colonne;
+  int max=INF;
+  int **DJ;
+  int maxPenalty[4];
+  vrna_md_t   md;
+
+  /**
+  *** variable initialization
+  **/
+  n3 = (int) strlen(s1);
+  n4 = (int) strlen(s2);
+
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    update_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  /**
+  *** array initialization
+  **/
+  c  = (int**) vrna_alloc(sizeof(int *) * (n3+1));
+  in = (int**) vrna_alloc(sizeof(int *) * (n3+1));
+  bx = (int**) vrna_alloc(sizeof(int *) * (n3+1));
+  by = (int**) vrna_alloc(sizeof(int *) * (n3+1));
+  inx= (int**) vrna_alloc(sizeof(int *) * (n3+1));
+  iny= (int**) vrna_alloc(sizeof(int *) * (n3+1));
+  /* #pragma omp parallel for */
+  for (i=0; i<=n3; i++){
+    c[i]  = (int *) vrna_alloc(sizeof(int) * (n4+1));
+    in[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+    bx[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+    by[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+    inx[i]= (int *) vrna_alloc(sizeof(int) * (n4+1));
+    iny[i]= (int *) vrna_alloc(sizeof(int) * (n4+1));
+  }
+  for(i=0; i<n3; i++){
+    for(j=0; j<n4; j++){
+      in[i][j]=INF;/* no in before  1 */
+      c[i][j] =INF; /* no bulge and no in before n2 */
+      bx[i][j]=INF;/* no bulge before 1 */
+      by[i][j]=INF;
+      inx[i][j]=INF;/* no bulge before 1 */
+      iny[i][j]=INF;
+    }
+  }
+  /**
+  *** sequence encoding
+  **/
+  encode_seqs(s1,s2);
+  /**
+  *** Compute max accessibility penalty for the query only once
+  **/
+  maxPenalty[0]=(int) -1*P->stack[2][2]/2;
+  maxPenalty[1]=(int) -1*P->stack[2][2];
+  maxPenalty[2]=(int) -3*P->stack[2][2]/2;
+  maxPenalty[3]=(int) -2*P->stack[2][2];
+
+
+  DJ=(int **)   vrna_alloc(4*sizeof(int*));
+  DJ[0]=(int *) vrna_alloc((1+n4)*sizeof(int));
+  DJ[1]=(int *) vrna_alloc((1+n4)*sizeof(int));
+  DJ[2]=(int *) vrna_alloc((1+n4)*sizeof(int));
+  DJ[3]=(int *) vrna_alloc((1+n4)*sizeof(int));
+
+  j=n4-9;
+  while(--j>9){
+    int jdiff=j_pos+j-11;
+    /**
+    *** Depending in which direction (i:1->n vs j:m->1) the accessibility is computed we get slightly different results.
+    *** We reduce the discrepancies by taking the average of d^i_k and d^j_l
+    **/
+    DJ[0][j] = 0.5*(access_s2[5][jdiff+4] - access_s2[4][jdiff+4] + access_s2[5][jdiff]  -access_s2[4][jdiff-1]  );
+    DJ[1][j] = 0.5*(access_s2[5][jdiff+5] - access_s2[4][jdiff+5] + access_s2[5][jdiff+1]-access_s2[4][jdiff]  ) + DJ[0][j];
+    DJ[2][j] = 0.5*(access_s2[5][jdiff+6] - access_s2[4][jdiff+6] + access_s2[5][jdiff+2]-access_s2[4][jdiff+1]) + DJ[1][j];
+    DJ[3][j] = 0.5*(access_s2[5][jdiff+7] - access_s2[4][jdiff+7] + access_s2[5][jdiff+3]-access_s2[4][jdiff+2]) + DJ[2][j];
+
+
+
+/*
+    DJ[0][j] = access_s2[5][jdiff+4] - access_s2[4][jdiff+4]           ;
+    DJ[1][j] = access_s2[5][jdiff+5] - access_s2[4][jdiff+5] + DJ[0][j];
+    DJ[2][j] = access_s2[5][jdiff+6] - access_s2[4][jdiff+6] + DJ[1][j];
+    DJ[3][j] = access_s2[5][jdiff+7] - access_s2[4][jdiff+7] + DJ[2][j];
+    DJ[0][j] = MIN2(DJ[0][j],maxPenalty[0]);
+    DJ[1][j] = MIN2(DJ[1][j],maxPenalty[1]);
+    DJ[2][j] = MIN2(DJ[2][j],maxPenalty[2]);
+    DJ[3][j] = MIN2(DJ[3][j],maxPenalty[3]);
+*/
+  }
+
+  /**
+  *** Start of the recursion
+  *** first and last 10 nucleotides on target and query are dummy nucleotides
+  *** allow to reduce number of if test
+  **/
+  i=11;
+  i_length=n3-9;
+  while(i < i_length) {
+    int di1,di2,di3,di4;
+    int idiff=i_pos-(n3-10-i);
+    di1 = 0.5*(access_s1[5][idiff+4] - access_s1[4][idiff+4] + access_s1[5][idiff]   - access_s1[4][idiff-1]);
+    di2 = 0.5*(access_s1[5][idiff+3] - access_s1[4][idiff+3] + access_s1[5][idiff-1] - access_s1[4][idiff-2]) + di1;
+    di3 = 0.5*(access_s1[5][idiff+2] - access_s1[4][idiff+2] + access_s1[5][idiff-2] - access_s1[4][idiff-3]) + di2;
+    di4 = 0.5*(access_s1[5][idiff+1] - access_s1[4][idiff+1] + access_s1[5][idiff-3] - access_s1[4][idiff-4]) + di3;
+/*
+    di1 =  access_s1[5][idiff]   - access_s1[4][idiff-1];
+    di2 =  access_s1[5][idiff-1] - access_s1[4][idiff-2] + di1;
+    di3 =  access_s1[5][idiff-2] - access_s1[4][idiff-3] + di2;
+    di4 =  access_s1[5][idiff-3] - access_s1[4][idiff-4] + di3;
+    di1=MIN2(di1,maxPenalty[0]);
+    di2=MIN2(di2,maxPenalty[1]);
+    di3=MIN2(di3,maxPenalty[2]);
+    di4=MIN2(di4,maxPenalty[3]);
+*/
+    j=n4-9;
+    min_colonne=INF;
+    while (10 < --j) {
+      int dj1,dj2,dj3,dj4;
+      int jdiff=j_pos+j-11;
+      dj1 = DJ[0][j];
+      dj2 = DJ[1][j];
+      dj3 = DJ[2][j];
+      dj4 = DJ[3][j];
+      int type, type2;
+      type = pair[S1[i]][S2[j]];
+      /**
+      *** Start duplex
+      **/
+      /*
+      c[i][j]=type ? P->DuplexInit + access_s1[1][idiff]+access_s2[1][jdiff] : INF;
+      */
+      c[i][j]=type ? P->DuplexInit: INF;
+      /**
+      *** update lin bx by linx liny matrix
+      **/
+      type2=pair[S2[j+1]][S1[i-1]];
+      /**
+      *** start/extend interior loop
+      **/
+      in[i][j]=MIN2(c[i - 1][j+1]+P->mismatchI[type2][SS2[j]][SS1[i]]+iopen+iext_s+di1+dj1,
+                    in[i - 1][j]+iext_ass + di1);
+
+      /**
+      *** start/extend nx1 target
+      *** use same type2 as for in
+      **/
+      inx[i][j]=MIN2(c[i-1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s+di1+dj1,
+                     inx[i-1][j]+iext_ass+di1);
+      /**
+      *** start/extend 1xn target
+      *** use same type2 as for in
+      **/
+      iny[i][j]=MIN2(c[i-1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s+di1+dj1,
+                     iny[i][j+1]+iext_ass+dj1);
+      /**
+      *** extend interior loop
+      **/
+      in[i][j]=MIN2(in[i][j],in[i][j+1]+iext_ass + dj1);
+      in[i][j]=MIN2(in[i][j],in[i - 1][j+1]+iext_s + di1 + dj1);
+      /**
+      *** start/extend bulge target
+      **/
+      type2=pair[S2[j]][S1[i-1]];
+      bx[i][j]=MIN2(bx[i - 1][j]+bext + di1, c[i - 1][j]+bopen+bext+(type2>2?P->TerminalAU:0) + di1);
+      /**
+      *** start/extend bulge query
+      **/
+      type2=pair[S2[j+1]][S1[i]];
+      by[i][j]=MIN2(by[i][j+1]+bext+dj1, c[i][j+1]+bopen+bext+(type2>2?P->TerminalAU:0)+dj1);
+      /**
+      ***end update recursion
+      ***######################## Start stack extension##############################
+      **/
+      if(!type){continue;}
+      c[i][j]+=E_ExtLoop(type, SS1[i-1], SS2[j+1],P);
+      /**
+      *** stack extension
+      **/
+      if((type2=pair[S1[i-1]][S2[j+1]]))
+        c[i][j]=MIN2(c[i - 1][j+1]+P->stack[rtype[type]][type2]+di1+dj1, c[i][j]);
+      /**
+      *** 1x0 / 0x1 stack extension
+      **/
+      if((type2=pair[S1[i-1]][S2[j+2]]))
+        c[i][j]=MIN2(c[i - 1][j+2]+P->bulge[1]+P->stack[rtype[type]][type2]+di1+dj2,c[i][j]);
+      if((type2=pair[S1[i-2]][S2[j+1]]))
+        c[i][j]=MIN2(c[i - 2][j+1]+P->bulge[1]+P->stack[type2][rtype[type]]+di2+dj1,c[i][j]);
+      /**
+      *** 1x1 / 2x2 stack extension
+      **/
+      if((type2=pair[S1[i-2]][S2[j+2]]))
+        c[i][j]=MIN2(c[i - 2][j+2]+P->int11[type2][rtype[type]][SS1[i-1]][SS2[j+1]]+di2+dj2, c[i][j]);
+      if((type2 = pair[S1[i-3]][S2[j+3]]))
+        c[i][j]=MIN2(c[i - 3][j+3]+P->int22[type2][rtype[type]][SS1[i-2]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+di3+dj3,c[i][j]);
+      /**
+      *** 1x2 / 2x1 stack extension
+      *** E_IntLoop(1,2,type2, rtype[type],SS1[i-1], SS2[j+2], SS1[i-1], SS2[j+1], P) corresponds to
+      *** P->int21[rtype[type]][type2][SS2[j+2]][SS1[i-1]][SS1[i-1]]
+      **/
+      if((type2 = pair[S1[i-3]][S2[j+2]]))
+        c[i][j]=MIN2(c[i - 3][j+2]+P->int21[rtype[type]][type2][SS2[j+1]][SS1[i-2]][SS1[i-1]]+di3+dj2, c[i][j]);
+      if((type2 = pair[S1[i-2]][S2[j+3]]))
+        c[i][j]=MIN2(c[i - 2][j+3]+P->int21[type2][rtype[type]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+di2+dj3, c[i][j]);
+
+      /**
+      *** 2x3 / 3x2 stack extension
+      **/
+      if((type2 = pair[S1[i-4]][S2[j+3]]))
+        c[i][j]=MIN2(c[i - 4][j+3]+P->internal_loop[5]+P->ninio[2]+
+                     P->mismatch23I[type2][SS1[i-3]][SS2[j+2]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+di4+dj3, c[i][j]);
+      if((type2 = pair[S1[i-3]][S2[j+4]]))
+        c[i][j]=MIN2(c[i - 3][j+4]+P->internal_loop[5]+P->ninio[2]+
+                     P->mismatch23I[type2][SS1[i-2]][SS2[j+3]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+di3+dj4, c[i][j]);
+
+      /**
+      *** So now we have to handle 1x3, 3x1, 3x3, and mxn m,n > 3
+      **/
+      /**
+      *** 3x3 or more
+      **/
+      c[i][j]=MIN2(in[i - 3][j+3]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+2*iext_s+di3+dj3, c[i][j]);
+      /**
+      *** 2xn or more
+      **/
+      c[i][j]=MIN2(in[i - 4][j+2]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+di4+dj2, c[i][j]);
+      /**
+      *** nx2 or more
+      **/
+      c[i][j]=MIN2(in[i - 2][j+4]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+di2+dj4, c[i][j]);
+      /**
+      *** nx1 n>2
+      **/
+      c[i][j]=MIN2(inx[i - 3][j+1]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+di3+dj1, c[i][j]);
+      /**
+      *** 1xn n>2
+      **/
+      c[i][j]=MIN2(iny[i - 1][j+3]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+dj3+di1, c[i][j]);
+      /**
+      *** nx0 n>1
+      **/
+      int bAU;
+      bAU=(type>2?P->TerminalAU:0);
+      c[i][j]=MIN2(bx[i - 2][j+1]+di2+dj1+bext+bAU, c[i][j]);
+      /**
+      *** 0xn n>1
+      **/
+      c[i][j]=MIN2(by[i - 1][j+2]+di1+dj2+bext+bAU, c[i][j]);
+      /*
+      remove this line printf("%d\t",c[i][j]);
+      */
+      temp=min_colonne;
+      min_colonne=MIN2(c[i][j]+ E_ExtLoop(rtype[type], SS2[j-1], SS1[i+1], P),min_colonne);
+      if(temp>min_colonne){
+        min_j_colonne=j;
+      }
+      /* ---------------------------------------------------------------------end update */
+    }
+    if(max>=min_colonne){
+      max=min_colonne;
+      max_pos=i;
+      max_pos_j=min_j_colonne;
+    }
+    i++;
+    /*
+    remove this line printf("\n");
+    */
+  }
+  Emin=max;
+  if(Emin>threshold){
+    free(S1); free(S2); free(SS1); free(SS2);
+    for (i=0; i<=n3; i++) {
+      free(c[i]);
+      free(in[i]);
+      free(bx[i]);
+      free(by[i]);
+      free(inx[i]);
+      free(iny[i]);
+    }
+    for (i=0; i<=3; i++) {
+      free(DJ[i]);
+    }
+    free(c);free(in);free(bx);free(by);free(inx);free(iny);free(DJ);
+    mfe.energy=0;
+    mfe.structure=NULL;
+    return mfe;
+  }
+  i_min=max_pos;
+  j_min=max_pos_j;
+  int dGe, dGeplex, dGx, dGy;
+  dGe=dGeplex=dGx=dGy=0;
+  /* printf("MAX fduplexfold_XS %d\n",Emin); */
+  struc = fbacktrack_XS(i_min, j_min, access_s1, access_s2, i_pos, j_pos,il_a, il_b,b_a,b_b,&dGe, &dGeplex, &dGx, &dGy);
+
+  l1 = strchr(struc, '&')-struc;
+  int size;
+  size=strlen(struc)-1;
+  int lengthx; int endx; int lengthy; int endy;
+  lengthx=l1;
+  lengthx-=(struc[0]=='.'?1:0);
+  lengthx-=(struc[l1-1]=='.'?1:0);
+  endx=(i_pos-(n3-i_min));
+  lengthy=size-l1;
+  lengthy-=(struc[size]=='.'?1:0);
+  lengthy-=(struc[l1+1]=='.'?1:0);
+  endy=j_pos+j_min+lengthy -22;
+  if (i_min<n3-10) i_min++;
+  if (j_min>11 ) j_min--;
+  mfe.i = i_min;
+  mfe.j = j_min;
+  mfe.ddG = (double) Emin*0.01;
+  mfe.structure = struc;
+  mfe.energy_backtrack = (double) dGe * 0.01;
+  mfe.energy = (double) dGeplex * 0.01;
+  mfe.opening_backtrack_x = (double) dGx * 0.01;
+  mfe.opening_backtrack_y = (double) dGy * 0.01;
+  mfe.dG1=0;/* !remove access to complete access array (double) access_s1[lengthx][endx+10] * 0.01; */
+  mfe.dG2=0;/* !remove access to complete access array (double) access_s2[lengthy][endy+10] * 0.01; */
+  free(S1); free(S2); free(SS1); free(SS2);
+  for (i=0; i<=n3; i++) {
+    free(c[i]);
+    free(in[i]);
+    free(bx[i]);
+    free(by[i]);
+    free(inx[i]);
+    free(iny[i]);
+  }
+  for (i=0; i<=3; i++) {
+    free(DJ[i]);
+  }
+  free(DJ);
+  free(c);free(in);free(bx);free(by);free(iny);free(inx);
+  return mfe;
+}
+
+PRIVATE char *fbacktrack_XS(int i, int j, const int** access_s1, const int** access_s2, const int i_pos, const int j_pos,const int il_a, const int il_b, const int b_a, const int b_b, int *dG, int *dGplex, int *dGx, int *dGy) {
+  /* backtrack structure going backwards from i, and forwards from j
+     return structure in bracket notation with & as separator */
+  int k, l, type, type2, E, traced, i0, j0;
+  char *st1, *st2, *struc;
+  int bopen=b_b;
+  int bext=b_a;
+  int iopen=il_b;
+  int iext_s=2*il_a;/* iext_s 2 nt nucleotide extension of interior loop, on i and j side */
+  int iext_ass=50+il_a;/* iext_ass assymetric extension of interior loop, either on i or on j side. */
+  st1 = (char *) vrna_alloc(sizeof(char)*(n3+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n4+1));
+  i0=MIN2(i+1,n3-10); j0=MAX2(j-1,11);
+  int state;
+  state=1; /* we start backtracking from a a pair , i.e. c-matrix */
+  /* state 1 -> base pair, c
+     state 2 -> interior loop, in
+     state 3 -> bx loop, bx
+     state 4 -> by loop, by
+  */
+  traced=1;
+  k=i; l=j; /* stores the i,j information for subsequence usage see * */
+  int idiff,jdiff;
+  /**
+  *** (type>2?P->TerminalAU:0)+P->dangle3[rtype[type]][SS1[i+1]]+P->dangle5[rtype[type]][SS2[j-1]];
+  **/
+
+  int maxPenalty[4];
+  vrna_md_t   md;
+
+  set_model_details(&md);
+
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)){
+    update_dfold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  maxPenalty[0]=(int) -1*P->stack[2][2]/2;
+  maxPenalty[1]=(int) -1*P->stack[2][2];
+  maxPenalty[2]=(int) -3*P->stack[2][2]/2;
+  maxPenalty[3]=(int) -2*P->stack[2][2];
+
+  type = pair[S1[i]][S2[j]];
+  *dG+= E_ExtLoop(rtype[type], SS2[j-1] , SS1[i+1] , P);
+  *dGplex=*dG;
+
+  while (i>10 && j<=n4-9 && traced) {
+    int di1,di2,di3,di4;
+    idiff=i_pos-(n3-10-i);
+    di1 = 0.5*(access_s1[5][idiff+4] - access_s1[4][idiff+4] + access_s1[5][idiff]   - access_s1[4][idiff-1]);
+    di2 = 0.5*(access_s1[5][idiff+3] - access_s1[4][idiff+3] + access_s1[5][idiff-1] - access_s1[4][idiff-2]) + di1;
+    di3 = 0.5*(access_s1[5][idiff+2] - access_s1[4][idiff+2] + access_s1[5][idiff-2] - access_s1[4][idiff-3]) + di2;
+    di4 = 0.5*(access_s1[5][idiff+1] - access_s1[4][idiff+1] + access_s1[5][idiff-3] - access_s1[4][idiff-4]) + di3;
+/*
+    di1 = access_s1[5][idiff]   - access_s1[4][idiff-1];
+    di2 = access_s1[5][idiff-1] - access_s1[4][idiff-2] + di1;
+    di3 = access_s1[5][idiff-2] - access_s1[4][idiff-3] + di2;
+    di4 = access_s1[5][idiff-3] - access_s1[4][idiff-4] + di3;
+    di1=MIN2(di1,maxPenalty[0]);
+    di2=MIN2(di2,maxPenalty[1]);
+    di3=MIN2(di3,maxPenalty[2]);
+    di4=MIN2(di4,maxPenalty[3]);
+*/
+    int dj1,dj2,dj3,dj4;
+    jdiff=j_pos+j-11;
+    dj1=0.5*(access_s2[5][jdiff+4] - access_s2[4][jdiff+4] + access_s2[5][jdiff]  -access_s2[4][jdiff-1]  );
+    dj2=0.5*(access_s2[5][jdiff+5] - access_s2[4][jdiff+5] + access_s2[5][jdiff+1]-access_s2[4][jdiff]  ) + dj1;
+    dj3=0.5*(access_s2[5][jdiff+6] - access_s2[4][jdiff+6] + access_s2[5][jdiff+2]-access_s2[4][jdiff+1]) + dj2;
+    dj4=0.5*(access_s2[5][jdiff+7] - access_s2[4][jdiff+7] + access_s2[5][jdiff+3]-access_s2[4][jdiff+2]) + dj3;
+
+
+
+/*
+    dj1 = access_s2[5][jdiff+4] - access_s2[4][jdiff+4];
+    dj2 = access_s2[5][jdiff+5] - access_s2[4][jdiff+5] + dj1;
+    dj3 = access_s2[5][jdiff+6] - access_s2[4][jdiff+6] + dj2;
+    dj4 = access_s2[5][jdiff+7] - access_s2[4][jdiff+7] + dj3;
+    dj1=MIN2(dj1,maxPenalty[0]);
+    dj2=MIN2(dj2,maxPenalty[1]);
+    dj3=MIN2(dj3,maxPenalty[2]);
+    dj4=MIN2(dj4,maxPenalty[3]);
+*/
+    traced=0;
+    switch(state){
+    case 1:
+      type = pair[S1[i]][S2[j]];
+      int bAU;
+      bAU=(type>2?P->TerminalAU:0);
+      if(!type) vrna_message_error("backtrack failed in fold duplex");
+      type2=pair[S1[i-1]][S2[j+1]];
+      if(type2 && c[i][j]== (c[i - 1][j+1]+P->stack[rtype[type]][type2]+di1+dj1)){
+        k=i-1;
+        l=j+1;
+        (*dG)+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGplex+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di1;
+        *dGy+=dj1;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2=pair[S1[i-1]][S2[j+2]];
+      if(type2 && c[i][j]==(c[i - 1][j+2]+P->bulge[1]+P->stack[rtype[type]][type2]+di1+dj2)){
+        k=i-1;
+        l=j+2;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGplex+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di1;
+        *dGy+=dj2;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2=pair[S1[i-2]][S2[j+1]];
+      if(type2 && c[i][j]==(c[i - 2][j+1]+P->bulge[1]+P->stack[type2][rtype[type]]+di2+dj1)){
+        k=i-2;
+        l=j+1;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGplex+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di2;
+        *dGy+=dj1;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2=pair[S1[i-2]][S2[j+2]];
+      if(type2 && c[i][j]==(c[i - 2][j+2]+P->int11[type2][rtype[type]][SS1[i-1]][SS2[j+1]]+di2+dj2)){
+        k=i-2;
+        l=j+2;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGplex+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di2;
+        *dGy+=dj2;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2 = pair[S1[i-3]][S2[j+3]];
+      if(type2 && c[i][j]==(c[i - 3][j+3]+P->int22[type2][rtype[type]][SS1[i-2]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+di3+dj3)){
+        k=i-3;
+        l=j+3;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGplex+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di3;
+        *dGy+=dj3;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2 = pair[S1[i-3]][S2[j+2]];
+      if(type2 && c[i][j]==(c[i - 3][j+2]+P->int21[rtype[type]][type2][SS2[j+1]][SS1[i-2]][SS1[i-1]]+di3+dj2)){
+        k=i-3;
+        l=j+2;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGplex+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di3;
+        *dGy+=dj2;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2 = pair[S1[i-2]][S2[j+3]];
+      if(type2 && c[i][j]==(c[i - 2][j+3]+P->int21[type2][rtype[type]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+di2+dj3)){
+        k=i-2;
+        l=j+3;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGplex+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di2;
+        *dGy+=dj3;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2 = pair[S1[i-4]][S2[j+3]];
+      if(type2 && c[i][j]==(c[i - 4][j+3]+P->internal_loop[5]+P->ninio[2]+
+                            P->mismatch23I[type2][SS1[i-3]][SS2[j+2]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+di4+dj3)){
+        k=i-4;
+        l=j+3;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGplex+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di2;
+        *dGy+=dj3;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2 = pair[S1[i-3]][S2[j+4]];
+      if(type2 && c[i][j]==(c[i - 3][j+4]+P->internal_loop[5]+P->ninio[2]+
+                            P->mismatch23I[type2][SS1[i-2]][SS2[j+3]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+di3+dj4)){
+        k=i-3;
+        l=j+4;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGplex+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di2;
+        *dGy+=dj3;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(in[i - 3][j+3]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+di3+dj3+2*iext_s)){
+        k=i;
+        l=j;
+        *dGplex+=P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+2*iext_s;
+        *dGx+=di3;
+        *dGy+=dj3;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-3;
+        j=j+3;
+        state=2;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(in[i - 4][j+2]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+di4+dj2+iext_s+2*iext_ass)){
+        k=i;
+        l=j;
+        *dGplex+=P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass;
+        *dGx+=di4;
+        *dGy+=dj2;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-4;
+        j=j+2;
+        state=2;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(in[i - 2][j+4]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+di2+dj4+iext_s+2*iext_ass)){
+        k=i;
+        l=j;
+        *dGplex+=P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass;
+        *dGx+=di2;
+        *dGy+=dj4;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-2;
+        j=j+4;
+        state=2;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(inx[i - 3][j+1]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+di3+dj1)){
+        k=i;
+        l=j;
+        *dGplex+=P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+di3+dj1;
+        *dGx+=di3;
+        *dGy+=dj1;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-3;
+        j=j+1;
+        state=5;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(iny[i - 1][j+3]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+di1+dj3)){
+        k=i;
+        l=j;
+        *dGplex+=P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+di1+dj3;
+        *dGx+=di1;
+        *dGy+=dj3;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-1;
+        j=j+3;
+        state=6;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(bx[i - 2][j+1]+di2+dj1+bext+bAU)){
+        k=i;
+        l=j;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        *dGplex+=bext+bAU;
+        *dGx+=di2;
+        *dGy+=dj1;
+        i=i-2;
+        j=j+1;
+        state=3;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(by[i - 1][j+2]+di1+dj2+bext+bAU)){
+        k=i;
+        l=j;
+        *dGplex+=bext+bAU;
+        *dGx+=di1;
+        *dGy+=dj2;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-1;
+        j=j+2;
+        state=4;
+        traced=1;
+        break;
+      }
+      break;
+    case 2:
+      if(in[i][j]==(in[i - 1][j+1]+iext_s + di1 + dj1)){
+        i--;
+        j++;
+        *dGplex+=iext_s;
+        *dGx+=di1;
+        *dGy+=dj1;
+        state=2;
+        traced=1;
+        break;
+      }
+      if(in[i][j]==(in[i - 1][j]+iext_ass + di1)){
+        i=i-1;
+        *dGplex+=iext_ass;
+        *dGx+=di1;
+        state=2;
+        traced=1;
+        break;
+      }
+      if(in[i][j]==(in[i][j+1]+iext_ass + dj1)){
+        j++;
+        state=2;
+        *dGy+=dj1;
+        *dGplex+=iext_ass;
+        traced=1;
+        break;
+      }
+      type2=pair[SS2[j+1]][SS1[i-1]];
+      if(type2 && in[i][j]==(c[i - 1][j+1]+P->mismatchI[type2][SS2[j]][SS1[i]]+iopen+iext_s + di1 +dj1)){
+        *dGplex+=P->mismatchI[type2][SS2[j]][SS1[i]]+iopen+iext_s;
+        int temp; temp=k; k=i-1; i=temp;
+        temp=l; l=j+1; j=temp;
+        type=pair[S1[i]][S2[j]];
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di1;
+        *dGy+=dj1;
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+    case 3:
+      if(bx[i][j]==(bx[i - 1][j]+bext+di1)){
+        i--;
+        *dGplex+=bext;
+        *dGx+=di1;
+        state=3;
+        traced=1;
+        break;
+      }
+      type2=pair[S2[j]][S1[i-1]];
+      if(type2 && bx[i][j]==(c[i - 1][j]+bopen+bext+(type2>2?P->TerminalAU:0)+di1)){
+        int temp; temp=k; k=i-1; i=temp;
+        temp=l; l=j; j=temp;
+        type=pair[S1[i]][S2[j]];
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGplex+=bopen+bext+(type2>2?P->TerminalAU:0);
+        *dGx+=di1;
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+    case 4:
+      if(by[i][j]==(by[i][j+1] + bext +dj1)){
+        j++;
+        *dGplex+=bext;
+        state=4;
+        traced=1;
+        break;
+      }
+      type2=pair[S2[j+1]][S1[i]];
+      if(type2 && by[i][j]==(c[i][j+1]+bopen+bext+(type2>2?P->TerminalAU:0) + dj1)){
+        int temp; temp=k; k=i; i=temp;
+        temp=l; l=j+1; j=temp;
+        type=pair[S1[i]][S2[j]];
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGplex+=bopen+bext+(type2>2?P->TerminalAU:0);
+        *dGy+=dj1;
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+    case 5:
+      if(inx[i][j]==(inx[i-1][j]+iext_ass+di1)) {
+        i--;
+        *dGplex+=iext_ass;
+        *dGx+=di1;
+        state=5;
+        traced=1;
+        break;
+      }
+      type2=pair[S2[j+1]][S1[i-1]];
+      if(type2 && inx[i][j]==(c[i-1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s+di1+dj1)){
+        *dGplex+=P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s;
+        int temp; temp=k; k=i-1; i=temp;
+        temp=l; l=j+1; j=temp;
+        type=pair[S1[i]][S2[j]];
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di1;
+        *dGy+=dj1;
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+    case 6:
+      if(iny[i][j]==(iny[i][j+1]+iext_ass+dj1)) {
+        j++;
+        *dGplex+=iext_ass;
+        *dGx+=dj1;
+        state=6;
+        traced=1;
+        break;
+      }
+      type2=pair[S2[j+1]][S1[i-1]];
+      if(type2 && iny[i][j]==(c[i-1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s+di1+dj1)){
+        *dGplex+=P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s;
+        int temp; temp=k; k=i-1; i=temp;
+        temp=l; l=j+1; j=temp;
+        type=pair[S1[i]][S2[j]];
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        *dGx+=di1;
+        *dGy+=dj1;
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+    }
+  }
+  if (!traced) {
+    idiff=i_pos-(n3-10-i);
+    jdiff=j_pos+j-11;
+    E=c[i][j];
+    /**
+    *** if (i>1) {E -= P->dangle5[type][SS1[i-1]]; *dG+=P->dangle5[type][SS1[i-1]];*dGplex+=P->dangle5[type][SS1[i-1]];}
+    *** if (j<n4){E -= P->dangle3[type][SS2[j+1]]; *dG+=P->dangle3[type][SS2[j+1]];*dGplex+=P->dangle3[type][SS2[j+1]];}
+    *** if (type>2) {E -= P->TerminalAU; *dG+=P->TerminalAU;*dGplex+=P->TerminalAU;}
+    **/
+    int correction;
+    correction = E_ExtLoop(type, (i>1) ? SS1[i-1] : -1, (j<n4) ? SS2[j+1] : -1, P);
+    *dG+=correction;
+    *dGplex+=correction;
+    E-=correction;
+
+/*
+ if (E != P->DuplexInit+access_s1[1][idiff]+access_s2[1][jdiff]) {
+      vrna_message_error("backtrack failed in second fold duplex");
+    }
+*/
+    if (E != P->DuplexInit) {
+      vrna_message_error("backtrack failed in second fold duplex");
+    }
+    else{
+      *dG+=P->DuplexInit;
+      *dGplex+=P->DuplexInit;
+      *dGx+=0;/* access_s1[1][idiff]; */
+      *dGy+=0;/* access_s2[1][jdiff]; */
+      st1[i-1]='(';
+      st2[j-1]=')';
+    }
+  }
+  if (i>11)  i--;
+  if (j<n4-10) j++;
+  struc = (char *) vrna_alloc(i0-i+1+j-j0+1+2);
+  for (k=MAX2(i,1); k<=i0; k++) if (!st1[k-1]) st1[k-1] = '.';
+  for (k=j0; k<=j; k++) if (!st2[k-1]) st2[k-1] = '.';
+  strcpy(struc, st1+MAX2(i-1,0));
+  strcat(struc, "&");
+  strcat(struc, st2+j0-1);
+  /* printf("%s %3d,%-3d : %3d,%-3d\n", struc, i,i0,j0,j);  */
+  free(st1); free(st2);
+  return struc;
+}
+
+
+duplexT ** Lduplexfold_XS(const char *s1, const char *s2, const int **access_s1, const int **access_s2, const int threshold, const int alignment_length, const int delta, const int fast, const int il_a, const int il_b, const int b_a, const int b_b)
+{
+  /**
+  *** See variable definition in fduplexfold_XS
+  **/
+  int i, j;
+  int bopen=b_b;
+  int bext=b_a;
+  int iopen=il_b;
+  int iext_s=2*il_a;
+  int iext_ass=50+il_a;
+  int min_colonne=INF;
+  int i_length;
+  int max_pos;
+  int max_pos_j;
+  int min_j_colonne;
+  int max=INF;
+  int *position;
+  int *position_j;
+  int maxPenalty[4];
+  int **DJ;
+  /**
+  *** 1D array corresponding to the standard 2d recursion matrix
+  *** Makes the computation 20% faster
+  **/
+  int *SA;
+  vrna_md_t   md;
+  /**
+  *** variable initialization
+  **/
+  n1 = (int) strlen(s1);
+  n2 = (int) strlen(s2);
+  /**
+  *** Sequence encoding
+  **/
+
+  set_model_details(&md);
+
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    update_dfold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  encode_seqs(s1,s2);
+  /**
+  *** Position of the high score on the target and query sequence
+  **/
+  position = (int *) vrna_alloc((delta+n1+3+delta) * sizeof(int));
+  position_j= (int *) vrna_alloc((delta+n1+3+delta) * sizeof(int));
+  /**
+  *** extension penalty, computed only once, further reduce the computation time
+  **/
+  maxPenalty[0]=(int) -1*P->stack[2][2]/2;
+  maxPenalty[1]=(int) -1*P->stack[2][2];
+  maxPenalty[2]=(int) -3*P->stack[2][2]/2;
+  maxPenalty[3]=(int) -2*P->stack[2][2];
+
+  DJ=(int **) vrna_alloc(4*sizeof(int*));
+  DJ[0]=(int *) vrna_alloc(n2*sizeof(int));
+  DJ[1]=(int *) vrna_alloc(n2*sizeof(int));
+  DJ[2]=(int *) vrna_alloc(n2*sizeof(int));
+  DJ[3]=(int *) vrna_alloc(n2*sizeof(int));
+  j=n2-9;
+  while(--j>10){
+    DJ[0][j] = 0.5*(access_s2[5][j+4] - access_s2[4][j+4] + access_s2[5][j]  -access_s2[4][j-1]  );
+    DJ[1][j] = 0.5*(access_s2[5][j+5] - access_s2[4][j+5] + access_s2[5][j+1]-access_s2[4][j]  ) + DJ[0][j];
+    DJ[2][j] = 0.5*(access_s2[5][j+6] - access_s2[4][j+6] + access_s2[5][j+2]-access_s2[4][j+1]) + DJ[1][j];
+    DJ[3][j] = 0.5*(access_s2[5][j+7] - access_s2[4][j+7] + access_s2[5][j+3]-access_s2[4][j+2]) + DJ[2][j];
+/*
+    DJ[0][j] = access_s2[5][j+4] - access_s2[4][j+4]           ;
+    DJ[1][j] = access_s2[5][j+5] - access_s2[4][j+5] + DJ[0][j];
+    DJ[2][j] = access_s2[5][j+6] - access_s2[4][j+6] + DJ[1][j];
+    DJ[3][j] = access_s2[5][j+7] - access_s2[4][j+7] + DJ[2][j];
+    DJ[0][j] = MIN2(DJ[0][j],maxPenalty[0]);
+    DJ[1][j] = MIN2(DJ[1][j],maxPenalty[1]);
+    DJ[2][j] = MIN2(DJ[2][j],maxPenalty[2]);
+    DJ[3][j] = MIN2(DJ[3][j],maxPenalty[3]);
+*/
+  }
+  /**
+  *** instead of having 4 2-dim arrays we use a unique 1-dim array
+  *** The mapping 2d -> 1D is done based ont the macro
+  *** LCI(i,j,l)      ((i     )*l + j)
+  *** LINI(i,j,l)     ((i +  5)*l + j)
+  *** LBXI(i,j,l)     ((i + 10)*l + j)
+  *** LBYI(i,j,l)     ((i + 15)*l + j)
+  *** LINIX(i,j,l)    ((i + 20)*l + j)
+  *** LINIY(i,j,l)    ((i + 25)*l + j)
+  ***
+  *** SA has a length of 5 (number of columns we look back) *
+  ***                  * 6 (number of structures we look at) *
+  ***                  * length of the sequence
+  **/
+
+  SA=(int *) vrna_alloc(sizeof(int)*5*6*(n2+5));
+  for(j=n2+4;j>=0;j--) {
+    SA[(j*30)   ]=SA[(j*30)+1   ]=SA[(j*30)+2   ]=SA[(j*30)+3   ]=SA[(j*30)+4   ]=INF;
+    SA[(j*30)+5 ]=SA[(j*30)+1+5 ]=SA[(j*30)+2+5 ]=SA[(j*30)+3+5 ]=SA[(j*30)+4+5 ]=INF;
+    SA[(j*30)+10]=SA[(j*30)+1+10]=SA[(j*30)+2+10]=SA[(j*30)+3+10]=SA[(j*30)+4+10]=INF;
+    SA[(j*30)+15]=SA[(j*30)+1+15]=SA[(j*30)+2+15]=SA[(j*30)+3+15]=SA[(j*30)+4+15]=INF;
+    SA[(j*30)+20]=SA[(j*30)+1+20]=SA[(j*30)+2+20]=SA[(j*30)+3+20]=SA[(j*30)+4+20]=INF;
+    SA[(j*30)+25]=SA[(j*30)+1+25]=SA[(j*30)+2+25]=SA[(j*30)+3+25]=SA[(j*30)+4+25]=INF;
+  }
+
+  i=10 ;
+  i_length= n1 - 9  ;
+  while(i < i_length) {
+    int di1,di2,di3,di4;
+    int idx=i%5;
+    int idx_1=(i-1)%5;
+    int idx_2=(i-2)%5;
+    int idx_3=(i-3)%5;
+    int idx_4=(i-4)%5;
+    di1 = 0.5*(access_s1[5][i+4] - access_s1[4][i+4] + access_s1[5][i]   - access_s1[4][i-1]);
+    di2 = 0.5*(access_s1[5][i+3] - access_s1[4][i+3] + access_s1[5][i-1] - access_s1[4][i-2]) + di1;
+    di3 = 0.5*(access_s1[5][i+2] - access_s1[4][i+2] + access_s1[5][i-2] - access_s1[4][i-3]) + di2;
+    di4 = 0.5*(access_s1[5][i+1] - access_s1[4][i+1] + access_s1[5][i-3] - access_s1[4][i-4]) + di3;
+/*
+    di1 = access_s1[5][i]   - access_s1[4][i-1];
+    di2 = access_s1[5][i-1] - access_s1[4][i-2] + di1;
+    di3 = access_s1[5][i-2] - access_s1[4][i-3] + di2;
+    di4 = access_s1[5][i-3] - access_s1[4][i-4] + di3;
+    di1=MIN2(di1,maxPenalty[0]);
+    di2=MIN2(di2,maxPenalty[1]);
+    di3=MIN2(di3,maxPenalty[2]);
+    di4=MIN2(di4,maxPenalty[3]);
+*/
+    j=n2 - 9;
+    while (--j > 9) {
+      int dj1,dj2,dj3,dj4;
+      dj1=DJ[0][j];
+      dj2=DJ[1][j];
+      dj3=DJ[2][j];
+      dj4=DJ[3][j];
+      int type2, type,temp;
+      type  = pair[S1[i]][S2[j]];
+      /**
+      *** Start duplex
+      **/
+      /* SA[LCI(idx,j,n2)] = type ? P->DuplexInit + access_s1[1][i] + access_s2[1][j] : INF; */
+      SA[LCI(idx,j,n2)] = type ? P->DuplexInit : INF;
+      /**
+      *** update lin bx by linx liny matrix
+      **/
+      type2=pair[S2[j+1]][S1[i-1]];
+      /**
+      *** start/extend interior loop
+      **/
+      SA[LINI(idx,j,n2)]=MIN2(SA[LCI(idx_1,j+1,n2)]+P->mismatchI[type2][SS2[j]][SS1[i]]+di1+dj1+iopen+iext_s,
+                              SA[LINI(idx_1,j,n2)]+iext_ass + di1);
+
+      /**
+      *** start/extend nx1 target
+      *** use same type2 as for in
+      **/
+      SA[LINIX(idx,j,n2)]=MIN2(SA[LCI(idx_1,j+1,n2)]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+di1+dj1+iopen+iext_s,
+                               SA[LINIX(idx_1,j,n2)]+iext_ass + di1);
+      /**
+      *** start/extend 1xn target
+      *** use same type2 as for in
+      **/
+      SA[LINIY(idx,j,n2)]=MIN2(SA[LCI(idx_1,j+1,n2)]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+di1+dj1+iopen+iext_s,
+                               SA[LINIY(idx,j+1,n2)]+iext_ass + dj1);
+      /**
+      *** extend interior loop
+      **/
+      SA[LINI(idx,j,n2)]=MIN2(SA[LINI(idx,j,n2)],SA[LINI(idx,j+1,n2)]+iext_ass + dj1);
+      SA[LINI(idx,j,n2)]=MIN2(SA[LINI(idx,j,n2)],SA[LINI(idx_1,j+1,n2)]+iext_s + di1 + dj1);
+      /**
+      *** start/extend bulge target
+      **/
+      type2=pair[S2[j]][S1[i-1]];
+      SA[LBXI(idx,j,n2)]=MIN2(SA[LBXI(idx_1,j,n2)]+bext + di1, SA[LCI(idx_1,j,n2)]+bopen+bext+(type2>2?P->TerminalAU:0) + di1);
+      /**
+      *** start/extend bulge query
+      **/
+      type2=pair[S2[j+1]][S1[i]];
+      SA[LBYI(idx,j,n2)]=MIN2(SA[LBYI(idx,j+1,n2)]+bext + dj1 , SA[LCI(idx,j+1,n2)]+bopen+bext+(type2>2?P->TerminalAU:0)+ dj1);
+      /**
+      ***end update recursion
+      **/
+      if(!type){continue;}
+      /**
+      *** stack extension
+      **/
+      SA[LCI(idx,j,n2)]+= E_ExtLoop(type, SS1[i-1] , SS2[j+1], P);
+      /**
+      *** stack extension
+      **/
+      if((type2=pair[S1[i-1]][S2[j+1]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_1,j+1,n2)]+P->stack[rtype[type]][type2]+di1+dj1, SA[LCI(idx,j,n2)]);
+      /**
+      *** 1x0 / 0x1 stack extension
+      **/
+      if((type2=pair[S1[i-1]][S2[j+2]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_1,j+2,n2)]+P->bulge[1]+P->stack[rtype[type]][type2]+di1+dj2, SA[LCI(idx,j,n2)]);
+      if((type2=pair[S1[i-2]][S2[j+1]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_2,j+1,n2)]+P->bulge[1]+P->stack[type2][rtype[type]]+di2+dj1, SA[LCI(idx,j,n2)]);
+      /**
+      *** 1x1 / 2x2 stack extension
+      **/
+      if((type2=pair[S1[i-2]][S2[j+2]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_2,j+2,n2)]+P->int11[type2][rtype[type]][SS1[i-1]][SS2[j+1]]+di2+dj2, SA[LCI(idx,j,n2)]);
+      if((type2 = pair[S1[i-3]][S2[j+3]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_3,j+3,n2)]+P->int22[type2][rtype[type]][SS1[i-2]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+di3+dj3, SA[LCI(idx,j,n2)]);
+      /**
+      *** 1x2 / 2x1 stack extension
+      *** E_IntLoop(1,2,type2, rtype[type],SS1[i-1], SS2[j+2], SS1[i-1], SS2[j+1], P) corresponds to
+      *** P->int21[rtype[type]][type2][SS2[j+2]][SS1[i-1]][SS1[i-1]]
+      **/
+      if((type2 = pair[S1[i-3]][S2[j+2]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_3,j+2,n2)]+P->int21[rtype[type]][type2][SS2[j+1]][SS1[i-2]][SS1[i-1]]+di3+dj2, SA[LCI(idx,j,n2)]);
+      if((type2 = pair[S1[i-2]][S2[j+3]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_2,j+3,n2)]+P->int21[type2][rtype[type]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+di2+dj3, SA[LCI(idx,j,n2)]);
+      /**
+      *** 2x3 / 3x2 stack extension
+      **/
+      if((type2 = pair[S1[i-4]][S2[j+3]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_4,j+3,n2)]+P->internal_loop[5]+P->ninio[2]+
+                               P->mismatch23I[type2][SS1[i-3]][SS2[j+2]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+di4+dj3, SA[LCI(idx,j,n2)]);
+      if((type2 = pair[S1[i-3]][S2[j+4]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_3,j+4,n2)]+P->internal_loop[5]+P->ninio[2]+
+                               P->mismatch23I[type2][SS1[i-2]][SS2[j+3]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+di3+dj4, SA[LCI(idx,j,n2)]);
+      /**
+      *** So now we have to handle 1x3, 3x1, 3x3, and mxn m,n > 3
+      **/
+      /**
+      *** 3x3 or more
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LINI(idx_3,j+3,n2)]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+2*iext_s+di3+dj3,SA[LCI(idx,j,n2)]);
+      /**
+      *** 2xn or more
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LINI(idx_4,j+2,n2)]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+di4+dj2, SA[LCI(idx,j,n2)]);
+      /**
+      *** nx2 or more
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LINI(idx_2,j+4,n2)]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+di2+dj4, SA[LCI(idx,j,n2)]);
+      /**
+      *** nx1 n>2
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LINIX(idx_3,j+1,n2)]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+di3+dj1, SA[LCI(idx,j,n2)]);
+      /**
+      *** 1xn n>2
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LINIY(idx_1,j+3,n2)]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+dj3+di1, SA[LCI(idx,j,n2)]);
+      /**
+      *** nx0 n>1
+      **/
+      int bAU;
+      bAU=(type>2?P->TerminalAU:0);
+      SA[LCI(idx,j,n2)]=MIN2(SA[LBXI(idx_2,j+1,n2)]+di2+dj1+bext+bAU,SA[LCI(idx,j,n2)]);
+      /**
+      *** 0xn n>1
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LBYI(idx_1,j+2,n2)]+di1+dj2+bext+bAU,SA[LCI(idx,j,n2)]);
+      temp=min_colonne;
+      /**
+      *** (type>2?P->TerminalAU:0)+
+      *** P->dangle3[rtype[type]][SS1[i+1]]+
+      *** P->dangle5[rtype[type]][SS2[j-1]],
+      **/
+      /* remove this line printf("LCI %d:%d %d\t",i,j,SA[LCI(idx,j,n2)]); */
+      /* remove this line printf("LI %d:%d %d\t",i,j, SA[LINI(idx,j,n2)]); */
+      min_colonne=MIN2(SA[LCI(idx,j,n2)]+E_ExtLoop(rtype[type], SS2[j-1] , SS1[i+1] , P), min_colonne);
+
+      if(temp>min_colonne){
+        min_j_colonne=j;
+      }
+
+      /* ---------------------------------------------------------------------end update */
+    }
+    if(max>=min_colonne){
+      max=min_colonne;
+      max_pos=i;
+      max_pos_j=min_j_colonne;
+    }
+    position[i+delta]=min_colonne;min_colonne=INF;
+    position_j[i+delta]=min_j_colonne;
+    /* remove this line printf("\n"); */
+    i++;
+  }
+  /* printf("MAX: %d",max); */
+  free(S1); free(S2); free(SS1); free(SS2);free(SA);
+  if(max<threshold){
+    find_max_XS(position, position_j, delta, threshold, alignment_length, s1, s2, access_s1, access_s2, fast,il_a, il_b,b_a, b_b);
+  }
+  if(max<INF){
+    plot_max_XS(max, max_pos, max_pos_j, alignment_length, s1, s2, access_s1, access_s2,fast, il_a, il_b, b_a, b_b);
+  }
+  for (i=0; i<=3; i++) {
+    free(DJ[i]);
+  }
+  free(DJ);
+  free(position);
+  free(position_j);
+  return NULL;
+}
+
+PRIVATE void find_max_XS(const int *position, const int *position_j,const int delta, const int threshold, const int alignment_length, const char *s1, const char *s2, const int **access_s1, const int **access_s2, const int fast,const int il_a, const int il_b, const int b_a, const int b_b){
+  int pos=n1-9;
+  if(fast==1){
+    while(10 < pos--){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        int max;
+        max=position[pos+delta];
+        printf("target upper bound %d: query lower bound %d  (%5.2f) \n", pos-10, max_pos_j-10, ((double)max)/100);
+        pos=MAX2(10,pos+temp_min-delta);
+      }
+    }
+  }
+  else if(fast==2){
+    pos=n1-9;
+    while(10 < pos--){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        /* max_pos_j und pos entsprechen die realen position
+            in der erweiterten sequenz.
+           pos=1 -> position 1 in the sequence (and not 0 like in C)
+           max_pos_j -> position 1 in the sequence ( not 0 like in C)
+        */
+        int alignment_length2; alignment_length2 = MIN2(n1,n2);
+        int begin_t=MAX2(11, pos-alignment_length2+1);/* 10 */
+        int end_t  =MIN2(n1-10, pos+1);
+        int begin_q=MAX2(11, max_pos_j-1); /* 10 */
+        int end_q  =MIN2(n2-10, max_pos_j+alignment_length2-1);
+        char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2 + 20));
+        char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2 + 20));
+        strcpy(s3,"NNNNNNNNNN");strcpy(s4,"NNNNNNNNNN");
+        strncat(s3, (s1+begin_t-1),  end_t - begin_t +1);
+        strncat(s4, (s2+begin_q-1) , end_q - begin_q +1);
+        strcat(s3,"NNNNNNNNNN");strcat(s4,"NNNNNNNNNN");
+        s3[end_t -begin_t +1 +20 ]='\0';
+        s4[end_q -begin_q +1 +20]='\0';
+        duplexT test;
+        test = fduplexfold_XS(s3, s4, access_s1, access_s2, end_t, begin_q,threshold, il_a, il_b, b_a, b_b);
+        if(test.energy * 100 < threshold){
+          int l1=strchr(test.structure, '&')-test.structure;
+          printf(" %s %3d,%-3d : %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f) [%5.2f] i:%d,j:%d <%5.2f>\n", test.structure,
+                 begin_t-10+test.i-l1-10,
+                 begin_t-10+test.i-1-10,
+                 begin_q-10 + test.j-1-10 ,
+                 (begin_q -11) + test.j + (int)strlen(test.structure)-l1-2-10,
+                 test.ddG, test.energy, test.opening_backtrack_x, test.opening_backtrack_y, test.energy_backtrack,
+                 pos-10, max_pos_j-10, ((double) position[pos+delta])/100);
+          pos=MAX2(10,pos+temp_min-delta);
+          free(test.structure);
+        }
+        free(s3);free(s4);
+      }
+    }
+  }
+  else{
+    pos=n1-9;
+    while( pos-- > 10 ){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min; /* position on i */
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta]; /* position on j */
+        int begin_t=MAX2(11,pos-alignment_length);
+        int end_t  =MIN2(n1-10, pos+1);
+        int begin_q=MAX2(11,max_pos_j-1);
+        int end_q  =MIN2(n2-10,max_pos_j+alignment_length-1);
+        int i_flag;
+        int j_flag;
+        i_flag = (end_t   ==  pos+1?1:0);
+        j_flag = (begin_q == max_pos_j-1?1:0);
+        char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2));
+        char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2));
+        strncpy(s3, (s1+begin_t),  end_t - begin_t+1);
+        strncpy(s4, (s2+begin_q) , end_q - begin_q+1);
+        s3[end_t -begin_t +1 ]='\0';
+        s4[end_q -begin_q +1 ]='\0';
+        duplexT test;
+        test = duplexfold_XS(s3,s4,access_s1,access_s2,pos, max_pos_j,threshold,i_flag,j_flag);
+        if(test.energy * 100 < threshold){
+          printf("%s %3d,%-3d : %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f) i:%d,j:%d <%5.2f>\n", test.structure,
+                 test.tb,test.te,test.qb,test.qe, test.ddG, test.energy, test.dG1, test.dG2, pos-10, max_pos_j-10, ((double) position[pos+delta])/100);
+          pos=MAX2(10,pos+temp_min-delta);
+        }
+        free(s3);free(s4);
+        free(test.structure);
+      }
+    }
+  }
+}
+
+#if 0
+PRIVATE int compare(const void *sub1, const void *sub2) {
+  int d;
+  if (((duplexT *) sub1)->ddG > ((duplexT *) sub2)->ddG)
+    return 1;
+  if (((duplexT *) sub1)->ddG < ((duplexT *) sub2)->ddG)
+    return -1;
+  d = ((duplexT *) sub1)->i - ((duplexT *) sub2)->i;
+  if (d!=0) return d;
+  return  ((duplexT *) sub1)->j - ((duplexT *) sub2)->j;
+}
+#endif
+
+PRIVATE void plot_max_XS(const int max, const int max_pos, const int max_pos_j, const int alignment_length, const char *s1, const char *s2, const int ** access_s1, const int ** access_s2, const int fast,const int il_a, const int il_b, const int b_a, const int b_b)
+{
+  if(fast==1){
+    printf("target upper bound %d: query lower bound %d (%5.2f)\n", max_pos-3, max_pos_j, ((double)max)/100);
+  }
+  else if(fast==2){
+    int alignment_length2; alignment_length2 = MIN2(n1,n2);
+    int begin_t=MAX2(11, max_pos-alignment_length2+1);/* 10 */
+    int end_t  =MIN2(n1-10, max_pos+1);
+    int begin_q=MAX2(11, max_pos_j-1); /* 10 */
+    int end_q  =MIN2(n2-10, max_pos_j+alignment_length2-1);
+    char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2 + 20));
+    char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2 + 20));
+    strcpy(s3,"NNNNNNNNNN");strcpy(s4,"NNNNNNNNNN");
+    strncat(s3, (s1+begin_t-1),  end_t - begin_t +1);
+    strncat(s4, (s2+begin_q-1) , end_q - begin_q +1);
+    strcat(s3,"NNNNNNNNNN");strcat(s4,"NNNNNNNNNN");
+    s3[end_t -begin_t +1 +20 ]='\0';
+    s4[end_q -begin_q +1 +20]='\0';
+    duplexT test;
+    test = fduplexfold_XS(s3, s4, access_s1, access_s2, end_t, begin_q, INF, il_a, il_b, b_a, b_b);
+    int l1=strchr(test.structure, '&')-test.structure;
+    printf("%s %3d,%-3d : %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f) [%5.2f] i:%d,j:%d <%5.2f>\n", test.structure,
+           begin_t-10+test.i-l1-10,
+           begin_t-10+test.i-1-10,
+           begin_q-10 + test.j-1-10 ,
+           (begin_q -11) + test.j + (int)strlen(test.structure)-l1-2-10,
+           test.ddG, test.energy, test.opening_backtrack_x, test.opening_backtrack_y, test.energy_backtrack,
+           max_pos-10, max_pos_j-10, (double) max/100);
+
+    free(s3);free(s4);
+    free(test.structure);
+  }
+  else{
+    int begin_t=MAX2(11,max_pos-alignment_length);
+    int end_t  =MIN2(n1-10, max_pos+1);
+    int begin_q=MAX2(11, max_pos_j-1);
+    int end_q  =MIN2(n2-10,max_pos_j+alignment_length-1);
+    int i_flag;
+    int j_flag;
+    i_flag = (end_t   == max_pos+1?1:0);
+    j_flag = (begin_q == max_pos_j-1?1:0);
+    char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2)); /* +1 for \0 +1 for distance */
+    char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2));
+
+    strncpy(s3, (s1+begin_t-1),  end_t - begin_t+1);/* -1 to go from  */
+    strncpy(s4, (s2+begin_q-1) , end_q - begin_q+1);/* -1 to go from  */
+    s3[end_t -begin_t +1 ]='\0';/*  */
+    s4[end_q -begin_q +1 ]='\0';
+    duplexT test;
+    test = duplexfold_XS(s3,s4,access_s1,access_s2,max_pos, max_pos_j,INF,i_flag,j_flag);
+    printf("%s %3d,%-3d : %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f) i:%d,j:%d <%5.2f>\n", test.structure,
+           test.tb,test.te,test.qb,test.qe, test.ddG, test.energy, test.dG1, test.dG2, max_pos-10, max_pos_j - 10,(double) max/100);
+    free(s3);free(s4);free(test.structure);
+  }
+}
+
+
+/*---------------------------------------------------------duplexfold----------------------------------------------------------------------------------*/
+
+
+PRIVATE duplexT duplexfold(const char *s1, const char *s2, const int extension_cost) {
+  int i, j, l1, Emin=INF, i_min=0, j_min=0;
+  char *struc;
+  duplexT mfe;
+  vrna_md_t md;
+
+  n3 = (int) strlen(s1);
+  n4 = (int) strlen(s2);
+
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    update_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+
+  c = (int **) vrna_alloc(sizeof(int *) * (n3+1));
+  for (i=0; i<=n3; i++) c[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+  encode_seqs(s1, s2);
+  for (i=1; i<=n3; i++) {
+    for (j=n4; j>0; j--) {
+      int type, type2, E, k,l;
+      type = pair[S1[i]][S2[j]];
+      c[i][j] = type ? P->DuplexInit +2 * extension_cost: INF;
+      if (!type) continue;
+      /**
+      ***       if (i>1)  c[i][j] += P->dangle5[type][SS1[i-1]]+ extension_cost;
+      ***       if (j<n4) c[i][j] += P->dangle3[type][SS2[j+1]]+ extension_cost;
+      ***       if (type>2) c[i][j] += P->TerminalAU;
+      **/
+      c[i][j] += E_ExtLoop(type, (i>1) ? SS1[i-1] : -1, (j<n4) ? SS2[j+1] : -1, P);
+      for (k=i-1; k>0 && k>i-MAXLOOP-2; k--) {
+        for (l=j+1; l<=n4; l++) {
+          if (i-k+l-j-2>MAXLOOP) break;
+          type2 = pair[S1[k]][S2[l]];
+          if (!type2) continue;
+          E = E_IntLoop(i-k-1, l-j-1, type2, rtype[type],
+                        SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P)+(i-k+l-j)*extension_cost;
+          c[i][j] = MIN2(c[i][j], c[k][l]+E);
+        }
+      }
+      E = c[i][j];
+      /**
+      ***      if (i<n3) E += P->dangle3[rtype[type]][SS1[i+1]]+extension_cost;
+      ***      if (j>1)  E += P->dangle5[rtype[type]][SS2[j-1]]+extension_cost;
+      ***      if (type>2) E += P->TerminalAU;
+      ***
+      **/
+      E += E_ExtLoop(rtype[type], (j > 1) ? SS2[j-1] : -1, (i<n3) ? SS1[i+1] : -1, P);
+      if (E<Emin) {
+        Emin=E; i_min=i; j_min=j;
+      }
+    }
+  }
+  struc = backtrack(i_min, j_min, extension_cost);
+  if (i_min<n3) i_min++;
+  if (j_min>1 ) j_min--;
+  l1 = strchr(struc, '&')-struc;
+  int size;
+  size=strlen(struc)-1;
+  Emin-= size * (extension_cost);
+  mfe.i = i_min;
+  mfe.j = j_min;
+  mfe.energy = (double) Emin/100.;
+  mfe.structure = struc;
+  for (i=0; i<=n3; i++) free(c[i]);
+  free(c);
+  free(S1); free(S2); free(SS1); free(SS2);
+  return mfe;
+}
+
+PRIVATE char *backtrack(int i, int j, const int extension_cost) {
+  /* backtrack structure going backwards from i, and forwards from j
+     return structure in bracket notation with & as separator */
+  int k, l, type, type2, E, traced, i0, j0;
+  char *st1, *st2, *struc;
+
+  st1 = (char *) vrna_alloc(sizeof(char)*(n3+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n4+1));
+
+  i0=MIN2(i+1,n3); j0=MAX2(j-1,1);
+
+  while (i>0 && j<=n4) {
+    E = c[i][j]; traced=0;
+    st1[i-1] = '(';
+    st2[j-1] = ')';
+    type = pair[S1[i]][S2[j]];
+    if (!type) vrna_message_error("backtrack failed in fold duplex");
+    for (k=i-1; k>0 && k>i-MAXLOOP-2; k--) {
+      for (l=j+1; l<=n4; l++) {
+        int LE;
+        if (i-k+l-j-2>MAXLOOP) break;
+        type2 = pair[S1[k]][S2[l]];
+        if (!type2) continue;
+        LE = E_IntLoop(i-k-1, l-j-1, type2, rtype[type],
+                       SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P)+(i-k+l-j)*extension_cost;
+        if (E == c[k][l]+LE) {
+          traced=1;
+          i=k; j=l;
+          break;
+        }
+      }
+      if (traced) break;
+    }
+    if (!traced) {
+
+      E -=  E_ExtLoop(type, (i>1) ? SS1[i-1] : -1, (j<n4) ? SS2[j+1] : -1, P);
+      /**
+      ***      if (i>1) E -= P->dangle5[type][SS1[i-1]]+extension_cost;
+      ***      if (j<n4) E -= P->dangle3[type][SS2[j+1]]+extension_cost;
+      ***      if (type>2) E -= P->TerminalAU;
+      **/
+      if (E != P->DuplexInit+2*extension_cost) {
+        vrna_message_error("backtrack failed in fold duplex");
+      } else break;
+    }
+  }
+  if (i>1)  i--;
+  if (j<n4) j++;
+
+  struc = (char *) vrna_alloc(i0-i+1+j-j0+1+2);
+  for (k=MAX2(i,1); k<=i0; k++) if (!st1[k-1]) st1[k-1] = '.';
+  for (k=j0; k<=j; k++) if (!st2[k-1]) st2[k-1] = '.';
+  strcpy(struc, st1+MAX2(i-1,0));
+  strcat(struc, "&");
+  strcat(struc, st2+j0-1);
+  /* printf("%s %3d,%-3d : %3d,%-3d\n", struc, i,i0,j0,j);  */
+  free(st1); free(st2);
+  return struc;
+}
+
+PRIVATE duplexT fduplexfold(const char *s1, const char *s2, const int extension_cost,const int il_a, const int il_b, const int b_a, const int b_b) {
+  int i, j, Emin, i_min, j_min,l1;
+  duplexT mfe;
+  char *struc;
+  int bopen=b_b;
+  int bext=b_a+extension_cost;
+  int iopen=il_b;
+  int iext_s=2*(il_a+extension_cost);/* iext_s 2 nt nucleotide extension of interior loop, on i and j side */
+  int iext_ass=50+il_a+extension_cost;/* iext_ass assymetric extension of interior loop, either on i or on j side. */
+  int min_colonne=INF; /* enthaelt das maximum einer kolonne */
+  int i_length;
+  int max_pos;/* get position of the best hit */
+  int max_pos_j;
+  int temp=INF;
+  int min_j_colonne;
+  int max=INF;
+  vrna_md_t md;
+  /* FOLLOWING NEXT 4 LINE DEFINES AN ARRAY CONTAINING POSITION OF THE SUBOPT IN S1 */
+
+  n3 = (int) strlen(s1);
+  n4 = (int) strlen(s2);
+  /* delta_check is the minimal distance allowed for two hits to be accepted */
+  /* if both hits are closer, reject the smaller ( in term of position)  hits  */
+  /* i want to implement a function that, given a position in a long sequence and a small sequence, */
+  /* duplexfold them at this position and report the result at the command line */
+  /* for this i first need to rewrite backtrack in order to remove the printf functio */
+  /* END OF DEFINITION FOR NEEDED SUBOPT DATA  */
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    update_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  /*local c array initialization---------------------------------------------*/
+  c  = (int**)  vrna_alloc(sizeof(int *) * (n3+1));
+  in = (int**) vrna_alloc(sizeof(int *) * (n3+1));
+  bx = (int**) vrna_alloc(sizeof(int *) * (n3+1));
+  by = (int**) vrna_alloc(sizeof(int *) * (n3+1));
+  inx= (int**) vrna_alloc(sizeof(int *) * (n3+1));
+  iny= (int**) vrna_alloc(sizeof(int *) * (n3+1));
+  for (i=0; i<=n3; i++){
+    c[i]  = (int *) vrna_alloc(sizeof(int) * (n4+1));
+    in[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+    bx[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+    by[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+    inx[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+    iny[i] = (int *) vrna_alloc(sizeof(int) * (n4+1));
+  }
+  /*-------------------------------------------------------------------------*/
+  /*end of array initialisation----------------------------------*/
+  /*maybe int *** would be better*/
+  encode_seqs(s1,s2);
+  /* ------------------------------------------matrix initialisierung */
+  for(i=0; i<n3; i++){
+    for(j=0; j<n4; j++){
+      in[i][j]=INF;/* no in before  1 */
+      c[i][j] =INF; /* no bulge and no in before n2 */
+      bx[i][j]=INF;/* no bulge before 1 */
+      by[i][j]=INF;
+      inx[i][j]=INF;/* no bulge before 1 */
+      iny[i][j]=INF;
+    }
+  }
+
+  /*--------------------------------------------------------local array*/
+
+
+  /* -------------------------------------------------------------matrix initialisierung */
+  i=11;
+  i_length=n3-9;
+  while(i < i_length) {
+    j=n4-9;
+    min_colonne=INF;
+    while (10 < --j) {
+      int type, type2;
+      type = pair[S1[i]][S2[j]];
+      /**
+      *** Start duplex
+      **/
+      c[i][j]=type ? P->DuplexInit + 2*extension_cost : INF;
+      /**
+      *** update lin bx by linx liny matrix
+      **/
+      type2=pair[S2[j+1]][S1[i-1]];
+      /**
+      *** start/extend interior loop
+      **/
+      in[i][j]=MIN2(c[i - 1][j+1]+P->mismatchI[type2][SS2[j]][SS1[i]]+iopen+iext_s, in[i - 1][j]+iext_ass);
+      /**
+      *** start/extend nx1 target
+      *** use same type2 as for in
+      **/
+      inx[i][j]=MIN2(c[i-1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s,
+                     inx[i-1][j]+iext_ass);
+      /**
+      *** start/extend 1xn target
+      *** use same type2 as for in
+      **/
+      iny[i][j]=MIN2(c[i-1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s,
+                     iny[i][j+1]+iext_ass);
+      /**
+      *** extend interior loop
+      **/
+      in[i][j]=MIN2(in[i][j],in[i][j+1]+iext_ass);
+      in[i][j]=MIN2(in[i][j],in[i - 1][j+1]+iext_s);
+      /**
+      *** start/extend bulge target
+      **/
+      type2=pair[S2[j]][S1[i-1]];
+      bx[i][j]=MIN2(bx[i - 1][j]+bext, c[i - 1][j]+bopen+bext+(type2>2?P->TerminalAU:0));
+      /**
+      *** start/extend bulge query
+      **/
+      type2=pair[S2[j+1]][S1[i]];
+      by[i][j]=MIN2(by[i][j+1]+bext, c[i][j+1]+bopen+bext+(type2>2?P->TerminalAU:0));
+      /**
+      ***end update recursion
+      ***######################## Start stack extension##############################
+      **/
+      if(!type){continue;}
+      c[i][j]+=E_ExtLoop(type, SS1[i-1] , SS2[j+1], P) + 2*extension_cost;
+      /**
+      *** stack extension
+      **/
+      if((type2=pair[S1[i-1]][S2[j+1]]))
+        c[i][j]=MIN2(c[i - 1][j+1]+P->stack[rtype[type]][type2]+2*extension_cost, c[i][j]);
+      /**
+      *** 1x0 / 0x1 stack extension
+      **/
+      type2=pair[S1[i-1]][S2[j+2]];
+      c[i][j]=MIN2(c[i - 1][j+2]+P->bulge[1]+P->stack[rtype[type]][type2]+3*extension_cost,c[i][j]);
+      type2=pair[S1[i-2]][S2[j+1]];
+      c[i][j]=MIN2(c[i - 2][j+1]+P->bulge[1]+P->stack[type2][rtype[type]]+3*extension_cost,c[i][j]);
+      /**
+      *** 1x1 / 2x2 stack extension
+      **/
+      type2=pair[S1[i-2]][S2[j+2]];
+      c[i][j]=MIN2(c[i - 2][j+2]+P->int11[type2][rtype[type]][SS1[i-1]][SS2[j+1]]+4*extension_cost, c[i][j]);
+      type2 = pair[S1[i-3]][S2[j+3]];
+      c[i][j]=MIN2(c[i - 3][j+3]+P->int22[type2][rtype[type]][SS1[i-2]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+6*extension_cost,c[i][j]);
+      /**
+      *** 1x2 / 2x1 stack extension
+      *** E_IntLoop(1,2,type2, rtype[type],SS1[i-1], SS2[j+2], SS1[i-1], SS2[j+1], P) corresponds to
+      *** P->int21[rtype[type]][type2][SS2[j+2]][SS1[i-1]][SS1[i-1]]
+      **/
+      type2 = pair[S1[i-3]][S2[j+2]];
+      c[i][j]=MIN2(c[i - 3][j+2]+P->int21[rtype[type]][type2][SS2[j+1]][SS1[i-2]][SS1[i-1]]+5*extension_cost, c[i][j]);
+      type2 = pair[S1[i-2]][S2[j+3]];
+      c[i][j]=MIN2(c[i - 2][j+3]+P->int21[type2][rtype[type]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+5*extension_cost, c[i][j]);
+
+      /**
+      *** 2x3 / 3x2 stack extension
+      **/
+      if((type2 = pair[S1[i-4]][S2[j+3]]))
+        c[i][j]=MIN2(c[i - 4][j+3]+P->internal_loop[5]+P->ninio[2]+
+                     P->mismatch23I[type2][SS1[i-3]][SS2[j+2]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+7*extension_cost, c[i][j]);
+      if((type2 = pair[S1[i-3]][S2[j+4]]))
+        c[i][j]=MIN2(c[i - 3][j+4]+P->internal_loop[5]+P->ninio[2]+
+                     P->mismatch23I[type2][SS1[i-2]][SS2[j+3]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+7*extension_cost, c[i][j]);
+      /**
+      *** So now we have to handle 1x3, 3x1, 3x3, and mxn m,n > 3
+      **/
+      /**
+      *** 3x3 or more
+      **/
+      c[i][j]=MIN2(in[i - 3][j+3]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+2*iext_s+2*extension_cost, c[i][j]);
+      /**
+      *** 2xn or more
+      **/
+      c[i][j]=MIN2(in[i - 4][j+2]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+2*extension_cost, c[i][j]);
+      /**
+      *** nx2 or more
+      **/
+      c[i][j]=MIN2(in[i - 2][j+4]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+2*extension_cost, c[i][j]);
+      /**
+      *** nx1 n>2
+      **/
+      c[i][j]=MIN2(inx[i - 3][j+1]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+2*extension_cost, c[i][j]);
+      /**
+      *** 1xn n>2
+      **/
+      c[i][j]=MIN2(iny[i - 1][j+3]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+2*extension_cost, c[i][j]);
+      /**
+      *** nx0 n>1
+      **/
+      int bAU;
+      bAU=(type>2?P->TerminalAU:0);
+      c[i][j]=MIN2(bx[i - 2][j+1]+2*extension_cost+bext+bAU, c[i][j]);
+      /**
+      *** 0xn n>1
+      **/
+      c[i][j]=MIN2(by[i - 1][j+2]+2*extension_cost+bext+bAU, c[i][j]);
+      temp=min_colonne;
+      min_colonne=MIN2(c[i][j]+E_ExtLoop(rtype[type], SS2[j-1] , SS1[i+1] , P) + 2*extension_cost, min_colonne);
+      if(temp>min_colonne){
+        min_j_colonne=j;
+      }
+      /* ---------------------------------------------------------------------end update */
+    }
+    if(max>=min_colonne){
+      max=min_colonne;
+      max_pos=i;
+      max_pos_j=min_j_colonne;
+    }
+    i++;
+  }
+  Emin=max;
+  i_min=max_pos;
+  j_min=max_pos_j;
+  int dGe;
+  dGe=0;
+  struc = fbacktrack(i_min, j_min, extension_cost, il_a, il_b, b_a, b_b,&dGe);
+  if (i_min<n3-10) i_min++;
+  if (j_min>11 ) j_min--;
+  l1 = strchr(struc, '&')-struc;
+  int size;
+  size=strlen(struc)-1;
+  Emin-= size * (extension_cost);
+  mfe.i = i_min;
+  mfe.j = j_min;
+  mfe.energy = (double) Emin/100.;
+  mfe.energy_backtrack = (double) dGe/100.;
+  mfe.structure = struc;
+  free(S1); free(S2); free(SS1); free(SS2);
+  for (i=0; i<=n3; i++) {
+    free(c[i]);
+    free(in[i]);
+    free(bx[i]);
+    free(by[i]);
+    free(inx[i]);
+    free(iny[i]);
+  }
+  free(c);free(in);free(bx);free(by);free(inx);free(iny);
+  return mfe;
+}
+
+
+PRIVATE char *fbacktrack(int i, int j, const int extension_cost,const int il_a, const int il_b, const int b_a, const int b_b, int *dG) {
+  /* backtrack structure going backwards from i, and forwards from j
+     return structure in bracket notation with & as separator */
+  int k, l, type, type2, E, traced, i0, j0;
+  char *st1, *st2, *struc;
+  int bopen=b_b;
+  int bext=b_a+extension_cost;
+  int iopen=il_b;
+  int iext_s=2*(il_a+extension_cost);/* iext_s 2 nt nucleotide extension of interior loop, on i and j side */
+  int iext_ass=50+il_a+extension_cost;/* iext_ass assymetric extension of interior loop, either on i or on j side. */
+  st1 = (char *) vrna_alloc(sizeof(char)*(n3+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n4+1));
+  i0=MIN2(i+1,n3-10); j0=MAX2(j-1,11);
+  int state;
+  state=1; /* we start backtracking from a a pair , i.e. c-matrix */
+  /* state 1 -> base pair, c
+     state 2 -> interior loop, in
+     state 3 -> bx loop, bx
+     state 4 -> by loop, by
+  */
+  traced=1;
+  k=i;l=j;
+  type=pair[S1[i]][S2[j]];
+  *dG+=E_ExtLoop(rtype[type], SS2[j-1] , SS1[i+1] , P);
+  /*     (type>2?P->TerminalAU:0)+P->dangle3[rtype[type]][SS1[i+1]]+P->dangle5[rtype[type]][SS2[j-1]]; */
+  while (i>10 && j<=n4-9 && traced) {
+    traced=0;
+    switch(state){
+    case 1:
+      type = pair[S1[i]][S2[j]];
+      int bAU;
+      bAU=(type>2?P->TerminalAU:0);
+      if(!type) vrna_message_error("backtrack failed in fold duplex");
+      type2=pair[S1[i-1]][S2[j+1]];
+      if(type2 && c[i][j]== (c[i - 1][j+1]+P->stack[rtype[type]][type2]+2*extension_cost)){
+        k=i-1;
+        l=j+1;
+        (*dG)+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2=pair[S1[i-1]][S2[j+2]];
+      if(type2 && c[i][j]==(c[i - 1][j+2]+P->bulge[1]+P->stack[rtype[type]][type2]+3*extension_cost)){
+        k=i-1;
+        l=j+2;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2=pair[S1[i-2]][S2[j+1]];
+      if(type2 && c[i][j]==(c[i - 2][j+1]+P->bulge[1]+P->stack[type2][rtype[type]]+3*extension_cost)){
+        k=i-2;
+        l=j+1;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2=pair[S1[i-2]][S2[j+2]];
+      if(type2 && c[i][j]==(c[i - 2][j+2]+P->int11[type2][rtype[type]][SS1[i-1]][SS2[j+1]]+4*extension_cost)){
+        k=i-2;
+        l=j+2;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2 = pair[S1[i-3]][S2[j+3]];
+      if(type2 && c[i][j]==(c[i - 3][j+3]+P->int22[type2][rtype[type]][SS1[i-2]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+6*extension_cost)){
+        k=i-3;
+        l=j+3;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2 = pair[S1[i-3]][S2[j+2]];
+      if(type2 && c[i][j]==(c[i - 3][j+2]+P->int21[rtype[type]][type2][SS2[j+1]][SS1[i-2]][SS1[i-1]]+5*extension_cost)){
+        k=i-3;
+        l=j+2;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2 = pair[S1[i-2]][S2[j+3]];
+      if(type2 && c[i][j]==(c[i - 2][j+3]+P->int21[type2][rtype[type]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+5*extension_cost)){
+        k=i-2;
+        l=j+3;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2 = pair[S1[i-4]][S2[j+3]];
+      if(type2 && c[i][j]==(c[i - 4][j+3]+P->internal_loop[5]+P->ninio[2]+
+                            P->mismatch23I[type2][SS1[i-3]][SS2[j+2]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+7*extension_cost)){
+        k=i-4;
+        l=j+3;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      type2 = pair[S1[i-3]][S2[j+4]];
+      if(type2 && c[i][j]==(c[i - 3][j+4]+P->internal_loop[5]+P->ninio[2]+
+                            P->mismatch23I[type2][SS1[i-2]][SS2[j+3]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+7*extension_cost)){
+        k=i-3;
+        l=j+4;
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(in[i - 3][j+3]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+2*extension_cost+2*iext_s)){
+        k=i;
+        l=j;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-3;
+        j=j+3;
+        state=2;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(in[i - 4][j+2]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+2*extension_cost)){
+        k=i;
+        l=j;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-4;
+        j=j+2;
+        state=2;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(in[i - 2][j+4]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+2*extension_cost)){
+        k=i;
+        l=j;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-2;
+        j=j+4;
+        state=2;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(inx[i - 3][j+1]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+2*extension_cost)){
+        k=i;
+        l=j;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-3;
+        j=j+1;
+        state=5;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(iny[i - 1][j+3]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+2*extension_cost)){
+        k=i;
+        l=j;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-1;
+        j=j+3;
+        state=6;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(bx[i - 2][j+1]+2*extension_cost+bext+bAU)){
+        k=i;
+        l=j;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-2;
+        j=j+1;
+        state=3;
+        traced=1;
+        break;
+      }
+      if(c[i][j]==(by[i - 1][j+2]+2*extension_cost+bext+bAU)){
+        k=i;
+        l=j;
+        st1[i-1] = '(';
+        st2[j-1] = ')';
+        i=i-1;
+        j=j+2;
+        state=4;
+        traced=1;
+        break;
+      }
+      break;
+    case 2:
+      if(in[i][j]==(in[i - 1][j+1]+iext_s)){
+        i--;
+        j++;
+        state=2;
+        traced=1;
+        break;
+      }
+      if(in[i][j]==(in[i - 1][j]+iext_ass)){
+        i=i-1;
+        state=2;
+        traced=1;
+        break;
+      }
+      if(in[i][j]==(in[i][j+1]+iext_ass)){
+        j++;
+        state=2;
+        traced=1;
+        break;
+      }
+      type2=pair[S2[j+1]][S1[i-1]];
+      if(type2 && in[i][j]==(c[i - 1][j+1]+P->mismatchI[type2][SS2[j]][SS1[i]]+iopen+iext_s)){
+        int temp; temp=k; k=i-1; i=temp;
+        temp=l; l=j+1; j=temp;
+        type=pair[S1[i]][S2[j]];
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+    case 3:
+      if(bx[i][j]==(bx[i - 1][j]+bext)){
+        i--;
+        state=3;
+        traced=1;
+        break;
+      }
+      type2=pair[S2[j]][S1[i-1]];
+      if(type2 && bx[i][j]==(c[i - 1][j]+bopen+bext+(type2>2?P->TerminalAU:0))){
+        int temp; temp=k; k=i-1; i=temp;
+        temp=l; l=j; j=temp;
+        type=pair[S1[i]][S2[j]];
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+    case 4:
+      if(by[i][j]==(by[i][j+1] + bext)){
+        j++;
+
+        state=4;
+        traced=1;
+        break;
+      }
+      type2=pair[S2[j+1]][S1[i]];
+      if(type2 && by[i][j]==(c[i][j+1]+bopen+bext+(type2>2?P->TerminalAU:0))){
+        int temp; temp=k; k=i; i=temp;
+        temp=l; l=j+1; j=temp;
+        type=pair[S1[i]][S2[j]];
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+    case 5:
+      if(inx[i][j]==(inx[i-1][j]+iext_ass)) {
+        i--;
+        state=5;
+        traced=1;
+        break;
+      }
+      type2=pair[S2[j+1]][S1[i-1]];
+      if(type2 && inx[i][j]==(c[i-1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s)){
+        int temp; temp=k; k=i-1; i=temp;
+        temp=l; l=j+1; j=temp;
+        type=pair[S1[i]][S2[j]];
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+    case 6:
+      if(iny[i][j]==(iny[i][j+1]+iext_ass)) {
+        j++;
+        state=6;
+        traced=1;
+        break;
+      }
+      type2=pair[S2[j+1]][S1[i-1]];
+      if(type2 && iny[i][j]==(c[i-1][j+1]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s)){
+        int temp; temp=k; k=i-1; i=temp;
+        temp=l; l=j+1; j=temp;
+        type=pair[S1[i]][S2[j]];
+        *dG+=E_IntLoop(i-k-1, l-j-1, type2, rtype[type],SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+        i=k;
+        j=l;
+        state=1;
+        traced=1;
+        break;
+      }
+    }
+  }
+  if (!traced) {
+    E=c[i][j];
+    /**
+    ***    if (i>1) {E -= P->dangle5[type][SS1[i-1]]+extension_cost; *dG+=P->dangle5[type][SS1[i-1]];}
+    ***    if (j<n4){E -= P->dangle3[type][SS2[j+1]]+extension_cost; *dG+=P->dangle3[type][SS2[j+1]];}
+    ***    if (type>2) {E -= P->TerminalAU; *dG+=P->TerminalAU;}
+    **/
+    int correction;
+    correction = E_ExtLoop(type, (i>1) ? SS1[i-1] : -1, (j<n4) ? SS2[j+1] : -1, P);
+    *dG+=correction;
+    E-=correction+2*extension_cost;
+    if (E != P->DuplexInit+2*extension_cost) {
+      vrna_message_error("backtrack failed in second fold duplex");
+    }
+    else{
+      *dG+=P->DuplexInit;
+      st1[i-1]='(';
+      st2[j-1]=')';
+    }
+  }
+  if (i>11)  i--;
+  if (j<n4-10) j++;
+  struc = (char *) vrna_alloc(i0-i+1+j-j0+1+2);
+  for (k=MAX2(i,1); k<=i0; k++) if (!st1[k-1]) st1[k-1] = '.';
+  for (k=j0; k<=j; k++) if (!st2[k-1]) st2[k-1] = '.';
+  strcpy(struc, st1+MAX2(i-1,0));
+  strcat(struc, "&");
+  strcat(struc, st2+j0-1);
+  /* printf("%s %3d,%-3d : %3d,%-3d\n", struc, i,i0,j0,j);  */
+  free(st1); free(st2);
+  return struc;
+}
+
+
+duplexT ** Lduplexfold(const char *s1, const char *s2, const int threshold, const int extension_cost, const int alignment_length, const int delta, const int fast, const int il_a, const int il_b, const int b_a, const int b_b)
+{
+  /**
+  *** See variable definition in fduplexfold_XS
+  **/
+  int i, j;
+  int bopen=b_b;
+  int bext=b_a+extension_cost;
+  int iopen=il_b;
+  int iext_s=2*(il_a+extension_cost);/* iext_s 2 nt nucleotide extension of interior loop, on i and j side */
+  int iext_ass=50+il_a+extension_cost;/* iext_ass assymetric extension of interior loop, either on i or on j side. */
+  int min_colonne=INF; /* enthaelt das maximum einer kolonne */
+  int i_length;
+  int max_pos;/* get position of the best hit */
+  int max_pos_j;
+  int temp=INF;
+  int min_j_colonne;
+  int max=INF;
+  int *position; /* contains the position of the hits with energy > E */
+  int *position_j;
+  /**
+  *** 1D array corresponding to the standard 2d recursion matrix
+  *** Makes the computation 20% faster
+  **/
+  int *SA;
+  vrna_md_t md;
+  
+  /**
+  *** variable initialization
+  **/
+  n1 = (int) strlen(s1);
+  n2 = (int) strlen(s2);
+  /**
+  *** Sequence encoding
+  **/
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    update_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  encode_seqs(s1,s2);
+  /**
+  *** Position of the high score on the target and query sequence
+  **/
+  position = (int *) vrna_alloc((delta+n1+3+delta) * sizeof(int));
+  position_j= (int *) vrna_alloc((delta+n1+3+delta) * sizeof(int));
+  /**
+  *** instead of having 4 2-dim arrays we use a unique 1-dim array
+  *** The mapping 2d -> 1D is done based ont the macro
+  *** LCI(i,j,l)      ((i     )*l + j)
+  *** LINI(i,j,l)     ((i +  5)*l + j)
+  *** LBXI(i,j,l)     ((i + 10)*l + j)
+  *** LBYI(i,j,l)     ((i + 15)*l + j)
+  *** LINIX(i,j,l)    ((i + 20)*l + j)
+  *** LINIY(i,j,l)    ((i + 25)*l + j)
+  ***
+  *** SA has a length of 5 (number of columns we look back) *
+  ***                  * 6 (number of structures we look at) *
+  ***                  * length of the sequence
+  **/
+  SA=(int *) vrna_alloc(sizeof(int)*5*6*(n2+5));
+  for(j=n2+4;j>=0;j--) {
+    SA[(j*30)   ]=SA[(j*30)+1   ]=SA[(j*30)+2   ]=SA[(j*30)+3   ]=SA[(j*30)+4   ]=INF;
+    SA[(j*30)+5 ]=SA[(j*30)+1+5 ]=SA[(j*30)+2+5 ]=SA[(j*30)+3+5 ]=SA[(j*30)+4+5 ]=INF;
+    SA[(j*30)+10]=SA[(j*30)+1+10]=SA[(j*30)+2+10]=SA[(j*30)+3+10]=SA[(j*30)+4+10]=INF;
+    SA[(j*30)+15]=SA[(j*30)+1+15]=SA[(j*30)+2+15]=SA[(j*30)+3+15]=SA[(j*30)+4+15]=INF;
+    SA[(j*30)+20]=SA[(j*30)+1+20]=SA[(j*30)+2+20]=SA[(j*30)+3+20]=SA[(j*30)+4+20]=INF;
+    SA[(j*30)+25]=SA[(j*30)+1+25]=SA[(j*30)+2+25]=SA[(j*30)+3+25]=SA[(j*30)+4+25]=INF;
+  }
+  i=10;
+  i_length= n1 - 9 ;
+  while(i < i_length) {
+    int idx=i%5;
+    int idx_1=(i-1)%5;
+    int idx_2=(i-2)%5;
+    int idx_3=(i-3)%5;
+    int idx_4=(i-4)%5;
+    j=n2-9;
+    while (9 < --j) {
+      int type, type2;
+      type = pair[S1[i]][S2[j]];
+      /**
+      *** Start duplex
+      **/
+      SA[LCI(idx,j,n2)]=type ? P->DuplexInit + 2*extension_cost : INF;
+      /**
+      *** update lin bx by linx liny matrix
+      **/
+      type2=pair[S2[j+1]][S1[i-1]];
+      /**
+      *** start/extend interior loop
+      **/
+      SA[LINI(idx,j,n2)]=MIN2(SA[LCI(idx_1,j+1,n2)]+P->mismatchI[type2][SS2[j]][SS1[i]]+iopen+iext_s,
+                              SA[LINI(idx_1,j,n2)]+iext_ass);
+      /**
+      *** start/extend nx1 target
+      *** use same type2 as for in
+      **/
+      SA[LINIX(idx,j,n2)]=MIN2(SA[LCI(idx_1,j+1,n2)]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s,
+                               SA[LINIX(idx_1,j,n2)]+iext_ass);
+      /**
+      *** start/extend 1xn target
+      *** use same type2 as for in
+      **/
+      SA[LINIY(idx,j,n2)]=MIN2(SA[LCI(idx_1,j+1,n2)]+P->mismatch1nI[type2][SS2[j]][SS1[i]]+iopen+iext_s,
+                               SA[LINIY(idx,j+1,n2)]+iext_ass);
+      /**
+      *** extend interior loop
+      **/
+      SA[LINI(idx,j,n2)]=MIN2(SA[LINI(idx,j,n2)],SA[LINI(idx,j+1,n2)]+iext_ass);
+      SA[LINI(idx,j,n2)]=MIN2(SA[LINI(idx,j,n2)],SA[LINI(idx_1,j+1,n2)]+iext_s);
+      /**
+      *** start/extend bulge target
+      **/
+      type2=pair[S2[j]][S1[i-1]];
+      SA[LBXI(idx,j,n2)]=MIN2(SA[LBXI(idx_1,j,n2)]+bext, SA[LCI(idx_1,j,n2)]+bopen+bext+(type2>2?P->TerminalAU:0));
+      /**
+      *** start/extend bulge query
+      **/
+      type2=pair[S2[j+1]][S1[i]];
+      SA[LBYI(idx,j,n2)]=MIN2(SA[LBYI(idx,j+1,n2)]+bext, SA[LCI(idx,j+1,n2)]+bopen+bext+(type2>2?P->TerminalAU:0));
+      /**
+      ***end update recursion
+      ***##################### Start stack extension ######################
+      **/
+      if(!type){continue;}
+      /**
+      *** stack extension
+      **/
+      SA[LCI(idx,j,n2)]+= E_ExtLoop(type, SS1[i-1] , SS2[j+1], P) + 2*extension_cost;
+      /**
+      *** stack extension
+      **/
+      if((type2=pair[S1[i-1]][S2[j+1]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_1,j+1,n2)]+P->stack[rtype[type]][type2]+2*extension_cost, SA[LCI(idx,j,n2)]);
+      /**
+      *** 1x0 / 0x1 stack extension
+      **/
+      if((type2=pair[S1[i-1]][S2[j+2]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_1,j+2,n2)]+P->bulge[1]+P->stack[rtype[type]][type2]+3*extension_cost,SA[LCI(idx,j,n2)]);
+      if((type2=pair[S1[i-2]][S2[j+1]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_2,j+1,n2)]+P->bulge[1]+P->stack[type2][rtype[type]]+3*extension_cost,SA[LCI(idx,j,n2)]);
+      /**
+      *** 1x1 / 2x2 stack extension
+      **/
+      if((type2=pair[S1[i-2]][S2[j+2]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_2,j+2,n2)]+P->int11[type2][rtype[type]][SS1[i-1]][SS2[j+1]]+4*extension_cost, SA[LCI(idx,j,n2)]);
+      if((type2 = pair[S1[i-3]][S2[j+3]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_3,j+3,n2)]+P->int22[type2][rtype[type]][SS1[i-2]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+6*extension_cost,SA[LCI(idx,j,n2)]);
+      /**
+      *** 1x2 / 2x1 stack extension
+      *** E_IntLoop(1,2,type2, rtype[type],SS1[i-1], SS2[j+2], SS1[i-1], SS2[j+1], P) corresponds to
+      *** P->int21[rtype[type]][type2][SS2[j+2]][SS1[i-1]][SS1[i-1]]
+      **/
+      if((type2 = pair[S1[i-3]][S2[j+2]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_3,j+2,n2)]+P->int21[rtype[type]][type2][SS2[j+1]][SS1[i-2]][SS1[i-1]]+5*extension_cost, SA[LCI(idx,j,n2)]);
+      if((type2 = pair[S1[i-2]][S2[j+3]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_2,j+3,n2)]+P->int21[type2][rtype[type]][SS1[i-1]][SS2[j+1]][SS2[j+2]]+5*extension_cost, SA[LCI(idx,j,n2)]);
+      /**
+      *** 2x3 / 3x2 stack extension
+      **/
+      if((type2 = pair[S1[i-4]][S2[j+3]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_4,j+3,n2)]+P->internal_loop[5]+P->ninio[2]+
+                               P->mismatch23I[type2][SS1[i-3]][SS2[j+2]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+7*extension_cost, SA[LCI(idx,j,n2)]);
+      if((type2 = pair[S1[i-3]][S2[j+4]]))
+        SA[LCI(idx,j,n2)]=MIN2(SA[LCI(idx_3,j+4,n2)]+P->internal_loop[5]+P->ninio[2]+
+                               P->mismatch23I[type2][SS1[i-2]][SS2[j+3]]+P->mismatch23I[rtype[type]][SS2[j+1]][SS1[i-1]]+7*extension_cost, SA[LCI(idx,j,n2)]);
+      /**
+      *** So now we have to handle 1x3, 3x1, 3x3, and mxn m,n > 3
+      **/
+      /**
+      *** 3x3 or more
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LINI(idx_3,j+3,n2)]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+2*iext_s+2*extension_cost,SA[LCI(idx,j,n2)]);
+      /**
+      *** 2xn or more
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LINI(idx_4,j+2,n2)]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+2*extension_cost, SA[LCI(idx,j,n2)]);
+      /**
+      *** nx2 or more
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LINI(idx_2,j+4,n2)]+P->mismatchI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_s+2*iext_ass+2*extension_cost, SA[LCI(idx,j,n2)]);
+      /**
+      *** nx1 n>2
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LINIX(idx_3,j+1,n2)]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+2*extension_cost, SA[LCI(idx,j,n2)]);
+      /**
+      *** 1xn n>2
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LINIY(idx_1,j+3,n2)]+P->mismatch1nI[rtype[type]][SS1[i-1]][SS2[j+1]]+iext_ass+iext_ass+2*extension_cost, SA[LCI(idx,j,n2)]);
+      /**
+      *** nx0 n>1
+      **/
+      int bAU;
+      bAU=(type>2?P->TerminalAU:0);
+      SA[LCI(idx,j,n2)]=MIN2(SA[LBXI(idx_2,j+1,n2)]+2*extension_cost+bext+bAU,SA[LCI(idx,j,n2)]);
+      /**
+      *** 0xn n>1
+      **/
+      SA[LCI(idx,j,n2)]=MIN2(SA[LBYI(idx_1,j+2,n2)]+2*extension_cost+bext+bAU,SA[LCI(idx,j,n2)]);
+      temp=min_colonne;
+
+      min_colonne=MIN2(SA[LCI(idx,j,n2)]+E_ExtLoop(rtype[type], SS2[j-1] , SS1[i+1] , P) + 2*extension_cost, min_colonne);
+      if(temp>min_colonne){
+        min_j_colonne=j;
+      }
+    }
+    if(max>=min_colonne){
+      max=min_colonne;
+      max_pos=i;
+      max_pos_j=min_j_colonne;
+    }
+    position[i+delta]=min_colonne;min_colonne=INF;
+    position_j[i+delta]=min_j_colonne;
+    i++;
+  }
+  /* printf("MAX: %d",max); */
+  free(S1); free(S2); free(SS1); free(SS2);
+  if(max<threshold){
+    find_max(position, position_j, delta, threshold, alignment_length, s1, s2, extension_cost, fast, il_a, il_b, b_a, b_b);
+  }
+  if(max<INF){
+    plot_max(max, max_pos, max_pos_j,alignment_length, s1, s2, extension_cost,fast, il_a, il_b, b_a, b_b);
+  }
+  free(SA);
+  free(position);
+  free(position_j);
+  return NULL;
+}
+
+
+
+
+PRIVATE void find_max(const int *position, const int *position_j,const int delta, const int threshold, const int alignment_length, const char *s1, const char *s2, const int extension_cost, const int fast,const int il_a, const int il_b, const int b_a, const int b_b){
+  int pos=n1-9;
+  if(fast==1){
+    while(10 < pos--){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        int max;
+        max=position[pos+delta];
+        printf("target upper bound %d: query lower bound %d  (%5.2f) \n", pos-10, max_pos_j-10, ((double)max)/100);
+        pos=MAX2(10,pos+temp_min-delta);
+      }
+    }
+  }
+  else if(fast==2){
+    pos=n1-9;
+    while(10 < pos--){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        /* max_pos_j und pos entsprechen die realen position
+           in der erweiterten sequenz.
+           pos=1 -> position 1 in the sequence (and not 0 like in C)
+           max_pos_j -> position 1 in the sequence ( not 0 like in C)
+        */
+        int alignment_length2; alignment_length2 = MIN2(n1,n2);
+        int begin_t=MAX2(11, pos-alignment_length2+1);/* 10 */
+        int end_t  =MIN2(n1-10, pos+1);
+        int begin_q=MAX2(11, max_pos_j-1); /* 10 */
+        int end_q  =MIN2(n2-10, max_pos_j+alignment_length2-1);
+        char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2 + 20));
+        char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2 + 20));
+        strcpy(s3,"NNNNNNNNNN");strcpy(s4,"NNNNNNNNNN");
+        strncat(s3, (s1+begin_t-1),  end_t - begin_t +1);
+        strncat(s4, (s2+begin_q-1) , end_q - begin_q +1);
+        strcat(s3,"NNNNNNNNNN");strcat(s4,"NNNNNNNNNN");
+        s3[end_t -begin_t +1 +20 ]='\0';
+        s4[end_q -begin_q +1 +20]='\0';
+        duplexT test;
+        test = fduplexfold(s3, s4, extension_cost,il_a, il_b, b_a, b_b);
+        if(test.energy * 100 < threshold){
+          int l1=strchr(test.structure, '&')-test.structure;
+          printf("%s %3d,%-3d : %3d,%-3d (%5.2f) [%5.2f]  i:%d,j:%d <%5.2f>\n", test.structure,
+                 begin_t-10+test.i-l1-10,
+                 begin_t-10+test.i-1-10,
+                 begin_q-10 + test.j-1-10 ,
+                 (begin_q -11) + test.j + (int)strlen(test.structure)-l1-2-10,
+                 test.energy,test.energy_backtrack, pos-10, max_pos_j-10, ((double) position[pos+delta])/100);
+          pos=MAX2(10,pos+temp_min-delta);
+        }
+        free(s3);free(s4);
+        free(test.structure);
+      }
+    }
+  }
+#if 0
+  else if(fast==3){
+    pos=n1-9;
+    while(10 < pos--){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        /* max_pos_j und pos entsprechen die realen position
+           in der erweiterten sequenz.
+           pos=1 -> position 1 in the sequence (and not 0 like in C)
+           max_pos_j -> position 1 in the sequence ( not 0 like in C)
+        */
+        //Here we can start the reverse recursion for the
+        //Starting from the reported pos / max_pos_j we start the recursion
+        //We have to be careful with the fact that all energies are inverted.
+
+        int alignment_length2;
+        //Select the smallest interaction length in order to define the new interaction length
+        alignment_length2 = MIN2(n1-pos + 1,max_pos_j - 1 + 1);
+        //
+        int begin_t=MAX2(11, pos-alignment_length2+1);/* 10 */
+        int end_t  =MIN2(n1-10, pos+1);
+        int begin_q=MAX2(11, max_pos_j-1); /* 10 */
+        int end_q  =MIN2(n2-10, max_pos_j+alignment_length2-1);
+        char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2 + 20));
+        char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2 + 20));
+        strcpy(s3,"NNNNNNNNNN");strcpy(s4,"NNNNNNNNNN");
+        strncat(s3, (s1+begin_t-1),  end_t - begin_t +1);
+        strncat(s4, (s2+begin_q-1) , end_q - begin_q +1);
+        strcat(s3,"NNNNNNNNNN");strcat(s4,"NNNNNNNNNN");
+        s3[end_t -begin_t +1 +20 ]='\0';
+        s4[end_q -begin_q +1 +20]='\0';
+        duplexT test;
+        test = fduplexfold(s4, s3, extension_cost,il_a, il_b, b_a, b_b);
+        if(test.energy * 100 < threshold){
+          int structureLength=strlen(test.structure);
+          int l1=strchr(test.structure, '&')-test.structure;
+          int start_t,end_t,start_q,end_q;
+
+
+          /*reverse structure string*/
+          char *reverseStructure = (char*) vrna_alloc(sizeof(char)*(structureLength+1));
+          int posStructure;
+          for(posStructure=l1+1; posStructure < structureLength; posStructure++){
+            if(test.structure[posStructure]==')'){
+              reverseStructure[posStructure-l1-1] = '(';
+            }
+            else{
+              reverseStructure[posStructure-l1-1] = test.structure[posStructure];
+            }
+          }
+          reverseStructure[structureLength-1-l1]='&';
+          for(posStructure=0; posStructure<l1; posStructure++){
+            if(test.structure[posStructure]=='('){
+              reverseStructure[structureLength+posStructure-l1] = ')';
+            }
+            else{
+              reverseStructure[structureLength+posStructure-l1] = test.structure[posStructure];
+            }
+          }
+          reverseStructure[structureLength]='\0';
+          //          l1=strchr(reverse.structure, '&')-test.structure;
+
+
+          printf("%s %3d,%-3d : %3d,%-3d (%5.2f) [%5.2f] i:%d,j:%d <%5.2f>\n", reverseStructure,
+                 begin_t-10 + test.j-1-10,
+                 (begin_t -11) + test.j + strlen(test.structure)-l1-2-10,
+                 begin_q-10+test.i-l1-10,
+                 begin_q-10+test.i-1-10,
+                 test.energy,test.energy_backtrack,pos, max_pos_j, ((double) position[pos+delta])/100);
+          pos=MAX2(10,pos+temp_min-delta);
+        }
+        free(s3);free(s4);
+        free(test.structure);
+      }
+    }
+  }
+#endif
+  else{
+    pos=n1-9;
+    while(10 < pos--){
+      int temp_min=0;
+      if(position[pos+delta]<(threshold)){
+        int search_range;
+        search_range=delta+1;
+        while(--search_range){
+          if(position[pos+delta-search_range]<=position[pos+delta-temp_min]){
+            temp_min=search_range;
+          }
+        }
+        pos-=temp_min;
+        int max_pos_j;
+        max_pos_j=position_j[pos+delta];
+        /* max_pos_j und pos entsprechen die realen position
+           in der erweiterten sequenz.
+           pos=1 -> position 1 in the sequence (and not 0 like in C)
+           max_pos_j -> position 1 in the sequence ( not 0 like in C)
+        */
+        int alignment_length2; alignment_length2 = MIN2(n1,n2);
+        int begin_t=MAX2(11, pos-alignment_length2+1);/* 10 */
+        int end_t  =MIN2(n1-10, pos+1);
+        int begin_q=MAX2(11, max_pos_j-1); /* 10 */
+        int end_q  =MIN2(n2-10, max_pos_j+alignment_length2-1);
+        char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2));
+        char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2));
+        strncpy(s3, (s1+begin_t-1),  end_t - begin_t +1);
+        strncpy(s4, (s2+begin_q-1) , end_q - begin_q +1);
+        s3[end_t -begin_t +1 ]='\0';
+        s4[end_q -begin_q +1 ]='\0';
+        duplexT test;
+        test = duplexfold(s3, s4, extension_cost);
+        if(test.energy * 100 < threshold){
+          int l1=strchr(test.structure, '&')-test.structure;
+          printf("%s %3d,%-3d : %3d,%-3d (%5.2f)  i:%d,j:%d <%5.2f>\n", test.structure,
+                 begin_t-10+test.i-l1,
+                 begin_t-10+test.i-1,
+                 begin_q-10 + test.j-1 ,
+                 (begin_q -11) + test.j + (int)strlen(test.structure)-l1-2,
+                 test.energy, pos-10, max_pos_j-10, ((double) position[pos+delta])/100);
+          pos=MAX2(10,pos+temp_min-delta);
+        }
+        free(s3);free(s4);
+        free(test.structure);
+      }
+    }
+  }
+}
+PRIVATE void plot_max(const int max, const int max_pos, const int max_pos_j, const int alignment_length, const char *s1, const char *s2, const int extension_cost, const int fast,const int il_a, const int il_b, const int b_a, const int b_b)
+{
+  if(fast==1){
+    printf("target upper bound %d: query lower bound %d (%5.2f)\n", max_pos-10, max_pos_j-10, ((double)max)/100);
+  }
+  else if(fast==2){
+    int alignment_length2; alignment_length2 = MIN2(n1,n2);
+    int begin_t=MAX2(11, max_pos-alignment_length2+1);/* 10 */
+    int end_t  =MIN2(n1-10, max_pos+1);
+    int begin_q=MAX2(11, max_pos_j-1); /* 10 */
+    int end_q  =MIN2(n2-10, max_pos_j+alignment_length2-1);
+    char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2 + 20));
+    char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2 + 20));
+    strcpy(s3,"NNNNNNNNNN");strcpy(s4,"NNNNNNNNNN");
+    strncat(s3, (s1+begin_t-1),  end_t - begin_t +1);
+    strncat(s4, (s2+begin_q-1) , end_q - begin_q +1);
+    strcat(s3,"NNNNNNNNNN");strcat(s4,"NNNNNNNNNN");
+    s3[end_t -begin_t +1 +20 ]='\0';
+    s4[end_q -begin_q +1 +20]='\0';
+    duplexT test;
+    test = fduplexfold(s3, s4, extension_cost,il_a, il_b, b_a, b_b);
+    int l1=strchr(test.structure, '&')-test.structure;
+    printf("%s %3d,%-3d : %3d,%-3d (%5.2f) [%5.2f] i:%d,j:%d <%5.2f>\n", test.structure,
+           begin_t-10+test.i-l1-10,
+           begin_t-10+test.i-1-10,
+           begin_q-10 + test.j-1-10 ,
+           (begin_q -11) + test.j + (int)strlen(test.structure)-l1-2-10,
+           test.energy, test.energy_backtrack,max_pos-10, max_pos_j-10,((double) max)/100);
+    free(s3);free(s4);free(test.structure);
+  }
+  else{
+    duplexT test;
+    int alignment_length2; alignment_length2 = MIN2(n1,n2);
+    int begin_t=MAX2(11, max_pos-alignment_length2+1);
+    int end_t  =MIN2(n1-10, max_pos+1);
+    int begin_q=MAX2(11, max_pos_j-1);
+    int end_q  =MIN2(n2-10, max_pos_j+alignment_length2-1);
+    char *s3 = (char*) vrna_alloc(sizeof(char)*(end_t - begin_t +2));
+    char *s4 = (char*) vrna_alloc(sizeof(char)*(end_q - begin_q +2));
+    strncpy(s3, (s1+begin_t-1),  end_t - begin_t + 1);
+    strncpy(s4, (s2+begin_q-1) , end_q - begin_q +1 );
+    s3[end_t -begin_t +1 ]='\0';
+    s4[end_q -begin_q +1 ]='\0';
+    test = duplexfold(s3, s4, extension_cost);
+    int l1=strchr(test.structure, '&')-test.structure;
+    printf("%s %3d,%-3d : %3d,%-3d (%5.2f) i:%d,j:%d <%5.2f>\n", test.structure,
+           begin_t-10+test.i-l1,
+           begin_t-10+test.i-1,
+           begin_q-10 +test.j-1 ,
+           (begin_q -11) + test.j + (int)strlen(test.structure)-l1-2,
+           test.energy, max_pos-10, max_pos_j -10, ((double) max)/100);
+    free(s3);free(s4);free(test.structure);
+  }
+}
+
+
+PRIVATE void update_dfold_params(void)
+{
+  vrna_md_t md;
+  if(P)
+    free(P);
+  set_model_details(&md);
+  P = vrna_params(&md);
+  make_pair_matrix();
+}
+
+PRIVATE void encode_seqs(const char *s1, const char *s2) {
+  unsigned int i,l;
+
+  l = strlen(s1);
+  S1 = encode_seq(s1);
+  SS1= (short *) vrna_alloc(sizeof(short)*(l+1));
+  /* SS1 exists only for the special X K and I bases and energy_set!=0 */
+
+  for (i=1; i<=l; i++) { /* make numerical encoding of sequence */
+    SS1[i] = alias[S1[i]];   /* for mismatches of nostandard bases */
+  }
+
+  l = strlen(s2);
+  S2 = encode_seq(s2);
+  SS2= (short *) vrna_alloc(sizeof(short)*(l+1));
+  /* SS2 exists only for the special X K and I bases and energy_set!=0 */
+
+  for (i=1; i<=l; i++) { /* make numerical encoding of sequence */
+    SS2[i] = alias[S2[i]];   /* for mismatches of nostandard bases */
+  }
+}
+
+PRIVATE short * encode_seq(const char *sequence) {
+  unsigned int i,l;
+  short *S;
+  l = strlen(sequence);
+  S = (short *) vrna_alloc(sizeof(short)*(l+2));
+  S[0] = (short) l;
+
+  /* make numerical encoding of sequence */
+  for (i=1; i<=l; i++)
+    S[i]= (short) encode_char(toupper(sequence[i-1]));
+
+  /* for circular folding add first base at position n+1 */
+  S[l+1] = S[1];
+
+  return S;
+}
+
+int arraySize(duplexT** array)
+{
+  int site_count=0;
+  while(array[site_count]!=NULL){
+    site_count++;
+  }
+  return site_count;
+}
+
+void freeDuplexT(duplexT** array)
+{
+  int size=arraySize(array);
+  while(--size){
+    free(array[size]->structure);
+    free(array[size]);
+  }
+  free(array[0]->structure);
+  free(array);
+}
diff --git a/C/ViennaRNA/plex.h b/C/ViennaRNA/plex.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/plex.h
@@ -0,0 +1,80 @@
+#ifndef VIENNA_RNA_PACKAGE_PLEX_H
+#define VIENNA_RNA_PACKAGE_PLEX_H
+
+#include <ViennaRNA/data_structures.h>
+
+
+extern int subopt_sorted;
+
+/**
+*** Lduplexfold Computes duplexes between two single sequences
+**/
+duplexT** Lduplexfold(const char *s1,
+                      const char *s2,
+                      const int threshold,
+                      const int extension_cost,
+                      const int alignment_length,
+                      const int delta,
+                      const int fast,
+                      const int il_a,
+                      const int il_b,
+                      const int b_a,
+                      const int b_b);
+
+/**
+*** Lduplexfold_XS Computes duplexes between two single sequences with accessibility
+**/
+duplexT** Lduplexfold_XS( const char*s1,
+                          const char* s2,
+                          const int **access_s1,
+                          const int **access_s2,
+                          const int threshold,
+                          const int delta,
+                          const int alignment_length,
+                          const int fast,
+                          const int il_a,
+                          const int il_b,
+                          const int b_a,
+                          const int b_b);/* , const int target_dead, const int query_dead); */
+
+/**
+*** Lduplexfold_C Computes duplexes between two single sequences and takes constraint into account
+**/
+duplexT** Lduplexfold_C(const char *s1,
+                        const char *s2,
+                        const int threshold,
+                        const int extension_cost,
+                        const int alignment_length,
+                        const int delta,
+                        const int fast,
+                        const char* structure,
+                        const int il_a,
+                        const int il_b,
+                        const int b_a,
+                        const int b_b);
+
+/**
+*** Lduplexfold_CXS Computes duplexes between two single sequences and takes constraint as well as accessibility into account
+**/
+
+duplexT** Lduplexfold_CXS(const char*s1,
+                          const char* s2,
+                          const int **access_s1,
+                          const int **access_s2,
+                          const int threshold,
+                          const int delta,
+                          const int alignment_length,
+                          const int fast,
+                          const char* structure,
+                          const int il_a,
+                          const int il_b,
+                          const int b_a,
+                          const int b_b); /*, const int target_dead, const int query_dead); */
+
+
+
+
+int      arraySize(duplexT** array);
+void     freeDuplexT(duplexT** array);
+
+#endif
diff --git a/C/ViennaRNA/plex_functions.c b/C/ViennaRNA/plex_functions.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/plex_functions.c
@@ -0,0 +1,307 @@
+/*
+           compute potentially pseudoknotted structures of an RNA sequence
+                             Ivo Hofacker
+                          Vienna RNA package
+*/
+
+/*
+  library containing the function used in PKplex
+  it generates pseudoknotted structures by letting the sequence form a duplex structure with itself
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include <time.h>
+
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/loop_energies.h"
+
+#include "ViennaRNA/pair_mat.h"
+
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/PKplex.h"
+
+#undef  MAXLOOP
+#define MAXLOOP 10
+
+PRIVATE void  update_dfold_params(void);
+PRIVATE void  duplexfold_XS(const char *s1, int **access_s1, const int threshold, const int max_interaction_length);
+PRIVATE char  *backtrack_XS(int kk, int ll, const int ii, const int jj, const int max_interaction_length);
+PRIVATE void  make_ptypes(const char *structure);
+
+PRIVATE vrna_param_t  *P = NULL;
+PRIVATE int     ***c3 = NULL;      /* energy array used in duplexfold */
+PRIVATE short   *S1 = NULL, *SS1 = NULL;
+PRIVATE int     n1;
+PRIVATE char    *ptype = NULL;     /* precomputed array of pair types */
+PRIVATE int     *indx = NULL;      /* index for moving in the triangle matrices ptype[] */
+
+PUBLIC  dupVar  *PlexHits = NULL;
+PUBLIC  int     PlexHitsArrayLength = 100;
+PUBLIC  int     NumberOfHits        = 0;
+PUBLIC  int     verbose             = 0;
+
+/*-----------------------------------------------------------------------duplexfold_XS---------------------------------------------------------------------------*/
+
+PRIVATE void  duplexfold_XS(const char *s1,
+                            int **access_s1,
+                            const int threshold,
+                            const int max_interaction_length){
+
+  int i, j, k, l, p, q, Emin=INF, l_min=0, k_min=0, j_min=0;
+  int type, type2, type3, E, tempK;
+  char *struc;
+  int length = (int) strlen(s1);
+  struc=NULL;
+
+  c3 = (int ***) vrna_alloc(sizeof(int **) * (length));
+  for (i=0; i<length; i++){
+    c3[i] = (int **) vrna_alloc(sizeof(int *) * max_interaction_length);
+    for (j=0; j<max_interaction_length; j++) {
+      c3[i][j]=(int *) vrna_alloc(sizeof(int) * max_interaction_length);
+    }
+  }
+
+  i = length - 9;
+
+  while( i-- > 11 ){
+    Emin=INF;
+    j_min=0;
+    l_min=0;
+    k_min=0;
+
+    /* init all matrix elements to INF */
+    for (j=0; j < length; j++){
+      for(k=0;k<max_interaction_length;k++){
+        for(l=0;l<max_interaction_length;l++){
+          c3[j][k][l]=INF;
+        }
+      }
+    }
+    char string[10] = {'\0'};
+    /* matrix starting values for (i,j)-basepairs */
+    for(j=i+4; j<n1-10; j++) {
+      type=ptype[indx[j]+i];
+      if (type) {
+        c3[j-11][max_interaction_length-1][0] = P->DuplexInit;
+        c3[j-11][max_interaction_length-1][0] += E_Hairpin(j-i-1, type,  SS1[i+1], SS1[j-1], string, P);
+/*        c3[j-11][max_interaction_length-1][0] += E_ExtLoop(type, SS1[i+1], SS1[j-1], P); */
+/*           c3[j-11][max_interaction_length-1][0] += E_ExtLoop(rtype[type], SS1[j-1], SS1[i+1], P); */
+       }
+    }
+
+    int i_pos_begin=MAX2(9, i-max_interaction_length); /* why 9 ??? */
+
+    /* fill matrix */
+    for(k=i-1; k>i_pos_begin; k--) {
+      tempK=max_interaction_length-i+k-1;
+      for(l = i + 5; l < n1 - 9; l++) { /* again, why 9 less then the sequence length ? */
+        type2 = ptype[indx[l] + k];
+        if(!type2) continue;
+        for(p = k + 1; (p <= i) && (p <= k + MAXLOOP + 1); p++){
+          for(q = l - 1; (q>=i+4) && (q >= l - MAXLOOP - 1); q--){
+            if (p - k + l - q - 2 > MAXLOOP) break;
+            type3 = ptype[indx[q] + p];
+            if(!type3) continue;
+            E = E_IntLoop(p - k - 1, l - q - 1, type2, rtype[type3], SS1[k + 1], SS1[l - 1], SS1[p - 1], SS1[q + 1], P);
+            for(j = MAX2(i + 4, l - max_interaction_length + 1); j <= q; j++){
+              type = ptype[indx[j]+i];
+              if (type){
+                c3[j-11][tempK][l-j] = MIN2(c3[j-11][tempK][l-j], c3[j-11][max_interaction_length-i+p-1][q-j]+E);
+              }
+            }/* next j */
+          }/* next q */
+        }/* next p */
+      }/* next l */
+    }/* next k */
+
+    /* read out matrix minimum */
+    for(j=i+4; j<n1-10; j++) {
+      type=ptype[indx[j]+i];
+      if (!type) continue;
+      int j_pos_end=MIN2(n1-9,j+max_interaction_length);
+      for (k=i-1; k>i_pos_begin; k--) {
+        for (l=j+1; l<j_pos_end; l++) {
+          type2=ptype[indx[l]+k];
+          if (!type2) continue;
+          E = c3[j-11][max_interaction_length-i+k-1][l-j];
+/*           printf("[%d,%d][%d,%d]\t%6.2f\t%6.2f\t%6.2f\n", i, k, l, j, E/100., access_s1[i-k+1][i]/100., access_s1[l-j+1][l]/100.); */
+          E+=access_s1[i-k+1][i]+access_s1[l-j+1][l];
+          E+=E_ExtLoop(type2,((k>i_pos_begin+1)? SS1[k-1]:-1),((l<j_pos_end-1)? SS1[l+1]:-1),P);
+          E+=E_ExtLoop(rtype[type], SS1[j-1], SS1[i+1], P);
+          if (E<Emin) {
+            Emin=E; k_min=k; l_min=l;
+            j_min=j;
+          }
+        }
+      }
+    }
+
+    if(Emin  < threshold){
+      struc = backtrack_XS(k_min, l_min, i, j_min, max_interaction_length);
+
+      /* lets take care of the dangles */
+      /* find best combination */
+      int dx_5, dx_3, dy_5, dy_3,dGx,dGy,bonus_x, bonus_y;
+      dx_5 = dx_3 = dy_5 = dy_3 = dGx = dGy = bonus_x = bonus_y = 0;
+      dGx = access_s1[i-k_min+1][i];
+      dGy = access_s1[l_min-j_min+1][l_min];
+      PlexHits[NumberOfHits].tb=k_min -10 -dx_5;
+      PlexHits[NumberOfHits].te=i -10 + dx_3;
+      PlexHits[NumberOfHits].qb=j_min -10 - dy_5;
+      PlexHits[NumberOfHits].qe=l_min -10 + dy_3;
+      PlexHits[NumberOfHits].ddG=(double) Emin * 0.01;
+      PlexHits[NumberOfHits].dG1=(double) dGx*0.01 ;
+      PlexHits[NumberOfHits].dG2=(double) dGy*0.01 ;
+      PlexHits[NumberOfHits].energy = PlexHits[NumberOfHits].ddG - PlexHits[NumberOfHits].dG1 - PlexHits[NumberOfHits].dG2;
+      PlexHits[NumberOfHits].structure = struc;
+
+      /* output: */
+      if(PlexHits[NumberOfHits].energy * 100 < threshold){
+        if (verbose) printf("%s %3d,%-3d : %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f)\n", PlexHits[NumberOfHits].structure, PlexHits[NumberOfHits].tb, PlexHits[NumberOfHits].te, PlexHits[NumberOfHits].qb, PlexHits[NumberOfHits].qe, PlexHits[NumberOfHits].ddG, PlexHits[NumberOfHits].energy, PlexHits[NumberOfHits].dG1, PlexHits[NumberOfHits].dG2);
+        NumberOfHits++;
+        if(NumberOfHits==PlexHitsArrayLength-1){
+          PlexHitsArrayLength*=2;
+          PlexHits = (dupVar *) vrna_realloc(PlexHits,sizeof(dupVar)*PlexHitsArrayLength);
+        }
+      }
+    }
+  }
+
+  for (i=0; i<(n1-20); i++) {
+    for (j=0; j<max_interaction_length; j++) {
+      free(c3[i][j]);
+    }
+    free(c3[i]);
+  }
+  free(c3);
+}
+
+
+PRIVATE char *backtrack_XS(int k, int l, const int i, const int j, const int max_interaction_length) {
+  /* backtrack structure going backwards from i, and forwards from j
+     return structure in bracket notation with & as separator */
+  int p, q, type, type2, E, traced, i0, j0;
+  char *st1, *st2, *struc;
+  st1 = (char *) vrna_alloc(sizeof(char)*(i-k+2));
+  st1[i-k+1]='\0';
+  st2 = (char *) vrna_alloc(sizeof(char)*(l-j+2));
+  st2[l-j+1]='\0';
+
+  i0=k; j0=l;
+  while (k<=i && l>=j) {
+    E = c3[j-11][max_interaction_length-i+k-1][l-j]; traced=0;
+    st1[k-i0] = '(';
+    st2[l-j] = ')';
+
+    type=ptype[indx[l]+k];
+    if (!type) vrna_message_error("backtrack failed in fold duplex bli");
+    for (p=k+1; p<=i; p++) {
+      for (q=l-1; q>=j; q--) {
+        int LE;
+        if (p-k+l-q-2>MAXLOOP) break;
+        type2=ptype[indx[q]+p];
+        if (!type2) continue;
+         LE = E_IntLoop(p-k-1, l-q-1, type, rtype[type2], SS1[k+1], SS1[l-1], SS1[p-1], SS1[q+1], P);
+         if (E == c3[j-11][max_interaction_length-i+p-1][q-j]+LE) {
+          traced=1;
+           k=p; l=q;
+          break;
+        }
+      }
+      if (traced) break;
+    }
+    if (!traced) {
+      E-=E_ExtLoop(type2, ((k<i)?SS1[k+1]:-1), ((l>j-1)? SS1[l-1]:-1), P);
+      break;
+      if (E != P->DuplexInit) {
+        vrna_message_error("backtrack failed in fold duplex bal");
+      } else break;
+    }
+  }
+  struc = (char *) vrna_alloc(k-i0+1+j0-l+1+2);
+
+  for (p=0; p<=i-i0; p++){
+    if (!st1[p]) st1[p] = '.';
+  }
+
+  for (p=0; p<=j0-j; p++) {
+    if (!st2[p]) {
+      st2[p] = '.';
+    }
+  }
+
+  strcpy(struc, st1);
+  strcat(struc, "&");
+  strcat(struc, st2);
+  free(st1); free(st2);
+  return struc;
+}
+
+PUBLIC  dupVar  **PKLduplexfold_XS( const char *s1,
+                                    int **access_s1,
+                                    const int threshold,
+                                    const int max_interaction_length,
+                                    const int delta){
+
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6))
+    update_dfold_params();
+
+  n1 = (int) strlen(s1);
+  S1 = encode_sequence(s1, 0);
+  SS1 = encode_sequence(s1, 1);
+
+  indx  = vrna_idx_col_wise(n1);
+  ptype = (char *) vrna_alloc(sizeof(char)*((n1*(n1+1))/2+2));
+  make_ptypes(s1);
+
+  P->DuplexInit=0;
+  duplexfold_XS(s1,access_s1,threshold, max_interaction_length);
+  free(S1); free(SS1);
+  free(indx); free(ptype);
+  return NULL;
+}
+
+/*---------------------------------UTILS------------------------------------------*/
+
+PRIVATE void update_dfold_params(void){
+  vrna_md_t md;
+  if(P)
+    free(P);
+  set_model_details(&md);
+  P = vrna_params(&md);
+  make_pair_matrix();
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void make_ptypes(const char *structure) {
+  int n,i,j,k,l;
+
+  n=S1[0];
+  for (k=1; k<n-TURN; k++)
+    for (l=1; l<=2; l++) {
+      int type,ntype=0,otype=0;
+      i=k; j = i+TURN+l; if (j>n) continue;
+      type = pair[S1[i]][S1[j]];
+      while ((i>=1)&&(j<=n)) {
+        if ((i>1)&&(j<n)) ntype = pair[S1[i-1]][S1[j+1]];
+        if (noLonelyPairs && (!otype) && (!ntype))
+          type = 0; /* i.j can only form isolated pairs */
+        ptype[indx[j]+i] = (char) type;
+        otype =  type;
+        type  = ntype;
+        i--; j++;
+      }
+    }
+}
diff --git a/C/ViennaRNA/plot_aln.c b/C/ViennaRNA/plot_aln.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/plot_aln.c
@@ -0,0 +1,600 @@
+/*
+        PostScript output for Sequence / Structure Alignments
+
+                 c  Ivo Hofacker, Peter F Stadler, Ronny Lorenz
+                          Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+#include "ViennaRNA/model.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/aln_util.h"
+#include "ViennaRNA/plot_aln.h"
+
+/*
+#################################
+# PRIVATE MACROS                #
+#################################
+*/
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+int PS_color_aln(const char *structure, const char *filename,
+                 const char *seqs[], const char *names[]) {
+  /* produce PS sequence alignment color-annotated by consensus structure */
+
+  int N,i,j,k,x,y,tmp,columnWidth;
+  char *tmpBuffer,*ssEscaped,*ruler, *cons;
+  char c;
+  float fontWidth, fontHeight, imageHeight, imageWidth,tmpColumns;
+  int length, maxName, maxNum, currPos;
+  float lineStep,blockStep,consStep,ssStep,rulerStep,nameStep,numberStep;
+  float maxConsBar,startY,namesX,seqsX, currY;
+  float score,barHeight,xx,yy;
+  int match,block;
+  FILE *outfile;
+  short *pair_table;
+  char * colorMatrix[6][3] = {
+    {"0.0 1", "0.0 0.6",  "0.0 0.2"},  /* red    */
+    {"0.16 1","0.16 0.6", "0.16 0.2"}, /* ochre  */
+    {"0.32 1","0.32 0.6", "0.32 0.2"}, /* turquoise */
+    {"0.48 1","0.48 0.6", "0.48 0.2"}, /* green  */
+    {"0.65 1","0.65 0.6", "0.65 0.2"}, /* blue   */
+    {"0.81 1","0.81 0.6", "0.81 0.2"} /* violet */
+  };
+
+  const char *alnPlotHeader =
+        "%%!PS-Adobe-3.0 EPSF-3.0\n"
+        "%%%%BoundingBox: %i %i %i %i\n"
+        "%%%%EndComments\n"
+        "%% draws Vienna RNA like colored boxes\n"
+        "/box { %% x1 y1 x2 y2 hue saturation\n"
+        "  gsave\n"
+        "  dup 0.3 mul 1 exch sub sethsbcolor\n"
+        "  exch 3 index sub exch 2 index sub rectfill\n"
+        "  grestore\n"
+        "} def\n"
+        "%% draws a box in current color\n"
+        "/box2 { %% x1 y1 x2 y2\n"
+        "  exch 3 index sub exch 2 index sub rectfill\n"
+        "} def\n"
+        "/string { %% (Text) x y\n"
+        " 6 add\n"
+        " moveto\n"
+        "  show\n"
+        "} def\n"
+        "0 %i translate\n"
+        "1 -1 scale\n"
+        "/Courier findfont\n"
+        "[10 0 0 -10 0 0] makefont setfont\n";
+
+  vrna_md_t     md;
+
+  set_model_details(&md);
+
+  outfile = fopen(filename, "w");
+
+  if (outfile == NULL) {
+    vrna_message_warning("can't open file %s - not doing alignment plot\n", filename);
+    return 0;
+  }
+
+  columnWidth=60;            /* Display long alignments in blocks of this size */
+  fontWidth=6;               /* Font metrics */
+  fontHeight=6.5;
+  lineStep=fontHeight+2;     /* distance between lines */
+  blockStep=3.5*fontHeight;  /* distance between blocks */
+  consStep=fontHeight*0.5;   /* distance between alignment and conservation curve */
+  ssStep=2;                  /* distance between secondary structure line and sequences */
+  rulerStep=2;               /* distance between sequences and ruler */
+  nameStep=3*fontWidth;             /* distance between names and sequences */
+  numberStep=fontWidth;      /* distance between sequeces and numbers */
+  maxConsBar=2.5*fontHeight; /* Height of conservation curve */
+  startY=2;                     /* "y origin" */
+  namesX=fontWidth;             /* "x origin" */
+
+  /* Number of columns of the alignment */
+  length=strlen(seqs[0]);
+
+  /* Allocate memory for various strings, length*2 is (more than)
+         enough for all of them */
+  tmpBuffer = (char *) vrna_alloc((unsigned) MAX2(length*2,columnWidth)+1);
+  ssEscaped=(char *) vrna_alloc((unsigned) length*2);
+  ruler=(char *) vrna_alloc((unsigned) length*2);
+
+  pair_table=vrna_ptable(structure);
+  /* Get length of longest name and count sequences in alignment*/
+
+  for (i=maxName=N=0; names[i] != NULL; i++) {
+    N++;
+    tmp=strlen(names[i]);
+    if (tmp>maxName)  maxName=tmp;
+  }
+
+
+  /* x-coord. where sequences start */
+  seqsX=namesX+maxName*fontWidth+nameStep;
+
+  /* calculate number of digits of the alignment length */
+  snprintf(tmpBuffer,length, "%i",length);
+  maxNum=strlen(tmpBuffer);
+
+
+  /* Calculate bounding box */
+  tmpColumns=columnWidth;
+  if (length<columnWidth){
+        tmpColumns=length;
+  }
+  imageWidth=ceil(namesX+(maxName+tmpColumns+maxNum)*fontWidth+2*nameStep+fontWidth+numberStep);
+  imageHeight=startY+ceil((float)length/columnWidth)*((N+2)*lineStep+blockStep+consStep+ssStep+rulerStep);
+
+  /* Write postscript header including correct bounding box */
+  fprintf(outfile,alnPlotHeader,0,0,(int)imageWidth,(int)imageHeight,(int)imageHeight);
+
+  /* Create ruler and secondary structure lines */
+  i=0;
+  /* Init all with dots */
+  for (i=0;i<(length);i++){
+        ruler[i]='.';
+  }
+  i=0;
+  for (i=0;i<length;i++){
+        /* Write number every 10th position, leave out block breaks */
+        if ((i+1)%10==0 && (i+1)%columnWidth!=0){
+          snprintf(tmpBuffer,length,"%i",i+1);
+          strncpy(ruler+i,tmpBuffer,strlen(tmpBuffer));
+        }
+  }
+  ruler[length]='\0';
+
+  /* Draw color annotation first */
+  /* Repeat for all pairs */
+  for (i=1; i<=length; i++) {
+    if ((j=pair_table[i])>i) {
+      /* Repeat for open and closing position */
+      for (k=0;k<2;k++){
+        int pairings, nonpair, s, col;
+        int ptype[8] = {0,0,0,0,0,0,0,0};
+        char *color;
+        col = (k==0)?i-1:j-1;
+        block=ceil((float)(col+1)/columnWidth);
+        xx=seqsX+(col-(block-1)*columnWidth)*fontWidth;
+        /* Repeat for each sequence */
+        for (s=pairings=nonpair=0; s<N; s++) {
+          ptype[md.pair[vrna_nucleotide_encode(seqs[s][i-1], &md)][vrna_nucleotide_encode(seqs[s][j-1], &md)]]++;
+        }
+        for (pairings=0,s=1; s<=7; s++) {
+          if (ptype[s]) pairings++;
+        }
+        nonpair=ptype[0];
+        if (nonpair <=2) {
+          color = colorMatrix[pairings-1][nonpair];
+          for (s=0; s<N; s++) {
+            yy=startY+(block-1)*(lineStep*(N+2)+blockStep+consStep+rulerStep)+ssStep*(block)+(s+1)*lineStep;
+
+            /* Color according due color information in pi-array, only if base pair is possible */
+            if (md.pair[vrna_nucleotide_encode(seqs[s][i-1], &md)][vrna_nucleotide_encode(seqs[s][j-1], &md)]) {
+
+              fprintf(outfile, "%.1f %.1f %.1f %.1f %s box\n",
+                      xx,yy-1,xx+fontWidth,yy+fontHeight+1,color);
+            }
+          }
+        }
+      }
+    }
+  }
+  free(pair_table);
+
+  /* Process rest of the output in blocks of columnWidth */
+
+  currY=startY;
+  currPos=0;
+
+  cons =  consensus(seqs);
+
+  while (currPos<length) {
+
+    /* Display secondary structure line */
+    fprintf(outfile,"0 setgray\n");
+    strncpy(tmpBuffer,structure+currPos,columnWidth);
+    tmpBuffer[columnWidth]='\0';
+
+    x=0;y=0;
+    while ((c=tmpBuffer[x])){
+      if (c=='.'){
+        ssEscaped[y++]='.';
+      } else {
+        ssEscaped[y++]='\\';
+        ssEscaped[y++]=c;
+      }
+      x++;
+    }
+    ssEscaped[y]='\0';
+
+    fprintf(outfile, "(%s) %.1f %.1f string\n", ssEscaped,seqsX,currY);
+    currY+=ssStep+lineStep;
+
+    /* Display names, sequences and numbers */
+
+    for (i=0; i<N; i++) {
+
+      strncpy(tmpBuffer,seqs[i]+currPos,columnWidth);
+      tmpBuffer[columnWidth]='\0';
+
+      match=0;
+      for (j=0;j<(currPos+strlen(tmpBuffer));j++){
+        if (seqs[i][j] != '-') match++;
+      }
+
+      fprintf(outfile, "(%s) %.1f %.1f string\n", names[i],namesX,currY);
+      fprintf(outfile, "(%s) %.1f %.1f string\n", tmpBuffer,seqsX,currY);
+      fprintf(outfile, "(%i) %.1f %.1f string\n", match,seqsX+fontWidth*(strlen(tmpBuffer))+numberStep,currY);
+      currY+=lineStep;
+    }
+    currY+=rulerStep;
+    strncpy(tmpBuffer,ruler+currPos,columnWidth);
+    tmpBuffer[columnWidth]='\0';
+    fprintf(outfile, "(%s) %.1f %.1f string\n", tmpBuffer,seqsX,currY);
+
+    currY+=lineStep;
+    currY+=consStep;
+
+    /*Display conservation bar*/
+
+    fprintf(outfile,"0.6 setgray\n");
+    for (i=currPos;(i<currPos+columnWidth && i<length);i++){
+      match=0;
+      for (j=0;j<N;j++){
+        if (cons[i] == seqs[j][i]) match++;
+        if (cons[i]=='U' && seqs[j][i]=='T') match++;
+        if (cons[i]=='T' && seqs[j][i]=='U') match++;
+      }
+      score=(float)(match-1)/(N-1);
+
+      if (cons[i] == '-' ||
+          cons[i] == '_' ||
+          cons[i] == '.'){
+        score=0;
+      }
+
+      barHeight=maxConsBar*score;
+      if (barHeight==0){
+        barHeight=1;
+      }
+
+      xx=seqsX+(i-(columnWidth*currPos/columnWidth))*fontWidth;
+
+      fprintf(outfile,"%.1f %.1f %.1f %.1f box2\n",
+              xx,
+              currY+maxConsBar-barHeight,
+              xx+fontWidth,
+              currY+maxConsBar);
+    }
+
+    currY+=blockStep;
+    currPos+=columnWidth;
+  }
+  free(cons);
+
+  fprintf(outfile,"showpage\n");
+  fclose(outfile);
+
+  free(tmpBuffer);
+  free(ssEscaped);free(ruler);
+
+  return 0;
+
+}
+
+int aliPS_color_aln(const char *structure, const char *filename, 
+                    const char *seqs[], const char *names[]) {
+  /* produce PS sequence alignment color-annotated by consensus structure */
+
+  int N,i,j,k,x,y,tmp,columnWidth;
+  char *tmpBuffer,*ssEscaped,*ruler, *cons;
+  char c;
+  float fontWidth, fontHeight, imageHeight, imageWidth,tmpColumns;
+  int length, maxName, maxNum, currPos;
+  float lineStep,blockStep,consStep,ssStep,rulerStep,nameStep,numberStep;
+  float maxConsBar,startY,namesX,seqsX, currY;
+  float score,barHeight,xx,yy;
+  int match,block;
+  FILE *outfile;
+  short *pair_table;
+  char * colorMatrix[6][3] = {
+    {"0.0 1", "0.0 0.6",  "0.0 0.2"},  /* red    */
+    {"0.16 1","0.16 0.6", "0.16 0.2"}, /* ochre  */
+    {"0.32 1","0.32 0.6", "0.32 0.2"}, /* turquoise */
+    {"0.48 1","0.48 0.6", "0.48 0.2"}, /* green  */
+    {"0.65 1","0.65 0.6", "0.65 0.2"}, /* blue   */
+    {"0.81 1","0.81 0.6", "0.81 0.2"} /* violet */
+  };
+
+  const char *alnPlotHeader =
+        "%%!PS-Adobe-3.0 EPSF-3.0\n"
+        "%%%%BoundingBox: %i %i %i %i\n"
+        "%%%%EndComments\n"
+        "%% draws Vienna RNA like colored boxes\n"
+        "/box { %% x1 y1 x2 y2 hue saturation\n"
+        "  gsave\n"
+        "  dup 0.3 mul 1 exch sub sethsbcolor\n"
+        "  exch 3 index sub exch 2 index sub rectfill\n"
+        "  grestore\n"
+        "} def\n"
+        "%% draws a box in current color\n"
+        "/box2 { %% x1 y1 x2 y2\n"
+        "  exch 3 index sub exch 2 index sub rectfill\n"
+        "} def\n"
+        "/string { %% (Text) x y\n"
+        " 6 add\n"
+        " moveto\n"
+        "  show\n"
+        "} def\n"
+        "0 %i translate\n"
+        "1 -1 scale\n"
+        "/Courier findfont\n"
+        "[10 0 0 -10 0 0] makefont setfont\n";
+        
+  vrna_md_t md;
+
+  set_model_details(&md);
+
+  outfile = fopen(filename, "w");
+  if (outfile == NULL) {
+    vrna_message_warning("can't open file %s - not doing alignment plot\n", filename);
+    return 0;
+  }
+  
+  columnWidth=100;            /* Display long alignments in blocks of this size */
+  fontWidth=6;               /* Font metrics */
+  fontHeight=6.5;
+  lineStep=fontHeight+2;     /* distance between lines */
+  blockStep=3.5*fontHeight;  /* distance between blocks */
+  consStep=fontHeight*0.5;   /* distance between alignment and conservation curve */
+  ssStep=2;                  /* distance between secondary structure line and sequences */
+  rulerStep=2;               /* distance between sequences and ruler */
+  nameStep=3*fontWidth;             /* distance between names and sequences */
+  numberStep=fontWidth;      /* distance between sequeces and numbers */
+  maxConsBar=2.5*fontHeight; /* Height of conservation curve */
+  startY=2;                     /* "y origin" */
+  namesX=fontWidth;             /* "x origin" */
+
+  /* Number of columns of the alignment */
+  length=strlen(seqs[0]);
+
+  /* Allocate memory for various strings, length*2 is (more than)
+         enough for all of them */
+  tmpBuffer = (char *) vrna_alloc((unsigned) columnWidth + length*2 );
+  ssEscaped=(char *) vrna_alloc((unsigned) length*2 );
+  ruler=(char *) vrna_alloc((unsigned) length*2  );
+/*   char * structur; */
+/*   structur = (char*) vrna_alloc((length+1)*sizeof(char)); */
+/*   structur = strdup(structure); */
+/*   for(i=0; i<length;i++){ */
+/*     if(structur[i] == '<') structur[i]='('; */
+/*     if(structur[i] == '>') structur[i]=')'; */
+/*   } */
+/*   structur[length]='\0';    */
+/*   printf("%s \n", structur); */
+   pair_table=vrna_pt_ali_get(structure);
+  /* Get length of longest name and count sequences in alignment*/
+
+  for (i=maxName=N=0; names[i] != NULL; i++) {
+    N++;
+    tmp=strlen(names[i]);
+    if (tmp>maxName)  maxName=tmp;
+  }
+
+  
+  /* x-coord. where sequences start */
+  seqsX=namesX+maxName*fontWidth+nameStep; 
+
+  /* calculate number of digits of the alignment length */
+  snprintf(tmpBuffer,length, "%i",length);
+  maxNum=strlen(tmpBuffer);
+  
+
+  /* Calculate bounding box */
+  tmpColumns=columnWidth;
+  if (length<columnWidth){
+        tmpColumns=length;
+  }
+  imageWidth=ceil(namesX+(maxName+tmpColumns+maxNum)*fontWidth+2*nameStep+fontWidth+numberStep);
+  imageHeight=startY+ceil((float)length/columnWidth)*((N+2)*lineStep+blockStep+consStep+ssStep+rulerStep);
+
+  /* Write postscript header including correct bounding box */
+  fprintf(outfile,alnPlotHeader,0,0,(int)imageWidth,(int)imageHeight,(int)imageHeight);
+
+  /* Create ruler and secondary structure lines */
+  i=0;
+  /* Init all with dots */
+  for (i=0;i<(length);i++){
+        ruler[i]='.';
+  }
+  i=0;
+  for (i=0;i<length;i++){
+        /* Write number every 10th position, leave out block breaks */
+        if ((i+1)%10==0 && (i+1)%columnWidth!=0){
+          snprintf(tmpBuffer,length,"%i",i+1);
+          strncpy(ruler+i,tmpBuffer,strlen(tmpBuffer));
+        }
+  }
+  ruler[length]='\0';
+  
+  /* Draw color annotation first */
+  /* Repeat for all pairs */
+  for (i=1; i<=length; i++) {
+    if ((j=pair_table[i])>i) {
+      /* Repeat for open and closing position */
+      for (k=0;k<2;k++){
+        int pairings, nonpair, s, col;
+        int ptype[8] = {0,0,0,0,0,0,0,0};
+        char *color;
+        col = (k==0)?i-1:j-1;
+        block=ceil((float)(col+1)/columnWidth);
+        xx=seqsX+(col-(block-1)*columnWidth)*fontWidth;
+        /* Repeat for each sequence */
+        for (s=pairings=nonpair=0; s<N; s++) {
+          ptype[md.pair[vrna_nucleotide_encode(seqs[s][i-1], &md)][vrna_nucleotide_encode(seqs[s][j-1], &md)]]++;
+        }
+        for (pairings=0,s=1; s<=7; s++) {
+          if (ptype[s]) pairings++;
+        }
+        nonpair=ptype[0];
+        if (nonpair <=2) {
+          color = colorMatrix[pairings-1][nonpair];
+          for (s=0; s<N; s++) {
+            yy=startY+(block-1)*(lineStep*(N+2)+blockStep+consStep+rulerStep)+ssStep*(block)+(s+1)*lineStep;
+            
+            /* Color according due color information in pi-array, only if base pair is possible */
+            if (md.pair[vrna_nucleotide_encode(seqs[s][i-1], &md)][vrna_nucleotide_encode(seqs[s][j-1], &md)]) {
+
+              fprintf(outfile, "%.1f %.1f %.1f %.1f %s box\n",
+                      xx,yy-1,xx+fontWidth,yy+fontHeight+1,color);
+            }
+          }
+        }
+      }
+    }
+  }
+  free(pair_table);
+
+  /* Process rest of the output in blocks of columnWidth */
+
+  currY=startY;
+  currPos=0;
+
+  cons =  consensus(seqs);
+  
+  while (currPos<length) {
+
+    /* Display secondary structure line */
+    fprintf(outfile,"0 setgray\n");
+    strncpy(tmpBuffer,structure+currPos,columnWidth);
+    tmpBuffer[columnWidth]='\0';
+    
+    x=0;y=0;
+    while ((c=tmpBuffer[x])){
+      if (c=='.'){
+        ssEscaped[y++]='.';
+      } else {
+        ssEscaped[y++]='\\';
+        ssEscaped[y++]=c;
+      }                         
+      x++;
+    }
+    ssEscaped[y]='\0';
+    
+    fprintf(outfile, "(%s) %.1f %.1f string\n", ssEscaped,seqsX,currY);
+    currY+=ssStep+lineStep;
+    
+    /* Display names, sequences and numbers */
+
+    for (i=0; i<N; i++) {
+      
+      strncpy(tmpBuffer,seqs[i]+currPos,columnWidth);
+      tmpBuffer[columnWidth]='\0';
+      
+      match=0;
+      for (j=0;j<(currPos+strlen(tmpBuffer));j++){
+        if (seqs[i][j] != '-') match++;
+      }
+      
+      fprintf(outfile, "(%s) %.1f %.1f string\n", names[i],namesX,currY);
+      fprintf(outfile, "(%s) %.1f %.1f string\n", tmpBuffer,seqsX,currY);
+      fprintf(outfile, "(%i) %.1f %.1f string\n", match,seqsX+fontWidth*(strlen(tmpBuffer))+numberStep,currY);
+      currY+=lineStep;
+    }
+    currY+=rulerStep;
+    strncpy(tmpBuffer,ruler+currPos,columnWidth);
+    tmpBuffer[columnWidth]='\0';
+    fprintf(outfile, "(%s) %.1f %.1f string\n", tmpBuffer,seqsX,currY);
+    
+    currY+=lineStep;
+    currY+=consStep;
+    
+    /*Display conservation bar*/
+    
+    fprintf(outfile,"0.6 setgray\n");
+    for (i=currPos;(i<currPos+columnWidth && i<length);i++){
+      match=0;
+      for (j=0;j<N;j++){
+        if (cons[i] == seqs[j][i]) match++;
+        if (cons[i]=='U' && seqs[j][i]=='T') match++;
+        if (cons[i]=='T' && seqs[j][i]=='U') match++;
+      }
+      score=(float)(match-1)/(N-1);
+      
+      if (cons[i] == '-' ||
+          cons[i] == '_' ||
+          cons[i] == '.'){
+        score=0;
+      }
+      
+      barHeight=maxConsBar*score;
+      if (barHeight==0){
+        barHeight=1;
+      }
+      
+      xx=seqsX+(i-(columnWidth*currPos/columnWidth))*fontWidth;
+      
+      fprintf(outfile,"%.1f %.1f %.1f %.1f box2\n",
+              xx,
+              currY+maxConsBar-barHeight,
+              xx+fontWidth,
+              currY+maxConsBar);
+    }
+    
+    currY+=blockStep;
+    currPos+=columnWidth;
+  }
+  free(cons);
+  fprintf(outfile,"showpage\n");
+  fclose(outfile);
+  free(tmpBuffer);
+  free(ssEscaped);free(ruler);
+  
+  return 0;
+
+}
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+
+#endif
+
diff --git a/C/ViennaRNA/plot_aln.h b/C/ViennaRNA/plot_aln.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/plot_aln.h
@@ -0,0 +1,53 @@
+#ifndef VIENNA_RNA_PACKAGE_PLOT_ALN_H
+#define VIENNA_RNA_PACKAGE_PLOT_ALN_H
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file     plot_aln.h
+ *  @ingroup  plotting_utils
+ *  @brief    Various functions for plotting Sequence / Structure Alignments
+ */
+
+/**
+ *  @{
+ *  @ingroup  plotting_utils
+ */
+
+/**
+ *  @brief Produce PostScript sequence alignment color-annotated by consensus
+ *  structure
+*/
+int PS_color_aln( const char *structure,
+                  const char *filename,
+                  const char *seqs[],
+                  const char *names[]);
+
+/**
+ *  PS_color_aln for duplexes
+*/
+int aliPS_color_aln(const char *structure,
+                    const char *filename, 
+                    const char *seqs[],
+                    const char *names[]); 
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+#endif
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/plot_layouts.c b/C/ViennaRNA/plot_layouts.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/plot_layouts.c
@@ -0,0 +1,161 @@
+/**
+ * This file is a container for all plotting layout algorithms
+ *
+ *  c Ronny Lorenz
+ *    The ViennaRNA Package
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/plot_layouts.h"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#define PUBLIC
+#define PRIVATE static
+
+PUBLIC  int     rna_plot_type = 1;  /* 0 = simple, 1 = naview, 2 = circular plot */
+
+PRIVATE float   *angle;
+PRIVATE int     *loop_size, *stack_size;
+PRIVATE int     lp, stk;
+
+PRIVATE void  loop(int i, int j, short *pair_table);
+
+#ifdef _OPENMP
+/* NOTE: all threadprivate variables are uninitialized when entering a thread! */
+#pragma omp threadprivate(angle, loop_size, stack_size, lp, stk)
+#endif
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC int simple_xy_coordinates(short *pair_table, float *x, float *y)
+{
+  float INIT_ANGLE=0.;     /* initial bending angle */
+  float INIT_X = 100.;     /* coordinate of first digit */
+  float INIT_Y = 100.;     /* see above */
+  float RADIUS =  15.;
+
+  int i, length;
+  float  alpha;
+
+  length = pair_table[0];
+  angle =      (float*) vrna_alloc( (length+5)*sizeof(float) );
+  loop_size  =   (int*) vrna_alloc( 16+(length/5)*sizeof(int) );
+  stack_size =   (int*) vrna_alloc( 16+(length/5)*sizeof(int) );
+  lp = stk = 0;
+  loop(0, length+1, pair_table);
+  loop_size[lp] -= 2;     /* correct for cheating with function loop */
+
+  alpha = INIT_ANGLE;
+  x[0]  = INIT_X;
+  y[0]  = INIT_Y;
+
+  for (i = 1; i <= length; i++) {
+    x[i] = x[i-1]+RADIUS*cos(alpha);
+    y[i] = y[i-1]+RADIUS*sin(alpha);
+    alpha += PI-angle[i+1];
+  }
+  free(angle);
+  free(loop_size);
+  free(stack_size);
+
+  return length;
+
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void loop(int i, int j, short *pair_table)
+             /* i, j are the positions AFTER the last pair of a stack; i.e
+                i-1 and j+1 are paired. */
+{
+  int    count = 2;   /* counts the VERTICES of a loop polygon; that's
+                           NOT necessarily the number of unpaired bases!
+                           Upon entry the loop has already 2 vertices, namely
+                           the pair i-1/j+1.  */
+
+  int    r = 0, bubble = 0; /* bubble counts the unpaired digits in loops */
+
+  int    i_old, partner, k, l, start_k, start_l, fill, ladder;
+  int    begin, v, diff;
+  float  polygon;
+
+  short *remember;
+
+  remember = (short *) vrna_alloc((3+(j-i)/5)*2*sizeof(short));
+
+  i_old = i-1, j++;         /* j has now been set to the partner of the
+                               previous pair for correct while-loop
+                               termination.  */
+  while (i != j) {
+    partner = pair_table[i];
+    if ((!partner) || (i==0))
+      i++, count++, bubble++;
+    else {
+      count += 2;
+      k = i, l = partner;    /* beginning of stack */
+      remember[++r] = k;
+      remember[++r] = l;
+      i = partner+1;         /* next i for the current loop */
+
+      start_k = k, start_l = l;
+      ladder = 0;
+      do {
+        k++, l--, ladder++;        /* go along the stack region */
+      }
+      while ((pair_table[k] == l) && (pair_table[k] > k));
+
+      fill = ladder-2;
+      if (ladder >= 2) {
+        angle[start_k+1+fill] += PIHALF;   /*  Loop entries and    */
+        angle[start_l-1-fill] += PIHALF;   /*  exits get an        */
+        angle[start_k]        += PIHALF;   /*  additional PI/2.    */
+        angle[start_l]        += PIHALF;   /*  Why ? (exercise)    */
+        if (ladder > 2) {
+          for (; fill >= 1; fill--) {
+            angle[start_k+fill] = PI;    /*  fill in the angles  */
+            angle[start_l-fill] = PI;    /*  for the backbone    */
+          }
+        }
+      }
+      stack_size[++stk] = ladder;
+      if(k <= l)
+        loop(k, l, pair_table);
+    }
+  }
+  polygon = PI*(count-2)/(float)count; /* bending angle in loop polygon */
+  remember[++r] = j;
+  begin = i_old < 0 ? 0 : i_old;
+  for (v = 1; v <= r; v++) {
+    diff  = remember[v]-begin;
+    for (fill = 0; fill <= diff; fill++)
+      angle[begin+fill] += polygon;
+    if (v > r)
+      break;
+    begin = remember[++v];
+  }
+  loop_size[++lp] = bubble;
+  free(remember);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC int simple_circplot_coordinates(short *pair_table, float *x, float *y){
+  unsigned int  length = (unsigned int) pair_table[0];
+  unsigned int  i;
+  float         d = 2*PI/length;
+  for(i=0; i < length; i++){
+    x[i] = cos(i * d - PI/2);
+    y[i] = sin(i * d - PI/2);
+  }
+  return length;
+}
diff --git a/C/ViennaRNA/plot_layouts.h b/C/ViennaRNA/plot_layouts.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/plot_layouts.h
@@ -0,0 +1,121 @@
+/**
+ *  @file     plot_layouts.h
+ *  @ingroup  plotting_utils
+ *  @brief    Secondary structure plot layout algorithms
+ */
+
+/**
+ *  @{
+ *  @ingroup   plotting_utils
+ *
+ */
+#ifndef VIENNA_RNA_PACKAGE_PLOT_LAYOUTS_H
+#define VIENNA_RNA_PACKAGE_PLOT_LAYOUTS_H
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/naview.h>
+
+#ifndef PI
+#define  PI       3.141592654
+#endif
+#define  PIHALF       PI/2.
+
+
+/**
+ *  @brief Definition of Plot type <i>simple</i>
+ *
+ *  This is the plot type definition for several RNA structure plotting functions telling
+ *  them to use <b>Simple</b> plotting algorithm
+ *
+ *  @see rna_plot_type, vrna_file_PS_rnaplot_a(), vrna_file_PS_rnaplot(), svg_rna_plot(), gmlRNA(), ssv_rna_plot(), xrna_plot()
+ */
+#define VRNA_PLOT_TYPE_SIMPLE     0
+
+/**
+ *  @brief Definition of Plot type <i>Naview</i>
+ *
+ *  This is the plot type definition for several RNA structure plotting functions telling
+ *  them to use <b>Naview</b> plotting algorithm
+ *
+ *  @see rna_plot_type, vrna_file_PS_rnaplot_a(), vrna_file_PS_rnaplot(), svg_rna_plot(), gmlRNA(), ssv_rna_plot(), xrna_plot()
+ */
+#define VRNA_PLOT_TYPE_NAVIEW     1
+
+/**
+ *  @brief Definition of Plot type <i>Circular</i>
+ *
+ *  This is the plot type definition for several RNA structure plotting functions telling
+ *  them to produce a <b>Circular plot</b>
+ *
+ *  @see rna_plot_type, vrna_file_PS_rnaplot_a(), vrna_file_PS_rnaplot(), svg_rna_plot(), gmlRNA(), ssv_rna_plot(), xrna_plot()
+ */
+#define VRNA_PLOT_TYPE_CIRCULAR   2
+
+/**
+ *  @brief this is a workarround for the SWIG Perl Wrapper RNA plot function
+ *  that returns an array of type COORDINATE
+ */
+typedef struct {
+  float X; /* X coords */
+  float Y; /* Y coords */
+} COORDINATE;
+
+/**
+ *  @brief Switch for changing the secondary structure layout algorithm
+ *
+ *  Current possibility are 0 for a simple radial drawing or 1 for the modified
+ *  radial drawing taken from the @e naview program of @cite bruccoleri:1988.
+ *
+ *  @note To provide thread safety please do not rely on this global variable in future implementations
+ *  but pass a plot type flag directly to the function that decides which layout algorithm it may use!
+ *
+ *  @see #VRNA_PLOT_TYPE_SIMPLE, #VRNA_PLOT_TYPE_NAVIEW, #VRNA_PLOT_TYPE_CIRCULAR
+ *
+ */
+extern int rna_plot_type;
+
+/**
+ *  @brief Calculate nucleotide coordinates for secondary structure plot the <i>Simple way</i>
+ *
+ *  @see make_pair_table(), rna_plot_type, simple_circplot_coordinates(), naview_xy_coordinates(), vrna_file_PS_rnaplot_a(),
+ *  vrna_file_PS_rnaplot, svg_rna_plot()
+ *
+ *  @param  pair_table  The pair table of the secondary structure
+ *  @param  X           a pointer to an array with enough allocated space to hold the x coordinates
+ *  @param  Y           a pointer to an array with enough allocated space to hold the y coordinates
+ *  @return             length of sequence on success, 0 otherwise
+ */
+int simple_xy_coordinates(short *pair_table,
+                          float *X,
+                          float *Y);
+
+/**
+ *  @brief Calculate nucleotide coordinates for <i>Circular Plot</i>
+ *
+ *  This function calculates the coordinates of nucleotides mapped in equal distancies onto a unit circle.
+ *
+ *  @note In order to draw nice arcs using quadratic bezier curves that connect base pairs one may calculate
+ *  a second tangential point @f$P^t@f$ in addition to the actual R<sup>2</sup> coordinates.
+ *  the simplest way to do so may be to compute a radius scaling factor @f$rs@f$ in the interval @f$[0,1]@f$ that
+ *  weights the proportion of base pair span to the actual length of the sequence. This scaling factor
+ *  can then be used to calculate the coordinates for @f$P^t@f$, i.e. @f$ P^{t}_x[i] = X[i] * rs@f$
+ *  and @f$P^{t}_y[i] = Y[i] * rs@f$.
+ *
+ *  @see make_pair_table(), rna_plot_type, simple_xy_coordinates(), naview_xy_coordinates(), vrna_file_PS_rnaplot_a(),
+ *  vrna_file_PS_rnaplot, svg_rna_plot()
+ *
+ *  @param  pair_table  The pair table of the secondary structure
+ *  @param  x           a pointer to an array with enough allocated space to hold the x coordinates
+ *  @param  y           a pointer to an array with enough allocated space to hold the y coordinates
+ *  @return             length of sequence on success, 0 otherwise
+ */
+int simple_circplot_coordinates(short *pair_table,
+                                float *x,
+                                float *y);
+
+/**
+ * @}
+ */
+
+
+#endif
diff --git a/C/ViennaRNA/plot_structure.c b/C/ViennaRNA/plot_structure.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/plot_structure.c
@@ -0,0 +1,1256 @@
+/*
+        PostScript and other output formats for RNA secondary structure plots
+
+                 c  Ivo Hofacker, Peter F Stadler, Ronny Lorenz
+                          Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+#include "ViennaRNA/model.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/aln_util.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/plot_layouts.h"
+#include "ViennaRNA/plot_structure.h"
+
+/*
+#################################
+# PRIVATE MACROS                #
+#################################
+*/
+
+#ifndef PI
+#define  PI       3.141592654
+#endif
+#define  PIHALF       PI/2.
+#define SIZE 452.
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+static const char *RNAss_head =
+"%%BeginProlog\n"
+"/RNAplot 100 dict def\n"
+"RNAplot begin\n"
+"/fsize  14 def\n"
+"/outlinecolor {0.2 setgray} bind def\n"
+"/paircolor    {0.2 setgray} bind def\n"
+"/seqcolor     {0   setgray} bind def\n"
+"/cshow  { dup stringwidth pop -2 div fsize -3 div rmoveto show} bind def\n"
+"/min { 2 copy gt { exch } if pop } bind def\n"
+"/max { 2 copy lt { exch } if pop } bind def\n"
+"/arccoords { % i j arccoords\n"
+"  % puts optimal x1 y1 x2 y2 coordinates used in bezier curves from i to j\n"
+"  % onto the stack\n"
+"  dup 3 -1 roll dup 4 -1 roll lt dup dup 5 2 roll {exch} if\n"
+"  dup 3 -1 roll dup 3 -1 roll exch sub 1 sub dup\n"
+"  4 -2 roll 5 -1 roll {exch} if 4 2 roll\n"
+"  sequence length dup 2 div exch 3 1 roll lt \n"
+"  {exch 5 -1 roll pop 4 -2 roll exch 4 2 roll}\n"
+"  { 4 2 roll 5 -1 roll dup 6 1 roll {exch} if\n"
+"    4 -2 roll exch pop dup 3 -1 roll dup 4 1 roll\n"
+"    exch add 4 -1 roll dup 5 1 roll sub 1 sub\n"
+"    5 -1 roll not {4 -2 roll exch 4 2 roll} if\n"
+"  }ifelse\n"
+"   % compute the scalingfactor and prepare (1-sf) and sf*r\n"
+"  2 mul exch cpr 3 1 roll div dup\n"
+"  3 -1 roll mul exch 1 exch sub exch\n"
+"   % compute the coordinates\n"
+"  3 -1 roll 1 sub coor exch get aload pop % get coord for i\n"
+"  4 -1 roll dup 5 1 roll mul 3 -1 roll dup 4 1 roll add exch % calculate y1\n"
+"  4 -1 roll dup 5 1 roll mul 3 -1 roll dup 4 1 roll add exch % calculate x1\n"
+"  5 -1 roll 1 sub coor exch get aload pop % get coord for j\n"
+"  % duplicate j coord\n"
+"  dup 3 -1 roll dup 4 1 roll exch 8 2 roll\n"
+"  6 -1 roll dup 7 1 roll mul 5 -1 roll dup 6 1 roll add exch % calculate y2\n"
+"  6 -1 roll mul 5 -1 roll add exch % calculate x2\n"
+"  6 -2 roll % reorder\n"
+"} bind def\n"
+"/drawoutline {\n"
+"  gsave outlinecolor newpath\n"
+"  coor 0 get aload pop 0.8 0 360 arc % draw 5' circle of 1st sequence\n"
+"  currentdict /cutpoint known        % check if cutpoint is defined\n"
+"  {coor 0 cutpoint getinterval\n"
+"   {aload pop lineto} forall         % draw outline of 1st sequence\n"
+"   coor cutpoint 1 add get aload pop\n"
+"   2 copy moveto 0.8 0 360 arc       % draw 5' circle of 2nd sequence\n"
+"   coor cutpoint 1 add coor length cutpoint 1 add sub getinterval\n"
+"   {aload pop lineto} forall}        % draw outline of 2nd sequence\n"
+"  {coor {aload pop lineto} forall}   % draw outline as a whole\n"
+"  ifelse\n"
+"  stroke grestore\n"
+"} bind def\n"
+"/drawpairs {\n"
+"  paircolor\n"
+"  0.7 setlinewidth\n"
+"  [9 3.01] 9 setdash\n"
+"  newpath\n"
+"  pairs {aload pop\n"
+"      currentdict (cpr) known\n"
+"      { exch dup\n"
+"        coor  exch 1 sub get aload pop moveto\n"
+"        exch arccoords curveto\n"
+"      }\n"
+"      { coor exch 1 sub get aload pop moveto\n"
+"        coor exch 1 sub get aload pop lineto\n"
+"      }ifelse\n"
+"  } forall\n"
+"  stroke\n"
+"} bind def\n"
+"% draw bases\n"
+"/drawbases {\n"
+"  [] 0 setdash\n"
+"  seqcolor\n"
+"  0\n"
+"  coor {\n"
+"    aload pop moveto\n"
+"    dup sequence exch 1 getinterval cshow\n"
+"    1 add\n"
+"  } forall\n"
+"  pop\n"
+"} bind def\n\n"
+"/init {\n"
+"  /Helvetica findfont fsize scalefont setfont\n"
+"  1 setlinejoin\n"
+"  1 setlinecap\n"
+"  0.8 setlinewidth\n"
+"  % find the coordinate range\n"
+"  /xmax -1000 def /xmin 10000 def\n"
+"  /ymax -1000 def /ymin 10000 def\n"
+"  coor {\n"
+"      aload pop\n"
+"      dup ymin lt {dup /ymin exch def} if\n"
+"      dup ymax gt {/ymax exch def} {pop} ifelse\n"
+"      dup xmin lt {dup /xmin exch def} if\n"
+"      dup xmax gt {/xmax exch def} {pop} ifelse\n"
+"  } forall\n"
+"  /size {xmax xmin sub ymax ymin sub max} bind def\n"
+"  /width {xmax xmin sub} bind def\n"
+"  /height {ymax ymin sub} bind def\n"
+"  10 10 translate\n"
+"  680 size 10 add div dup scale\n"
+"  size width sub width xmin sub xmax sub add 2 div 5 add\n"
+"  size height sub height ymin sub ymax sub add 2 div 5 add\n"
+"  translate\n"
+"} bind def\n"
+"end\n";
+
+static const char *anote_macros =
+"RNAplot begin\n"
+"% extra definitions for standard anotations\n"
+"/min { 2 copy gt { exch } if pop } bind def\n"
+"/BLACK { 0 0 0 } def\n"
+"/RED   { 1 0 0 } def\n"
+"/GREEN { 0 1 0 } def\n"
+"/BLUE  { 0 0 1 } def\n"
+"/WHITE { 1 1 1 } def\n"
+"/LabelFont { % font size LabelFont\n"
+"  exch findfont exch fsize mul scalefont setfont\n"
+"} bind def\n"
+"/Label { % i dx dy (text) Label\n"
+"  % write text at base i plus offset dx, dy\n"
+"  4 3 roll 1 sub coor exch get aload pop moveto\n"
+"  3 1 roll fsize mul exch fsize mul exch rmoveto\n"
+"  show\n"
+"} bind def\n"
+"/cmark { % i cmark   draw circle around base i\n"
+"  newpath 1 sub coor exch get aload pop\n"
+"  fsize 2 div 0 360 arc stroke\n"
+"} bind def\n"
+"/gmark { % i j c gmark\n"
+"  % draw basepair i,j with c counter examples in gray\n"
+"  gsave\n"
+"  3 min [0 0.33 0.66 0.9] exch get setgray\n"
+"  1 sub dup coor exch get aload pop moveto\n"
+"  sequence exch 1 getinterval cshow\n"
+"  1 sub dup coor exch get aload pop moveto\n"
+"  sequence exch 1 getinterval cshow\n"
+"  grestore\n"
+"} bind def\n"
+"/segmark { % f i j lw r g b segmark\n"
+"  % mark segment [i,j] with outline width lw and color rgb\n"
+"  % use omark and Fomark instead\n"
+"  gsave\n"
+"  setrgbcolor setlinewidth\n"
+"  newpath\n"
+"  1 sub exch 1 sub dup\n"
+"  coor exch get aload pop moveto\n"
+"  currentdict (cpr) known\n"
+"  {\n"
+"    3 -1 roll dup 4 1 roll dup\n"
+"    {\n"
+"      3 1 roll dup 3 -1 roll dup\n"
+"      4 1 roll exch 5 2 roll exch\n"
+"    }\n"
+"    {\n"
+"      3 1 roll exch\n"
+"    } ifelse\n"
+"    1 exch { coor exch get aload pop lineto } for\n"
+"    {\n"
+"      dup 3 1 roll 1 add exch 1 add arccoords pop pop\n"
+"      4 2 roll 5 -1 roll coor exch get aload pop curveto\n"
+"    } if\n"
+"  }\n"
+"  {\n"
+"    exch 1 exch {\n"
+"      coor exch get aload pop lineto\n"
+"    } for\n"
+"  } ifelse\n"
+"  { closepath fill } if  stroke\n"
+"  grestore\n"
+"} bind def\n"
+"/omark { % i j lw r g b omark\n"
+"  % stroke segment [i..j] with linewidth lw, color rgb\n"
+"  false 7 1 roll segmark\n"
+"} bind def\n"
+"/Fomark { % i j r g b Fomark\n"
+"  % fill segment [i..j] with color rgb\n"
+"  % should precede drawbases\n"
+"  1 4 1 roll true 7 1 roll segmark\n"
+"} bind def\n"
+"/BFmark{ % i j k l r g b BFmark\n"
+"  % fill block between pairs (i,j) and (k,l) with color rgb\n"
+"  % should precede drawbases\n"
+"  gsave\n"
+"  setrgbcolor\n"
+"  newpath\n"
+"  currentdict (cpr) known\n"
+"  {\n"
+"    dup 1 sub coor exch get aload pop moveto % move to l\n"
+"    dup 1 sub 4 -1 roll dup 5 1 roll 1 sub 1 exch\n"
+"    { coor exch get aload pop lineto } for % lines from l to j\n"
+"    3 -1 roll 4 -1 roll dup 5 1 roll arccoords curveto % curve from j to i\n"
+"    exch dup 4 -1 roll 1 sub exch 1 sub 1 exch\n"
+"    { coor exch get aload pop lineto } for % lines from i to k\n"
+"    exch arccoords curveto% curve from k to l\n"
+"  }\n"
+"  {  exch 4 3 roll exch 1 sub exch 1 sub dup\n"
+"     coor exch get aload pop moveto\n"
+"     exch 1 exch { coor exch get aload pop lineto } for\n"
+"     exch 1 sub exch 1 sub dup\n"
+"     coor exch get aload pop lineto\n"
+"     exch 1 exch { coor exch get aload pop lineto } for\n"
+"  } ifelse\n"
+"    closepath fill stroke\n"
+"   grestore\n"
+"} bind def\n"
+"/hsb {\n"
+"  dup 0.3 mul 1 exch sub sethsbcolor\n"
+"} bind def\n"
+"/colorpair { % i j hue sat colorpair\n"
+"  % draw basepair i,j in color\n"
+"  % 1 index 0.00 ne {\n"
+"  gsave\n"
+"  newpath\n"
+"  hsb\n"
+"  fsize setlinewidth\n"
+"  currentdict (cpr) known\n"
+"  {\n"
+"    exch dup\n"
+"    coor  exch 1 sub get aload pop moveto\n"
+"    exch arccoords curveto\n"
+"  }\n"
+"  { 1 sub coor exch get aload pop moveto\n"
+"    1 sub coor exch get aload pop lineto\n"
+"  } ifelse\n"
+"   stroke\n"
+"   grestore\n"
+"   % } if\n"
+"} bind def\n"
+ "end\n\n";
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+PRIVATE char **annote(const char *structure, const char *AS[]);
+
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC int
+vrna_file_PS_rnaplot( const char *string,
+                      const char *structure,
+                      const char *ssfile,
+                      vrna_md_t  *md_p){
+
+  return vrna_file_PS_rnaplot_a(string, structure, ssfile, NULL, NULL, md_p);
+}
+
+PUBLIC int
+vrna_file_PS_rnaplot_a( const char *seq,
+                        const char *structure,
+                        const char *ssfile,
+                        const char *pre,
+                        const char *post,
+                        vrna_md_t  *md_p){
+
+  float  xmin, xmax, ymin, ymax;
+  int    i, length;
+  int    ee, gb, ge, Lg, l[3];
+  float *X, *Y;
+  FILE  *xyplot;
+  short *pair_table, *pair_table_g;
+  char  *c, *string;
+  vrna_md_t   md;
+
+  if(!md_p){
+    set_model_details(&md);
+    md_p  = &md;
+  }
+    
+  string = strdup(seq);
+  length = strlen(string);
+
+  xyplot = fopen(ssfile, "w");
+  if (xyplot == NULL) {
+    vrna_message_warning("can't open file %s - not doing xy_plot", ssfile);
+    return 0;
+  }
+
+  pair_table = vrna_ptable(structure);
+  pair_table_g = vrna_ptable(structure);
+
+  ge=0;
+  while ( (ee=parse_gquad(structure+ge, &Lg, l)) >0 ) {
+    ge += ee;
+    gb=ge-Lg*4-l[0]-l[1]-l[2]+1;
+    /* add pseudo-base pair encloding gquad */
+    for (i=0; i<Lg; i++) {
+      pair_table_g[ge-i]=gb+i;
+      pair_table_g[gb+i]=ge-i;
+    }
+  } 
+      
+  X = (float *) vrna_alloc((length+1)*sizeof(float));
+  Y = (float *) vrna_alloc((length+1)*sizeof(float));
+  switch(rna_plot_type){
+    case VRNA_PLOT_TYPE_SIMPLE:   i = simple_xy_coordinates(pair_table_g, X, Y);
+                                  break;
+    case VRNA_PLOT_TYPE_CIRCULAR: {
+                                    int radius = 3*length;
+                                    i = simple_circplot_coordinates(pair_table_g, X, Y);
+                                    for (i = 0; i < length; i++) {
+                                      X[i] *= radius;
+                                      X[i] += radius;
+                                      Y[i] *= radius;
+                                      Y[i] += radius;
+                                    }
+                                  }
+                                  break;
+    default:                      i = naview_xy_coordinates(pair_table_g, X, Y);
+                                  break;
+  }
+  if(i!=length)
+    vrna_message_warning("strange things happening in PS_rna_plot...");
+
+  xmin = xmax = X[0];
+  ymin = ymax = Y[0];
+  for (i = 1; i < length; i++) {
+     xmin = X[i] < xmin ? X[i] : xmin;
+     xmax = X[i] > xmax ? X[i] : xmax;
+     ymin = Y[i] < ymin ? Y[i] : ymin;
+     ymax = Y[i] > ymax ? Y[i] : ymax;
+  }
+
+  fprintf(xyplot,
+          "%%!PS-Adobe-3.0 EPSF-3.0\n"
+          "%%%%Creator: ViennaRNA-%s\n"
+          "%%%%CreationDate: %s"
+          "%%%%Title: RNA Secondary Structure Plot\n"
+          "%%%%BoundingBox: 0 0 700 700\n"
+          "%%%%DocumentFonts: Helvetica\n"
+          "%%%%Pages: 1\n"
+          "%%%%EndComments\n\n"
+          "%%Options: %s\n", VERSION, vrna_time_stamp(), vrna_md_option_string(md_p));
+  fprintf(xyplot, "%% to switch off outline pairs of sequence comment or\n"
+          "%% delete the appropriate line near the end of the file\n\n");
+  fprintf(xyplot, "%s", RNAss_head);
+
+  if (pre || post) {
+    fprintf(xyplot, "%s", anote_macros);
+  }
+  fprintf(xyplot, "%%%%EndProlog\n");
+
+  fprintf(xyplot, "RNAplot begin\n"
+          "%% data start here\n");
+
+  /* cut_point */
+  if ((c = strchr(structure, '&'))) {
+    int cutpoint;
+    cutpoint = c - structure;
+    string[cutpoint] = ' '; /* replace & with space */
+    fprintf(xyplot, "/cutpoint %d def\n", cutpoint);
+  }
+
+  /* sequence */
+  fprintf(xyplot,"/sequence (\\\n");
+  i=0;
+  while (i<length) {
+    fprintf(xyplot, "%.255s\\\n", string+i);  /* no lines longer than 255 */
+    i+=255;
+  }
+  fprintf(xyplot,") def\n");
+  /* coordinates */
+  fprintf(xyplot, "/coor [\n");
+  for (i = 0; i < length; i++)
+    fprintf(xyplot, "[%3.8f %3.8f]\n", X[i], Y[i]);
+  fprintf(xyplot, "] def\n");
+  /* correction coordinates for quadratic beziers in case we produce a circplot */
+  if(rna_plot_type == VRNA_PLOT_TYPE_CIRCULAR)
+    fprintf(xyplot, "/cpr %6.2f def\n", (float)3*length);
+  /* base pairs */
+  fprintf(xyplot, "/pairs [\n");
+  for (i = 1; i <= length; i++)
+    if (pair_table[i]>i)
+      fprintf(xyplot, "[%d %d]\n", i, pair_table[i]);
+  /* add gquad pairs */
+  ge=0;
+  while ( (ee=parse_gquad(structure+ge, &Lg, l)) >0 ) {
+    int k;
+    fprintf(xyplot, "%% gquad\n");
+    ge += ee;
+    gb=ge-Lg*4-l[0]-l[1]-l[2]+1; /* add pseudo-base pair encloding gquad */
+    for (k=0; k<Lg; k++) {
+      int ii, jj, il;
+      for (il=0, ii=gb+k; il<3; il++) {
+        jj = ii+l[il]+Lg;
+        fprintf(xyplot, "[%d %d]\n", ii, jj);
+        ii = jj;
+      }
+      jj = gb+k;
+      fprintf(xyplot, "[%d %d]\n", jj, ii);
+    }
+  }
+
+  fprintf(xyplot, "] def\n\n");
+
+  fprintf(xyplot, "init\n\n");
+  /* draw the data */
+  if (pre) {
+    fprintf(xyplot, "%% Start Annotations\n");
+    fprintf(xyplot, "%s\n", pre);
+    fprintf(xyplot, "%% End Annotations\n");
+  }
+  fprintf(xyplot,
+          "%% switch off outline pairs or bases by removing these lines\n"
+          "drawoutline\n"
+          "drawpairs\n"
+          "drawbases\n");
+
+  if (post) {
+    fprintf(xyplot, "%% Start Annotations\n");
+    fprintf(xyplot, "%s\n", post);
+    fprintf(xyplot, "%% End Annotations\n");
+  }
+  fprintf(xyplot, "%% show it\nshowpage\n");
+  fprintf(xyplot, "end\n");
+  fprintf(xyplot, "%%%%EOF\n");
+
+  fclose(xyplot);
+
+  free(string);
+  free(pair_table);
+  free(pair_table_g);
+  free(X); free(Y);
+  return 1; /* success */
+}
+
+/* options for gml output:
+   uppercase letters: print sequence labels
+   lowercase letters: no sequence lables
+   graphics information:
+   x X  simple xy plot
+   (nothing else implemented at present)
+   default:           no graphics data at all
+*/
+
+PUBLIC int gmlRNA(char *string, char *structure, char *ssfile, char option)
+{
+  FILE *gmlfile;
+  int i;
+  int length;
+  short *pair_table;
+  float *X, *Y;
+
+  gmlfile = fopen(ssfile, "w");
+  if (gmlfile == NULL) {
+     vrna_message_warning("can't open file %s - not doing xy_plot", ssfile);
+     return 0;
+  }
+
+  length = strlen(string);
+
+  pair_table = vrna_ptable(structure);
+
+  switch(option){
+  case 'X' :
+  case 'x' :
+    /* Simple XY Plot */
+    X = (float *) vrna_alloc((length+1)*sizeof(float));
+    Y = (float *) vrna_alloc((length+1)*sizeof(float));
+    if (rna_plot_type == 0)
+      i = simple_xy_coordinates(pair_table, X, Y);
+    else
+      i = naview_xy_coordinates(pair_table, X, Y);
+
+    if(i!=length)
+      vrna_message_warning("strange things happening in gmlRNA ...");
+    break;
+  default:
+    /* No Graphics Information */
+    X = NULL;
+    Y = NULL;
+  }
+
+  fprintf(gmlfile,
+          "# Vienna RNA Package %s\n"
+          "# GML Output\n"
+          "# CreationDate: %s\n"
+          "# Name: %s\n"
+          "# Options: %s\n", VERSION, vrna_time_stamp(), ssfile, option_string());
+  fprintf(gmlfile,
+          "graph [\n"
+          " directed 0\n");
+  for (i=1; i<=length; i++){
+     fprintf(gmlfile,
+          " node [ id %d ", i);
+     if (option) fprintf(gmlfile,
+          "label \"%c\"",string[i-1]);
+     if ((option == 'X')||(option=='x'))
+       fprintf(gmlfile,
+               "\n  graphics [ x %9.4f y %9.4f ]\n", X[i-1], Y[i-1]);
+     fprintf(gmlfile," ]\n");
+  }
+  for (i=1; i<length; i++)
+    fprintf(gmlfile,
+            "edge [ source %d target %d ]\n", i, i+1);
+  for (i=1; i<=length; i++) {
+     if (pair_table[i]>i)
+        fprintf(gmlfile,
+                "edge [ source %d target %d ]\n", i, pair_table[i]);
+  }
+  fprintf(gmlfile, "]\n");
+  fclose(gmlfile);
+
+  free(pair_table);
+  free(X); free(Y);
+  return 1; /* success */
+}
+
+
+
+int PS_rna_plot_snoop_a(char *string, char *structure, char *ssfile, int *relative_access, const char *seqs[])
+{
+  int    i, length;
+  float *X, *Y;
+  FILE  *xyplot;
+  short *pair_table;
+  short *pair_table_snoop;
+
+  length = strlen(string);
+
+  xyplot = fopen(ssfile, "w");
+  if (xyplot == NULL) {
+    vrna_message_warning("can't open file %s - not doing xy_plot", ssfile);
+    return 0;
+  }
+
+  pair_table = vrna_ptable(structure);
+  pair_table_snoop = vrna_pt_snoop_get(structure);
+
+  X = (float *) vrna_alloc((length+1)*sizeof(float));
+  Y = (float *) vrna_alloc((length+1)*sizeof(float));
+  if (rna_plot_type == 0)
+    i = simple_xy_coordinates(pair_table, X, Y);
+  else
+    i = naview_xy_coordinates(pair_table, X, Y);
+  if(i!=length)
+    vrna_message_warning("strange things happening in PS_rna_plot...");
+/*   printf("cut_point %d\n", cut_point); */
+
+/*   for (i = 1; i < length; i++) { */
+/*     printf("%d X %f Y %f \n", i, X[i], Y[i]); */
+/*     xmin = X[i] < xmin ? X[i] : xmin; */
+/*     xmax = X[i] > xmax ? X[i] : xmax; */
+/*     ymin = Y[i] < ymin ? Y[i] : ymin; */
+/*     ymax = Y[i] > ymax ? Y[i] : ymax; */
+/*   } */
+  /* localize centre of the interaction bucket. Geometry */
+  
+  for (i = 1; i < cut_point; i++) {  /* interior loop of size 0 */
+    if(pair_table_snoop[i] != 0){ 
+      X[i-1]=X[pair_table_snoop[i]-1]; 
+      Y[i-1]=Y[pair_table_snoop[i]-1]; 
+    }
+    else if(pair_table_snoop[i-1] && pair_table_snoop[i+1]){ /* interior loop of size 1 */
+      X[i-1]=X[pair_table_snoop[i-1] -1-1];
+      Y[i-1]=Y[pair_table_snoop[i-1] -1-1];
+    } 
+    else if(pair_table_snoop[i-1] && pair_table_snoop[i+2]){ /* interior loop of size 2 */
+      if(pair_table_snoop[i-1] - pair_table_snoop[i+2] ==2){
+        X[i-1]=X[pair_table_snoop[i-1]-2];
+        Y[i-1]=Y[pair_table_snoop[i-1]-2];
+        X[i]=X[pair_table_snoop[i+2]];
+        Y[i]=Y[pair_table_snoop[i+2]];
+        i++;
+      }
+      else if(pair_table[pair_table_snoop[i-1]-1]){
+        X[i-1]=X[pair_table_snoop[i-1]-2];
+        Y[i-1]=Y[pair_table_snoop[i-1]-2];
+        X[i]=X[pair_table[pair_table_snoop[i-1]-1]-1];
+        Y[i]=Y[pair_table[pair_table_snoop[i-1]-1]-1];
+        i++;
+      }
+      else if(pair_table[pair_table_snoop[i-1]-2]){
+        X[i-1]=X[pair_table_snoop[i-1]-3];
+        Y[i-1]=Y[pair_table_snoop[i-1]-3];
+        X[i]=X[pair_table[pair_table_snoop[i-1]-2]-1];
+        Y[i]=Y[pair_table[pair_table_snoop[i-1]-2]-1];
+        i++;
+      }
+      else if(pair_table[pair_table_snoop[i-1]-3]){
+        X[i-1]=X[pair_table_snoop[i-1]-4];
+        Y[i-1]=Y[pair_table_snoop[i-1]-4];
+        X[i]=X[pair_table[pair_table_snoop[i-1]-3]-1];
+        Y[i]=Y[pair_table[pair_table_snoop[i-1]-3]-1];
+        i++;
+      }
+      else{
+        X[i-1]=X[pair_table_snoop[i-1]-2];
+        Y[i-1]=Y[pair_table_snoop[i-1]-2];
+        X[i]=X[pair_table_snoop[i+2]];
+        Y[i]=Y[pair_table_snoop[i+2]];
+        i++;
+      }
+    }
+    else if(pair_table_snoop[i-1] && pair_table_snoop[i+3]){ /* interior loop of size 2 */
+      if(pair_table[pair_table_snoop[i-1]-1]){
+        X[i-1]=0.5*(X[pair_table_snoop[i-1]-1]+X[pair_table_snoop[i-1]-2]);
+        Y[i-1]=0.5*(Y[pair_table_snoop[i-1]-1]+Y[pair_table_snoop[i-1]-2]);
+        X[i]=  0.5*(X[pair_table[pair_table_snoop[i-1]-1]-1]+X[pair_table_snoop[i-1]-2]);
+        Y[i]=  0.5*(Y[pair_table[pair_table_snoop[i-1]-1]-1]+Y[pair_table_snoop[i-1]-2]);
+        X[i+1]=0.5*(X[pair_table[pair_table_snoop[i-1]-1]-2]+X[pair_table[pair_table_snoop[i-1]-1]-1]);
+        Y[i+1]=0.5*(Y[pair_table[pair_table_snoop[i-1]-1]-2]+Y[pair_table[pair_table_snoop[i-1]-1]-1]);
+        i++;i++;
+
+      }
+      else if(pair_table[pair_table_snoop[i-1]-2]){
+        X[i-1]=0.5*(X[pair_table_snoop[i-1]-2]+X[pair_table_snoop[i-1]-3]);
+        Y[i-1]=0.5*(Y[pair_table_snoop[i-1]-2]+Y[pair_table_snoop[i-1]-3]);
+        X[i]=  0.5*(X[pair_table[pair_table_snoop[i-1]-2]-1]+X[pair_table_snoop[i-1]-3]);
+        Y[i]=  0.5*(Y[pair_table[pair_table_snoop[i-1]-2]-1]+Y[pair_table_snoop[i-1]-3]);
+        X[i+1]=0.5*(X[pair_table[pair_table_snoop[i-1]-2]-2]+X[pair_table[pair_table_snoop[i-1]-2]-1]);
+        Y[i+1]=0.5*(Y[pair_table[pair_table_snoop[i-1]-2]-2]+Y[pair_table[pair_table_snoop[i-1]-2]-1]);
+        i++;i++;
+      }
+      else if(pair_table[pair_table_snoop[i-1]-3]){
+        X[i-1]=0.5*(X[pair_table_snoop[i-1]-3]+X[pair_table_snoop[i-1]-4]);
+        Y[i-1]=0.5*(Y[pair_table_snoop[i-1]-3]+Y[pair_table_snoop[i-1]-4]);
+        X[i]=  0.5*(X[pair_table[pair_table_snoop[i-1]-3]-1]+X[pair_table_snoop[i-1]-4]);
+        Y[i]=  0.5*(Y[pair_table[pair_table_snoop[i-1]-3]-1]+Y[pair_table_snoop[i-1]-4]);
+        X[i+1]=0.5*(X[pair_table[pair_table_snoop[i-1]-3]-2]+X[pair_table[pair_table_snoop[i-1]-3]-1]);
+        Y[i+1]=0.5*(Y[pair_table[pair_table_snoop[i-1]-3]-2]+Y[pair_table[pair_table_snoop[i-1]-3]-1]);
+        i++;i++;
+      }
+      else{
+        X[i-1]=X[pair_table_snoop[i-1]-2];
+        Y[i-1]=Y[pair_table_snoop[i-1]-2];
+        X[i]=X[pair_table_snoop[i-1]-2];
+        Y[i]=Y[pair_table_snoop[i-1]-2];
+        X[i+1]=X[pair_table_snoop[i-1]-2];
+        Y[i+1]=Y[pair_table_snoop[i-1]-2];
+        i++;i++;
+      }
+    }
+  }
+  double xC;
+  double yC;
+  float X0=-1,Y0=-1,X1=-1,Y1=-1,X2=-1,Y2=-1;
+/*   int c1,c2,c3; */
+  for(i=1;i<cut_point; i++){
+    if(pair_table_snoop[i]){
+      X0=X[pair_table_snoop[i]-1];Y0=Y[pair_table_snoop[i]-1];
+  /*     c1=pair_table_snoop[i]; */
+      i++;
+      break;
+    }
+  }
+  for(;i<cut_point; i++){
+    if(pair_table_snoop[i]){
+      X1=X[pair_table_snoop[i]-1];Y1=Y[pair_table_snoop[i]-1];
+    /*   c2=pair_table_snoop[i]; */
+      i++;
+      break;
+    }
+  }
+  for(;i<cut_point; i++){
+    if(pair_table_snoop[i]){
+      X2=X[pair_table_snoop[i]-1];Y2=Y[pair_table_snoop[i]-1];
+    /*   c3=pair_table_snoop[i]; */
+      i++;
+      break;
+    }
+  }
+/*   for(i=cut_point-2;i>pair_table_snoop[c1]; i--){ */
+/*     if(pair_table_snoop[i]){ */
+/*       X1=X[pair_table_snoop[i]-1];Y1=Y[pair_table_snoop[i]-1]; */
+/*       c2=pair_table_snoop[i]; */
+/*       i++; */
+/*       break; */
+/*     } */
+/*   } */
+/*   for(i=pair_table_snoop[c1]+1;i<pair_table_snoop[c2]; i++){ */
+/*     if(pair_table_snoop[i]){ */
+/*       X2=X[pair_table_snoop[i]-1];Y2=Y[pair_table_snoop[i]-1]; */
+/*       c3=pair_table_snoop[i]; */
+/*       i++; */
+/*       break; */
+/*     } */
+/*   } */ 
+ if(X0 < 0 || X1 < 0 || X2 < 0){
+   printf("Could not get the center of the binding bucket. No ps file will be produced!\n");
+   fclose(xyplot);
+   free(pair_table);
+   free(pair_table_snoop);
+   free(X);free(Y);
+   pair_table=NULL;pair_table_snoop=NULL;X=NULL;Y=NULL;
+   return 0;
+ }
+  double alpha   =   (X0 -X1)/(Y1-Y0);
+  double alpha_p =   (X1 -X2)/(Y2-Y1);
+  double b =         (Y0+Y1 -alpha*(X0+X1))*0.5;
+  double b_p =       (Y1+Y2 -alpha_p*(X1+X2))*0.5;
+  /*    if(abs(alpha -alpha_p) > 0.0000001){ */
+  xC  =  (b_p - b) / (alpha - alpha_p);
+  yC  =  alpha * xC + b;
+  for (i = 1; i < cut_point; i++) {  
+     X[i-1] = X[i-1] + 0.25*(xC-X[i-1]);  
+     Y[i-1] = Y[i-1] + 0.25*(yC-Y[i-1]);  
+  }  
+
+  fprintf(xyplot,
+          "%%!PS-Adobe-3.0 EPSF-3.0\n"
+          "%%%%Creator: ViennaRNA-%s\n"
+          "%%%%CreationDate: %s"
+          "%%%%Title: RNA Secondary Structure Plot\n"
+          "%%%%BoundingBox: 0 0 700 700\n"
+          "%%%%DocumentFonts: Helvetica\n"
+          "%%%%Pages: 1\n"
+          "%%%%EndComments\n\n"
+          "%%Options: %s\n", VERSION, vrna_time_stamp(), option_string());
+  fprintf(xyplot, "%% to switch off outline pairs of sequence comment or\n"
+          "%% delete the appropriate line near the end of the file\n\n");
+  fprintf(xyplot, "%s", RNAss_head);
+  char **A;
+  fprintf(xyplot, "%s", anote_macros);
+  if(seqs){
+    fprintf(xyplot, "%s", anote_macros);
+    A = annote(structure, (const char**) seqs);
+  }
+  fprintf(xyplot, "%%%%EndProlog\n");
+  
+  fprintf(xyplot, "RNAplot begin\n"
+          "%% data start here\n");
+  /* cut_point */
+  if (cut_point > 0 && cut_point <= strlen(string))
+    fprintf(xyplot, "/cutpoint %d def\n", cut_point-1);
+  /* sequence */
+  fprintf(xyplot,"/sequence (\\\n");
+  i=0;
+  while (i<length) {
+    fprintf(xyplot, "%.255s\\\n", string+i);  /* no lines longer than 255 */
+    i+=255;
+  }
+  fprintf(xyplot,") def\n");
+  /* coordinates */
+  fprintf(xyplot, "/coor [\n");
+  for (i = 0; i < length; i++)
+    fprintf(xyplot, "[%3.3f %3.3f]\n", X[i], Y[i]);
+  fprintf(xyplot, "] def\n");
+  /* base pairs */
+  fprintf(xyplot, "/pairs [\n");
+  for (i = 1; i <= length; i++)
+    if (pair_table[i]>i)
+      fprintf(xyplot, "[%d %d]\n", i, pair_table[i]);
+  for (i = 1; i <= length; i++)
+    if (pair_table_snoop[i]>i)
+      fprintf(xyplot, "[%d %d]\n", i, pair_table_snoop[i]);
+  fprintf(xyplot, "] def\n\n");
+  if(relative_access){
+    fprintf(xyplot,"/S [\n");
+    for(i=0;i<cut_point-1; i++){
+      fprintf(xyplot, " %f\n", (float)relative_access[i]/100);
+    }
+    fprintf(xyplot,"]\n bind def\n");
+    fprintf(xyplot,"/invert false def\n");
+    fprintf(xyplot,"/range 0.8 def\n");
+    fprintf(xyplot,"/drawreliability {\n"                      
+                   "/Smax 2.6 def\n"                         
+                   "  0        \n"                              
+                   "  coor 0 cutpoint getinterval {\n"
+                   "    aload pop\n"
+                   "    S 3 index get\n"
+                   "    Smax div range mul\n"     
+                   "    invert {range exch sub} if\n"  
+                   "    1 1 sethsbcolor\n"
+                   "    newpath\n"
+                   "    fsize 2.5 div 0 360 arc\n"
+                   "    fill\n"
+                   "    1 add\n"
+                   "  } forall\n"
+                   "\n"
+                   "} bind def\n"); 
+  }
+  fprintf(xyplot, "init\n\n");
+  /*raw the data */
+  if (seqs) { 
+     fprintf(xyplot, "%% Start Annotations\n"); 
+     fprintf(xyplot, "%s\n", A[0]); 
+     fprintf(xyplot, "%% End Annotations\n"); 
+   } 
+
+
+  fprintf(xyplot,"%%switch off outline pairs or bases by removing these lines\n");
+  if(relative_access){
+    fprintf(xyplot,"drawreliability\n");
+  }
+  fprintf(xyplot,
+          "drawoutline\n"
+          "drawpairs\n"
+          "drawbases\n");
+  /* fprintf(xyplot, "%d cmark\n",c1); */
+  /* fprintf(xyplot, "%d cmark\n",c2); */
+  /* fprintf(xyplot, "%d cmark\n",c3); */
+  if (seqs) { 
+     fprintf(xyplot, "%% Start Annotations\n"); 
+     fprintf(xyplot, "%s\n", A[1]); 
+     fprintf(xyplot, "%% End Annotations\n"); 
+   } 
+  fprintf(xyplot, "%% show it\nshowpage\n");
+  fprintf(xyplot, "end\n");
+  fprintf(xyplot, "%%%%EOF\n");
+
+  fclose(xyplot);
+  if(seqs){free(A[0]);free(A[1]);free(A);}
+  free(pair_table);free(pair_table_snoop);
+  free(X); free(Y);
+  return 1; /* success */
+}
+
+
+PRIVATE char **annote(const char *structure, const char *AS[]) {
+  char *ps, *colorps, **A;
+  int i, n, s, pairings, maxl;
+  short *ptable;
+  char * colorMatrix[6][3] = {
+    {"0.0 1", "0.0 0.6",  "0.0 0.2"},  /* red    */
+    {"0.16 1","0.16 0.6", "0.16 0.2"}, /* ochre  */
+    {"0.32 1","0.32 0.6", "0.32 0.2"}, /* turquoise */
+    {"0.48 1","0.48 0.6", "0.48 0.2"}, /* green  */
+    {"0.65 1","0.65 0.6", "0.65 0.2"}, /* blue   */
+    {"0.81 1","0.81 0.6", "0.81 0.2"} /* violet */
+  };
+
+  vrna_md_t   md;
+  set_model_details(&md);
+
+  n = strlen(AS[0]);
+  maxl = 1024;
+
+  A = (char **) vrna_alloc(sizeof(char *)*2);
+  ps = (char *) vrna_alloc(maxl);
+  colorps = (char *) vrna_alloc(maxl);
+  ptable = vrna_pt_ali_get(structure);
+  for (i=1; i<=n; i++) {
+    char pps[64], ci='\0', cj='\0';
+    int j, type, pfreq[8] = {0,0,0,0,0,0,0,0}, vi=0, vj=0;
+    if ((j=ptable[i])<i) continue;
+    for (s=0; AS[s]!=NULL; s++) {
+      type = md.pair[vrna_nucleotide_encode(AS[s][i-1], &md)][vrna_nucleotide_encode(AS[s][j-1], &md)];
+      pfreq[type]++;
+      if (type) {
+        if (AS[s][i-1] != ci) { ci = AS[s][i-1]; vi++;}
+        if (AS[s][j-1] != cj) { cj = AS[s][j-1]; vj++;}
+      }
+    }
+    for (pairings=0,s=1; s<=7; s++) {
+      if (pfreq[s]) pairings++;
+    }
+
+    if ((maxl - strlen(ps) < 192) || ((maxl - strlen(colorps)) < 64)) {
+      maxl *= 2;
+      ps = realloc(ps, maxl);
+      colorps = realloc(colorps, maxl);
+      if ((ps==NULL) || (colorps == NULL))
+          vrna_message_error("out of memory in realloc");
+    }
+
+    if (pfreq[0]<=2) {
+      snprintf(pps, 64, "%d %d %s colorpair\n",
+               i,j, colorMatrix[pairings-1][pfreq[0]]);
+      strcat(colorps, pps);
+    }
+
+    if (pfreq[0]>0) {
+      snprintf(pps, 64, "%d %d %d gmark\n", i, j, pfreq[0]);
+      strcat(ps, pps);
+    }
+    if (vi>1) {
+      snprintf(pps, 64, "%d cmark\n", i);
+      strcat(ps, pps);
+    }
+    if (vj>1) {
+      snprintf(pps, 64, "%d cmark\n", j);
+      strcat(ps, pps);
+    }
+  }
+  free(ptable);
+  A[0]=colorps;
+  A[1]=ps;
+  return A;
+}
+
+/*--------------------------------------------------------------------------*/
+
+
+int svg_rna_plot(char *string, char *structure, char *ssfile)
+{
+  float  xmin, xmax, ymin, ymax, size;
+  int    i, length;
+  float *X, *Y, *R = NULL, *CX = NULL, *CY = NULL;
+  FILE  *xyplot;
+  short *pair_table;
+
+  length = strlen(string);
+
+  xyplot = fopen(ssfile, "w");
+  if (xyplot == NULL) {
+    vrna_message_warning("can't open file %s - not doing xy_plot", ssfile);
+    return 0;
+  }
+
+  pair_table = vrna_ptable(structure);
+
+  X = (float *) vrna_alloc((length+1)*sizeof(float));
+  Y = (float *) vrna_alloc((length+1)*sizeof(float));
+
+  switch(rna_plot_type){
+    case VRNA_PLOT_TYPE_SIMPLE:   i = simple_xy_coordinates(pair_table, X, Y);
+                                  break;
+    case VRNA_PLOT_TYPE_CIRCULAR: {
+                                    int radius = 3*length;
+                                    int dr = 0;
+                                    R = (float *) vrna_alloc((length+1)*sizeof(float));
+                                    CX = (float *) vrna_alloc((length+1)*sizeof(float));
+                                    CY = (float *) vrna_alloc((length+1)*sizeof(float));
+                                    i = simple_circplot_coordinates(pair_table, X, Y);
+                                    for (i = 0; i < length; i++) {
+                                      if(i+1 < pair_table[i+1]){
+                                        dr = (pair_table[i+1]-i+1 <= (length/2 + 1)) ? pair_table[i+1]-i : i + length - pair_table[i+1];
+                                        R[i] = 1. - (2.*dr/(float)length);
+                                      }
+                                      else if(pair_table[i+1]){
+                                        R[i] = R[pair_table[i+1]-1];
+                                      }
+                                      else{
+                                        R[i] = 1.0;
+                                      }
+                                      CX[i] = X[i] * radius * R[i] + radius;
+                                      CY[i] = Y[i] * radius * R[i] + radius;
+                                      X[i] *= radius;
+                                      X[i] += radius;
+                                      Y[i] *= radius;
+                                      Y[i] += radius;
+                                    }
+                                  }
+                                  break;
+    default:                      i = naview_xy_coordinates(pair_table, X, Y);
+                                  break;
+  }
+
+  if(i!=length)
+    vrna_message_warning("strange things happening in PS_rna_plot...");
+
+
+  xmin = xmax = X[0];
+  ymin = ymax = Y[0];
+  for (i = 1; i < length; i++) {
+     xmin = X[i] < xmin ? X[i] : xmin;
+     xmax = X[i] > xmax ? X[i] : xmax;
+     ymin = Y[i] < ymin ? Y[i] : ymin;
+     ymax = Y[i] > ymax ? Y[i] : ymax;
+  }
+  for (i = 0; i < length; i++)
+    Y[i] = ymin+ymax - Y[i]; /* mirror coordinates so they look as in PS */
+
+  if(rna_plot_type == VRNA_PLOT_TYPE_CIRCULAR)
+    for (i = 0; i < length; i++){
+      CY[i] = ymin+ymax - CY[i]; /* mirror coordinates so they look as in PS */
+    }
+   
+  size = MAX2((xmax-xmin),(ymax-ymin));
+  size += 15; /* add some so the bounding box isn't too tight */
+
+  fprintf(xyplot,
+          "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
+          "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"452\" width=\"452\">\n");
+  fprintf(xyplot,
+          "<script type=\"text/ecmascript\">\n"
+          "      <![CDATA[\n"
+          "        var shown = 1;\n"
+          "        function click() {\n"
+          "             var seq = document.getElementById(\"seq\");\n"
+          "             if (shown==1) {\n"
+          "               seq.setAttribute(\"style\", \"visibility: hidden\");\n"
+          "               shown = 0;\n"
+          "             } else {\n"
+          "               seq.setAttribute(\"style\", \"visibility: visible\");\n"
+          "               shown = 1;\n"
+          "             }\n"
+          "         }\n"
+          "        ]]>\n"
+          "</script>\n");
+  fprintf(xyplot,
+          "  <rect style=\"stroke: white; fill: white\" height=\"452\" x=\"0\" y=\"0\" width=\"452\" onclick=\"click(evt)\" />\n"
+          "  <g transform=\"scale(%7f,%7f) translate(%7f,%7f)\">\n",
+          SIZE/size, SIZE/size, (size-xmin-xmax)/2, (size-ymin-ymax)/2);
+
+  fprintf(xyplot,
+          "    <polyline style=\"stroke: black; fill: none; stroke-width: 1.5\" id=\"outline\" points=\"\n");
+  for (i = 0; i < length; i++)
+    fprintf(xyplot, "      %3.3f,%3.3f\n", X[i], Y[i]);
+  fprintf(xyplot,"    \" />\n");
+
+  fprintf(xyplot,"    <g style=\"stroke: black; stroke-width: 1; fill: none;\" id=\"pairs\">\n");
+  for (i = 1; i <= length; i++) {
+    int j;
+    if ((j=pair_table[i])>i){
+      if(rna_plot_type == VRNA_PLOT_TYPE_CIRCULAR)
+        fprintf(xyplot,
+                "      <path id=\"%d,%d\" d=\"M %6.15f %6.15f C %6.15f,%6.15f %6.15f,%6.15f %6.15f %6.15f\" />\n",
+                i,j, X[i-1], Y[i-1], CX[i-1], CY[i-1], CX[j-1], CY[j-1], X[j-1], Y[j-1]);
+      else
+        fprintf(xyplot,
+                "      <line id=\"%d,%d\" x1=\"%6.5f\" y1=\"%6.5f\" x2=\"%6.5f\" y2=\"%6.5f\" />\n",
+                i,j, X[i-1], Y[i-1], X[j-1], Y[j-1]);
+    }
+  }
+  fprintf(xyplot, "    </g>\n");
+  fprintf(xyplot, "    <g style=\"font-family: SansSerif\" transform=\"translate(-4.6, 4)\" id=\"seq\">\n");
+  for (i = 0; i < length; i++)
+    fprintf(xyplot, "      <text x=\"%.3f\" y=\"%.3f\">%c</text>\n", X[i], Y[i], string[i]);
+  fprintf(xyplot, "    </g>\n");
+  fprintf(xyplot, "  </g>\n");
+  fprintf(xyplot, "</svg>\n");
+
+  fclose(xyplot);
+
+  free(pair_table);
+  free(X); free(Y);
+  if(R) free(R);
+  if(CX) free(CX);
+  if(CY) free(CY);
+  return 1; /* success */
+}
+
+/*--------------------------------------------------------------------------*/
+
+PUBLIC int ssv_rna_plot(char *string, char *structure, char *ssfile)
+{           /* produce input for the SStructView java applet */
+  FILE *ssvfile;
+  int i, bp;
+  int length;
+  short *pair_table;
+  float *X, *Y;
+  float xmin, xmax, ymin, ymax;
+
+  ssvfile = fopen(ssfile, "w");
+  if (ssvfile == NULL) {
+     vrna_message_warning("can't open file %s - not doing xy_plot", ssfile);
+     return 0;
+  }
+  length = strlen(string);
+  pair_table = vrna_ptable(structure);
+
+  /* make coordinates */
+  X = (float *) vrna_alloc((length+1)*sizeof(float));
+  Y = (float *) vrna_alloc((length+1)*sizeof(float));
+
+  if (rna_plot_type == 0)
+    i = simple_xy_coordinates(pair_table, X, Y);
+  else
+    i = naview_xy_coordinates(pair_table, X, Y);
+  if (i!=length)
+    vrna_message_warning("strange things happening in ssv_rna_plot...");
+
+  /* make coords nonegative */
+  xmin = xmax = X[0];
+  ymin = ymax = Y[0];
+  for (i = 1; i < length; i++) {
+     xmin = X[i] < xmin ? X[i] : xmin;
+     xmax = X[i] > xmax ? X[i] : xmax;
+     ymin = Y[i] < ymin ? Y[i] : ymin;
+     ymax = Y[i] > ymax ? Y[i] : ymax;
+  }
+  if (xmin<1) {
+    for (i = 0; i <= length; i++)
+      X[i] -= xmin-1;
+    xmin = 1;
+  }
+  if (ymin<1) {
+    for (i = 0; i <= length; i++)
+      Y[i] -= ymin-1;
+    ymin = 1;
+  }
+#if 0
+  {
+    float size, xoff, yoff;
+    float JSIZE = 500; /* size of the java applet window */
+    /* rescale coordinates, center on square of size HSIZE */
+    size = MAX2((xmax-xmin),(ymax-ymin));
+    xoff = (size - xmax + xmin)/2;
+    yoff = (size - ymax + ymin)/2;
+    for (i = 0; i <= length; i++) {
+      X[i] = (X[i]-xmin+xoff)*(JSIZE-10)/size + 5;
+      Y[i] = (Y[i]-ymin+yoff)*(JSIZE-10)/size + 5;
+    }
+  }
+#endif
+  /* */
+
+  fprintf(ssvfile,
+          "# Vienna RNA Package %s\n"
+          "# SStructView Output\n"
+          "# CreationDate: %s\n"
+          "# Name: %s\n"
+          "# Options: %s\n", VERSION, vrna_time_stamp(), ssfile, option_string());
+  for (i=1; i<=length; i++)
+    fprintf(ssvfile, "BASE\t%d\t%c\t%d\t%d\n",
+            i, string[i-1], (int) (X[i-1]+0.5), (int) (Y[i-1]+0.5));
+  for (bp=1, i=1; i<=length; i++)
+    if (pair_table[i]>i)
+      fprintf(ssvfile, "BASE-PAIR\tbp%d\t%d\t%d\n", bp++, i, pair_table[i]);
+  fclose(ssvfile);
+
+  free(pair_table);
+  free(X); free(Y);
+  return 1; /* success */
+}
+
+/*---------------------------------------------------------------------------*/
+PUBLIC int xrna_plot(char *string, char *structure, char *ssfile)
+{           /* produce input for XRNA RNA drawing program */
+  FILE *ss_file;
+  int i;
+  int length;
+  short *pair_table;
+  float *X, *Y;
+
+  ss_file = fopen(ssfile, "w");
+  if (ss_file == NULL) {
+    vrna_message_warning("can't open file %s - not doing xy_plot", ssfile);
+    return 0;
+  }
+
+  length = strlen(string);
+  pair_table = vrna_ptable(structure);
+
+  /* make coordinates */
+  X = (float *) vrna_alloc((length+1)*sizeof(float));
+  Y = (float *) vrna_alloc((length+1)*sizeof(float));
+
+  if (rna_plot_type == 0)
+    i = simple_xy_coordinates(pair_table, X, Y);
+  else
+    i = naview_xy_coordinates(pair_table, X, Y);
+  if (i!=length)
+    vrna_message_warning("strange things happening in xrna_plot...");
+
+  fprintf(ss_file,
+          "# Vienna RNA Package %s, XRNA output\n"
+          "# CreationDate: %s\n"
+          "# Options: %s\n", VERSION, vrna_time_stamp(), option_string());
+  for (i=1; i<=length; i++)
+    /* XRNA likes to have coordinate mirrored, so we use (-X, Y) */
+    fprintf(ss_file, "%d %c %6.2f %6.2f %d %d\n", i, string[i-1],
+            -X[i-1], Y[i-1], (pair_table[i]?1:0), pair_table[i]);
+  fclose(ss_file);
+
+  free(pair_table);
+  free(X); free(Y);
+  return 1; /* success */
+}
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC int
+PS_rna_plot(char *string,
+            char *structure,
+            char *ssfile){
+
+  return vrna_file_PS_rnaplot((const char*)string,
+                              (const char*)structure,
+                              (const char*) ssfile,
+                              NULL);
+}
+
+PUBLIC int
+PS_rna_plot_a(char *string,
+              char *structure,
+              char *ssfile,
+              char *pre,
+              char *post){
+
+  return vrna_file_PS_rnaplot_a((const char*)string,
+                                (const char*)structure,
+                                (const char*)ssfile,
+                                (const char*)pre,
+                                (const char*)post,
+                                NULL);
+}
+
+PUBLIC int
+PS_rna_plot_a_gquad(char *string,
+                    char *structure,
+                    char *ssfile,
+                    char *pre,
+                    char *post){
+
+  return vrna_file_PS_rnaplot_a((const char*)string,
+                                (const char*)structure,
+                                (const char*)ssfile,
+                                (const char*)pre,
+                                (const char*)post,
+                                NULL);
+}
+
+#endif
+
diff --git a/C/ViennaRNA/plot_structure.h b/C/ViennaRNA/plot_structure.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/plot_structure.h
@@ -0,0 +1,168 @@
+#ifndef VIENNA_RNA_PACKAGE_PLOT_STRUCTURE_H
+#define VIENNA_RNA_PACKAGE_PLOT_STRUCTURE_H
+
+#include <ViennaRNA/model.h>
+#include <ViennaRNA/plot_layouts.h>
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @file plot_structure.h
+ *  @ingroup   plotting_utils
+ *  @brief Various functions for plotting RNA secondary structures
+ */
+
+/**
+ *  @{
+ *  @ingroup   plotting_utils
+ */
+
+/* write PostScript drawing of structure to file with annotation */
+int PS_rna_plot_snoop_a(char *string,
+                        char *structure,
+                        char *ssfile,
+                        int *relative_access,
+                        const char *seqs[]);
+
+/**
+ *  @brief Produce a secondary structure graph in PostScript and write it to 'filename'.
+ *
+ *  Note that this function has changed from previous versions
+ *  and now expects the structure to be plotted in dot-bracket notation as an
+ *  argument. It does not make use of the global #base_pair array anymore.
+ *
+ *  @param seq        The RNA sequence
+ *  @param structure  The secondary structure in dot-bracket notation
+ *  @param file       The filename of the postscript output
+ *  @param md_p       Model parameters used to generate a commandline option string in the output (Maybe NULL)
+ *  @return           1 on success, 0 otherwise
+ */
+int vrna_file_PS_rnaplot( const char *seq,
+                          const char *structure,
+                          const char *file,
+                          vrna_md_t  *md_p);
+
+/**
+ *  @brief Produce a secondary structure graph in PostScript including additional
+ *  annotation macros and write it to 'filename'
+ *
+ *  Same as vrna_file_PS_rnaplot() but adds extra PostScript macros for various
+ *  annotations (see generated PS code). The 'pre' and 'post'
+ *  variables contain PostScript code that is verbatim copied in the
+ *  resulting PS file just before and after the structure plot.
+ *  If both arguments ('pre' and 'post') are NULL, no additional macros will
+ *  be printed into the PostScript.
+ *
+ *  @param seq     The RNA sequence
+ *  @param structure  The secondary structure in dot-bracket notation
+ *  @param file       The filename of the postscript output
+ *  @param pre        PostScript code to appear before the secondary structure plot
+ *  @param post       PostScript code to appear after the secondary structure plot
+ *  @param md_p       Model parameters used to generate a commandline option string in the output (Maybe NULL)
+ *  @return           1 on success, 0 otherwise
+ */
+int vrna_file_PS_rnaplot_a( const char *seq,
+                            const char *structure,
+                            const char *file,
+                            const char *pre,
+                            const char *post,
+                            vrna_md_t  *md_p);
+
+/**
+ *  @brief Produce a secondary structure graph in Graph Meta Language (gml) and write it to a file
+ *
+ *  If 'option' is an uppercase letter the RNA sequence is used to label nodes, if 'option' equals
+ *  @a 'X' or @a 'x' the resulting file will coordinates for an initial layout of the graph.
+ *
+ *  @param  string    The RNA sequence
+ *  @param  structure The secondary structure in dot-bracket notation
+ *  @param  ssfile    The filename of the gml output
+ *  @param  option    The option flag
+ *  @return           1 on success, 0 otherwise
+ */
+int gmlRNA( char *string,
+            char *structure,
+            char *ssfile,
+            char option);
+
+/**
+ *  @brief  Produce a secondary structure graph in SStructView format
+ *
+ *  Write coord file for SStructView
+ *
+ *  @param  string    The RNA sequence
+ *  @param  structure The secondary structure in dot-bracket notation
+ *  @param  ssfile    The filename of the ssv output
+ *  @return           1 on success, 0 otherwise
+ */
+int ssv_rna_plot( char *string,
+                  char *structure,
+                  char *ssfile);
+
+/**
+ *  @brief Produce a secondary structure plot in SVG format and write it to a file
+ *
+ *  @param string     The RNA sequence
+ *  @param structure  The secondary structure in dot-bracket notation
+ *  @param ssfile     The filename of the svg output
+ *  @return           1 on success, 0 otherwise
+ */
+int svg_rna_plot( char *string,
+                  char *structure,
+                  char *ssfile);
+
+/**
+ *  @brief Produce a secondary structure plot for further editing in XRNA
+ *
+ *  @param string     The RNA sequence
+ *  @param structure  The secondary structure in dot-bracket notation
+ *  @param ssfile     The filename of the xrna output
+ *  @return           1 on success, 0 otherwise
+ */
+int xrna_plot(char *string,
+              char *structure,
+              char *ssfile);
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief Produce a secondary structure graph in PostScript and write it to 'filename'.
+ *
+ *  @deprecated   Use vrna_file_PS_rnaplot() instead!
+ */
+DEPRECATED(int PS_rna_plot(char *string, char *structure, char *file));
+
+/**
+ *  @brief Produce a secondary structure graph in PostScript including additional
+ *  annotation macros and write it to 'filename'
+ *
+ *  @deprecated   Use vrna_file_PS_rnaplot_a() instead!
+ */
+DEPRECATED(int PS_rna_plot_a(char *string, char *structure, char *file, char *pre, char *post));
+
+/**
+ *  @brief Produce a secondary structure graph in PostScript including additional
+ *  annotation macros and write it to 'filename' (detect and draw g-quadruplexes)
+ *
+ *  @deprecated   Use vrna_file_PS_rnaplot_a() instead!
+ */
+DEPRECATED(int PS_rna_plot_a_gquad(char *string, char *structure, char *ssfile, char *pre, char *post));
+
+#endif
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/profiledist.h b/C/ViennaRNA/profiledist.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/profiledist.h
@@ -0,0 +1,62 @@
+#ifndef VIENNA_RNA_PACKAGE_PROFILEDIST_H
+#define VIENNA_RNA_PACKAGE_PROFILEDIST_H
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+#include <ViennaRNA/data_structures.h>
+
+/** \file profiledist.h  */
+
+/**
+ *  \brief Align the 2 probability profiles T1, T2\n
+ * 
+ *  This is like a Needleman-Wunsch alignment,
+ *  we should really use affine gap-costs ala Gotoh
+ */
+float profile_edit_distance(const float *T1,
+                            const float *T2);
+
+/**
+ *  \brief condense pair probability matrix into a vector containing probabilities
+ *  for unpaired, upstream paired and downstream paired.
+ * 
+ *  This resulting probability profile is used as input for profile_edit_distance
+ * 
+ *  \param bppm   A pointer to the base pair probability matrix
+ *  \param length The length of the sequence
+ *  \returns      The bp profile
+ */
+float *Make_bp_profile_bppm(FLT_OR_DBL *bppm,
+                            int length);
+
+/**
+ *  \brief print string representation of probability profile
+ */
+void  print_bppm(const float *T);
+
+/**
+ *  \brief free space allocated in Make_bp_profile
+ * 
+ *  Backward compatibility only. You can just use plain free()
+ */
+void  free_profile(float *T);
+
+/**
+ *  \note This function is NOT threadsafe
+ * 
+ *  \see Make_bp_profile_bppm()
+ * 
+ *  \deprecated This function is deprecated and will be removed soon! See \ref Make_bp_profile_bppm() for a replacement
+ * 
+ */
+DEPRECATED(float *Make_bp_profile(int length));
+
+#endif
diff --git a/C/ViennaRNA/read_epars.c b/C/ViennaRNA/read_epars.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/read_epars.c
@@ -0,0 +1,1079 @@
+/*
+                  read energy parameters from a file
+
+                      Stephan Kopp, Ivo Hofacker
+                          Vienna RNA Package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <math.h>
+#include <stdarg.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_const.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/read_epars.h"
+
+#define PUBLIC
+#define PRIVATE   static
+#define PARSET 20
+
+#define DEF -50
+#define NST 0
+
+PRIVATE FILE *fp;
+
+PRIVATE void  display_array(int *p, int size, int line, FILE *fp);
+PRIVATE char  *get_array1(int *arr, int size);
+PRIVATE void  ignore_comment(char *line);
+PRIVATE void  check_symmetry(void);
+PRIVATE void  update_nst(int array[NBPAIRS+1][NBPAIRS+1][5][5][5][5]);
+
+/**
+*** read a 1dimensional array from file
+*** \param array  a pointer to the first element in the array
+*** \param dim    the size of the array
+*** \param shift  the first position the new values will be written in
+**/
+PRIVATE void  rd_1dim(int *array, int dim, int shift);
+PRIVATE void  rd_1dim_slice(int *array, int dim, int shift, int post);
+PRIVATE void  rd_2dim(int *array,
+                      int dim1, int dim2,
+                      int shift1, int shift2);
+PRIVATE void  rd_2dim_slice(int *array,
+                      int dim1, int dim2,
+                      int shift1, int shift2,
+                      int post1, int post2);
+PRIVATE void  rd_3dim(int *array,
+                      int dim1, int dim2, int dim3,
+                      int shift1, int shift2, int shift3);
+PRIVATE void  rd_3dim_slice(int *array,
+                      int dim1, int dim2, int dim3,
+                      int shift1, int shift2, int shift3,
+                      int post1, int post2, int post3);
+PRIVATE void  rd_4dim(int *array,
+                      int dim1, int dim2, int dim3, int dim4,
+                      int shift1, int shift2, int shift3, int shift4);
+PRIVATE void  rd_4dim_slice(int *array,
+                      int dim1, int dim2, int dim3, int dim4,
+                      int shift1, int shift2, int shift3, int shift4,
+                      int post1, int post2, int post3, int post4);
+PRIVATE void  rd_5dim(int *array,
+                      int dim1, int dim2, int dim3, int dim4, int dim5,
+                      int shift1, int shift2, int shift3, int shift4, int shift5);
+PRIVATE void  rd_5dim_slice(int *array,
+                      int dim1, int dim2, int dim3, int dim4, int dim5,
+                      int shift1, int shift2, int shift3, int shift4, int shift5,
+                      int post1, int post2, int post3, int post4, int post5);
+PRIVATE void  rd_6dim(int *array,
+                      int dim1, int dim2, int dim3, int dim4, int dim5, int dim6,
+                      int shift1, int shift2, int shift3, int shift4, int shift5, int shift6);
+PRIVATE void  rd_6dim_slice(int *array,
+                      int dim1, int dim2, int dim3, int dim4, int dim5, int dim6,
+                      int shift1, int shift2, int shift3, int shift4, int shift5, int shift6,
+                      int post1, int post2, int post3, int post4, int post5, int post6);
+PRIVATE void  rd_Tetraloop37(void);
+PRIVATE void  rd_Triloop37(void);
+PRIVATE void  rd_Hexaloop37(void);
+
+/*------------------------------------------------------------*/
+PUBLIC void read_parameter_file(const char fname[]){
+  char        *line, ident[256];
+  enum parset type;
+  int         r;
+
+  if (!(fp=fopen(fname,"r"))) {
+    vrna_message_warning("\nread_parameter_file:\n"
+                                "\t\tcan't open file %s\n"
+                                "\t\tusing default parameters instead.",
+                                fname);
+    return;
+  }
+
+  if (!(line = vrna_read_line(fp))) {
+    vrna_message_warning(" File %s is improper.\n", fname);
+    fclose(fp);
+    return;
+  }
+
+  if (strncmp(line,"## RNAfold parameter file v2.0",30)!=0) {
+    vrna_message_warning( "Missing header line in file.\n"
+                          "May be this file has not v2.0 format.\n"
+                          "Use INTERRUPT-key to stop.");
+  }
+  free(line);
+
+  while((line=vrna_read_line(fp))) {
+
+    r = sscanf(line, "# %255s", ident);
+    if (r==1) {
+      type = gettype(ident);
+      switch (type){
+        case QUIT:    break;
+        case S:       rd_2dim(&(stack37[0][0]), NBPAIRS+1, NBPAIRS+1, 1, 1);
+                      break;
+        case S_H:     rd_2dim(&(stackdH[0][0]), NBPAIRS+1, NBPAIRS+1, 1, 1);
+                      break;
+        case HP:      rd_1dim(&(hairpin37[0]), 31, 0);
+                      break;
+        case HP_H:    rd_1dim(&(hairpindH[0]), 31, 0);
+                      break;
+        case B:       rd_1dim(&(bulge37[0]), 31, 0);
+                      break;
+        case B_H:     rd_1dim(&(bulgedH[0]), 31, 0);
+                      break;
+        case IL:      rd_1dim(&(internal_loop37[0]), 31, 0);
+                      break;
+        case IL_H:    rd_1dim(&(internal_loopdH[0]), 31, 0);
+                      break;
+        case MME:     rd_3dim(&(mismatchExt37[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case MME_H:   rd_3dim(&(mismatchExtdH[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case MMH:     rd_3dim(&(mismatchH37[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case MMH_H:   rd_3dim(&(mismatchHdH[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case MMI:     rd_3dim(&(mismatchI37[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case MMI_H:   rd_3dim(&(mismatchIdH[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case MMI1N:   rd_3dim(&(mismatch1nI37[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case MMI1N_H: rd_3dim(&(mismatch1nIdH[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case MMI23:   rd_3dim(&(mismatch23I37[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case MMI23_H: rd_3dim(&(mismatch23IdH[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case MMM:     rd_3dim(&(mismatchM37[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case MMM_H:   rd_3dim(&(mismatchMdH[0][0][0]),
+                          NBPAIRS+1, 5, 5,
+                          1, 0, 0);
+                      break;
+        case INT11:   rd_4dim(&(int11_37[0][0][0][0]),
+                          NBPAIRS+1, NBPAIRS+1, 5, 5,
+                          1, 1, 0, 0);
+                      break;
+        case INT11_H: rd_4dim(&(int11_dH[0][0][0][0]),
+                          NBPAIRS+1, NBPAIRS+1, 5, 5,
+                          1, 1, 0, 0);
+                      break;
+        case INT21:   rd_5dim(&(int21_37[0][0][0][0][0]),
+                          NBPAIRS+1, NBPAIRS+1, 5, 5, 5,
+                          1, 1, 0, 0, 0);
+                      break;
+        case INT21_H: rd_5dim(&(int21_dH[0][0][0][0][0]),
+                          NBPAIRS+1, NBPAIRS+1, 5, 5, 5,
+                          1, 1, 0, 0, 0);
+                      break;
+        case INT22:   rd_6dim_slice(&(int22_37[0][0][0][0][0][0]),
+                          NBPAIRS+1, NBPAIRS+1, 5, 5, 5, 5,
+                          1, 1, 1, 1, 1, 1,
+                          1, 1, 0, 0, 0, 0);
+                      update_nst(int22_37);
+                      break;
+        case INT22_H: rd_6dim_slice(&(int22_dH[0][0][0][0][0][0]),
+                          NBPAIRS+1, NBPAIRS+1, 5, 5, 5, 5,
+                          1, 1, 1, 1, 1, 1,
+                          1, 1, 0, 0, 0, 0);
+                      update_nst(int22_dH);
+                      break;
+        case D5:      rd_2dim(&(dangle5_37[0][0]), NBPAIRS+1, 5, 1, 0);
+                      break;
+        case D5_H:    rd_2dim(&(dangle5_dH[0][0]), NBPAIRS+1, 5, 1, 0);
+                      break;
+        case D3:      rd_2dim(&(dangle3_37[0][0]), NBPAIRS+1, 5, 1, 0);
+                      break;
+        case D3_H:    rd_2dim(&(dangle3_dH[0][0]), NBPAIRS+1, 5, 1, 0);
+                      break;
+        case ML:      {
+                        int values[6];
+                        rd_1dim(&values[0], 6, 0);
+                        ML_BASE37     = values[0];
+                        ML_BASEdH     = values[1];
+                        ML_closing37  = values[2];
+                        ML_closingdH  = values[3];
+                        ML_intern37   = values[4];
+                        ML_interndH   = values[5];
+                      }
+                      break;
+        case NIN:     {
+                        int values[3];
+                        rd_1dim(&values[0], 3, 0);
+                        ninio37 = values[0];
+                        niniodH = values[1];
+                        MAX_NINIO  = values[2];
+                      }
+                      break;
+        case MISC:    {
+                        int values[4];
+                        rd_1dim(&values[0], 4, 0);
+                        DuplexInit37 = values[0];
+                        DuplexInitdH = values[1];
+                        TerminalAU37 = values[2];
+                        TerminalAUdH = values[3];
+                      }
+                      break;
+        case TL:      rd_Tetraloop37();
+                      break;
+        case TRI:     rd_Triloop37();
+                      break;
+        case HEX:     rd_Hexaloop37();
+                      break;
+        default:      /* do nothing but complain */
+                      vrna_message_warning("read_epars: Unknown field identifier in `%s'", line);
+      }
+    } /* else ignore line */
+    free(line);
+  }
+  fclose(fp);
+
+  check_symmetry();
+  return;
+}
+
+/*------------------------------------------------------------*/
+
+PRIVATE void display_array(int *p, int size, int nl, FILE *fp)
+{
+  int i;
+
+  for (i=1; i<=size; i++, p++) {
+    switch(*p)
+      {
+      case  INF: fprintf(fp,"   INF"); break;
+      case -INF: fprintf(fp,"  -INf"); break;
+      case  DEF: fprintf(fp,"   DEF"); break;
+      default:   fprintf(fp,"%6d",  *p); break;
+      }
+    if ((i%nl)==0) fprintf(fp,"\n");
+  }
+  if (size%nl) fprintf(fp,"\n");
+  return;
+}
+
+/*------------------------------------------------------------*/
+
+PRIVATE char *get_array1(int *arr, int size)
+{
+  int    i, p, pos, pp, r, last;
+  char  *line, buf[16];
+
+
+  i = last = 0;
+  while( i<size ) {
+    line = vrna_read_line(fp);
+    if (!line) vrna_message_error("unexpected end of file in get_array1");
+    ignore_comment(line);
+    pos=0;
+    while ((i<size)&&(sscanf(line+pos,"%15s%n", buf, &pp)==1)) {
+      pos += pp;
+      if (buf[0]=='*') {i++; continue;}
+      else if (buf[0]=='x') { /* should only be used for loop parameters */
+        if (i==0) vrna_message_error("can't extrapolate first value");
+        p = arr[last] + (int) (0.5+ lxc37*log(((double) i)/(double)(last)));
+      }
+      else if (strcmp(buf,"DEF") == 0) p = DEF;
+      else if (strcmp(buf,"INF") == 0) p = INF;
+      else if (strcmp(buf,"NST") == 0) p = NST;
+      else {
+        r=sscanf(buf,"%d", &p);
+        if (r!=1) {
+          return line+pos;
+          vrna_message_error("can't interpret `%s' in get_array1", buf);
+          exit(1);
+        }
+        last = i;
+      }
+      arr[i++]=p;
+    }
+    free(line);
+  }
+
+  return NULL;
+}
+
+PRIVATE void rd_1dim(int *array, int dim, int shift){
+  rd_1dim_slice(array, dim, shift, 0);
+}
+
+PRIVATE void rd_1dim_slice(int *array, int dim, int shift, int post){
+  char *cp;
+  cp   = get_array1(array+shift, dim-shift-post);
+
+  if (cp) {
+    vrna_message_error("\nrd_1dim: %s", cp);
+    exit(1);
+  }
+  return;
+}
+
+PRIVATE void  rd_2dim(int *array, int dim1, int dim2, int shift1, int shift2){
+  rd_2dim_slice(array, dim1, dim2, shift1, shift2, 0, 0);
+}
+
+PRIVATE void  rd_2dim_slice(int *array,
+                      int dim1, int dim2,
+                      int shift1, int shift2,
+                      int post1, int post2){
+  int i;
+  int delta_pre   = shift1 + shift2;
+  int delta_post  = post1 + post2;
+
+  if(delta_pre + delta_post == 0){
+    rd_1dim(array, dim1 * dim2, 0);
+    return;
+  }
+  for (i=shift1; i<dim1 - post1; i++)
+    rd_1dim_slice(array + (i*dim2), dim2, shift2, post2);
+  return;
+}
+
+PRIVATE void  rd_3dim(int *array, int dim1, int dim2, int dim3, int shift1, int shift2, int shift3){
+  rd_3dim_slice(array,
+                dim1, dim2, dim3,
+                shift1, shift2, shift3,
+                0, 0, 0);
+}
+
+PRIVATE void  rd_3dim_slice(int *array,
+                            int dim1, int dim2, int dim3,
+                            int shift1, int shift2, int shift3,
+                            int post1, int post2, int post3){
+  int    i;
+  int delta_pre   = shift1 + shift2 + shift3;
+  int delta_post  = post1 + post2 + post3;
+
+  if(delta_pre + delta_post == 0){
+    rd_1dim(array, dim1 * dim2 * dim3, 0);
+    return;
+  }
+  for (i=shift1; i<dim1 - post1; i++){
+    rd_2dim_slice(array + (i * dim2 * dim3),
+            dim2, dim3,
+            shift2, shift3,
+            post2, post3);
+  }
+  return;
+}
+
+PRIVATE void  rd_4dim(int *array,
+                      int dim1, int dim2, int dim3, int dim4,
+                      int shift1, int shift2, int shift3, int shift4){
+  rd_4dim_slice(array,
+                dim1, dim2, dim3, dim4,
+                shift1, shift2, shift3, shift4,
+                0, 0, 0, 0);
+}
+
+PRIVATE void  rd_4dim_slice(int *array,
+                      int dim1, int dim2, int dim3, int dim4,
+                      int shift1, int shift2, int shift3, int shift4,
+                      int post1, int post2, int post3, int post4){
+  int i;
+  int delta_pre   = shift1 + shift2 + shift3 + shift4;
+  int delta_post  = post1 + post2 + post3 + post4;
+
+  if(delta_pre + delta_post == 0){
+    rd_1dim(array, dim1 * dim2 * dim3 * dim4, 0);
+    return;
+  }
+  for(i=shift1; i<dim1 - post1; i++){
+    rd_3dim_slice(array + (i * dim2 * dim3 * dim4),
+            dim2, dim3, dim4,
+            shift2, shift3, shift4,
+            post2, post3, post4);
+  }
+  return;
+}
+
+PRIVATE void  rd_5dim(int *array,
+                      int dim1, int dim2, int dim3, int dim4, int dim5,
+                      int shift1, int shift2, int shift3, int shift4, int shift5){
+  rd_5dim_slice(array,
+                dim1, dim2, dim3, dim4, dim5,
+                shift1, shift2, shift3, shift4, shift5,
+                0, 0, 0, 0, 0);
+}
+
+PRIVATE void  rd_5dim_slice(int *array,
+                      int dim1, int dim2, int dim3, int dim4, int dim5,
+                      int shift1, int shift2, int shift3, int shift4, int shift5,
+                      int post1, int post2, int post3, int post4, int post5){
+  int i;
+  int delta_pre   = shift1 + shift2 + shift3 + shift4 + shift5;
+  int delta_post  = post1 + post2 + post3 + post4 + post5;
+
+  if(delta_pre + delta_post == 0){
+    rd_1dim(array, dim1 * dim2 * dim3 * dim4 * dim5, 0);
+    return;
+  }
+  for(i=shift1; i<dim1 - post1; i++)
+    rd_4dim_slice(array + (i * dim2 * dim3 * dim4 * dim5),
+            dim2, dim3, dim4, dim5,
+            shift2, shift3, shift4, shift5,
+            post2, post3, post4, post5);
+  return;
+}
+
+/**
+*** \param dim1   The size of the first dimension
+*** \param shift1 The pre shift for the first dimension
+**/
+PRIVATE void  rd_6dim(int *array,
+                      int dim1, int dim2, int dim3, int dim4, int dim5, int dim6,
+                      int shift1, int shift2, int shift3, int shift4, int shift5, int shift6){
+  rd_6dim_slice(array,
+                dim1, dim2, dim3, dim4, dim5, dim6,
+                shift1, shift2, shift3, shift4, shift5, shift6,
+                0, 0, 0, 0, 0, 0);
+}
+
+PRIVATE void  rd_6dim_slice(int *array,
+                      int dim1, int dim2, int dim3, int dim4, int dim5, int dim6,
+                      int shift1, int shift2, int shift3, int shift4, int shift5, int shift6,
+                      int post1, int post2, int post3, int post4, int post5, int post6){
+  int i;
+  int delta_pre   = shift1 + shift2 + shift3 + shift4 + shift5 + shift6;
+  int delta_post  = post1 + post2 + post3 + post4 + post5 + post6;
+
+  if(delta_pre + delta_post == 0){
+    rd_1dim(array, dim1 * dim2 * dim3 * dim4 * dim5 * dim6, 0);
+    return;
+  }
+  for(i=shift1; i<dim1 - post1; i++)
+    rd_5dim_slice(array + (i * dim2 * dim3 * dim4 * dim5 * dim6),
+            dim2, dim3, dim4, dim5, dim6,
+            shift2, shift3, shift4, shift5, shift6,
+            post2, post3, post4, post5, post6);
+  return;
+}
+
+
+/*------------------------------------------------------------*/
+PRIVATE void  rd_Tetraloop37(void)
+{
+  int    i, r;
+  char   *buf;
+
+  i=0;
+  /* erase old tetraloop entries */
+  memset(&Tetraloops, 0, 281);
+  memset(&Tetraloop37, 0, sizeof(int)*40);
+  memset(&TetraloopdH, 0, sizeof(int)*40);
+  do {
+    buf = vrna_read_line(fp);
+    if (buf==NULL) break;
+    r = sscanf(buf,"%6s %d %d", &Tetraloops[7*i], &Tetraloop37[i], &TetraloopdH[i]);
+    strcat(Tetraloops, " ");
+    free(buf);
+    i++;
+  } while((r==3)&&(i<40));
+  return;
+}
+
+/*------------------------------------------------------------*/
+PRIVATE void  rd_Hexaloop37(void)
+{
+  int    i, r;
+  char   *buf;
+
+  i=0;
+  /* erase old hexaloop entries */
+  memset(&Hexaloops, 0, 361);
+  memset(&Hexaloop37, 0, sizeof(int)*40);
+  memset(&HexaloopdH, 0, sizeof(int)*40);
+  do {
+    buf = vrna_read_line(fp);
+    if (buf==NULL) break;
+    r = sscanf(buf,"%8s %d %d", &Hexaloops[9*i], &Hexaloop37[i], &HexaloopdH[i]);
+    strcat(Hexaloops, " ");
+    free(buf);
+    i++;
+  } while((r==3)&&(i<40));
+  return;
+}
+
+/*------------------------------------------------------------*/
+PRIVATE void  rd_Triloop37(void)
+{
+  int    i, r;
+  char   *buf;
+
+  i=0;
+  /* erase old hexaloop entries */
+  memset(&Triloops,   0, 241);
+  memset(&Triloop37,  0, sizeof(int)*40);
+  memset(&TriloopdH,  0, sizeof(int)*40);
+  do {
+    buf = vrna_read_line(fp);
+    if (buf==NULL) break;
+    r = sscanf(buf,"%5s %d %d", &Triloops[6*i], &Triloop37[i], &TriloopdH[i]);
+    strcat(Triloops, " ");
+    free(buf);
+    i++;
+  } while((r==3)&&(i<40));
+  return;
+}
+
+/*------------------------------------------------------------*/
+
+
+PRIVATE void ignore_comment(char * line)
+{
+  /* excise C style comments */
+  /* only one comment per line, no multiline comments */
+  char *cp1, *cp2;
+
+  if ((cp1=strstr(line, "/*"))) {
+    cp2 = strstr(cp1, "*/");
+    if (cp2==NULL)
+      vrna_message_error("unclosed comment in parameter file");
+    /* can't use strcpy for overlapping strings */
+    for (cp2+=2; *cp2!='\0'; cp2++, cp1++)
+      *cp1 = *cp2;
+    *cp1 = '\0';
+  }
+
+  return;
+}
+/*------------------------------------------------------------*/
+
+PUBLIC char *settype(enum parset s){
+  switch(s){
+    case        S:  return "stack";
+    case      S_H:  return "stack_enthalpies";
+    case       HP:  return "hairpin";
+    case     HP_H:  return "hairpin_enthalpies";
+    case        B:  return "bulge";
+    case      B_H:  return "bulge_enthalpies";
+    case       IL:  return "interior";
+    case     IL_H:  return "interior_enthalpies";
+    case      MME:  return "mismatch_exterior";
+    case    MME_H:  return "mismatch_exterior_enthalpies";
+    case      MMH:  return "mismatch_hairpin";
+    case    MMH_H:  return "mismatch_hairpin_enthalpies";
+    case      MMI:  return "mismatch_interior";
+    case    MMI_H:  return "mismatch_interior_enthalpies";
+    case    MMI1N:  return "mismatch_interior_1n";
+    case  MMI1N_H:  return "mismatch_interior_1n_enthalpies";
+    case    MMI23:  return "mismatch_interior_23";
+    case  MMI23_H:  return "mismatch_interior_23_enthalpies";
+    case      MMM:  return "mismatch_multi";
+    case    MMM_H:  return "mismatch_multi_enthalpies";
+    case       D5:  return "dangle5";
+    case     D5_H:  return "dangle5_enthalpies";
+    case       D3:  return "dangle3";
+    case     D3_H:  return "dangle3_enthalpies";
+    case    INT11:  return "int11";
+    case  INT11_H:  return "int11_enthalpies";
+    case    INT21:  return "int21";
+    case  INT21_H:  return "int21_enthalpies";
+    case    INT22:  return "int22";
+    case  INT22_H:  return "int22_enthalpies";
+    case       ML:  return "ML_params";
+    case      NIN:  return "NINIO";
+    case      TRI:  return "Triloops";
+    case       TL:  return "Tetraloops";
+    case      HEX:  return "Hexaloops";
+    case     QUIT:  return "END";
+    case     MISC:  return "Misc";
+    default: vrna_message_error("\nThe answer is: 42\n");
+  }
+  return "";
+}
+/*------------------------------------------------------------*/
+
+PUBLIC enum parset gettype(const char *ident){
+  if      (strcmp(ident,"stack") == 0)                            return S;
+  else if (strcmp(ident,"stack_enthalpies") == 0)                 return S_H;
+  else if (strcmp(ident,"hairpin") == 0)                          return HP;
+  else if (strcmp(ident,"hairpin_enthalpies") == 0)               return HP_H;
+  else if (strcmp(ident,"bulge") == 0)                            return B;
+  else if (strcmp(ident,"bulge_enthalpies") == 0)                 return B_H;
+  else if (strcmp(ident,"interior") == 0)                         return IL;
+  else if (strcmp(ident,"interior_enthalpies") == 0)              return IL_H;
+  else if (strcmp(ident,"mismatch_exterior") == 0)                return MME;
+  else if (strcmp(ident,"mismatch_exterior_enthalpies") == 0)     return MME_H;
+  else if (strcmp(ident,"mismatch_hairpin") == 0)                 return MMH;
+  else if (strcmp(ident,"mismatch_hairpin_enthalpies") == 0)      return MMH_H;
+  else if (strcmp(ident,"mismatch_interior") == 0)                return MMI;
+  else if (strcmp(ident,"mismatch_interior_enthalpies") == 0)     return MMI_H;
+  else if (strcmp(ident,"mismatch_interior_1n") == 0)             return MMI1N;
+  else if (strcmp(ident,"mismatch_interior_1n_enthalpies") == 0)  return MMI1N_H;
+  else if (strcmp(ident,"mismatch_interior_23") == 0)             return MMI23;
+  else if (strcmp(ident,"mismatch_interior_23_enthalpies") == 0)  return MMI23_H;
+  else if (strcmp(ident,"mismatch_multi") == 0)                   return MMM;
+  else if (strcmp(ident,"mismatch_multi_enthalpies") == 0)        return MMM_H;
+  else if (strcmp(ident,"int11") == 0)                            return INT11;
+  else if (strcmp(ident,"int11_enthalpies") == 0)                 return INT11_H;
+  else if (strcmp(ident,"int21") == 0)                            return INT21;
+  else if (strcmp(ident,"int21_enthalpies") == 0)                 return INT21_H;
+  else if (strcmp(ident,"int22") == 0)                            return INT22;
+  else if (strcmp(ident,"int22_enthalpies") == 0)                 return INT22_H;
+  else if (strcmp(ident,"dangle5")== 0)                           return D5;
+  else if (strcmp(ident,"dangle5_enthalpies")== 0)                return D5_H;
+  else if (strcmp(ident,"dangle3")== 0)                           return D3;
+  else if (strcmp(ident,"dangle3_enthalpies")== 0)                return D3_H;
+  else if (strcmp(ident,"ML_params")== 0)                         return ML;
+  else if (strcmp(ident,"NINIO") == 0)                            return NIN;
+  else if (strcmp(ident,"Triloops") == 0)                         return TRI;
+  else if (strcmp(ident,"Tetraloops") == 0)                       return TL;
+  else if (strcmp(ident,"Hexaloops") == 0)                        return HEX;
+  else if (strcmp(ident,"Misc") == 0)                             return MISC;
+  else if (strcmp(ident,"END") == 0)                              return QUIT;
+  else return UNKNOWN;
+}
+
+/*---------------------------------------------------------------*/
+
+PUBLIC void write_parameter_file(const char fname[]){
+  FILE *outfp;
+  int c;
+  char *pnames[] = {"NP", "CG", "GC", "GU", "UG", "AU", "UA", " @"};
+  char bnames[] = "@ACGU";
+  outfp = fopen(fname, "w");
+  if (!outfp) {
+    vrna_message_error("can't open file %s", fname);
+    exit(1);
+  }
+  fprintf(outfp,"## RNAfold parameter file v2.0\n");
+
+  fprintf(outfp,"\n# %s\n", settype(S));
+  fprintf(outfp,"/*  CG    GC    GU    UG    AU    UA    @  */\n");
+  for (c=1; c<NBPAIRS+1; c++)
+    display_array(stack37[c]+1,NBPAIRS,NBPAIRS, outfp);
+
+  fprintf(outfp,"\n# %s\n", settype(S_H));
+  fprintf(outfp,"/*  CG    GC    GU    UG    AU    UA    @  */\n");
+  for (c=1; c<NBPAIRS+1; c++)
+    display_array(stackdH[c]+1,NBPAIRS,NBPAIRS, outfp);
+
+  fprintf(outfp,"\n# %s\n", settype(MMH));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatchH37[k][i],5,5, outfp);
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(MMH_H));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatchHdH[k][i],5,5, outfp);
+
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(MMI));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatchI37[k][i],5,5, outfp);
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(MMI_H));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatchIdH[k][i],5,5, outfp);
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(MMI1N));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatch1nI37[k][i],5,5, outfp);
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(MMI1N_H));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatch1nIdH[k][i],5,5, outfp);
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(MMI23));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatch23I37[k][i],5,5, outfp);
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(MMI23_H));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatch23IdH[k][i],5,5, outfp);
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(MMM));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatchM37[k][i],5,5, outfp);
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(MMM_H));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatchMdH[k][i],5,5, outfp);
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(MME));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatchExt37[k][i],5,5, outfp);
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(MME_H));
+  { int i,k;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (i=0; i<5; i++)
+      display_array(mismatchExtdH[k][i],5,5, outfp);
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(D5));
+  fprintf(outfp,"/*  @     A     C     G     U   */\n");
+  for (c=1; c<NBPAIRS+1; c++)
+    display_array(dangle5_37[c], 5, 5, outfp);
+
+  fprintf(outfp,"\n# %s\n", settype(D5_H));
+  fprintf(outfp,"/*  @     A     C     G     U   */\n");
+  for (c=1; c<NBPAIRS+1; c++)
+    display_array(dangle5_dH[c], 5, 5, outfp);
+
+  fprintf(outfp,"\n# %s\n", settype(D3));
+  fprintf(outfp,"/*  @     A     C     G     U   */\n");
+  for (c=1; c<NBPAIRS+1; c++)
+    display_array(dangle3_37[c], 5, 5, outfp);
+
+  fprintf(outfp,"\n# %s\n", settype(D3_H));
+  fprintf(outfp,"/*  @     A     C     G     U   */\n");
+  for (c=1; c<NBPAIRS+1; c++)
+    display_array(dangle3_dH[c], 5, 5, outfp);
+
+
+  /* dont print "no pair" entries for interior loop arrays */
+  fprintf(outfp,"\n# %s\n", settype(INT11));
+  { int i,k,l;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (l=1; l<NBPAIRS+1; l++) {
+      fprintf(outfp, "/* %2s..%2s */\n", pnames[k], pnames[l]);
+      for (i=0; i<5; i++)
+        display_array(int11_37[k][l][i], 5, 5, outfp);
+    }
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(INT11_H));
+  { int i,k,l;
+  for (k=1; k<NBPAIRS+1; k++)
+    for (l=1; l<NBPAIRS+1; l++) {
+      fprintf(outfp, "/* %2s..%2s */\n", pnames[k], pnames[l]);
+      for (i=0; i<5; i++)
+        display_array(int11_dH[k][l][i],5,5, outfp);
+    }
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(INT21));
+  { int p1, p2, i, j;
+  for (p1=1; p1<NBPAIRS+1; p1++)
+    for (p2=1; p2<NBPAIRS+1; p2++)
+      for (i=0; i<5; i++) {
+        fprintf(outfp, "/* %2s.%c..%2s */\n",
+                pnames[p1], bnames[i], pnames[p2]);
+        for (j=0; j<5; j++)
+          display_array(int21_37[p1][p2][i][j],5,5, outfp);
+      }
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(INT21_H));
+  { int p1, p2, i, j;
+  for (p1=1; p1<NBPAIRS+1; p1++)
+    for (p2=1; p2<NBPAIRS+1; p2++)
+      for (i=0; i<5; i++) {
+        fprintf(outfp, "/* %2s.%c..%2s */\n",
+                pnames[p1], bnames[i], pnames[p2]);
+        for (j=0; j<5; j++)
+          display_array(int21_dH[p1][p2][i][j],5,5, outfp);
+      }
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(INT22));
+  { int p1, p2, i, j, k;
+  for (p1=1; p1<NBPAIRS; p1++)
+    for (p2=1; p2<NBPAIRS; p2++)
+      for (i=1; i<5; i++)
+        for (j=1; j<5; j++) {
+          fprintf(outfp, "/* %2s.%c%c..%2s */\n",
+                  pnames[p1], bnames[i], bnames[j], pnames[p2]);
+          for (k=1; k<5; k++)
+            display_array(int22_37[p1][p2][i][j][k]+1,4,5, outfp);
+        }
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(INT22_H));
+  { int p1, p2, i, j, k;
+  for (p1=1; p1<NBPAIRS; p1++)
+    for (p2=1; p2<NBPAIRS; p2++)
+      for (i=1; i<5; i++)
+        for (j=1; j<5; j++) {
+          fprintf(outfp, "/* %2s.%c%c..%2s */\n",
+                  pnames[p1], bnames[i], bnames[j], pnames[p2]);
+          for (k=1; k<5; k++)
+            display_array(int22_dH[p1][p2][i][j][k]+1,4,5, outfp);
+        }
+  }
+
+  fprintf(outfp,"\n# %s\n", settype(HP));
+  display_array(hairpin37, 31, 10, outfp);
+
+  fprintf(outfp,"\n# %s\n", settype(HP_H));
+  display_array(hairpindH, 31, 10, outfp);
+
+  fprintf(outfp,"\n# %s\n", settype(B));
+  display_array(bulge37, 31, 10, outfp);
+
+  fprintf(outfp,"\n# %s\n", settype(B_H));
+  display_array(bulgedH, 31, 10, outfp);
+
+  fprintf(outfp,"\n# %s\n", settype(IL));
+  display_array(internal_loop37, 31, 10, outfp);
+
+  fprintf(outfp,"\n# %s\n", settype(IL_H));
+  display_array(internal_loopdH, 31, 10, outfp);
+
+  fprintf(outfp,"\n# %s\n", settype(ML));
+  fprintf(outfp,"/* F = cu*n_unpaired + cc + ci*loop_degree (+TermAU) */\n");
+  fprintf(outfp,"/*\t    cu\t cu_dH\t    cc\t cc_dH\t    ci\t ci_dH  */\n");
+  fprintf(outfp,"\t%6d\t%6d\t%6d\t%6d\t%6d\t%6d\n", ML_BASE37, ML_BASEdH, ML_closing37, ML_closingdH, ML_intern37, ML_interndH);
+
+  fprintf(outfp,"\n# %s\n", settype(NIN));
+  fprintf(outfp,"/* Ninio = MIN(max, m*|n1-n2| */\n"
+              "/*\t    m\t  m_dH     max  */\n"
+              "\t%6d\t%6d\t%6d\n", ninio37, niniodH, MAX_NINIO);
+
+  fprintf(outfp,"\n# %s\n", settype(MISC));
+  fprintf(outfp,"/* all parameters are pairs of 'energy enthalpy' */\n");
+  fprintf(outfp,"/*    DuplexInit     TerminalAU      LXC */\n");
+  fprintf(outfp,"   %6d %6d %6d  %6d %3.6f %6d\n", DuplexInit37, DuplexInitdH, TerminalAU37, TerminalAUdH, lxc37, 0);
+
+  fprintf(outfp,"\n# %s\n", settype(HEX));
+  for (c=0; c< strlen(Hexaloops)/9; c++)
+    fprintf(outfp,"\t%.8s %6d %6d\n", Hexaloops+c*9, Hexaloop37[c], HexaloopdH[c]);
+
+  fprintf(outfp,"\n# %s\n", settype(TL));
+  for (c=0; c< strlen(Tetraloops)/7; c++)
+    fprintf(outfp,"\t%.6s %6d %6d\n", Tetraloops+c*7, Tetraloop37[c], TetraloopdH[c]);
+
+  fprintf(outfp,"\n# %s\n", settype(TRI));
+  for (c=0; c< strlen(Triloops)/6; c++)
+    fprintf(outfp,"\t%.5s %6d %6d\n", Triloops+c*6, Triloop37[c], TriloopdH[c]);
+
+  fprintf(outfp,"\n# %s\n", settype(QUIT));
+  fclose(outfp);
+}
+
+PRIVATE void check_symmetry(void) {
+  int i,j,k,l;
+
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      if (stack37[i][j] != stack37[j][i])
+        vrna_message_warning("stacking energies not symmetric");
+
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      if (stackdH[i][j] != stackdH[j][i])
+        vrna_message_warning("stacking enthalpies not symmetric");
+
+
+  /* interior 1x1 loops */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++)
+          if (int11_37[i][j][k][l] != int11_37[j][i][l][k])
+            vrna_message_warning("int11 energies not symmetric (%d,%d,%d,%d) (%d vs. %d)",
+                                        i, j, k, l, int11_37[i][j][k][l], int11_37[j][i][l][k]);
+
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++)
+          if (int11_dH[i][j][k][l] != int11_dH[j][i][l][k])
+            vrna_message_warning("int11 enthalpies not symmetric");
+
+  /* interior 2x2 loops */
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          int m,n;
+          for (m=0; m<5; m++)
+            for (n=0; n<5; n++)
+              if (int22_37[i][j][k][l][m][n] != int22_37[j][i][m][n][k][l])
+                vrna_message_warning("int22 energies not symmetric");
+        }
+
+  for (i=0; i<=NBPAIRS; i++)
+    for (j=0; j<=NBPAIRS; j++)
+      for (k=0; k<5; k++)
+        for (l=0; l<5; l++) {
+          int m,n;
+          for (m=0; m<5; m++)
+            for (n=0; n<5; n++)
+              if (int22_dH[i][j][k][l][m][n] != int22_dH[j][i][m][n][k][l])
+                vrna_message_warning("int22 enthalpies not symmetric: %d %d %d %d %d %d",
+                                            i,j,k,l,m,n);
+        }
+}
+
+/* update nonstandard nucleotide/basepair involved contributions for int22 */
+PRIVATE void update_nst(int array[NBPAIRS+1][NBPAIRS+1][5][5][5][5]){
+  int    i, j, k, l, m, n;
+  int max, max2, max3, max4, max5, max6;
+
+  /* get maxima for one nonstandard nucleotide */
+  for (i=1; i<NBPAIRS; i++){
+    for (j=1; j<NBPAIRS; j++){
+      for (k=1; k<5; k++){
+        for (l=1; l<5; l++){
+          for (m=1; m<5; m++){
+            max = max2 = max3 = max4 = -INF; /* max of {CGAU} */
+            for(n=1;n<5;n++){
+              max   = MAX2(max,   array[i][j][k][l][m][n]);
+              max2  = MAX2(max2,  array[i][j][k][l][n][m]);
+              max3  = MAX2(max3,  array[i][j][k][n][l][m]);
+              max4  = MAX2(max4,  array[i][j][n][k][l][m]);
+            }
+            array[i][j][k][l][m][0] = max;
+            array[i][j][k][l][0][m] = max2;
+            array[i][j][k][0][l][m] = max3;
+            array[i][j][0][k][l][m] = max4;
+          }
+        }
+      }
+    }
+  }
+  /* get maxima for two nonstandard nucleotides */
+  for (i=1; i<NBPAIRS; i++){
+    for (j=1; j<NBPAIRS; j++){
+      for (k=1; k<5; k++){
+        for (l=1; l<5; l++){
+          max = max2 = max3 = max4 = max5 = max6 = -INF; /* max of {CGAU} */
+          for (m=1; m<5; m++){
+            max   = MAX2(max,   array[i][j][k][l][m][0]);
+            max2  = MAX2(max2,  array[i][j][k][m][0][l]);
+            max3  = MAX2(max3,  array[i][j][m][0][k][l]);
+            max4  = MAX2(max4,  array[i][j][0][k][l][m]);
+            max5  = MAX2(max5,  array[i][j][0][k][m][l]);
+            max6  = MAX2(max6,  array[i][j][k][0][l][m]);
+          }
+          array[i][j][k][l][0][0] = max;
+          array[i][j][k][0][0][l] = max2;
+          array[i][j][0][0][k][l] = max3;
+          array[i][j][k][0][l][0] = max6;
+          array[i][j][0][k][0][l] = max5;
+          array[i][j][0][k][l][0] = max4;
+        }
+      }
+    }
+  }
+  /* get maxima for three nonstandard nucleotides */
+  for (i=1; i<NBPAIRS; i++){
+    for (j=1; j<NBPAIRS; j++){
+      for (k=1; k<5; k++){
+        max = max2 = max3 = max4 = -INF; /* max of {CGAU} */
+        for (l=1; l<5; l++){
+          /* should be arbitrary where index l resides in last 3 possible locations */
+          max   = MAX2(max,   array[i][j][k][l][0][0]);
+          max2  = MAX2(max2,  array[i][j][0][k][l][0]);
+          max3  = MAX2(max3,  array[i][j][0][0][k][l]);
+          max4  = MAX2(max4,  array[i][j][0][0][l][k]);
+        }
+        array[i][j][k][0][0][0] = max;
+        array[i][j][0][k][0][0] = max2;
+        array[i][j][0][0][k][0] = max3;
+        array[i][j][0][0][0][k] = max4;
+      }
+    }
+  }
+  /* get maxima for 4 nonstandard nucleotides */
+  for (i=1; i<NBPAIRS; i++){
+    for (j=1; j<NBPAIRS; j++){
+      max = -INF; /* max of {CGAU} */
+      for (k=1; k<5; k++){
+        max   = MAX2(max,   array[i][j][k][0][0][0]);
+      }
+      array[i][j][0][0][0][0] = max;
+    }
+  }
+
+  /* now compute contributions for nonstandard base pairs ... */
+  /* first, 1 nonstandard bp */
+  for (i=1; i<NBPAIRS; i++){
+    for (k=0; k<5; k++){
+      for (l=0; l<5; l++){
+        for (m=0; m<5; m++){
+          for(n=0;n<5;n++){
+            max = max2 = -INF;
+            for(j=1;j<NBPAIRS;j++){
+              max   = MAX2(max, array[i][j][k][l][m][n]);
+              max2  = MAX2(max2, array[j][i][k][l][m][n]);
+            }
+            array[i][NBPAIRS][k][l][m][n] = max;
+            array[NBPAIRS][i][k][l][m][n] = max2;
+          }
+        }
+      }
+    }
+  }
+
+  /* now 2 nst base pairs */
+  for (k=0; k<5; k++){
+    for (l=0; l<5; l++){
+      for (m=0; m<5; m++){
+        for(n=0;n<5;n++){
+          max = -INF;
+          for(j=1;j<NBPAIRS;j++){
+            max   = MAX2(max, array[NBPAIRS][j][k][l][m][n]);
+          }
+          array[NBPAIRS][NBPAIRS][k][l][m][n] = max;
+        }
+      }
+    }
+  }
+
+}
diff --git a/C/ViennaRNA/read_epars.h b/C/ViennaRNA/read_epars.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/read_epars.h
@@ -0,0 +1,62 @@
+#ifndef VIENNA_RNA_PACKAGE_READ_EPARS_H
+#define VIENNA_RNA_PACKAGE_READ_EPARS_H
+
+/**
+ *  @file     read_epars.h
+ *  @ingroup  energy_parameters
+ *  @brief    Read and write energy parameter files
+ */
+
+/**
+ *  @addtogroup energy_parameters_rw
+ *  @brief  Read and Write energy parameter sets from and to text files
+ *
+ *  A default set of parameters, identical to the one described in
+ *  @cite mathews:2004 and @cite turner:2010, is compiled into the library.
+ *
+ *  @{
+ *  @ingroup  energy_parameters_rw
+ */
+
+/**
+ *  @brief
+ *
+ */
+enum parset {
+  UNKNOWN= -1, QUIT,
+  S, S_H, HP, HP_H, B, B_H, IL, IL_H, MMH, MMH_H, MMI, MMI_H,
+  MMI1N, MMI1N_H, MMI23, MMI23_H, MMM, MMM_H, MME, MME_H, D5, D5_H, D3, D3_H,
+  INT11, INT11_H, INT21, INT21_H, INT22, INT22_H, ML, TL,
+  TRI, HEX, NIN, MISC};
+
+/**
+ *  @brief Read energy parameters from a file
+ * 
+ *  @param fname  The path to the file containing the energy parameters
+ */
+void  read_parameter_file(const char fname[]);
+
+/**
+ *  @brief Write energy parameters to a file
+ * 
+ *  @param fname  A filename (path) for the file where the current energy parameters will be written to
+ */
+void  write_parameter_file(const char fname[]);
+
+/**
+ *  @brief
+ *
+ */
+enum  parset gettype(const char *ident);
+
+/**
+ *  @brief
+ *
+ */
+char  *settype(enum parset s);
+
+/**
+ *  @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/ribo.c b/C/ViennaRNA/ribo.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/ribo.c
@@ -0,0 +1,1134 @@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/ribo.h"
+
+static float dm_12_5[7][7]={{0,0,0,0,0,0,0},
+{0, 3.092536, 3.375764, 1.374085, 0.681999, 2.357501, 2.759147},
+{0, 3.375764, 3.223949, 1.077220, 0.713622, 2.742085, 2.325847},
+{0, 1.374085, 1.077220, 0.801987, -0.251514, 0.289428, 0.641530},
+{0, 0.681999, 0.713622, -0.251514, 1.203844, -0.228733, 0.292522},
+{0, 2.357501, 2.742085, 0.289428, -0.228733, 1.511221, 1.958625},
+{0, 2.759147, 2.325847, 0.641530, 0.292522, 1.958625, 1.948208}};
+static float dm_12_6[7][7]={{0,0,0,0,0,0,0},
+{0, 3.092373, 3.375631, 1.374059, 0.681938, 2.357565, 2.759217},
+{0, 3.375631, 3.223782, 1.077212, 0.713641, 2.742133, 2.325829},
+{0, 1.374059, 1.077212, 0.801954, -0.251326, 0.289489, 0.641712},
+{0, 0.681938, 0.713641, -0.251326, 1.203723, -0.228872, 0.292526},
+{0, 2.357565, 2.742133, 0.289489, -0.228872, 1.511158, 1.958685},
+{0, 2.759217, 2.325829, 0.641712, 0.292526, 1.958685, 1.948130}};
+static float dm_12_7[7][7]={{0,0,0,0,0,0,0},
+{0, 3.053179, 3.352207, 1.390738, 0.684033, 2.353429, 2.765638},
+{0, 3.352207, 3.188833, 1.115659, 0.689646, 2.742801, 2.338308},
+{0, 1.390738, 1.115659, 0.803823, -0.192463, 0.312652, 0.698703},
+{0, 0.684033, 0.689646, -0.192463, 1.107424, -0.189709, 0.302683},
+{0, 2.353429, 2.742801, 0.312652, -0.189709, 1.453439, 1.907102},
+{0, 2.765638, 2.338308, 0.698703, 0.302683, 1.907102, 1.850447}};
+static float dm_12_8[7][7]={{0,0,0,0,0,0,0},
+{0, 3.049303, 3.270569, 1.417231, 0.666003, 2.313534, 2.891832},
+{0, 3.270569, 3.186336, 1.047878, 0.717329, 2.806323, 2.360206},
+{0, 1.417231, 1.047878, 0.718061, -0.168063, 0.238106, 0.821674},
+{0, 0.666003, 0.717329, -0.168063, 0.995556, 0.010346, 0.171852},
+{0, 2.313534, 2.806323, 0.238106, 0.010346, 1.361999, 1.906834},
+{0, 2.891832, 2.360206, 0.821674, 0.171852, 1.906834, 1.745436}};
+static float dm_12_9[7][7]={{0,0,0,0,0,0,0},
+{0, 3.165100, 3.153340, 1.293645, 0.683711, 2.215911, 3.082474},
+{0, 3.153340, 3.304615, 1.071703, 0.672898, 2.978487, 2.330174},
+{0, 1.293645, 1.071703, 0.684991, -0.294258, 0.196122, 0.756948},
+{0, 0.683711, 0.672898, -0.294258, 1.089387, 0.034000, 0.046088},
+{0, 2.215911, 2.978487, 0.196122, 0.034000, 1.457778, 1.997389},
+{0, 3.082474, 2.330174, 0.756948, 0.046088, 1.997389, 1.860867}};
+static float dm_12_10[7][7]={{0,0,0,0,0,0,0},
+{0, 3.316050, 3.080141, 1.198316, 0.719889, 2.155618, 3.134309},
+{0, 3.080141, 3.404347, 1.108233, 0.637222, 2.938360, 2.294410},
+{0, 1.198316, 1.108233, 0.657620, -0.563942, 0.269879, 0.776661},
+{0, 0.719889, 0.637222, -0.563942, 1.170892, 0.077878, -0.014940},
+{0, 2.155618, 2.938360, 0.269879, 0.077878, 1.631701, 2.093486},
+{0, 3.134309, 2.294410, 0.776661, -0.014940, 2.093486, 2.008351}};
+static float dm_12_11[7][7]={{0,0,0,0,0,0,0},
+{0, 4.453617, 3.036904, 0.865118, 0.725919, 2.140436, 3.324865},
+{0, 3.036904, 4.352423, 0.749665, 0.059865, 2.923511, 2.308393},
+{0, 0.865118, 0.749665, 0.722300, -1.323178, 0.374187, 0.426083},
+{0, 0.725919, 0.059865, -1.323178, 1.727563, -0.428759, 0.330746},
+{0, 2.140436, 2.923511, 0.374187, -0.428759, 2.428389, 2.233568},
+{0, 3.324865, 2.308393, 0.426083, 0.330746, 2.233568, 2.821057}};
+static float dm_13_5[7][7]={{0,0,0,0,0,0,0},
+{0, 2.533782, 3.282896, 1.521364, 0.752652, 2.264693, 2.589635},
+{0, 3.282896, 2.711135, 0.952877, 1.215201, 2.545641, 2.334410},
+{0, 1.521364, 0.952877, 0.827991, 0.183827, 0.378211, 0.794884},
+{0, 0.752652, 1.215201, 0.183827, 0.819462, 0.368008, 0.475756},
+{0, 2.264693, 2.545641, 0.378211, 0.368008, 1.007668, 1.732095},
+{0, 2.589635, 2.334410, 0.794884, 0.475756, 1.732095, 1.315666}};
+static float dm_13_6[7][7]={{0,0,0,0,0,0,0},
+{0, 2.533730, 3.282872, 1.521367, 0.752640, 2.264708, 2.589641},
+{0, 3.282872, 2.711079, 0.952872, 1.215222, 2.545643, 2.334410},
+{0, 1.521367, 0.952872, 0.827971, 0.183877, 0.378217, 0.794922},
+{0, 0.752640, 1.215222, 0.183877, 0.819423, 0.368018, 0.475753},
+{0, 2.264708, 2.545643, 0.378217, 0.368018, 1.007640, 1.732099},
+{0, 2.589641, 2.334410, 0.794922, 0.475753, 1.732099, 1.315634}};
+static float dm_13_7[7][7]={{0,0,0,0,0,0,0},
+{0, 2.517035, 3.288237, 1.534295, 0.752649, 2.264114, 2.587804},
+{0, 3.288237, 2.694998, 0.956805, 1.227789, 2.542543, 2.336350},
+{0, 1.534295, 0.956805, 0.820438, 0.200329, 0.379706, 0.803818},
+{0, 0.752649, 1.227789, 0.200329, 0.797982, 0.376972, 0.476299},
+{0, 2.264114, 2.542543, 0.379706, 0.376972, 0.988104, 1.718544},
+{0, 2.587804, 2.336350, 0.803818, 0.476299, 1.718544, 1.288938}};
+static float dm_13_8[7][7]={{0,0,0,0,0,0,0},
+{0, 2.455141, 3.267199, 1.550791, 0.740489, 2.281213, 2.624344},
+{0, 3.267199, 2.639092, 0.938981, 1.263224, 2.561521, 2.363191},
+{0, 1.550791, 0.938981, 0.771171, 0.200008, 0.376450, 0.811315},
+{0, 0.740489, 1.263224, 0.200008, 0.754473, 0.422913, 0.493286},
+{0, 2.281213, 2.561521, 0.376450, 0.422913, 0.922402, 1.721243},
+{0, 2.624344, 2.363191, 0.811315, 0.493286, 1.721243, 1.225387}};
+static float dm_13_9[7][7]={{0,0,0,0,0,0,0},
+{0, 2.379212, 3.195011, 1.477942, 0.732266, 2.283994, 2.699509},
+{0, 3.195011, 2.577100, 0.912791, 1.272057, 2.625508, 2.371223},
+{0, 1.477942, 0.912791, 0.737835, 0.193712, 0.381625, 0.838647},
+{0, 0.732266, 1.272057, 0.193712, 0.719631, 0.491776, 0.516184},
+{0, 2.283994, 2.625508, 0.381625, 0.491776, 0.889747, 1.759331},
+{0, 2.699509, 2.371223, 0.838647, 0.516184, 1.759331, 1.193323}};
+static float dm_13_10[7][7]={{0,0,0,0,0,0,0},
+{0, 2.280425, 3.074698, 1.281893, 0.750335, 2.294618, 2.818548},
+{0, 3.074698, 2.501446, 0.902613, 1.237324, 2.733365, 2.420051},
+{0, 1.281893, 0.902613, 0.663356, 0.025119, 0.436734, 0.946242},
+{0, 0.750335, 1.237324, 0.025119, 0.634862, 0.635376, 0.587841},
+{0, 2.294618, 2.733365, 0.436734, 0.635376, 0.851475, 1.822634},
+{0, 2.818548, 2.420051, 0.946242, 0.587841, 1.822634, 1.133656}};
+static float dm_13_11[7][7]={{0,0,0,0,0,0,0},
+{0, 2.049420, 3.065598, 1.147184, 0.984070, 2.286178, 2.745107},
+{0, 3.065598, 2.349472, 0.907685, 1.527069, 2.637071, 2.291610},
+{0, 1.147184, 0.907685, 0.583508, 0.290374, 0.432797, 0.907368},
+{0, 0.984070, 1.527069, 0.290374, 0.528508, 0.783625, 0.671962},
+{0, 2.286178, 2.637071, 0.432797, 0.783625, 0.749801, 1.701156},
+{0, 2.745107, 2.291610, 0.907368, 0.671962, 1.701156, 0.981579}};
+static float dm_13_12[7][7]={{0,0,0,0,0,0,0},
+{0, 1.904683, 3.147814, 1.383470, 0.788061, 2.230640, 2.516545},
+{0, 3.147814, 2.158800, 1.031644, 1.913906, 2.492254, 1.996584},
+{0, 1.383470, 1.031644, 0.332441, 0.746301, 0.435514, 0.879258},
+{0, 0.788061, 1.913906, 0.746301, 0.496698, 0.960208, 0.630473},
+{0, 2.230640, 2.492254, 0.435514, 0.960208, 0.830695, 1.541673},
+{0, 2.516545, 1.996584, 0.879258, 0.630473, 1.541673, 0.887994}};
+static float dm_14_5[7][7]={{0,0,0,0,0,0,0},
+{0, 2.294989, 3.205559, 1.584266, 0.734475, 2.289599, 2.535028},
+{0, 3.205559, 2.485328, 0.891295, 1.466901, 2.470993, 2.328167},
+{0, 1.584266, 0.891295, 0.759635, 0.320177, 0.322250, 0.907780},
+{0, 0.734475, 1.466901, 0.320177, 0.770910, 0.521607, 0.411958},
+{0, 2.289599, 2.470993, 0.322250, 0.521607, 0.900558, 1.829543},
+{0, 2.535028, 2.328167, 0.907780, 0.411958, 1.829543, 1.149384}};
+static float dm_14_6[7][7]={{0,0,0,0,0,0,0},
+{0, 2.294961, 3.205540, 1.584268, 0.734469, 2.289603, 2.535026},
+{0, 3.205540, 2.485292, 0.891288, 1.466911, 2.470989, 2.328168},
+{0, 1.584268, 0.891288, 0.759627, 0.320205, 0.322258, 0.907802},
+{0, 0.734469, 1.466911, 0.320205, 0.770895, 0.521619, 0.411961},
+{0, 2.289603, 2.470989, 0.322258, 0.521619, 0.900543, 1.829549},
+{0, 2.535026, 2.328168, 0.907802, 0.411961, 1.829549, 1.149367}};
+static float dm_14_7[7][7]={{0,0,0,0,0,0,0},
+{0, 2.284183, 3.205463, 1.589806, 0.733327, 2.290173, 2.534179},
+{0, 3.205463, 2.474571, 0.891349, 1.473391, 2.469534, 2.329742},
+{0, 1.589806, 0.891349, 0.754092, 0.329639, 0.323746, 0.913721},
+{0, 0.733327, 1.473391, 0.329639, 0.760515, 0.527766, 0.413001},
+{0, 2.290173, 2.469534, 0.323746, 0.527766, 0.890631, 1.825071},
+{0, 2.534179, 2.329742, 0.913721, 0.413001, 1.825071, 1.136190}};
+static float dm_14_8[7][7]={{0,0,0,0,0,0,0},
+{0, 2.235726, 3.181914, 1.595503, 0.722770, 2.300997, 2.546218},
+{0, 3.181914, 2.427845, 0.875999, 1.494647, 2.473461, 2.342035},
+{0, 1.595503, 0.875999, 0.724803, 0.342682, 0.323718, 0.932708},
+{0, 0.722770, 1.494647, 0.342682, 0.734102, 0.566070, 0.421129},
+{0, 2.300997, 2.473461, 0.323718, 0.566070, 0.855249, 1.842018},
+{0, 2.546218, 2.342035, 0.932708, 0.421129, 1.842018, 1.098536}};
+static float dm_14_9[7][7]={{0,0,0,0,0,0,0},
+{0, 2.169213, 3.125506, 1.561668, 0.710360, 2.315725, 2.570925},
+{0, 3.125506, 2.366074, 0.850145, 1.506427, 2.491705, 2.351458},
+{0, 1.561668, 0.850145, 0.699815, 0.342923, 0.328538, 0.974691},
+{0, 0.710360, 1.506427, 0.342923, 0.708392, 0.630838, 0.430721},
+{0, 2.315725, 2.491705, 0.328538, 0.630838, 0.830805, 1.888777},
+{0, 2.570925, 2.351458, 0.974691, 0.430721, 1.888777, 1.064891}};
+static float dm_14_10[7][7]={{0,0,0,0,0,0,0},
+{0, 2.121401, 3.097557, 1.560258, 0.689908, 2.317536, 2.630291},
+{0, 3.097557, 2.307448, 0.784748, 1.536794, 2.544322, 2.395549},
+{0, 1.560258, 0.784748, 0.636637, 0.281228, 0.337831, 0.965036},
+{0, 0.689908, 1.536794, 0.281228, 0.656827, 0.697208, 0.440900},
+{0, 2.317536, 2.544322, 0.337831, 0.697208, 0.832763, 1.933003},
+{0, 2.630291, 2.395549, 0.965036, 0.440900, 1.933003, 1.020585}};
+static float dm_14_11[7][7]={{0,0,0,0,0,0,0},
+{0, 2.073657, 3.129452, 1.652733, 0.683925, 2.335236, 2.616220},
+{0, 3.129452, 2.249754, 0.745361, 1.637265, 2.557071, 2.392472},
+{0, 1.652733, 0.745361, 0.597976, 0.222713, 0.343902, 0.889990},
+{0, 0.683925, 1.637265, 0.222713, 0.624604, 0.786781, 0.435623},
+{0, 2.335236, 2.557071, 0.343902, 0.786781, 0.831075, 1.905111},
+{0, 2.616220, 2.392472, 0.889990, 0.435623, 1.905111, 0.955225}};
+static float dm_14_12[7][7]={{0,0,0,0,0,0,0},
+{0, 2.029277, 3.087264, 1.718185, 0.587838, 2.396044, 2.545040},
+{0, 3.087264, 2.177344, 0.725318, 1.676438, 2.547083, 2.447849},
+{0, 1.718185, 0.725318, 0.542734, 0.219786, 0.369477, 0.869417},
+{0, 0.587838, 1.676438, 0.219786, 0.608994, 0.859758, 0.368574},
+{0, 2.396044, 2.547083, 0.369477, 0.859758, 0.842019, 2.027160},
+{0, 2.545040, 2.447849, 0.869417, 0.368574, 2.027160, 0.909170}};
+static float dm_14_13[7][7]={{0,0,0,0,0,0,0},
+{0, 2.000248, 3.122593, 1.864659, 0.494490, 2.479114, 2.554107},
+{0, 3.122593, 2.129482, 0.626369, 1.637370, 2.548600, 2.565048},
+{0, 1.864659, 0.626369, 0.454571, 0.172183, 0.351022, 0.794287},
+{0, 0.494490, 1.637370, 0.172183, 0.671707, 0.748383, 0.198126},
+{0, 2.479114, 2.548600, 0.351022, 0.748383, 0.846495, 2.353506},
+{0, 2.554107, 2.565048, 0.794287, 0.198126, 2.353506, 0.877777}};
+static float dm_15_5[7][7]={{0,0,0,0,0,0,0},
+{0, 2.185017, 3.256348, 1.588804, 0.666905, 2.355718, 2.520031},
+{0, 3.256348, 2.374070, 0.850906, 1.551282, 2.511878, 2.371123},
+{0, 1.588804, 0.850906, 0.689517, 0.366678, 0.267602, 0.985305},
+{0, 0.666905, 1.551282, 0.366678, 0.702683, 0.582839, 0.372196},
+{0, 2.355718, 2.511878, 0.267602, 0.582839, 0.778425, 1.871858},
+{0, 2.520031, 2.371123, 0.985305, 0.372196, 1.871858, 1.031343}};
+static float dm_15_6[7][7]={{0,0,0,0,0,0,0},
+{0, 2.184997, 3.256344, 1.588807, 0.666901, 2.355725, 2.520032},
+{0, 3.256344, 2.374049, 0.850901, 1.551289, 2.511879, 2.371126},
+{0, 1.588807, 0.850901, 0.689501, 0.366694, 0.267601, 0.985320},
+{0, 0.666901, 1.551289, 0.366694, 0.702666, 0.582848, 0.372191},
+{0, 2.355725, 2.511879, 0.267601, 0.582848, 0.778413, 1.871866},
+{0, 2.520032, 2.371126, 0.985320, 0.372191, 1.871866, 1.031328}};
+static float dm_15_7[7][7]={{0,0,0,0,0,0,0},
+{0, 2.178225, 3.255949, 1.591734, 0.666172, 2.356327, 2.519434},
+{0, 3.255949, 2.367187, 0.850656, 1.554802, 2.511035, 2.372193},
+{0, 1.591734, 0.850656, 0.685901, 0.372252, 0.268459, 0.988985},
+{0, 0.666172, 1.554802, 0.372252, 0.696898, 0.586767, 0.372815},
+{0, 2.356327, 2.511035, 0.268459, 0.586767, 0.772770, 1.869928},
+{0, 2.519434, 2.372193, 0.988985, 0.372815, 1.869928, 1.024003}};
+static float dm_15_8[7][7]={{0,0,0,0,0,0,0},
+{0, 2.141127, 3.237374, 1.592766, 0.658485, 2.364123, 2.524356},
+{0, 3.237374, 2.330108, 0.840158, 1.565238, 2.512924, 2.380899},
+{0, 1.592766, 0.840158, 0.665322, 0.384438, 0.266965, 1.010245},
+{0, 0.658485, 1.565238, 0.384438, 0.677947, 0.617501, 0.377062},
+{0, 2.364123, 2.512924, 0.266965, 0.617501, 0.748457, 1.886645},
+{0, 2.524356, 2.380899, 1.010245, 0.377062, 1.886645, 0.998685}};
+static float dm_15_9[7][7]={{0,0,0,0,0,0,0},
+{0, 2.082602, 3.194686, 1.571476, 0.645533, 2.377215, 2.534602},
+{0, 3.194686, 2.272916, 0.822962, 1.573341, 2.520912, 2.393028},
+{0, 1.571476, 0.822962, 0.640049, 0.397585, 0.269078, 1.050093},
+{0, 0.645533, 1.573341, 0.397585, 0.651218, 0.668684, 0.385365},
+{0, 2.377215, 2.520912, 0.269078, 0.668684, 0.720559, 1.929423},
+{0, 2.534602, 2.393028, 1.050093, 0.385365, 1.929423, 0.964692}};
+static float dm_15_10[7][7]={{0,0,0,0,0,0,0},
+{0, 2.011980, 3.208890, 1.586936, 0.614653, 2.410291, 2.569991},
+{0, 3.208890, 2.192435, 0.783958, 1.618693, 2.560039, 2.439652},
+{0, 1.586936, 0.783958, 0.566237, 0.382907, 0.271841, 1.006087},
+{0, 0.614653, 1.618693, 0.382907, 0.581074, 0.728724, 0.387583},
+{0, 2.410291, 2.560039, 0.271841, 0.728724, 0.689985, 1.958203},
+{0, 2.569991, 2.439652, 1.006087, 0.387583, 1.958203, 0.901393}};
+static float dm_15_11[7][7]={{0,0,0,0,0,0,0},
+{0, 1.960846, 3.364729, 1.711101, 0.580163, 2.436976, 2.568375},
+{0, 3.364729, 2.127484, 0.757940, 1.724525, 2.572193, 2.449286},
+{0, 1.711101, 0.757940, 0.506015, 0.306759, 0.248888, 0.900846},
+{0, 0.580163, 1.724525, 0.306759, 0.515784, 0.796313, 0.387969},
+{0, 2.436976, 2.572193, 0.248888, 0.796313, 0.651734, 1.900198},
+{0, 2.568375, 2.449286, 0.900846, 0.387969, 1.900198, 0.825616}};
+static float dm_15_12[7][7]={{0,0,0,0,0,0,0},
+{0, 1.905112, 3.368458, 1.738759, 0.521209, 2.469970, 2.532597},
+{0, 3.368458, 2.057336, 0.733674, 1.764054, 2.567498, 2.475677},
+{0, 1.738759, 0.733674, 0.452960, 0.356533, 0.263124, 0.915940},
+{0, 0.521209, 1.764054, 0.356533, 0.468384, 0.825416, 0.393747},
+{0, 2.469970, 2.567498, 0.263124, 0.825416, 0.620497, 1.933061},
+{0, 2.532597, 2.475677, 0.915940, 0.393747, 1.933061, 0.776274}};
+static float dm_15_13[7][7]={{0,0,0,0,0,0,0},
+{0, 1.764334, 3.521734, 1.844636, 0.465089, 2.475371, 2.501349},
+{0, 3.521734, 1.899254, 0.652013, 1.866354, 2.519286, 2.498764},
+{0, 1.844636, 0.652013, 0.373857, 0.494613, 0.240469, 1.003296},
+{0, 0.465089, 1.866354, 0.494613, 0.346332, 0.823497, 0.447243},
+{0, 2.475371, 2.519286, 0.240469, 0.823497, 0.468987, 1.894554},
+{0, 2.501349, 2.498764, 1.003296, 0.447243, 1.894554, 0.650703}};
+static float dm_15_14[7][7]={{0,0,0,0,0,0,0},
+{0, 1.753217, 3.560554, 1.890084, 0.497526, 2.482621, 2.508029},
+{0, 3.560554, 1.886087, 0.571603, 1.903238, 2.518939, 2.505216},
+{0, 1.890084, 0.571603, 0.375259, 0.535512, 0.227112, 1.009415},
+{0, 0.497526, 1.903238, 0.535512, 0.355054, 0.732221, 0.497356},
+{0, 2.482621, 2.518939, 0.227112, 0.732221, 0.453713, 1.824189},
+{0, 2.508029, 2.505216, 1.009415, 0.497356, 1.824189, 0.649442}};
+static float dm_16_5[7][7]={{0,0,0,0,0,0,0},
+{0, 2.096356, 3.297512, 1.643277, 0.627608, 2.425850, 2.531892},
+{0, 3.297512, 2.277720, 0.776768, 1.578330, 2.507998, 2.381738},
+{0, 1.643277, 0.776768, 0.652789, 0.376193, 0.205475, 1.050591},
+{0, 0.627608, 1.578330, 0.376193, 0.635057, 0.695045, 0.328657},
+{0, 2.425850, 2.507998, 0.205475, 0.695045, 0.647026, 1.971812},
+{0, 2.531892, 2.381738, 1.050591, 0.328657, 1.971812, 0.893562}};
+static float dm_16_6[7][7]={{0,0,0,0,0,0,0},
+{0, 2.096346, 3.297510, 1.643276, 0.627604, 2.425854, 2.531894},
+{0, 3.297510, 2.277709, 0.776764, 1.578331, 2.508000, 2.381737},
+{0, 1.643276, 0.776764, 0.652783, 0.376197, 0.205477, 1.050597},
+{0, 0.627604, 1.578331, 0.376197, 0.635048, 0.695048, 0.328658},
+{0, 2.425854, 2.508000, 0.205477, 0.695048, 0.647022, 1.971820},
+{0, 2.531894, 2.381737, 1.050597, 0.328658, 1.971820, 0.893558}};
+static float dm_16_7[7][7]={{0,0,0,0,0,0,0},
+{0, 2.092914, 3.296980, 1.644541, 0.627228, 2.426164, 2.531487},
+{0, 3.296980, 2.274181, 0.776531, 1.579823, 2.507496, 2.382211},
+{0, 1.644541, 0.776531, 0.650930, 0.378902, 0.205995, 1.052513},
+{0, 0.627228, 1.579823, 0.378902, 0.632483, 0.697137, 0.329046},
+{0, 2.426164, 2.507496, 0.205995, 0.697137, 0.644461, 1.971311},
+{0, 2.531487, 2.382211, 1.052513, 0.329046, 1.971311, 0.890302}};
+static float dm_16_8[7][7]={{0,0,0,0,0,0,0},
+{0, 2.073428, 3.286494, 1.644950, 0.623462, 2.430093, 2.532505},
+{0, 3.286494, 2.254339, 0.771248, 1.583832, 2.507212, 2.385719},
+{0, 1.644950, 0.771248, 0.640496, 0.385785, 0.205764, 1.064654},
+{0, 0.623462, 1.583832, 0.385785, 0.622568, 0.714265, 0.331069},
+{0, 2.430093, 2.507212, 0.205764, 0.714265, 0.632331, 1.982670},
+{0, 2.532505, 2.385719, 1.064654, 0.331069, 1.982670, 0.877393}};
+static float dm_16_9[7][7]={{0,0,0,0,0,0,0},
+{0, 2.040939, 3.265472, 1.637410, 0.615748, 2.438042, 2.535927},
+{0, 3.265472, 2.221433, 0.760900, 1.588059, 2.509252, 2.391099},
+{0, 1.637410, 0.760900, 0.625103, 0.394320, 0.206172, 1.085801},
+{0, 0.615748, 1.588059, 0.394320, 0.606102, 0.744667, 0.334067},
+{0, 2.438042, 2.509252, 0.206172, 0.744667, 0.614764, 2.010608},
+{0, 2.535927, 2.391099, 1.085801, 0.334067, 2.010608, 0.856570}};
+static float dm_16_10[7][7]={{0,0,0,0,0,0,0},
+{0, 1.929517, 3.299150, 1.679136, 0.598406, 2.478683, 2.546578},
+{0, 3.299150, 2.091719, 0.711831, 1.702824, 2.519268, 2.443818},
+{0, 1.679136, 0.711831, 0.530571, 0.408434, 0.197624, 1.036293},
+{0, 0.598406, 1.702824, 0.408434, 0.495823, 0.861514, 0.331873},
+{0, 2.478683, 2.519268, 0.197624, 0.861514, 0.535526, 2.017192},
+{0, 2.546578, 2.443818, 1.036293, 0.331873, 2.017192, 0.751594}};
+static float dm_16_11[7][7]={{0,0,0,0,0,0,0},
+{0, 1.790624, 3.419792, 1.804745, 0.585040, 2.511724, 2.507394},
+{0, 3.419792, 1.936325, 0.655038, 1.866549, 2.481327, 2.473116},
+{0, 1.804745, 0.655038, 0.440211, 0.419147, 0.190157, 0.999819},
+{0, 0.585040, 1.866549, 0.419147, 0.384589, 0.972519, 0.349591},
+{0, 2.511724, 2.481327, 0.190157, 0.972519, 0.439998, 1.950823},
+{0, 2.507394, 2.473116, 0.999819, 0.349591, 1.950823, 0.634690}};
+static float dm_16_12[7][7]={{0,0,0,0,0,0,0},
+{0, 1.738485, 3.413306, 1.823292, 0.565589, 2.524720, 2.483688},
+{0, 3.413306, 1.875156, 0.624931, 1.902547, 2.464176, 2.477746},
+{0, 1.823292, 0.624931, 0.407593, 0.460985, 0.201735, 1.024667},
+{0, 0.565589, 1.902547, 0.460985, 0.347262, 1.021166, 0.354417},
+{0, 2.524720, 2.464176, 0.201735, 1.021166, 0.409784, 1.969276},
+{0, 2.483688, 2.477746, 1.024667, 0.354417, 1.969276, 0.597237}};
+static float dm_16_13[7][7]={{0,0,0,0,0,0,0},
+{0, 1.664768, 3.405759, 1.848635, 0.546367, 2.518192, 2.460663},
+{0, 3.405759, 1.785451, 0.567988, 1.961108, 2.436129, 2.469090},
+{0, 1.848635, 0.567988, 0.373320, 0.524553, 0.220489, 1.071079},
+{0, 0.546367, 1.961108, 0.524553, 0.294419, 1.099707, 0.370092},
+{0, 2.518192, 2.436129, 0.220489, 1.099707, 0.364109, 1.982751},
+{0, 2.460663, 2.469090, 1.071079, 0.370092, 1.982751, 0.552731}};
+static float dm_16_14[7][7]={{0,0,0,0,0,0,0},
+{0, 1.586401, 3.322065, 1.884482, 0.570145, 2.512906, 2.427617},
+{0, 3.322065, 1.692728, 0.531570, 1.996685, 2.415287, 2.448701},
+{0, 1.884482, 0.531570, 0.352236, 0.601762, 0.215346, 1.113649},
+{0, 0.570145, 1.996685, 0.601762, 0.269440, 1.208804, 0.368633},
+{0, 2.512906, 2.415287, 0.215346, 1.208804, 0.308130, 2.023351},
+{0, 2.427617, 2.448701, 1.113649, 0.368633, 2.023351, 0.509060}};
+static float dm_16_15[7][7]={{0,0,0,0,0,0,0},
+{0, 1.663168, 3.308261, 1.850005, 0.549647, 2.516260, 2.489382},
+{0, 3.308261, 1.762303, 0.472887, 1.999308, 2.452056, 2.487940},
+{0, 1.850005, 0.472887, 0.321624, 0.611101, 0.250077, 1.031153},
+{0, 0.549647, 1.999308, 0.611101, 0.328556, 1.140290, 0.273025},
+{0, 2.516260, 2.452056, 0.250077, 1.140290, 0.460515, 2.003803},
+{0, 2.489382, 2.487940, 1.031153, 0.273025, 2.003803, 0.593446}};
+static float dm_17_5[7][7]={{0,0,0,0,0,0,0},
+{0, 2.007833, 3.291241, 1.663891, 0.607307, 2.464689, 2.554022},
+{0, 3.291241, 2.181349, 0.736718, 1.592793, 2.504274, 2.379900},
+{0, 1.663891, 0.736718, 0.616428, 0.445344, 0.161487, 1.114375},
+{0, 0.607307, 1.592793, 0.445344, 0.571508, 0.773714, 0.288043},
+{0, 2.464689, 2.504274, 0.161487, 0.773714, 0.544800, 2.054002},
+{0, 2.554022, 2.379900, 1.114375, 0.288043, 2.054002, 0.814483}};
+static float dm_17_6[7][7]={{0,0,0,0,0,0,0},
+{0, 2.007829, 3.291242, 1.663892, 0.607308, 2.464688, 2.554020},
+{0, 3.291242, 2.181345, 0.736719, 1.592796, 2.504272, 2.379900},
+{0, 1.663892, 0.736719, 0.616427, 0.445344, 0.161487, 1.114376},
+{0, 0.607308, 1.592796, 0.445344, 0.571507, 0.773715, 0.288042},
+{0, 2.464688, 2.504272, 0.161487, 0.773715, 0.544799, 2.054004},
+{0, 2.554020, 2.379900, 1.114376, 0.288042, 2.054004, 0.814482}};
+static float dm_17_7[7][7]={{0,0,0,0,0,0,0},
+{0, 2.006511, 3.290918, 1.664311, 0.607172, 2.464800, 2.553839},
+{0, 3.290918, 2.179982, 0.736617, 1.593288, 2.504065, 2.380066},
+{0, 1.664311, 0.736617, 0.615720, 0.446361, 0.161718, 1.115108},
+{0, 0.607172, 1.593288, 0.446361, 0.570613, 0.774548, 0.288223},
+{0, 2.464800, 2.504065, 0.161718, 0.774548, 0.543905, 2.053924},
+{0, 2.553839, 2.380066, 1.115108, 0.288223, 2.053924, 0.813353}};
+static float dm_17_8[7][7]={{0,0,0,0,0,0,0},
+{0, 1.997746, 3.285639, 1.664262, 0.605619, 2.466015, 2.554194},
+{0, 3.285639, 2.170945, 0.734627, 1.594479, 2.504060, 2.380880},
+{0, 1.664262, 0.734627, 0.611204, 0.449825, 0.161638, 1.120324},
+{0, 0.605619, 1.594479, 0.449825, 0.566330, 0.782686, 0.288928},
+{0, 2.466015, 2.504060, 0.161638, 0.782686, 0.538801, 2.060339},
+{0, 2.554194, 2.380880, 1.120324, 0.288928, 2.060339, 0.807944}};
+static float dm_17_9[7][7]={{0,0,0,0,0,0,0},
+{0, 1.982793, 3.276596, 1.661720, 0.602603, 2.468779, 2.554925},
+{0, 3.276596, 2.155408, 0.730430, 1.596575, 2.504169, 2.382555},
+{0, 1.661720, 0.730430, 0.603805, 0.454813, 0.162205, 1.129925},
+{0, 0.602603, 1.596575, 0.454813, 0.558528, 0.796813, 0.290137},
+{0, 2.468779, 2.504169, 0.162205, 0.796813, 0.530589, 2.073034},
+{0, 2.554925, 2.382555, 1.129925, 0.290137, 2.073034, 0.798318}};
+static float dm_17_10[7][7]={{0,0,0,0,0,0,0},
+{0, 1.832394, 3.307697, 1.711062, 0.587652, 2.500571, 2.542166},
+{0, 3.307697, 1.983636, 0.677419, 1.738092, 2.497012, 2.437609},
+{0, 1.711062, 0.677419, 0.494725, 0.489828, 0.154804, 1.109600},
+{0, 0.587652, 1.738092, 0.489828, 0.434240, 0.948956, 0.303653},
+{0, 2.500571, 2.497012, 0.154804, 0.948956, 0.429058, 2.071173},
+{0, 2.542166, 2.437609, 1.109600, 0.303653, 2.071173, 0.671361}};
+static float dm_17_11[7][7]={{0,0,0,0,0,0,0},
+{0, 1.633896, 3.402351, 1.834789, 0.578697, 2.521230, 2.483018},
+{0, 3.402351, 1.765915, 0.619865, 1.929028, 2.436812, 2.470046},
+{0, 1.834789, 0.619865, 0.383602, 0.561116, 0.161953, 1.095287},
+{0, 0.578697, 1.929028, 0.561116, 0.306100, 1.098171, 0.336383},
+{0, 2.521230, 2.436812, 0.161953, 1.098171, 0.313977, 2.003038},
+{0, 2.483018, 2.470046, 1.095287, 0.336383, 2.003038, 0.532942}};
+static float dm_17_12[7][7]={{0,0,0,0,0,0,0},
+{0, 1.595425, 3.398979, 1.849409, 0.570570, 2.521120, 2.468389},
+{0, 3.398979, 1.722025, 0.598918, 1.955315, 2.423195, 2.464611},
+{0, 1.849409, 0.598918, 0.364362, 0.591967, 0.170305, 1.116927},
+{0, 0.570570, 1.955315, 0.591967, 0.283012, 1.131490, 0.342010},
+{0, 2.521120, 2.423195, 0.170305, 1.131490, 0.296061, 2.010796},
+{0, 2.468389, 2.464611, 1.116927, 0.342010, 2.010796, 0.511111}};
+static float dm_17_13[7][7]={{0,0,0,0,0,0,0},
+{0, 1.549012, 3.376494, 1.861681, 0.554571, 2.504364, 2.452632},
+{0, 3.376494, 1.665273, 0.557068, 1.995296, 2.410242, 2.446184},
+{0, 1.861681, 0.557068, 0.344309, 0.638901, 0.190280, 1.155475},
+{0, 0.554571, 1.995296, 0.638901, 0.253950, 1.182863, 0.350164},
+{0, 2.504364, 2.410242, 0.190280, 1.182863, 0.281259, 2.030459},
+{0, 2.452632, 2.446184, 1.155475, 0.350164, 2.030459, 0.492848}};
+static float dm_17_14[7][7]={{0,0,0,0,0,0,0},
+{0, 1.495463, 3.333516, 1.880225, 0.561395, 2.499855, 2.437629},
+{0, 3.333516, 1.603946, 0.541227, 2.013724, 2.402244, 2.432190},
+{0, 1.880225, 0.541227, 0.328083, 0.699849, 0.185966, 1.189426},
+{0, 0.561395, 2.013724, 0.699849, 0.236830, 1.224252, 0.355651},
+{0, 2.499855, 2.402244, 0.185966, 1.224252, 0.250988, 2.050938},
+{0, 2.437629, 2.432190, 1.189426, 0.355651, 2.050938, 0.468514}};
+static float dm_17_15[7][7]={{0,0,0,0,0,0,0},
+{0, 1.445032, 3.277640, 1.899860, 0.579524, 2.495022, 2.453726},
+{0, 3.277640, 1.540316, 0.514869, 2.009604, 2.432139, 2.400556},
+{0, 1.899860, 0.514869, 0.290900, 0.783431, 0.190682, 1.228429},
+{0, 0.579524, 2.009604, 0.783431, 0.228588, 1.227334, 0.350982},
+{0, 2.495022, 2.432139, 0.190682, 1.227334, 0.254986, 2.050370},
+{0, 2.453726, 2.400556, 1.228429, 0.350982, 2.050370, 0.451843}};
+static float dm_17_16[7][7]={{0,0,0,0,0,0,0},
+{0, 1.488960, 3.203613, 1.823525, 0.490317, 2.511323, 2.529750},
+{0, 3.203613, 1.582014, 0.402531, 1.848617, 2.505082, 2.396065},
+{0, 1.823525, 0.402531, 0.270031, 0.719134, 0.275540, 1.315131},
+{0, 0.490317, 1.848617, 0.719134, 0.249862, 1.211044, 0.369940},
+{0, 2.511323, 2.505082, 0.275540, 1.211044, 0.401915, 2.139891},
+{0, 2.529750, 2.396065, 1.315131, 0.369940, 2.139891, 0.524210}};
+static float dm_18_5[7][7]={{0,0,0,0,0,0,0},
+{0, 1.959599, 3.270973, 1.671129, 0.574402, 2.470822, 2.567678},
+{0, 3.270973, 2.124333, 0.699437, 1.586377, 2.503971, 2.367755},
+{0, 1.671129, 0.699437, 0.602529, 0.514746, 0.131217, 1.191973},
+{0, 0.574402, 1.586377, 0.514746, 0.543897, 0.783468, 0.266230},
+{0, 2.470822, 2.503971, 0.131217, 0.783468, 0.523535, 2.125332},
+{0, 2.567678, 2.367755, 1.191973, 0.266230, 2.125332, 0.795089}};
+static float dm_18_6[7][7]={{0,0,0,0,0,0,0},
+{0, 1.959599, 3.270973, 1.671129, 0.574402, 2.470822, 2.567678},
+{0, 3.270973, 2.124333, 0.699437, 1.586377, 2.503971, 2.367755},
+{0, 1.671129, 0.699437, 0.602529, 0.514746, 0.131217, 1.191973},
+{0, 0.574402, 1.586377, 0.514746, 0.543897, 0.783468, 0.266230},
+{0, 2.470822, 2.503971, 0.131217, 0.783468, 0.523535, 2.125332},
+{0, 2.567678, 2.367755, 1.191973, 0.266230, 2.125332, 0.795089}};
+static float dm_18_7[7][7]={{0,0,0,0,0,0,0},
+{0, 1.959107, 3.270822, 1.671269, 0.574356, 2.470852, 2.567602},
+{0, 3.270822, 2.123822, 0.699405, 1.586546, 2.503884, 2.367804},
+{0, 1.671269, 0.699405, 0.602271, 0.515123, 0.131315, 1.192250},
+{0, 0.574356, 1.586546, 0.515123, 0.543584, 0.783791, 0.266309},
+{0, 2.470852, 2.503884, 0.131315, 0.783791, 0.523221, 2.125324},
+{0, 2.567602, 2.367804, 1.192250, 0.266309, 2.125324, 0.794693}};
+static float dm_18_8[7][7]={{0,0,0,0,0,0,0},
+{0, 1.954893, 3.267998, 1.671033, 0.573675, 2.471278, 2.567651},
+{0, 3.267998, 2.119451, 0.698449, 1.587072, 2.503825, 2.367971},
+{0, 1.671033, 0.698449, 0.600163, 0.516924, 0.131274, 1.194926},
+{0, 0.573675, 1.587072, 0.516924, 0.541618, 0.787988, 0.266654},
+{0, 2.471278, 2.503825, 0.131274, 0.787988, 0.520857, 2.128706},
+{0, 2.567651, 2.367971, 1.194926, 0.266654, 2.128706, 0.792170}};
+static float dm_18_9[7][7]={{0,0,0,0,0,0,0},
+{0, 1.945124, 3.264181, 1.671424, 0.571213, 2.472533, 2.567351},
+{0, 3.264181, 2.109123, 0.695302, 1.589162, 2.502780, 2.369180},
+{0, 1.671424, 0.695302, 0.595101, 0.519845, 0.132914, 1.201167},
+{0, 0.571213, 1.589162, 0.519845, 0.536309, 0.796405, 0.268040},
+{0, 2.472533, 2.502780, 0.132914, 0.796405, 0.515207, 2.135443},
+{0, 2.567351, 2.369180, 1.201167, 0.268040, 2.135443, 0.785257}};
+static float dm_18_10[7][7]={{0,0,0,0,0,0,0},
+{0, 1.778806, 3.290372, 1.729008, 0.558489, 2.496256, 2.542594},
+{0, 3.290372, 1.919078, 0.640136, 1.742877, 2.490111, 2.425930},
+{0, 1.729008, 0.640136, 0.481526, 0.559858, 0.122004, 1.188502},
+{0, 0.558489, 1.742877, 0.559858, 0.408793, 0.965121, 0.290692},
+{0, 2.496256, 2.490111, 0.122004, 0.965121, 0.406294, 2.135398},
+{0, 2.542594, 2.425930, 1.188502, 0.290692, 2.135398, 0.650811}};
+static float dm_18_11[7][7]={{0,0,0,0,0,0,0},
+{0, 1.541260, 3.359887, 1.863305, 0.552149, 2.512117, 2.465080},
+{0, 3.359887, 1.659552, 0.577262, 1.954784, 2.419679, 2.467978},
+{0, 1.863305, 0.577262, 0.355424, 0.658994, 0.133093, 1.173777},
+{0, 0.552149, 1.954784, 0.658994, 0.268144, 1.152204, 0.340224},
+{0, 2.512117, 2.419679, 0.133093, 1.152204, 0.278844, 2.069528},
+{0, 2.465080, 2.467978, 1.173777, 0.340224, 2.069528, 0.496656}};
+static float dm_18_12[7][7]={{0,0,0,0,0,0,0},
+{0, 1.515109, 3.355111, 1.873865, 0.547484, 2.509063, 2.454676},
+{0, 3.355111, 1.629923, 0.562408, 1.973041, 2.410124, 2.462343},
+{0, 1.873865, 0.562408, 0.343602, 0.682667, 0.137341, 1.188539},
+{0, 0.547484, 1.973041, 0.682667, 0.253609, 1.175520, 0.346154},
+{0, 2.509063, 2.410124, 0.137341, 1.175520, 0.268542, 2.074538},
+{0, 2.454676, 2.462343, 1.188539, 0.346154, 2.074538, 0.483464}};
+static float dm_18_13[7][7]={{0,0,0,0,0,0,0},
+{0, 1.473845, 3.334992, 1.883878, 0.535323, 2.497538, 2.439103},
+{0, 3.334992, 1.582030, 0.528874, 2.002078, 2.397872, 2.448436},
+{0, 1.883878, 0.528874, 0.327587, 0.725281, 0.148692, 1.223566},
+{0, 0.535323, 2.002078, 0.725281, 0.230794, 1.216739, 0.355996},
+{0, 2.497538, 2.397872, 0.148692, 1.216739, 0.256653, 2.092929},
+{0, 2.439103, 2.448436, 1.223566, 0.355996, 2.092929, 0.466494}};
+static float dm_18_14[7][7]={{0,0,0,0,0,0,0},
+{0, 1.438699, 3.305116, 1.892865, 0.534599, 2.498865, 2.427961},
+{0, 3.305116, 1.541486, 0.516396, 2.013794, 2.391791, 2.443225},
+{0, 1.892865, 0.516396, 0.314606, 0.768388, 0.147398, 1.244406},
+{0, 0.534599, 2.013794, 0.768388, 0.219136, 1.239877, 0.363050},
+{0, 2.498865, 2.391791, 0.147398, 1.239877, 0.245018, 2.106483},
+{0, 2.427961, 2.443225, 1.244406, 0.363050, 2.106483, 0.452624}};
+static float dm_18_15[7][7]={{0,0,0,0,0,0,0},
+{0, 1.402188, 3.243491, 1.873197, 0.523749, 2.513206, 2.440632},
+{0, 3.243491, 1.493880, 0.479570, 2.003177, 2.410569, 2.437229},
+{0, 1.873197, 0.479570, 0.286984, 0.854376, 0.156044, 1.259959},
+{0, 0.523749, 2.003177, 0.854376, 0.211875, 1.261759, 0.358950},
+{0, 2.513206, 2.410569, 0.156044, 1.261759, 0.268410, 2.128211},
+{0, 2.440632, 2.437229, 1.259959, 0.358950, 2.128211, 0.448424}};
+static float dm_18_16[7][7]={{0,0,0,0,0,0,0},
+{0, 1.399936, 3.187488, 1.813113, 0.458372, 2.536421, 2.523106},
+{0, 3.187488, 1.481063, 0.386274, 1.879206, 2.472031, 2.470590},
+{0, 1.813113, 0.386274, 0.260196, 0.908918, 0.241168, 1.252977},
+{0, 0.458372, 1.879206, 0.908918, 0.212976, 1.264362, 0.319339},
+{0, 2.536421, 2.472031, 0.241168, 1.264362, 0.364359, 2.184745},
+{0, 2.523106, 2.470590, 1.252977, 0.319339, 2.184745, 0.485249}};
+static float dm_18_17[7][7]={{0,0,0,0,0,0,0},
+{0, 1.267458, 3.104292, 1.954389, 0.508102, 2.474593, 2.482510},
+{0, 3.104292, 1.332773, 0.384678, 1.918735, 2.426904, 2.409497},
+{0, 1.954389, 0.384678, 0.231292, 1.095239, 0.222912, 1.303908},
+{0, 0.508102, 1.918735, 1.095239, 0.194026, 1.349575, 0.325298},
+{0, 2.474593, 2.426904, 0.222912, 1.349575, 0.302607, 2.167885},
+{0, 2.482510, 2.409497, 1.303908, 0.325298, 2.167885, 0.414809}};
+static float dm_19_5[7][7]={{0,0,0,0,0,0,0},
+{0, 1.925029, 3.259785, 1.678082, 0.532879, 2.480385, 2.567162},
+{0, 3.259785, 2.081752, 0.661029, 1.587558, 2.507624, 2.352855},
+{0, 1.678082, 0.661029, 0.587688, 0.564095, 0.115803, 1.245217},
+{0, 0.532879, 1.587558, 0.564095, 0.523708, 0.804297, 0.259865},
+{0, 2.480385, 2.507624, 0.115803, 0.804297, 0.509191, 2.180337},
+{0, 2.567162, 2.352855, 1.245217, 0.259865, 2.180337, 0.778683}};
+static float dm_19_6[7][7]={{0,0,0,0,0,0,0},
+{0, 1.925029, 3.259785, 1.678082, 0.532879, 2.480385, 2.567162},
+{0, 3.259785, 2.081752, 0.661029, 1.587558, 2.507624, 2.352855},
+{0, 1.678082, 0.661029, 0.587688, 0.564095, 0.115803, 1.245217},
+{0, 0.532879, 1.587558, 0.564095, 0.523708, 0.804297, 0.259865},
+{0, 2.480385, 2.507624, 0.115803, 0.804297, 0.509191, 2.180337},
+{0, 2.567162, 2.352855, 1.245217, 0.259865, 2.180337, 0.778683}};
+static float dm_19_7[7][7]={{0,0,0,0,0,0,0},
+{0, 1.924817, 3.259699, 1.678128, 0.532863, 2.480398, 2.567133},
+{0, 3.259699, 2.081532, 0.661015, 1.587619, 2.507590, 2.352872},
+{0, 1.678128, 0.661015, 0.587581, 0.564243, 0.115852, 1.245339},
+{0, 0.532863, 1.587619, 0.564243, 0.523585, 0.804442, 0.259908},
+{0, 2.480398, 2.507590, 0.115852, 0.804442, 0.509065, 2.180349},
+{0, 2.567133, 2.352872, 1.245339, 0.259908, 2.180349, 0.778524}};
+static float dm_19_8[7][7]={{0,0,0,0,0,0,0},
+{0, 1.921707, 3.257254, 1.677579, 0.532391, 2.480555, 2.567179},
+{0, 3.257254, 2.078298, 0.660245, 1.587790, 2.507604, 2.352655},
+{0, 1.677579, 0.660245, 0.586053, 0.565436, 0.115818, 1.247825},
+{0, 0.532391, 1.587790, 0.565436, 0.522217, 0.807816, 0.260351},
+{0, 2.480555, 2.507604, 0.115818, 0.807816, 0.507451, 2.183255},
+{0, 2.567179, 2.352655, 1.247825, 0.260351, 2.183255, 0.776767}};
+static float dm_19_9[7][7]={{0,0,0,0,0,0,0},
+{0, 1.914948, 3.253973, 1.677337, 0.531084, 2.481010, 2.566882},
+{0, 3.253973, 2.071131, 0.658362, 1.589059, 2.507048, 2.352997},
+{0, 1.677337, 0.658362, 0.582634, 0.567513, 0.117022, 1.252162},
+{0, 0.531084, 1.589059, 0.567513, 0.518726, 0.814061, 0.261409},
+{0, 2.481010, 2.507048, 0.117022, 0.814061, 0.503793, 2.188359},
+{0, 2.566882, 2.352997, 1.252162, 0.261409, 2.188359, 0.772214}};
+static float dm_19_10[7][7]={{0,0,0,0,0,0,0},
+{0, 1.742218, 3.274206, 1.736365, 0.520548, 2.506409, 2.538636},
+{0, 3.274206, 1.874376, 0.601999, 1.751372, 2.493109, 2.410477},
+{0, 1.736365, 0.601999, 0.469932, 0.605555, 0.101804, 1.237622},
+{0, 0.520548, 1.751372, 0.605555, 0.394004, 0.990584, 0.288953},
+{0, 2.506409, 2.493109, 0.101804, 0.990584, 0.393873, 2.187079},
+{0, 2.538636, 2.410477, 1.237622, 0.288953, 2.187079, 0.636158}};
+static float dm_19_11[7][7]={{0,0,0,0,0,0,0},
+{0, 1.468048, 3.334714, 1.879583, 0.513847, 2.525290, 2.448642},
+{0, 3.334714, 1.575000, 0.532017, 1.991892, 2.413770, 2.459092},
+{0, 1.879583, 0.532017, 0.330291, 0.714265, 0.121153, 1.217842},
+{0, 0.513847, 1.991892, 0.714265, 0.242569, 1.209724, 0.357392},
+{0, 2.525290, 2.413770, 0.121153, 1.209724, 0.254157, 2.113204},
+{0, 2.448642, 2.459092, 1.217842, 0.357392, 2.113204, 0.465079}};
+static float dm_19_12[7][7]={{0,0,0,0,0,0,0},
+{0, 1.447264, 3.331175, 1.887623, 0.510032, 2.522588, 2.440064},
+{0, 3.331175, 1.551640, 0.520175, 2.006256, 2.406278, 2.453450},
+{0, 1.887623, 0.520175, 0.321641, 0.733595, 0.124449, 1.227696},
+{0, 0.510032, 2.006256, 0.733595, 0.232046, 1.228902, 0.363719},
+{0, 2.522588, 2.406278, 0.124449, 1.228902, 0.246735, 2.116614},
+{0, 2.440064, 2.453450, 1.227696, 0.363719, 2.116614, 0.455445}};
+static float dm_19_13[7][7]={{0,0,0,0,0,0,0},
+{0, 1.413676, 3.312147, 1.892690, 0.497363, 2.513815, 2.427618},
+{0, 3.312147, 1.512635, 0.491529, 2.029384, 2.398107, 2.440346},
+{0, 1.892690, 0.491529, 0.309708, 0.770725, 0.131677, 1.255730},
+{0, 0.497363, 2.029384, 0.770725, 0.215276, 1.262537, 0.375238},
+{0, 2.513815, 2.398107, 0.131677, 1.262537, 0.238420, 2.134600},
+{0, 2.427618, 2.440346, 1.255730, 0.375238, 2.134600, 0.443272}};
+static float dm_19_14[7][7]={{0,0,0,0,0,0,0},
+{0, 1.390424, 3.289395, 1.895911, 0.494394, 2.515601, 2.419213},
+{0, 3.289395, 1.485413, 0.482937, 2.038817, 2.393102, 2.437050},
+{0, 1.895911, 0.482937, 0.301201, 0.802783, 0.131369, 1.267332},
+{0, 0.494394, 2.038817, 0.802783, 0.208219, 1.278597, 0.381488},
+{0, 2.515601, 2.393102, 0.131369, 1.278597, 0.233137, 2.145289},
+{0, 2.419213, 2.437050, 1.267332, 0.381488, 2.145289, 0.435049}};
+static float dm_19_15[7][7]={{0,0,0,0,0,0,0},
+{0, 1.359065, 3.252756, 1.879860, 0.477404, 2.530994, 2.422584},
+{0, 3.252756, 1.444344, 0.446651, 2.034691, 2.393761, 2.436293},
+{0, 1.879860, 0.446651, 0.279248, 0.878068, 0.136700, 1.277241},
+{0, 0.477404, 2.034691, 0.878068, 0.203105, 1.302254, 0.369173},
+{0, 2.530994, 2.393761, 0.136700, 1.302254, 0.254187, 2.176724},
+{0, 2.422584, 2.436293, 1.277241, 0.369173, 2.176724, 0.429742}};
+static float dm_19_16[7][7]={{0,0,0,0,0,0,0},
+{0, 1.319235, 3.187463, 1.883259, 0.425750, 2.549595, 2.483464},
+{0, 3.187463, 1.390041, 0.356901, 1.935186, 2.431514, 2.438827},
+{0, 1.883259, 0.356901, 0.250462, 1.025379, 0.218729, 1.267437},
+{0, 0.425750, 1.935186, 1.025379, 0.196407, 1.314921, 0.319083},
+{0, 2.549595, 2.431514, 0.218729, 1.314921, 0.318075, 2.206259},
+{0, 2.483464, 2.438827, 1.267437, 0.319083, 2.206259, 0.438250}};
+static float dm_19_17[7][7]={{0,0,0,0,0,0,0},
+{0, 1.160111, 3.036527, 2.090520, 0.506996, 2.523007, 2.425038},
+{0, 3.036527, 1.210398, 0.370582, 1.975521, 2.395384, 2.342602},
+{0, 2.090520, 0.370582, 0.208600, 1.267580, 0.187575, 1.340450},
+{0, 0.506996, 1.975521, 1.267580, 0.167525, 1.417493, 0.331364},
+{0, 2.523007, 2.395384, 0.187575, 1.417493, 0.245059, 2.119651},
+{0, 2.425038, 2.342602, 1.340450, 0.331364, 2.119651, 0.347729}};
+static float dm_19_18[7][7]={{0,0,0,0,0,0,0},
+{0, 1.088965, 3.033821, 2.120758, 0.473214, 2.457352, 2.432026},
+{0, 3.033821, 1.133849, 0.379829, 2.009372, 2.419403, 2.321236},
+{0, 2.120758, 0.379829, 0.179593, 1.357010, 0.233102, 1.418578},
+{0, 0.473214, 2.009372, 1.357010, 0.153161, 1.425354, 0.285522},
+{0, 2.457352, 2.419403, 0.233102, 1.425354, 0.262864, 2.054949},
+{0, 2.432026, 2.321236, 1.418578, 0.285522, 2.054949, 0.338514}};
+static float dm_20_5[7][7]={{0,0,0,0,0,0,0},
+{0, 1.897075, 3.279011, 1.691793, 0.504730, 2.480118, 2.562844},
+{0, 3.279011, 2.039856, 0.633859, 1.632167, 2.502239, 2.351187},
+{0, 1.691793, 0.633859, 0.568358, 0.603584, 0.107146, 1.236087},
+{0, 0.504730, 1.632167, 0.603584, 0.501897, 0.828959, 0.259130},
+{0, 2.480118, 2.502239, 0.107146, 0.828959, 0.486634, 2.206702},
+{0, 2.562844, 2.351187, 1.236087, 0.259130, 2.206702, 0.747065}};
+static float dm_20_6[7][7]={{0,0,0,0,0,0,0},
+{0, 1.897075, 3.279011, 1.691793, 0.504730, 2.480118, 2.562844},
+{0, 3.279011, 2.039856, 0.633859, 1.632167, 2.502239, 2.351187},
+{0, 1.691793, 0.633859, 0.568358, 0.603584, 0.107146, 1.236087},
+{0, 0.504730, 1.632167, 0.603584, 0.501897, 0.828959, 0.259130},
+{0, 2.480118, 2.502239, 0.107146, 0.828959, 0.486634, 2.206702},
+{0, 2.562844, 2.351187, 1.236087, 0.259130, 2.206702, 0.747065}};
+static float dm_20_7[7][7]={{0,0,0,0,0,0,0},
+{0, 1.896975, 3.278955, 1.691795, 0.504726, 2.480131, 2.562842},
+{0, 3.278955, 2.039753, 0.633848, 1.632190, 2.502228, 2.351194},
+{0, 1.691795, 0.633848, 0.568300, 0.603635, 0.107161, 1.236152},
+{0, 0.504726, 1.632190, 0.603635, 0.501838, 0.829046, 0.259144},
+{0, 2.480131, 2.502228, 0.107161, 0.829046, 0.486574, 2.206739},
+{0, 2.562842, 2.351194, 1.236152, 0.259144, 2.206739, 0.746992}};
+static float dm_20_8[7][7]={{0,0,0,0,0,0,0},
+{0, 1.893588, 3.276862, 1.690784, 0.504129, 2.480570, 2.563086},
+{0, 3.276862, 2.036224, 0.632813, 1.632784, 2.502765, 2.351393},
+{0, 1.690784, 0.632813, 0.566635, 0.604567, 0.107215, 1.237196},
+{0, 0.504129, 1.632784, 0.604567, 0.500459, 0.833358, 0.259465},
+{0, 2.480570, 2.502765, 0.107215, 0.833358, 0.484631, 2.209749},
+{0, 2.563086, 2.351393, 1.237196, 0.259465, 2.209749, 0.744986}};
+static float dm_20_9[7][7]={{0,0,0,0,0,0,0},
+{0, 1.884748, 3.272721, 1.689032, 0.502174, 2.481643, 2.563448},
+{0, 3.272721, 2.026963, 0.630025, 1.634741, 2.503505, 2.351925},
+{0, 1.689032, 0.630025, 0.562287, 0.606772, 0.108251, 1.240282},
+{0, 0.502174, 1.634741, 0.606772, 0.496494, 0.843309, 0.260392},
+{0, 2.481643, 2.503505, 0.108251, 0.843309, 0.479544, 2.217089},
+{0, 2.563448, 2.351925, 1.240282, 0.260392, 2.217089, 0.739346}};
+static float dm_20_10[7][7]={{0,0,0,0,0,0,0},
+{0, 1.724070, 3.286052, 1.745294, 0.494028, 2.511104, 2.531181},
+{0, 3.286052, 1.845625, 0.575819, 1.789622, 2.488166, 2.403681},
+{0, 1.745294, 0.575819, 0.464041, 0.655968, 0.086096, 1.231891},
+{0, 0.494028, 1.789622, 0.655968, 0.386445, 0.993640, 0.286030},
+{0, 2.511104, 2.488166, 0.086096, 0.993640, 0.381186, 2.210917},
+{0, 2.531181, 2.403681, 1.231891, 0.286030, 2.210917, 0.619655}};
+static float dm_20_11[7][7]={{0,0,0,0,0,0,0},
+{0, 1.366924, 3.326755, 1.917379, 0.486377, 2.535956, 2.402764},
+{0, 3.326755, 1.458409, 0.487252, 2.081863, 2.377195, 2.464398},
+{0, 1.917379, 0.487252, 0.291262, 0.818906, 0.121663, 1.238422},
+{0, 0.486377, 2.081863, 0.818906, 0.204468, 1.272391, 0.381068},
+{0, 2.535956, 2.377195, 0.121663, 1.272391, 0.212433, 2.115436},
+{0, 2.402764, 2.464398, 1.238422, 0.381068, 2.115436, 0.410852}};
+static float dm_20_12[7][7]={{0,0,0,0,0,0,0},
+{0, 1.349682, 3.322530, 1.923718, 0.483384, 2.534184, 2.393804},
+{0, 3.322530, 1.439522, 0.479792, 2.090923, 2.369673, 2.461525},
+{0, 1.923718, 0.479792, 0.284782, 0.836368, 0.126042, 1.246251},
+{0, 0.483384, 2.090923, 0.836368, 0.197208, 1.286660, 0.385916},
+{0, 2.534184, 2.369673, 0.126042, 1.286660, 0.206645, 2.118761},
+{0, 2.393804, 2.461525, 1.246251, 0.385916, 2.118761, 0.403098}};
+static float dm_20_13[7][7]={{0,0,0,0,0,0,0},
+{0, 1.325594, 3.311550, 1.928873, 0.475383, 2.528168, 2.382278},
+{0, 3.311550, 1.412034, 0.461445, 2.106893, 2.361332, 2.453619},
+{0, 1.928873, 0.461445, 0.277185, 0.862477, 0.132110, 1.265629},
+{0, 0.475383, 2.106893, 0.862477, 0.186437, 1.309775, 0.393588},
+{0, 2.528168, 2.361332, 0.132110, 1.309775, 0.200886, 2.128515},
+{0, 2.382278, 2.453619, 1.265629, 0.393588, 2.128515, 0.394595}};
+static float dm_20_14[7][7]={{0,0,0,0,0,0,0},
+{0, 1.311939, 3.299898, 1.933137, 0.471935, 2.529169, 2.375251},
+{0, 3.299898, 1.395992, 0.455706, 2.114821, 2.356211, 2.451006},
+{0, 1.933137, 0.455706, 0.271715, 0.884807, 0.131733, 1.269681},
+{0, 0.471935, 2.114821, 0.884807, 0.182317, 1.320966, 0.396050},
+{0, 2.529169, 2.356211, 0.131733, 1.320966, 0.199041, 2.134307},
+{0, 2.375251, 2.451006, 1.269681, 0.396050, 2.134307, 0.389641}};
+static float dm_20_15[7][7]={{0,0,0,0,0,0,0},
+{0, 1.290169, 3.289532, 1.928987, 0.454296, 2.557077, 2.372959},
+{0, 3.289532, 1.366891, 0.412695, 2.119268, 2.344543, 2.452420},
+{0, 1.928987, 0.412695, 0.254556, 0.948114, 0.109102, 1.276760},
+{0, 0.454296, 2.119268, 0.948114, 0.179089, 1.351415, 0.361892},
+{0, 2.557077, 2.344543, 0.109102, 1.351415, 0.225454, 2.170825},
+{0, 2.372959, 2.452420, 1.276760, 0.361892, 2.170825, 0.384073}};
+static float dm_20_16[7][7]={{0,0,0,0,0,0,0},
+{0, 1.241983, 3.298278, 2.020828, 0.408475, 2.597074, 2.370026},
+{0, 3.298278, 1.298912, 0.321238, 2.068440, 2.315534, 2.439604},
+{0, 2.020828, 0.321238, 0.220983, 1.147124, 0.213801, 1.254817},
+{0, 0.408475, 2.068440, 1.147124, 0.172898, 1.335235, 0.279635},
+{0, 2.597074, 2.315534, 0.213801, 1.335235, 0.296732, 2.123562},
+{0, 2.370026, 2.439604, 1.254817, 0.279635, 2.123562, 0.381151}};
+static float dm_20_17[7][7]={{0,0,0,0,0,0,0},
+{0, 1.031083, 3.146699, 2.295330, 0.511540, 2.584730, 2.277981},
+{0, 3.146699, 1.064679, 0.357052, 2.105656, 2.264165, 2.292508},
+{0, 2.295330, 0.357052, 0.171546, 1.497354, 0.225501, 1.336781},
+{0, 0.511540, 2.105656, 1.497354, 0.136152, 1.441587, 0.273770},
+{0, 2.584730, 2.264165, 0.225501, 1.441587, 0.196237, 1.955911},
+{0, 2.277981, 2.292508, 1.336781, 0.273770, 1.955911, 0.267176}};
+static float dm_20_18[7][7]={{0,0,0,0,0,0,0},
+{0, 0.943522, 3.116469, 2.274659, 0.422065, 2.542425, 2.299795},
+{0, 3.116469, 0.970661, 0.354446, 2.179069, 2.278761, 2.269135},
+{0, 2.274659, 0.354446, 0.148767, 1.494225, 0.206332, 1.496611},
+{0, 0.422065, 2.179069, 1.494225, 0.128695, 1.562489, 0.209998},
+{0, 2.542425, 2.278761, 0.206332, 1.562489, 0.230554, 1.946200},
+{0, 2.299795, 2.269135, 1.496611, 0.209998, 1.946200, 0.272444}};
+static float dm_20_19[7][7]={{0,0,0,0,0,0,0},
+{0, 0.900882, 2.994246, 2.284230, 0.220253, 2.658395, 2.356499},
+{0, 2.994246, 0.929797, 0.286242, 2.159140, 2.277679, 2.304699},
+{0, 2.284230, 0.286242, 0.130488, 1.356211, 0.237656, 1.714175},
+{0, 0.220253, 2.159140, 1.356211, 0.130093, 1.740519, 0.194186},
+{0, 2.658395, 2.277679, 0.237656, 1.740519, 0.250414, 1.898882},
+{0, 2.356499, 2.304699, 1.714175, 0.194186, 1.898882, 0.292298}};
+
+
+float **get_ribosum(const char **Alseq, int n_seq, int length){
+  int i, j,k;
+  float ident=0;
+  int pairnum=0;
+  float minimum=1;
+  float maximum=0.;
+  int min;
+  int max;
+  float **ribo;
+
+  ribo=(float **)vrna_alloc(7*sizeof(float *));
+  for (i=0; i<7; i++) {
+    ribo[i]=(float *)vrna_alloc(7*sizeof(float));
+  }
+  for(j=0; j<n_seq-1; j++)
+    for(k=j+1; k<n_seq; k++) {
+      ident=length-vrna_hamming_distance(Alseq[k],Alseq[j]);
+      if ((ident/(length))<minimum) minimum=ident/(float)(length);
+      if ((ident/(length))>maximum) maximum=ident/(float)(length);
+    }
+  /*+2.5 for ALWAYS round up*/
+  minimum*=100;
+  maximum*=100;
+  minimum+=0.5;
+  maximum+=0.5;
+  if (n_seq==1 || minimum>100.45){
+    for (i=0; i<7; i++)
+      for (j=0; j<7;j++)
+        ribo[i][j]= 0.;
+    return ribo;
+  }
+  min=(int) minimum/5;
+  max=(int) maximum/5;
+
+  if (max<12) max=12;
+  if (min<5) min=5;
+  if (min>=max) min=max-1;
+  switch (max) {
+  case 12:
+    switch (min) {
+    case 5:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_12_5[i][j];
+      break;
+    case 6:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_12_6[i][j];
+      break;
+    case 7:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_12_7[i][j];
+      break;
+    case 8:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_12_8[i][j];
+      break;
+    case 9:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_12_9[i][j];
+      break;
+    case 10:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_12_10[i][j];
+      break;
+    case 11:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_12_11[i][j];
+      break;
+    default:
+      vrna_message_error("da hats was grobes im dmchoose\n");
+    }
+    break;
+  case 13:
+    switch (min) {
+    case 5:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_13_5[i][j];
+      break;
+    case 6:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_13_6[i][j];
+      break;
+    case 7:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_13_7[i][j];
+      break;
+    case 8:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_13_8[i][j];
+      break;
+    case 9:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_13_9[i][j];
+      break;
+    case 10:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_13_10[i][j];
+      break;
+    case 11:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_13_11[i][j];
+      break;
+    case 12:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_13_12[i][j];
+      break;
+    default:
+      vrna_message_error("da hats was grobes im dmchoose\n");
+    }
+    break;
+  case 14:
+    switch (min) {
+    case 5:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_14_5[i][j];
+      break;
+    case 6:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_14_6[i][j];
+      break;
+    case 7:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_14_7[i][j];
+      break;
+    case 8:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_14_8[i][j];
+      break;
+    case 9:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_14_9[i][j];
+      break;
+    case 10:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_14_10[i][j];
+      break;
+    case 11:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_14_11[i][j];
+      break;
+    case 12:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_14_12[i][j];
+      break;
+    case 13:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_14_13[i][j];
+      break;
+    default:
+      vrna_message_error("da hats was grobes im dmchoose\n");
+    }
+    break;
+  case 15:
+    switch (min) {
+    case 5:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_15_5[i][j];
+      break;
+    case 6:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_15_6[i][j];
+      break;
+    case 7:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_15_7[i][j];
+      break;
+    case 8:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_15_8[i][j];
+      break;
+    case 9:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_15_9[i][j];
+      break;
+    case 10:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_15_10[i][j];
+      break;
+    case 11:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_15_11[i][j];
+      break;
+    case 12:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_15_12[i][j];
+      break;
+    case 13:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_15_13[i][j];
+      break;
+    case 14:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_15_14[i][j];
+      break;
+    default:
+      vrna_message_error("da hats was grobes im dmchoose\n");
+    }
+    break;
+  case 16:
+    switch (min) {
+    case 5:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_16_5[i][j];
+      break;
+    case 6:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_16_6[i][j];
+      break;
+    case 7:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_16_7[i][j];
+      break;
+    case 8:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_16_8[i][j];
+      break;
+    case 9:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_16_9[i][j];
+      break;
+    case 10:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_16_10[i][j];
+      break;
+    case 11:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_16_11[i][j];
+      break;
+    case 12:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_16_12[i][j];
+      break;
+    case 13:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_16_13[i][j];
+      break;
+    case 14:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_16_14[i][j];
+    break;
+    case 15:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_16_15[i][j];
+      break;
+    default:
+      vrna_message_error("da hats was grobes im dmchoose\n");
+    }
+    break;
+  case 17:
+    switch (min) {
+    case 5:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_5[i][j];
+      break;
+    case 6:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_6[i][j];
+      break;
+    case 7:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_7[i][j];
+      break;
+    case 8:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_8[i][j];
+      break;
+    case 9:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_9[i][j];
+      break;
+    case 10:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_10[i][j];
+      break;
+    case 11:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_11[i][j];
+      break;
+    case 12:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_12[i][j];
+      break;
+    case 13:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_13[i][j];
+      break;
+    case 14:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_14[i][j];
+    break;
+    case 15:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_15[i][j];
+      break;
+    case 16:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_17_16[i][j];
+      break;
+    default:
+      vrna_message_error("da hats was grobes im dmchoose\n");
+    }
+    break;
+  case 18:
+    switch (min) {
+    case 5:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_5[i][j];
+      break;
+    case 6:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_6[i][j];
+      break;
+    case 7:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_7[i][j];
+      break;
+    case 8:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_8[i][j];
+      break;
+    case 9:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_9[i][j];
+      break;
+    case 10:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_10[i][j];
+      break;
+    case 11:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_11[i][j];
+      break;
+    case 12:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_12[i][j];
+      break;
+    case 13:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_13[i][j];
+      break;
+    case 14:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_14[i][j];
+    break;
+    case 15:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_15[i][j];
+      break;
+    case 16:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_16[i][j];
+      break;
+    case 17:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_18_17[i][j];
+      break;
+    default:
+      vrna_message_error("da hats was grobes im dmchoose\n");
+    }
+    break;
+   case 19:
+    switch (min) {
+    case 5:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_5[i][j];
+      break;
+    case 6:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_6[i][j];
+      break;
+    case 7:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_7[i][j];
+      break;
+    case 8:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_8[i][j];
+      break;
+    case 9:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_9[i][j];
+      break;
+    case 10:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_10[i][j];
+      break;
+    case 11:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_11[i][j];
+      break;
+    case 12:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_12[i][j];
+      break;
+    case 13:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_13[i][j];
+      break;
+    case 14:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_14[i][j];
+      break;
+    case 15:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_15[i][j];
+      break;
+    case 16:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_16[i][j];
+      break;
+    case 17:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_17[i][j];
+      break;
+    case 18:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_19_18[i][j];
+      break;
+    default:
+      vrna_message_error("da hats was grobes im dmchoose\n");
+    }
+    break;
+  case 20:
+    switch (min) {
+    case 5:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_5[i][j];
+      break;
+    case 6:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_6[i][j];
+      break;
+    case 7:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_7[i][j];
+      break;
+    case 8:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_8[i][j];
+      break;
+    case 9:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_9[i][j];
+      break;
+    case 10:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_10[i][j];
+      break;
+    case 11:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_11[i][j];
+      break;
+    case 12:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_12[i][j];
+      break;
+    case 13:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_13[i][j];
+      break;
+    case 14:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_14[i][j];
+    break;
+    case 15:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_15[i][j];
+      break;
+    case 16:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_16[i][j];
+      break;
+    case 17:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_17[i][j];
+      break;
+    case 18:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_18[i][j];
+      break;
+    case 19:
+      for (i=0; i<7; i++) for (j=0; j<7;j++) ribo[i][j]=dm_20_19[i][j];
+      break;
+    default:
+      vrna_message_error("da hats was grobes im dmchoose\n");
+    }
+    break;
+  default:
+    vrna_message_error("da hats was grobes im dmchoose\n");
+  }
+  return ribo;
+}
+
+PUBLIC float **readribosum(char *name){
+
+  float **dm;
+  char *line;
+  FILE *fp;
+  int i=0;
+  int who=0;
+  float a,b,c,d,e,f;
+  int translator[7]={0,5,1,2,3,6,4};
+
+  fp=fopen(name,"r");
+  dm=(float **)vrna_alloc(7*sizeof(float*));
+  for (i=0; i<7;i++) {
+    dm[i]=(float *)vrna_alloc(7*sizeof(float));
+  }
+  while(1) { /*bisma hoit fertisch san*/
+    line=vrna_read_line(fp);
+    if (*line=='#') continue;
+    i=0;
+    i=sscanf(line,"%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f);
+    if (i==0) break;
+    dm[translator[++who]][translator[1]]=a;
+    dm[translator[who]][translator[2]]=b;
+    dm[translator[who]][translator[3]]=c;
+    dm[translator[who]][translator[4]]=d;
+    dm[translator[who]][translator[5]]=e;
+    dm[translator[who]][translator[6]]=f;
+    free(line);
+    if (who==6) break;
+  }
+  fclose(fp);
+  return dm;
+}
+
diff --git a/C/ViennaRNA/ribo.h b/C/ViennaRNA/ribo.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/ribo.h
@@ -0,0 +1,33 @@
+#ifndef VIENNA_RNA_PACKAGE_RIBOSUM_H
+#define VIENNA_RNA_PACKAGE_RIBOSUM_H
+
+/**
+ *  @file ribo.h
+ *  @ingroup   file_utils
+ *  @brief  Parse RiboSum Scoring Matrices for Covariance Scoring of Alignments
+ */
+
+/**
+ *  @{
+ *  @ingroup   file_utils
+ */
+
+/**
+ *  @brief Retrieve a RiboSum Scoring Matrix for a given Alignment
+ *  \ingroup consensus_fold
+ * 
+ */
+float **get_ribosum(const char **Alseq,
+                    int n_seq,
+                    int length);
+
+/**
+ *  \brief Read a RiboSum or other user-defined Scoring Matrix and Store into global Memory
+ * 
+ */
+float   **readribosum(char *name);
+
+/**
+ *  @}
+ */
+#endif
diff --git a/C/ViennaRNA/snofold.c b/C/ViennaRNA/snofold.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/snofold.c
@@ -0,0 +1,1103 @@
+/*
+                  minimum free energy
+                  RNA secondary structure prediction
+
+                  c Ivo Hofacker, Chrisoph Flamm
+                  original implementation by
+                  Walter Fontana
+
+                  Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/structure_utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/snofold.h"
+#include "ViennaRNA/loop_energies.h"
+
+#ifdef __GNUC__
+#define INLINE inline
+#else
+#define INLINE
+#endif
+
+#define PAREN
+
+#define PUBLIC
+#define PRIVATE static
+
+#define STACK_BULGE1  1   /* stacking energies for bulges of size 1 */
+#define NEW_NINIO     1   /* new asymetry penalty */
+
+/*@unused@*/
+PRIVATE void  get_arrays(unsigned int size);
+/* PRIVATE int   stack_energy(int i, const char *string); */
+PRIVATE void  make_ptypes(const short *S, const char *structure);
+PRIVATE void encode_seq(const char *sequence);
+PRIVATE void  backtrack(const char *sequence, int s);
+PRIVATE int   fill_arrays(const char *sequence, const int max_asymm, const int threshloop,
+                          const int min_s2, const int max_s2, const int half_stem, const int max_half_stem);
+/*@unused@*/
+
+
+/* alifold */
+PRIVATE void alisnoinitialize_fold(const int length);
+PRIVATE void make_pscores(const short *const* S, const char *const* AS,int n_seq, const char *structure);
+PRIVATE int   *pscore;  /* precomputed array of pair types */
+PRIVATE short **Sali;
+PRIVATE int alifill_arrays(const char **string, const int max_asymm, const int threshloop, 
+                           const int min_s2, const int max_s2, const int half_stem, 
+                           const int max_half_stem);
+PRIVATE void aliget_arrays(unsigned int size);
+PRIVATE short * aliencode_seq(const char *sequence);
+PRIVATE int alibacktrack(const char **strings, int s);
+
+#define UNIT 100
+#define MINPSCORE -2 * UNIT
+/* end alifold */
+
+#define MAXSECTORS      500     /* dimension for a backtrack array */
+#define LOCALITY        0.      /* locality parameter for base-pairs */
+
+#define MIN2(A, B)      ((A) < (B) ? (A) : (B))
+#define MAX2(A, B)      ((A) > (B) ? (A) : (B))
+#define SAME_STRAND(I,J) (((I)>=cut_point)||((J)<cut_point))
+
+PRIVATE vrna_param_t *P = NULL;
+
+PRIVATE int *indx = NULL; /* index for moving in the triangle matrices c[] and fMl[]*/
+
+PRIVATE int   *c = NULL;       /* energy array, given that i-j pair */
+PRIVATE int   *cc = NULL;      /* linear array for calculating canonical structures */
+PRIVATE int   *cc1 = NULL;     /*   "     "        */
+PRIVATE int   *Fmi = NULL;     /* holds row i of fML (avoids jumps in memory) */
+PRIVATE int   *DMLi = NULL;    /* DMLi[j] holds MIN(fML[i,k]+fML[k+1,j])  */
+PRIVATE int   *DMLi1 = NULL;   /*             MIN(fML[i+1,k]+fML[k+1,j])  */
+PRIVATE int   *DMLi2 = NULL;   /*             MIN(fML[i+2,k]+fML[k+1,j])  */
+PRIVATE char  *ptype = NULL;   /* precomputed array of pair types */
+PRIVATE short *S = NULL, *S1 = NULL;
+PRIVATE int    init_length=-1;
+PRIVATE int    *mLoop = NULL; /*contains the minimum of c for a xy range*/
+PRIVATE folden **foldlist = NULL;
+PRIVATE folden **foldlist_XS = NULL;
+
+PRIVATE int     *BP = NULL; /* contains the structure constrainsts: BP[i]
+                        -1: | = base must be paired
+                        -2: < = base must be paired with j<i
+                        -3: > = base must be paired with j>i
+                        -4: x = base must not pair
+                        positive int: base is paired with int      */
+
+
+static sect sector[MAXSECTORS]; /* stack of partial structures for backtracking */
+
+PRIVATE char  alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+/* needed by cofold/eval */
+/* PRIVATE int cut_in_loop(int i); */
+/* PRIVATE int min_hairpin = TURN; */
+
+/* some definitions to take circfold into account...        */
+/* PRIVATE int   *fM2 = NULL;*/        /* fM2 = multiloop region with exactly two stems, extending to 3' end        */
+PUBLIC        int   Fc, FcH, FcI, FcM; /* parts of the exterior loop energies                        */
+/*--------------------------------------------------------------------------*/
+
+void snoinitialize_fold(const int length)
+{
+  unsigned int n;
+  if (length<1) vrna_message_error("snoinitialize_fold: argument must be greater 0");
+  if (init_length>0) snofree_arrays(length);
+  get_arrays((unsigned) length);
+  init_length=length;
+  for (n = 1; n <= (unsigned) length; n++)
+    indx[n] = (n*(n-1)) >> 1;        /* n(n-1)/2 */
+
+  snoupdate_fold_params();
+}
+
+PRIVATE void alisnoinitialize_fold(const int length)
+{
+  unsigned int n;
+  if (length<1) vrna_message_error("snoinitialize_fold: argument must be greater 0");
+  if (init_length>0) snofree_arrays(length);
+  aliget_arrays((unsigned) length);
+  make_pair_matrix();
+  init_length=length;
+  for (n = 1; n <= (unsigned) length; n++)
+    indx[n] = (n*(n-1)) >> 1;        /* n(n-1)/2 */
+  snoupdate_fold_params();
+}  
+
+
+/*--------------------------------------------------------------------------*/
+
+PRIVATE void get_arrays(unsigned int size)
+{
+  indx = (int *) vrna_alloc(sizeof(int)*(size+1));
+  c     = (int *) vrna_alloc(sizeof(int)*((size*(size+1))/2+2));
+  mLoop = (int *) vrna_alloc(sizeof(int)*((size*(size+1))/2+2));
+
+  ptype = (char *) vrna_alloc(sizeof(char)*((size*(size+1))/2+2));
+  cc    = (int *) vrna_alloc(sizeof(int)*(size+2));
+  cc1   = (int *) vrna_alloc(sizeof(int)*(size+2));
+  Fmi   = (int *) vrna_alloc(sizeof(int)*(size+1));
+  DMLi  = (int *) vrna_alloc(sizeof(int)*(size+1));
+  DMLi1  = (int *) vrna_alloc(sizeof(int)*(size+1));
+  DMLi2  = (int *) vrna_alloc(sizeof(int)*(size+1));
+  if (base_pair) free(base_pair);
+  base_pair = (vrna_bp_stack_t *) vrna_alloc(sizeof(vrna_bp_stack_t)*(1+size/2));
+  /* extra array(s) for circfold() */
+}
+
+PRIVATE void aliget_arrays(unsigned int size)
+{
+  indx = (int *) vrna_alloc(sizeof(int)*(size+1));
+  c     = (int *) vrna_alloc(sizeof(int)*((size*(size+1))/2+2));
+  mLoop = (int *) vrna_alloc(sizeof(int)*((size*(size+1))/2+2));
+  pscore = (int *) vrna_alloc(sizeof(int)*((size*(size+1))/2+2));
+  ptype = (char *) vrna_alloc(sizeof(char)*((size*(size+1))/2+2));
+  cc    = (int *) vrna_alloc(sizeof(int)*(size+2));
+  cc1   = (int *) vrna_alloc(sizeof(int)*(size+2));
+  Fmi   = (int *) vrna_alloc(sizeof(int)*(size+1));
+  DMLi  = (int *) vrna_alloc(sizeof(int)*(size+1));
+  DMLi1  = (int *) vrna_alloc(sizeof(int)*(size+1));
+  DMLi2  = (int *) vrna_alloc(sizeof(int)*(size+1));
+  if (base_pair) free(base_pair);
+  base_pair = (vrna_bp_stack_t *) vrna_alloc(sizeof(vrna_bp_stack_t)*(1+size/2));
+  /* extra array(s) for circfold() */
+}
+
+
+
+
+/*--------------------------------------------------------------------------*/
+
+
+void snofree_arrays(const int length)
+{
+  free(indx); free(c);free(cc); free(cc1);
+  free(ptype);free(mLoop);
+  int i;
+  for(i=length;i>-1;i--){
+    while(foldlist[i]!=NULL){
+      folden *n = foldlist[i];
+      foldlist[i] = foldlist[i]->next;
+      free(n);
+    }
+    free(foldlist[i]);
+  }
+  free(foldlist);
+  for(i=length;i>-1;i--){
+    while(foldlist_XS[i]!=NULL){
+      folden *n = foldlist_XS[i];
+      foldlist_XS[i] = foldlist_XS[i]->next;
+      free(n);
+    }
+    free(foldlist_XS[i]);
+  }
+  free(foldlist_XS);
+  free(base_pair); base_pair=NULL; free(Fmi);
+  free(DMLi); free(DMLi1);free(DMLi2);
+  free(BP);
+  init_length=0;
+}
+
+void alisnofree_arrays(const int length)
+{
+  free(indx); free(c);free(cc); free(cc1);
+  free(ptype);free(mLoop);free(pscore);
+  int i;
+  for(i=length-1;i>-1;i--){
+    while(foldlist[i]!=NULL){
+      folden *n = foldlist[i];
+      foldlist[i] = foldlist[i]->next;
+      free(n);
+    }
+    free(foldlist[i]);
+  }
+  free(foldlist);
+  free(base_pair); base_pair=NULL; free(Fmi);
+  free(DMLi); free(DMLi1);free(DMLi2);
+  free(BP);
+  init_length=0;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void snoexport_fold_arrays(int **indx_p, int **mLoop_p, int **cLoop,  folden ***fold_p, folden ***fold_p_XS) {
+  /* make the DP arrays available to routines such as subopt() */
+  *indx_p = indx; *mLoop_p = mLoop;
+  *cLoop = c; *fold_p = foldlist;*fold_p_XS=foldlist_XS;
+}
+
+/* void alisnoexport_fold_arrays(int **indx_p, int **mLoop_p, int **cLoop, folden ***fold_p, int **pscores) { */
+/*   /\* make the DP arrays available to routines such as subopt() *\/ */
+/*   *indx_p = indx; *mLoop_p = mLoop; */
+/*   *cLoop = c; *fold_p = foldlist; */
+/*   *pscores=pscore; */
+/* } */
+
+/*--------------------------------------------------------------------------*/
+
+
+
+
+
+
+
+
+
+
+int snofold(const char *string, char *structure, const int max_assym, const int threshloop, 
+              const int min_s2, const int max_s2, const int half_stem, const int max_half_stem) {
+  int length, energy, bonus, bonus_cnt, s;
+  
+  /* Variable initialization */
+  bonus = 0;
+  bonus_cnt = 0;
+  s     = 0;
+  length = (int) strlen(string);
+  
+  S   = encode_sequence(string, 0);
+  S1  = encode_sequence(string, 1);
+
+  
+  /* structure = (char *) vrna_alloc((unsigned) length+1); */
+  
+  if (length>init_length) snoinitialize_fold(length);
+  else if (fabs(P->temperature - temperature)>1e-6) snoupdate_fold_params();
+
+  
+
+  /* encode_seq(string); */
+  BP  = (int *)vrna_alloc(sizeof(int)*(length+2));
+  make_ptypes(S, structure);
+  energy=fill_arrays(string, max_assym, threshloop, min_s2, max_s2, half_stem, max_half_stem);
+  backtrack(string, s);
+
+  free(structure);
+  free(S); free(S1); /* free(BP); */
+  return energy;
+}
+
+PRIVATE void make_pscores(const short *const* S, const char *const* AS,
+                          int n_seq, const char *structure) {
+  /* calculate co-variance bonus for each pair depending on  */
+  /* compensatory/consistent mutations and incompatible seqs */
+  /* should be 0 for conserved pairs, >0 for good pairs      */
+#define NONE -10000 /* score for forbidden pairs */
+  int n,i,j,k,l,s,score;
+  int dm[7][7]={{0,0,0,0,0,0,0}, /* hamming distance between pairs */
+                       {0,0,2,2,1,2,2} /* CG */,
+                {0,2,0,1,2,2,2} /* GC */,
+                {0,2,1,0,2,1,2} /* GU */,
+                {0,1,2,2,0,2,1} /* UG */,
+                {0,2,2,1,2,0,2} /* AU */,
+                {0,2,2,2,1,2,0} /* UA */};
+  n=Sali[0][0];  /* length of seqs */
+  for (i=1; i<n; i++) {
+    for (j=i+1; (j<i+TURN+1) && (j<=n); j++)
+      pscore[indx[j]+i] = NONE;
+    for (j=i+TURN+1; j<=n; j++) {
+      int pfreq[8]={0,0,0,0,0,0,0,0};
+      for (s=0; s<n_seq; s++) {
+        int type;
+        if (Sali[s][i]==0 && Sali[s][j]==0) type = 7; /* gap-gap  */
+        else {
+          if ((AS[s][i] == '~')||(AS[s][j] == '~')) type = 7;
+          else type = pair[Sali[s][i]][Sali[s][j]];
+        }
+
+        pfreq[type]++;
+      }
+      if (pfreq[0]*2>n_seq) { pscore[indx[j]+i] = NONE; continue;}
+      for (k=1,score=0; k<=6; k++) /* ignore pairtype 7 (gap-gap) */
+        for (l=k+1; l<=6; l++)
+          /* scores for replacements between pairtypes    */
+          /* consistent or compensatory mutations score 1 or 2  */
+          score += pfreq[k]*pfreq[l]*dm[k][l];
+      /* counter examples score -1, gap-gap scores -0.25   */
+      pscore[indx[j]+i] = cv_fact *
+        ((UNIT*score)/n_seq - nc_fact*UNIT*(pfreq[0] + pfreq[7]*0.25));
+    }
+  }
+
+  if (noLonelyPairs) /* remove unwanted pairs */
+    for (k=1; k<n-TURN-1; k++)
+      for (l=1; l<=2; l++) {
+        int type,ntype=0,otype=0;
+        i=k; j = i+TURN+l;
+        type = pscore[indx[j]+i];
+        while ((i>=1)&&(j<=n)) {
+          if ((i>1)&&(j<n)) ntype = pscore[indx[j+1]+i-1];
+          if ((otype<-4*UNIT)&&(ntype<-4*UNIT))  /* worse than 2 counterex */
+            pscore[indx[j]+i] = NONE; /* i.j can only form isolated pairs */
+          otype =  type;
+          type  = ntype;
+          i--; j++;
+        }
+      }
+
+
+  if (fold_constrained&&(structure!=NULL)) {
+    int psij, hx, hx2, *stack, *stack2;
+    stack = (int *) vrna_alloc(sizeof(int)*(n+1));
+    stack2 = (int *) vrna_alloc(sizeof(int)*(n+1));
+
+    for(hx=hx2=0, j=1; j<=n; j++) {
+      switch (structure[j-1]) {
+      case 'x': /* can't pair */
+        for (l=1; l<j-TURN; l++) pscore[indx[j]+l] = NONE;
+        for (l=j+TURN+1; l<=n; l++) pscore[indx[l]+j] = NONE;
+        break;
+      case '(':
+        stack[hx++]=j;
+        /* fallthrough */
+      case '[':
+        stack2[hx2++]=j;
+        /* fallthrough */
+      case '<': /* pairs upstream */
+        for (l=1; l<j-TURN; l++) pscore[indx[j]+l] = NONE;
+        break;
+      case ']':
+        if (hx2<=0) {
+          vrna_message_error("unbalanced brackets in constraints\n%s", structure);
+        }
+        i = stack2[--hx2];
+        pscore[indx[j]+i]=NONE;
+        break;
+      case ')':
+        if (hx<=0) {
+          vrna_message_error("unbalanced brackets in constraints\n%s", structure);
+        }
+        i = stack[--hx];
+        psij = pscore[indx[j]+i]; /* store for later */
+        for (k=j; k<=n; k++)
+          for (l=i; l<=j; l++)
+            pscore[indx[k]+l] = NONE;
+        for (l=i; l<=j; l++)
+          for (k=1; k<=i; k++)
+            pscore[indx[l]+k] = NONE;
+        for (k=i+1; k<j; k++)
+          pscore[indx[k]+i] = pscore[indx[j]+k] = NONE;
+        pscore[indx[j]+i] = (psij>0) ? psij : 0;
+        /* fallthrough */
+      case '>': /* pairs downstream */
+        for (l=j+TURN+1; l<=n; l++) pscore[indx[l]+j] = NONE;
+        break;
+      }
+    }
+    if (hx!=0) {
+      vrna_message_error("unbalanced brackets in constraint string\n%s", structure);
+    }
+    free(stack); free(stack2);
+  }
+}
+
+float alisnofold(const char **strings, const int max_assym, const int threshloop, 
+              const int min_s2, const int max_s2, const int half_stem, const int max_half_stem) {
+  int s,n_seq, length, energy;
+  char * structure;
+  length = (int) strlen(strings[0]);
+  /* structure = (char *) vrna_alloc((unsigned) length+1); */
+  structure = NULL;
+  if (length>init_length) alisnoinitialize_fold(length);
+  if (fabs(P->temperature - temperature)>1e-6) snoupdate_fold_params();
+  for (s=0; strings[s]!=NULL; s++);
+  n_seq = s;
+  Sali = (short **) vrna_alloc(n_seq*sizeof(short *));
+  for (s=0; s<n_seq; s++) {
+    if (strlen(strings[s]) != length) vrna_message_error("uneqal seqence lengths");
+    Sali[s] = aliencode_seq(strings[s]);
+  }
+  make_pscores((const short **) Sali, (const char *const *) strings, n_seq, structure);
+  energy=alifill_arrays(strings, max_assym, threshloop, min_s2, max_s2, half_stem, max_half_stem);
+  alibacktrack((const char **)strings, 0);
+  for (s=0; s<n_seq; s++) free(Sali[s]);
+  free(Sali);
+  /* free(structure); */
+  /*  free(S)*/; free(S1); /* free(BP); */
+  return (float) energy/100.;
+}
+
+PRIVATE int alifill_arrays(const char **strings, const int max_asymm, const int threshloop, 
+                           const int min_s2, const int max_s2, const int half_stem, 
+                           const int max_half_stem) {
+
+  int   i, j, length, energy;
+  /* int   decomp, new_fML; */
+  int   *type, type_2;
+  int   bonus,n_seq,s;
+
+  
+  for (n_seq=0; strings[n_seq]!=NULL; n_seq++);
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+  length = strlen(strings[0]);
+  bonus=0;
+  /*   max_separation = (int) ((1.-LOCALITY)*(double)(length-2));*/ /* not in use */
+  
+    /* for (i=(j>TURN?(j-TURN):1); i<j; i++) { */
+    /* } */
+    for (i = (length)-TURN-1; i >= 1; i--) { /* i,j in [1..length] */
+      for (j = i+TURN+1; j <= length; j++) {
+        int p, q, ij,psc;
+        ij = indx[j]+i;
+        for (s=0; s<n_seq; s++) {
+          type[s] = pair[Sali[s][i]][Sali[s][j]];
+          if (type[s]==0) type[s]=7;
+        }
+        psc = pscore[indx[j]+i];
+        if (psc>=MINPSCORE) {   /* we have a pair */
+        int new_c=0, stackEnergy=INF; /* seems that new_c immer den minimum von cij enthaelt */
+        /* hairpin ----------------------------------------------*/
+        
+        for (new_c=s=0; s<n_seq; s++)
+          new_c += E_Hairpin(j-i-1,type[s],Sali[s][i+1],Sali[s][j-1],strings[s]+i-1,P);
+        /*--------------------------------------------------------      
+          check for elementary structures involving more than one
+          closing pair (interior loop).
+          --------------------------------------------------------*/      
+        
+        for (p = i+1; p <= MIN2(j-2-TURN,i+MAXLOOP+1) ; p++) {
+          int minq = j-i+p-MAXLOOP-2;
+          if (minq<p+1+TURN) minq = p+1+TURN;
+          for (q = minq; q < j; q++) {
+            if (pscore[indx[q]+p]<MINPSCORE) continue;
+            if(abs((p-i) - (j-q)) > max_asymm) continue;
+            for (energy = s=0; s<n_seq; s++) {
+              type_2 = pair[Sali[s][q]][Sali[s][p]]; /* q,p not p,q! */
+              if (type_2 == 0) type_2 = 7;
+              energy += E_IntLoop(p-i-1, j-q-1, type[s], type_2,
+                                  Sali[s][i+1], Sali[s][j-1],
+                                  Sali[s][p-1], Sali[s][q+1],P);
+            }
+            new_c = MIN2(energy+c[indx[q]+p], new_c);
+            if ((p==i+1)&&(j==q+1)) stackEnergy = energy; /* remember stack energy */
+            
+          } /* end q-loop */
+        } /* end p-loop */
+        
+        /* coaxial stacking of (i.j) with (i+1.k) or (k+1.j-1) */
+        
+        new_c = MIN2(new_c, cc1[j-1]+stackEnergy);
+        cc[j] = new_c - psc; /* add covariance bonnus/penalty */
+        c[ij]=cc[j];
+        } /* end >> if (pair) << */
+        else c[ij] = INF;
+        /* done with c[i,j], now compute fML[i,j] */
+        /* free ends ? -----------------------------------------*/
+        
+      }
+
+    {
+      int *FF; /* rotate the auxilliary arrays */
+      FF = DMLi2; DMLi2 = DMLi1; DMLi1 = DMLi; DMLi = FF;
+      FF = cc1; cc1=cc; cc=FF;
+      for (j=1; j<=length; j++) {cc[j]=Fmi[j]=DMLi[j]=INF; }
+    }
+  }
+  foldlist = (folden**) vrna_alloc((length)*sizeof(folden*));
+
+  for(i=0; i< length; i++){
+    foldlist[i]=(folden*) vrna_alloc(sizeof(folden));
+    foldlist[i]->next=NULL;
+    foldlist[i]->k=INF+1;
+    foldlist[i]->energy=INF;
+
+  }
+  folden* head; /* we save the stem loop information in a list like structure */
+
+  for (i = length-TURN-1; i >= 1; i--) { /* i,j in [1..length] */
+    int max_k, min_k;
+    max_k = MIN2(length-min_s2,i+max_half_stem+1);
+    min_k = MAX2(i+half_stem+1, length-max_s2);
+    for (j = i+TURN+1; j <= length; j++) {
+      int ij,a,b;
+      ij = indx[j]+i;
+      for(a=0; a< MISMATCH ;a++){
+        for(b=0; b< MISMATCH ; b++){
+          mLoop[ij]=MIN2(mLoop[ij],  c[indx[j-a]+i+b]);
+
+        }
+      }
+      if(mLoop[ij]>=n_seq*threshloop){
+        mLoop[ij]=INF;        
+      }
+      else{
+        if(j>=min_k-1 && j < max_k){ /* comment if out to recover the known behaviour */
+          head = (folden*) vrna_alloc(sizeof(folden));
+          head->k=j;
+          head->energy=mLoop[ij];
+          head->next=foldlist[i];
+          foldlist[i] = head;
+
+        }
+      }
+    }
+    
+  }
+  free(type);
+  return mLoop[indx[length]+1];/* mLoop;  */
+}
+
+PRIVATE int alibacktrack(const char **strings, int s) {
+
+  /*------------------------------------------------------------------
+    trace back through the "c", "f5" and "fML" arrays to get the
+    base pairing list. No search for equivalent structures is done.
+    This is fast, since only few structure elements are recalculated.
+    ------------------------------------------------------------------*/
+
+  /* normally s=0.
+     If s>0 then s items have been already pushed onto the sector stack */
+  int   i, j, length, energy;/* , new; */
+  int   type_2;
+  int   bonus,n_seq,*type;  int   b=0,cov_en = 0;
+
+  length = strlen(strings[0]);
+  for (n_seq=0; strings[n_seq]!=NULL; n_seq++);
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+  if (s==0) {
+    sector[++s].i = 1;
+    sector[s].j = length;
+    sector[s].ml = 2 ; 
+  }
+  while (s>0) {
+    int ml, ss, cij, traced, i1, j1, p, q;
+    int canonical = 1;     /* (i,j) closes a canonical structure */
+    i  = sector[s].i;
+    j  = sector[s].j;
+    ml = sector[s--].ml;   /* ml is a flag indicating if backtracking is to
+                              occur in the fML- (1) or in the f-array (0) */
+    if (ml==2) {
+      base_pair[++b].i = i;
+      base_pair[b].j   = j;
+      goto repeat1;
+    }
+
+    if (j < i+TURN+1) continue; /* no more pairs in this interval */
+
+
+  repeat1:
+
+    /*----- begin of "repeat:" -----*/
+    if (canonical)  cij = c[indx[j]+i];
+    for (ss=0; ss<n_seq; ss++) {
+      type[ss] = pair[Sali[ss][i]][Sali[ss][j]];
+      if (type[ss]==0) type[ss] = 7;
+    }
+    bonus = 0;
+    
+    if (noLonelyPairs)
+      if (cij == c[indx[j]+i]) {
+        /* (i.j) closes canonical structures, thus
+           (i+1.j-1) must be a pair                */
+        for (ss=0; ss<n_seq; ss++) {
+          type_2 = pair[Sali[ss][j-1]][Sali[ss][i+1]];  /* j,i not i,j */
+          if (type_2==0) type_2 = 7;
+          cij -= P->stack[type[ss]][type_2];
+        }
+        cij += pscore[indx[j]+i];
+        base_pair[++b].i = i+1;
+        base_pair[b].j   = j-1;
+        cov_en += pscore[indx[j-1]+i+1];
+        i++; j--;
+        canonical=0;
+        goto repeat1;
+      }
+    canonical = 1;
+    cij += pscore[indx[j]+i];
+    {int cc=0;
+      for (ss=0; ss<n_seq; ss++)
+        cc += E_Hairpin(j-i-1, type[ss], Sali[ss][i+1], Sali[ss][j-1], strings[ss]+i-1,P);
+      if (cij == cc) /* found hairpin */
+        continue;
+    }
+    for (p = i+1; p <= MIN2(j-2-TURN,i+MAXLOOP+1); p++) {
+      int minq;
+      minq = j-i+p-MAXLOOP-2;
+      if (minq<p+1+TURN) minq = p+1+TURN;
+      for (q = j-1; q >= minq; q--) {
+        for (ss=energy=0; ss<n_seq; ss++) {
+          type_2 = pair[Sali[ss][q]][Sali[ss][p]];  /* q,p not p,q */
+          if (type_2==0) type_2 = 7;
+          energy += E_IntLoop(p-i-1, j-q-1, type[ss], type_2,
+                               Sali[ss][i+1], Sali[ss][j-1],
+                              Sali[ss][p-1], Sali[ss][q+1],P);
+        }
+        traced = (cij == energy+c[indx[q]+p]);
+        if (traced) {
+          base_pair[++b].i = p;
+          base_pair[b].j   = q;
+          cov_en += pscore[indx[q]+p];
+          i = p, j = q;
+          goto repeat1;
+        }
+      }
+    }
+
+    /* end of repeat: --------------------------------------------------*/
+
+    /* (i.j) must close a multi-loop */
+    /* tt = rtype[type]; */
+/*     mm = bonus+P->MLclosing+P->MLintern[tt]; */
+/*     d5 = P->dangle5[tt][S1[j-1]]; */
+/*     d3 = P->dangle3[tt][S1[i+1]]; */
+    i1 = i+1; j1 = j-1;
+    sector[s+1].ml  = sector[s+2].ml = 1;
+    
+/*      if (k<=j-3-TURN) { /\\* found the decomposition *\\/ *\/ */
+/*       sector[++s].i = i1; */
+/*       sector[s].j   = k; */
+/*       sector[++s].i = k+1; */
+/*       sector[s].j   = j1; */
+/*     } /\* else { *\/ */
+/*       vrna_message_error("backtracking failed in repeat"); */
+/*     } */
+    
+  }
+  base_pair[0].i = b;    /* save the total number of base pairs */
+  free(type);
+  return cov_en;
+}
+
+PRIVATE int fill_arrays(const char *string, const int max_asymm, const int threshloop, 
+                        const int min_s2, const int max_s2, const int half_stem, const int max_half_stem) {
+
+  int   i, j,  length, energy;
+  /*   int   decomp;*/ /*, new_fML; */
+  int   no_close, type, type_2;
+  int   bonus;
+  int min_c;
+  
+  min_c=INF;
+  length = (int) strlen(string);
+  bonus=0;
+  /*   max_separation = (int) ((1.-LOCALITY)*(double)(length-2)); */ /* not in use */
+
+
+  
+
+  for (i = length-TURN-1; i >= 1; i--) { /* i,j in [1..length] */
+    /* printf("i=%d\t",i);  */
+    for (j = i+TURN+1; j <= length; j++) {
+/*         printf("j=%d,",j); */
+      int p, q, ij;
+      ij = indx[j]+i;
+      type = ptype[ij];
+      bonus = 0;
+      energy = INF;
+
+      if ((BP[i]==j)||(BP[i]==-1)||(BP[i]==-2)) bonus -= BONUS;
+      if ((BP[j]==-1)||(BP[j]==-3)) bonus -= BONUS;
+      if ((BP[i]==-4)||(BP[j]==-4)) type=0;
+
+      no_close = (((type==3)||(type==4))&&no_closingGU);
+
+      /* if (j-i-1 > max_separation) type = 0; */ /* forces locality degree */
+
+      if (type) {   /* we have a pair */
+        int new_c=0, stackEnergy=INF; /* seems that new_c immer den minimum von cij enthaelt */
+        /* hairpin ----------------------------------------------*/
+
+        if (no_close) new_c = FORBIDDEN;
+        else
+          new_c = E_Hairpin(j-i-1, type, S1[i+1], S1[j-1], string+i-1,P); /* computes hair pin structure for subsequence i...j */
+
+        /*--------------------------------------------------------      
+          check for elementary structures involving more than one
+          closing pair (interior loop).
+          --------------------------------------------------------*/      
+
+        for (p = i+1; p <= MIN2(j-2-TURN,i+MAXLOOP+1) ; p++) {
+          int minq = j-i+p-MAXLOOP-2;
+          if (minq<p+1+TURN) minq = p+1+TURN;
+          for (q = minq; q < j; q++) {
+            
+            if(abs((p-i) - (j-q)) > max_asymm) continue;
+            type_2 = ptype[indx[q]+p];
+
+            if (type_2==0) continue;
+            type_2 = rtype[type_2];
+
+            if (no_closingGU)
+              if (no_close||(type_2==3)||(type_2==4))
+                if ((p>i+1)||(q<j-1)) continue;  /* continue unless stack */
+
+            energy = E_IntLoop(p-i-1, j-q-1, type, type_2,
+                               S1[i+1], S1[j-1], S1[p-1], S1[q+1],P);
+            new_c = MIN2(energy+c[indx[q]+p], new_c);
+            if ((p==i+1)&&(j==q+1)) stackEnergy = energy; /* remember stack energy */
+
+          } /* end q-loop */
+        } /* end p-loop */
+
+
+
+
+        /* coaxial stacking of (i.j) with (i+1.k) or (k+1.j-1) */
+
+
+        new_c = MIN2(new_c, cc1[j-1]+stackEnergy);
+        cc[j] = new_c;
+        c[ij] = new_c;
+        /*         min_c=MIN2(min_c, c[ij]); */
+
+      } /* end >> if (pair) << */
+
+      else c[ij] = INF;
+
+
+      /* done with c[i,j], now compute fML[i,j] */
+      /* free ends ? -----------------------------------------*/
+
+    }
+
+    {
+      int *FF; /* rotate the auxilliary arrays */
+      FF = DMLi2; DMLi2 = DMLi1; DMLi1 = DMLi; DMLi = FF;
+      FF = cc1; cc1=cc; cc=FF;
+      for (j=1; j<=length; j++) {cc[j]=Fmi[j]=DMLi[j]=INF; }
+    }
+  }
+  foldlist = (folden**) vrna_alloc((length+1)*sizeof(folden*));
+  foldlist_XS = (folden**) vrna_alloc((length+1)*sizeof(folden*));
+  /* linked list initialization*/
+  for(i=0; i<=length; i++){
+    foldlist[i]=(folden*) vrna_alloc(sizeof(folden));
+    foldlist[i]->next=NULL;
+    foldlist[i]->k=INF+1;
+    foldlist[i]->energy=INF;
+    foldlist_XS[i]=(folden*) vrna_alloc(sizeof(folden));
+    foldlist_XS[i]->next=NULL;
+    foldlist_XS[i]->k=INF+1;
+    foldlist_XS[i]->energy=INF;
+  }
+  folden* head; /* we save the stem loop information in a list like structure */
+  folden* head_XS;
+  for (i = length-TURN-1; i >= 1; i--) { /* i,j in [1..length] */
+    int max_k, min_k;
+    max_k = MIN2(length-min_s2,i+max_half_stem+1);
+    min_k = MAX2(i+half_stem+1, length-max_s2);
+
+
+    for (j = i+TURN+1; j <= length; j++) {
+        int ij,a,b;
+              ij = indx[j]+i;
+            for(a=0; a< MISMATCH ;a++){
+          for(b=0; b< MISMATCH ; b++){
+              mLoop[ij]=MIN2(mLoop[ij],  c[indx[j-a]+i+b]);
+            /* #mLoop[ij]=MIN2(mLoop[ij], c[indx[j-2]+i]); */
+            /* #mLoop[ij]=MIN2(mLoop[ij], c[indx[j]+i+1]); */
+            /* #mLoop[ij]=MIN2(mLoop[ij], c[indx[j-1]+i+1]); */
+            /* #mLoop[ij]=MIN2(mLoop[ij], c[indx[j-2]+i+1]); */
+            /* #mLoop[ij]=MIN2(mLoop[ij], c[indx[j]+i+2]); */
+            /* #mLoop[ij]=MIN2(mLoop[ij], c[indx[j-1]+i+2]); */
+            /* #mLoop[ij]=MIN2(mLoop[ij], c[indx[j-2]+i+2]); */
+          }
+        }
+        min_c = MIN2(mLoop[ij] ,min_c);
+        
+        if(mLoop[ij]>=threshloop){
+          mLoop[ij]=INF;        
+        }
+        else{
+          if(j>=min_k-1 && j <= max_k){ /* comment if out to recover the known behaviour */
+            head = (folden*) vrna_alloc(sizeof(folden));
+            head->k=j;
+            head->energy=mLoop[ij];
+            head->next=foldlist[i];
+            foldlist[i] = head;
+            head_XS = (folden*) vrna_alloc(sizeof(folden));
+            head_XS->k=i;
+            head_XS->energy=mLoop[ij];
+            head_XS->next=foldlist_XS[j];
+            foldlist_XS[j] = head_XS;            
+          }
+        }
+    }
+    
+  }
+/*   int count=0; */
+/*    for(i=0; i< length; i++){  */
+/*      folden *temp;  */
+/*      temp = foldlist[i];  */
+/*      while(temp->next){  */
+/*        count++; */
+/*        printf("count %d: i%d j%d energy %d \n", count, i, temp->k, temp->energy);  */
+/*        temp=temp->next;  */
+/*      }      */
+/*    }  */
+/*    printf("Count %d \n", count); */
+/*    count=0; */
+/*    for(i=length-1; i>=0; i--){  */
+/*      folden *temp;  */
+/*      temp = foldlist_XS[i];  */
+/*      while(temp->next){  */
+/*        count++; */
+/*        printf("count %d: i%d j%d energy %d \n", count, temp->k,i, temp->energy);  */
+/*        temp=temp->next;  */
+/*      }      */
+/*    }  */
+/*    printf("Count %d \n", count); */
+/*    return mLoop[indx[length]+1]; */ /* mLoop; */
+   return min_c;
+  /* printf("\nmin_array = %d\n", min_c); */
+  /* return f5[length]; */
+}
+
+
+
+
+PRIVATE void backtrack(const char *string, int s) {
+
+  /*------------------------------------------------------------------
+    trace back through the "c", "f5" and "fML" arrays to get the
+    base pairing list. No search for equivalent structures is done.
+    This is fast, since only few structure elements are recalculated.
+    ------------------------------------------------------------------*/
+
+  /* normally s=0.
+     If s>0 then s items have been already pushed onto the sector stack */
+  int   i, j, /*k,*/ length, energy, new;
+  int   no_close, type, type_2;/* , tt; */
+  int   bonus;
+  int   b=0;
+
+  length = strlen(string);
+  if (s==0) {
+    sector[++s].i = 1;
+    sector[s].j = length;
+    sector[s].ml = 2 ; 
+  }
+  while (s>0) {
+    int ml, cij, traced, i1, j1, /*d3, d5, mm,*/ p, q;
+    int canonical = 1;     /* (i,j) closes a canonical structure */
+    i  = sector[s].i;
+    j  = sector[s].j;
+    ml = sector[s--].ml;   /* ml is a flag indicating if backtracking is to
+                              occur in the fML- (1) or in the f-array (0) */
+    if (ml==2) {
+      base_pair[++b].i = i;
+      base_pair[b].j   = j;
+      goto repeat1;
+    }
+
+    if (j < i+TURN+1) continue; /* no more pairs in this interval */
+
+
+  repeat1:
+
+    /*----- begin of "repeat:" -----*/
+    if (canonical)  cij = c[indx[j]+i];
+    type = ptype[indx[j]+i];
+    bonus = 0;
+    if (fold_constrained) {
+      if ((BP[i]==j)||(BP[i]==-1)||(BP[i]==-2)) bonus -= BONUS;
+      if ((BP[j]==-1)||(BP[j]==-3)) bonus -= BONUS;
+    }
+    if (noLonelyPairs)
+      if (cij == c[indx[j]+i]) {
+        /* (i.j) closes canonical structures, thus
+           (i+1.j-1) must be a pair                */
+        type_2 = ptype[indx[j-1]+i+1]; type_2 = rtype[type_2];
+        cij -= P->stack[type][type_2] + bonus;
+        base_pair[++b].i = i+1;
+        base_pair[b].j   = j-1;
+        i++; j--;
+        canonical=0;
+        goto repeat1;
+      }
+    canonical = 1;
+    no_close = (((type==3)||(type==4))&&no_closingGU&&(bonus==0));
+    if (no_close) {
+      if (cij == FORBIDDEN) continue;
+    } else
+      if (cij == E_Hairpin(j-i-1, type, S1[i+1], S1[j-1],string+i-1,P)+bonus)
+        continue;
+    for (p = i+1; p <= MIN2(j-2-TURN,i+MAXLOOP+1); p++) {
+      int minq;
+      minq = j-i+p-MAXLOOP-2;
+      if (minq<p+1+TURN) minq = p+1+TURN;
+      for (q = j-1; q >= minq; q--) {
+        type_2 = ptype[indx[q]+p];
+        if (type_2==0) continue;
+        type_2 = rtype[type_2];
+        if (no_closingGU)
+          if (no_close||(type_2==3)||(type_2==4))
+            if ((p>i+1)||(q<j-1)) continue;  /* continue unless stack */
+        energy = E_IntLoop(p-i-1, j-q-1, type, type_2,
+                           S1[i+1], S1[j-1], S1[p-1], S1[q+1],P);
+        new = energy+c[indx[q]+p]+bonus;
+        traced = (cij == new);
+        if (traced) {
+          base_pair[++b].i = p;
+          base_pair[b].j   = q;
+          i = p, j = q;
+          goto repeat1;
+        }
+      }
+    }
+
+    /* end of repeat: --------------------------------------------------*/
+
+    /* (i.j) must close a multi-loop */
+/*     tt = rtype[type]; */
+/*     mm = bonus+P->MLclosing+P->MLintern[tt]; */
+/*     d5 = P->dangle5[tt][S1[j-1]]; */
+/*     d3 = P->dangle3[tt][S1[i+1]]; */
+    i1 = i+1; j1 = j-1;
+    sector[s+1].ml  = sector[s+2].ml = 1;
+
+/*      if (k<=j-3-TURN) { */ /* found the decomposition */
+/*       sector[++s].i = i1; */
+/*       sector[s].j   = k; */
+/*       sector[++s].i = k+1; */
+/*       sector[s].j   = j1; */
+/*     } else { */
+/*         vrna_message_error("backtracking failed in repeat"); */
+/*     } */
+/*  */
+  }
+
+  base_pair[0].i = b;    /* save the total number of base pairs */
+}
+
+char *snobacktrack_fold_from_pair(const char *sequence, int i, int j) {
+  char *structure;
+  sector[1].i  = i;
+  sector[1].j  = j;
+  sector[1].ml = 2;
+  base_pair[0].i=0;
+  encode_seq(sequence);
+  backtrack(sequence, 1);
+  structure = vrna_db_from_bp_stack(base_pair, strlen(sequence));
+  free(S);free(S1);
+  return structure;
+}
+
+char *alisnobacktrack_fold_from_pair(const char **strings, int i, int j, int *cov) {
+  char *structure;
+  int n_seq, s, length;
+  length = (int) strlen(strings[0]);
+  for (s=0; strings[s]!=NULL; s++);
+  n_seq = s;
+  sector[1].i  = i;
+  sector[1].j  = j;
+  sector[1].ml = 2;
+  base_pair[0].i=0;
+  /* encode_seq(sequence); */
+  Sali = (short **) vrna_alloc(n_seq*sizeof(short *));
+  for (s=0; s<n_seq; s++) {
+    if (strlen(strings[s]) != length) vrna_message_error("uneqal seqence lengths");
+    Sali[s] = aliencode_seq(strings[s]);
+  }
+  *cov=alibacktrack(strings, 1);
+  structure = vrna_db_from_bp_stack(base_pair, length);
+  free(S);free(S1);
+  for (s=0; s<n_seq; s++) {
+    free(Sali[s]);
+  }
+  free(Sali);
+  return structure;
+}
+
+
+
+/*---------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------------*/
+
+
+/*---------------------------------------------------------------------------*/
+
+
+PRIVATE void encode_seq(const char *sequence) {
+  unsigned int i,l;
+
+  l = strlen(sequence);
+  S = (short *) vrna_alloc(sizeof(short)*(l+2));
+  S1= (short *) vrna_alloc(sizeof(short)*(l+2));
+  /* S1 exists only for the special X K and I bases and energy_set!=0 */
+  S[0] = (short) l;
+
+  for (i=1; i<=l; i++) { /* make numerical encoding of sequence */
+    S[i]= (short) encode_char(toupper(sequence[i-1]));
+    S1[i] = alias[S[i]];   /* for mismatches of nostandard bases */
+  }
+  /* for circular folding add first base at position n+1 and last base at
+        position 0 in S1        */
+  S[l+1] = S[1]; S1[l+1]=S1[1]; S1[0] = S1[l];
+}
+
+PRIVATE short * aliencode_seq(const char *sequence) {
+  unsigned int i,l;
+  short *Stemp;
+  l = strlen(sequence);
+  Stemp = (short *) vrna_alloc(sizeof(short)*(l+2));
+  Stemp[0] = (short) l;
+
+  /* make numerical encoding of sequence */
+  for (i=1; i<=l; i++)
+    Stemp[i]= (short) encode_char(toupper(sequence[i-1]));
+
+  /* for circular folding add first base at position n+1 */
+  /* Stemp[l+1] = Stemp[1]; */
+
+  return Stemp;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC void snoupdate_fold_params(void)
+{
+  vrna_md_t md;
+  if(P)
+    free(P);
+  set_model_details(&md);
+  P = vrna_params(&md);
+  make_pair_matrix();
+  if (init_length < 0) init_length=0;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void make_ptypes(const short *S, const char *structure) {
+  int n,i,j,k,l;
+
+  n=S[0];
+  for (k=1; k<n-TURN; k++)
+    for (l=1; l<=2; l++) {
+      int type,ntype=0,otype=0;
+      i=k; j = i+TURN+l; if (j>n) continue;
+      type = pair[S[i]][S[j]];
+      while ((i>=1)&&(j<=n)) {
+        if ((i>1)&&(j<n)) ntype = pair[S[i-1]][S[j+1]];
+        if (noLonelyPairs && (!otype) && (!ntype))
+          type = 0; /* i.j can only form isolated pairs */
+        ptype[indx[j]+i] = (char) type;
+        otype =  type;
+        type  = ntype;
+        i--; j++;
+      }
+    }
+
+  if (fold_constrained&&(structure!=NULL)) {
+    constrain_ptypes(structure, (unsigned int)n, ptype, BP, TURN, 0);
+  }
+}
diff --git a/C/ViennaRNA/snofold.h b/C/ViennaRNA/snofold.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/snofold.h
@@ -0,0 +1,58 @@
+/* function from fold.c */
+#ifndef VIENNA_RNA_PACKAGE_SNOFOLD_H
+#define VIENNA_RNA_PACKAGE_SNOFOLD_H
+
+#include <ViennaRNA/data_structures.h>
+
+/* Normal fold */
+
+/**
+*** snofold is the stem folding array for RNAsnoop
+**/
+int  snofold( const char *sequence,
+		char *structure,
+                const int max_assym,
+                const int threshold, 
+                const int min_s2,
+                const int max_s2,
+                const int half_stem,
+                const int max_half_stem);
+/**
+*** Free arrays and structure related to snofold
+**/
+
+void   snofree_arrays(const int length);  /* free arrays for mfe folding */
+void   snoinitialize_fold(int length);    /* allocate arrays for folding */
+void   snoupdate_fold_params(void);       /* recalculate parameters */
+int    snoloop_energy(short *ptable,
+                      short *s,
+                      short *s1,
+                      int i);
+void   snoexport_fold_arrays( int **indx_p,
+                              int **mLoop_p,
+                              int **cLoop,
+                              folden ***fold_p,
+                              folden ***fold_p_XS);
+char * snobacktrack_fold_from_pair( const char *sequence,
+                                    int i,
+                                    int j);
+/* alifold */
+float alisnofold( const char **strings,
+                  const int max_assym,
+                  const int threshloop, 
+                  const int min_s2,
+                  const int max_s2,
+                  const int half_stem,
+                  const int max_half_stem);
+void  alisnofree_arrays(const int length);
+char  *alisnobacktrack_fold_from_pair(const char **sequence,
+                                      int i,
+                                      int j,
+                                      int *cov);
+extern double cv_fact /* =1 */;
+extern double nc_fact /* =1 */;
+
+/* max number of mismatch >>>>>..((   )).>>>> */
+#define MISMATCH 3
+
+#endif
diff --git a/C/ViennaRNA/snoop.c b/C/ViennaRNA/snoop.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/snoop.c
@@ -0,0 +1,2621 @@
+/*                
+           compute the duplex structure of two RNA strands,
+                allowing only inter-strand base pairs.
+         see cofold() for computing hybrid structures without
+                             restriction.
+
+                             Ivo Hofacker
+                          Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/snofold.h"
+#include "ViennaRNA/pair_mat.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/snoop.h"
+#include "ViennaRNA/PS_dot.h"
+/* #include "ViennaRNA/fold.h" */
+#include "ViennaRNA/duplex.h"
+#include "ViennaRNA/loop_energies.h"
+
+
+#define STACK_BULGE1  1   /* stacking energies for bulges of size 1 */
+#define NEW_NINIO     1   /* new asymetry penalty */
+
+
+
+PRIVATE void  encode_seqs(const char *s1, const char *s2);
+PRIVATE short *encode_seq(const char *seq);
+
+PRIVATE void find_max_snoop(const char *s1, const char *s2, const int max, 
+                            const int alignment_length, const int* position, 
+                            const int delta, const int distance,  const int penalty, 
+                            const int threshloop, const int threshLE, const int threshRE, 
+                            const int threshDE, const int threshTE, const int threshSE, const int threshD,
+                            const int half_stem, const int max_half_stem,  const int min_s2, 
+                            const int max_s2, const int min_s1, const int  max_s1, const int min_d1, const int min_d2, const char* name, const int fullStemEnergy);
+
+PRIVATE void find_max_snoop_XS(const char *s1, const char *s2, const int **access_s1, const int max, 
+                               const int alignment_length, const int* position, const int *position_j,
+                               const int delta, const int distance,  const int penalty, 
+                               const int threshloop, const int threshLE, const int threshRE, 
+                               const int threshDE, const int threshTE, const int threshSE, const int threshD,
+                               const int half_stem, const int max_half_stem,  const int min_s2, 
+                               const int max_s2, const int min_s1, const int  max_s1, const int min_d1, const int min_d2, const char *name, const int fullStemEnergy);
+
+
+
+
+
+PRIVATE char * alisnoop_backtrack(int i, int j, const char ** s2, 
+                                  int* Duplex_El, int* Duplex_Er, int* Loop_E, int *Loop_D, int *u, 
+                                  int *pscd, int *psct, int *pscg,
+                                  const int penalty, const int threshloop, 
+                                  const int threshLE, const int threshRE, const int threshDE, const int threshD,
+                                  const int half_stem, const int max_half_stem, 
+                                  const int min_s2, const int max_s2, const int min_s1, 
+                                  const int max_s1, const int min_d1, const int min_d2,
+                                  const short **S1, const short **S2);
+
+   
+PRIVATE char * snoop_backtrack(int i, int j, const char* s2, int* Duplex_El, int* Duplex_Er, int* Loop_E, int *Loop_D, int *u, 
+                               const int penalty, const int threshloop, const int threshLE, const int threshRE, const int threshDE, 
+                               const int threshD,
+                               const int half_stem, const int max_half_stem, 
+                               const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2);
+
+PRIVATE char * snoop_backtrack_XS(int i, int j, const char* s2, int* Duplex_El, int* Duplex_Er, int* Loop_E, int *Loop_D, int *u, 
+                               const int penalty, const int threshloop, const int threshLE, const int threshRE, const int threshDE, 
+                               const int threshD,
+                               const int half_stem, const int max_half_stem, 
+                               const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2);
+
+
+
+
+PRIVATE int compare(const void *sub1, const void *sub2);
+PRIVATE int covscore(const int *types, int n_seq);
+PRIVATE short * aliencode_seq(const char *sequence);
+
+PUBLIC  int snoop_subopt_sorted=0; /* from subopt.c, default 0 */
+
+
+/*@unused@*/
+
+
+
+
+#define MAXLOOP_L        3
+#define MIN2(A, B)      ((A) < (B) ? (A) : (B))
+#define MAX2(A, B)      ((A) > (B) ? (A) : (B))
+#define ASS                1
+PRIVATE vrna_param_t *P = NULL;
+
+PRIVATE int   **c = NULL;      /* energy array, given that i-j pair */
+PRIVATE int   **r = NULL;
+PRIVATE int   **lc = NULL;      /* energy array, given that i-j pair */
+PRIVATE int   **lr = NULL;
+PRIVATE int   **c_fill = NULL;
+PRIVATE int   **r_fill = NULL;
+PRIVATE int   **lpair = NULL;
+
+
+PRIVATE short  *S1 = NULL, *SS1 = NULL, *S2 = NULL, *SS2 = NULL;
+PRIVATE short *S1_fill = NULL, *SS1_fill = NULL, *S2_fill = NULL, *SS2_fill = NULL;
+PRIVATE int   n1,n2;    /* sequence lengths */
+
+extern int cut_point;
+
+PRIVATE int delay_free=0;
+/*--------------------------------------------------------------------------*/
+
+snoopT alisnoopfold(const char **s1, const char **s2, 
+                    const int penalty, const int threshloop, 
+                    const int threshLE, const int threshRE, const int threshDE, const int threshD,
+                    const int half_stem, const int max_half_stem, 
+                    const int min_s2, const int max_s2, const int min_s1, 
+                    const int max_s1, const int min_d1, const int min_d2) {
+  
+  int s,n_seq;
+  int i, j, E, l1,Emin=INF, i_min=0, j_min=0;
+  char *struc;
+  snoopT mfe;
+  int *indx;
+  int *mLoop;
+  int *cLoop;
+  folden  **foldlist; folden **foldlist_XS;
+  int Duplex_El, Duplex_Er,pscd,psct,pscg;
+  int Loop_D;
+  int u;
+  int Loop_E;
+  short **Sali1,**Sali2;
+  int *type,*type2,*type3;
+  vrna_md_t md;
+  Duplex_El=0;Duplex_Er=0;Loop_E=0; Loop_D=0;pscd=0;psct=0;pscg=0;
+  snoexport_fold_arrays(&indx, &mLoop, &cLoop,&foldlist, &foldlist_XS); 
+  n1 = (int) strlen(s1[0]);
+  n2 = (int) strlen(s2[0]);
+  
+  for (s=0; s1[s]!=NULL; s++);
+  n_seq = s;
+  for (s=0; s2[s]!=NULL; s++);
+  if (n_seq != s) vrna_message_error("unequal number of sequences in aliduplexfold()\n");
+  
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    snoupdate_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  
+  c = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+  r = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+  for (i=0; i<=n1; i++) {
+          c[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        r[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        for(j=n2; j>-1; j--){
+                c[i][j]=INF;
+                r[i][j]=INF;
+        }
+  }
+  Sali1 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  Sali2 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  for (s=0; s<n_seq; s++) {
+    if ((int)strlen(s1[s]) != n1) vrna_message_error("uneqal seqence lengths");
+    if ((int)strlen(s2[s]) != n2) vrna_message_error("uneqal seqence lengths");
+    Sali1[s] = aliencode_seq(s1[s]);
+    Sali2[s] = aliencode_seq(s2[s]);
+  }
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+  type2 = (int *) vrna_alloc(n_seq*sizeof(int));
+  type3 = (int *) vrna_alloc(n_seq*sizeof(int));
+  /*   encode_seqs(s1, s2); */
+  for (i=6; i<=n1-5; i++) {
+    int U; U=0;
+    for (s=0; s<n_seq; s++) {
+      U+=Sali1[s][i-2];
+    }
+    U = (U==(n_seq)*4?1:0);
+    for (j=n2-min_d2; j>min_d1; j--) {
+      int type4, k,l,psc,psc2,psc3;
+      for (s=0; s<n_seq; s++) {
+        type[s] = pair[Sali1[s][i]][Sali2[s][j]];
+      }
+      psc = covscore(type, n_seq);
+      for (s=0; s<n_seq; s++) if (type[s]==0) type[s]=7;
+      c[i][j] = (psc>=MINPSCORE) ? (n_seq*P->DuplexInit) : INF;
+      if (psc<MINPSCORE) continue;
+      if(/*  pair[Sali1[i+1]][Sali2[j-1]] &&  */
+         U && j < max_s1 && j > min_s1 &&  
+         j > n2 - max_s2 - max_half_stem && 
+         j < n2 -min_s2 -half_stem ) { /*constraint on s2 and i*/
+        folden *temp;
+        temp=foldlist[j+1];
+        while(temp->next){
+          int k = temp->k;
+          for (s=0; s<n_seq; s++) {
+            type2[s]= pair[Sali1[s][i-3]][Sali2[s][k+1]];
+            type3[s]= pair[Sali1[s][i-4]][Sali2[s][k+1]];
+          }
+          psc2 = covscore(type2, n_seq);
+          psc3 = covscore(type3, n_seq);
+          if(psc2 > MINPSCORE){
+            r[i][j]=MIN2(r[i][j],c[i-3][k+1]+temp->energy);
+          }
+          if(psc3 > MINPSCORE){
+            r[i][j]=MIN2(r[i][j],c[i-4][k+1]+temp->energy);
+          }
+          temp=temp->next;
+        }
+      }
+      /* dangle 5'SIDE relative to the mRNA  */
+      for (s=0; s<n_seq; s++) {
+        c[i][j] += E_ExtLoop(type[s], Sali1[s][i-1],Sali2[s][j+1],P);
+      }
+      for (k=i-1; k>0 && (i-k)<MAXLOOP_L; k--) {
+        for (l=j+1; l<=n2 ; l++) {
+          if (i-k+l-j>2*MAXLOOP_L-2) break;
+          if (abs(i-k-l+j) >= ASS ) continue;
+          for (E=s=0; s<n_seq; s++) { 
+            type4 = pair[Sali1[s][k]][Sali2[s][l]];
+            if (type4==0) type4=7;
+            E += E_IntLoop(i-k-1, l-j-1, type4, rtype[type[s]],
+                           Sali1[s][k+1], Sali2[s][l-1], Sali1[s][i-1], Sali2[s][j+1],P);
+          }
+          c[i][j] = MIN2(c[i][j], c[k][l] + E);
+          r[i][j] = MIN2(r[i][j], r[k][l] + E);
+        }
+      }
+      c[i][j]-=psc;
+      r[i][j]-=psc;
+      E = r[i][j]; 
+      for (s=0; s<n_seq; s++) {
+        E+= E_ExtLoop(rtype[type[s]], Sali2[s][j-1], Sali1[s][i+1], P);
+        /**
+        *** if (i<n1) E += P->dangle3[rtype[type[s]]][Sali1[s][i+1]];
+        *** if (j>1)  E += P->dangle5[rtype[type[s]]][Sali2[s][j-1]];
+        *** if (type[s]>2) E += P->TerminalAU;
+        **/
+      }
+      if (E<Emin) {
+        Emin=E; i_min=i; j_min=j;
+      } 
+    }
+  }
+  if(Emin > 0){
+          printf("no target found under the constraints chosen\n");
+        for (i=0; i<=n1; i++) {free(r[i]);free(c[i]);}
+        free(c);
+        free(r);
+        for(s=0; s<n_seq;s++){
+          free(Sali1[s]);
+          free(Sali2[s]);
+        }
+        free(Sali1); free(Sali2);
+        free(S2); free(SS1); free(SS2);free(type);free(type2);free(type3);
+        mfe.energy=INF;
+        mfe.structure=NULL;
+        return mfe;
+  }
+  struc = alisnoop_backtrack(i_min, j_min,(const char**) s2, 
+                             &Duplex_El, &Duplex_Er, &Loop_E, 
+                             &Loop_D, &u, &pscd, &psct, &pscg,
+                             penalty, threshloop, threshLE, 
+                             threshRE,threshDE, threshD,
+                             half_stem, max_half_stem, min_s2, 
+                             max_s2, min_s1, max_s1, min_d1, 
+                             min_d2,(const short**) Sali1,(const short**) Sali2);
+  /* if (i_min<n1-5) i_min++; */
+  /* if (j_min>6 ) j_min--; */
+  l1 = strchr(struc, '&')-struc;
+  mfe.i = i_min-5;
+  mfe.j = j_min-5;
+  mfe.u = u -5;
+  mfe.Duplex_Er = (float) Duplex_Er/100;
+  mfe.Duplex_El = (float) Duplex_El/100;
+  mfe.Loop_D = (float) Loop_D/100;
+  mfe.Loop_E = (float) Loop_E/100;
+  mfe.energy = (float) Emin/100 ;
+  /* mfe.fullStemEnergy = (float) fullStemEnergy/100; */
+  mfe.pscd = pscd;
+  mfe.psct = psct;
+  mfe.structure = struc;
+  for(s=0; s<n_seq;s++){
+    free(Sali1[s]);free(Sali2[s]);
+  }
+  free(Sali1);free(Sali2);free(type);free(type2);free(type3);
+
+  if (!delay_free) {
+    for (i=0; i<=n1; i++) {free(r[i]);free(c[i]);}
+    free(c);
+    free(r);
+    free(S2); free(SS1); free(SS2);
+  }
+  return mfe;
+}
+
+PUBLIC snoopT *alisnoop_subopt(const char **s1, const char **s2, int delta, int w, 
+                              const int penalty, const int threshloop, 
+                               const int threshLE, const int threshRE, const int threshDE, const int threshTE, const int threshSE, const int threshD,
+                              const int distance, const int half_stem, const int max_half_stem,
+                               const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2) {
+
+
+  short **Sali1, **Sali2;
+  /* printf("%d %d\n", min_s2, max_s2); */
+  int i,j,s,n_seq, n1, n2, E, n_subopt=0, n_max;
+  char *struc;
+  snoopT mfe;
+  snoopT *subopt;
+  int thresh;
+  int *type;
+  int Duplex_El, Duplex_Er, Loop_E,pscd,psct,pscg;
+  int Loop_D;
+  Duplex_El=0; Duplex_Er=0; Loop_E=0;Loop_D=0;pscd=0;psct=0;pscg=0;
+  int u;
+  u=0;
+  n_max=16;
+  subopt = (snoopT *) vrna_alloc(n_max*sizeof(snoopT));
+  delay_free=1;
+  mfe = alisnoopfold(s1, s2, penalty, threshloop, threshLE, threshRE, threshDE,threshD,
+                  half_stem, max_half_stem,
+                     min_s2, max_s2, min_s1, max_s1, min_d1, min_d2);
+  if(mfe.energy > 0){
+          free(subopt);
+        delay_free=0;
+        return NULL;
+  }
+  thresh = MIN2((int) ((mfe.Duplex_Er + mfe.Duplex_El + mfe.Loop_E)*100+0.1 + 410) + delta, threshTE );
+ /* subopt[n_subopt++]=mfe; */
+  free(mfe.structure);
+  n1 = (int)strlen(s1[0]);
+  n2 = (int)strlen(s2[0]);
+  for (s=0; s1[s]!=NULL; s++);
+  n_seq = s;
+  Sali1 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  Sali2 = (short **) vrna_alloc((n_seq+1)*sizeof(short *));
+  for (s=0; s<n_seq; s++) {
+    if ((int)strlen(s1[s]) != n1) vrna_message_error("uneqal seqence lengths");
+    if ((int)strlen(s2[s]) != n2) vrna_message_error("uneqal seqence lengths");
+    Sali1[s] = aliencode_seq(s1[s]);
+    Sali2[s] = aliencode_seq(s2[s]);
+  }
+  Sali1[n_seq]=NULL;  Sali2[n_seq]=NULL;
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+  for (i=n1; i>1; i--){
+    for (j=1; j<=n2; j++) {
+      int  ii,jj, Ed,psc,skip;
+      for (s=0; s<n_seq; s++) {
+        type[s] = pair[Sali2[s][j]][Sali1[s][i]];
+      }
+      psc = covscore(type, n_seq);
+      for (s=0; s<n_seq; s++) if (type[s]==0) type[s]=7;
+      if (psc<MINPSCORE) continue;
+      E = Ed = r[i][j];
+      for  (s=0; s<n_seq; s++) {
+        /*         if (i<n1-5) Ed += P->dangle3[type[s]][Sali1[s][i+1]]; */
+        /*       if (j>6)  Ed += P->dangle5[type[s]][Sali2[s][j-1]]; */
+        if (type[s]>2) Ed += P->TerminalAU;
+      }
+      if (Ed>thresh) continue;
+      /* too keep output small, remove hits that are dominated by a
+         better one close (w) by. For simplicity we do test without
+         adding dangles, which is slightly inaccurate. 
+      */ 
+      w=1;
+      for (skip=0, ii=MAX2(i-w,1); (ii<=MIN2(i+w,n1)) && type; ii++) { 
+        for (jj=MAX2(j-w,1); jj<=MIN2(j+w,n2); jj++)
+          if (r[ii][jj]<E) {skip=1; break;}
+      }
+      if (skip){continue;}
+      psct=0;
+      pscg=0;
+      struc = alisnoop_backtrack(i,j,s2, &Duplex_El, 
+                                 &Duplex_Er, &Loop_E, &Loop_D, &u, &pscd, &psct,&pscg, 
+                                 penalty, threshloop,threshLE,threshRE,threshDE, threshD,
+                                 half_stem, max_half_stem, min_s2, max_s2, min_s1, max_s1, min_d1, min_d2,(const short int**) Sali1,(const int short **) Sali2);
+              
+      if (Duplex_Er > threshRE || Duplex_El > threshLE || Loop_D > threshD ||
+         (Duplex_Er + Duplex_El) > threshDE || 
+         (Duplex_Er + Duplex_El + Loop_E) > threshTE ||
+         (Duplex_Er + Duplex_El + Loop_E + Loop_D + 410) > threshSE) {
+                 /* printf(" Duplex_Er %d threshRE %d Duplex_El %d threshLE %d \n" */
+                /*        " Duplex_Er + Duplex_El %d  threshDE %d \n" */
+                /*        " Duplex_Er + Duplex_El + Loop_E %d  threshTE %d \n" */
+                /*        " Duplex_Er + Duplex_El + Loop_E + Loop_D %d  threshSE %d \n",  */
+                /*          Duplex_Er , threshRE , Duplex_El ,threshLE, */
+                /*          Duplex_Er + Duplex_El, threshDE, */
+                /*          Duplex_Er + Duplex_El+  Loop_E , threshTE, */
+                /*          Duplex_Er + Duplex_El+  Loop_E + Loop_D, threshSE);  */
+                 Duplex_Er=0; 
+                Duplex_El=0;
+                Loop_E = 0;
+                Loop_D = 0;
+                u=0,
+                free(struc);
+                continue;
+        }
+
+      if (n_subopt+1>=n_max) {
+        n_max *= 2;
+        subopt = (snoopT *) vrna_realloc(subopt, n_max*sizeof(snoopT));
+      }
+      
+      subopt[n_subopt].i = i-5;
+      subopt[n_subopt].j = j-5;
+      subopt[n_subopt].u = u-5;
+      subopt[n_subopt].Duplex_Er = Duplex_Er * 0.01;
+      subopt[n_subopt].Duplex_El = Duplex_El * 0.01;
+      subopt[n_subopt].Loop_E = Loop_E * 0.01;
+      subopt[n_subopt].Loop_D = Loop_D * 0.01;
+      subopt[n_subopt].energy = (Duplex_Er +Duplex_El + Loop_E + Loop_D + 410) * 0.01 ;
+      subopt[n_subopt].pscd = pscd * 0.01;
+      subopt[n_subopt].psct = -psct * 0.01;
+      subopt[n_subopt++].structure = struc;
+      
+      /* i=u; */
+      Duplex_Er=0; Duplex_El=0; Loop_E=0; Loop_D=0;u=0;pscd=0;psct=0;
+    }
+  }
+  
+  for (i=0; i<=n1; i++) {free(c[i]);free(r[i]);}
+  free(c);free(r);
+  for (s=0; s<n_seq; s++) {
+    free(Sali1[s]); free(Sali2[s]);
+  }
+  free(Sali1); free(Sali2); free(type);
+  
+  if (snoop_subopt_sorted) 
+    qsort(subopt, n_subopt, sizeof(snoopT), compare);
+  subopt[n_subopt].i =0;
+  subopt[n_subopt].j =0;
+  subopt[n_subopt].structure = NULL;
+  return subopt;
+}
+
+
+
+
+
+
+
+PRIVATE char *alisnoop_backtrack(int i, int j, const char ** snoseq, int *Duplex_El, 
+                                 int *Duplex_Er, int *Loop_E, int *Loop_D, int *u, 
+                                 int *pscd, int *psct, int *pscg,
+                                 const int penalty, const int threshloop, const int threshLE, 
+                                 const int threshRE, const int threshDE, const int threshD, const int half_stem, 
+                                 const int max_half_stem, 
+                                 const int min_s2, const int max_s2, const int min_s1, 
+                                 const int max_s1, 
+                                 const int min_d1, const int min_d2,const short **Sali1, const short **Sali2) {
+  /* backtrack structure going backwards from i, and forwards from j 
+     return structure in bracket notation with & as separator */
+  int k, l, *type,*type2,*type3,type4, E, traced, i0, j0,s,n_seq,psc;
+  int traced_r=0; /* flag for following backtrack in c or r */
+  char *st1, *st2, *struc;
+  char *struc_loop;
+  n1 = (int) Sali1[0][0];
+  n2 = (int) Sali2[0][0];
+  
+  for (s=0; Sali1[s]!=NULL; s++);
+  n_seq = s;
+  for (s=0; Sali2[s]!=NULL; s++);
+  if (n_seq != s) vrna_message_error("unequal number of sequences in alibacktrack()\n");
+  
+  st1 = (char *) vrna_alloc(sizeof(char)*(n1+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n2+1));
+  type = (int *) vrna_alloc(n_seq*sizeof(int));
+  type2 = (int *) vrna_alloc(n_seq*sizeof(int));
+  type3 = (int *) vrna_alloc(n_seq*sizeof(int));
+  int *indx;
+  int *mLoop;
+  int *cLoop;
+  folden **foldlist, **foldlist_XS;
+  snoexport_fold_arrays(&indx, &mLoop, &cLoop,&foldlist, &foldlist_XS ); 
+  i0=i; j0=j; /* MIN2(i+1,n1); j0=MAX2(j-1,1);!modified */
+  for (s=0; s<n_seq; s++) {
+    type[s] = pair[Sali1[s][i]][Sali2[s][j]];
+    if(type[s]==0) type[s] = 7;
+    *Duplex_Er += E_ExtLoop(rtype[type[s]], (j>1) ? Sali2[s][j-1] : -1, (i<n1) ? Sali1[s][i+1] : -1, P);
+    /**
+    *** if (i<n1)   *Duplex_Er += P->dangle3[rtype[type[s]]][Sali1[s][i+1]];
+    *** if (j>1)    *Duplex_Er += P->dangle5[rtype[type[s]]][Sali2[s][j-1]];
+    *** if (type[s]>2) *Duplex_Er += P->TerminalAU;
+    **/
+  }
+  while (i>0 && j<=n2-min_d2 ) {
+    if(!traced_r) {
+      E = r[i][j]; traced=0;
+      st1[i-1] = '<';
+      st2[j-1] = '>'; 
+      for (s=0; s<n_seq; s++) {
+        type[s] = pair[Sali1[s][i]][Sali2[s][j]];
+      }
+      psc = covscore(type,n_seq);
+      for (s=0; s<n_seq; s++) if (type[s]==0) type[s] = 7;
+      E += psc;
+      *pscd +=psc;
+      for (k=i-1; k>0 && (i-k)<MAXLOOP_L; k--) {
+        for (l=j+1; l<=n2 ; l++) {
+          int LE;
+          if (i-k+l-j>2*MAXLOOP_L-2) break;
+          if (abs(i-k-l+j) >= ASS) continue;
+          for (s=LE=0; s<n_seq; s++) {
+            type4 = pair[Sali1[s][k]][Sali2[s][l]];
+            if (type4==0) type4=7;
+            LE += E_IntLoop(i-k-1, l-j-1, type4, rtype[type[s]], Sali1[s][k+1], Sali2[s][l-1], Sali1[s][i-1], Sali2[s][j+1],P);
+          }
+          if (E == r[k][l]+LE) {
+            traced=1; 
+            i=k; j=l;
+            *Duplex_Er+=LE;
+            break;
+          }
+        }
+        if (traced) break;
+      }
+      if(!traced){
+        int U=0;
+        for (s=0; s<n_seq; s++) {
+          U+=Sali1[s][i-2];
+        }
+        U = (U==(n_seq)*4?1:0);
+        if(/*  pair[Sali1[i+1]][Sali2[j-1]] && */   /* only U's are allowed */
+            U && j < max_s1 && j > min_s1 && 
+            j > n2 - max_s2 - max_half_stem && 
+            j < n2 -min_s2 -half_stem ) {
+          int min_k, max_k;
+          max_k = MIN2(n2-min_s2,j+max_half_stem+1);
+          min_k = MAX2(j+half_stem+1, n2-max_s2);
+          folden * temp;
+          temp=foldlist[j+1];
+          while(temp->next) {
+            int psc2, psc3;
+            int k = temp->k;
+            for (s=0; s<n_seq; s++) {
+              type2[s]= pair[Sali1[s][i-3]][Sali2[s][k+1]];
+              type3[s]= pair[Sali1[s][i-4]][Sali2[s][k+1]];
+            }
+            psc2 = covscore(type2, n_seq);
+            psc3 = covscore(type3, n_seq);
+            if(psc2>MINPSCORE /*&& pair[Sali1[i-4]][Sali2[k+2]]*/    ){  /* introduce structure from RNAfold */
+              if(E==c[i-3][k+1]+temp->energy){
+                *Loop_E=temp->energy;
+                st1[i-3]= '|';
+                *u=i-2;
+                int a,b;
+                /* int fix_ij=indx[k-1+1]+j+1; */
+                for(a=0; a< MISMATCH ;a++){
+                  for(b=0; b< MISMATCH ; b++){
+                    int ij=indx[k-1-a+1]+j+1+b;
+                    if(cLoop[ij]==temp->energy) {
+                      /* int bla; */
+                      struc_loop=alisnobacktrack_fold_from_pair(snoseq, j+1+b, k-a-1+1,psct);
+                    a=INF; b=INF;        
+                    }
+                  }
+                }
+                traced=1;
+                traced_r=1;
+                i=i-3;j=k+1;
+                break;
+              }
+            }
+             if (psc3>MINPSCORE  /*&& pair[Sali1[i-5]][Sali2[k+2]]*/){  /* introduce structure from RNAfold */
+              if(E==c[i-4][k+1]+temp->energy){
+                *Loop_E=temp->energy;
+                st1[i-3]= '|';
+                *u=i-2;
+                int a,b;
+                /* int fix_ij=indx[k-1+1]+j+1; */
+                for(a=0; a< MISMATCH ;a++){
+                  for(b=0; b< MISMATCH ; b++){
+                    int ij=indx[k-1-a+1]+j+1+b;
+                    if(cLoop[ij]==temp->energy) {
+                      /* int bla; */
+                      struc_loop=alisnobacktrack_fold_from_pair(snoseq, j+1+b, k-a-1+1,psct);
+                      a=INF; b=INF;        
+                    }
+                  }
+                }
+                traced=1;
+                traced_r=1;
+                i=i-4;j=k+1;
+                break;
+              }
+            } /* else if */
+            temp=temp->next;
+          } /* while temp-> next */
+        } /* test on j  */
+      }/* traced? */
+    }/* traced_r? */
+    else{
+      E = c[i][j]; traced=0;
+      st1[i-1] = '<';
+      st2[j-1] = '>'; 
+      for (s=0; s<n_seq; s++) {
+        type[s] = pair[Sali1[s][i]][Sali2[s][j]];
+      }
+      psc = covscore(type,n_seq);
+      for (s=0; s<n_seq; s++) if (type[s]==0) type[s] = 7;
+      E += psc;
+      *pscd+=psc;
+      if (!type) vrna_message_error("backtrack failed in fold duplex c");
+      for (k=i-1; (i-k)<MAXLOOP_L; k--) {
+        for (l=j+1; l<=n2; l++) {
+          int LE;
+          if (i-k+l-j>2*MAXLOOP_L-2) break;
+          if (abs(i-k-l+j) >= ASS) continue;
+          for (s=LE=0; s<n_seq; s++) {
+            type4 = pair[Sali1[s][k]][Sali2[s][l]];
+            if (type4==0) type4=7;
+            LE += E_IntLoop(i-k-1, l-j-1, type4, rtype[type[s]], Sali1[s][k+1], Sali2[s][l-1], Sali1[s][i-1], Sali2[s][j+1],P);
+          }
+          if (E == c[k][l]+LE) {
+            traced=1; 
+            i=k; j=l;
+            *Duplex_El+=LE;
+            break;
+          }
+        }
+        if (traced) break;
+      }
+    }
+    if (!traced) { 
+      for (s=0; s<n_seq; s++) {
+        int correction;
+        correction = E_ExtLoop(type[s], (i>1) ? Sali1[s][i-1] : -1, (j<n2) ? Sali2[s][j+1] : -1, P);
+        *Duplex_El += correction;
+        E          -= correction;
+        /**
+        *** if (i>1)    {E -= P->dangle5[type[s]][Sali1[s][i-1]]; *Duplex_El +=P->dangle5[type[s]][Sali1[s][i-1]];}
+        *** if (j<n2)   {E -= P->dangle3[type[s]][Sali2[s][j+1]]; *Duplex_El +=P->dangle3[type[s]][Sali2[s][j+1]];}
+        *** if (type[s]>2) {E -= P->TerminalAU;                      *Duplex_El +=P->TerminalAU;}
+        **/
+      }
+      if (E != n_seq * P->DuplexInit) {
+        vrna_message_error("backtrack failed in fold duplex end");
+      } else break;
+    }
+  }
+/*   if (i>1)  i--;  */
+/*   if (j<n2) j++;  */
+  /* struc = (char *) vrna_alloc(i0-i+1+j-j0+1+2); */ /* declare final duplex structure */
+  struc = (char *) vrna_alloc(i0-i+1+n2-1+1+2); /* declare final duplex structure */
+  char * struc2;
+  struc2 = (char *) vrna_alloc(n2+1);
+  /* char * struct_const; */
+  for (k=MAX2(i,1); k<=i0; k++) if (!st1[k-1]) st1[k-1] = '.';
+  /* for (k=j0; k<=j; k++) if (!st2[k-1]) st2[k-1] = struc_loop[k-1];*/ /* '.'; normal */
+  /*  char * struct_const; */
+  /*  struct_const = (char *) vrna_alloc(sizeof(char)*(n2+1));   */
+  for (k=1; k<=n2; k++) {
+    if (!st2[k-1]) st2[k-1] = struc_loop[k-1];/* '.'; */
+    struc2[k-1] = st2[k-1];/* '.'; */
+    /*      if (k>=j0 && k<=j){ */
+    /*              struct_const[k-1]='x'; */
+    /*      } */
+    /*      else{ */
+    /*              if(k<j0) {struct_const[k-1]='<';} */
+    /*              if(k>j) {struct_const[k-1]='>';} */
+    /*      } */
+  }
+
+  /*   char duplexseq_1[j0+1]; */
+  /* char duplexseq_2[n2-j+3]; */
+  if(j<n2){
+    char **duplexseq_1, **duplexseq_2;
+    duplexseq_1 = (char**) vrna_alloc((n_seq+1) * sizeof(char*));
+    duplexseq_2 = (char**) vrna_alloc((n_seq+1) * sizeof(char*));
+    for(s=0; s<n_seq; s++){
+      duplexseq_1[s] = (char*) vrna_alloc((j0)*sizeof(char)); /* modfied j0+1 */
+      duplexseq_2[s] = (char*) vrna_alloc((n2-j+2)*sizeof(char)); /* modified j+3 */
+      strncpy(duplexseq_1[s], snoseq[s], j0-1); /* modified j0 */
+      strcpy(duplexseq_2[s], snoseq[s] + j); /* modified j-1 */
+      duplexseq_1[s][j0-1]='\0'; /* modified j0 */
+      duplexseq_2[s][n2-j+1]='\0';/* modified j+2 */
+    }
+    duplexseq_1[n_seq]=NULL;
+    duplexseq_2[n_seq]=NULL;
+    duplexT temp;
+    temp=aliduplexfold((const char**)duplexseq_1, (const char**)duplexseq_2);
+    *Loop_D =  MIN2(0,-410 + (int) 100 * temp.energy*n_seq);
+    if(*Loop_D){
+      int l1,ibegin, iend, jbegin, jend;
+      l1=strchr(temp.structure, '&')-temp.structure;
+      ibegin=temp.i-l1;
+      iend  =temp.i-1;
+      jbegin=temp.j;
+      jend  =temp.j+(int)strlen(temp.structure)-l1-2-1;
+      for(k=ibegin+1; k<=iend+1; k++){
+        struc2[k-1]=temp.structure[k-ibegin-1];
+      }
+      for(k=jbegin+j; k<=jend+j; k++){
+        struc2[k-1]=temp.structure[l1+k-j-jbegin+1];
+      }
+    }
+    for(s=0; s<n_seq; s++){
+      free(duplexseq_1[s]);
+      free(duplexseq_2[s]);
+    }
+    free(duplexseq_1);free(duplexseq_2);
+    free(temp.structure);
+  }
+  strcpy(struc, st1+MAX2(i-1,0)); strcat(struc, "&"); 
+  /* strcat(struc, st2); */
+  strncat(struc, struc2+5, (int)strlen(struc2)-10);
+  free(struc2);
+  free(struc_loop);
+  free(st1); free(st2);
+  free(type);free(type2);free(type3);
+  /* free_arrays(); */
+  return struc;
+}
+
+
+
+
+
+
+
+void Lsnoop_subopt(const char *s1, const char *s2, int delta, int w, 
+                   const int penalty, const int threshloop, 
+                   const int threshLE, const int threshRE, const int threshDE, const int threshTE,const int threshSE,const int threshD,
+                   const int distance,
+                   const int half_stem, const int max_half_stem,
+                   const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2, const int alignment_length, const char* name, const int fullStemEnergy)
+{
+
+ int min_colonne=INF;
+ int max_pos;
+ int max;max=INF;
+ /* int temp; */
+ /* int nsubopt=10; */
+ n1 = (int) strlen(s1);
+ n2 = (int) strlen(s2);
+ int *position;
+ position = (int*) vrna_alloc((n1+3)*sizeof(int));
+
+
+  /* int Eminj, Emin_l; */
+  int i, j; /* l1, Emin=INF, i_min=0, j_min=0; */
+  /* char *struc; */
+  /* snoopT mfe; */
+  int *indx;
+  int *mLoop;
+  int *cLoop;
+  folden **foldlist, **foldlist_XS;
+  int Duplex_El, Duplex_Er;
+  int Loop_D;
+  /* int u; */
+  int Loop_E;
+  vrna_md_t md;
+
+  Duplex_El=0;Duplex_Er=0;Loop_E=0, Loop_D=0;
+  snoexport_fold_arrays(&indx, &mLoop, &cLoop, &foldlist, &foldlist_XS); 
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    snoupdate_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  
+  lc = (int **) vrna_alloc(sizeof(int *) * (5));
+  lr = (int **) vrna_alloc(sizeof(int *) * (5));
+  for (i=0; i<5; i++) {
+          lc[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        lr[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        for(j=n2; j>-1; j--){
+                lc[i][j]=INF;
+                lr[i][j]=INF;
+        }
+  }
+  encode_seqs(s1, s2);
+  for (i=1; i<=n1; i++) {
+      int idx=i%5;
+      int idx_1=(i-1)%5;
+      int idx_2=(i-2)%5;
+      int idx_3=(i-3)%5;
+      int idx_4=(i-4)%5;
+    for (j=n2-min_d2; j>min_d1; j--) {
+      int type, type2, k;
+      type = pair[S1[i]][S2[j]];
+      lc[idx][j] = (type) ? P->DuplexInit + 2*penalty : INF;
+      lr[idx][j] = INF;
+      if(!type) continue;
+      if( /*pair[S1[i+1]][S2[j-1]]   &&  check that we have a solid base stack after the mLoop */
+          j < max_s1 && j > min_s1 &&  
+          j > n2 - max_s2 - max_half_stem && 
+          j < n2 -min_s2 -half_stem && S1[i-2]==4) { /*constraint on s2 and i*/
+        int min_k, max_k;
+        max_k = MIN2(n2-min_s2,j+max_half_stem+1);
+        min_k = MAX2(j+half_stem+1, n2-max_s2);
+        for(k=min_k; k <= max_k ; k++){         
+          if(mLoop[indx[k-1]+j+1] < 0){
+                }
+          if(pair[S1[i-3]][S2[k]] /*genau zwei ungepaarte nucleotiden --NU--*/
+             && mLoop[indx[k-1]+j+1] < threshloop){  
+            lr[idx][j]=MIN2(lr[idx][j], lc[idx_3][k]+mLoop[indx[k-1]+j+1]);
+          }
+          else if(pair[S1[i-4]][S2[k]] &&  mLoop[indx[k-1]+j+1] < threshloop){/*--NUN--*/
+            lr[idx][j]=MIN2(lr[idx][j], lc[idx_4][k]+mLoop[indx[k-1]+j+1]);
+          }
+              }
+      }
+      /* dangle 5'SIDE relative to the mRNA  */
+      lc[idx][j] += E_ExtLoop(type, (i>1) ? SS1[i-1] : -1, (j<n2) ? SS2[j+1] : -1, P);
+      /**
+      *** if (i>1)    lc[idx][j] += P->dangle5[type][SS1[i-1]];
+      *** if (j<n2)   lc[idx][j] += P->dangle3[type][SS2[j+1]];
+      *** if (type>2) lc[idx][j] += P->TerminalAU;
+      **/
+      
+      if(j<n2 && i>1){
+        type2=pair[S1[i-1]][S2[j+1]];
+              if(type2>0){
+          lc[idx][j]=MIN2(lc[idx_1][j+1]+E_IntLoop(0,0,type2, rtype[type],SS1[i], SS2[j], SS1[i-1], SS2[j+1], P)+2*penalty, lc[idx][j]);
+          lr[idx][j]=MIN2(lr[idx_1][j+1]+E_IntLoop(0,0,type2, rtype[type],SS1[i], SS2[j], SS1[i-1], SS2[j+1], P)+2*penalty, lr[idx][j]);
+              }
+      }
+      if(j<n2-1 && i>2){
+        type2=pair[S1[i-2]][S2[j+2]];
+        if(type2>0 ){
+          lc[idx][j]=MIN2(lc[idx_2][j+2]+E_IntLoop(1,1,type2, rtype[type],SS1[i-1], SS2[j+1], SS1[i-1], SS2[j+1], P)+4*penalty, lc[idx][j]);
+          lr[idx][j]=MIN2(lr[idx_2][j+2]+E_IntLoop(1,1,type2, rtype[type],SS1[i-1], SS2[j+1], SS1[i-1], SS2[j+1], P)+4*penalty, lr[idx][j]);
+        }
+      }
+      if(j<n2-2 && i>3){
+        type2 = pair[S1[i-3]][S2[j+3]];
+        if(type2>0){
+          lc[idx][j]=MIN2(lc[idx_3][j+3]+E_IntLoop(2,2,type2, rtype[type],SS1[i-2], SS2[j+2], SS1[i-1], SS2[j+1], P)+6*penalty,lc[idx][j]);
+          lr[idx][j]=MIN2(lr[idx_3][j+3]+E_IntLoop(2,2,type2, rtype[type],SS1[i-2], SS2[j+2], SS1[i-1], SS2[j+1], P)+6*penalty,lr[idx][j]);
+              }
+      }
+      /**
+      *** (type>2?P->TerminalAU:0)+(i<(n1)?P->dangle3[rtype[type]][SS1[i+1]]+penalty:0)+(j>1?P->dangle5[rtype[type]][SS2[j-1]]+penalty:0)
+      **/
+      min_colonne=MIN2(lr[idx][j]+E_ExtLoop(rtype[type], (j > 1) ? SS2[j-1] : -1, (i<n1) ? SS1[i+1] : -1, P), min_colonne);
+      }
+      position[i]=min_colonne;
+      if(max>=min_colonne){
+        max=min_colonne;
+        max_pos=i;
+      }
+      min_colonne=INF;
+ }
+ 
+  free(S1); free(S2); free(SS1); free(SS2);
+  if(max<threshTE){
+        find_max_snoop(s1, s2, max, alignment_length, position, delta, 
+                       distance, penalty, threshloop, threshLE, threshRE, threshDE, 
+                       threshTE, threshSE, threshD, half_stem, max_half_stem, min_s2, max_s2, min_s1, max_s1, min_d1, min_d2,name, fullStemEnergy);
+   }
+  for (i=1; i<5; i++) {free(lc[i]);free(lr[i]);}
+  free(lc[0]);free(lr[0]);
+  free(lc);free(lr);
+  free(position);
+  
+}  
+
+
+
+void Lsnoop_subopt_list(const char *s1, const char *s2, int delta, int w, 
+                        const int penalty, const int threshloop, 
+                        const int threshLE, const int threshRE, const int threshDE, const int threshTE,const int threshSE,const int threshD,
+                        const int distance,
+                        const int half_stem, const int max_half_stem,
+                        const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2, const int alignment_length,const char *name,const int fullStemEnergy)
+{
+ 
+ int min_colonne=INF;
+ int max_pos;
+ int max;max=INF;
+ /* int temp; */
+ /* int nsubopt=10; */
+ n1 = (int) strlen(s1);
+ n2 = (int) strlen(s2);
+ int *position;
+ position = (int*) vrna_alloc((n1+3)*sizeof(int));
+
+
+ /* int Eminj, Emin_l; */
+  int i, j;/*  l1, Emin=INF, i_min=0, j_min=0; */
+  /* char *struc; */
+  /* snoopT mfe; */
+  int *indx;
+  int *mLoop;
+  int *cLoop;
+  folden **foldlist, **foldlist_XS;
+  int Duplex_El, Duplex_Er;
+  int Loop_D;
+  /* int u; */
+  int Loop_E;
+  vrna_md_t md;
+
+  Duplex_El=0;Duplex_Er=0;Loop_E=0, Loop_D=0;
+  snoexport_fold_arrays(&indx, &mLoop, &cLoop, &foldlist,  &foldlist_XS); 
+
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    snoupdate_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  
+  lpair = (int **) vrna_alloc(sizeof(int *) * (6));
+  lc    = (int **) vrna_alloc(sizeof(int *) * (6));
+  lr    = (int **) vrna_alloc(sizeof(int *) * (6));
+  for (i=0; i<6; i++) {
+          lc[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        lr[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        lpair[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        for(j=n2; j>-1; j--){
+                lc[i][j]=INF;
+                lr[i][j]=INF;
+                lpair[i][j]=0;
+        }
+  }
+  encode_seqs(s1, s2);
+  int lim_maxj=n2-min_d2 ;
+  int lim_minj=min_d1;
+  int lim_maxi=n1;
+  for (i=5; i<=lim_maxi; i++) {
+    int idx=i%5;
+    int idx_1=(i-1)%5;
+    int idx_2=(i-2)%5;
+    int idx_3=(i-3)%5;
+    int idx_4=(i-4)%5;
+
+    for (j=lim_maxj; j>lim_minj; j--) {
+      int type, type2;/*  E, k,l; */
+      type = pair[S1[i]][S2[j]];
+      lpair[idx][j] = type;
+      lc[idx][j] = (type) ? P->DuplexInit + 2*penalty : INF;
+      lr[idx][j] = INF;
+      if(!type) continue;
+      if( /*pair[S1[i+1]][S2[j-1]] && Be sure it binds*/
+          j < max_s1 && j > min_s1 &&  
+          j > n2 - max_s2 - max_half_stem && 
+          j < n2 -min_s2 -half_stem && S1[i-2]==4 ) { /*constraint on s2 and i*/
+        int min_k, max_k;
+        max_k = MIN2(n2-min_s2,j+max_half_stem+1);
+        min_k = MAX2(j+half_stem+1, n2-max_s2);
+        folden * temp;
+        temp=foldlist[j+1];
+        while(temp->next){
+          int k = temp->k;
+          /* if(k >= min_k-1 && k < max_k){ comment to recover normal behaviour */
+          if(lpair[idx_3][k+1] /*&& lpair[idx_4][k+2]*/){
+            lr[idx][j]=MIN2(lr[idx][j], lc[idx_3][k+1]+temp->energy);/*--NU--*/
+          }
+          /*else*/ if(lpair[idx_4][k+1]){/*--NUN--*/
+            lr[idx][j]=MIN2(lr[idx][j], lc[idx_4][k+1]+temp->energy);
+          }
+            /*  } */
+          temp=temp->next;
+        }
+      }
+      /* dangle 5'SIDE relative to the mRNA  */
+      lc[idx][j] += E_ExtLoop(type,  SS1[i-1] , SS2[j+1] , P);
+      /**
+      ***      lc[idx][j] += P->dangle5[type][SS1[i-1]];
+      ***      lc[idx][j] += P->dangle3[type][SS2[j+1]];
+      ***      if (type>2) lc[idx][j] += P->TerminalAU;
+      **/
+      /*       if(j<n2 && i>1){ */
+      /* type2=pair[S1[i-1]][S2[j+1]]; */
+        type2=lpair[idx_1][j+1];
+        if(type2>0 ){
+          lc[idx][j]=MIN2(lc[idx_1][j+1]+E_IntLoop(0,0,type2, rtype[type],SS1[i], SS2[j], SS1[i-1], SS2[j+1], P)+2*penalty, lc[idx][j]);
+          lr[idx][j]=MIN2(lr[idx_1][j+1]+E_IntLoop(0,0,type2, rtype[type],SS1[i], SS2[j], SS1[i-1], SS2[j+1], P)+2*penalty, lr[idx][j]);
+        }
+        /* } */
+        /*       if(j<n2-1 && i>2){ */
+        /* type2=pair[S1[i-2]][S2[j+2]]; */
+        type2=lpair[idx_2][j+2];
+        if(type2>0 ){
+          lc[idx][j]=MIN2(lc[idx_2][j+2]+E_IntLoop(1,1,type2, rtype[type],SS1[i-1], SS2[j+1], SS1[i-1], SS2[j+1], P), lc[idx][j]);
+          lr[idx][j]=MIN2(lr[idx_2][j+2]+E_IntLoop(1,1,type2, rtype[type],SS1[i-1], SS2[j+1], SS1[i-1], SS2[j+1], P), lr[idx][j]);
+          /*         } */
+      }
+        /*       if(j<n2-2 && i>3){ */
+        /* type2 = pair[S1[i-3]][S2[j+3]]; */
+        type2 =lpair[idx_3][j+3];
+        if(type2>0 ){
+          lc[idx][j]=MIN2(lc[idx_3][j+3]+E_IntLoop(2,2,type2, rtype[type],SS1[i-2], SS2[j+2], SS1[i-1], SS2[j+1], P)+6*penalty,lc[idx][j]);
+          lr[idx][j]=MIN2(lr[idx_3][j+3]+E_IntLoop(2,2,type2, rtype[type],SS1[i-2], SS2[j+2], SS1[i-1], SS2[j+1], P)+6*penalty,lr[idx][j]);
+          /*         } */
+      }
+      /* min_colonne=MIN2(lr[idx][j]+(type>2?P->TerminalAU:0)+P->dangle3[rtype[type]][SS1[i+1]]+P->dangle5[rtype[type]][SS2[j-1]], min_colonne); */
+      int bla;
+      bla=lr[idx][j]+E_ExtLoop(rtype[type], SS2[j-1] , SS1[i+1], P)+2*penalty;
+      min_colonne=MIN2(bla, min_colonne);
+    }
+    position[i]=min_colonne;
+    if(max>=min_colonne){
+      max=min_colonne;
+      max_pos=i;
+      }
+    min_colonne=INF;
+ }
+ 
+  free(S1); free(S2); free(SS1); free(SS2);
+  if(max<threshTE){
+      find_max_snoop(s1, s2, max, alignment_length, position, 
+                     delta, distance, penalty, threshloop, 
+                     threshLE, threshRE, threshDE, threshTE, threshSE, threshD,
+                     half_stem, max_half_stem, min_s2, max_s2, min_s1, max_s1, min_d1, min_d2,name, fullStemEnergy);
+   }
+  for (i=1; i<6; i++) {free(lc[i]);free(lr[i]);free(lpair[i]);}
+  free(lc[0]);free(lr[0]);free(lpair[0]);
+  free(lc);free(lr);free(lpair);
+  free(position);
+}  
+
+
+PRIVATE void find_max_snoop(const char *s1, const char *s2,const int max,  const int alignment_length, const int* position, const int delta, 
+                            const int distance, const int penalty, const int threshloop,  const int threshLE, const int threshRE, 
+                            const int threshDE, const int threshTE, const int threshSE, const int threshD, 
+                            const int half_stem, const int max_half_stem, const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2, const char* name, const int fullStemEnergy)
+{
+  int count=0;
+  int pos=n1+1;
+  int threshold = MIN2(threshTE , max + delta );
+  /* printf("threshTE %d max %d\n", threshTE, max); */
+  /* #pragma omp parallel for */
+  /*   for(pos=n1+1;pos>distance;pos--){ */
+  while(pos-- > 5){
+    int temp_min=0;
+    if(position[pos]<(threshold)){
+      int search_range;
+      search_range=distance+1;
+      while(--search_range){
+        if(position[pos-search_range]<=position[pos-temp_min]){
+          temp_min=search_range;
+        }
+      }
+      pos-=temp_min;
+      int begin=MAX2(6, pos-alignment_length+1);
+      char *s3 = (char*) vrna_alloc(sizeof(char)*(pos-begin+3+12));
+      strcpy(s3, "NNNNN");
+      strncat(s3, (s1+begin-1), pos-begin+2);
+      strcat(s3,"NNNNN\0");
+      /* printf("%s s3\n", s3);  */
+      snoopT test;
+      test = snoopfold(s3, s2, penalty, threshloop, threshLE, threshRE, threshDE, threshD, half_stem, max_half_stem, min_s2, max_s2, min_s1, 
+                       max_s1, min_d1, min_d2,fullStemEnergy);
+      if(test.energy==INF){
+        free(s3);
+        continue;
+      }
+      if(test.Duplex_El > threshLE * 0.01 || test.Duplex_Er > threshRE * 0.01  ||
+         test.Loop_D > threshD * 0.01 || (test.Duplex_Er + test.Duplex_El) > threshDE * 0.01 ||
+         (test.Duplex_Er + test.Duplex_El + test.Loop_E + test.Loop_D + 410) > threshSE*0.01) {
+        free(test.structure);free(s3);
+        continue;
+      }
+      int l1;
+      l1 = strchr(test.structure, '&')-test.structure;
+      
+      int shift=0;
+      if(test.i > (int)strlen(s3)-10){
+        test.i--;
+        l1--; 
+      }
+      if(test.i-l1<0){
+        l1--;
+        shift++;
+      }
+      char *target_struct =  (char*) vrna_alloc(sizeof(char) * (strlen(test.structure)+1));
+      strncpy(target_struct, test.structure+shift, l1);
+      strncat(target_struct, test.structure + (strchr(test.structure, '&')-
+                                               test.structure), (int)strlen(test.structure) - (strchr(test.structure, '&')-
+                                                                                          test.structure));
+      strcat(target_struct,"\0");
+      char *target; 
+      target = (char *) vrna_alloc(l1+1);
+      strncpy(target, (s3+test.i+5-l1), l1);
+      target[l1]='\0';
+      char *s4;
+      s4 = (char*) vrna_alloc(sizeof(char) *(strlen(s2)-9));
+      strncpy(s4, s2+5, (int)strlen(s2)-10);
+      s4[(int)strlen(s2)-10]='\0';
+      printf("%s %3d,%-3d;%3d : %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f + %5.2f + 4.1 ) (%5.2f) \n%s&%s\n", 
+             target_struct,begin + test.i-5-l1,begin + test.i -6 , begin + test.u -6, 
+             test.j+1, test.j + (int)(strrchr(test.structure,'>') - strchr(test.structure,'>'))+1 ,
+             test.Loop_D + test.Duplex_El + test.Duplex_Er + test.Loop_E + 4.10, test.Duplex_El,
+             test.Duplex_Er, test.Loop_E, test.Loop_D,test.fullStemEnergy, target,s4);
+      if(name){
+        char *temp_seq;
+        char *temp_struc;
+        char psoutput[100];
+        temp_seq = (char*) vrna_alloc(sizeof(char)*(l1+n2-9));
+        temp_struc = (char*) vrna_alloc(sizeof(char)*(l1+n2-9));
+        strcpy(temp_seq, target);
+        strcat(temp_seq, s4);
+        strncpy(temp_struc, target_struct, l1);
+        strcat(temp_struc, target_struct+l1+1);
+        temp_seq[n2+l1-10]='\0';
+        temp_struc[n2+l1-10]='\0';
+        cut_point = l1+1;
+        char str[16];char upos[16];
+        strcpy(psoutput,"sno_");
+        sprintf(str,"%d",count);
+        strcat(psoutput,str);
+        sprintf(upos,"%d",begin + test.u - 6);
+        strcat(psoutput,"_u_");
+        strcat(psoutput,upos);
+        strcat(psoutput,"_");
+        strcat(psoutput,name);
+        strcat(psoutput,".ps\0");
+        PS_rna_plot_snoop_a(temp_seq, temp_struc, psoutput, NULL, NULL);
+        cut_point = -1;
+        free(temp_seq);
+        free(temp_struc);
+        count++;
+        /* free(psoutput); */
+      }
+      free(s4);
+      free(test.structure);
+      free(target_struct);
+      free(target);
+      free(s3);
+    }
+  }
+  
+}
+
+
+
+
+
+
+
+
+snoopT snoopfold(const char *s1, const char *s2, 
+                 const int penalty, const int threshloop, const int threshLE, const int threshRE, const int threshDE,
+                 const int threshD,
+                 const int half_stem, const int max_half_stem, 
+                 const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2, const int fullStemEnergy) {
+  /* int Eminj, Emin_l; */
+  int i, j, l1, Emin=INF, i_min=0, j_min=0;
+  char *struc;
+  snoopT mfe;
+  int *indx;
+  int *mLoop;
+  int *cLoop;
+  folden** foldlist, **foldlist_XS;
+  int Duplex_El, Duplex_Er;
+  int Loop_D;
+  int u;
+  int Loop_E;
+  vrna_md_t md;
+  Duplex_El=0;Duplex_Er=0;Loop_E=0, Loop_D=0;
+  snoexport_fold_arrays(&indx, &mLoop, &cLoop,&foldlist, &foldlist_XS ); 
+  n1 = (int) strlen(s1);
+  n2 = (int) strlen(s2);
+  
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    snoupdate_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  
+  c = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+  r = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+  for (i=0; i<=n1; i++) {
+          c[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        r[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        for(j=n2; j>-1; j--){
+                c[i][j]=INF;
+                r[i][j]=INF;
+        }
+  }
+  encode_seqs(s1, s2);
+  for (i=6; i<=n1-5; i++) {
+    for (j=n2-min_d2; j>min_d1; j--) {
+      int type, type2, E, k,l;
+      type = pair[S1[i]][S2[j]];
+      c[i][j] = (type ) ? P->DuplexInit : INF;
+      if(!type) continue;
+      if(/*  pair[S1[i+1]][S2[j-1]] &&  */
+         j < max_s1 && j > min_s1 &&  
+         j > n2 - max_s2 - max_half_stem && 
+         j < n2 -min_s2 -half_stem && S1[i-2]==4  ) { /*constraint on s2 and i*/
+        int min_k, max_k;
+        max_k = MIN2(n2-min_s2,j+max_half_stem);
+        min_k = MAX2(j+half_stem, n2-max_s2);
+        folden * temp;
+        temp=foldlist[j+1];
+        while(temp->next){
+          int k = temp->k;
+          /* if(k >= min_k-1 && k < max_k){ uncomment to recovernormal behaviour */
+          if(pair[S1[i-3]][S2[k+1]] /*&& pair[S1[i-4]][S2[k+2]]*/ ){
+            r[i][j]=MIN2(r[i][j], c[i-3][k+1]+temp->energy);
+          }
+          /*else*/ if(pair[S1[i-4]][S2[k+1]] /*&& pair[S1[i-5]][S2[k+2]]*/ ){
+            r[i][j]=MIN2(r[i][j], c[i-4][k+1]+temp->energy);
+          }
+          /* } */
+          temp=temp->next;
+        }
+      }
+      /* dangle 5'SIDE relative to the mRNA  */
+      /**
+      *** c[i][j] += P->dangle5[type][SS1[i-1]];
+      *** c[i][j] += P->dangle3[type][SS2[j+1]];
+      *** if (type>2) c[i][j] += P->TerminalAU;
+      **/
+      c[i][j]+=E_ExtLoop(type, SS1[i-1] , SS2[j+1], P);
+      for (k=i-1; k>0 && (i-k)<MAXLOOP_L; k--) {
+        for (l=j+1; l<=n2 ; l++) {
+          if (i-k+l-j>2*MAXLOOP_L-2) break;
+          if (abs(i-k-l+j) >= ASS ) continue;
+          type2 = pair[S1[k]][S2[l]];
+          if (!type2) continue;
+          E = E_IntLoop(i-k-1, l-j-1, type2, rtype[type],
+                        SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+          c[i][j] = MIN2(c[i][j], c[k][l]+E+(i-k+l-j)*penalty);
+          r[i][j] = MIN2(r[i][j], r[k][l]+E+(i-k+l-j)*penalty);
+        }
+      }
+      E = r[i][j]; 
+      /**
+      *** if (i<n1) E += P->dangle3[rtype[type]][SS1[i+1]];              
+      *** if (j>1)  E += P->dangle5[rtype[type]][SS2[j-1]]; 
+      *** f (type>2) E += P->TerminalAU;
+      **/
+      E+=E_ExtLoop(rtype[type], (j > 1) ? SS2[j-1] : -1, (i<n1) ? SS1[i+1] : -1, P);
+      if (E<Emin) {
+        Emin=E; i_min=i; j_min=j;
+      } 
+    }
+  }
+  if(Emin > 0){
+          printf("no target found under the constraints chosen\n");
+        for (i=0; i<=n1; i++) {free(r[i]);free(c[i]);}
+        free(c);
+        free(r);
+        free(S1); free(S2); free(SS1); free(SS2);
+        mfe.energy=INF;
+        return mfe;
+  }
+  struc = snoop_backtrack(i_min, j_min,s2, &Duplex_El, &Duplex_Er, &Loop_E, &Loop_D, 
+                          &u, penalty, threshloop, threshLE, threshRE,threshDE, threshD,
+                            half_stem, max_half_stem, min_s2, max_s2, min_s1, max_s1, min_d1, min_d2);
+/*   if (i_min<n1-5) i_min++; */
+/*   if (j_min>1 ) j_min--; */
+  l1 = strchr(struc, '&')-struc;
+  mfe.i = i_min-5;
+  mfe.j = j_min-5;
+  mfe.u = u -5;
+  mfe.Duplex_Er = (float) Duplex_Er/100;
+  mfe.Duplex_El = (float) Duplex_El/100;
+  mfe.Loop_D = (float) Loop_D/100;
+  mfe.Loop_E = (float) Loop_E/100;
+  mfe.energy = (float) Emin/100 ;
+  mfe.fullStemEnergy = (float) fullStemEnergy/100;
+  mfe.structure = struc;
+  if (!delay_free) {
+    for (i=0; i<=n1; i++) {free(r[i]);free(c[i]);}
+    free(c);
+    free(r);
+    free(S1); free(S2); free(SS1); free(SS2);
+  }
+  return mfe;
+}
+
+PRIVATE int snoopfold_XS_fill(const char *s1, const char *s2, const int **access_s1,
+                 const int penalty, const int threshloop, const int threshLE, const int threshRE, const int threshDE,
+                 const int threshD,
+                 const int half_stem, const int max_half_stem, 
+                 const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2) {
+  /* int Eminj, Emin_l; */
+  int i, j, Emin=INF, i_min=0, j_min=0;
+  /* char *struc; */
+  /* snoopT mfe; */
+  int *indx;
+  int *mLoop;
+  int *cLoop;
+  folden** foldlist, **foldlist_XS;
+  int Duplex_El, Duplex_Er;
+  int Loop_D;
+  /* int u; */
+  int Loop_E;
+  vrna_md_t   md;
+  Duplex_El=0;Duplex_Er=0;Loop_E=0, Loop_D=0;
+  snoexport_fold_arrays(&indx, &mLoop, &cLoop,&foldlist, &foldlist_XS ); 
+  n1 = (int) strlen(s1);
+  n2 = (int) strlen(s2);
+  
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    snoupdate_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  
+  c_fill = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+  r_fill = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+  for (i=0; i<=n1; i++) {
+          c_fill[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        r_fill[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        for(j=n2; j>-1; j--){
+                c_fill[i][j]=INF;
+                r_fill[i][j]=INF;
+        }
+  }
+  encode_seqs(s1, s2);
+
+  int di[5];
+  di[0]=0;  
+  for (i=6; i<=n1-5; i++) {
+    di[1]=access_s1[5][i]   - access_s1[4][i-1];           
+    di[2]=access_s1[5][i-1] - access_s1[4][i-2] + di[1];
+    di[3]=access_s1[5][i-2] - access_s1[4][i-3] + di[2];
+    di[4]=access_s1[5][i-3] - access_s1[4][i-4] + di[3];
+    di[1]=MIN2(di[1],165);
+    di[2]=MIN2(di[2],330);
+    di[3]=MIN2(di[3],495);
+    di[4]=MIN2(di[4],660);
+    for (j=n2-min_d2; j>min_d1; j--) {
+      int type, type2, E, k,l;
+      type = pair[S1[i]][S2[j]];
+      c_fill[i][j] = (type ) ? P->DuplexInit : INF;
+      if(!type) continue;
+      if(/*  pair[S1[i+1]][S2[j-1]] &&  */
+         j < max_s1 && j > min_s1 &&  
+         j > n2 - max_s2 - max_half_stem && 
+         j < n2 -min_s2 -half_stem && S1[i-2]==4  ) { /*constraint on s2 and i*/
+        int min_k, max_k;
+        max_k = MIN2(n2-min_s2,j+max_half_stem);
+        min_k = MAX2(j+half_stem, n2-max_s2);
+        folden * temp;
+        temp=foldlist[j+1];
+        while(temp->next){
+          int k = temp->k;
+          /* if(k >= min_k-1 && k < max_k){ uncomment to recovernormal behaviour */
+          if(pair[S1[i-3]][S2[k+1]] /*&& pair[S1[i-4]][S2[k+2]]*/ ){
+            r_fill[i][j]=MIN2(r_fill[i][j], c_fill[i-3][k+1]+temp->energy+ di[3]);
+          }
+          /*else*/ if(pair[S1[i-4]][S2[k+1]] /*&& pair[S1[i-5]][S2[k+2]]*/ ){
+            r_fill[i][j]=MIN2(r_fill[i][j], c_fill[i-4][k+1]+temp->energy + di[4]);
+          }
+          /* } */
+          temp=temp->next;
+        }
+      }
+      /* dangle 5'SIDE relative to the mRNA  */
+      /**
+      *** c_fill[i][j] += P->dangle5[type][SS1[i-1]];
+      *** c_fill[i][j] += P->dangle3[type][SS2[j+1]];
+      *** if (type>2) c_fill[i][j] += P->TerminalAU;
+      **/
+      c_fill[i][j]+= E_ExtLoop(type, SS1[i-1], SS2[j+1],P);
+      for (k=i-1; k>0 && (i-k)<MAXLOOP_L; k--) {
+        for (l=j+1; l<=n2 ; l++) {
+          if (i-k+l-j>2*MAXLOOP_L-2) break;
+          if (abs(i-k-l+j) >= ASS ) continue;
+          type2 = pair[S1[k]][S2[l]];
+          if (!type2) continue;
+          E = E_IntLoop(i-k-1, l-j-1, type2, rtype[type],
+                        SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+          c_fill[i][j] = MIN2(c_fill[i][j], c_fill[k][l]+E+di[i-k]);
+          r_fill[i][j] = MIN2(r_fill[i][j], r_fill[k][l]+E+di[i-k]);
+        }
+      }
+      E = r_fill[i][j]; 
+      /**
+      ***  if (i<n1) E += P->dangle3[rtype[type]][SS1[i+1]];              
+      ***  if (j>1)  E += P->dangle5[rtype[type]][SS2[j-1]]; 
+      *** if (type>2) E += P->TerminalAU;
+      **/
+      E+= E_ExtLoop(rtype[type], (j > 1) ? SS2[j-1] : -1, (i<n1) ? SS1[i+1] : -1, P);
+      if (E<Emin) {
+        Emin=E; i_min=i; j_min=j;
+      } 
+    }
+  }
+  return Emin;
+}
+
+
+
+PUBLIC snoopT *snoop_subopt(const char *s1, const char *s2, int delta, int w, 
+                            const int penalty, const int threshloop, 
+                            const int threshLE, const int threshRE, const int threshDE, const int threshTE, const int threshSE, const int threshD,
+                            const int distance, const int half_stem, const int max_half_stem,
+                            const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2, const int fullStemEnergy) {
+
+
+
+  /* printf("%d %d\n", min_s2, max_s2); */
+  int i,j, n1, n2, E, n_subopt=0, n_max;
+  char *struc;
+  snoopT mfe;
+  snoopT *subopt;
+  int thresh;
+
+  int Duplex_El, Duplex_Er, Loop_E;
+  int Loop_D;
+  Duplex_El=0; Duplex_Er=0; Loop_E=0;Loop_D=0;
+  int u;
+  u=0;
+  n_max=16;
+  subopt = (snoopT *) vrna_alloc(n_max*sizeof(snoopT));
+  delay_free=1;
+  mfe = snoopfold(s1, s2, penalty, threshloop, threshLE, threshRE, threshDE,threshD,
+                  half_stem, max_half_stem,
+                  min_s2, max_s2, min_s1, max_s1, min_d1, min_d2, fullStemEnergy);
+
+
+
+  if(mfe.energy > 0){
+          free(subopt);
+        delay_free=0;
+        return NULL;
+  }
+  thresh = MIN2((int) ((mfe.Duplex_Er + mfe.Duplex_El + mfe.Loop_E)*100+0.1 + 410) + delta, threshTE );
+ /* subopt[n_subopt++]=mfe; */
+  free(mfe.structure);
+  
+  n1 = (int)strlen(s1); n2=(int)strlen(s2);
+  for (i=n1; i>0; i--) {
+    for (j=1; j<=n2; j++) {
+      int type, Ed;
+      type = pair[S2[j]][S1[i]];
+      if (!type) continue;
+      E = Ed = r[i][j];
+      /**
+      *** if (i<n1) Ed += P->dangle3[type][SS1[i+1]]; 
+      *** if (j>1)  Ed += P->dangle5[type][SS2[j-1]]; 
+      *** if (type>2) Ed += P->TerminalAU;
+      **/
+      Ed+= E_ExtLoop(type, (j > 1) ? SS2[j-1] : -1, (i<n1) ? SS1[i+1] : -1, P);
+      if (Ed>thresh) continue;
+      /* too keep output small, remove hits that are dominated by a
+         better one close (w) by. For simplicity we do test without
+         adding dangles, which is slightly inaccurate. 
+      */ 
+      /* w=1; */
+/*       for (ii=MAX2(i-w,1); (ii<=MIN2(i+w,n1)) && type; ii++) {  */
+/*         for (jj=MAX2(j-w,1); jj<=MIN2(j+w,n2); jj++) */
+/*           if (r[ii][jj]<E) {type=0; break;} */
+/*       } */
+      if (!type) continue;
+
+      struc = snoop_backtrack(i,j,s2, &Duplex_El, &Duplex_Er, &Loop_E, &Loop_D, &u, penalty, threshloop,threshLE,threshRE,threshDE,threshD, 
+                        half_stem, max_half_stem, min_s2, max_s2, min_s1, max_s1, min_d1, min_d2);
+      if (Duplex_Er > threshRE || Duplex_El > threshLE || Loop_D > threshD ||
+         (Duplex_Er + Duplex_El) > threshDE || 
+         (Duplex_Er + Duplex_El + Loop_E) > threshTE ||
+         (Duplex_Er + Duplex_El + Loop_E + Loop_D + 410) > threshSE) {
+                 /* printf(" Duplex_Er %d threshRE %d Duplex_El %d threshLE %d \n" */
+                /*        " Duplex_Er + Duplex_El %d  threshDE %d \n" */
+                /*        " Duplex_Er + Duplex_El + Loop_E %d  threshTE %d \n" */
+                /*        " Duplex_Er + Duplex_El + Loop_E + Loop_D %d  threshSE %d \n",  */
+                /*          Duplex_Er , threshRE , Duplex_El ,threshLE, */
+                /*          Duplex_Er + Duplex_El, threshDE, */
+                /*          Duplex_Er + Duplex_El+  Loop_E , threshTE, */
+                /*          Duplex_Er + Duplex_El+  Loop_E + Loop_D, threshSE);  */
+                 Duplex_Er=0; 
+                Duplex_El=0;
+                Loop_E = 0;
+                Loop_D = 0;
+                u=0,
+                free(struc);
+                continue;
+        }
+
+      if (n_subopt+1>=n_max) {
+        n_max *= 2;
+        subopt = (snoopT *) vrna_realloc(subopt, n_max*sizeof(snoopT));
+      }
+      subopt[n_subopt].i = i-5;
+      subopt[n_subopt].j = j-5;
+      subopt[n_subopt].u = u-5;
+      subopt[n_subopt].Duplex_Er = Duplex_Er * 0.01;
+      subopt[n_subopt].Duplex_El = Duplex_El * 0.01;
+      subopt[n_subopt].Loop_E = Loop_E * 0.01;
+      subopt[n_subopt].Loop_D = Loop_D * 0.01;
+      subopt[n_subopt].energy = (Duplex_Er +Duplex_El + Loop_E + Loop_D + 410) * 0.01 ;
+      subopt[n_subopt].fullStemEnergy = (float) fullStemEnergy * 0.01;
+      subopt[n_subopt++].structure = struc;
+
+      Duplex_Er=0; Duplex_El=0; Loop_E=0; Loop_D=0;u=0;
+    }
+  }
+  
+  for (i=0; i<=n1; i++) {free(c[i]);free(r[i]);}
+  free(c);free(r);
+  free(S1); free(S2); free(SS1); free(SS2);
+  delay_free=0;
+
+  if (snoop_subopt_sorted) qsort(subopt, n_subopt, sizeof(snoopT), compare);
+  subopt[n_subopt].i =0;
+  subopt[n_subopt].j =0;
+  subopt[n_subopt].structure = NULL;
+  return subopt;
+}
+
+PUBLIC void snoop_subopt_XS(const char *s1, const char *s2, const int **access_s1, int delta, int w, 
+                            const int penalty, const int threshloop, 
+                            const int threshLE, const int threshRE, const int threshDE, const int threshTE, const int threshSE, const int threshD,
+                            const int distance, const int half_stem, const int max_half_stem,
+                            const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2, const int alignment_length, const char *name, const int fullStemEnergy) {
+
+
+
+  /* printf("%d %d\n", min_s2, max_s2); */
+  int i,j, E,  n_max;
+  /* char *struc; */
+  /* snoopT mfe; */
+
+  int thresh;
+
+  int Duplex_El, Duplex_Er, Loop_E;
+  int Loop_D;
+  Duplex_El=0; Duplex_Er=0; Loop_E=0;Loop_D=0;
+  int u;
+  u=0;
+  n_max=16;
+  delay_free=1;
+  int Emin = snoopfold_XS_fill(s1, s2, access_s1,penalty, threshloop, threshLE, threshRE, threshDE,threshD,
+                               half_stem, max_half_stem,
+                               min_s2, max_s2, min_s1, max_s1, min_d1, min_d2);
+  if(Emin > 0){
+    delay_free=0;
+  }
+  thresh = MIN2(-100, threshTE +alignment_length*30);  
+  /*   n1=(int)strlen(s1);  */
+  /*   n2=(int)strlen(s2); */
+  
+  int n3=(int)strlen(s1);
+  int n4=(int)strlen(s2);
+  S1_fill = (short*)vrna_alloc(sizeof(short)*(n3+2));
+  S2_fill = (short*)vrna_alloc(sizeof(short)*(n4+2));
+  SS1_fill = (short*)vrna_alloc(sizeof(short)*(n3+1));
+  SS2_fill = (short*)vrna_alloc(sizeof(short)*(n4+1));
+  memcpy(S1_fill, S1, sizeof(short)*n3+2);
+  memcpy(S2_fill, S2, sizeof(short)*n4+2);
+  memcpy(SS1_fill, SS1, sizeof(short)*n3+1);
+  memcpy(SS2_fill, SS2, sizeof(short)*n4+1);
+  free(S1);free(S2);free(SS1);free(SS2);
+  int count=0;
+  for (i=n3-5; i>0; i--) {
+    for (j=1; j<=n4; j++) {
+      int type, Ed;
+      type = pair[S2_fill[j]][S1_fill[i]];
+      if (!type) continue;
+      E = Ed = r_fill[i][j];
+      /**
+      ***if (i<n3) Ed += P->dangle3[type][SS1_fill[i+1]]; 
+      ***if (j>1)  Ed += P->dangle5[type][SS2_fill[j-1]]; 
+      ***if (type>2) Ed += P->TerminalAU;
+      **/
+      Ed+=E_ExtLoop(type, (j > 1) ? SS2[j-1] : -1, (i<n3) ? SS1[i+1] : -1, P);
+      if (Ed>thresh) continue;
+      
+      /* to keep output small, remove hits that are dominated by a
+         better one close (w) by. For simplicity we do test without
+         adding dangles, which is slightly inaccurate. 
+      */ 
+/*       w=10;  */
+/*       for (ii=MAX2(i-w,1); (ii<=MIN2(i+w,n3-5)) && type; ii++) {   */
+/*         for (jj=MAX2(j-w,1); jj<=MIN2(j+w,n4-5); jj++)  */
+/*           if (r_fill[ii][jj]<E) {type=0; break;}  */
+/*       }  */
+/*       i=ii;j=jj; */
+      if (!type) continue;
+      int begin=MAX2(5, i-alignment_length);
+      int end  =MIN2(n3-5, i-1); 
+      char *s3 = (char*) vrna_alloc(sizeof(char)*(end-begin+2)+5);
+      strncpy(s3, (s1+begin), end - begin +1);
+      strcat(s3,"NNNNN\0");
+      int n5 = (int)strlen(s3);
+      snoopT test = snoopfold_XS(s3, s2, access_s1, i, j ,penalty, 
+                          threshloop, threshLE, threshRE, 
+                          threshDE, threshD, half_stem, 
+                          max_half_stem, min_s2, max_s2, min_s1, 
+                                 max_s1, min_d1, min_d2,fullStemEnergy);
+      if(test.energy==INF){
+        free(s3);
+        continue;
+      }
+      if( test.Duplex_El > threshLE * 0.01 ||test.Duplex_Er > threshRE * 0.01  || 
+          test.Loop_D > threshD * 0.01 || (test.Duplex_Er + test.Duplex_El) > threshDE * 0.01 || 
+          (test.Duplex_Er + test.Duplex_El + test.Loop_E) > threshTE*0.01 || (test.Duplex_Er + test.Duplex_El + test.Loop_E + test.Loop_D + 410) > threshSE*0.01) 
+        { 
+          free(test.structure);free(s3); 
+          continue; 
+        }
+      char *s4; 
+      s4 = (char*) vrna_alloc(sizeof(char) *(n4-9)); 
+      strncpy(s4, s2+5, n4-10); 
+      s4[n4-10]='\0';
+      
+      char *s5 = vrna_alloc(sizeof(char) * n5-test.i+2-5);
+      strncpy(s5,s3+test.i-1,n5-test.i+1-5);
+      s5[n5-test.i+1-5]='\0';
+      float dE = ((float) (access_s1[n5-test.i+1-5][i]))*0.01;
+      printf("%s %3d,%-3d;%3d : %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f + %5.2f + %5.2f + 4.10)  (%5.2f)\n%s&%s\n" ,  
+             test.structure, i  -  (n5 - test.i) ,i - 5, i - (n5 - test.u ),
+             j-5, j-5 + (int)(strrchr(test.structure,'>') - strchr(test.structure,'>')), 
+             test.Loop_D + test.Duplex_El + test.Duplex_Er + test.Loop_E + 4.10+dE, test.Duplex_El, 
+             test.Duplex_Er, test.Loop_E, test.Loop_D,dE , test.fullStemEnergy, s5,s4);
+      if(name){
+        int begin_t, end_t, begin_q, end_q, and, pipe,k; 
+        char psoutput[100];
+        begin_q=0;
+        end_q=n4-10;
+        begin_t=0;
+        end_t=n5-test.i+ 1-5;
+        and=end_t+1;
+        pipe=test.u -test.i + 1;
+        cut_point = end_t +1 ;
+        char *catseq, *catstruct;/*  *fname;  */
+        catseq = (char*) vrna_alloc(n5 + end_q -begin_q +2);
+        catstruct = (char*) vrna_alloc(n5 + end_q -begin_q +2);
+        strcpy(catseq, s5);
+        strncpy(catstruct, test.structure, end_t);
+        strcat(catseq, s4);
+        strncat(catstruct, test.structure+end_t+1, end_q-begin_q+1);
+        catstruct[end_t - begin_t + end_q-begin_q+2]='\0';
+        catseq[end_t - begin_t + end_q-begin_q+2]='\0';
+        int *relative_access;
+        relative_access = vrna_alloc(sizeof(int)*strlen(s5));
+        relative_access[0] = access_s1[1][i - (n5  - test.i) + 5];
+        for(k=1;k<(int)strlen(s5);k++){
+          relative_access[k] =  access_s1[k+1][i - (n5  - test.i) + k + 5] -  access_s1[k][i - (n5  - test.i) + k + 4];
+        }
+        char str[16];char upos[16];
+        strcpy(psoutput,"sno_XS_");
+        sprintf(str,"%d",count);
+        strcat(psoutput,str);
+        sprintf(upos,"%d",i - (n5 - test.u ));
+        strcat(psoutput,"_u_");
+        strcat(psoutput,upos);
+        strcat(psoutput,"_");
+        strcat(psoutput,name);
+        strcat(psoutput,".ps\0");
+        PS_rna_plot_snoop_a(catseq, catstruct, psoutput,relative_access,NULL);
+        free(catseq);free(catstruct);free(relative_access);
+        count++;
+      }
+      free(s3);free(s4);free(s5);free(test.structure);
+    }
+  }  
+  for (i=0; i<=n3; i++) {free(c_fill[i]);free(r_fill[i]);}
+  free(c_fill);free(r_fill);
+  free(S1_fill); free(S2_fill); free(SS1_fill); free(SS2_fill);
+  delay_free=0;
+}
+
+
+
+
+PRIVATE char *snoop_backtrack(int i, int j, const char* snoseq, 
+                              int *Duplex_El, int *Duplex_Er, 
+                              int *Loop_E, int *Loop_D, int *u, 
+                              const int penalty, const int threshloop, 
+                              const int threshLE, const int threshRE, const int threshDE, const int threshD,
+                              const int half_stem, const int max_half_stem, 
+                              const int min_s2, const int max_s2, const int min_s1, 
+                              const int max_s1, const int min_d1, const int min_d2) {
+  /* backtrack structure going backwards from i, and forwards from j 
+     return structure in bracket notation with & as separator */
+  int k, l, type, type2, E, traced, i0, j0;
+  int traced_r=0; /* flag for following backtrack in c or r */
+  char *st1, *st2, *struc;
+  char *struc_loop;
+
+  st1 = (char *) vrna_alloc(sizeof(char)*(n1+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n2+1));
+  int *indx;
+  int *mLoop;
+  int *cLoop;
+  folden **foldlist, **foldlist_XS;
+  type=pair[S1[i]][S2[j]];
+  snoexport_fold_arrays(&indx, &mLoop, &cLoop,&foldlist, &foldlist_XS ); 
+  i0=i; j0=j;
+  /**
+  *** if (i<n1)   *Duplex_Er += P->dangle3[rtype[type]][SS1[i+1]];
+  *** if (j>1)    *Duplex_Er += P->dangle5[rtype[type]][SS2[j-1]];
+  *** if (type>2) *Duplex_Er += P->TerminalAU;
+  **/
+  *Duplex_Er += E_ExtLoop(rtype[type], (j > 1) ? SS2[j-1] : -1, (i<n1) ? SS1[i+1] : -1, P);
+  while (i>0 && j<=n2-min_d2 ) {
+    if(!traced_r) {
+      E = r[i][j]; traced=0;
+      st1[i-1] = '<';
+      st2[j-1] = '>'; 
+      type = pair[S1[i]][S2[j]];
+      if (!type) vrna_message_error("backtrack failed in fold duplex r");
+      for (k=i-1; k>0 && (i-k)<MAXLOOP_L; k--) {
+        for (l=j+1; l<=n2 ; l++) {
+          int LE;
+          if (i-k+l-j>2*MAXLOOP_L-2) break;
+          if (abs(i-k-l+j) >= ASS) continue;
+          
+          type2 = pair[S1[k]][S2[l]];
+          if (!type2) continue;
+          LE = E_IntLoop(i-k-1, l-j-1, type2, rtype[type],
+                         SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+          if (E == r[k][l]+LE+(i-k+l-j)*penalty) {
+            traced=1; 
+            i=k; j=l;
+            *Duplex_Er+=LE;
+            break;
+          }
+        }
+        if (traced) break;
+      }
+      if(!traced){
+        if(/*  pair[S1[i+1]][S2[j-1]] && */  
+            j < max_s1 && j > min_s1 && 
+            j > n2 - max_s2 - max_half_stem && 
+            j < n2 -min_s2 -half_stem && 
+            S1[i-2]==4) {
+          int min_k, max_k;
+          max_k = MIN2(n2-min_s2,j+max_half_stem+1);
+          min_k = MAX2(j+half_stem+1, n2-max_s2);
+          folden * temp;
+          temp=foldlist[j+1];
+          while(temp->next) {
+            int k = temp->k;
+            if(pair[S1[i-3]][S2[k+1]] /*&& pair[S1[i-4]][S2[k+2]]*/    ){  /* introduce structure from RNAfold */
+              if(E==c[i-3][k+1]+temp->energy){
+                *Loop_E=temp->energy;
+                st1[i-3]= '|';
+                *u=i-2;
+                int a,b;
+                /* int fix_ij=indx[k-1+1]+j+1; */
+                for(a=0; a< MISMATCH ;a++){
+                  for(b=0; b< MISMATCH ; b++){
+                    int ij=indx[k-1-a+1]+j+1+b;
+                    if(cLoop[ij]==temp->energy) {
+                      struc_loop=snobacktrack_fold_from_pair(snoseq, j+1+b, k-a-1+1);
+                    a=INF; b=INF;        
+                    }
+                  }
+                }
+                traced=1;
+                traced_r=1;
+                i=i-3;j=k+1;
+                break;
+              }
+            }
+            /*else*/ if (pair[S1[i-4]][S2[k+1]] /*&& pair[S1[i-5]][S2[k+2]]*/){  /* introduce structure from RNAfold */
+              if(E==c[i-4][k+1]+temp->energy){
+                *Loop_E=temp->energy;
+                st1[i-3]= '|';
+                *u=i-2;
+                int a,b;
+                /* int fix_ij=indx[k-1+1]+j+1; */
+                for(a=0; a< MISMATCH ;a++){
+                  for(b=0; b< MISMATCH ; b++){
+                    int ij=indx[k-1-a+1]+j+1+b;
+                    if(cLoop[ij]==temp->energy) {
+                      struc_loop=snobacktrack_fold_from_pair(snoseq, j+1+b, k-a-1+1);
+                      a=INF; b=INF;        
+                    }
+                  }
+                }
+                traced=1;
+                traced_r=1;
+                i=i-4;j=k+1;
+                break;
+              }
+            } /* else if */
+            temp=temp->next;
+          } /* while temp-> next */
+        } /* test on j  */
+      }/* traced? */
+    }/* traced_r? */
+    else{
+      E = c[i][j]; traced=0;
+      st1[i-1] = '<';
+      st2[j-1] = '>'; 
+      type = pair[S1[i]][S2[j]];
+      if (!type) vrna_message_error("backtrack failed in fold duplex c");
+      for (k=i-1; (i-k)<MAXLOOP_L; k--) {
+        for (l=j+1; l<=n2; l++) {
+          int LE;
+          if (i-k+l-j>2*MAXLOOP_L-2) break;
+          if (abs(i-k-l+j) >= ASS) continue;
+          type2 = pair[S1[k]][S2[l]];
+          if (!type2) continue;
+          LE = E_IntLoop(i-k-1, l-j-1, type2, rtype[type],
+                         SS1[k+1], SS2[l-1], SS1[i-1], SS2[j+1],P);
+          if (E == c[k][l]+LE+(i-k+l-j)*penalty) {
+            traced=1; 
+            i=k; j=l;
+            *Duplex_El+=LE;
+            break;
+          }
+        }
+        if (traced) break;
+      }
+    }
+    if (!traced) { 
+      int correction;
+      correction = E_ExtLoop(type, (i>1) ? SS1[i-1] : -1, (j<n2) ? SS2[j+1] : -1, P);
+      E-=correction;
+      *Duplex_El+=correction;
+      /**
+      *** if (i>1)    {E -= P->dangle5[type][SS1[i-1]]; *Duplex_El +=P->dangle5[type][SS1[i-1]];}
+      *** if (j<n2)   {E -= P->dangle3[type][SS2[j+1]]; *Duplex_El +=P->dangle3[type][SS2[j+1]];}
+      *** if (type>2) {E -= P->TerminalAU;                    *Duplex_El +=P->TerminalAU;}
+      **/
+      if (E != P->DuplexInit) {
+        vrna_message_error("backtrack failed in fold duplex end");
+      } else break;
+    }
+  }
+/*   if (i>1)  i--; */
+/*   if (j<n2) j++; */  
+  /* struc = (char *) vrna_alloc(i0-i+1+j-j0+1+2); */ /* declare final duplex structure */
+  struc = (char *) vrna_alloc(i0-i+1+n2-1+1+2); /* declare final duplex structure */
+  char * struc2;
+  struc2 = (char *) vrna_alloc(n2+1);
+  /* char * struct_const; */
+  for (k=MAX2(i,1); k<=i0; k++) if (!st1[k-1]) st1[k-1] = '.';
+  /* for (k=j0; k<=j; k++) if (!st2[k-1]) st2[k-1] = struc_loop[k-1];*/ /* '.'; normal */
+  /*  char * struct_const; */
+  /*  struct_const = (char *) vrna_alloc(sizeof(char)*(n2+1));   */
+  for (k=1; k<=n2; k++) {
+    if (!st2[k-1]) st2[k-1] = struc_loop[k-1];/* '.'; */
+    struc2[k-1] = st2[k-1];/* '.'; */
+    /*      if (k>=j0 && k<=j){ */
+    /*              struct_const[k-1]='x'; */
+    /*      } */
+    /*      else{ */
+    /*              if(k<j0) {struct_const[k-1]='<';} */
+    /*              if(k>j) {struct_const[k-1]='>';} */
+    /*      } */
+  }
+  char duplexseq_1[j0];
+  char duplexseq_2[n2-j+2];
+  if(j<n2){
+    strncpy(duplexseq_1, snoseq, j0-1);
+    strcpy(duplexseq_2, snoseq + j);
+    duplexseq_1[j0-1]='\0';
+    duplexseq_2[n2-j+1]='\0';
+    duplexT temp;
+    temp=duplexfold(duplexseq_1, duplexseq_2);
+    *Loop_D =  MIN2(0,-410 + (int) 100 * temp.energy);
+    if(*Loop_D){
+      int l1,ibegin, iend, jbegin, jend;
+      l1=strchr(temp.structure, '&')-temp.structure;
+      ibegin=temp.i-l1;
+      iend  =temp.i-1;
+      jbegin=temp.j;
+      jend  =temp.j+(int)strlen(temp.structure)-l1-2-1;
+      for(k=ibegin+1; k<=iend+1; k++){
+        struc2[k-1]=temp.structure[k-ibegin-1];
+      }
+      for(k=jbegin+j; k<=jend+j; k++){
+        struc2[k-1]=temp.structure[l1+k-j-jbegin+1];
+      } 
+    }
+    free(temp.structure);
+  } 
+  strcpy(struc, st1+MAX2(i-1,0)); strcat(struc, "&"); 
+  /* strcat(struc, st2); */
+  strncat(struc, struc2+5, (int)strlen(struc2)-10);
+  free(struc2);
+  free(struc_loop);
+  free(st1); free(st2);
+  /* free_arrays(); */
+  return struc;
+}
+
+void Lsnoop_subopt_list_XS(const char *s1, const char *s2,  const int **access_s1, int delta, int w, 
+                        const int penalty, const int threshloop, 
+                        const int threshLE, const int threshRE, const int threshDE, const int threshTE,const int threshSE,const int threshD,
+                        const int distance,
+                        const int half_stem, const int max_half_stem,
+                           const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2, const int alignment_length, const char *name, const int fullStemEnergy)
+{
+ 
+ int min_colonne=INF;
+ int max_pos;
+ int max;max=INF;
+ /* int temp; */
+ /* int nsubopt=10; */
+ n1 = (int) strlen(s1);
+ n2 = (int) strlen(s2);
+ int *position;
+ int *position_j;
+ int min_j_colonne;
+ int max_pos_j=INF; 
+ position = (int*) vrna_alloc((n1+3)*sizeof(int));
+ position_j = (int*) vrna_alloc((n1+3)*sizeof(int));
+
+ /* int Eminj, Emin_l; */
+  int i, j;/*  l1, Emin=INF, i_min=0, j_min=0; */
+  /* char *struc; */
+  /* snoopT mfe; */
+  int *indx;
+  int *mLoop;
+  int *cLoop;
+  folden **foldlist, **foldlist_XS;
+  int Duplex_El, Duplex_Er;
+  int Loop_D;
+  /* int u; */
+  int Loop_E;
+  vrna_md_t md;
+
+  Duplex_El=0;Duplex_Er=0;Loop_E=0, Loop_D=0;
+  snoexport_fold_arrays(&indx, &mLoop, &cLoop, &foldlist, &foldlist_XS); 
+
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    snoupdate_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  
+  lpair = (int **) vrna_alloc(sizeof(int *) * (6));
+  lc    = (int **) vrna_alloc(sizeof(int *) * (6));
+  lr    = (int **) vrna_alloc(sizeof(int *) * (6));
+  for (i=0; i<6; i++) {
+          lc[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        lr[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        lpair[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        for(j=n2; j>-1; j--){
+                lc[i][j]=INF;
+                lr[i][j]=INF;
+                lpair[i][j]=0;
+        }
+  }
+  encode_seqs(s1, s2);
+  int lim_maxj=n2-min_d2 ;
+  int lim_minj=min_d1;
+  int lim_maxi=n1-5;
+  for (i=5; i<=lim_maxi; i++) {
+    int idx=i%5;
+    int idx_1=(i-1)%5;
+    int idx_2=(i-2)%5;
+    int idx_3=(i-3)%5;
+    int idx_4=(i-4)%5;
+    int di1, di2, di3, di4;
+    di1 = access_s1[5][i]   - access_s1[4][i-1];           
+    di2 =access_s1[5][i-1] - access_s1[4][i-2] + di1;
+    di3 = access_s1[5][i-2] - access_s1[4][i-3] + di2;
+    di4 = access_s1[5][i-3] - access_s1[4][i-4] + di3;
+    di1=MIN2(di1,165);
+    di2=MIN2(di2,330);
+    di3=MIN2(di3,495);
+    di4=MIN2(di4,660);
+    for (j=lim_maxj; j>lim_minj; j--) {
+      int type, type2;/*  E, k,l; */
+      type = pair[S1[i]][S2[j]];
+      lpair[idx][j] = type;
+      lc[idx][j] = (type) ? P->DuplexInit + access_s1[1][i] : INF;
+      lr[idx][j] = INF;
+      if(!type) continue;
+      if( /*pair[S1[i+1]][S2[j-1]] && Be sure it binds*/
+          j < max_s1 && j > min_s1 &&  
+          j > n2 - max_s2 - max_half_stem && 
+          j < n2 -min_s2 -half_stem && S1[i-2]==4 ) { /*constraint on s2 and i*/
+        int min_k, max_k;
+        max_k = MIN2(n2-min_s2,j+max_half_stem+1);
+        min_k = MAX2(j+half_stem+1, n2-max_s2);
+        folden * temp;
+        temp=foldlist[j+1];
+        while(temp->next){
+          int k = temp->k;
+          /* if(k >= min_k-1 && k < max_k){ comment to recover normal behaviour */
+          if(lpair[idx_3][k+1] && lc[idx_3][k+1] /*+di3*/ < 411 /*&& lpair[idx_4][k+2]*/){ /*  remove second condition */
+            lr[idx][j]=MIN2(lr[idx][j], di3 + lc[idx_3][k+1]+temp->energy);/*--NU--*/
+          }
+          /*else*/ if(lpair[idx_4][k+1] && /*di4 +*/ lc[idx_4][k+1] < 411  ){/*--NUN--*/ /*  remove second condition  */
+            lr[idx][j]=MIN2(lr[idx][j], di4 + lc[idx_4][k+1]+temp->energy);
+          }
+            /*  } */
+          temp=temp->next;
+        }
+      }
+      /* dangle 5'SIDE relative to the mRNA  */
+      /**
+      *** lc[idx][j] += P->dangle5[type][SS1[i-1]];
+      *** lc[idx][j] += P->dangle3[type][SS2[j+1]];
+      *** if (type>2) lc[idx][j] += P->TerminalAU;
+      **/
+      lc[idx][j]+=E_ExtLoop(type, SS1[i-1] ,  SS2[j+1] , P);
+      /*       if(j<n2 && i>1){ */
+      /* type2=pair[S1[i-1]][S2[j+1]]; */
+        type2=lpair[idx_1][j+1];
+        if(type2>0 ){
+          lc[idx][j]=MIN2(lc[idx_1][j+1]+E_IntLoop(0,0,type2, rtype[type],SS1[i], SS2[j], SS1[i-1], SS2[j+1], P)+di1, lc[idx][j]);
+          lr[idx][j]=MIN2(lr[idx_1][j+1]+E_IntLoop(0,0,type2, rtype[type],SS1[i], SS2[j], SS1[i-1], SS2[j+1], P)+di1, lr[idx][j]);
+        }
+        type2=lpair[idx_2][j+2];
+        if(type2>0 ){
+          lc[idx][j]=MIN2(lc[idx_2][j+2]+E_IntLoop(1,1,type2, rtype[type],SS1[i-1], SS2[j+1], SS1[i-1], SS2[j+1], P)+di2, lc[idx][j]);
+          lr[idx][j]=MIN2(lr[idx_2][j+2]+E_IntLoop(1,1,type2, rtype[type],SS1[i-1], SS2[j+1], SS1[i-1], SS2[j+1], P)+di2, lr[idx][j]);
+         
+      }
+        type2 =lpair[idx_3][j+3];
+        if(type2>0 ){
+          lc[idx][j]=MIN2(lc[idx_3][j+3]+E_IntLoop(2,2,type2, rtype[type],SS1[i-2], SS2[j+2], SS1[i-1], SS2[j+1], P)+di3,lc[idx][j]);
+          lr[idx][j]=MIN2(lr[idx_3][j+3]+E_IntLoop(2,2,type2, rtype[type],SS1[i-2], SS2[j+2], SS1[i-1], SS2[j+1], P)+di3,lr[idx][j]);
+
+      }
+      int bla;
+      int temp2;
+      temp2=min_colonne;
+      bla=lr[idx][j] + E_ExtLoop(rtype[type], SS2[j-1], SS1[i+1] , P);
+        /**
+        *** (type>2?P->TerminalAU:0)+P->dangle3[rtype[type]][SS1[i+1]]+P->dangle5[rtype[type]][SS2[j-1]];
+        **/
+      min_colonne=MIN2(bla, min_colonne);
+      if(temp2>min_colonne){
+        min_j_colonne=j;
+      }
+    }
+    position[i]=min_colonne;
+    if(max>=min_colonne){
+      max=min_colonne;
+      max_pos=i;
+      max_pos_j=min_j_colonne;
+      }
+    position_j[i]=min_j_colonne;
+    min_colonne=INF;
+ }
+  free(S1); free(S2); free(SS1); free(SS2);
+
+  if(max<threshTE + 30*alignment_length){
+    find_max_snoop_XS(s1, s2, access_s1,max,alignment_length, position, position_j,
+                     delta, distance, penalty, threshloop, 
+                     threshLE, threshRE, threshDE, threshTE, threshSE, threshD,
+                      half_stem, max_half_stem, min_s2, max_s2, min_s1, max_s1, min_d1, min_d2,name,fullStemEnergy);
+   }
+  for (i=1; i<6; i++) {free(lc[i]);free(lr[i]);free(lpair[i]);}
+  free(lc[0]);free(lr[0]);free(lpair[0]);
+  free(lc);free(lr);free(lpair);
+  free(position);free(position_j);
+}  
+
+
+PRIVATE void find_max_snoop_XS(const char *s1, const char *s2, const int **access_s1, 
+                               const int max,  const int alignment_length, 
+                               const int* position, const int* position_j, const int delta, 
+                               const int distance, const int penalty, const int threshloop,  const int threshLE, const int threshRE, 
+                               const int threshDE, const int threshTE, const int threshSE, const int threshD, 
+                               const int half_stem, const int max_half_stem, const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2, const char *name, const int fullStemEnergy){
+  int count=0;
+  int n3=(int)strlen(s1);
+  int n4=(int)strlen(s2);
+  int pos=n1-4;
+  int max_pos_j;
+  int threshold = MIN2(threshTE + alignment_length*30, -100);
+  /* printf("threshTE %d max %d\n", threshTE, max); */
+  /* #pragma omp parallel for */
+  /*   for(pos=n1+1;pos>distance;pos--){ */
+  while(pos-->5){
+    int temp_min=0;
+    if(position[pos]<(threshold)){
+      int search_range;
+      search_range=distance+1;
+      while(--search_range){
+        if(position[pos-search_range]<=position[pos-temp_min]){
+          temp_min=search_range;
+        }
+      }
+      pos-=temp_min;
+      max_pos_j=position_j[pos];
+      int begin=MAX2(5, pos-alignment_length);
+      int end  =MIN2(n3-5, pos-1); 
+      char *s3 = (char*) vrna_alloc(sizeof(char)*(end-begin+2)+5);
+      strncpy(s3, (s1+begin), end - begin +1);
+      strcat(s3,"NNNNN\0");
+
+      int n5 = (int)strlen(s3);
+      snoopT test;
+      test = snoopfold_XS(s3, s2, access_s1, pos, max_pos_j ,penalty, 
+                          threshloop, threshLE, threshRE, 
+                          threshDE, threshD, half_stem, 
+                          max_half_stem, min_s2, max_s2, min_s1, 
+                          max_s1, min_d1, min_d2, fullStemEnergy);
+      if(test.energy==INF){
+        free(s3);
+        continue;
+      }
+      if( test.Duplex_El > threshLE * 0.01 ||test.Duplex_Er > threshRE * 0.01  || 
+         test.Loop_D > threshD * 0.01 || (test.Duplex_Er + test.Duplex_El) > threshDE * 0.01 || 
+         (test.Duplex_Er + test.Duplex_El + test.Loop_E) > threshTE*0.01 || (test.Duplex_Er + test.Duplex_El + test.Loop_E + test.Loop_D + 410) > threshSE*0.01) { 
+        free(test.structure);free(s3); 
+        continue; 
+      }
+      
+      char *s4; 
+      s4 = (char*) vrna_alloc(sizeof(char) *(n4-9)); 
+      strncpy(s4, s2+5, n4-10); 
+      s4[n4-10]='\0';
+
+      char *s5 = vrna_alloc(sizeof(char) * n5-test.i+2-5);
+      strncpy(s5,s3+test.i-1,n5-test.i+1-5);
+      s5[n5-test.i+1-5]='\0';
+      float dE = ((float) (access_s1[n5-test.i+1-5][pos]))*0.01;
+      printf("%s %3d,%-3d;%3d : %3d,%-3d (%5.2f = %5.2f + %5.2f + %5.2f + %5.2f + %5.2f + 4.10) (%5.2f)\n%s&%s\n" ,  
+             test.structure, pos  -  (n5 - test.i) ,pos - 5, pos - (n5 - test.u ),
+             max_pos_j-5, max_pos_j-5 + (int)(strrchr(test.structure,'>') - strchr(test.structure,'>')), 
+             test.Loop_D + test.Duplex_El + test.Duplex_Er + test.Loop_E + 4.10+dE, test.Duplex_El, 
+             test.Duplex_Er, test.Loop_E, test.Loop_D,dE ,test.fullStemEnergy, s5,s4);
+      if(name){
+        int begin_t, end_t, begin_q, end_q, and, pipe, i; 
+        char psoutput[100];
+        begin_q=0;
+        end_q=n4-10;
+        begin_t=0;
+        end_t=n5-test.i+ 1-5;
+        and=end_t+1;
+        pipe=test.u -test.i + 1;
+        cut_point = end_t +1 ;
+        char *catseq, *catstruct;/*  *fname;  */
+        catseq = (char*) vrna_alloc(n5 + end_q -begin_q +2);
+        catstruct = (char*) vrna_alloc(n5 + end_q -begin_q +2);
+        strcpy(catseq, s5);
+        strncpy(catstruct, test.structure, end_t);
+        strcat(catseq, s4);
+        strncat(catstruct, test.structure+end_t+1, end_q-begin_q+1);
+        catstruct[end_t - begin_t + end_q-begin_q+2]='\0';
+        catseq[end_t - begin_t + end_q-begin_q+2]='\0';
+        int *relative_access;
+        relative_access = vrna_alloc(sizeof(int)*strlen(s5));
+
+        relative_access[0] = access_s1[1][pos - (n5  - test.i) + 5];
+        for(i=1;i<(int)strlen(s5);i++){
+          relative_access[i] =  access_s1[i+1][pos - (n5  - test.i) + i + 5] -  access_s1[i][pos - (n5  - test.i) + i + 4];
+        }
+        char str[16];
+        char upos[16];
+        strcpy(psoutput,"sno_XS_");
+        sprintf(str,"%d",count);
+        strcat(psoutput,str);
+        sprintf(upos,"%d",pos - (n5 - test.u ));
+        strcat(psoutput,"_u_");
+        strcat(psoutput,upos);
+        strcat(psoutput,"_");
+        strcat(psoutput,name);
+        strcat(psoutput,".ps\0");
+        PS_rna_plot_snoop_a(catseq, catstruct, psoutput,relative_access,NULL);
+        free(catseq);free(catstruct);free(relative_access);
+        count++;
+      }
+      free(s3);free(s4);free(s5);free(test.structure);
+    }
+  }
+}
+
+snoopT snoopfold_XS(const char *s1, const char *s2, const int **access_s1, const int pos_i, const int pos_j,
+                 const int penalty, const int threshloop, const int threshLE, const int threshRE, const int threshDE,
+                 const int threshD,
+                 const int half_stem, const int max_half_stem, 
+                    const int min_s2, const int max_s2, const int min_s1, const int max_s1, const int min_d1, const int min_d2, const int fullStemEnergy) {
+  /*   int Eminj, Emin_l; */
+  int a,b,i, j, Emin=INF, a_min=0, b_min=0;
+  char *struc;
+  snoopT mfe;
+  int *indx;
+  int *mLoop;
+  int *cLoop;
+  folden** foldlist, **foldlist_XS;
+  int Duplex_El, Duplex_Er;
+  int Loop_D;
+  int u;
+  int Loop_E;
+  vrna_md_t md;
+
+  Duplex_El=0;Duplex_Er=0;Loop_E=0, Loop_D=0;
+  snoexport_fold_arrays(&indx, &mLoop, &cLoop,&foldlist, &foldlist_XS ); 
+  n1 = (int) strlen(s1);
+  n2 = (int) strlen(s2);
+  
+  set_model_details(&md);
+  if ((!P) || (fabs(P->temperature - temperature)>1e-6)) {
+    snoupdate_fold_params();
+    if(P)
+      free(P);
+    P = vrna_params(&md);
+    make_pair_matrix();
+  }
+  
+  c = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+  r = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+  for (i=0; i<=n1; i++) {
+          c[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        r[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+        for(j=n2; j>-1; j--){
+                c[i][j]=INF;
+                r[i][j]=INF;
+        }
+  }
+  encode_seqs(s1, s2);
+  i=n1-5;
+  j=pos_j;
+  /* printf("tar: %s\nsno: %s\n ", s1, s2); */
+  /* printf("pos_i %d pos_j %d\n", pos_i, pos_j); */
+  /* printf("type %d n1 %d n2 %d S1[n1] %d S2[n2] %d", pair[S1[i]][S2[j]], n1, n2, S1[n1], S2[n2]); */
+  int type, type2, E, p,q;    
+  r[i][j] = P->DuplexInit; 
+  /* r[i][j] += P->dangle3[rtype[type]][SS1[i+1]] + P->dangle5[rtype[type]][SS2[j-1]];  */
+  
+  if(pair[S1[i]][S2[j]]>2) r[i][j]+=P->TerminalAU;
+  for(a=i-1; a>0;a--){ /* i-1 */
+    r[a+1][0]=INF;
+    for(b=j+1; b<=n2-min_d2;b++){ /* j+1 */
+      r[a][b]=INF;
+      type = pair[S1[a]][S2[b]]; 
+       if(!type) continue; 
+       if(S1[a+1]==4){ 
+         folden * temp; 
+         temp=foldlist_XS[b-1]; 
+         while(temp->next) {     
+           int k = temp->k; 
+           if(pair[S1[a+3]][S2[k-1]] && k< max_s1 && k > min_s1 && k > n2 - max_s2 - max_half_stem &&  k < n2 -min_s2 -half_stem /*&& r[a+3][k-1] + access_s1[i-(a+3)+1][pos_i] < 411*/) { /* remove last condition last condition is to check if the interaction is stable enough */
+             c[a][b]=MIN2(c[a][b], r[a+3][k-1]+temp->energy); 
+           }
+           temp=temp->next;
+         }
+       }
+       if(S1[a+2]==4){
+         folden * temp; 
+         temp=foldlist_XS[b-1]; 
+         while(temp->next){ 
+           int k = temp->k; 
+           if(pair[S1[a+4]][S2[k-1]] &&  k< max_s1 && k > min_s1 && k > n2 - max_s2 - max_half_stem &&  k < n2 -min_s2 -half_stem /*&& r[a+4][k-1] + access_s1[i-(a+4)+1][pos_i] < 411 */ ) { /* remove last condition  */
+             c[a][b]=MIN2(c[a][b], r[a+4][k-1]+temp->energy); 
+           }
+           temp=temp->next;
+         }
+       }
+       for(p=a+1; p<n1 && (p-a) < MAXLOOP_L; p++) { /* p < n1 */
+         for (q=b-1; q > 1  ; q--) {  /* q > 1 */
+           if (p-a+b-q>2*MAXLOOP_L-2) break; 
+           if (abs((p-a)-(b-q)) >= ASS ) continue; 
+           type2 = pair[S1[p]][S2[q]]; 
+           if (!type2) continue; 
+           E = E_IntLoop(p-a-1, b-q-1, type2, rtype[type],SS1[a+1], SS2[b-1], SS1[p-1], SS2[q+1],P); 
+           c[a][b] = MIN2(c[a][b], c[p][q]+E); 
+           r[a][b] = MIN2(r[a][b], r[p][q]+E); 
+         }
+       }
+       E = c[a][b];  
+       if (type>2) E += P->TerminalAU;  
+       /*        E +=P->dangle5[rtype[type]][SS1[i+1]]; */
+       /* E +=P->dangle5[rtype[type]][SS2[j-1]];  */
+       E+=access_s1[i-a+1][pos_i]; 
+       if (E<Emin) { 
+         Emin=E; a_min=a; b_min=b; 
+       }  
+    }
+  }
+  if(Emin > 0){ 
+    printf("no target found under the constraints chosen\n");
+    for (i=0; i<=n1; i++) {free(r[i]);free(c[i]);}
+    free(c);
+    free(r); 
+    free(S1); free(S2); free(SS1); free(SS2);
+    mfe.energy=INF;
+    return mfe;
+  }  
+  type2=pair[S1[a_min]][S2[b_min]];
+  if(type2>2) Emin +=P->TerminalAU;
+  mfe.energy = ((float) (Emin))/100;
+  struc = snoop_backtrack_XS(a_min, b_min,s2, &Duplex_El, &Duplex_Er, &Loop_E, &Loop_D, 
+                             &u, penalty, threshloop, threshLE, threshRE,threshDE, threshD, 
+                             half_stem, max_half_stem, min_s2, max_s2, min_s1, max_s1, min_d1, min_d2); 
+
+  mfe.i = a_min;
+  mfe.j = b_min;
+  mfe.u = u;
+  mfe.Duplex_Er = (float) Duplex_Er/100;
+  mfe.Duplex_El = (float) Duplex_El/100;
+  mfe.Loop_D = (float) Loop_D/100;
+  mfe.Loop_E = (float) Loop_E/100;
+  mfe.energy = (float) Emin/100 ;
+  mfe.fullStemEnergy = (float) fullStemEnergy/100;
+  mfe.structure = struc;
+  return mfe;
+}
+
+PRIVATE char *snoop_backtrack_XS(int i, int j, const char* snoseq, 
+                              int *Duplex_El, int *Duplex_Er, 
+                              int *Loop_E, int *Loop_D, int *u, 
+                              const int penalty, const int threshloop, 
+                              const int threshLE, const int threshRE, const int threshDE, const int threshD,
+                              const int half_stem, const int max_half_stem, 
+                              const int min_s2, const int max_s2, const int min_s1, 
+                              const int max_s1, const int min_d1, const int min_d2) {
+  /* backtrack structure going backwards from i, and forwards from j 
+     return structure in bracket notation with & as separator */
+  int k, l, type, type2, E, traced, i0, j0;
+  int traced_c=0; /* flag for following backtrack in c or r */
+  char *st1, *st2, *struc;
+  char *struc_loop;
+
+  st1 = (char *) vrna_alloc(sizeof(char)*(n1+1));
+  st2 = (char *) vrna_alloc(sizeof(char)*(n2+1));
+  int *indx;
+  int *mLoop;
+  int *cLoop;
+  folden **foldlist, **foldlist_XS;
+  type=pair[S1[i]][S2[j]];
+  snoexport_fold_arrays(&indx, &mLoop, &cLoop,&foldlist, &foldlist_XS ); 
+  i0=i;j0=j;
+  /*   i0=MAX2(i,1); j0=MIN2(j+1,n2); */
+  while (i<=n1 && j>=1 ) {
+    if(!traced_c) {
+      E = c[i][j]; traced=0;
+      st1[i] = '<';
+      st2[j-1] = '>'; 
+      type = pair[S1[i]][S2[j]];
+      if (!type) vrna_message_error("backtrack failed in fold duplex c");
+      for (k=i+1; k>0 && (k-i)<MAXLOOP_L; k++) {
+        for (l=j-1; l>=1 ; l--) {
+          int LE;
+          if (k-i+j-l>2*MAXLOOP_L-2) break;
+          if (abs(k-i-j+l) >= ASS) continue;
+          type2 = pair[S1[k]][S2[l]];
+          if (!type2) continue;
+          LE = E_IntLoop(k-i-1, j-l-1, type2, rtype[type],
+                         SS1[i+1], SS2[j-1], SS1[k-1], SS2[l+1],P);
+          if (E == c[k][l]+LE) {
+            traced=1; 
+            i=k; j=l;
+            *Duplex_El+=LE;
+            break;
+          }
+        }
+        if (traced) break;
+      }
+      if(!traced){
+        if(S1[i+1]==4) {
+          folden * temp;
+          temp=foldlist_XS[j-1];
+          while(temp->next) {
+            int k = temp->k;
+            if(pair[S1[i+3]][S2[k-1]] && k< max_s1 && k > min_s1 && k > n2 - max_s2 - max_half_stem &&  k < n2 -min_s2 -half_stem ) {
+              if(E==r[i+3][k-1]+temp->energy){
+                *Loop_E=temp->energy;
+                st1[i+1]= '|';
+                st1[i+2]='.';
+                *u=i+1;
+                int a,b;
+                for(a=0; a< MISMATCH ;a++){
+                  for(b=0; b< MISMATCH ; b++){
+                    int ij=indx[j-1-a]+k+b;
+                    if(cLoop[ij]==temp->energy) {
+                      struc_loop=snobacktrack_fold_from_pair(snoseq, k+b, j-1-a); 
+                      a=INF; b=INF;        
+                    }
+                  }
+                }
+                traced=1;
+                traced_c=1;
+                i=i+3;j=k-1;
+                break;
+              }
+            }
+            temp=temp->next;
+          }
+        }
+        if (S1[i+2]==4){  /* introduce structure from RNAfold */
+          folden * temp;
+          temp=foldlist_XS[j-1];
+          while(temp->next) {
+            int k = temp->k;
+            if(pair[S1[i+4]][S2[k-1]] && k< max_s1 && k > min_s1 && k > n2 - max_s2 - max_half_stem &&  k < n2 -min_s2 -half_stem ) {
+              if(E==r[i+4][k-1]+temp->energy){
+                *Loop_E=temp->energy;
+                st1[i+2]= '|';
+                st1[i+1]=st1[i+3]='.';
+                *u=i+2;
+                int a,b;
+                for(a=0; a< MISMATCH ;a++){
+                  for(b=0; b< MISMATCH ; b++){
+                    int ij=indx[j-1-a]+k+b;
+                    if(cLoop[ij]==temp->energy) {
+                      struc_loop=snobacktrack_fold_from_pair(snoseq, k+b, j-a-1);
+                      a=INF; b=INF;        
+                    }
+                  }
+                }
+                traced=1;
+                traced_c=1;
+                i=i+4;j=k-1;
+                break;
+              }
+            }
+            temp=temp->next;
+          }
+        }
+      }/* traced? */
+    }/* traced_r? */
+    else{
+      E = r[i][j]; traced=0;
+      st1[i] = '<';
+      st2[j-1] = '>'; 
+      type = pair[S1[i]][S2[j]];
+      if (!type) vrna_message_error("backtrack failed in fold duplex r");
+      for (k=i+1; k>0 && (k-i)<MAXLOOP_L; k++) {
+        for (l=j-1; l>=1 ; l--) {
+          int LE;
+          if (k-i+j-l>2*MAXLOOP_L-2) break;
+          if (abs(k-i-j+l) >= ASS) continue;
+          type2 = pair[S1[k]][S2[l]];
+          if (!type2) continue;
+          LE = E_IntLoop(k-i-1, j-l-1, type2, rtype[type],
+                         SS1[i+1], SS2[j-1], SS1[k-1], SS2[l+1],P);
+          if (E == r[k][l]+LE) {
+            traced=1; 
+            i=k; j=l;
+            *Duplex_Er+=LE;
+            break;
+          }
+        }
+        if (traced) break;
+      }
+    }
+    if (!traced) { 
+/*       if (i>1)    {E -= P->dangle5[type][SS1[i-1]]; *Duplex_El +=P->dangle5[type][SS1[i-1]];} */
+/*       if (j<n2)   {E -= P->dangle3[type][SS2[j+1]]; *Duplex_El +=P->dangle3[type][SS2[j+1]];} */
+      if (type>2) {E -= P->TerminalAU;        *Duplex_Er +=P->TerminalAU;}
+      if (E != P->DuplexInit) {
+        vrna_message_error("backtrack failed in fold duplex end");
+      } else break;
+    }
+  }
+
+  
+  /* struc = (char *) vrna_alloc(i0-i+1+j-j0+1+2); */ /* declare final duplex structure */
+  struc = (char *) vrna_alloc(i-i0+1+n2); /* declare final duplex structure */
+  char * struc2;
+  struc2 = (char *) vrna_alloc(n2+1);
+  /* char * struct_const; */
+
+  for (k=MIN2(i0,1); k<=i; k++) if (!st1[k-1]) st1[k-1] = '.';
+  /* for (k=j0; k<=j; k++) if (!st2[k-1]) st2[k-1] = struc_loop[k-1];*/ /* '.'; normal */
+  /*  char * struct_const; */
+  /*  struct_const = (char *) vrna_alloc(sizeof(char)*(n2+1));   */
+  for (k=1; k<=n2; k++) {
+    if (!st2[k-1]) st2[k-1] = struc_loop[k-1];/* '.'; */
+    struc2[k-1] = st2[k-1];/* '.'; */
+    /*      if (k>=j0 && k<=j){ */
+    /*              struct_const[k-1]='x'; */
+    /*      } */
+    /*      else{ */
+    /*              if(k<j0) {struct_const[k-1]='<';} */
+    /*              if(k>j) {struct_const[k-1]='>';} */
+    /*      } */
+  }
+  char duplexseq_1[j];
+  char duplexseq_2[n2-j0+2];
+  if(j0<n2){
+    strncpy(duplexseq_1, snoseq, j-1);
+    strcpy(duplexseq_2, snoseq + j0);
+    duplexseq_1[j-1]='\0';
+    duplexseq_2[n2-j0+1]='\0';
+    duplexT temp;
+    temp=duplexfold(duplexseq_1, duplexseq_2);
+    *Loop_D =  MIN2(0,-410 + (int) 100 * temp.energy);
+    if(*Loop_D){
+      int l1,ibegin, iend, jbegin, jend;
+      l1=strchr(temp.structure, '&')-temp.structure;
+      ibegin=temp.i-l1;
+      iend  =temp.i-1;
+      jbegin=temp.j;
+      jend  =temp.j+(int)strlen(temp.structure)-l1-2-1;
+      for(k=ibegin+1; k<=iend+1; k++){
+        struc2[k-1]=temp.structure[k-ibegin-1];
+      }
+      for(k=jbegin+j0; k<=jend+j0; k++){
+        struc2[k-1]=temp.structure[l1+k-j0-jbegin+1];
+      } 
+    }
+    free(temp.structure);
+  } 
+  strcpy(struc, st1+MAX2(i0,1)); strcat(struc, "&"); 
+  /* strcat(struc, st2); */
+  strncat(struc, struc2+5, (int)strlen(struc2)-10);
+  free(struc2);
+  free(struc_loop);
+  free(st1); free(st2);
+  
+    for (i=0; i<=n1; i++) {free(r[i]);free(c[i]);}
+    free(c);
+    free(r);
+    free(S1);free(S2);free(SS1);free(SS2);
+    /* free_arrays(); */
+  return struc;
+}
+
+PRIVATE int covscore(const int *types, int n_seq) {
+  /* calculate co-variance bonus for a pair depending on  */
+  /* compensatory/consistent mutations and incompatible seqs */
+  /* should be 0 for conserved pairs, >0 for good pairs      */
+#define NONE -10000 /* score for forbidden pairs */
+  int k,l,s,score, pscore;
+  int dm[7][7]={{0,0,0,0,0,0,0}, /* hamming distance between pairs */
+                {0,0,2,2,1,2,2} /* CG */,
+                {0,2,0,1,2,2,2} /* GC */,
+                {0,2,1,0,2,1,2} /* GU */,
+                {0,1,2,2,0,2,1} /* UG */,
+                {0,2,2,1,2,0,2} /* AU */,
+                {0,2,2,2,1,2,0} /* UA */};
+  
+  int pfreq[8]={0,0,0,0,0,0,0,0};
+  for (s=0; s<n_seq; s++)
+    pfreq[types[s]]++;
+
+  if (pfreq[0]*2>n_seq) return NONE;
+  for (k=1,score=0; k<=6; k++) /* ignore pairtype 7 (gap-gap) */
+    for (l=k+1; l<=6; l++)
+      /* scores for replacements between pairtypes    */
+      /* consistent or compensatory mutations score 1 or 2  */
+      score += pfreq[k]*pfreq[l]*dm[k][l];
+  
+  /* counter examples score -1, gap-gap scores -0.25   */
+  pscore = cv_fact * 
+    ((UNIT*score)/n_seq - nc_fact*UNIT*(pfreq[0] + pfreq[7]*0.25));
+  return pscore;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE short * aliencode_seq(const char *sequence) {
+  unsigned int i,l;
+  short *Stemp;
+  l = strlen(sequence);
+  Stemp = (short *) vrna_alloc(sizeof(short)*(l+2));
+  Stemp[0] = (short) l;
+
+  /* make numerical encoding of sequence */
+  for (i=1; i<=l; i++)
+    Stemp[i]= (short) encode_char(toupper(sequence[i-1]));
+
+  /* for circular folding add first base at position n+1 */
+  /* Stemp[l+1] = Stemp[1]; */
+
+  return Stemp;
+}
+
+PRIVATE short * encode_seq(const char *sequence) {
+  unsigned int i,l;
+  short *S;
+  l = strlen(sequence);
+extern double nc_fact;
+  S = (short *) vrna_alloc(sizeof(short)*(l+2));
+  S[0] = (short) l;
+
+  /* make numerical encoding of sequence */
+  for (i=1; i<=l; i++)
+    S[i]= (short) encode_char(toupper(sequence[i-1]));
+  /* for circular folding add first base at position n+1 */
+  S[l+1] = S[1];
+
+  return S;
+}
+
+PRIVATE void encode_seqs(const char *s1, const char *s2) {
+  unsigned int i,l;
+
+  l = strlen(s1);
+  S1 = encode_seq(s1);
+  SS1= (short *) vrna_alloc(sizeof(short)*(l+1));
+  /* SS1 exists only for the special X K and I bases and energy_set!=0 */
+  
+  for (i=1; i<=l; i++) { /* make numerical encoding of sequence */
+    SS1[i] = alias[S1[i]];   /* for mismatches of nostandard bases */
+  }
+
+  l = strlen(s2);
+  S2 = encode_seq(s2);
+  SS2= (short *) vrna_alloc(sizeof(short)*(l+1));
+  /* SS2 exists only for the special X K and I bases and energy_set!=0 */
+  
+  for (i=1; i<=l; i++) { /* make numerical encoding of sequence */
+    SS2[i] = alias[S2[i]];   /* for mismatches of nostandard bases */
+  }
+}
+
+PRIVATE int compare(const void *sub1, const void *sub2) {
+  int d;
+  if (((snoopT *) sub1)->energy > ((snoopT *) sub2)->energy)
+    return 1;
+  if (((snoopT *) sub1)->energy < ((snoopT *) sub2)->energy)
+    return -1;
+  d = ((snoopT *) sub1)->i - ((snoopT *) sub2)->i;
+  if (d!=0) return d;
+  return  ((snoopT *) sub1)->j - ((snoopT *) sub2)->j;
+}
+
+
+
diff --git a/C/ViennaRNA/snoop.h b/C/ViennaRNA/snoop.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/snoop.h
@@ -0,0 +1,284 @@
+#ifndef VIENNA_RNA_PACKAGE_SNOOP_H
+#define VIENNA_RNA_PACKAGE_SNOOP_H
+
+#include <ViennaRNA/data_structures.h>
+/** 
+*** computes snoRNA-RNA interactions in RNAduplex manner
+**/
+
+snoopT snoopfold( const char *s1,
+                  const char *s2, 
+                  const int penalty,
+                  const int threshloop, 
+                  const int threshLE,
+                  const int threshRE,
+                  const int threshDE,
+                  const int threshD,
+                  const int half_stem,
+                  const int max_half_stem,
+                  const int min_s2,
+                  const int max_s2,
+                  const int min_s1,
+                  const int max_s1,
+                  const int min_d1,
+                  const int min_d2,
+		  const int fullStemEnergy);
+
+/** 
+*** computes snoRNA-RNA suboptimal interactions in RNAduplex manner
+**/
+
+
+snoopT *snoop_subopt( const char *s1,
+                      const char *s2,
+                      int delta,
+                      int w,
+                      const int penalty,
+                      const int threshloop, 
+                      const int threshLE,
+                      const int threshRE,
+                      const int threshDE,
+                      const int threshTE,
+                      const int threshSE,
+                      const int threshD,
+                      const int distance,
+                      const int half_stem,
+                      const int max_half_stem,
+                      const int min_s2,
+                      const int max_s2,
+                      const int min_s1,
+                      const int max_s1,
+                      const int min_d1,
+                      const int min_d2,
+		      const int fullStemEnergy);
+
+/** 
+*** computes snoRNA-RNA suboptimal interactions in a RNAplex manner
+**/
+
+
+
+void Lsnoop_subopt( const char *s1,
+                    const char *s2,
+                    int delta,
+                    int w, 
+                    const int penalty,
+                    const int threshloop, 
+                    const int threshLE,
+                    const int threshRE,
+                    const int threshDE,
+                    const int threshTE,
+                    const int threshSE,
+                    const int threshD,
+                    const int distance,
+                    const int half_stem,
+                    const int max_half_stem,
+                    const int min_s2,
+                    const int max_s2,
+                    const int min_s1,
+                    const int max_s1,
+                    const int min_d1,
+                    const int min_d2,
+                    const int alignment_length,
+                    const char* name,
+		    const int fullStemEnergy);
+
+/** 
+*** computes snoRNA-RNA suboptimal interactions in a RNAplex manner. The stem energy is saved into a list of struct, leading to a runtime improvement of 20%
+**/
+
+
+
+void Lsnoop_subopt_list ( const char *s1,
+                          const char *s2,
+                          int delta,
+                          int w, 
+                          const int penalty,
+                          const int threshloop, 
+                          const int threshLE,
+                          const int threshRE,
+                          const int threshDE,
+                          const int threshTE,
+                          const int threshSE,
+                          const int threshD,
+                          const int distance,
+                          const int half_stem,
+                          const int max_half_stem,
+                          const int min_s2,
+                          const int max_s2,
+                          const int min_s1,
+                          const int max_s1,
+                          const int min_d1,
+                          const int min_d2,
+                          const int alignment_length,
+                          const char *name,
+			  const int fullStemEnergy);
+
+/** 
+*** computes snoRNA-RNA suboptimal interactions in a RNAplex manner. The stem energy is saved into a list of struct, leading to a runtime improvement of 20%. It considers accessibility
+**/
+
+
+void Lsnoop_subopt_list_XS (const char *s1,
+                            const char *s2,
+                            const int **access_s1,
+                            int delta,
+                            int w, 
+                            const int penalty,
+                            const int threshloop, 
+                            const int threshLE,
+                            const int threshRE,
+                            const int threshDE,
+                            const int threshTE,
+                            const int threshSE,
+                            const int threshD,
+                            const int distance,
+                            const int half_stem,
+                            const int max_half_stem,
+                            const int min_s2,
+                            const int max_s2,
+                            const int min_s1,
+                            const int max_s1,
+                            const int min_d1,
+                            const int min_d2,
+                            const int alignment_length,
+                            const char *name,
+			    const int fullStemEnergy);
+
+
+/** 
+*** computes snoRNA-RNA suboptimal interactions in a RNAduplex manner, and considers accessibility
+**/
+
+
+void snoop_subopt_XS (const char *s1,
+                      const char *s2,
+                      const int **access_s1,
+                      int delta,
+                      int w, 
+                      const int penalty,
+                      const int threshloop, 
+                      const int threshLE,
+                      const int threshRE,
+                      const int threshDE,
+                      const int threshTE,
+                      const int threshSE,
+                      const int threshD,
+                      const int distance,
+                      const int half_stem,
+                      const int max_half_stem,
+                      const int min_s2,
+                      const int max_s2,
+                      const int min_s1,
+                      const int max_s1,
+                      const int min_d1,
+                      const int min_d2,
+                      const int alignment_length,
+                      const char *name,
+		      const int fullStemEnergy);
+
+/**
+*** aliduplex-like alignment version of snoop_subopt
+ **/
+
+snoopT *alisnoop_subopt(const char **s1,
+                        const char **s2,
+                        int delta,
+                        int w,
+                        const int penalty,
+                        const int threshloop, 
+                        const int threshLE,
+                        const int threshRE,
+                        const int threshDE,
+                        const int threshTE,
+                        const int threshSE,
+                        const int threshD,
+                        const int distance,
+                        const int half_stem,
+                        const int max_half_stem,
+                        const int min_s2,
+                        const int max_s2,
+                        const int min_s1,
+                        const int max_s1,
+                        const int min_d1,
+                        const int min_d2);
+
+/**
+*** RNAplex-like Alignment version of snoop_subopt
+ **/
+
+
+
+snoopT *aliLsnoop_subopt_list ( const char **s1,
+                                const char **s2,
+                                int delta,
+                                int w, 
+                                const int penalty,
+                                const int threshloop, 
+                                const int threshLE,
+                                const int threshRE,
+                                const int threshDE,
+                                const int threshTE,
+                                const int threshSE,
+                                const int threshD,
+                                const int distance,
+                                const int half_stem,
+                                const int max_half_stem,
+                                const int min_s2,
+                                const int max_s2,
+                                const int min_s1,
+                                const int max_s1,
+                                const int min_d1,
+                                const int min_d2,
+                                const int alignment_length);
+/**
+*** RNAaliduplex-like version of snoopfold
+**/
+
+
+snoopT alisnoopfold(const char **s1,
+                    const char **s2, 
+                    const int penalty,
+                    const int threshloop,
+                    const int threshLE,
+                    const int threshRE,
+                    const int threshDE,
+                    const int threshD,
+                    const int half_stem,
+                    const int max_half_stem,
+                    const int min_s2,
+                    const int max_s2,
+                    const int min_s1,
+                    const int max_s1,
+                    const int min_d1,
+                    const int min_d2);
+/**
+*** RNAduplex-like version of snoopfold with accessibility information
+**/ 
+
+snoopT snoopfold_XS(const char *s1,
+                    const char *s2,
+                    const int **access_s1,
+                    const int pos,
+                    const int max_pos_j,
+                    const int penalty,
+                    const int threshloop, 
+                    const int threshLE,
+                    const int threshRE,
+                    const int threshDE,
+                    const int threshD,
+                    const int half_stem,
+                    const int max_half_stem,
+                    const int min_s2,
+                    const int max_s2,
+                    const int min_s1,
+                    const int max_s1,
+                    const int min_d1,
+                    const int min_d2,
+		    const int fullStemEnergy);
+
+
+
+
+extern int snoop_subopt_sorted;
+#endif
diff --git a/C/ViennaRNA/string_utils.c b/C/ViennaRNA/string_utils.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/string_utils.c
@@ -0,0 +1,340 @@
+/*
+                               string_utils.c
+
+                 c  Ivo L Hofacker and Walter Fontana
+                          Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdarg.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/string_utils.h"
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+#ifndef HAVE_STRDUP
+char *strdup(const char *s) {
+  char *dup;
+
+  dup = vrna_alloc(strlen(s)+1);
+  strcpy(dup, s);
+  return(dup);
+}
+#endif
+
+PUBLIC char *
+vrna_strdup_printf(const char *format, ...){
+
+  char *result;
+  va_list argp;
+
+  va_start(argp, format);
+  result = vrna_strdup_vprintf(format, argp);
+  va_end(argp); /* Each va_start() or va_copy() needs a va_end() */
+
+  return result;
+}
+
+PUBLIC char *
+vrna_strdup_vprintf(const char *format, va_list argp){
+
+  char    *result;
+  int     r;
+
+  result  = NULL;
+
+#ifndef HAVE_VASPRINTF
+  int     count;
+  va_list copy;
+  va_copy(copy, argp);
+
+  r = -1;
+
+  /* retrieve the number of characters that the string requires */
+#ifdef _WIN32
+  /*
+    vsnprintf() in Windows is not ANSI compliant, although it's
+    "...included for compliance to the ANSI standard"
+    Thus, we use _vscprintf() that explicitly counts characters
+  */
+  count = _vscprintf(format, argp);
+#else
+  count = vsnprintf(NULL, 0, format, argp);
+#endif
+
+  if((count >= 0) && (count < INT_MAX)){
+    char *buf = (char *)vrna_alloc(sizeof(char) * (count + 1));
+    if(buf == NULL)
+      r = -1;
+    else if((r = vsnprintf(buf, count + 1, format, copy)) < 0)
+      free(buf);
+    else
+      result = buf;
+  }
+
+  va_end(copy);  /* Each va_start() or va_copy() needs a va_end() */
+#else
+  /* the default is to use vasprintf() if available */
+  r = vasprintf(&result, format, argp);
+#endif
+
+  /* check for any memory allocation error indicated by r == -1 */
+  if(r == -1){
+    vrna_message_warning("vrna_strdup_printf: memory allocation failure!");
+    result = NULL;
+  }
+
+  return result;
+}
+
+
+PUBLIC int
+vrna_strcat_printf(char **dest, const char *format, ...){
+
+  int r;
+  va_list argp;
+
+  va_start(argp, format);
+  r = vrna_strcat_vprintf(dest, format, argp);
+  va_end(argp); /* Each va_start() or va_copy() needs a va_end() */
+
+  return r;
+}
+
+
+PUBLIC int
+vrna_strcat_vprintf(char **dest, const char *format, va_list args){
+
+  char    *buf;
+  int     r, l1, l2;
+  size_t  old_count, new_count;
+
+  if((!dest) || (!format))
+    return -1;
+
+  va_list copy;
+  va_copy(copy, args);
+
+  r         = -1;
+  buf       = *dest;
+  old_count = (buf) ? strlen(buf) : 0;
+
+  /* retrieve the number of characters that the string requires */
+#ifdef _WIN32
+  /*
+    vsnprintf() in Windows is not ANSI compliant, although it's
+    "...included for compliance to the ANSI standard"
+    Thus, we use _vscprintf() that explicitly counts characters
+  */
+  new_count = _vscprintf(format, args);
+#else
+  new_count = vsnprintf(NULL, 0, format, args);
+#endif
+
+  /* determine longer and shorter part of new string for INT overflow protection */
+  if(old_count > new_count){
+    l1 = old_count;
+    l2 = new_count;
+  } else {
+    l1 = new_count;
+    l2 = old_count;
+  }
+
+  if((new_count > 0) && (l1 < SIZE_MAX) && ((SIZE_MAX - l1) > l2)){
+    buf = (char *)vrna_realloc(buf, sizeof(char) * (old_count + new_count + 1));
+    if(buf == NULL)
+      r = -1;
+    else if((r = vsnprintf(buf + old_count, new_count + 1, format, copy)) < 0)
+      free(buf);
+    else {
+      *dest = buf;
+      r = old_count + new_count;
+    }
+  } else if(new_count == 0){
+    /* we do not treat empty format string as error */
+    r = (int)old_count;
+  }
+
+  va_end(copy);  /* Each va_start() or va_copy() needs a va_end() */
+
+  /* check for any memory allocation error indicated by r == -1 */
+  if(r == -1){
+    vrna_message_warning("vrna_strcat_printf: memory allocation failure!");
+    *dest = NULL;
+  }
+
+  return r;
+}
+
+
+PUBLIC char *
+vrna_random_string(int l, const char symbols[]){
+
+  char *r;
+  int   i, rn, base;
+
+  base = (int) strlen(symbols);
+  r = (char *) vrna_alloc(sizeof(char)*(l+1));
+
+  for (i = 0; i < l; i++) {
+    rn = (int) (vrna_urn()*base);  /* [0, base-1] */
+    r[i] = symbols[rn];
+  }
+  r[l] = '\0';
+  return r;
+}
+
+/*-----------------------------------------------------------------*/
+
+PUBLIC int
+vrna_hamming_distance(const char *s1,
+                      const char *s2){
+
+  int h=0;
+
+  for (; *s1 && *s2; s1++, s2++)
+    if (*s1 != *s2) h++;
+  return h;
+}
+
+PUBLIC int
+vrna_hamming_distance_bound(const char *s1,
+                            const char *s2,
+                            int boundary){
+
+  int h=0;
+
+  for (; *s1 && *s2 && boundary; s1++, s2++, boundary--)
+    if (*s1 != *s2) h++;
+  return h;
+}
+
+PUBLIC  void
+vrna_seq_toRNA(char *sequence){
+
+  unsigned int i;
+  if(sequence){
+    for(i = 0; sequence[i]; i++){
+      if(sequence[i] == 'T') sequence[i] = 'U';
+      if(sequence[i] == 't') sequence[i] = 'u';
+    }
+  }
+}
+
+PUBLIC void
+vrna_seq_toupper(char *sequence){
+
+  unsigned int i;
+  if(sequence){
+    for(i=0;sequence[i];i++)
+      sequence[i] = toupper(sequence[i]);
+  }
+}
+
+PUBLIC char *
+vrna_cut_point_insert(const char *string,
+                      int cp){
+
+  char *ctmp;
+  int len;
+
+  if(cp > 0){
+    len = strlen(string);
+    ctmp = (char *)vrna_alloc((len+2) * sizeof(char));
+    /* first sequence */
+    (void) strncpy(ctmp, string, cp-1);
+    /* spacer */
+    ctmp[cp-1] = '&';
+    /* second sequence */
+    (void) strcat(ctmp, string+cp-1);
+  } else {
+    ctmp = strdup(string);
+  }
+  return ctmp;
+}
+
+PUBLIC char *
+vrna_cut_point_remove(const char *string,
+                      int *cp){
+
+  char *pos, *copy = NULL;
+
+  *cp = -1;
+
+  if(string){
+    copy = (char *) vrna_alloc(strlen(string)+1);
+    (void) sscanf(string, "%s", copy);
+    pos = strchr(copy, '&');
+    if (pos) {
+      *cp = (int)(pos - copy) + 1;
+      if (*cp >= strlen(copy)) *cp = -1;
+      if (strchr(pos+1, '&')) vrna_message_error("more than one cut-point in input");
+      for (;*pos;pos++) *pos = *(pos+1); /* splice out the & */
+    }
+  }
+
+  return copy;
+}
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC void
+str_uppercase(char *sequence){
+
+  vrna_seq_toupper(sequence);
+}
+
+PUBLIC void
+str_DNA2RNA(char *sequence){
+
+  vrna_seq_toRNA(sequence);
+}
+
+PUBLIC char *
+random_string(int l, const char symbols[]){
+
+  return vrna_random_string(l, symbols);
+}
+
+PUBLIC int
+hamming(const char *s1,
+        const char *s2){
+
+  return vrna_hamming_distance(s1, s2);
+}
+
+PUBLIC int
+hamming_bound(const char *s1,
+              const char *s2,
+              int boundary){
+
+  return vrna_hamming_distance_bound(s1, s2, boundary);
+}
+
+#endif
diff --git a/C/ViennaRNA/string_utils.h b/C/ViennaRNA/string_utils.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/string_utils.h
@@ -0,0 +1,259 @@
+#ifndef VIENNA_RNA_PACKAGE_STRING_UTILS_H
+#define VIENNA_RNA_PACKAGE_STRING_UTILS_H
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file     string_utils.h
+ *  @ingroup  utils
+ *  @brief    General utility- and helper-functions for RNA sequence and structure strings used throughout the ViennaRNA Package
+ */
+
+/**
+ *  @{
+ *  @ingroup   string_utils
+ */
+
+#include <stdarg.h>
+#include <ViennaRNA/data_structures.h>
+
+/**
+ * @brief Stringify a macro after expansion
+ */
+#define XSTR(s) STR(s)
+
+/**
+ * @brief Stringify a macro argument
+ */
+#define STR(s) #s
+
+#ifndef FILENAME_MAX_LENGTH
+
+/**
+ *  @brief Maximum length of filenames that are generated by our programs
+ *
+ *  This definition should be used throughout the complete ViennaRNA package
+ *  wherever a static array holding filenames of output files is declared.
+ */
+#define FILENAME_MAX_LENGTH   80
+
+/**
+ *  @brief Maximum length of id taken from fasta header for filename generation
+ *
+ *  this has to be smaller than FILENAME_MAX_LENGTH since in most cases,
+ *  some suffix will be appended to the ID
+ */
+#define FILENAME_ID_LENGTH    42
+
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#ifndef HAVE_STRDUP
+char *strdup(const char *s);
+#endif
+#endif
+
+/**
+ *  @brief Safely create a formatted string
+ *
+ *  This function is a safe implementation for creating a formatted character array,
+ *  similar to @em sprintf.
+ *  Internally, it uses the @em asprintf function if available to dynamically allocate
+ *  a large enough character array to store the supplied content. If @em asprintf is
+ *  not available, mimic it's behavior using @em vsnprintf.
+ *
+ *  @note The returned pointer of this function should always be passed to @em free() to
+ *  release the allocated memory
+ *
+ *  @see vrna_strdup_vprintf(), vrna_strcat_printf()
+ *
+ *  @param  format  The format string (See also asprintf)
+ *  @param  ...     The list of variables used to fill the format string
+ *  @return         The formatted, null-terminated string, or NULL if something has gone wrong
+ */
+char *vrna_strdup_printf(const char *format, ...);
+
+
+/**
+ *  @brief Safely create a formatted string
+ *
+ *  This function is the @em va_list version of vrna_strdup_printf()
+ *
+ *  @note The returned pointer of this function should always be passed to @em free() to
+ *  release the allocated memory
+ *
+ *  @see vrna_strdup_printf(), vrna_strcat_printf(), vrna_strcat_vprintf()
+ *
+ *  @param  format  The format string (See also asprintf)
+ *  @param  ...     The list of variables used to fill the format string
+ *  @return         The formatted, null-terminated string, or NULL if something has gone wrong
+ */
+char *vrna_strdup_vprintf(const char *format, va_list argp);
+
+
+/**
+ *  @brief Safely append a formatted string to another string
+ *
+ *  This function is a safe implementation for appending a formatted character array,
+ *  similar to a cobination of @em strcat and @em sprintf.
+ *  The function automatically allocates enough memory to store both, the previous
+ *  content stored at @p dest and the appended format string. If the @p dest pointer
+ *  is NULL, the function allocate memory only for the format string.
+ *  The function returns the number of characters in the resulting string or -1
+ *  in case of an error.
+ *
+ *  @see vrna_strcat_vprintf(), vrna_strdup_printf(), vrna_strdup_vprintf()
+ *
+ *  @param  dest    The address of a char *pointer where the formatted string is to be appended
+ *  @param  format  The format string (See also sprintf)
+ *  @param  ...     The list of variables used to fill the format string
+ *  @return         The number of characters in the final string, or -1 on error
+ */
+int vrna_strcat_printf(char **dest, const char *format, ...);
+
+
+/**
+ *  @brief Safely append a formatted string to another string
+ *
+ *  This function is the @em va_list version of vrna_strcat_printf()
+ *
+ *  @see vrna_strcat_printf(), vrna_strdup_printf(), vrna_strdup_vprintf()
+ *
+ *  @param  dest    The address of a char *pointer where the formatted string is to be appended
+ *  @param  format  The format string (See also sprintf)
+ *  @param  ...     The list of variables used to fill the format string
+ *  @return         The number of characters in the final string, or -1 on error
+ */
+int vrna_strcat_vprintf(char **dest, const char *format, va_list args);
+
+
+/**
+ *  @brief Create a random string using characters from a specified symbol set
+ *
+ *  @param l        The length of the sequence
+ *  @param symbols  The symbol set
+ *  @return         A random string of length 'l' containing characters from the symbolset
+ */
+char  *vrna_random_string(int l, const char symbols[]);
+
+/**
+ *  @brief Calculate hamming distance between two sequences
+ *
+ *  @param s1   The first sequence
+ *  @param s2   The second sequence
+ *  @return     The hamming distance between s1 and s2
+ */
+int vrna_hamming_distance(const char *s1, const char *s2);
+
+/**
+ *  @brief Calculate hamming distance between two sequences up to a specified length
+ *
+ *  This function is similar to vrna_hamming_distance() but instead of comparing both sequences
+ *  up to their actual length only the first 'n' characters are taken into account
+ *  @param  s1  The first sequence
+ *  @param  s2  The second sequence
+ *  @param  n   The length of the subsequences to consider (starting from the 5' end)
+ *  @return     The hamming distance between s1 and s2
+ */
+int vrna_hamming_distance_bound(const char *s1, const char *s2, int n);
+
+/**
+ *  @brief Convert an input sequence (possibly containing DNA alphabet characters) to RNA alphabet
+ *
+ *  This function substitudes <i>T</i> and <i>t</i> with <i>U</i> and <i>u</i>, respectively
+ * 
+ *  @param sequence The sequence to be converted
+ */
+void vrna_seq_toRNA(char *sequence);
+
+/**
+ *  @brief Convert an input sequence to uppercase
+ * 
+ *  @param sequence The sequence to be converted
+ */
+void vrna_seq_toupper(char *sequence);
+
+/**
+ *  @brief Add a separating '&' character into a string according to cut-point position
+ *
+ *  If the cut-point position is less or equal to zero, this function just
+ *  returns a copy of the provided string. Otherwise, the cut-point character
+ *  is set at the corresponding position
+ *
+ *  @param  string    The original string
+ *  @param  cp        The cut-point position
+ *  @return           A copy of the provided string including the cut-point character
+ */
+char *vrna_cut_point_insert(const char *string,
+                            int cp);
+
+/**
+ *  @brief  Remove a separating '&' character from a string
+ *
+ *  This function removes the cut-point indicating '&' character from a string
+ *  and memorizes its position in a provided integer variable. If not '&' is
+ *  found in the input, the integer variable is set to -1. The function returns
+ *  a copy of the input string with the '&' being sliced out.
+ *
+ *  @param  string  The original string
+ *  @param  cp      The cut-point position
+ *  @return         A copy of the input string with the '&' being sliced out
+ */
+char *vrna_cut_point_remove(const char *string,
+                            int *cp);
+
+/**
+ *  @}
+ */
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief Convert an input sequence to uppercase
+ *  @deprecated   Use vrna_seq_toupper() instead!
+ */
+DEPRECATED(void  str_uppercase(char *sequence));
+
+/**
+ *  @brief Convert a DNA input sequence to RNA alphabet
+ *
+ *  @deprecated Use vrna_seq_toRNA() instead!
+ */
+DEPRECATED(void str_DNA2RNA(char *sequence));
+
+/**
+ *  @brief Create a random string using characters from a specified symbol set
+ *
+ *  @deprecated Use vrna_random_string() instead!
+ */
+DEPRECATED(char *random_string(int l, const char symbols[]));
+
+/**
+ *  @brief Calculate hamming distance between two sequences
+ *
+ *  @deprecated Use vrna_hamming_distance() instead!
+ */
+DEPRECATED(int hamming(const char *s1, const char *s2));
+
+/**
+ *  @brief Calculate hamming distance between two sequences up to a specified length
+ *
+ *  @deprecated Use vrna_hamming_distance_bound() instead!
+ */
+DEPRECATED(int hamming_bound(const char *s1, const char *s2, int n));
+
+#endif
+
+#endif
diff --git a/C/ViennaRNA/stringdist.c b/C/ViennaRNA/stringdist.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/stringdist.c
@@ -0,0 +1,434 @@
+/*
+		String alignment for RNA secondary structures
+		      Peter F Stadler, Ivo Hofacker
+			   Vienna RNA Package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+#include "ViennaRNA/edit_cost.h"
+#include "ViennaRNA/dist_vars.h"
+#include "ViennaRNA/utils.h"
+
+
+#define PUBLIC
+#define PRIVATE        static
+
+PUBLIC  float      string_edit_distance(swString *T1, swString *T2);
+PUBLIC  swString  *Make_swString(char *string);
+PUBLIC  void       print_swString(swString *x);
+PUBLIC  void       print_alignment_list(void);
+
+PRIVATE void       sprint_aligned_swStrings(swString *T1, swString *T2);
+PRIVATE float      StrEditCost(int i, int j, swString *T1, swString *T2);
+PRIVATE void       DeCode(char *string, int k, int *tp, float *w);
+PRIVATE int        decode(char *id);
+PRIVATE void       encode(int type, char label[]);
+PRIVATE int       *alignment[2]; /* contains information from backtracking
+				    alignment[0][n] is the node in tree2
+				    matching node n in tree1               */
+
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC float string_edit_distance(swString *T1, swString *T2)
+
+{
+    float  **distance;
+    short    **i_point, **j_point;
+
+    int           i, j, i1, j1, pos, length1,length2;
+    float         minus, plus, change, temp;
+
+    if (cost_matrix==0) EditCost = &UsualCost;
+    else EditCost = &ShapiroCost;
+
+    length1 = T1[0].sign;
+    length2 = T2[0].sign;
+
+    distance = (float **)  vrna_alloc((length1 +1)*sizeof(float *));
+    if(edit_backtrack){
+       i_point  = (short **)  vrna_alloc((length1 +1)*sizeof(short *));
+       j_point  = (short **)  vrna_alloc((length1 +1)*sizeof(short *));
+    }
+    for(i=0; i<= length1; i++){
+       distance[i] = (float *) vrna_alloc( (length2+1)*sizeof(float));
+       if(edit_backtrack){
+	  i_point[i]  = (short *) vrna_alloc( (length2+1)*sizeof(short));
+	  j_point[i]  = (short *) vrna_alloc( (length2+1)*sizeof(short));
+       }
+    }
+
+    for(i = 1; i <= length1; i++) {
+       if (edit_backtrack){
+	  i_point[i][0] = i-1;
+	  j_point[i][0] = 0;
+       }
+       distance[i][0] = distance[i-1][0]+StrEditCost(i,0,T1,T2);
+    }
+    for(j = 1; j <= length2; j++) {
+       if (edit_backtrack){
+	  j_point[0][j] = j-1;
+	  i_point[0][j] = 0;
+       }
+       distance[0][j] = distance[0][j-1]+StrEditCost(0,j,T1,T2);
+    }
+
+    for (i = 1; i <= length1; i++) {
+       for (j = 1; j <= length2 ; j++) {
+          minus  = distance[i-1][j]  + StrEditCost(i,0,T1,T2);
+          plus   = distance[i][j-1]  + StrEditCost(0,j,T1,T2);
+          change = distance[i-1][j-1]+ StrEditCost(i,j,T1,T2);
+
+          distance[i][j] = MIN3(minus, plus, change);
+          /* printf("%g ", distance[i][j]); */
+
+          if(edit_backtrack){
+             if(distance[i][j] == change) {
+                i_point[i][j]=i-1; j_point[i][j]=j-1;  }
+             else if(distance[i][j] == plus) {
+                i_point[i][j]=i  ; j_point[i][j]=j-1;  }
+             else {
+                i_point[i][j]=i-1; j_point[i][j]=j  ;  }
+          }
+       }
+       /* printf("\n"); */
+    }
+    /* printf("\n"); */
+    temp = distance[length1][length2];
+    for(i=0;i<=length1;i++)
+       free(distance[i]);
+    free(distance);
+
+    if(edit_backtrack){
+       if(alignment[0]!= NULL) free(alignment[0]);
+       if(alignment[1]!= NULL) free(alignment[1]);
+       alignment[0] = (int *) vrna_alloc((length1+length2+1)*sizeof(int));
+       alignment[1] = (int *) vrna_alloc((length1+length2+1)*sizeof(int));
+
+       pos = length1+length2;
+       i   = length1;
+       j   = length2;
+       while( (i>0)||(j>0) ) {
+          i1 = i_point[i][j];
+          j1 = j_point[i][j];
+          if( ((i-i1)==1)&&((j-j1)==1) )  {  /* substitution    */
+              alignment[0][pos] = i;
+              alignment[1][pos] = j;
+          }
+          if( ((i-i1)==1)&&(j==j1) )      {  /* Deletion in [1] */
+              alignment[0][pos] = i;
+              alignment[1][pos] = 0;
+          }
+          if( (i==i1)&&((j-j1)==1)  )      {  /* Deletion in [0] */
+              alignment[0][pos] = 0;
+              alignment[1][pos] = j;
+          }
+          pos--;
+          i = i1;
+          j = j1;
+       }
+       for(i=pos+1; i<=length1+length2; i++){
+          alignment[0][i-pos] = alignment[0][i];
+          alignment[1][i-pos] = alignment[1][i];
+       }
+       alignment[0][0] = length1+length2-pos;   /* length of alignment */
+
+       for(i=0; i<=length1; i++){
+          free(i_point[i]); free(j_point[i]);
+       }
+       free(i_point); free(j_point);
+       sprint_aligned_swStrings(T1,T2);
+
+    }
+
+    return temp;
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE float StrEditCost(int i, int j, swString *T1, swString *T2)
+{
+    float  c, diff, cd, min, a, b, dist;
+
+    if(i==0) {
+       cd   =  (float) (*EditCost)[0][T2[j].type];
+       diff =  T2[j].weight;
+       dist =  cd*diff;
+    }
+    else
+    if(j==0) {
+       cd   =  (float) (*EditCost)[T1[i].type][0];
+       diff =  T1[i].weight;
+       dist =  cd*diff;
+    }
+    else
+    if( ((T1[i].sign)*(T2[j].sign)) > 0) {
+       c = (float) (*EditCost)[T1[i].type][T2[j].type];
+       diff = (float) fabs((a=T1[i].weight) - (b=T2[j].weight));
+       min = MIN2(a,b);
+       if (min == a) cd = (float) (*EditCost)[0][T2[j].type];
+       else          cd = (float) (*EditCost)[T1[i].type][0];
+       dist = c * min + cd * diff;
+    }
+    else dist = (float) DIST_INF;
+    return dist;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC swString *Make_swString(char *string)
+{
+   int i=0, j=0, k=0;
+   int tp, len, l, length;
+   float w;
+   swString  *S;
+
+   length = strlen(string);
+
+   for(i=0; i<length; i++) {
+      if( (string[i]=='(') || (string[i]==')') ) j++;
+      if(string[i]=='.') j+=2;
+   }
+
+   len = j;
+
+   S= (swString *) vrna_alloc(sizeof(swString)*(len+1));
+   S[0].sign = j; /* number of entries */
+   S[0].weight= 0.0;
+   S[0].type=     0;
+
+   i=0;
+   j=1;
+   while(i<length){
+      switch(string[i]){
+       case '(' :
+          S[j].sign = 1;
+          l=1;
+          k=i;
+          while (l>0) {
+             k++;
+             if(string[k] == '(' ) l++;
+             if(string[k] == ')' ) l--;
+          }
+          DeCode(string,k,&tp,&w);
+          S[j].type   = tp;
+          S[j].weight = w/2.0;
+	  j++;
+          break;
+       case ')' :
+          k=i;
+          S[j].sign = -1;
+          DeCode(string,k,&tp,&w);
+          S[j].type = tp;
+          S[j].weight = w/2.0;
+	  j++;
+          break;
+       case '.' :
+          S[j].sign = 1;
+          S[j].type = 1;
+          S[j].weight = 0.5;
+          j++;
+          S[j].sign = -1;
+          S[j].type =  1;
+          S[j].weight = 0.5;
+	  j++;
+          break;
+      }
+      i++;
+   }
+   return S;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void DeCode(char *string, int k, int *tp, float *w)
+   /* retrieves type and weigth for a node closed  by a bracket at position k */
+{
+   int i,j,l,m;
+   char  label[20], id[20] ;
+   i=k;
+   label[0] = '\0';
+   while(i>=0){
+      i--;
+      if( (string[i]=='(')||(string[i]==')')||(string[i]=='.') ) break;
+      else {
+         label[k-i-1] = string[i]; label[k-i] = '\0';
+      }
+   }
+   l=strlen(label);
+   if (l==0) {           /* Dot-Bracket notation */
+     *w  = 1.0;
+     *tp =   2;
+   }
+   else{
+     for (i=0; i<l; i++) {
+       if (!isalpha(label[l-i-1])) break;
+       id[i] = label[l-i-1];
+      }
+      id[i] = '\0';
+      *tp=decode(id);
+      l=l-i-1;
+      if(l>=0){
+         for(j=0; j<=l; j++)
+            id[j] = label[l-j];
+         label[l+1] ='\0';
+         m=-1;
+         sscanf(label,"%d",&m);
+         *w= (float) m;
+         if(m==-1) {
+            vrna_message_warning("Non-integer weight in DeCode ignored");
+            *w=1.0;
+         }
+      }
+      else
+         *w=1.0;
+   }
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE int decode(char *id)
+{
+    int   n, quit, i;
+    char  label[100], *code;
+
+    n = 0;
+
+    quit = 0;
+    code = coding;
+
+    while (!quit) {
+        for (i = 0; code[i] != sep; i++) {
+            if (code[i] == '\0') {
+                quit = 1;
+                break;
+            }
+            label[i] = code[i];
+        }
+        label[i] = '\0';
+        if (strcmp(id, label) == 0) return (n);
+        code += (i+1);
+        n++;
+    }
+
+    vrna_message_error("Syntax error: node identifier \"%s\" not found "
+                              "in coding string \"%s\"\n"
+                              "Exiting",
+                              id, coding);
+    exit(0);
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void encode( int type, char label[])
+
+{
+    int   i, l;
+
+    l = 0;
+    for (i = 0; i < type; i++) {
+        while (coding[l] != sep && coding[l]) l++;
+        l++;
+    }
+
+    for (i = 0; coding[l+i] != sep; i++) {
+        if (coding[l+i] == '\0') break;
+        label[i] = coding[l+i];
+    }
+    label[i] = '\0';
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void sprint_aligned_swStrings(swString *T1, swString *T2)
+{
+   int i, j, l0, l1, ltmp=0, weights;
+   char label[10], *a0, *a1, tmp0[20], tmp1[20];
+
+   weights = 0;
+   for (i=1; i<=T1[0].sign; i++) weights = (weights||(T1[i].weight!=0.5));
+   for (i=1; i<=T2[0].sign; i++) weights = (weights||(T2[i].weight!=0.5));
+
+   a0 = (char *) vrna_alloc(alignment[0][0]*4+2);
+   a1 = (char *) vrna_alloc(alignment[0][0]*4+2);
+   for(i=1; i<= alignment[0][0]; i++){
+      tmp0[0] = '\0'; l0=0;
+      if(alignment[0][i] > 0) {
+         encode(T1[alignment[0][i]].type, label);
+         if(T1[alignment[0][i]].sign > 0) {
+            tmp0[0] = '(';
+            tmp0[1] = '\0';
+         }
+         strcat(tmp0,label);
+	 if (weights)
+	    sprintf(tmp0+strlen(tmp0), "%d",
+		    (int)(2*T1[alignment[0][i]].weight));
+
+         if(T1[alignment[0][i]].sign < 0) strcat(tmp0, ")");
+	 l0 = strlen(tmp0);
+      }
+      tmp1[0]= '\0'; l1=0;
+      if(alignment[1][i] > 0) {
+         encode(T2[alignment[1][i]].type, label);
+         if(T2[alignment[1][i]].sign > 0) {
+            tmp1[0] = '(';
+            tmp1[1] = '\0';
+         }
+         strcat(tmp1,label);
+	 if (weights)
+	    sprintf(tmp1+strlen(tmp1), "%d",
+		    (int)(2*T2[alignment[1][i]].weight));
+
+	 if(T2[alignment[1][i]].sign < 0) strcat(tmp1, ")");
+         l1 = strlen(tmp1);
+      }
+      ltmp = MAX2(l0,l1);
+      for (j=l0; j<ltmp; j++) tmp0[j] = '_';
+      for (j=l1; j<ltmp; j++) tmp1[j] = '_';
+      tmp0[ltmp] = '\0'; tmp1[ltmp] = '\0';
+
+      strcat(a0,tmp0); strcat(a1,tmp1);
+      ltmp = strlen(a0);
+   }
+   if (aligned_line[0]!= NULL) { free(aligned_line[0]); aligned_line[0]= NULL;}
+   if (aligned_line[1]!= NULL) { free(aligned_line[1]); aligned_line[1]= NULL;}
+   aligned_line[0] = strdup(a0);
+   free(a0);
+   aligned_line[1] = strdup(a1);
+   free(a1);
+}
+
+/*---------------------------------------------------------------------------*/
+
+
+PUBLIC void print_swString(swString *x)
+{
+   int i;
+   for (i=0; i<=x[0].sign; i++)
+      printf("(%d,%d,%f\n) ", x[i].type, x[i].sign, x[i].weight );
+   printf("\n");
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC void print_alignment_list(void)
+{
+   int i;
+   printf("\n");
+   for (i=1; i<= alignment[0][0]; i++)
+      printf("%3d ",alignment[0][i]);
+      printf("\n");
+   for (i=1; i<= alignment[0][0]; i++)
+      printf("%3d ",alignment[1][i]);
+   printf("\n");
+}
diff --git a/C/ViennaRNA/stringdist.h b/C/ViennaRNA/stringdist.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/stringdist.h
@@ -0,0 +1,30 @@
+#ifndef VIENNA_RNA_PACKAGE_STRING_DIST_H
+#define VIENNA_RNA_PACKAGE_STRING_DIST_H
+
+/**
+ *  \file stringdist.h
+ *  \brief Functions for String Alignment
+ */
+
+#include <ViennaRNA/dist_vars.h>
+
+
+/**
+ *  \brief Convert a structure into a format suitable for string_edit_distance().
+ * 
+ *  \param string
+ *  \return
+ */
+swString *Make_swString(char *string);
+
+/**
+ *  \brief Calculate the string edit distance of T1 and T2.
+ * 
+ *  \param  T1
+ *  \param  T2
+ *  \return
+ */
+float     string_edit_distance( swString *T1,
+                                swString *T2);
+
+#endif
diff --git a/C/ViennaRNA/structure_utils.c b/C/ViennaRNA/structure_utils.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/structure_utils.c
@@ -0,0 +1,1253 @@
+/*
+    structure_utils.c
+
+    Various functions to convert, parse, encode secondary structures
+
+    c  Ivo L Hofacker, Walter Fontana, Ronny Lorenz
+                Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/structure_utils.h"
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE vrna_plist_t *
+wrap_get_plist( vrna_mx_pf_t *matrices,
+                int length,
+                int *index,
+                short *S,
+                vrna_exp_param_t *pf_params,
+                double cut_off);
+
+PRIVATE vrna_plist_t *
+wrap_plist( vrna_fold_compound_t *vc,
+            double cut_off);
+
+PRIVATE void assign_elements_pair(short *pt, int i, int j, char *elements);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+PUBLIC char *
+vrna_db_pack(const char *struc){
+
+  /* 5:1 compression using base 3 encoding */
+  int i,j,l,pi;
+  unsigned char *packed;
+
+  l = (int) strlen(struc);
+  packed = (unsigned char *) vrna_alloc(((l+4)/5+1)*sizeof(unsigned char));
+
+  j=i=pi=0;
+  while (i<l) {
+    register int p;
+    for (p=pi=0; pi<5; pi++) {
+      p *= 3;
+      switch (struc[i]) {
+      case '(':
+      case '\0':
+        break;
+      case '.':
+        p++;
+        break;
+      case ')':
+        p += 2;
+        break;
+      default: vrna_message_error("pack_structure: illegal character in structure");
+      }
+      if (i<l) i++;
+    }
+    packed[j++] = (unsigned char) (p+1); /* never use 0, so we can use
+                                            strcmp()  etc. */
+  }
+  packed[j] = '\0';      /* for str*() functions */
+  return (char *) packed;
+}
+
+PUBLIC char *
+vrna_db_unpack(const char *packed){
+
+  /* 5:1 compression using base 3 encoding */
+  int i,j,l;
+  char *struc;
+  unsigned const char *pp;
+  char code[3] = {'(', '.', ')'};
+
+  l = (int) strlen(packed);
+  pp = (const unsigned char *) packed;
+  struc = (char *) vrna_alloc((l*5+1)*sizeof(char));   /* up to 4 byte extra */
+
+  for (i=j=0; i<l; i++) {
+    register int p, c, k;
+
+    p = (int) pp[i] - 1;
+    for (k=4; k>=0; k--) {
+      c = p % 3;
+      p /= 3;
+      struc[j+k] = code[c];
+    }
+    j += 5;
+  }
+  struc[j--] = '\0';
+  while (struc[j] == '(') /* strip trailing ( */
+    struc[j--] = '\0';
+
+  return struc;
+}
+
+PUBLIC short *
+vrna_ptable(const char *structure){
+
+    /* returns array representation of structure.
+       table[i] is 0 if unpaired or j if (i.j) pair.  */
+   short i,j,hx;
+   short length;
+   short *stack;
+   short *table;
+
+   length = (short) strlen(structure);
+   stack = (short *) vrna_alloc(sizeof(short)*(length+1));
+   table = (short *) vrna_alloc(sizeof(short)*(length+2));
+   table[0] = length;
+
+   for (hx=0, i=1; i<=length; i++) {
+      switch (structure[i-1]) {
+       case '(':
+         stack[hx++]=i;
+         break;
+       case ')':
+         j = stack[--hx];
+         if (hx<0) {
+            vrna_message_error("%s\nunbalanced brackets in make_pair_table", structure);
+         }
+         table[i]=j;
+         table[j]=i;
+         break;
+       default:   /* unpaired base, usually '.' */
+         table[i]= 0;
+         break;
+      }
+   }
+   if (hx!=0) {
+      vrna_message_error("%s\nunbalanced brackets in make_pair_table", structure);
+   }
+   free(stack);
+   return(table);
+}
+
+PUBLIC short *
+vrna_pt_pk_get(const char *structure){
+
+   short i,j,hx, hx2;
+   short length;
+   short *stack;
+   short *stack2;
+   short *table;
+
+   length = (short) strlen(structure);
+   stack  = (short *) vrna_alloc(sizeof(short)*(length+1));
+   stack2 = (short *) vrna_alloc(sizeof(short)*(length+1));
+   table  = (short *) vrna_alloc(sizeof(short)*(length+2));
+   table[0] = length;
+
+   for (hx=0, hx2=0, i=1; i<=length; i++) {
+      switch (structure[i-1]) {
+       case '(':
+         stack[hx++]=i;
+         break;
+       case ')':
+         j = stack[--hx];
+         if (hx<0) {
+            vrna_message_error("%s\nunbalanced '()' brackets in make_pair_table_pk", structure);
+         }
+         table[i]=j;
+         table[j]=i;
+         break;
+       case '[':
+         stack2[hx2++]=i;
+         break;
+       case ']':
+         j = stack2[--hx2];
+         if (hx2<0) {
+            vrna_message_error("%s\nunbalanced '[]' brackets in make_pair_table_pk", structure);
+         }
+         table[i]=j;
+         table[j]=i;
+         break;
+       default:   /* unpaired base, usually '.' */
+         table[i]= 0;
+         break;
+      }
+   }
+   if (hx!=0) {
+      vrna_message_error("%s\nunbalanced '()' brackets in make_pair_table_pk", structure);
+   } else if (hx2!=0) {
+      vrna_message_error("%s\nunbalanced '[]' brackets in make_pair_table_pk", structure);
+   }
+   free(stack);
+   free(stack2);
+   return(table);
+}
+
+
+PUBLIC short *
+vrna_pt_snoop_get(const char *structure){
+
+    /* returns array representation of structure.
+       table[i] is 0 if unpaired or j if (i.j) pair.  */
+   short i,j,hx;
+   short length;
+   short *stack;
+   short *table;
+
+   length = (short) strlen(structure);
+   stack = (short *) vrna_alloc(sizeof(short)*(length+1));
+   table = (short *) vrna_alloc(sizeof(short)*(length+2));
+   table[0] = length;
+
+   for (hx=0, i=1; i<=length; i++) {
+     switch (structure[i-1]) {
+     case '<':
+       stack[hx++]=i;
+       break;
+     case '>':
+       j = stack[--hx];
+       if (hx<0) {
+         vrna_message_error("%s\nunbalanced brackets in make_pair_table", structure);
+       }
+       table[i]=j;
+       table[j]=i;
+       break;
+     default:   /* unpaired base, usually '.' */
+       table[i]= table[i];
+       break;
+     }
+   }
+   if (hx!=0) {
+     vrna_message_error("%s\nunbalanced brackets in make_pair_table", structure);
+   }
+   free(stack);
+   return table ;
+}
+
+
+
+PUBLIC short *
+vrna_pt_ali_get(const char *structure){
+
+    /* returns array representation of structure.
+       table[i] is 0 if unpaired or j if (i.j) pair.  */
+   short i,j,hx;
+   short length;
+   short *stack;
+   short *table;
+
+   length = (short) strlen(structure);
+   stack = (short *) vrna_alloc(sizeof(short)*(length+1));
+   table = (short *) vrna_alloc(sizeof(short)*(length+2));
+   table[0] = length;
+
+   for (hx=0, i=1; i<=length; i++) {
+      switch (structure[i-1]) {
+       case '(':
+         stack[hx++]=i;
+         break;
+       case ')':
+         j = stack[--hx];
+         if (hx<0) {
+            vrna_message_error("%s\nunbalanced brackets in make_pair_table", structure);
+         }
+         table[i]=j;
+         table[j]=i;
+         break;
+       default:   /* unpaired base, usually '.' */
+         table[i]= 0;
+         break;
+      }
+   }
+   for (hx=0, i=1; i<=length; i++) {
+      switch (structure[i-1]) {
+       case '<':
+         stack[hx++]=i;
+         break;
+       case '>':
+         j = stack[--hx];
+         if (hx<0) {
+            vrna_message_error("%s\nunbalanced brackets in make_pair_table", structure);
+         }
+         table[i]=j;
+         table[j]=i;
+         break;
+       default:   /* unpaired base, usually '.' */
+         table[i]= table[i];
+         break;
+      }
+   }
+   for (hx=0, i=1; i<=length; i++) {
+     switch (structure[i-1]) {
+     case '[':
+       stack[hx++]=i;
+       break;
+     case ']':
+       j = stack[--hx];
+       if (hx<0) {
+         vrna_message_error("%s\nunbalanced brackets in make_pair_table", structure);
+       }
+       table[i]=j;
+       table[j]=i;
+       break;
+     default:   /* unpaired base, usually '.' */
+       break;
+     }
+   }
+   if (hx!=0) {
+      vrna_message_error("%s\nunbalanced brackets in make_pair_table", structure);
+   }
+   free(stack);
+   return(table);
+}
+
+PUBLIC short *
+vrna_ptable_copy(const short *pt){
+  short *table = (short *)vrna_alloc(sizeof(short) * (pt[0]+2));
+  memcpy(table, pt, sizeof(short)*(pt[0]+2));
+  return table;
+}
+
+
+PUBLIC int *
+vrna_loopidx_from_ptable(const short *pt){
+
+  /* number each position by which loop it belongs to (positions start
+     at 1) */
+  int i,hx,l,nl;
+  int length;
+  int *stack = NULL;
+  int *loop = NULL;
+
+  length = pt[0];
+  stack  = (int *) vrna_alloc(sizeof(int)*(length+1));
+  loop   = (int *) vrna_alloc(sizeof(int)*(length+2));
+  hx=l=nl=0;
+
+  for (i=1; i<=length; i++) {
+    if ((pt[i] != 0) && (i < pt[i])) { /* ( */
+      nl++; l=nl;
+      stack[hx++]=i;
+    }
+    loop[i]=l;
+
+    if ((pt[i] != 0) && (i > pt[i])) { /* ) */
+      --hx;
+      if (hx>0)
+        l = loop[stack[hx-1]];  /* index of enclosing loop   */
+      else l=0;                 /* external loop has index 0 */
+      if (hx<0) {
+        vrna_message_error("unbalanced brackets in make_pair_table");
+      }
+    }
+  }
+  loop[0] = nl;
+  free(stack);
+  return (loop);
+}
+
+PUBLIC char *
+vrna_db_from_ptable(short *pt){
+
+  int i;
+  char *dotbracket = NULL;
+  if(pt){
+    dotbracket = (char *)vrna_alloc((pt[0]+1)*sizeof(char));
+    memset(dotbracket, '.', pt[0]);
+
+    for(i=1; i<=pt[0]; i++){
+      if(pt[i] > i){
+        dotbracket[i-1] = '(';
+        dotbracket[pt[i]-1] = ')';
+      }
+    }
+    dotbracket[i-1] = '\0';
+  }
+  return dotbracket;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC int
+vrna_bp_distance(const char *str1, const char *str2){
+
+  /* dist = {number of base pairs in one structure but not in the other} */
+  /* same as edit distance with pair_open pair_close as move set */
+   int dist;
+   short i,l;
+   short *t1, *t2;
+
+   dist = 0;
+   t1 = vrna_ptable(str1);
+   t2 = vrna_ptable(str2);
+
+   l = (t1[0]<t2[0])?t1[0]:t2[0];    /* minimum of the two lengths */
+
+   for (i=1; i<=l; i++)
+     if (t1[i]!=t2[i]) {
+       if (t1[i]>i) dist++;
+       if (t2[i]>i) dist++;
+     }
+   free(t1); free(t2);
+   return dist;
+}
+
+/* get a matrix containing the number of basepairs of a reference structure for each interval [i,j] with i<j
+*  access it via iindx!!!
+*/
+PUBLIC unsigned int *
+vrna_refBPcnt_matrix( const short *reference_pt,
+                      unsigned int turn){
+
+  unsigned int i,j,k,ij,length;
+  int *iindx;
+  unsigned int *array;
+  unsigned int size;
+  length = (unsigned int)reference_pt[0];
+  size  = ((length+1)*(length+2))/2;
+  iindx = vrna_idx_row_wise(length);
+  array = (unsigned int *) vrna_alloc(sizeof(unsigned int)*size);    /* matrix containing number of basepairs of reference structure1 in interval [i,j] */;
+  for (k=0; k<=turn; k++)
+    for (i=1; i<=length-k; i++) {
+      j=i+k;
+      ij = iindx[i]-j;
+      array[ij] = 0;
+    }
+
+  for (i = length-turn-1; i >= 1; i--)
+    for (j = i+turn+1; j <= length; j++){
+      int bps;
+      ij = iindx[i]-j;
+      bps = array[ij+1];
+      if((i<=(unsigned int)reference_pt[j]) && ((unsigned int)reference_pt[j] < j))
+        bps++;
+      array[ij] = bps;
+    }
+  free(iindx);
+  return array;
+}
+
+
+PUBLIC unsigned int *
+vrna_refBPdist_matrix(const short *pt1,
+                      const short *pt2,
+                      unsigned int turn){
+
+  unsigned int *array;
+  unsigned int n, size, i, j, ij, d;
+  n = (unsigned int)pt1[0];
+  size = ((n+1)*(n+2))/2;
+  array = (unsigned int *)vrna_alloc(sizeof(unsigned int) * size);
+  int *iindx = vrna_idx_row_wise(n);
+  for(i = n - turn - 1; i>=1; i--){
+    d = 0;
+    for(j = i+turn+1; j <= n; j++){
+      ij = iindx[i]-j;
+      d = array[ij+1];
+      if(pt1[j] != pt2[j]){
+        if(i <= (unsigned int)pt1[j] && (unsigned int)pt1[j] < j){
+          /* we got an additional base pair in reference structure 1 */
+          d++;
+        }
+        if(i <= (unsigned int)pt2[j] && (unsigned int)pt2[j] < j){
+          /* we got another base pair in reference structure 2 */
+          d++;
+        }
+      }
+      array[ij] = d;
+
+    }
+  }
+  free(iindx);
+  return array;
+}
+
+PUBLIC char
+vrna_bpp_symbol(const float *x){
+
+/*  if( ((x[1]-x[2])*(x[1]-x[2]))<0.1&&x[0]<=0.677) return '|'; */
+  if( x[0] > 0.667 )  return '.';
+  if( x[1] > 0.667 )  return '(';
+  if( x[2] > 0.667 )  return ')';
+  if( (x[1]+x[2]) > x[0] ) {
+    if( (x[1]/(x[1]+x[2])) > 0.667) return '{';
+    if( (x[2]/(x[1]+x[2])) > 0.667) return '}';
+    else return '|';
+  }
+  if( x[0] > (x[1]+x[2]) ) return ',';
+  return ':';
+}
+
+PUBLIC char *
+vrna_db_from_probs(const FLT_OR_DBL *p,
+                    unsigned int length){
+
+  int    i, j, *index;
+  float  P[3];   /* P[][0] unpaired, P[][1] upstream p, P[][2] downstream p */
+  char  *s;
+
+  index = vrna_idx_row_wise(length);
+  s     = (char *)vrna_alloc(sizeof(char) * (length + 1));
+
+  for( j=1; j<=length; j++ ) {
+    P[0] = 1.0;
+    P[1] = P[2] = 0.0;
+    for( i=1; i<j; i++) {
+      P[2] += (float)p[index[i]-j];    /* j is paired downstream */
+      P[0] -= (float)p[index[i]-j];    /* j is unpaired */
+    }
+    for( i=j+1; i<=length; i++ ) {
+      P[1] += (float)p[index[j]-i];    /* j is paired upstream */
+      P[0] -= (float)p[index[j]-i];    /* j is unpaired */
+    }
+    s[j-1] = vrna_bpp_symbol(P);
+  }
+  s[length] = '\0';
+  free(index);
+
+  return s;
+}
+
+PUBLIC void
+vrna_letter_structure(char *structure,
+                      vrna_bp_stack_t *bp,
+                      unsigned int length){
+
+  int   n, k, x, y;
+  char  alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+  memset(structure, '.', length);
+  structure[length] = '\0';
+
+  for (n = 0, k = 1; k <= bp[0].i; k++) {
+    y = bp[k].j;
+    x = bp[k].i;
+    if (x-1 > 0 && y+1 <= length) {
+      if (structure[x-2] != ' ' && structure[y] == structure[x-2]) {
+        structure[x-1] = structure[x-2];
+        structure[y-1] = structure[x-1];
+        continue;
+      }
+    }
+    if (structure[x] != ' ' && structure[y-2] == structure[x]) {
+      structure[x-1] = structure[x];
+      structure[y-1] = structure[x-1];
+      continue;
+    }
+    n++;
+    structure[x-1] = alpha[n-1];
+    structure[y-1] = alpha[n-1];
+  }
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC char *
+vrna_db_from_bp_stack(vrna_bp_stack_t *bp,
+                      unsigned int length){
+
+  int k, i, j, temp;
+  char *structure;
+
+  structure = vrna_alloc(sizeof(char) * (length + 1));
+
+  if(length > 0)
+    memset(structure, '.', length);
+
+  structure[length] = '\0';
+
+  for (k = 1; k <= bp[0].i; k++) {
+    i=bp[k].i;
+    j=bp[k].j;
+    if (i>length) i-=length;
+    if (j>length) j-=length;
+    if (i>j) {
+      temp=i; i=j; j=temp;
+    }
+    if(i == j){ /* Gquad bonds are marked as bp[i].i == bp[i].j */
+      structure[i-1] = '+';
+    } else { /* the following ones are regular base pairs */
+      structure[i-1] = '(';
+      structure[j-1] = ')';
+    }
+  }
+  return structure;
+}
+
+PUBLIC vrna_plist_t *
+vrna_plist( const char *struc,
+            float pr){
+
+  /* convert bracket string to plist */
+  short *pt;
+  int i, k = 0, size, n;
+  vrna_plist_t *gpl, *ptr, *pl;
+
+  size  = strlen(struc);
+  n     = 2;
+
+  pt  = vrna_ptable(struc);
+  pl = (vrna_plist_t *)vrna_alloc(n*size*sizeof(vrna_plist_t));
+  for(i = 1; i < size; i++){
+    if(pt[i]>i){
+      (pl)[k].i      = i;
+      (pl)[k].j      = pt[i];
+      (pl)[k].p      = pr;
+      (pl)[k++].type = 0;
+    }
+  }
+
+  gpl = get_plist_gquad_from_db(struc, pr);
+  for(ptr = gpl; ptr->i != 0; ptr++){
+    if (k == n * size - 1){
+      n *= 2;
+      pl = (vrna_plist_t *)vrna_realloc(pl, n * size * sizeof(vrna_plist_t));
+    }
+    (pl)[k].i      = ptr->i;
+    (pl)[k].j      = ptr->j;
+    (pl)[k].p       = ptr->p;
+    (pl)[k++].type = ptr->type;
+  }
+  free(gpl);
+
+  (pl)[k].i      = 0;
+  (pl)[k].j      = 0;
+  (pl)[k].p      = 0.;
+  (pl)[k++].type = 0.;
+  free(pt);
+  pl = (vrna_plist_t *)vrna_realloc(pl, k * sizeof(vrna_plist_t));
+
+  return pl;
+}
+
+PUBLIC vrna_plist_t *
+vrna_plist_from_probs(vrna_fold_compound_t *vc,
+                    double cut_off){
+
+  if(!vc){
+    vrna_message_error("vrna_pl_get_from_pr: run vrna_pf_fold first!");
+  } else if( !vc->exp_matrices->probs){
+    vrna_message_error("vrna_pl_get_from_pr: probs==NULL!");
+  }
+
+  return wrap_plist(vc, cut_off);
+}
+
+PUBLIC  char *
+vrna_db_from_plist(vrna_plist_t *pairs,
+              unsigned int n){
+
+  vrna_plist_t *ptr;
+  char  *structure = NULL;
+  int   i;
+
+  if(n > 0){
+    structure = (char *)vrna_alloc(sizeof(char) * (n+1));
+    memset(structure, '.', n);
+    structure[n] = '\0';
+
+    for(ptr = pairs; (*ptr).i; ptr++){
+      if(((*ptr).i < n) && ((*ptr).j <= n)){
+        structure[(*ptr).i - 1] = '(';
+        structure[(*ptr).j - 1] = ')';
+      }
+    }
+  }
+  return structure;
+}
+
+
+PUBLIC int
+vrna_plist_append(vrna_plist_t        **target,
+                  const vrna_plist_t  *list){
+
+  int                 size1, size2;
+  const vrna_plist_t  *ptr;
+
+  if((target) && (list)){
+    size1 = size2 = 0;
+
+    if(*target)
+      for(ptr = *target; ptr->i; size1++, ptr++);
+
+    for(ptr = list; ptr->i; size2++, ptr++);
+
+    *target = (vrna_plist_t *)vrna_realloc(*target, sizeof(vrna_plist_t) * (size1 + size2 + 1));
+
+    if(*target){
+      memcpy(*target + size1, list, sizeof(vrna_plist_t) * size2);
+      (*target)[size1 + size2].i = (*target)[size1 + size2].j = 0;
+      return 1;
+    }
+  }
+
+  return 0;
+}
+
+
+PRIVATE vrna_plist_t *
+wrap_get_plist( vrna_mx_pf_t *matrices,
+                int length,
+                int *index,
+                short *S,
+                vrna_exp_param_t *pf_params,
+                double cut_off){
+
+  int i, j, k, n, count, gquad;
+  FLT_OR_DBL  *probs, *G, *scale;
+  vrna_plist_t         *pl;
+
+  probs     = matrices->probs;
+  G         = matrices->G;
+  scale     = matrices->scale;
+  gquad     = pf_params->model_details.gquad;
+
+  count = 0;
+  n     = 2;
+
+  /* first guess of the size needed for pl */
+  pl = (vrna_plist_t *)vrna_alloc(n*length*sizeof(vrna_plist_t));
+
+  for (i=1; i<length; i++) {
+    for (j=i+1; j<=length; j++) {
+      /* skip all entries below the cutoff */
+      if (probs[index[i]-j] < (FLT_OR_DBL)cut_off) continue;
+
+      /* do we need to allocate more memory? */
+      if (count == n * length - 1){
+        n *= 2;
+        pl = (vrna_plist_t *)vrna_realloc(pl, n * length * sizeof(vrna_plist_t));
+      }
+
+      /* check for presence of gquadruplex */
+      if(gquad && (S[i] == 3) && (S[j] == 3)){
+        /* add probability of a gquadruplex at position (i,j)
+           for dot_plot
+        */
+        (pl)[count].i      = i;
+        (pl)[count].j      = j;
+        (pl)[count].p      = (float)probs[index[i] - j];
+        (pl)[count++].type = 1;
+        /* now add the probabilies of it's actual pairing patterns */
+        vrna_plist_t *inner, *ptr;
+        inner = get_plist_gquad_from_pr(S, i, j, G, probs, scale, pf_params);
+        for(ptr=inner; ptr->i != 0; ptr++){
+            if (count == n * length - 1){
+              n *= 2;
+              pl = (vrna_plist_t *)vrna_realloc(pl, n * length * sizeof(vrna_plist_t));
+            }
+            /* check if we've already seen this pair */
+            for(k = 0; k < count; k++)
+              if(((pl)[k].i == ptr->i) && ((pl)[k].j == ptr->j))
+                break;
+            (pl)[k].i      = ptr->i;
+            (pl)[k].j      = ptr->j;
+            (pl)[k].type = 0;
+            if(k == count){
+              (pl)[k].p  = ptr->p;
+              count++;
+            } else
+              (pl)[k].p  += ptr->p;
+        }
+      } else {
+          (pl)[count].i      = i;
+          (pl)[count].j      = j;
+          (pl)[count].p      = (float)probs[index[i] - j];
+          (pl)[count++].type = 0;
+      }
+    }
+  }
+  /* mark the end of pl */
+  (pl)[count].i    = 0;
+  (pl)[count].j    = 0;
+  (pl)[count].type = 0;
+  (pl)[count++].p  = 0.;
+  /* shrink memory to actual size needed */
+  pl = (vrna_plist_t *)vrna_realloc(pl, count * sizeof(vrna_plist_t));
+
+  return pl;
+}
+
+PRIVATE vrna_plist_t *
+wrap_plist( vrna_fold_compound_t *vc,
+            double cut_off){
+
+  short             *S;
+  int               i, j, k, n, m, count, gquad, length, *index;
+  FLT_OR_DBL        *probs, *G, *scale;
+  vrna_plist_t      *pl;
+  vrna_mx_pf_t      *matrices;
+  vrna_exp_param_t  *pf_params;
+
+  S         = vc->sequence_encoding2;
+  index     = vc->iindx;
+  length    = vc->length;
+  pf_params = vc->exp_params;
+  matrices  = vc->exp_matrices;
+  probs     = matrices->probs;
+  G         = matrices->G;
+  scale     = matrices->scale;
+  gquad     = pf_params->model_details.gquad;
+
+  count = 0;
+  n     = 2;
+
+  /* first guess of the size needed for pl */
+  pl = (vrna_plist_t *)vrna_alloc(n*length*sizeof(vrna_plist_t));
+
+  for (i=1; i<length; i++) {
+    for (j=i+1; j<=length; j++) {
+
+      /* skip all entries below the cutoff */
+      if(probs[index[i]-j] < (FLT_OR_DBL)cut_off)
+        continue;
+
+      /* do we need to allocate more memory? */
+      if (count == n * length - 1){
+        n *= 2;
+        pl = (vrna_plist_t *)vrna_realloc(pl, n * length * sizeof(vrna_plist_t));
+      }
+
+      /* check for presence of gquadruplex */
+      if(gquad && (S[i] == 3) && (S[j] == 3)){
+        /* add probability of a gquadruplex at position (i,j)
+           for dot_plot
+        */
+        (pl)[count].i      = i;
+        (pl)[count].j      = j;
+        (pl)[count].p      = (float)probs[index[i] - j];
+        (pl)[count++].type = VRNA_PLIST_TYPE_GQUAD;
+        /* now add the probabilies of it's actual pairing patterns */
+        vrna_plist_t *inner, *ptr;
+        inner = get_plist_gquad_from_pr(S, i, j, G, probs, scale, pf_params);
+        for(ptr=inner; ptr->i != 0; ptr++){
+            if (count == n * length - 1){
+              n *= 2;
+              pl = (vrna_plist_t *)vrna_realloc(pl, n * length * sizeof(vrna_plist_t));
+            }
+            /* check if we've already seen this pair */
+            for(k = 0; k < count; k++)
+              if(((pl)[k].i == ptr->i) && ((pl)[k].j == ptr->j))
+                break;
+            (pl)[k].i      = ptr->i;
+            (pl)[k].j      = ptr->j;
+            (pl)[k].type = VRNA_PLIST_TYPE_BASEPAIR;
+            if(k == count){
+              (pl)[k].p  = ptr->p;
+              count++;
+            } else
+              (pl)[k].p  += ptr->p;
+        }
+      } else {
+          (pl)[count].i      = i;
+          (pl)[count].j      = j;
+          (pl)[count].p      = (float)probs[index[i] - j];
+          (pl)[count++].type = VRNA_PLIST_TYPE_BASEPAIR;
+      }
+    }
+  }
+
+  /* check unstructured domains */
+  if(vc->domains_up){
+    vrna_ud_t *domains_up;
+    domains_up = vc->domains_up;
+
+    if(domains_up->probs_get)
+      for(i = 1; i <= length; i++)
+        for(m = 0; m < domains_up->motif_count; m++){
+          FLT_OR_DBL pp;
+          j = i + domains_up->motif_size[m] - 1;
+          pp = 0.;
+          pp += domains_up->probs_get(vc, i, j, VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP, m, domains_up->data);
+          pp += domains_up->probs_get(vc, i, j, VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP, m, domains_up->data);
+          pp += domains_up->probs_get(vc, i, j, VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP, m, domains_up->data);
+          pp += domains_up->probs_get(vc, i, j, VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP, m, domains_up->data);
+          if(pp >= (FLT_OR_DBL)cut_off){
+
+            /* do we need to allocate more memory? */
+            if (count == n * length - 1){
+              n *= 2;
+              pl = (vrna_plist_t *)vrna_realloc(pl, n * length * sizeof(vrna_plist_t));
+            }
+
+            (pl)[count].i      = i;
+            (pl)[count].j      = j;
+            (pl)[count].p      = (float)pp;
+            (pl)[count++].type = VRNA_PLIST_TYPE_UD_MOTIF;
+          }
+        }
+  }
+
+  /* mark the end of pl */
+  (pl)[count].i    = 0;
+  (pl)[count].j    = 0;
+  (pl)[count].type = 0;
+  (pl)[count++].p  = 0.;
+  /* shrink memory to actual size needed */
+  pl = (vrna_plist_t *)vrna_realloc(pl, count * sizeof(vrna_plist_t));
+
+  return pl;
+}
+
+PUBLIC vrna_hx_t *
+vrna_hx_from_ptable(short *pt){
+
+  int i, k, n, l, s, *stack;
+  vrna_hx_t *list;
+
+  n = pt[0];
+  l = 0;
+  s = 1;
+  list  = (vrna_hx_t *)vrna_alloc(sizeof(vrna_hx_t) * n/2);
+  stack = (int *)vrna_alloc(sizeof(int) * n/2);
+
+  stack[s] = 1;
+
+  do{
+    for(i = stack[s--]; i <= n; i++){
+      if(pt[i] > (short)i){  /* found a base pair */
+        k = i;
+        /* go through stack */
+        for(;pt[k+1] == pt[k] - 1; k++);
+        list[l].start  = i;
+        list[l].end    = pt[i];
+        list[l].length = k - i + 1;
+        list[l].up5 = list[l].up3 = 0;
+        l++;
+        stack[++s] = pt[i] + 1;
+        stack[++s] = k + 1;
+        break;
+      } else if(pt[i]) { /* end of region */
+        break;
+      }
+    }
+  } while (s > 0);
+
+  list = vrna_realloc(list, (l+1)*sizeof(vrna_hx_t));
+  list[l].start = list[l].end = list[l].length = list[l].up5 = list[l].up3 = 0;
+
+  free(stack);
+  return list;
+}
+
+PUBLIC vrna_hx_t *
+vrna_hx_merge(const vrna_hx_t *list, int maxdist){
+  int merged, i, j, s, neighbors, n;
+  vrna_hx_t *merged_list;
+
+  for(n=0; list[n].length > 0; n++); /* check size of list */
+
+  merged_list = (vrna_hx_t *)vrna_alloc(sizeof(vrna_hx_t) * (n+1));
+  memcpy(merged_list, list, sizeof(vrna_hx_t) * (n+1));
+
+  s = n+1;
+
+  do{
+    merged = 0;
+    for(i = 1; merged_list[i].length > 0; i++){
+      /*
+        GOAL: merge two consecutive helices i and i-1, if i-1
+        subsumes i, and not more than i
+      */
+
+      /* 1st, check for neighbors */
+      neighbors = 0;
+      for(j = i + 1; merged_list[j].length > 0; j++){
+        if(merged_list[j].start > merged_list[i-1].end) break;
+        if(merged_list[j].start < merged_list[i].end) continue;
+        neighbors = 1;
+      }
+      if(neighbors) continue;
+
+      /* check if we may merge i with i-1 */
+      if(merged_list[i].end < merged_list[i-1].end){
+        merged_list[i-1].up5 += merged_list[i].start
+                                - merged_list[i-1].start
+                                - merged_list[i-1].length
+                                - merged_list[i-1].up5
+                                + merged_list[i].up5;
+        merged_list[i-1].up3 += merged_list[i-1].end
+                                - merged_list[i-1].length
+                                - merged_list[i-1].up3
+                                - merged_list[i].end
+                                + merged_list[i].up3;
+        merged_list[i-1].length += merged_list[i].length;
+        /* splice out helix i */
+        memmove(merged_list+i, merged_list+i+1, sizeof(vrna_hx_t)*(n-i));
+        s--;
+        merged = 1;
+        break;
+      }
+    }
+  } while(merged);
+
+  merged_list = vrna_realloc(merged_list, sizeof(vrna_hx_t) * s);
+
+  return merged_list;
+}
+
+
+PUBLIC char *
+vrna_db_to_element_string(const char *structure){
+
+  char    *elements;
+  int     n, i;
+  short   *pt;
+
+  elements = NULL;
+
+  if(structure){
+    n         = (int)strlen(structure);
+    pt        = vrna_ptable(structure);
+    elements  = (char *)vrna_alloc(sizeof(char) * (n + 1));
+
+    for(i = 1; i <= n; i++){
+      if(!pt[i])  /* mark nucleotides in exterior loop */
+        elements[i-1] = 'e';
+      else {
+        assign_elements_pair(pt, i, pt[i], elements);
+        i = pt[i];
+      }
+    }
+
+    elements[n] = '\0';
+    free(pt);
+  }
+
+  return elements;
+}
+
+PRIVATE void
+assign_elements_pair(short *pt, int i, int j, char *elements){
+
+  int p, k, num_pairs;
+
+  num_pairs = 0;
+  /* first, determine the number of pairs (i,j) is enclosing */
+  for(k = i + 1; k < j; k++){
+    if(k < pt[k]){
+      num_pairs++;
+      k = pt[k];
+    }
+  }
+
+  switch(num_pairs){
+    case 0:   /* hairpin loop */
+              elements[i - 1] = elements[j - 1] = 'H';
+              for(k = i + 1; k < j; k++)
+                elements[k-1] = 'h';
+              break;
+
+    case 1:   /* interior loop */
+              elements[i - 1] = elements[j - 1] = 'I';
+              for(k = i + 1; k < j; k++){
+                if(!pt[k])
+                  elements[k-1] = 'i';
+                else {
+                  p = k;
+                  k = pt[k];
+                }
+              }
+              assign_elements_pair(pt, p, pt[p], elements);
+              break;
+
+    default:  /* multibranch loop */
+              elements[i - 1] = elements[j - 1] = 'M';
+              for(k = i + 1; k < j; k++){
+                if(!pt[k])
+                  elements[k-1] = 'm';
+                else {
+                  assign_elements_pair(pt, k, pt[k], elements);
+                  k = pt[k];
+                }
+              }
+              break;
+  }
+}
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+
+PUBLIC char *
+pack_structure(const char *struc){
+
+  return vrna_db_pack(struc);
+}
+
+PUBLIC char *
+unpack_structure(const char *packed){
+
+  return vrna_db_unpack(packed);
+}
+
+PUBLIC void
+parenthesis_structure(char *structure,
+                      vrna_bp_stack_t *bp,
+                      int length){
+
+  char *s = vrna_db_from_bp_stack(bp, length);
+  strncpy(structure, s, length + 1);
+  free(s);
+}
+
+PUBLIC void
+letter_structure( char *structure,
+                  vrna_bp_stack_t *bp,
+                  int length){
+
+  vrna_letter_structure(structure, bp, length);
+}
+
+PUBLIC void
+parenthesis_zuker(char *structure,
+                  vrna_bp_stack_t *bp,
+                  int length){
+
+  char *s = vrna_db_from_bp_stack(bp, length);
+  strncpy(structure, s, length + 1);
+  free(s);
+}
+
+PUBLIC void
+assign_plist_from_pr( vrna_plist_t **pl,
+                      FLT_OR_DBL *probs,
+                      int length,
+                      double cut_off){
+
+  int              *index;
+  vrna_mx_pf_t     *matrices;
+  vrna_md_t        md;
+  vrna_exp_param_t *pf_params;
+
+  index     = vrna_idx_row_wise(length);
+  matrices  = (vrna_mx_pf_t *)vrna_alloc(sizeof(vrna_mx_pf_t));
+
+  set_model_details(&md);
+  md.gquad        = 0;
+  pf_params       = vrna_exp_params(&md);
+  matrices->probs = probs;
+
+  *pl = wrap_get_plist( matrices,
+                        length,
+                        index,
+                        NULL,
+                        pf_params,
+                        cut_off);
+
+  free(index);
+  free(pf_params);
+  free(matrices);
+}
+
+PUBLIC void
+assign_plist_from_db( vrna_plist_t **pl,
+                      const char *struc,
+                      float pr){
+
+  *pl = vrna_plist(struc, pr);
+}
+
+PUBLIC short *
+make_pair_table(const char *structure){
+
+  return vrna_ptable(structure);
+}
+
+PUBLIC short *
+copy_pair_table(const short *pt){
+
+  return vrna_ptable_copy(pt);
+}
+
+PUBLIC short *
+make_pair_table_pk(const char *structure){
+
+  return vrna_pt_pk_get(structure);
+}
+
+PUBLIC short *
+make_pair_table_snoop(const char *structure){
+
+  return vrna_pt_snoop_get(structure);
+}
+
+PUBLIC short *
+alimake_pair_table(const char *structure){
+
+  return vrna_pt_ali_get(structure);
+}
+
+PUBLIC int *
+make_loop_index_pt(short *pt){
+
+  return vrna_loopidx_from_ptable((const short*)pt);
+}
+
+PUBLIC int
+bp_distance(const char *str1, const char *str2){
+
+  return vrna_bp_distance(str1, str2);
+}
+
+PUBLIC unsigned int *
+make_referenceBP_array( short *reference_pt,
+                        unsigned int turn){
+
+  return vrna_refBPcnt_matrix((const short *)reference_pt, turn);
+}
+
+PUBLIC unsigned int *
+compute_BPdifferences(short *pt1,
+                      short *pt2,
+                      unsigned int turn){
+
+  return vrna_refBPdist_matrix((const short *)pt1, (const short *)pt2, turn);
+}
+
+PUBLIC char
+bppm_symbol(const float *x){
+
+  return vrna_bpp_symbol(x);
+}
+
+PUBLIC void
+bppm_to_structure(char *structure,
+                  FLT_OR_DBL *p,
+                  unsigned int length){
+
+  char *s = vrna_db_from_probs((const FLT_OR_DBL *)p, length);
+  memcpy(structure, s, length);
+  structure[length] = '\0';
+  free(s);
+}
+
+#endif
diff --git a/C/ViennaRNA/structure_utils.h b/C/ViennaRNA/structure_utils.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/structure_utils.h
@@ -0,0 +1,449 @@
+#ifndef VIENNA_RNA_PACKAGE_STRUCT_UTILS_H
+#define VIENNA_RNA_PACKAGE_STRUCT_UTILS_H
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file     structure_utils.h
+ *  @ingroup  utils
+ *  @brief    Various utility- and helper-functions for secondary structure parsing, converting, etc.
+ */
+
+/**
+ *  @{
+ *  @ingroup   struct_utils
+ */
+
+/**
+ *  @brief Convenience typedef for data structure #vrna_hx_s
+ */
+typedef struct vrna_hx_s  vrna_hx_t;
+
+#include <stdio.h>
+
+#include <ViennaRNA/data_structures.h>
+
+/**
+ *  @brief  Data structure representing an entry of a helix list
+ */
+struct vrna_hx_s {
+  unsigned int start;
+  unsigned int end;
+  unsigned int length;
+  unsigned int up5;
+  unsigned int up3;
+};
+
+/**
+ *  @brief Pack secondary secondary structure, 5:1 compression using base 3 encoding
+ *
+ *  Returns a binary string encoding of the secondary structure using
+ *  a 5:1 compression scheme. The string is NULL terminated and can
+ *  therefore be used with standard string functions such as strcmp().
+ *  Useful for programs that need to keep many structures in memory.
+ *
+ *  @see  vrna_db_unpack()
+ *  @param struc    The secondary structure in dot-bracket notation
+ *  @return         The binary encoded structure
+ */
+char *vrna_db_pack(const char *struc);
+
+/**
+ *  @brief Unpack secondary structure previously packed with vrna_db_pack()
+ *
+ *  Translate a compressed binary string produced by vrna_db_pack() back into
+ *  the familiar dot-bracket notation.
+ *
+ *  @see  vrna_db_pack()
+ *  @param packed   The binary encoded packed secondary structure
+ *  @return         The unpacked secondary structure in dot-bracket notation
+ */
+char *vrna_db_unpack(const char *packed);
+
+/**
+ *  @brief Create a pair table of a secondary structure
+ *
+ *  Returns a newly allocated table, such that table[i]=j if (i.j) pair
+ *  or 0 if i is unpaired, table[0] contains the length of the structure.
+ *
+ *  @param  structure The secondary structure in dot-bracket notation
+ *  @return           A pointer to the created pair_table
+ */
+short *vrna_ptable(const char *structure);
+
+
+/**
+ *  @brief Create a pair table of a secondary structure (pseudo-knot version)
+ *
+ *  Returns a newly allocated table, such that table[i]=j if (i.j) pair
+ *  or 0 if i is unpaired, table[0] contains the length of the structure.
+ *
+ *  In contrast to vrna_ptable() this function also recognizes the base pairs
+ *  denoted by '[' and ']' brackets.
+ *
+ *  @param  structure The secondary structure in (extended) dot-bracket notation
+ *  @return           A pointer to the created pair_table
+ */
+short *vrna_pt_pk_get(const char *structure);
+
+/**
+ *  @brief Get an exact copy of a pair table
+ *
+ *  @param pt The pair table to be copied
+ *  @return   A pointer to the copy of 'pt' 
+ */
+short *vrna_ptable_copy(const short *pt);
+
+/**
+ * @brief Create a pair table of a secondary structure (snoop align version)
+ *
+ */
+short *vrna_pt_ali_get(const char *structure);
+
+/**
+ * @brief Create a pair table of a secondary structure (snoop version)
+ *
+ *  returns a newly allocated table, such that:  table[i]=j if (i.j) pair or
+ *  0 if i is unpaired, table[0] contains the length of the structure.
+ *  The special pseudoknotted H/ACA-mRNA structure is taken into account.
+ */
+short *vrna_pt_snoop_get(const char *structure);
+
+/**
+ *  @brief Get a loop index representation of a structure
+ */
+int *vrna_loopidx_from_ptable(const short *pt);
+
+/**
+ *  @brief Convert a pair table into dot-parenthesis notation
+ *
+ *  @param pt The pair table to be copied
+ *  @return   A char pointer to the dot-bracket string
+ */
+char *vrna_db_from_ptable(short *pt);
+
+
+/**
+ *  @brief Compute the "base pair" distance between two secondary structures s1 and s2.
+ * 
+ *  The sequences should have the same length.
+ *  dist = number of base pairs in one structure but not in the other
+ *  same as edit distance with open-pair close-pair as move-set
+ * 
+ *  @param str1   First structure in dot-bracket notation
+ *  @param str2   Second structure in dot-bracket notation
+ *  @return       The base pair distance between str1 and str2
+ */
+int vrna_bp_distance( const char *str1,
+                      const char *str2);
+
+/**
+ *  @brief Make a reference base pair count matrix
+ *
+ *  Get an upper triangular matrix containing the number of basepairs of a reference
+ *  structure for each interval [i,j] with i<j. Access it via iindx!!!
+ */
+unsigned int  *vrna_refBPcnt_matrix(const short *reference_pt,
+                                    unsigned int turn);
+
+/**
+ *  @brief Make a reference base pair distance matrix
+ *
+ *  Get an upper triangular matrix containing the base pair distance of two
+ *  reference structures for each interval [i,j] with i<j. Access it via iindx!!!
+ *
+ */
+unsigned int  *vrna_refBPdist_matrix( const short *pt1,
+                                      const short *pt2,
+                                      unsigned int turn);
+
+/**
+ *  @brief Create a dot-bracket like structure string from base pair probability matrix
+ */
+char *vrna_db_from_probs( const FLT_OR_DBL *pr,
+                          unsigned int length);
+
+/**
+ *  @brief Get a pseudo dot bracket notation for a given probability information
+ */
+char vrna_bpp_symbol(const float *x);
+
+/**
+ *  @brief Create a dot-backet/parenthesis structure from backtracking stack
+ *
+ *  This function is capable to create dot-bracket structures from suboptimal
+ *  structure prediction sensu M. Zuker
+ *
+ *  @param bp     Base pair stack containing the traced base pairs
+ *  @param length The length of the structure
+ *  @return       The secondary structure in dot-bracket notation as
+ *                provided in the input
+ */
+char *vrna_db_from_bp_stack(vrna_bp_stack_t *bp,
+                            unsigned int length);
+
+void vrna_letter_structure( char *structure,
+                            vrna_bp_stack_t *bp,
+                            unsigned int length);
+
+/**
+ *  @brief Create a #vrna_plist_t from a dot-bracket string
+ * 
+ *  The dot-bracket string is parsed and for each base pair an
+ *  entry in the plist is created. The probability of each pair in
+ *  the list is set by a function parameter.
+ * 
+ *  The end of the plist is marked by sequence positions i as well as j
+ *  equal to 0. This condition should be used to stop looping over its
+ *  entries
+ * 
+ *  @param struc  The secondary structure in dot-bracket notation
+ *  @param pr     The probability for each base pair used in the plist
+ *  @return       The plist array
+ */
+vrna_plist_t *vrna_plist(const char *struc, float pr);
+
+/**
+ *  @brief Create a #vrna_plist_t from base pair probability matrix
+ * 
+ *  The probability matrix provided via the #vrna_fold_compound_t is parsed
+ *  and all pair probabilities above the given threshold are used to create
+ *  an entry in the plist
+ * 
+ *  The end of the plist is marked by sequence positions i as well as j
+ *  equal to 0. This condition should be used to stop looping over its
+ *  entries
+ * 
+ *  @ingroup            pf_fold
+ *  @param[in]  vc        The fold compound
+ *  @param[in]  cut_off   The cutoff value
+ *  @return               A pointer to the plist that is to be created
+ */
+vrna_plist_t *vrna_plist_from_probs(vrna_fold_compound_t *vc, double cut_off);
+
+/**
+ *  @brief  Convert a list of base pairs into dot-bracket notation
+ *
+ *  @see vrna_plist()
+ *  @param  pairs   A #vrna_plist_t containing the pairs to be included in
+ *                  the dot-bracket string
+ *  @param  n       The length of the structure (number of nucleotides)
+ *  @return         The dot-bracket string containing the provided base pairs
+ */
+char *vrna_db_from_plist(vrna_plist_t *pairs, unsigned int n);
+
+char *vrna_db_to_element_string(const char *structure);
+
+vrna_hx_t *vrna_hx_from_ptable(short *pt);
+vrna_hx_t *vrna_hx_merge(const vrna_hx_t *list, int maxdist);
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+/**
+ *  @brief Create a #vrna_plist_t from a dot-bracket string
+ * 
+ *  The dot-bracket string is parsed and for each base pair an
+ *  entry in the plist is created. The probability of each pair in
+ *  the list is set by a function parameter.
+ * 
+ *  The end of the plist is marked by sequence positions i as well as j
+ *  equal to 0. This condition should be used to stop looping over its
+ *  entries
+ * 
+ *  @deprecated   Use vrna_plist() instead
+ * 
+ *  @param pl     A pointer to the #vrna_plist_t that is to be created
+ *  @param struc  The secondary structure in dot-bracket notation
+ *  @param pr     The probability for each base pair
+ */
+DEPRECATED(void assign_plist_from_db(vrna_plist_t **pl, const char *struc, float pr));
+
+/**
+ *  @brief Pack secondary secondary structure, 5:1 compression using base 3 encoding
+ *
+ *  Returns a binary string encoding of the secondary structure using
+ *  a 5:1 compression scheme. The string is NULL terminated and can
+ *  therefore be used with standard string functions such as strcmp().
+ *  Useful for programs that need to keep many structures in memory.
+ *
+ *  @deprecated     Use vrna_db_pack() as a replacement
+ *  @param struc    The secondary structure in dot-bracket notation
+ *  @return         The binary encoded structure
+ */
+DEPRECATED(char *pack_structure(const char *struc));
+
+/**
+ *  @brief Unpack secondary structure previously packed with pack_structure()
+ *
+ *  Translate a compressed binary string produced by pack_structure() back into
+ *  the familiar dot-bracket notation.
+ *
+ *  @deprecated     Use vrna_db_unpack() as a replacement
+ *  @param packed   The binary encoded packed secondary structure
+ *  @return         The unpacked secondary structure in dot-bracket notation
+ */
+DEPRECATED(char *unpack_structure(const char *packed));
+
+/**
+ *  @brief Create a pair table of a secondary structure
+ *
+ *  Returns a newly allocated table, such that table[i]=j if (i.j) pair
+ *  or 0 if i is unpaired, table[0] contains the length of the structure.
+ *
+ *  @deprecated Use vrna_ptable() instead
+ *
+ *  @param  structure The secondary structure in dot-bracket notation
+ *  @return           A pointer to the created pair_table
+ */
+DEPRECATED(short *make_pair_table(const char *structure));
+
+DEPRECATED(short *make_pair_table_pk(const char *structure));
+
+/**
+ *  @brief Get an exact copy of a pair table
+ *
+ *  @deprecated Use vrna_ptable_copy() instead
+ *
+ *  @param pt The pair table to be copied
+ *  @return   A pointer to the copy of 'pt' 
+ */
+DEPRECATED(short *copy_pair_table(const short *pt));
+
+/**
+*** Pair table for snoop align
+***
+*** @deprecated Use vrna_pt_ali_get() instead!
+**/
+DEPRECATED(short *alimake_pair_table(const char *structure));
+
+/**
+*** returns a newly allocated table, such that:  table[i]=j if (i.j) pair or
+*** 0 if i is unpaired, table[0] contains the length of the structure.
+*** The special pseudoknotted H/ACA-mRNA structure is taken into account.
+*** @deprecated Use vrna_pt_snoop_get() instead!
+**/
+DEPRECATED(short *make_pair_table_snoop(const char *structure));
+
+DEPRECATED(int *make_loop_index_pt(short *pt));
+
+/**
+ *  @brief Compute the "base pair" distance between two secondary structures s1 and s2.
+ * 
+ *  The sequences should have the same length.
+ *  dist = number of base pairs in one structure but not in the other
+ *  same as edit distance with open-pair close-pair as move-set
+ *
+ *  @deprecated   Use vrna_bp_distance instead
+ *  @param str1   First structure in dot-bracket notation
+ *  @param str2   Second structure in dot-bracket notation
+ *  @return       The base pair distance between str1 and str2
+ */
+DEPRECATED(int bp_distance(const char *str1, const char *str2));
+
+/**
+ *  @brief Make a reference base pair count matrix
+ *
+ *  Get an upper triangular matrix containing the number of basepairs of a reference
+ *  structure for each interval [i,j] with i<j. Access it via iindx!!!
+ *
+ *  @deprecated Use vrna_refBPcnt_matrix() instead
+ */
+DEPRECATED(unsigned int  *make_referenceBP_array(short *reference_pt,
+                                      unsigned int turn));
+/**
+ *  @brief Make a reference base pair distance matrix
+ *
+ *  Get an upper triangular matrix containing the base pair distance of two
+ *  reference structures for each interval [i,j] with i<j. Access it via iindx!!!
+ *
+ *  @deprecated Use vrna_refBPdist_matrix() instead
+ */
+DEPRECATED(unsigned int  *compute_BPdifferences( short *pt1,
+                                      short *pt2,
+                                      unsigned int turn));
+
+/**
+ *  @brief Create a vrna_plist_t from a probability matrix
+ * 
+ *  The probability matrix given is parsed and all pair probabilities above
+ *  the given threshold are used to create an entry in the plist
+ * 
+ *  The end of the plist is marked by sequence positions i as well as j
+ *  equal to 0. This condition should be used to stop looping over its
+ *  entries
+ * 
+ *  @note This function is threadsafe
+ *  @deprecated Use vrna_plist_from_probs() instead!
+ *
+ *  @ingroup            pf_fold
+ *  @param[out] pl      A pointer to the vrna_plist_t that is to be created
+ *  @param[in]  probs   The probability matrix used for creating the plist
+ *  @param[in]  length  The length of the RNA sequence
+ *  @param[in]  cutoff  The cutoff value
+ */
+DEPRECATED(void  assign_plist_from_pr( vrna_plist_t **pl,
+                            FLT_OR_DBL *probs,
+                            int length,
+                            double cutoff));
+
+/**
+ *  @brief Create a dot-backet/parenthesis structure from backtracking stack
+ *
+ *  @deprecated use vrna_parenthesis_structure() instead
+ * 
+ *  @note This function is threadsafe
+ */
+DEPRECATED(void parenthesis_structure(char *structure,
+                                      vrna_bp_stack_t *bp,
+                                      int length));
+
+/**
+ *  @brief Create a dot-backet/parenthesis structure from backtracking stack
+ *  obtained by zuker suboptimal calculation in cofold.c
+ * 
+ *  @deprecated use vrna_parenthesis_zuker instead
+ * 
+ *  @note This function is threadsafe
+ */
+DEPRECATED(void parenthesis_zuker(char *structure,
+                                  vrna_bp_stack_t *bp,
+                                  int length));
+
+DEPRECATED(void letter_structure( char *structure,
+                                  vrna_bp_stack_t *bp,
+                                  int length));
+
+/**
+ *  @brief Create a dot-bracket like structure string from base pair probability matrix
+ *  @deprecated Use vrna_db_from_probs() instead!
+ */
+DEPRECATED(void  bppm_to_structure(char *structure, FLT_OR_DBL *pr, unsigned int length));
+
+/**
+ *  @brief Get a pseudo dot bracket notation for a given probability information
+ *  @deprecated Use vrna_bpp_symbol() instead!
+ */
+DEPRECATED(char    bppm_symbol(const float *x));
+
+#endif
+
+/**
+ * @}
+ */
+
+#endif
diff --git a/C/ViennaRNA/structured_domains.h b/C/ViennaRNA/structured_domains.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/structured_domains.h
@@ -0,0 +1,31 @@
+#ifndef VIENNA_RNA_PACKAGE_STRUCTURAL_DOMAINS_H
+#define VIENNA_RNA_PACKAGE_STRUCTURAL_DOMAINS_H
+
+/**
+ *  @file structured_domains.h
+ *  @ingroup domains_struc
+ *
+ *  @brief  This module provides interfaces that deal with additional structured domains in the folding grammar.
+ */
+
+/**
+ *  @addtogroup domains_struc
+ *
+ *  @brief  Add and modify structured domains to the RNA folding grammar
+ *
+ *  This module provides the tools to add and modify structured domains to the production rules of the RNA folding grammar.
+ *  Usually this functionality is utilized for incorporating self-enclosed structural modules that exhibit a more or less
+ *  complex base pairing pattern.
+ *
+ */
+
+
+typedef struct vrna_structured_domains_s  vrna_sd_t;
+
+
+struct vrna_structured_domains_s {
+
+
+};
+
+#endif
diff --git a/C/ViennaRNA/subopt.c b/C/ViennaRNA/subopt.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/subopt.c
@@ -0,0 +1,2070 @@
+/*
+   suboptimal folding - Stefan Wuchty, Walter Fontana & Ivo Hofacker
+
+                       Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <string.h>
+#include <math.h>
+#include "ViennaRNA/fold.h"
+#include "ViennaRNA/constraints.h"
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/energy_par.h"
+#include "ViennaRNA/fold_vars.h"
+#include "list.h"
+#include "ViennaRNA/eval.h"
+#include "ViennaRNA/params.h"
+#include "ViennaRNA/loop_energies.h"
+#include "ViennaRNA/cofold.h"
+#include "ViennaRNA/gquad.h"
+#include "ViennaRNA/subopt.h"
+
+/* hack */
+#include "ViennaRNA/color_output.inc"
+
+#ifdef _OPENMP
+#include <omp.h>
+#endif
+
+#define true              1
+#define false             0
+#define ON_SAME_STRAND(I,J,C)  (((I)>=(C))||((J)<(C)))
+
+/**
+ *  @brief  Sequence interval stack element used in subopt.c
+ */
+typedef struct INTERVAL {
+    int i;
+    int j;
+    int array_flag;
+} INTERVAL;
+
+typedef struct {
+    char *structure;
+    LIST *Intervals;
+    int partial_energy;
+    int is_duplex;
+    /* int best_energy;   */ /* best attainable energy */
+} STATE;
+
+typedef struct {
+  LIST          *Intervals;
+  LIST          *Stack;
+  int           nopush;
+} subopt_env;
+
+
+struct old_subopt_dat {
+
+  unsigned long max_sol;
+  unsigned long n_sol;
+  SOLUTION      *SolutionList;
+  FILE          *fp;
+};
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+PUBLIC  int     subopt_sorted=0;                           /* output sorted by energy */
+PUBLIC  int     density_of_states[MAXDOS+1];
+PUBLIC  double  print_energy = 9999; /* printing threshold for use with logML */
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+
+/* some backward compatibility stuff */
+PRIVATE int                 backward_compat           = 0;
+PRIVATE vrna_fold_compound_t  *backward_compat_compound = NULL;
+
+#ifdef _OPENMP
+
+#pragma omp threadprivate(backward_compat_compound, backward_compat)
+
+#endif
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+PRIVATE SOLUTION *
+wrap_subopt(char *seq,
+            char *structure,
+            vrna_param_t *parameters,
+            int delta,
+            int is_constrained,
+            int is_circular,
+            FILE *fp);
+#endif
+
+PRIVATE void      make_pair(int i, int j, STATE *state);
+
+/* mark a gquadruplex in the resulting dot-bracket structure */
+PRIVATE void      make_gquad(int i, int L, int l[3], STATE *state);
+
+PRIVATE INTERVAL  *make_interval (int i, int j, int ml);
+/*@out@*/ PRIVATE STATE *make_state(/*@only@*/LIST *Intervals,
+                                    /*@only@*/ /*@null@*/ char *structure,
+                                    int partial_energy, int is_duplex, int length);
+PRIVATE STATE     *copy_state(STATE * state);
+PRIVATE void      print_state(STATE * state);
+//PRIVATE void      UNUSED print_stack(LIST * list);
+/*@only@*/ PRIVATE LIST *make_list(void);
+PRIVATE void      push(LIST * list, /*@only@*/ void *data);
+PRIVATE void      *pop(LIST * list);
+PRIVATE int       best_attainable_energy(vrna_fold_compound_t *vc, STATE * state);
+PRIVATE void      scan_interval(vrna_fold_compound_t *vc, int i, int j, int array_flag, int threshold, STATE * state, subopt_env *env);
+PRIVATE void      free_interval_node(/*@only@*/ INTERVAL * node);
+PRIVATE void      free_state_node(/*@only@*/ STATE * node);
+PRIVATE void      push_back(LIST *Stack, STATE * state);
+PRIVATE char*     get_structure(STATE * state);
+PRIVATE int       compare(const void *solution1, const void *solution2);
+PRIVATE void      make_output(SOLUTION *SL, int cp, FILE *fp);
+PRIVATE void      repeat(vrna_fold_compound_t *vc, int i, int j, STATE * state, int part_energy, int temp_energy, int best_energy, int threshold, subopt_env *env);
+PRIVATE void      repeat_gquad(vrna_fold_compound_t *vc, int i, int j, STATE *state, int part_energy, int temp_energy, int best_energy, int threshold, subopt_env *env);
+
+
+PRIVATE void      old_subopt_print( const char *structure, float energy, void *data);
+PRIVATE void      old_subopt_store( const char *structure, float energy, void *data);
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+
+
+/*---------------------------------------------------------------------------*/
+/*List routines--------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void
+make_pair(int i, int j, STATE *state)
+{
+  state->structure[i-1] = '(';
+  state->structure[j-1] = ')';
+}
+
+PRIVATE void
+make_gquad(int i, int L, int l[3], STATE *state)
+{
+  int x;
+  for(x = 0; x < L; x++){
+    state->structure[i - 1 + x] = '+';
+    state->structure[i - 1 + x + L + l[0]] = '+';
+    state->structure[i - 1 + x + 2*L + l[0] + l[1]] = '+';
+    state->structure[i - 1 + x + 3*L + l[0] + l[1] + l[2]] = '+';
+  }
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE INTERVAL *
+make_interval(int i, int j, int array_flag)
+{
+  INTERVAL *interval;
+
+  interval = lst_newnode(sizeof(INTERVAL));
+  interval->i = i;
+  interval->j = j;
+  interval->array_flag = array_flag;
+  return interval;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void
+free_interval_node(INTERVAL * node)
+{
+  lst_freenode(node);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void
+free_state_node(STATE * node)
+{
+  free(node->structure);
+  if (node->Intervals)
+    lst_kill(node->Intervals, lst_freenode);
+  lst_freenode(node);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE STATE *
+make_state(LIST * Intervals,
+           char *structure,
+           int partial_energy,
+           int is_duplex,
+           int length)
+{
+  STATE *state;
+
+  state = lst_newnode(sizeof(STATE));
+
+  if (Intervals)
+    state->Intervals = Intervals;
+  else
+    state->Intervals = lst_init();
+  if (structure)
+    state->structure = structure;
+  else {
+    int i;
+    state->structure = (char *) vrna_alloc(length+1);
+    for (i=0; i<length; i++)
+      state->structure[i] = '.';
+  }
+
+  state->partial_energy = partial_energy;
+
+  return state;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE STATE *
+copy_state(STATE * state)
+{
+  STATE *new_state;
+  void *after;
+  INTERVAL *new_interval, *next;
+
+  new_state = lst_newnode(sizeof(STATE));
+  new_state->Intervals = lst_init();
+  new_state->partial_energy = state->partial_energy;
+  /* new_state->best_energy = state->best_energy; */
+
+  if (state->Intervals->count) {
+    after = LST_HEAD(new_state->Intervals);
+    for ( next = lst_first(state->Intervals); next; next = lst_next(next))
+      {
+        new_interval = lst_newnode(sizeof(INTERVAL));
+        *new_interval = *next;
+        lst_insertafter(new_state->Intervals, new_interval, after);
+        after = new_interval;
+      }
+  }
+  new_state->structure = strdup(state->structure);
+  if (!new_state->structure) vrna_message_error("out of memory");
+  return new_state;
+}
+
+/*---------------------------------------------------------------------------*/
+
+/*@unused @*/ PRIVATE void
+print_state(STATE * state)
+{
+  INTERVAL *next;
+
+  if (state->Intervals->count)
+    {
+      printf("%d intervals:\n", state->Intervals->count);
+      for (next = lst_first(state->Intervals); next; next = lst_next(next))
+        {
+          printf("[%d,%d],%d ", next->i, next->j, next->array_flag);
+        }
+      printf("\n");
+    }
+  printf("partial structure: %s\n", state->structure);
+  printf("\n");
+  printf(" partial_energy: %d\n", state->partial_energy);
+  /* printf(" best_energy: %d\n", state->best_energy); */
+  (void) fflush(stdout);
+}
+
+/*---------------------------------------------------------------------------*/
+
+/*@unused @*/ PRIVATE void
+print_stack(LIST * list)
+{
+  void *rec;
+
+  printf("================\n");
+  printf("%d states\n", list->count);
+  for (rec = lst_first(list); rec; rec = lst_next(rec))
+    {
+      printf("state-----------\n");
+      print_state(rec);
+    }
+  printf("================\n");
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE LIST *
+make_list(void)
+{
+  return lst_init();
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void
+push(LIST * list, void *data)
+{
+  lst_insertafter(list, data, LST_HEAD(list));
+}
+
+/* PRIVATE void */
+/* push_stack(STATE *state) { */ /* keep the stack sorted by energy */
+/*   STATE *after, *next; */
+/*   nopush = false; */
+/*   next = after = LST_HEAD(Stack); */
+/*   while ( next = lst_next(next)) { */
+/*     if ( next->best_energy >= state->best_energy ) break; */
+/*     after = next; */
+/*   } */
+/*   lst_insertafter(Stack, state, after); */
+/* } */
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void *
+pop(LIST * list)
+{
+  void *data;
+
+  data = lst_deletenext(list, LST_HEAD(list));
+  return data;
+}
+
+/*---------------------------------------------------------------------------*/
+/*auxiliary routines---------------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+
+PRIVATE int
+best_attainable_energy( vrna_fold_compound_t *vc,
+                        STATE *state){
+
+  /* evaluation of best possible energy attainable within remaining intervals */
+
+  register int sum;
+  INTERVAL        *next;
+  vrna_md_t       *md;
+  vrna_mx_mfe_t   *matrices;
+  int             *indx;
+
+  md        = &(vc->params->model_details);
+  matrices  = vc->matrices;
+  indx      = vc->jindx;
+
+  sum = state->partial_energy;  /* energy of already found elements */
+
+  for (next = lst_first(state->Intervals); next; next = lst_next(next))
+    {
+      if (next->array_flag == 0)
+        sum += (md->circ) ? matrices->Fc : matrices->f5[next->j];
+      else if (next->array_flag == 1)
+        sum += matrices->fML[indx[next->j] + next->i];
+      else if (next->array_flag == 2)
+        sum += matrices->c[indx[next->j] + next->i];
+      else if (next->array_flag == 3)
+        sum += matrices->fM1[indx[next->j] + next->i];
+      else if (next->array_flag == 4)
+        sum += matrices->fc[next->i];
+      else if (next->array_flag == 5)
+        sum += matrices->fc[next->j];
+      else if (next->array_flag == 6)
+        sum += matrices->ggg[indx[next->j] + next->i];
+    }
+
+  return sum;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void
+push_back(LIST *Stack, STATE * state)
+{
+  push(Stack, copy_state(state));
+  return;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE char*
+get_structure(STATE * state)
+{
+  char* structure;
+
+  structure = strdup(state->structure);
+  return structure;
+}
+
+/*---------------------------------------------------------------------------*/
+PRIVATE int
+compare(const void *solution1, const void *solution2)
+{
+  if (((SOLUTION *) solution1)->energy > ((SOLUTION *) solution2)->energy)
+    return 1;
+  if (((SOLUTION *) solution1)->energy < ((SOLUTION *) solution2)->energy)
+    return -1;
+  return strcmp(((SOLUTION *) solution1)->structure,
+                ((SOLUTION *) solution2)->structure);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void make_output(SOLUTION *SL, int cp, FILE *fp)  /* prints stuff */
+{
+  SOLUTION *sol;
+
+  for (sol = SL; sol->structure!=NULL; sol++){
+    char *e_string = vrna_strdup_printf(" %6.2f", sol->energy);
+    print_structure(fp, sol->structure, e_string);
+    free(e_string);
+  }
+}
+
+PRIVATE STATE *
+derive_new_state( int i,
+                  int j,
+                  STATE *s,
+                  int e,
+                  int flag){
+
+  STATE     *s_new  = copy_state(s);
+  INTERVAL  *ival   = make_interval(i, j, flag);
+  push(s_new->Intervals, ival);
+
+  s_new->partial_energy += e;
+
+  return s_new;
+}
+
+PRIVATE void
+fork_state( int i,
+            int j,
+            STATE *s,
+            int e,
+            int flag,
+            subopt_env *env){
+
+  STATE *s_new = derive_new_state(i, j, s, e, flag);
+  push(env->Stack, s_new);
+  env->nopush = false;
+}
+
+PRIVATE void
+fork_int_state( int i, int j,
+                int p, int q,
+                STATE *s,
+                int e,
+                subopt_env *env){
+
+  STATE *s_new = derive_new_state(p, q, s, e, 2);
+  make_pair(i, j, s_new);
+  make_pair(p, q, s_new);
+  push(env->Stack, s_new);
+  env->nopush = false;
+}
+
+PRIVATE void
+fork_state_pair(int i,
+                int j,
+                STATE *s,
+                int e,
+                subopt_env *env){
+
+  STATE     *new_state;
+
+  new_state = copy_state(s);
+  make_pair(i, j, new_state);
+  new_state->partial_energy += e;
+  push(env->Stack, new_state);
+  env->nopush = false;
+}
+
+PRIVATE void
+fork_two_states_pair( int i,
+                      int j,
+                      int k,
+                      STATE *s,
+                      int e,
+                      int flag1,
+                      int flag2,
+                      subopt_env *env){
+
+  INTERVAL  *interval1, *interval2;
+  STATE     *new_state;
+
+  new_state = copy_state(s);
+  interval1 = make_interval(i+1, k-1, flag1);
+  interval2 = make_interval(k, j-1, flag2);
+  if (k-i < j-k) { /* push larger interval first */
+    push(new_state->Intervals, interval1);
+    push(new_state->Intervals, interval2);
+  } else {
+    push(new_state->Intervals, interval2);
+    push(new_state->Intervals, interval1);
+  }
+  make_pair(i, j, new_state);
+  new_state->partial_energy += e;
+
+  push(env->Stack, new_state);
+  env->nopush = false;
+}
+
+
+PRIVATE void
+fork_two_states(int i,
+                int j,
+                int p,
+                int q,
+                STATE *s,
+                int e,
+                int flag1,
+                int flag2,
+                subopt_env *env){
+
+  INTERVAL  *interval1, *interval2;
+  STATE     *new_state;
+
+  new_state = copy_state(s);
+  interval1 = make_interval(i, j, flag1);
+  interval2 = make_interval(p, q, flag2);
+
+  if((j - i) < (q - p)){
+    push(new_state->Intervals, interval1);
+    push(new_state->Intervals, interval2);
+  } else {
+    push(new_state->Intervals, interval2);
+    push(new_state->Intervals, interval1);
+  }
+  new_state->partial_energy += e;
+
+  push(env->Stack, new_state);
+  env->nopush = false;
+}
+
+/*---------------------------------------------------------------------------*/
+/* start of subopt backtracking ---------------------------------------------*/
+/*---------------------------------------------------------------------------*/
+
+PUBLIC SOLUTION *
+vrna_subopt(vrna_fold_compound_t *vc,
+            int delta,
+            int sorted,
+            FILE *fp){
+
+  SOLUTION      *SolutionList;
+  unsigned long max_sol, n_sol;
+  struct old_subopt_dat data;
+
+  data.SolutionList = NULL;
+  data.max_sol      = 128;
+  data.n_sol        = 0;
+  data.fp           = fp;
+
+  if(vc){
+    /* SolutionList stores the suboptimal structures found */
+
+    data.SolutionList = (SOLUTION *) vrna_alloc(data.max_sol*sizeof(SOLUTION));
+
+    /* end initialize ------------------------------------------------------- */
+
+    if (fp) {
+      float min_en;
+      char  *SeQ, *energies = NULL;
+      if(vc->cutpoint > 0)
+        min_en = vrna_mfe_dimer(vc, NULL);
+      else
+        min_en = vrna_mfe(vc, NULL);
+
+      SeQ = vrna_cut_point_insert(vc->sequence, vc->cutpoint);
+      energies = vrna_strdup_printf(" %6.2f %6.2f", min_en, (float)delta/100.);
+      print_structure(fp, SeQ, energies);
+      free(SeQ);
+      free(energies);
+
+      vrna_mx_mfe_free(vc);
+    }
+    /* call subopt() */
+    vrna_subopt_cb(vc, delta, (!sorted && fp) ? &old_subopt_print : &old_subopt_store, (void *)&data);
+
+    if(sorted){
+      /* sort structures by energy */
+      if(data.n_sol > 0)
+        qsort(data.SolutionList, data.n_sol - 1, sizeof(SOLUTION), compare);
+      if(fp)
+        make_output(data.SolutionList, vc->cutpoint, fp);
+    }
+
+    if(fp){ /* we've printed everything -- free solutions */
+      SOLUTION *sol;
+      for(sol = data.SolutionList; sol->structure != NULL; sol++)
+        free(sol->structure);
+      free(data.SolutionList);
+      data.SolutionList = NULL;
+    }
+  }
+
+  return data.SolutionList;
+}
+
+PUBLIC void
+vrna_subopt_cb( vrna_fold_compound_t *vc,
+                int delta,
+                vrna_subopt_callback *cb,
+                void *data){
+
+  subopt_env    *env;
+  STATE         *state;
+  INTERVAL      *interval;
+  int           maxlevel, count, partial_energy, old_dangles, logML, dangle_model, length, circular, threshold, cp;
+  double        structure_energy, min_en, eprint;
+  char          *struc, *structure, *sequence;
+  float         correction;
+  vrna_param_t  *P;
+  vrna_md_t     *md;
+  int           minimal_energy;
+  int           Fc;
+  int           *f5;
+
+  vrna_fold_compound_prepare(vc, VRNA_OPTION_MFE | VRNA_OPTION_HYBRID);
+
+  sequence            = vc->sequence;
+  length              = vc->length;
+  cp                  = vc->cutpoint;
+  P                   = vc->params;
+  md                  = &(P->model_details);
+
+  /* do mfe folding to get fill arrays and get ground state energy  */
+  /* in case dangles is neither 0 or 2, set dangles=2 while folding */
+
+  circular    = md->circ;
+  logML       = md->logML;
+  old_dangles = dangle_model = md->dangles;
+
+  if(md->uniq_ML != 1)  /* failsafe mechanism to enforce valid fM1 array */
+    md->uniq_ML = 1;
+
+  /* temporarily set dangles to 2 if necessary */
+  if((md->dangles != 0) && (md->dangles != 2))
+    md->dangles = 2;
+
+  struc = (char *)vrna_alloc(sizeof(char) * (length + 1));
+
+  if(circular){
+    min_en = vrna_mfe(vc, struc);
+    Fc  = vc->matrices->Fc;
+    f5    = vc->matrices->f5;
+
+    /* restore dangle model */
+    md->dangles = old_dangles;
+    /* re-evaluate in case we're using logML etc */
+    min_en = vrna_eval_structure(vc, struc);
+  } else {
+    min_en = vrna_mfe_dimer(vc, struc);
+
+    f5    = vc->matrices->f5;
+
+    /* restore dangle model */
+    md->dangles = old_dangles;
+    /* re-evaluate in case we're using logML etc */
+    min_en = vrna_eval_structure(vc, struc);
+  }
+
+  free(struc);
+  eprint = print_energy + min_en;
+
+  correction = (min_en < 0) ? -0.1 : 0.1;
+
+  /* Initialize ------------------------------------------------------------ */
+
+  maxlevel = 0;
+  count = 0;
+  partial_energy = 0;
+
+  /* Initialize the stack ------------------------------------------------- */
+
+  minimal_energy = (circular) ? Fc : f5[length];
+  threshold = minimal_energy + delta;
+  if(threshold > INF){
+    vrna_message_warning("Energy range too high, limiting to reasonable value");
+    threshold = INF-EMAX;
+  }
+
+  /* init env data structure */
+  env = (subopt_env *)vrna_alloc(sizeof(subopt_env));
+  env->Stack      = NULL;
+  env->nopush     = true;
+  env->Stack      = make_list();                                                   /* anchor */
+  env->Intervals  = make_list();                                   /* initial state: */
+  interval   = make_interval(1, length, 0);          /* interval [1,length,0] */
+  push(env->Intervals, interval);
+  env->nopush = false;
+  state  = make_state(env->Intervals, NULL, partial_energy,0, length);
+  /* state->best_energy = minimal_energy; */
+  push(env->Stack, state);
+  env->nopush = false;
+
+  /* end initialize ------------------------------------------------------- */
+
+
+  while (1) {                    /* forever, til nothing remains on stack */
+
+    maxlevel = (env->Stack->count > maxlevel ? env->Stack->count : maxlevel);
+
+    if (LST_EMPTY (env->Stack))                   /* we are done! clean up and quit */
+      {
+        /* fprintf(stderr, "maxlevel: %d\n", maxlevel); */
+
+        lst_kill(env->Stack, free_state_node);
+
+        cb(NULL, 0, data); /* NULL (last time to call callback function */
+
+        break;
+      }
+
+    /* pop the last element ---------------------------------------------- */
+
+    state = pop(env->Stack);                       /* current state to work with */
+
+    if (LST_EMPTY(state->Intervals))
+      {
+        int e;
+        /* state has no intervals left: we got a solution */
+
+        count++;
+        structure = get_structure(state);
+        structure_energy = state->partial_energy / 100.;
+
+#ifdef CHECK_ENERGY
+        structure_energy = vrna_eval_structure(vc, structure);
+
+        if (!logML)
+          if ((double) (state->partial_energy / 100.) != structure_energy) {
+            vrna_message_error("%s %6.2f %6.2f",
+                                      structure,
+                                      state->partial_energy / 100.,
+                                      structure_energy );
+            exit(1);
+          }
+#endif
+        if (logML || (dangle_model==1) || (dangle_model==3)) { /* recalc energy */
+          structure_energy = vrna_eval_structure(vc, structure);
+        }
+
+        e = (int) ((structure_energy-min_en)*10. - correction); /* avoid rounding errors */
+        if (e>MAXDOS) e=MAXDOS;
+        density_of_states[e]++;
+        if(structure_energy <= eprint){
+          char *outstruct = vrna_cut_point_insert(structure, cp);
+          cb((const char *)outstruct, structure_energy, data);
+          free(outstruct);
+        }
+        free(structure);
+      }
+    else {
+      /* get (and remove) next interval of state to analyze */
+
+      interval = pop(state->Intervals);
+      scan_interval(vc, interval->i, interval->j, interval->array_flag, threshold, state, env);
+
+      free_interval_node(interval);        /* free the current interval */
+    }
+
+    free_state_node(state);                     /* free the current state */
+  } /* end of while (1) */
+
+  /* cleanup memory */
+  free(env);
+}
+
+
+PRIVATE void
+scan_interval(vrna_fold_compound_t *vc,
+              int i,
+              int j,
+              int array_flag,
+              int threshold,
+              STATE * state,
+              subopt_env *env){
+
+  /* real backtrack routine */
+
+  /* array_flag = 0:  trace back in f5-array  */
+  /* array_flag = 1:  trace back in fML-array */
+  /* array_flag = 2:  trace back in repeat()  */
+  /* array_flag = 3:  trace back in fM1-array */
+
+  STATE           *new_state, *temp_state;
+  INTERVAL        *new_interval;
+  vrna_param_t    *P;
+  vrna_md_t       *md;
+  register int    k, fi, cij, ij;
+  register int    type;
+  register int    dangle_model;
+  register int    noLP;
+  int             element_energy, best_energy;
+  int             *fc, *f5, *c, *fML, *fM1, *ggg;
+  int             FcH, FcI, FcM, *fM2;
+  int             length, *indx, *rtype, circular, with_gquad, turn, cp;
+  char            *ptype;
+  short           *S1;
+  char            *hard_constraints, hc_decompose;
+  vrna_hc_t       *hc;
+  vrna_sc_t       *sc;
+
+  length    = vc->length;
+  cp        = vc->cutpoint;
+  indx      = vc->jindx;
+  ptype     = vc->ptype;
+  S1        = vc->sequence_encoding;
+  P         = vc->params;
+  md        = &(P->model_details);
+  rtype     = &(md->rtype[0]);
+
+  dangle_model  = md->dangles;
+  noLP          = md->noLP;
+  circular      = md->circ;
+  with_gquad    = md->gquad;
+  turn          = md->min_loop_size;
+
+  fc  = vc->matrices->fc;
+  f5  = vc->matrices->f5;
+  c   = vc->matrices->c;
+  fML = vc->matrices->fML;
+  fM1 = vc->matrices->fM1;
+  ggg = vc->matrices->ggg;
+  FcH = vc->matrices->FcH;
+  FcI = vc->matrices->FcI;
+  FcM = vc->matrices->FcM;
+  fM2 = vc->matrices->fM2;
+
+  hc                = vc->hc;
+  hard_constraints  = hc->matrix;
+
+  sc                = vc->sc;
+
+  best_energy = best_attainable_energy(vc, state);  /* .. on remaining intervals */
+  env->nopush = true;
+
+  if ((i > 1) && (!array_flag))
+    vrna_message_error ("Error while backtracking!");
+
+  if (j < i + turn + 1 && ON_SAME_STRAND(i,j,cp)) { /* minimal structure element */
+    if(array_flag == 0){
+      /* do not forget to add f5[j], since it may contain pseudo energies from soft constraining */
+      state->partial_energy += f5[j];
+    }
+    if (env->nopush){
+      push_back(env->Stack, state);
+      env->nopush = false;
+    }
+    return;
+  }
+
+  ij = indx[j] + i;
+
+  /* 13131313131313131313131313131313131313131313131313131313131313131313131 */
+  if (array_flag == 3 || array_flag == 1) {
+    /* array_flag = 3: interval i,j was generated during */
+    /*                 a multiloop decomposition using array fM1 in repeat() */
+    /*                 or in this block */
+
+    /* array_flag = 1: interval i,j was generated from a */
+    /*                 stack, bulge, or internal loop in repeat() */
+    /*                 or in this block */
+
+    if(hc->up_ml[j]){
+      if (array_flag == 3)
+        fi = fM1[indx[j-1] + i] + P->MLbase;
+      else
+        fi = fML[indx[j-1] + i] + P->MLbase;
+
+      if(sc){
+        if(sc->energy_up)
+          fi += sc->energy_up[j][1];
+        if(sc->f)
+          fi += sc->f(i, j, i, j - 1, VRNA_DECOMP_ML_ML, sc->data);
+      }
+
+      if ((fi + best_energy <= threshold)&&(ON_SAME_STRAND(j-1,j, cp))) {
+        /* no basepair, nibbling of 3'-end */
+        fork_state(i, j-1, state, P->MLbase, array_flag, env);
+      }
+    }
+
+    hc_decompose  = hard_constraints[ij];
+
+    if (hc_decompose & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC) { /* i,j may pair */
+      cij = c[ij];
+
+      type = ptype[ij];
+
+      if(type == 0)
+        type = 7;
+
+      switch(dangle_model){
+        case 0:   element_energy = E_MLstem(type, -1, -1, P);
+                  break;
+        default:  element_energy = E_MLstem(type,
+                                  (((i > 1)&&(ON_SAME_STRAND(i-1,i,cp))) || circular)       ? S1[i-1] : -1,
+                                  (((j < length)&&(ON_SAME_STRAND(j,j+1,cp))) || circular)  ? S1[j+1] : -1,
+                                  P);
+                  break;
+      }
+
+      if(sc){
+/* should be unnecessary
+        if(sc->energy_bp)
+          element_energy += sc->energy_bp[ij];
+*/
+        if(sc->f)
+          element_energy += sc->f(i, j, i, j, VRNA_DECOMP_ML_STEM, sc->data);
+      }
+      cij += element_energy;
+
+      if (cij + best_energy <= threshold)
+        repeat(vc, i, j, state, element_energy, 0, best_energy, threshold, env);
+    } else if (with_gquad){
+      element_energy = E_MLstem(0, -1, -1, P);
+      cij = ggg[ij] + element_energy;
+      if(cij + best_energy <= threshold)
+        repeat_gquad(vc, i, j, state, element_energy, 0, best_energy, threshold, env);
+    }
+  }                                   /* array_flag == 3 || array_flag == 1 */
+
+  /* 11111111111111111111111111111111111111111111111111111111111111111111111 */
+
+  if (array_flag == 1) {
+    /* array_flag = 1:                   interval i,j was generated from a */
+    /*                          stack, bulge, or internal loop in repeat() */
+    /*                          or in this block */
+
+    int stopp, k1j;
+    if ((ON_SAME_STRAND(i-1,i,cp))&&(ON_SAME_STRAND(j,j+1,cp))) { /*backtrack in FML only if multiloop is possible*/
+      for ( k = i+turn+1 ; k <= j-1-turn ; k++) {
+        /* Multiloop decomposition if i,j contains more than 1 stack */
+
+        if(with_gquad){
+          if(ON_SAME_STRAND(k, k+1, cp)){
+            element_energy = E_MLstem(0, -1, -1, P);
+            if(fML[indx[k]+i] + ggg[indx[j] + k + 1] + element_energy + best_energy <= threshold){
+              
+              temp_state = derive_new_state(i, k, state, 0, array_flag);
+              env->nopush = false;
+              repeat_gquad(vc, k+1, j, temp_state, element_energy, fML[indx[k]+i], best_energy, threshold, env);
+              free_state_node(temp_state);
+            }
+          }
+        }
+
+        k1j = indx[j] + k + 1;
+
+        if(hard_constraints[k1j] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC){
+          short s5, s3;
+          type = ptype[k1j];
+
+          if(type == 0)
+            type = 7;
+
+          switch(dangle_model){
+            case 0:   s5 = s3 = -1;
+                      break;
+            default:  s5 = (ON_SAME_STRAND(i-1,i,cp)) ? S1[k] : -1;
+                      s3 = (ON_SAME_STRAND(j,j+1,cp)) ? S1[j+1] : -1;
+                      break;
+          }
+
+          element_energy = E_MLstem(type, s5, s3, P);
+
+          if(sc){
+/* should be unnecessary
+            if(sc->energy_bp)
+              element_energy += sc->energy_bp[k1j];
+*/
+            if(sc->f)
+              element_energy += sc->f(i, j, k, k + 1, VRNA_DECOMP_ML_ML_STEM, sc->data);
+          }
+
+          if(ON_SAME_STRAND(k, k+1, cp)){
+            if(fML[indx[k]+i] + c[k1j] + element_energy + best_energy <= threshold){
+              temp_state  = derive_new_state(i, k, state, 0, array_flag);
+              env->nopush = false;
+              repeat(vc, k+1, j, temp_state, element_energy, fML[indx[k]+i], best_energy, threshold, env);
+              free_state_node(temp_state);
+            }
+          }
+        }
+      }
+    }
+
+    stopp=(cp>0)? (cp-2):(length); /*if cp -1: k on cut, => no ml*/
+    stopp=MIN2(stopp, j-1-turn);
+    if (i>cp) stopp=j-1-turn;
+    else if (i==cp) stopp=0;   /*not a multi loop*/
+
+    int up = 1;
+    for(k = i; k <= stopp; k++, up++){
+
+      if(hc->up_ml[i] >= up){
+        k1j = indx[j] + k + 1;
+
+        /* Multiloop decomposition if i,j contains only 1 stack */
+        if(with_gquad){
+          element_energy = E_MLstem(0, -1, -1, P) + P->MLbase * up;
+
+          if(sc){
+            if(sc->energy_up)
+              element_energy += sc->energy_up[i][up];
+          }
+
+          if(ggg[k1j] + element_energy + best_energy <= threshold)
+            repeat_gquad(vc, k+1, j, state, element_energy, 0, best_energy, threshold, env);
+        }
+
+        if(hard_constraints[k1j] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC){
+          int s5, s3;
+          type = ptype[k1j];
+
+          if(type == 0)
+            type = 7;
+
+          switch(dangle_model){
+            case 0:   s5 = s3 = -1;
+                      break;
+            default:  s5 = (ON_SAME_STRAND(k-1,k,cp)) ? S1[k] : -1;
+                      s3 = (ON_SAME_STRAND(j,j+1,cp)) ? S1[j+1] : -1;
+                      break;
+          }
+
+          element_energy = E_MLstem(type, s5, s3, P);
+
+          element_energy += P->MLbase * up;
+
+          if(sc){
+            if(sc->energy_up)
+              element_energy += sc->energy_up[i][up];
+
+/* should be unnecessary
+            if(sc->energy_bp)
+              element_energy += sc->energy_bp[k1j];
+*/
+          }
+
+          if (c[k1j] + element_energy + best_energy <= threshold)
+            repeat(vc, k+1, j, state, element_energy, 0, best_energy, threshold, env);
+        }
+      }
+    }
+  } /* array_flag == 1 */
+
+  /* 22222222222222222222222222222222222222222222222222 */
+  /*                                                    */
+  /* array_flag = 2:  interval i,j was generated from a */
+  /* stack, bulge, or internal loop in repeat()         */
+  /*                                                    */
+  /* 22222222222222222222222222222222222222222222222222 */
+  if(array_flag == 2){
+    repeat(vc, i, j, state, 0, 0, best_energy, threshold, env);
+
+    if (env->nopush){
+      if (!noLP){
+        vrna_message_warning("%d,%d\nOops, no solution in repeat!", i, j);
+      }
+    }
+    return;
+  }
+
+  /* 00000000000000000000000000000000000000000000000000 */
+  /*                                                    */
+  /* array_flag = 0:  interval i,j was found while      */
+  /* tracing back through f5-array and c-array          */
+  /* or within this block                               */
+  /*                                                    */
+  /* 00000000000000000000000000000000000000000000000000 */
+  if((array_flag == 0) && !circular){
+    int s5, s3, kj, tmp_en;
+
+    if(hc->up_ext[j]){
+      tmp_en = 0;
+      if(sc){
+        if(sc->energy_up)
+          tmp_en += sc->energy_up[j][1];
+      }
+      if (f5[j-1] + tmp_en + best_energy <= threshold) {
+        /* no basepair, nibbling of 3'-end */
+        fork_state(i, j-1, state, tmp_en, 0, env);
+      }
+    }
+
+    for (k = j-turn-1; k > 1; k--) {
+      kj = indx[j] + k;
+
+      if(with_gquad){
+        if(ON_SAME_STRAND(k,j,cp)){
+          element_energy = 0;
+          if(f5[k-1] + ggg[kj] + element_energy + best_energy <= threshold){
+            temp_state = derive_new_state(1, k-1, state, 0, 0);
+            env->nopush = false;
+            /* backtrace the quadruplex */
+            repeat_gquad(vc, k, j, temp_state, element_energy, f5[k-1], best_energy, threshold, env);
+            free_state_node(temp_state);
+          }
+        }
+      }
+
+      if(hard_constraints[kj] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+        type = ptype[kj];
+
+        if(type == 0)
+          type = 7;
+
+        /* k and j pair */
+        switch(dangle_model){
+          case 0:   s5 = s3 = -1;
+                    break;
+          default:  s5 = (ON_SAME_STRAND(k-1,k,cp)) ? S1[k-1] : -1;
+                    s3 = ((j < length)&&(ON_SAME_STRAND(j,j+1,cp))) ? S1[j+1] : -1;
+                    break;
+        }
+        
+        element_energy = E_ExtLoop(type, s5, s3, P);
+
+        if (!(ON_SAME_STRAND(k,j,cp)))/*&&(state->is_duplex==0))*/ {
+          element_energy+=P->DuplexInit;
+          /*state->is_duplex=1;*/
+        }
+
+        if (f5[k-1] + c[kj] + element_energy + best_energy <= threshold){
+          temp_state = derive_new_state(1, k-1, state, 0, 0);
+          env->nopush = false;
+          repeat(vc, k, j, temp_state, element_energy, f5[k-1], best_energy, threshold, env);
+          free_state_node(temp_state);
+        }
+      }
+    }
+
+    kj = indx[j] + 1;
+
+    if(with_gquad){
+      if(ON_SAME_STRAND(k,j,cp)){
+        element_energy = 0;
+        if(ggg[kj] + element_energy + best_energy <= threshold){
+          /* backtrace the quadruplex */
+          repeat_gquad(vc, 1, j, state, element_energy, 0, best_energy, threshold, env);
+        }
+      }
+    }
+
+    if(hard_constraints[kj] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+      type  = ptype[kj];
+      s5    = -1;
+
+      if(type == 0)
+        type = 7;
+
+      switch(dangle_model){
+        case 0:   s3 = -1;
+                  break;
+        default:  s3 = (j < length) && (ON_SAME_STRAND(j,j+1,cp)) ? S1[j+1] : -1;
+                  break;
+      }
+
+      element_energy = E_ExtLoop(type, s5, s3, P);
+
+      if(!(ON_SAME_STRAND(1,j,cp)))
+        element_energy += P->DuplexInit;
+      if (c[kj] + element_energy + best_energy <= threshold)
+        repeat(vc, 1, j, state, element_energy, 0, best_energy, threshold, env);
+    }
+  } /* end array_flag == 0 && !circular*/
+  /* or do we subopt circular? */
+  else if(array_flag == 0){
+    int k, l, p, q, tmp_en;
+    /* if we've done everything right, we will never reach this case more than once   */
+    /* right after the initilization of the stack with ([1,n], empty, 0)              */
+    /* lets check, if we can have an open chain without breaking the threshold        */
+    /* this is an ugly work-arround cause in case of an open chain we do not have to  */
+    /* backtrack anything further...                                                  */
+    if(hc->up_ext[1] >= length){
+      tmp_en = 0;
+
+      if(sc){
+        if(sc->energy_up)
+          tmp_en += sc->energy_up[1][length];
+      }
+
+      if(tmp_en <= threshold){
+        new_state = derive_new_state(1,2,state,0,0);
+        new_state->partial_energy = 0;
+        push(env->Stack, new_state);
+        env->nopush = false;
+      }
+    }
+
+    /* ok, lets check if we can do an exterior hairpin without breaking the threshold */
+    /* best energy should be 0 if we are here                                         */
+    if(FcH + best_energy <= threshold){
+      /* lets search for all exterior hairpin cases, that fit into our threshold barrier  */
+      /* we use index k,l to avoid confusion with i,j index of our state...               */
+      /* if we reach here, i should be 1 and j should be n respectively                   */
+      for(k=i; k<j; k++){
+        if(hc->up_hp[1] < k)
+          break;
+
+        for (l=j; l >= k + turn + 1; l--){
+          int kl, tmpE;
+
+          kl    = indx[l] + k;
+          tmpE  = vrna_E_hp_loop(vc, l, k);
+
+          if(c[kl] + tmpE + best_energy <= threshold){
+            /* what we really have to do is something like this, isn't it?  */
+            /* we have to create a new state, with interval [k,l], then we  */
+            /* add our loop energy as initial energy of this state and put  */
+            /* the state onto the stack R... for further refinement...      */
+            /* we also denote this new interval to be scanned in C          */
+            fork_state(k, l, state, tmpE, 2, env);
+          }
+        }
+      }
+    }
+
+    /* now lets see, if we can do an exterior interior loop without breaking the threshold */
+    if(FcI + best_energy <= threshold){
+      /* now we search for our exterior interior loop possibilities */
+      for(k=i; k<j; k++){
+        for (l=j; l >= k + turn + 1; l--){
+          int kl, type, tmpE;
+
+          kl    = indx[l]+k;        /* just confusing these indices ;-) */
+
+          if(hard_constraints[kl] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){
+            type  = ptype[kl];
+            type  = rtype[type];
+
+            if(type == 0)
+              type = 7;
+
+            for (p = l+1; p < j ; p++){
+              int u1, qmin;
+              u1 = p-l-1;
+              if (u1+k-1>MAXLOOP) break;
+              if (hc->up_int[l+1] < u1) break;
+
+              qmin = u1+k-1+j-MAXLOOP;
+              if(qmin<p+turn+1) qmin = p+turn+1;
+
+              for(q = j; q >= qmin; q--){
+                int u2, type_2;
+
+                if(hc->up_int[q+1] < (j - q + k - 1))
+                  break;
+
+                if(hard_constraints[indx[q]+p] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){
+                  type_2 = rtype[ptype[indx[q]+p]];
+
+                  if(type_2 == 0)
+                    type_2 = 7;
+
+                  u2 = k-1 + j-q;
+                  if(u1+u2>MAXLOOP) continue;
+                  tmpE = E_IntLoop(u1, u2, type, type_2, S1[l+1], S1[k-1], S1[p-1], S1[q+1], P);
+                  
+                  if(sc){
+                    if(sc->energy_up)
+                      tmpE += sc->energy_up[l+1][p-l-1]
+                              + sc->energy_up[q+1][j-q]
+                              + sc->energy_up[1][k-1];
+                    
+                    if(sc->energy_stack)
+                      if(u1 + u2 == 0)
+                        tmpE += sc->energy_stack[k]
+                                + sc->energy_stack[l]
+                                + sc->energy_stack[p]
+                                + sc->energy_stack[q];
+                  }
+
+                  if(c[kl] + c[indx[q]+p] + tmpE + best_energy <= threshold){
+                    /* ok, similar to the hairpin stuff, we add new states onto the stack R */
+                    /* but in contrast to the hairpin decomposition, we have to add two new */
+                    /* intervals, enclosed by k,l and p,q respectively and we also have to  */
+                    /* add the partial energy, that comes from the exterior interior loop   */
+                    fork_two_states(k, l, p, q, state, tmpE, 2, 2, env);
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+
+    /* and last but not least, we have a look, if we can do an exterior multiloop within the energy threshold */
+    if(FcM <= threshold){
+      /* this decomposition will be somehow more complicated...so lets see what we do here...           */
+      /* first we want to find out which split inidices we can use without exceeding the threshold */
+      int tmpE2;
+      for (k=turn+1; k<j-2*turn; k++){
+        tmpE2 = fML[indx[k]+1]+fM2[k+1]+P->MLclosing;
+        if(tmpE2 + best_energy <= threshold){
+          /* grmpfh, we have found a possible split index k so we have to split fM2 and fML now */
+          /* lets do it first in fM2 anyway */
+          for(l=k+turn+2; l<j-turn-1; l++){
+            tmpE2 = fM1[indx[l]+k+1] + fM1[indx[j]+l+1];
+            if(tmpE2 + fML[indx[k]+1] + P->MLclosing <= threshold){
+              /* we've (hopefully) found a valid decomposition of fM2 and therefor we have all */
+              /* three intervals for our new state to be pushed on stack R */
+              new_state = copy_state(state);
+
+              /* first interval leads for search in fML array */
+              new_interval = make_interval(1, k, 1);
+              push(new_state->Intervals, new_interval);
+              env->nopush = false;
+
+              /* next, we have the first interval that has to be traced in fM1 */
+              new_interval = make_interval(k+1, l, 3);
+              push(new_state->Intervals, new_interval);
+              env->nopush = false;
+
+              /* and the last of our three intervals is also one to be traced within fM1 array... */
+              new_interval = make_interval(l+1, j, 3);
+              push(new_state->Intervals, new_interval);
+              env->nopush = false;
+
+              /* mmh, we add the energy for closing the multiloop now... */
+              new_state->partial_energy += P->MLclosing;
+              /* next we push our state onto the R stack */
+              push(env->Stack, new_state);
+              env->nopush = false;
+
+            }
+            /* else we search further... */
+          }
+
+          /* ok, we have to decompose fML now... */
+        }
+      }
+    }
+  }        /* thats all folks for the circular case... */
+
+  /* 44444444444444444444444444444444444444444444444444 */
+  /*                                                    */
+  /* array_flag = 4:  interval i,j was found while      */
+  /* tracing back through fc-array smaller than than cp */
+  /* or within this block                               */
+  /*                                                    */
+  /* 44444444444444444444444444444444444444444444444444 */
+  if (array_flag == 4) {
+    int ik, s5, s3, tmp_en;
+
+    if(hc->up_ext[i]){
+      tmp_en = 0;
+
+      if(sc){
+        if(sc->energy_up)
+          tmp_en += sc->energy_up[i][1];
+      }
+
+      if (fc[i+1] + tmp_en + best_energy <= threshold) {
+        /* no basepair, nibbling of 5'-end */
+        fork_state(i+1, j, state, tmp_en, 4, env);
+      }
+    }
+
+    for (k = i+TURN+1; k < j; k++) {
+
+      ik = indx[k] + i;
+
+      if(with_gquad){
+        if(fc[k+1] + ggg[ik] + best_energy <= threshold){
+          temp_state = derive_new_state(k+1, j, state, 0, 4);
+          env->nopush = false;
+          repeat_gquad(vc, i, k, temp_state, 0, fc[k+1], best_energy, threshold, env);
+          free_state_node(temp_state);
+        }
+      }
+
+      if(hard_constraints[ik] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+        type = ptype[ik];
+
+        if(type == 0)
+          type = 7;
+
+        switch(dangle_model){
+          case 0:   s5 = s3 = -1;
+                    break;
+          default:  s5 = (i > 1) ? S1[i-1]: -1;
+                    s3 = S1[k+1];
+                    break;
+        }
+
+        element_energy = E_ExtLoop(type, s5, s3, P);
+
+/* should be unnecessary
+        if(sc){
+          if(sc->energy_bp)
+            element_energy += sc->energy_bp[ik];
+        }
+*/
+
+        if (fc[k+1] + c[ik] + element_energy + best_energy <= threshold){
+          temp_state = derive_new_state(k+1, j, state, 0, 4);
+          env->nopush = false;
+          repeat(vc, i, k, temp_state, element_energy, fc[k+1], best_energy, threshold, env);
+          free_state_node(temp_state);
+        }
+      }
+    }
+
+    ik = indx[cp -1] + i; /* indx[j] + i; */
+
+    if(with_gquad){
+      if(ggg[ik] + best_energy <= threshold)
+        repeat_gquad(vc, i, cp - 1, state, 0, 0, best_energy, threshold, env);
+    }
+
+    if(hard_constraints[ik] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+      type  = ptype[ik];
+      s3    = -1;
+
+      if(type == 0)
+        type = 7;
+
+      switch(dangle_model){
+        case 0:   s5 = -1;
+                  break;
+        default:  s5 = (i>1) ? S1[i-1] : -1;
+                  break;
+      }
+
+      element_energy = E_ExtLoop(type, s5, s3, P);
+
+/* should be unnecessary
+      if(sc){
+        if(sc->energy_bp)
+          element_energy += sc->energy_bp[ik];
+      }
+*/
+
+      if(c[ik] + element_energy + best_energy <= threshold)
+        repeat(vc, i, cp-1, state, element_energy, 0, best_energy, threshold, env);
+    }
+  } /* array_flag == 4 */
+
+  /* 55555555555555555555555555555555555555555555555555 */
+  /*                                                    */
+  /* array_flag = 5:  interval cp=i,j was found while   */
+  /* tracing back through fc-array greater than cp      */
+  /* or within this block                               */
+  /*                                                    */
+  /* 55555555555555555555555555555555555555555555555555 */
+  if (array_flag == 5) {
+    int kj, s5, s3, tmp_en;
+
+    if(hc->up_ext[j]){
+      tmp_en = 0;
+
+      if(sc){
+        if(sc->energy_up)
+          tmp_en += sc->energy_up[j][1];
+      }
+
+      if (fc[j-1] + tmp_en + best_energy <= threshold) {
+        /* no basepair, nibbling of 3'-end */
+        fork_state(i, j-1, state, tmp_en, 5, env);
+      }
+    }
+
+
+    for (k = j-TURN-1; k > i; k--) {
+      kj = indx[j] + k;
+
+      if(with_gquad){
+        if(fc[k-1] + ggg[kj] + best_energy <= threshold){
+          temp_state = derive_new_state(i, k-1, state, 0, 5);
+          env->nopush = false;
+          repeat_gquad(vc, k, j, temp_state, 0, fc[k-1], best_energy, threshold, env);
+          free_state_node(temp_state);
+        }
+      }
+
+      if(hard_constraints[kj] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+        type            = ptype[kj];
+        element_energy  = 0;
+
+        if(type == 0)
+          type = 7;
+
+        switch(dangle_model){
+          case 0:   s3 = s5 = -1;
+                    break;
+          default:  s5 = S1[k-1];
+                    s3 = (j < length) ? S1[j+1] : -1;
+                    break;
+        }
+
+        element_energy = E_ExtLoop(type, s5, s3, P);
+
+/*  should be unnecessary
+        if(sc){
+          if(sc->energy_bp)
+            element_energy += sc->energy_bp[kj];
+        }
+*/
+
+        if (fc[k-1] + c[kj] + element_energy + best_energy <= threshold) {
+          temp_state = derive_new_state(i, k-1, state, 0, 5);
+          env->nopush = false;
+          repeat(vc, k, j, temp_state, element_energy, fc[k-1], best_energy, threshold, env);
+          free_state_node(temp_state);
+        }
+      }
+    }
+
+    kj = indx[j] + cp; /* indx[j] + i; */
+
+    if(with_gquad){
+      if(ggg[kj] + best_energy <= threshold)
+        repeat_gquad(vc, cp, j, state, 0, 0, best_energy, threshold, env);
+    }
+
+    if(hard_constraints[kj] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+      type  = ptype[kj];
+      s5    = -1;
+
+      if(type == 0)
+        type = 7;
+
+      switch(dangle_model){
+        case 0:   s3 = -1;
+                  break;
+        default:  s3 = (j<length) ? S1[j+1] : -1;
+                  break;
+      }
+
+      element_energy = E_ExtLoop(type, s5, s3, P);
+
+      if (c[kj] + element_energy + best_energy <= threshold)
+        repeat(vc, cp, j, state, element_energy, 0, best_energy, threshold, env);
+    }
+  } /* array_flag == 5 */
+
+  if (array_flag == 6) { /* we have a gquad */
+    repeat_gquad(vc, i, j, state, 0, 0, best_energy, threshold, env);
+    if (env->nopush){
+      vrna_message_warning("%d,%d\nOops, no solution in gquad-repeat!", i, j);
+    }
+    return;
+  }
+
+  if (env->nopush){
+    push_back(env->Stack, state);
+    env->nopush = false;
+  }
+  return;
+}
+
+/*---------------------------------------------------------------------------*/
+PRIVATE void
+repeat_gquad( vrna_fold_compound_t *vc,
+              int i,
+              int j,
+              STATE *state,
+              int part_energy,
+              int temp_energy,
+              int best_energy,
+              int threshold,
+              subopt_env *env){
+
+  int           *ggg, *indx, element_energy, cp;
+  short         *S1;
+  vrna_param_t  *P;
+
+  indx  = vc->jindx;
+  cp    = vc->cutpoint;
+  ggg   = vc->matrices->ggg;
+  S1    = vc->sequence_encoding;
+  P     = vc->params;
+
+
+  /* find all gquads that fit into the energy range and the interval [i,j] */
+  STATE *new_state;
+  best_energy += part_energy; /* energy of current structural element */
+  best_energy += temp_energy; /* energy from unpushed interval */
+
+  if(ON_SAME_STRAND(i,j,cp)){
+    element_energy = ggg[indx[j] + i];
+    if(element_energy + best_energy <= threshold){
+      int cnt;
+      int *L;
+      int *l;
+      /* find out how many gquads we might expect in the interval [i,j] */
+      int num_gquads = get_gquad_count(S1, i, j);
+      num_gquads++;
+      L = (int *)vrna_alloc(sizeof(int) * num_gquads);
+      l = (int *)vrna_alloc(sizeof(int) * num_gquads * 3);
+      L[0] = -1;
+
+      get_gquad_pattern_exhaustive(S1, i, j, P, L, l, threshold - best_energy);
+
+      for(cnt = 0; L[cnt] != -1; cnt++){
+        new_state = copy_state(state);
+
+        make_gquad(i, L[cnt], &(l[3*cnt]), new_state);
+        new_state->partial_energy += part_energy;
+        new_state->partial_energy += element_energy;
+        /* new_state->best_energy =
+           hairpin[unpaired] + element_energy + best_energy; */
+        push(env->Stack, new_state);
+        env->nopush = false;
+      }
+      free(L);
+      free(l);
+    }
+  }
+
+  best_energy -= part_energy;
+  best_energy -= temp_energy;
+  return;
+}
+
+
+
+PRIVATE void
+repeat( vrna_fold_compound_t *vc,
+        int i,
+        int j,
+        STATE * state,
+        int part_energy,
+        int temp_energy,
+        int best_energy,
+        int threshold,
+        subopt_env *env){
+
+  /* routine to find stacks, bulges, internal loops and  multiloops */
+  /* within interval closed by basepair i,j */
+
+  STATE           *new_state;
+  vrna_param_t    *P;
+  vrna_md_t       *md;
+
+  register int  ij, k, p, q, energy, new;
+  register int  mm;
+  register int  no_close, type, type_2;
+  char          *ptype;
+  int           element_energy;
+  int             *fc, *c, *fML, *fM1, *ggg;
+  int           rt, *indx, *rtype, noGUclosure, noLP, with_gquad, dangle_model, turn, cp;
+  short         *S1;
+  vrna_hc_t     *hc;
+  vrna_sc_t     *sc;
+
+  S1        = vc->sequence_encoding;
+  ptype     = vc->ptype;
+  indx      = vc->jindx;
+  cp        = vc->cutpoint;
+  P         = vc->params;
+  md        = &(P->model_details);
+  rtype     = &(md->rtype[0]);
+
+  noGUclosure   = md->noGUclosure;
+  noLP          = md->noLP;
+  with_gquad    = md->gquad;
+  dangle_model  = md->dangles;
+  turn          = md->min_loop_size;
+
+  fc  = vc->matrices->fc;
+  c   = vc->matrices->c;
+  fML = vc->matrices->fML;
+  fM1 = vc->matrices->fM1;
+  ggg = vc->matrices->ggg;
+
+  hc    = vc->hc;
+  sc    = vc->sc;
+
+  ij = indx[j]+i;
+
+  type = ptype[ij];
+/*
+  if (type==0) fprintf(stderr, "repeat: Warning: %d %d can't pair\n", i,j);
+*/
+
+  if(type == 0)
+    type = 7;
+
+  no_close = (((type == 3) || (type == 4)) && noGUclosure);
+
+  if(hc->matrix[ij] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){
+    if (noLP) /* always consider the structure with additional stack */
+      if(i + turn + 2 < j){
+        if(hc->matrix[indx[j-1]+i+1] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC){
+          type_2 = rtype[ptype[indx[j-1]+i+1]];
+
+          if(type_2 == 0)
+            type_2 = 7;
+
+          energy = 0;
+
+          if(ON_SAME_STRAND(i,i+1,cp) && ON_SAME_STRAND(j-1,j, cp)){
+            energy = E_IntLoop(0, 0, type, type_2,S1[i+1],S1[j-1],S1[i+1],S1[j-1], P);
+
+            if(sc){
+              if(sc->energy_bp)
+                energy += sc->energy_bp[ij];
+
+              if(sc->energy_stack)
+                energy += sc->energy_stack[i]
+                          + sc->energy_stack[i+1]
+                          + sc->energy_stack[j-1]
+                          + sc->energy_stack[j];
+
+              if(sc->f)
+                energy += sc->f(i, j, i+1, j-1, VRNA_DECOMP_PAIR_IL, sc->data);
+            }
+
+            new_state = derive_new_state(i+1, j-1, state, part_energy + energy, 2);
+            make_pair(i, j, new_state);
+            make_pair(i+1, j-1, new_state);
+
+            /* new_state->best_energy = new + best_energy; */
+            push(env->Stack, new_state);
+            env->nopush = false;
+            if (i==1 || state->structure[i-2]!='('  || state->structure[j]!=')')
+              /* adding a stack is the only possible structure */
+              return;
+          }
+        }
+      }
+  }
+
+  best_energy += part_energy; /* energy of current structural element */
+  best_energy += temp_energy; /* energy from unpushed interval */
+
+  if(hc->matrix[ij] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP){
+    for (p = i + 1; p <= MIN2 (j-2-turn,  i+MAXLOOP+1); p++) {
+      int minq = j-i+p-MAXLOOP-2;
+      if (minq<p+1+turn) minq = p+1+turn;
+
+      if(hc->up_int[i+1] < (p - i - 1))
+        break;
+
+      for (q = j - 1; q >= minq; q--) {
+        if(hc->up_int[q+1] < (j - q - 1))
+          break;
+
+        /* skip stack if noLP, since we've already processed it above */
+        if((noLP) && (p==i+1) && (q==j-1))
+          continue;
+
+        if(!(hc->matrix[indx[q]+p] & VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC))
+          continue;
+
+        type_2 = ptype[indx[q]+p];
+
+        if(type_2 == 0)
+          type_2 = 7;
+
+        if (noGUclosure)
+          if (no_close||(type_2==3)||(type_2==4))
+            if ((p>i+1)||(q<j-1)) continue;  /* continue unless stack */
+
+        if (ON_SAME_STRAND(i,p,cp) && ON_SAME_STRAND(q,j,cp)) {
+          energy = E_IntLoop(p-i-1, j-q-1, type, rtype[type_2],
+                              S1[i+1],S1[j-1],S1[p-1],S1[q+1], P);
+
+          new = energy + c[indx[q]+p];
+
+          if(sc){
+            if(sc->energy_up)
+              energy  +=  sc->energy_up[i+1][p-i-1]
+                          + sc->energy_up[q+1][j-q-1];
+
+            if(sc->energy_bp)
+              energy  += sc->energy_bp[ij];
+
+            if(sc->energy_stack)
+              if((p == i+1) && (q == j-1))
+                energy  +=  sc->energy_stack[i]
+                            + sc->energy_stack[p]
+                            + sc->energy_stack[q]
+                            + sc->energy_stack[j];
+
+            if(sc->f)
+              energy  += sc->f(i, j, p, q, VRNA_DECOMP_PAIR_IL, sc->data);
+          }
+
+          new = energy + c[indx[q]+p];
+
+          if (new + best_energy <= threshold) {
+            /* stack, bulge, or interior loop */
+            fork_int_state(i, j, p, q, state, part_energy + energy, env);
+          }
+        }/*end of if block */
+      } /* end of q-loop */
+    } /* end of p-loop */
+  }
+
+  if (!ON_SAME_STRAND(i,j,cp)) { /*look in fc*/
+    if(hc->matrix[ij] & VRNA_CONSTRAINT_CONTEXT_EXT_LOOP){
+      rt = rtype[type];
+
+      if(rt == 0)
+        rt = 7;
+
+      element_energy=0;
+      switch(dangle_model){
+        case 0:   element_energy = E_ExtLoop(rt, -1, -1, P);
+                  break;
+        default:  element_energy = E_ExtLoop(rt, (ON_SAME_STRAND(j-1,j,cp)) ? S1[j-1] : -1, (ON_SAME_STRAND(i,i+1,cp)) ? S1[i+1] : -1, P);
+                  break;
+      }
+
+      if (fc[i+1] + fc[j-1] +element_energy + best_energy  <= threshold)
+        {
+          fork_two_states_pair(i, j, cp, state, part_energy + element_energy, 4, 5, env);
+        }
+    }
+  }
+
+  mm = P->MLclosing;
+  rt = rtype[type];
+
+  if((hc->matrix[ij] & VRNA_CONSTRAINT_CONTEXT_MB_LOOP) && (i != cp-1) && (j != cp)){
+
+    if(rt == 0)
+      rt = 7;
+
+    element_energy = mm;
+    switch(dangle_model){
+      case 0:   element_energy = E_MLstem(rt, -1, -1, P) + mm;
+                break;
+      default:  element_energy = E_MLstem(rt, S1[j-1], S1[i+1], P) + mm;
+                break;
+    }
+
+    if(sc){
+      if(sc->energy_bp)
+        element_energy += sc->energy_bp[ij];
+    }
+
+    for (k = i + turn + 2; k <= j - turn - 2; k++)  {
+      /* multiloop decomposition */
+      if ((fML[indx[k-1] + i+1] + fM1[indx[j-1] + k] +
+          element_energy + best_energy)  <= threshold)
+        {
+          fork_two_states_pair(i, j, k, state, part_energy + element_energy, 1, 3, env);
+        }
+    }
+  }
+
+  if (ON_SAME_STRAND(i,j,cp)) {
+    if(hc->matrix[ij] & VRNA_CONSTRAINT_CONTEXT_HP_LOOP){
+
+      if(no_close)
+        element_energy = FORBIDDEN;
+      else
+          element_energy = vrna_E_hp_loop(vc, i, j);
+
+      if (element_energy + best_energy <= threshold) {
+        /* hairpin structure */
+        fork_state_pair(i, j, state, part_energy + element_energy, env);
+      }
+    }
+
+    if(with_gquad){
+      /* now we have to find all loops where (i,j) encloses a gquad in an interior loops style */
+      int cnt, *p, *q, *en, tmp_en;
+      p = q = en = NULL;
+      en = E_GQuad_IntLoop_exhaustive(i, j, &p, &q, type, S1, ggg, threshold - best_energy, indx, P);
+      for(cnt = 0; p[cnt] != -1; cnt++){
+        if((hc->up_int[i+1] >= p[cnt] - i - 1) && (hc->up_int[q[cnt]+1] >= j - q[cnt] - 1)){
+          tmp_en = en[cnt];
+
+          if(sc){
+            if(sc->energy_bp)
+              tmp_en += sc->energy_bp[ij];
+
+            if(sc->energy_up)
+              tmp_en += sc->energy_up[i+1][p[cnt] - i - 1]
+                        + sc->energy_up[q[cnt]+1][j - q[cnt] - 1];
+          }
+
+          new_state = derive_new_state(p[cnt], q[cnt], state, tmp_en + part_energy, 6);
+
+          make_pair(i, j, new_state);
+
+          /* new_state->best_energy = new + best_energy; */
+          push(env->Stack, new_state);
+          env->nopush = false;
+        }
+      }
+      free(en);
+      free(p);
+      free(q);
+    }
+  }
+
+  best_energy -= part_energy;
+  best_energy -= temp_energy;
+  return;
+}
+
+PRIVATE void
+old_subopt_print( const char *structure,
+                  float energy,
+                  void *data){
+
+  struct old_subopt_dat *d = (struct old_subopt_dat *)data;
+
+  if(structure && d->fp){
+    char *e_string = vrna_strdup_printf(" %6.2f", energy);
+    print_structure(d->fp, structure, e_string);
+    free(e_string);
+  }
+}
+
+
+PRIVATE void
+old_subopt_store( const char *structure,
+                  float energy,
+                  void *data){
+
+  struct old_subopt_dat *d = (struct old_subopt_dat *)data;
+
+  /* store solution */
+  if(d->n_sol + 1 == d->max_sol){
+    d->max_sol     *= 2;
+    d->SolutionList = (SOLUTION *)vrna_realloc(d->SolutionList, d->max_sol*sizeof(SOLUTION));
+  }
+
+  if(structure){
+    d->SolutionList[d->n_sol].energy      = energy;
+    d->SolutionList[d->n_sol++].structure = strdup(structure);
+  } else {
+    d->SolutionList[d->n_sol].energy      = 0;
+    d->SolutionList[d->n_sol++].structure = NULL;
+  }
+}
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+#ifdef VRNA_BACKWARD_COMPAT
+
+PUBLIC SOLUTION *
+subopt( char *seq,
+        char *structure,
+        int delta,
+        FILE *fp){
+
+  return wrap_subopt(seq, structure, NULL, delta, fold_constrained, 0, fp);
+}
+
+PUBLIC SOLUTION *
+subopt_circ(char *seq,
+            char *structure,
+            int delta,
+            FILE *fp){
+
+  return wrap_subopt(seq, structure, NULL, delta, fold_constrained, 1, fp);
+}
+
+PUBLIC SOLUTION *subopt_par(char *seq,
+                            char *structure,
+                            vrna_param_t *parameters,
+                            int delta,
+                            int is_constrained,
+                            int is_circular,
+                            FILE *fp){
+
+  return wrap_subopt(seq, structure, parameters, delta, is_constrained, is_circular, fp);
+}
+
+PRIVATE SOLUTION *
+wrap_subopt(char *string,
+            char *structure,
+            vrna_param_t *parameters,
+            int delta,
+            int is_constrained,
+            int is_circular,
+            FILE *fp){
+
+  vrna_fold_compound_t  *vc;
+  vrna_param_t        *P;
+  char                *seq;
+
+#ifdef _OPENMP
+/* Explicitly turn off dynamic threads */
+  omp_set_dynamic(0);
+#endif
+
+  /* we need the parameter structure for hard constraints */
+  if(parameters){
+    P = vrna_params_copy(parameters);
+  } else {
+    vrna_md_t md;
+    set_model_details(&md);
+    md.temperature = temperature;
+    P = vrna_params(&md);
+  }
+  P->model_details.circ     = is_circular;
+  P->model_details.uniq_ML  = uniq_ML = 1;
+
+  /* what about cofold sequences here? Is it safe to call the below cut_point_insert() ? */
+  /* dirty hack to reinsert the '&' according to the global variable 'cut_point' */
+  seq = vrna_cut_point_insert(string, cut_point);
+
+  vc = vrna_fold_compound(seq, &(P->model_details), ((is_circular == 0) ? VRNA_OPTION_HYBRID : VRNA_OPTION_DEFAULT));
+
+  if(parameters){ /* replace params if necessary */
+    free(vc->params);
+    vc->params = P;
+  } else {
+    free(P);
+  }
+
+  /* handle hard constraints in pseudo dot-bracket format if passed via simple interface */
+  if(is_constrained && structure){
+    unsigned int constraint_options = 0;
+    constraint_options |= VRNA_CONSTRAINT_DB
+                          | VRNA_CONSTRAINT_DB_PIPE
+                          | VRNA_CONSTRAINT_DB_DOT
+                          | VRNA_CONSTRAINT_DB_X
+                          | VRNA_CONSTRAINT_DB_ANG_BRACK
+                          | VRNA_CONSTRAINT_DB_RND_BRACK
+                          | VRNA_CONSTRAINT_DB_INTRAMOL
+                          | VRNA_CONSTRAINT_DB_INTERMOL;
+
+    vrna_constraints_add(vc, (const char *)structure, constraint_options);
+  }
+
+  if(backward_compat_compound && backward_compat)
+    vrna_fold_compound_free(backward_compat_compound);
+
+  backward_compat_compound  = vc;
+  backward_compat           = 1;
+
+  /* cleanup */
+  free(seq);
+
+  return vrna_subopt(vc, delta, subopt_sorted, fp);
+}
+
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* Well, that is the end!----------------------------------------------------*/
+/*---------------------------------------------------------------------------*/
diff --git a/C/ViennaRNA/subopt.h b/C/ViennaRNA/subopt.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/subopt.h
@@ -0,0 +1,280 @@
+/* subopt.h */
+#ifndef VIENNA_RNA_PACKAGE_SUBOPT_H
+#define VIENNA_RNA_PACKAGE_SUBOPT_H
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file subopt.h
+ *  @ingroup subopt_and_representatives
+ *  @brief RNAsubopt and density of states declarations
+ */
+
+#define VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief Typename for the subopt solution list repesenting data structure #vrna_subopt_sol_s
+ */
+typedef struct vrna_subopt_sol_s   vrna_subopt_solution_t;
+
+/**
+ *  @brief  Callback for vrna_subopt_cb()
+ *  @ingroup subopt_wuchty
+ */
+typedef void (vrna_subopt_callback)(const char *stucture, float energy, void *data);
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief  Backward compatibility typedef for #vrna_subopt_sol_s
+ *  @deprecated Use #vrna_subopt_solution_t instead!
+ */
+typedef struct vrna_subopt_sol_s   SOLUTION;
+
+#endif
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/params.h>
+
+
+/**
+ *  @brief  Solution element from subopt.c
+ */
+struct vrna_subopt_sol_s {
+  float energy;       /**< @brief Free Energy of structure in kcal/mol */
+  char *structure;    /**< @brief Structure in dot-bracket notation */
+};
+
+/**
+ *  @brief Maximum density of states discretization for subopt
+ */
+#define MAXDOS                1000
+
+/**
+ *  @addtogroup subopt_wuchty
+ *  @{
+ *
+ *  @}
+ */
+
+/**
+ *  @brief Returns list of subopt structures or writes to fp
+ * 
+ *  This function produces <b>all</b> suboptimal secondary structures within
+ *  'delta' * 0.01 kcal/mol of the optimum, see @cite wuchty:1999. The results
+ *  are either directly written to a 'fp' (if 'fp' is not NULL), or
+ *  (fp==NULL) returned in a #vrna_subopt_solution_t * list terminated
+ *  by an entry were the 'structure' member is NULL.
+ *
+ *  @ingroup subopt_wuchty
+ *
+ *  @note This function requires all multibranch loop DP matrices for unique
+ *        multibranch loop backtracing. Therefore, the supplied #vrna_fold_compound_t
+ *        @p vc (argument 1) must be initialized with #vrna_md_t.uniq_ML = 1, for
+ *        instance like this:
+ *        @code
+  vrna_md_t md;
+  vrna_md_set_default(&md);
+  md.uniq_ML = 1;
+
+  vrna_fold_compound_t *vc=vrna_fold_compound("GGGGGGAAAAAACCCCCC", &md, VRNA_OPTION_DEFAULT);
+ *        @endcode
+ *
+ *  @see vrna_subopt_cb(), vrna_subopt_zuker()
+ *  @param  vc
+ *  @param  delta
+ *  @param  sorted  Sort results by energy in ascending order
+ *  @param  fp
+ *  @return
+ */
+vrna_subopt_solution_t *
+vrna_subopt(vrna_fold_compound_t *vc,
+            int delta,
+            int sorted,
+            FILE *fp);
+
+/**
+ *  @brief  Generate suboptimal structures within an energy band arround the MFE
+ *
+ *  This is the most generic implementation of the suboptimal structure generator
+ *  according to Wuchty et al. 1999 @cite wuchty:1999. Identical to vrna_subopt(), it computes all
+ *  secondary structures within an energy band @p delta arround the MFE. However,
+ *  this function does not print the resulting structures and their corresponding
+ *  free energies to a file pointer, or returns them as a list. Instead, it calls
+ *  a user-provided callback function which it passes the structure in dot-bracket
+ *  format, the corresponding free energy in kcal/mol, and a user-provided data
+ *  structure each time a structure was backtracked successfully. This function
+ *  indicates the final output, i.e. the end of the backtracking procedure by
+ *  passing NULL instead of an actual dot-bracket string to the callback.
+ *
+ *  @ingroup subopt_wuchty
+ *
+ *  @note This function requires all multibranch loop DP matrices for unique
+ *        multibranch loop backtracing. Therefore, the supplied #vrna_fold_compound_t
+ *        @p vc (argument 1) must be initialized with #vrna_md_t.uniq_ML = 1, for
+ *        instance like this:
+ *        @code
+  vrna_md_t md;
+  vrna_md_set_default(&md);
+  md.uniq_ML = 1;
+
+  vrna_fold_compound_t *vc=vrna_fold_compound("GGGGGGAAAAAACCCCCC", &md, VRNA_OPTION_DEFAULT);
+ *        @endcode
+ *
+ *  @see vrna_subopt_callback, vrna_subopt(), vrna_subopt_zuker()
+ *  @param  vc      fold compount with the sequence data
+ *  @param  delta   Energy band arround the MFE in 10cal/mol, i.e. deka-calories
+ *  @param  cb      Pointer to a callback function that handles the backtracked structure and its free energy in kcal/mol
+ *  @param  data    Pointer to some data structure that is passed along to the callback
+ */
+void
+vrna_subopt_cb( vrna_fold_compound_t *vc,
+                int delta,
+                vrna_subopt_callback *cb,
+                void *data);
+
+/**
+ *  @brief Compute Zuker type suboptimal structures
+ *
+ *  Compute Suboptimal structures according to M. Zuker @cite zuker:1989 , i.e. for every
+ *  possible base pair the minimum energy structure containing the resp. base pair.
+ *  Returns a list of these structures and their energies.
+ *
+ *  @note This function internally uses the cofold implementation to compute
+ *        the suboptimal structures. For that purpose, the function doubles
+ *        the sequence and enlarges the DP matrices, which in fact will grow
+ *        by a factor of 4 during the computation!
+ *        At the end of the structure prediction, everything will be re-set
+ *        to its original requriements, i.e. normal sequence, normal (empty)
+ *        DP matrices.
+ *
+ *  @bug  Due to resizing, any pre-existing constraints will be lost!
+ *
+ *  @ingroup subopt_zuker
+ *
+ *  @see vrna_subopt(), zukersubopt(), zukersubopt_par()
+ *
+ *  @param  vc  fold compound
+ *  @return     List of zuker suboptimal structures
+ */
+vrna_subopt_solution_t *
+vrna_subopt_zuker(vrna_fold_compound_t *vc);
+
+/**
+ *  @brief printing threshold for use with logML
+ * 
+ *  @ingroup subopt_wuchty
+ *
+ */
+extern  double  print_energy;
+
+/**
+ *  @brief Sort output by energy
+ * 
+ *  @ingroup subopt_wuchty
+ *
+ */
+extern  int     subopt_sorted;
+
+/**
+ *  @addtogroup dos
+ *  @{
+ */
+
+/**
+ *  @brief The Density of States
+ *
+ *  This array contains the density of states for an RNA sequences after a call to subopt_par(),
+ *  subopt() or subopt_circ().
+ *
+ *  @pre  Call one of the functions subopt_par(), subopt() or subopt_circ() prior accessing the contents
+ *        of this array
+ *  @see  subopt_par(), subopt(), subopt_circ()
+ *
+ */
+extern  int     density_of_states[MAXDOS+1];
+
+/** @} */ /* End of group dos */
+
+#ifdef VRNA_BACKWARD_COMPAT
+
+/**
+ *  @brief Returns list of subopt structures or writes to fp
+ * 
+ *  This function produces <b>all</b> suboptimal secondary structures within
+ *  'delta' * 0.01 kcal/mol of the optimum. The results are either
+ *  directly written to a 'fp' (if 'fp' is not NULL), or
+ *  (fp==NULL) returned in a #SOLUTION * list terminated
+ *  by an entry were the 'structure' pointer is NULL.
+ *
+ *  @ingroup subopt_wuchty
+ *
+ *  @param  seq
+ *  @param  structure
+ *  @param  delta
+ *  @param  fp
+ *  @return
+ */
+DEPRECATED(SOLUTION *subopt (char *seq, char *structure, int delta, FILE *fp));
+
+/**
+ *  @brief Returns list of subopt structures or writes to fp
+ * 
+ *  @ingroup subopt_wuchty
+ */
+DEPRECATED(SOLUTION *subopt_par(char *seq, char *structure, vrna_param_t *parameters, int delta, int is_constrained, int is_circular, FILE *fp));
+
+/**
+ *  @brief Returns list of circular subopt structures or writes to fp
+ * 
+ *  This function is similar to subopt() but calculates secondary structures
+ *  assuming the RNA sequence to be circular instead of linear
+ * 
+ *  @ingroup subopt_wuchty
+ *
+ *  @param  seq
+ *  @param  sequence
+ *  @param  delta
+ *  @param  fp
+ *  @return
+ */
+DEPRECATED(SOLUTION *subopt_circ(char *seq, char *sequence, int delta, FILE *fp));
+
+/**
+ *  @brief Compute Zuker type suboptimal structures
+ *
+ *  Compute Suboptimal structures according to M. Zuker, i.e. for every
+ *  possible base pair the minimum energy structure containing the resp. base pair.
+ *  Returns a list of these structures and their energies.
+ *
+ *  @ingroup subopt_zuker
+ *
+ *  @deprecated use vrna_zukersubopt() instead
+ *
+ *  @param  string  RNA sequence
+ *  @return         List of zuker suboptimal structures
+ */
+DEPRECATED(SOLUTION  *zukersubopt(const char *string));
+
+/**
+ *  @brief Compute Zuker type suboptimal structures
+ *
+ *  @ingroup subopt_zuker
+ *
+ *  @deprecated use vrna_zukersubopt() instead
+ *
+ */
+DEPRECATED(SOLUTION  *zukersubopt_par(const char *string, vrna_param_t *parameters));
+
+
+#endif
+
+#endif
diff --git a/C/ViennaRNA/svm_utils.c b/C/ViennaRNA/svm_utils.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/svm_utils.c
@@ -0,0 +1,478 @@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <ctype.h>
+#include <string.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/fold_vars.h"
+#include "ViennaRNA/pair_mat.h"
+#include "svm_utils.h"
+
+#include "ViennaRNA/model_avg.inc"  /* defines avg_model_string */
+#include "ViennaRNA/model_sd.inc"   /* defines sd_model_string */
+
+
+
+PRIVATE struct svm_model *avg_model;
+PRIVATE struct svm_model *sd_model;
+
+PRIVATE void    freeFields(char** fields);
+PRIVATE char**  splitFields(char* string);
+PRIVATE char**  splitLines(char* string);
+
+PUBLIC float get_z(char *sequence, double energy) {
+  double average_free_energy;
+  double sd_free_energy;
+  float my_z = 0.;
+  int info_avg;
+  make_pair_matrix();
+  short *S      = encode_sequence(sequence, 0);
+  unsigned int   length  = strlen(sequence);
+  int   *AUGC   = get_seq_composition(S, 1, length, length);
+  avg_model     = svm_load_model_string(avg_model_string);
+  sd_model      = svm_load_model_string(sd_model_string);
+  average_free_energy = avg_regression(AUGC[0],AUGC[1],AUGC[2],AUGC[3],AUGC[4], avg_model, &info_avg);
+
+  if(info_avg == 0){
+    double difference = (energy/* /100*/) - average_free_energy;
+    sd_free_energy    = sd_regression(AUGC[0], AUGC[1], AUGC[2], AUGC[3], AUGC[4], sd_model);
+    my_z              = difference / sd_free_energy;
+  }
+  else{
+    vrna_message_warning("sequence out of bounds");
+#if 0
+    my_z = shuffle_score(sequence, energy);
+#endif
+  }
+  free(AUGC);
+  free(S);
+  svm_free_model_content(avg_model);
+  svm_free_model_content(sd_model);
+  return my_z;
+}
+
+PUBLIC int *get_seq_composition(short *S, unsigned int start, unsigned int stop, unsigned int length){
+  unsigned int i;
+  int *ret = (int *)vrna_alloc(sizeof(int) * 6);
+
+  for (i=MAX2(start, 1); i <= MIN2(stop, length); i++){
+    if(S[i] > 4)  ret[0]++;
+    else          ret[S[i]]++;
+  }
+  ret[5] = -1; /* indicate last entry */
+  return ret;
+}
+
+PUBLIC double sd_regression(int N, int A, int C, int G, int T,  struct svm_model *sd_model){
+  double sd_free_energy = 0.0;
+  int length = A + C + G + T + N;
+  double GC_content  = (double) (G + C)/length;
+  double AT_ratio    = (double) A/(A+T);
+  double CG_ratio    = (double) C/(C+G);
+  double norm_length = (double) (length-50)/350.0;
+  struct svm_node node_mono[5];
+
+  node_mono[0].index = 1; node_mono[0].value = GC_content;
+  node_mono[1].index = 2; node_mono[1].value = AT_ratio;
+  node_mono[2].index = 3; node_mono[2].value = CG_ratio;
+  node_mono[3].index = 4; node_mono[3].value = norm_length;
+  node_mono[4].index =-1;
+
+  sd_free_energy = svm_predict(sd_model,node_mono);
+
+  sd_free_energy = (double) sd_free_energy * sqrt(length);
+
+  return sd_free_energy;
+}
+
+PUBLIC double avg_regression(int N, int A, int C, int G, int T, struct svm_model *avg_model, int *info ){
+  double average_free_energy = 0.0;
+
+  int length = A + C + G + T + N;
+  double N_fraction = (double) N/length;
+  double GC_content = (double) (G + C)/length;
+  double AT_ratio   = (double) A/(A+T);
+  double CG_ratio   = (double) C/(C+G);
+
+  double norm_length = (double) (length-50)/350.0;
+
+  struct svm_node node_mono[5];
+  *info = 0;
+  if ( length < 50 || length > 400 ) {
+    *info = 1;
+    return 0.0;
+  }
+  if ( N_fraction > 0.05 ) {
+    *info = 2;
+    return 0.0;
+  }
+  if ( GC_content < 0.20 || GC_content > 0.80 ) {
+    *info = 3;
+    return 0.0;
+  }
+  if ( AT_ratio < 0.20 || AT_ratio > 0.80 ) {
+    *info = 4;
+    return 0.0;
+  }
+  if ( CG_ratio < 0.20 || CG_ratio > 0.80 ) {
+    *info = 5;
+    return 0.0;
+  }
+
+  node_mono[0].index = 1; node_mono[0].value = GC_content;
+  node_mono[1].index = 2; node_mono[1].value = AT_ratio;
+  node_mono[2].index = 3; node_mono[2].value = CG_ratio;
+  node_mono[3].index = 4; node_mono[3].value = norm_length;
+  node_mono[4].index =-1;
+
+  average_free_energy = svm_predict(avg_model,node_mono);
+
+  average_free_energy = (double) average_free_energy * length;
+
+  return average_free_energy;
+}
+
+PUBLIC double minimal_sd(int N, int A, int C, int G, int T ){
+  int length = A + C + G + T + N;
+  if ( length <  60 ) return 0.450324;
+  if ( length <  70 ) return 0.749771;
+  if ( length <  80 ) return 1.029421;
+  if ( length <  90 ) return 1.027517;
+  if ( length <  100 ) return 1.347283;
+  if ( length <  120 ) return 1.112086;
+  if ( length <  150 ) return 1.574339;
+  if ( length <  170 ) return 1.779043;
+  if ( length <  200 ) return 1.922908;
+  if ( length <  250 ) return 2.226856;
+  if ( length <  300 ) return 2.349300;
+  if ( length <  350 ) return 2.589703;
+  if ( length <  400 ) return 2.791215;
+
+  return 0.450324;
+}
+
+PUBLIC struct svm_model  *svm_load_model_string(char *modelString){
+
+  /* redefinition from svm.cpp */
+  char *svm_type_table[]={"c_svc","nu_svc","one_class","epsilon_svr","nu_svr",NULL};
+  char *kernel_type_table[]={"linear","polynomial","rbf","sigmoid",NULL};
+
+  struct svm_model *model;
+  char **lines, **fields;
+  int i,j,k,l,m;
+  char *key, *value, *field;
+  char c;
+  int dataStart, elements;
+  int isColon;
+  struct svm_node *x_space=NULL;
+
+  model = (struct svm_model*)vrna_alloc(sizeof(struct svm_model));
+
+  model->rho = NULL;
+  model->probA = NULL;
+  model->probB = NULL;
+  model->label = NULL;
+  model->nSV = NULL;
+
+
+  /* Read header until support vectors start */
+  lines=splitLines(modelString);
+  i=0;
+  while (lines[i] && (strcmp(lines[i],"SV")!=0)){
+        fields=splitFields(lines[i]);
+
+        key=fields[0];
+
+        if(strcmp(key,"svm_type")==0){
+          value=fields[1];
+          for(j=0;svm_type_table[j];j++){
+                if(strcmp(svm_type_table[j],value)==0){
+                  model->param.svm_type=j;
+                  break;
+                }
+          }
+          if(svm_type_table[i] == NULL){
+                vrna_message_warning("unknown svm type.");
+                free(model->rho);
+                free(model->label);
+                free(model->nSV);
+                free(model);
+                return NULL;
+          }
+        } else
+
+        if(strcmp(key,"kernel_type")==0){
+          value=fields[1];
+          for(j=0;kernel_type_table[j];j++){
+                if(strcmp(kernel_type_table[j],value)==0){
+                  model->param.kernel_type=j;
+                  break;
+                }
+          }
+          if(kernel_type_table[i] == NULL){
+                vrna_message_warning("unknown kernel type.");
+                free(model->rho);
+                free(model->label);
+                free(model->nSV);
+                free(model);
+                return NULL;
+          }
+        } else
+
+        if (strcmp(key,"gamma")==0){
+          value=fields[1];
+          sscanf(value,"%lf",&model->param.gamma);
+        }
+
+        if (strcmp(key,"degree")==0){
+          value=fields[1];
+          sscanf(value,"%d",&model->param.degree);
+        } else
+
+        if (strcmp(key,"coef0")==0){
+          value=fields[1];
+          sscanf(value,"%lf",&model->param.coef0);
+        } else
+        if (strcmp(key,"nr_class")==0){
+          value=fields[1];
+          sscanf(value,"%d",&model->nr_class);
+        } else
+        if (strcmp(key,"total_sv")==0){
+          value=fields[1];
+          sscanf(value,"%d",&model->l);
+        } else
+
+        if (strcmp(key,"rho")==0){
+          int n = model->nr_class * (model->nr_class-1)/2;
+          model->rho = (double*)vrna_alloc(sizeof(double)*n);
+          for(j=0;j<n;j++){
+                sscanf(fields[j+1],"%lf",&model->rho[j]);
+          }
+        } else
+
+        if (strcmp(key,"nr_sv")==0){
+          int n = model->nr_class;
+          model->nSV = (int*)vrna_alloc(sizeof(int)*n);
+          for(j=0;j<n;j++){
+                sscanf(fields[j+1],"%d",&model->nSV[j]);
+          }
+        } else
+
+        if (strcmp(key,"label")==0){
+          int n = model->nr_class;
+          model->label = (int*)vrna_alloc(sizeof(int)*n);
+          for(j=0;j<n;j++){
+                sscanf(fields[j+1],"%d",&model->label[j]);
+          }
+        } else
+
+        if (strcmp(key,"probA")==0){
+          int n = model->nr_class * (model->nr_class-1)/2;
+          model->probA = (double*)vrna_alloc(sizeof(double)*n);
+          for(j=0;j<n;j++){
+                sscanf(fields[j+1],"%lf",&model->probA[j]);
+          }
+        } else
+
+        if (strcmp(key,"probB")==0){
+          int n = model->nr_class * (model->nr_class-1)/2;
+          model->probB = (double*)vrna_alloc(sizeof(double)*n);
+          for(j=0;j<n;j++){
+                sscanf(fields[j+1],"%lf",&model->probB[j]);
+          }
+        }
+        i++;
+        freeFields(fields);
+  }
+
+  dataStart=i+1;
+  elements=0;
+
+  /* Count number of nodes (by counting colons) in advance to allocate
+         memory in one block */
+  while (lines[i]!=NULL){
+        j=0;
+        while ((c=lines[i][j])!='\0'){
+          if (c==':'){
+                elements++;
+          }
+          j++;
+        }
+        elements++;
+        i++;
+  }
+
+  /* allocate memory for SVs and coefficients */
+  m = model->nr_class - 1;
+  l = model->l;
+  model->sv_coef = (double**)vrna_alloc(sizeof(double*)*m);
+  for(i=0;i<m;i++){
+        model->sv_coef[i] = (double*)vrna_alloc(sizeof(double)*l);
+  }
+  model->SV = (struct svm_node**)vrna_alloc(sizeof(struct svm_node*)*l);
+
+  if(l>0){
+    x_space = (struct svm_node*)vrna_alloc(sizeof(struct svm_node)*(elements));
+  }
+
+
+  /* parse support vector data */
+  j=0;
+  for(i=0;i<l;i++){
+        fields=splitFields(lines[dataStart+i]);
+        model->SV[i] = &x_space[j];
+        k=0;
+        while ((field=fields[k])!=NULL){
+          if (k<m){
+            sscanf(fields[k],"%lf",&model->sv_coef[k][i]);
+          } else {
+            sscanf(fields[k],"%d:%lf",&(x_space[j].index),&(x_space[j].value));
+            j++;
+          }
+          k++;
+        }
+        x_space[j++].index = -1;
+        freeFields(fields);
+  }
+  freeFields(lines);
+
+  model->free_sv = 1;
+
+  return(model);
+}
+
+PRIVATE char **splitFields(char* string){
+
+  char c;
+  char* currField;
+  char** output=NULL;
+  int* seps;
+  int nSep;
+  int nField=0;
+  int i=0;
+
+  if (strlen(string)==0 || string==NULL){
+        return NULL;
+  }
+
+  /* First find all characters which are whitespaces and store the
+         positions in the array seps */
+
+  seps=(int *)vrna_alloc(sizeof(int));
+  seps[0]=-1;
+  nSep=1;
+
+  while ((c=string[i])!='\0' && (c!='\n')){
+        if (isspace(c)){
+          seps=(int*)vrna_realloc(seps,sizeof(int)*(nSep+1));
+          seps[nSep++]=i;
+        }
+        i++;
+  }
+
+  seps=(int*)vrna_realloc(seps,sizeof(int)*(nSep+1));
+  seps[nSep]=strlen(string);
+
+
+  /* Then go through all intervals in between of two whitespaces (or
+         end or start of string) and store the fields in the array
+         "output"; if there are two adjacent whitespaces this is ignored
+         resulting in a behaviour like "split /\s+/" in perl */
+
+  for (i=0;i<nSep;i++){
+
+        int start=seps[i];
+        int stop=seps[i+1];
+        int length=(stop-start);
+        int notSpace,j;
+
+
+        currField=(char *)vrna_alloc(sizeof(char)*(length+1));
+        strncpy(currField,string+start+1,length-1);
+        currField[length]='\0';
+
+        /* check if field is not only whitespace */
+        notSpace=0;
+        j=0;
+        while ((c=currField[j])!='\0'){
+          if (!isspace(c)){
+                notSpace=1;
+                break;
+          }
+        }
+
+        if (notSpace){
+          output=(char**)vrna_realloc(output,sizeof(char**)*(nField+1));
+          output[nField++]=currField;
+          currField=NULL;
+        } else {
+          free(currField);
+          currField=NULL;
+        }
+
+        /* printf("%s|\n",output[nField-1]); */
+  }
+
+  if (nField==0){
+        return NULL;
+  }
+
+
+  output=(char**)vrna_realloc(output,sizeof(char**)*(nField+1));
+  output[nField]=NULL;
+
+  free(seps);
+  return output;
+
+}
+
+PRIVATE char **splitLines(char* string){
+
+  char c;
+  char* currLine=NULL;
+  char** output=NULL;
+  int i=0;
+  int currLength=0;
+  int lineN=0;
+
+  while ((c=string[i])!='\0'){
+
+        if (c=='\n'){
+          output=(char**)vrna_realloc(output,sizeof(char**)*(lineN+1));
+          currLine=(char*)vrna_realloc(currLine,sizeof(char)*(currLength+1));
+          currLine[currLength]='\0';
+          output[lineN]=currLine;
+          currLength=0;
+          currLine=NULL;
+          lineN++;
+        } else {
+
+          currLine=(char*)vrna_realloc(currLine,sizeof(char)*(currLength+1));
+          currLine[currLength]=c;
+          currLength++;
+        }
+        i++;
+  }
+
+  output=(char**)vrna_realloc(output,sizeof(char**)*(lineN+1));
+  output[lineN]=NULL;
+
+  return output;
+
+}
+
+/*  for both splitLines and splitFields */
+void freeFields(char** fields){
+
+  int i=0;
+  while (fields[i]!=NULL){
+        free(fields[i++]);
+  }
+  free(fields);
+}
diff --git a/C/ViennaRNA/svm_utils.h b/C/ViennaRNA/svm_utils.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/svm_utils.h
@@ -0,0 +1,35 @@
+#ifndef VIENNA_RNA_PACKAGE_SUBOPT_H
+#define VIENNA_RNA_PACKAGE_SUBOPT_H
+
+#include "svm.h"
+
+extern  char *avg_model_string;
+extern  char *sd_model_string;
+
+float     get_z(char *sequence,
+                double energy);
+double    avg_regression (int N,
+                          int A,
+                          int C,
+                          int G,
+                          int T,
+                          struct svm_model *avg_model,
+                          int *info );
+double    sd_regression  (int N,
+                          int A,
+                          int C,
+                          int G,
+                          int T,
+                          struct svm_model  *sd_model);
+double    minimal_sd     (int N,
+                          int A,
+                          int C,
+                          int G,
+                          int T);
+struct svm_model *svm_load_model_string(char *modelString);
+int       *get_seq_composition( short *S,
+                                unsigned int start,
+                                unsigned int stop,
+                                unsigned int length);
+
+#endif
diff --git a/C/ViennaRNA/treedist.c b/C/ViennaRNA/treedist.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/treedist.c
@@ -0,0 +1,660 @@
+/*
+		Tree edit distances for RNA secondary structures
+		Walter Fontana, Ivo L Hofacker, Peter F Stadler
+			     Vienna RNA Package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include "ViennaRNA/edit_cost.h"
+#include "ViennaRNA/dist_vars.h"
+#include "ViennaRNA/utils.h"
+
+#define PRIVATE  static
+#define PUBLIC
+
+#define MNODES	  4000	  /* Maximal number of nodes for alignment    */
+
+PUBLIC  Tree     *make_tree(char *struc);
+PUBLIC  float     tree_edit_distance(Tree *T1, Tree *T2);
+PUBLIC  void      print_tree(Tree *t);
+PUBLIC  void      free_tree(Tree *t);
+
+
+PRIVATE void            tree_dist(int i, int j);
+PRIVATE int             edit_cost(int i, int j);
+PRIVATE int            *make_keyroots(Postorder_list *pl);
+PRIVATE void            sort(int n, int *ra);
+PRIVATE Postorder_list *make_postorder_list(char *struc);
+PRIVATE int             decode(char *id);
+PRIVATE int             number_of_nodes(char *struc);
+PRIVATE void            encode(int type, char *label);
+PRIVATE void            print_keyroots(int *keyroots);
+PRIVATE void            print_postorder_list(Postorder_list *pl);
+PRIVATE void            backtracking(void);
+PRIVATE void            sprint_aligned_trees(void);
+
+
+PRIVATE  Tree  *tree1, *tree2;
+PRIVATE  int  **tdist;       /* contains distances between subtrees */
+PRIVATE  int  **fdist;       /* contains distances between forests */
+PRIVATE  int  *alignment[2]; /* contains numeric information on the alignment:
+				alignment[0][p], aligment[1][p] are aligned postions.
+				INDELs have one 0.
+				alignment[0][0] contains the length of the alignment. */
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC float tree_edit_distance(Tree *T1, Tree *T2)
+{
+   int i1,j1,i,j, dist;
+   int n1, n2;
+
+   if (cost_matrix==0) EditCost = &UsualCost;
+   else EditCost = &ShapiroCost;
+
+   n1 = T1->postorder_list[0].sons;
+   n2 = T2->postorder_list[0].sons;
+
+   tdist = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+   fdist = (int **) vrna_alloc(sizeof(int *) * (n1+1));
+   for (i=0; i<=n1; i++) {
+      tdist[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+      fdist[i] = (int *) vrna_alloc(sizeof(int) * (n2+1));
+   }
+
+   tree1 = T1;  tree2 = T2;
+
+   for (i1 = 1; i1 <= T1->keyroots[0]; i1++) {
+      i = T1->keyroots[i1];
+      for (j1 = 1; j1 <= T2->keyroots[0]; j1++) {
+	 j = T2->keyroots[j1];
+
+	 tree_dist(i,j);
+      }
+   }
+
+   if (edit_backtrack) {
+
+      if ((n1>MNODES)||(n2>MNODES)) vrna_message_error("tree too large for alignment");
+
+      alignment[0] = (int *) vrna_alloc((n1+1)*sizeof(int));
+      alignment[1] = (int *) vrna_alloc((n2+1)*sizeof(int));
+
+      backtracking();
+      sprint_aligned_trees();
+      free(alignment[0]);
+      free(alignment[1]);
+   }
+   dist = tdist[n1][n2];
+   for (i=0; i<=n1; i++) {
+      free(tdist[i]);
+      free(fdist[i]);
+   }
+   free(tdist);
+   free(fdist);
+
+   return (float) dist;
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void tree_dist(int i, int j)
+{
+   int li,lj,i1,j1,i1_1,j1_1,li1_1,lj1_1,f1,f2,f3,f;
+   int cost, lleaf_i1, lleaf_j1;
+
+   fdist[0][0] = 0;
+
+   li = tree1->postorder_list[i].leftmostleaf;
+   lj = tree2->postorder_list[j].leftmostleaf;
+
+   for (i1 = li; i1 <= i; i1++) {
+      i1_1 = (li == i1 ? 0 : i1-1);
+      fdist[i1][0] = fdist[i1_1][0] + edit_cost(i1, 0);
+   }
+
+   for (j1 = lj; j1 <= j; j1++) {
+      j1_1 = (lj == j1 ? 0 : j1-1);
+      fdist[0][j1] = fdist[0][j1_1] + edit_cost(0, j1);
+   }
+
+   for (i1 = li; i1 <= i; i1++) {
+
+      lleaf_i1 = tree1->postorder_list[i1].leftmostleaf;
+      li1_1 = (li > lleaf_i1-1 ? 0 : lleaf_i1-1);
+      i1_1 = (i1 == li ? 0: i1-1);
+      cost = edit_cost(i1, 0);
+
+      for (j1 = lj; j1 <= j; j1++) {
+
+	 lleaf_j1 = tree2->postorder_list[j1].leftmostleaf;
+	 j1_1 = (j1 == lj ? 0: j1-1);
+
+	 f1 = fdist[i1_1][j1] + cost;
+	 f2 = fdist[i1][j1_1] + edit_cost(0, j1);
+
+	 f = f1 < f2 ? f1 : f2;
+
+	 if (lleaf_i1 == li && lleaf_j1 == lj)   {
+
+	    f3 = fdist[i1_1][j1_1] + edit_cost(i1, j1);
+
+	    fdist[i1][j1] = f3 < f ? f3 : f;
+
+	    tdist[i1][j1] = fdist[i1][j1];   /* store in array permanently */
+	 }
+	 else {
+	    lj1_1 = (lj > lleaf_j1-1 ? 0 : lleaf_j1-1);
+
+	    f3 = fdist[li1_1][lj1_1] + tdist[i1][j1];
+
+	    fdist[i1][j1] = f3 < f ? f3 : f;
+	 }
+      }
+   }
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE int edit_cost(int i, int j)
+{
+   int  c, diff, cd, min, a, b;
+
+   c = (*EditCost)[tree1->postorder_list[i].type][tree2->postorder_list[j].type];
+
+   diff = abs((a=tree1->postorder_list[i].weight) - (b=tree2->postorder_list[j].weight));
+
+   min = (a < b ? a: b);
+   if (min == a) cd = (*EditCost)[0][tree2->postorder_list[j].type];
+   else          cd = (*EditCost)[0][tree1->postorder_list[i].type];
+
+   return (c * min + cd * diff);
+
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC Tree *make_tree(char *struc)
+{
+   Tree *tree;
+
+   tree = (Tree *) vrna_alloc(sizeof(Tree));
+
+   tree->postorder_list = make_postorder_list(struc);
+   tree->keyroots       = make_keyroots(tree->postorder_list);
+
+   return (tree);
+}
+
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE int  *make_keyroots(Postorder_list *pl)
+{
+   int   i, k, keys;
+   int  *keyroots;
+
+   keyroots = (int *) vrna_alloc(sizeof(int)*(pl[0].sons+1));
+   keys      = 0;
+
+   for (i = 1; i <= pl[0].sons; i++) {
+      if (!pl[i].sons) {
+
+	 /* leaf */
+
+	 k = pl[0].sons;
+	 while (pl[k].leftmostleaf != i) k--;
+	 keyroots[++keys] = k;
+      }
+   }
+
+   sort(keys, keyroots);
+   keyroots[0] = keys;
+
+   return (keyroots);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void sort(int n, int *ra)       /* heap sort,  indices are 1..n !!! */
+{
+   int l,j,ir,i;
+   int rra;
+
+   if (n == 1) return;
+
+   l = (n >> 1)+1;
+   ir = n;
+   for (;;) {
+      if (l > 1)
+	 rra = ra[--l];
+      else {
+	 rra = ra[ir];
+	 ra[ir] = ra[1];
+	 if (--ir == 1) {
+	    ra[1] = rra;
+	    return;
+	 }
+      }
+      i = l;
+      j = l << 1;
+      while (j <= ir) {
+	 if (j < ir && ra[j] < ra[j+1]) ++j;
+	 if (rra < ra[j]) {
+	    ra[i] = ra[j];
+	    j += (i = j);
+	 }
+	 else j = ir+1;
+      }
+      ra[i] = rra;
+   }
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE Postorder_list *make_postorder_list(char *struc)
+
+     /*
+       Convention for structure representation "struc":
+       Nodes are one pair of matching parentheses, with the type and possibly
+       a weight of the node immediately preceding the closing parentheses.
+
+       Types:
+
+       U....unpaired
+       P....paired
+       H....hairpin loop
+       B....bulge loop
+       I....internal loop
+       M....multiloop
+       S....stack
+       R....virtual root
+
+       Example:
+
+       .((..(((...)))..((..)))). in usual notation becomes:
+
+       full tree:
+       ((U)(((U)(U)((((U)(U)(U)P)P)P)(U)(U)(((U)(U)P)P)P)P)(U)R)
+       HIT:
+       ((U1)((U2)((U3)P3)(U2)((U2)P2)P2)(U1)R)
+       Shapiro:
+       (((((H)S)((H)S)M)S)R)
+
+       */
+{
+   int  paren, i, l, order, local_order, w, sons, count;
+   int  n_nodes, p;
+   char id[100];
+   Postorder_list *pl;
+   int  match_pos[MNODES], match_order[MNODES];
+
+
+   n_nodes = number_of_nodes(struc);
+   if (n_nodes>MNODES) vrna_message_error("structure too long in make_postorder_list");
+   pl = (Postorder_list *) vrna_alloc(sizeof(Postorder_list)*(n_nodes+1));
+   pl[0].sons = n_nodes;
+
+   paren = 1;
+   match_pos[paren]   = 0;
+   match_order[paren] = 0;
+
+   i     = 1;
+   l     = 0;
+   order = 0;
+
+   while (paren) {
+      switch (struc[i]) {
+       case '(':
+	 match_pos[++paren] = i;
+	 match_order[paren] = order;
+	 break;
+       case ')':
+	 order++;
+	 id[l] = '\0';
+	 l = 0;
+	 while (isalpha((int) id[l])) l++;
+	 if (id[l]) sscanf(id+l, "%d", &w);
+	 else  w = 1;
+	 id[l] = '\0';
+	 pl[order].type         = decode(id);
+	 pl[order].weight       = w;
+	 pl[order].leftmostleaf = match_order[paren]+1;
+
+	 sons = count = 0;
+	 local_order  = match_order[paren];
+	 for (p = match_pos[paren]+1; p < i; p++) {
+	    if (struc[p] == '(') count++;
+	    else if (struc[p] == ')') {
+	       local_order++;
+	       if (count == 1) {
+		  sons++;
+		  pl[local_order].father = order;
+	       }
+	       count--;
+	    }
+	 }
+
+	 pl[order].sons         = sons;
+	 paren--;
+	 l = 0;
+	 break;
+       default:
+	 id[l++] = struc[i];
+	 break;
+      }
+      i++;
+   }
+
+   return (pl);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE int decode(char *id)
+{
+   int   n, quit, i;
+   char  label[100], *code;
+
+   n = 0;
+
+   quit = 0;
+   code = coding;
+
+   while (!quit) {
+      for (i = 0; code[i] != sep; i++) {
+	 if (code[i] == '\0') {
+	    quit = 1;
+	    break;
+	 }
+	 label[i] = code[i];
+      }
+      label[i] = '\0';
+      if (strcmp(id, label) == 0) return (n);
+      code += (i+1);
+      n++;
+   }
+
+   vrna_message_error( "Syntax error: node identifier \"%s\" not found "
+                              "in coding string \"%s\"\n"
+                              "Exiting...",
+                              id, coding);
+   exit(0);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void encode(int type, char label[])
+{
+   int   i, l;
+
+   l = 0;
+   for (i = 0; i < type; i++) {
+      while (coding[l] != sep && coding[l]) l++;
+      l++;
+   }
+
+   for (i = 0; coding[l+i] != sep; i++) {
+      if (coding[l+i] == '\0') break;
+      label[i] = coding[l+i];
+   }
+   label[i] = '\0';
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE int number_of_nodes(char *struc)
+{
+   int  l, c, i;
+
+   l = strlen(struc);
+   for (c = 0, i = 0; i < l; i++) if (struc[i] == ')') c++;
+   return (c);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void print_keyroots(int *keyroots)
+{
+   int i;
+
+   printf("--->  key roots  <---\n\n");
+
+   printf("entries: %d\n", keyroots[0]);
+   printf("{");
+   for (i = 1; i <= keyroots[0]; i++) printf(" %d", keyroots[i]);
+   printf(" }\n\n");
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void print_postorder_list(Postorder_list *pl)
+{
+   register int i;
+   char     label[100];
+
+   printf("--->  postorder list  <---\n\n");
+
+   for (i = 1; i <= pl[0].sons; i++) {
+      printf("    postorder: %3d\n", i);
+      *label = '\0';
+      encode(pl[i].type, label);
+      printf("         type: %3d (%s)\n", pl[i].type, label);
+      printf("       weight: %3d\n", pl[i].weight);
+      printf("       father: %3d\n", pl[i].father);
+      printf("         sons: %3d\n", pl[i].sons);
+      printf("leftmost leaf: %3d\n", pl[i].leftmostleaf);
+      printf("\n");
+   }
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC void print_tree(Tree *t)
+{
+   print_postorder_list(t->postorder_list);
+   print_keyroots(t->keyroots);
+   fflush(stdout);
+}
+
+/*---------------------------------------------------------------------------*/
+
+PUBLIC void free_tree(Tree *t)
+{
+   free(t->postorder_list);
+   free(t->keyroots);
+   free(t);
+}
+
+/*---------------------------------------------------------------------------*/
+
+
+PRIVATE void backtracking(void)
+{
+   int li,lj,i1,j1,i1_1,j1_1,li1_1,lj1_1,f;
+   int cost, lleaf_i1, lleaf_j1, ss, i,j,k;
+   struct {int i,j;} sector[MNODES/2];
+
+   ss=0;
+
+   i=i1=tree1->postorder_list[0].sons;
+   j=j1=tree2->postorder_list[0].sons;
+
+ start:
+   li = tree1->postorder_list[i].leftmostleaf;
+   lj = tree2->postorder_list[j].leftmostleaf;
+
+
+   while ((i1>=li)&&(j1>=lj)) {
+
+      lleaf_i1 = tree1->postorder_list[i1].leftmostleaf;
+      li1_1 = (li > lleaf_i1-1 ? 0 : lleaf_i1-1);
+      i1_1 = (i1 == li ? 0: i1-1);
+      lleaf_j1 = tree2->postorder_list[j1].leftmostleaf;
+      lj1_1 = (lj > lleaf_j1-1 ? 0 : lleaf_j1-1);
+      j1_1 = (j1 == lj ? 0: j1-1);
+
+      f = fdist[i1][j1];
+
+      cost = edit_cost(i1, 0);
+      if (f == fdist[i1_1][j1] + cost) {
+	 alignment[0][i1]=0;
+	 i1=i1_1;
+      }
+      else {
+	 if (f ==  fdist[i1][j1_1] + edit_cost(0, j1)) {
+	    alignment[1][j1]=0;
+	    j1=j1_1;
+	 }
+	 else if (lleaf_i1 == li && lleaf_j1 == lj) {
+	    alignment[0][i1] = j1;
+	    alignment[1][j1] = i1;
+	    i1=i1_1; j1=j1_1;
+	 } else  {
+	    sector[ss].i=i1;
+	    sector[ss++].j=j1;
+	    i1=li1_1;
+	    j1=lj1_1;
+	 }
+      }
+   }
+   for (; i1>=li; ) {
+      alignment[0][i1]=0;
+      i1 = (i1 == li ? 0: i1-1);
+   }
+   for (; j1>=lj; ) {
+      alignment[1][j1]=0;
+      j1 = (j1 == lj ? 0: j1-1);
+   }
+   while (ss>0) {
+      i1=sector[--ss].i;
+      j1=sector[ss].j;
+      for (k=1; 1; k++) {
+	 i = tree1->keyroots[k];
+	 if (tree1->postorder_list[i].leftmostleaf ==
+	     tree1->postorder_list[i1].leftmostleaf) break;
+      }
+      for (k=1; 1; k++) {
+	 j = tree2->keyroots[k];
+	 if (tree2->postorder_list[j].leftmostleaf ==
+	     tree2->postorder_list[j1].leftmostleaf) break;
+      }
+      tree_dist(i,j);
+      goto start;
+   }
+}
+
+/*---------------------------------------------------------------------------*/
+
+PRIVATE void sprint_aligned_trees(void)
+{
+   int i,j,n1,n2,k,l,p, ni, nj, weights;
+   char t1[2*MNODES+1], t2[2*MNODES+1], a1[8*MNODES], a2[8*MNODES], ll[20], ll1[20];
+
+   weights=0;
+   n1=tree1->postorder_list[0].sons;
+   n2=tree2->postorder_list[0].sons;
+   for (i=1; i<=n1; i++) weights |= (tree1->postorder_list[i].weight!=1);
+   for (i=1; i<=n2; i++) weights |= (tree2->postorder_list[i].weight!=1);
+
+   for (i=n1, l=2*n1-1; i>0; i--) {
+      if (alignment[0][i]!=0) t1[l--]=']';
+      else t1[l--]=')';
+      p=i;
+      while(i==tree1->postorder_list[p].leftmostleaf) {
+	 if (alignment[0][p]!=0) t1[l--]='[';
+	 else t1[l--]='(';
+	 p=tree1->postorder_list[p].father;
+      }
+   }
+   t1[2*n1]='\0';
+   for (j=n2, l=2*n2-1; j>0; j--) {
+      if (alignment[1][j]!=0) t2[l--]=']';
+      else t2[l--]=')';
+      p=j;
+      while(j==tree2->postorder_list[p].leftmostleaf) {
+	 if (alignment[1][p]!=0) t2[l--]='[';
+	 else t2[l--]='(';
+	 p=tree2->postorder_list[p].father;
+      }
+   }
+   t2[2*n2]='\0';
+
+   ni=nj=l=i=j=0;
+   while (t1[i]||t2[j]) {
+      while ((t1[i]=='(')||(t1[i]==')')) {
+	 if (t1[i]==')') {
+	    ni++;
+	    encode(tree1->postorder_list[ni].type, ll);
+	    if (weights)
+	       sprintf(ll+strlen(ll), "%d", tree1->postorder_list[ni].weight);
+	    for (k=0; k< strlen(ll); k++) {
+	       a1[l]=ll[k];
+	       a2[l++]='_';
+	    }
+	    a1[l]=')'; a2[l++]='_';
+	 } else {
+	    a1[l] = t1[i];
+	    a2[l++] ='_';
+	 }
+	 i++;
+      }
+
+      while ((t2[j]=='(')||(t2[j]==')')) {
+	 if (t2[j]==')') {
+	    nj++;
+	    encode(tree2->postorder_list[nj].type, ll);
+	    if (weights)
+	       sprintf(ll+strlen(ll), "%d", tree2->postorder_list[nj].weight);
+	    for (k=0; k< strlen(ll); k++) {
+	       a2[l]=ll[k];
+	       a1[l++]='_';
+	    }
+	    a2[l]=')'; a1[l++]='_';
+	 } else {
+	    a2[l] = t2[j];
+	    a1[l++] ='_';
+	 }
+	 j++;
+      }
+
+      if (t2[j]==']') {
+	 ni++; nj++;
+	 encode(tree2->postorder_list[nj].type, ll);
+	 if (weights)
+	    sprintf(ll+strlen(ll), "%d", tree2->postorder_list[nj].weight);
+	 encode(tree1->postorder_list[ni].type, ll1);
+	 if (weights)
+	    sprintf(ll1+strlen(ll1), "%d", tree1->postorder_list[ni].weight);
+	 if (strlen(ll)>strlen(ll1))
+	    for (k=0; k<strlen(ll)-strlen(ll1); k++) strcat(ll1,"_");
+	 if (strlen(ll)<strlen(ll1))
+	    for (k=0; k<strlen(ll1)-strlen(ll); k++) strcat(ll,"_");
+	 for (k=0; k< strlen(ll); k++) a2[l+k]=ll[k];
+	 for (k=0; k< strlen(ll); k++) a1[l+k]=ll1[k];
+	 l+=k;
+	 a1[l]=a2[l]=')'; l++;
+	 i++; j++;
+      } else if (t2[j]=='[') {
+	 a1[l]=a2[l]='('; l++;
+	 i++; j++;
+      }
+   }
+   a1[l]=a2[l]='\0';
+   if (l>8*MNODES) vrna_message_error("structure too long in sprint_aligned_trees");
+   if (aligned_line[0]!= NULL)  free(aligned_line[0]);
+   if (aligned_line[1]!= NULL)  free(aligned_line[1]);
+   aligned_line[0] = (char *) vrna_alloc((l+1)*sizeof(char));
+   aligned_line[1] = (char *) vrna_alloc((l+1)*sizeof(char));
+   strcpy(aligned_line[0], a1);
+   strcpy(aligned_line[1], a2);
+}
+
+/*---------------------------------------------------------------------------*/
diff --git a/C/ViennaRNA/treedist.h b/C/ViennaRNA/treedist.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/treedist.h
@@ -0,0 +1,42 @@
+#ifndef VIENNA_RNA_PACKAGE_TREE_DIST_H
+#define VIENNA_RNA_PACKAGE_TREE_DIST_H
+
+/**
+ *  \file treedist.h
+ *  \brief Functions for Tree Edit Distances
+ */
+
+#include <ViennaRNA/dist_vars.h>
+
+/**
+ *  \brief Constructs a Tree ( essentially the postorder list ) of the
+ *  structure 'struc', for use in tree_edit_distance().
+ * 
+ *  \param  struc may be any rooted structure representation.
+ *  \return
+ */
+Tree   *make_tree(char *struc);
+
+/**
+ *  \brief Calculates the edit distance of the two trees.
+ * 
+ *  \param T1
+ *  \param T2
+ *  \return
+ */
+float   tree_edit_distance( Tree *T1,
+                            Tree *T2);
+
+/**
+ *  \brief Print a tree (mainly for debugging)
+ */
+void    print_tree(Tree *t);
+
+/**
+ *  \brief Free the memory allocated for Tree t.
+ * 
+ *  \param t
+ */
+void    free_tree(Tree *t);
+
+#endif
diff --git a/C/ViennaRNA/unstructured_domains.c b/C/ViennaRNA/unstructured_domains.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/unstructured_domains.c
@@ -0,0 +1,1503 @@
+/** \file unstructured_domains.c **/
+
+/*
+                  Unstructured domains
+
+                  This file contains everything necessary to
+                  deal with the default implementation for unstructured
+                  domains in secondary structures. This feature enables,
+                  for instance, ligand binding to unpaired stretches of
+                  an RNA secondary structure.
+
+                  c 2016 Ronny Lorenz
+
+                  ViennaRNA package
+*/
+
+#include <config.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <float.h>
+#include <math.h>
+
+#include "ViennaRNA/utils.h"
+#include "ViennaRNA/alphabet.h"
+#include "ViennaRNA/unstructured_domains.h"
+
+/*
+#################################
+# PRIVATE MACROS                #
+#################################
+*/
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+
+/*
+#################################
+# PRIVATE VARIABLES/STRUCTS     #
+#################################
+*/
+
+struct default_outside {
+  int         motif_num;
+  FLT_OR_DBL  exp_energy;
+};
+
+/*
+ *  Default data structure for ligand binding to unpaired stretches
+ */
+struct ligands_up_data_default {
+
+  /*
+  **********************************
+    pre-computed position-wise
+    motif list
+  **********************************
+  */
+  int           n;
+  int           **motif_list_ext;
+  int           **motif_list_hp;
+  int           **motif_list_int;
+  int           **motif_list_mb;
+
+  int           *dG;
+  FLT_OR_DBL    *exp_dG;
+  int           *len;
+
+  /*
+  **********************************
+    below are DP matrices to store
+    the production rule results
+  **********************************
+  */
+  int           *energies_ext;
+  int           *energies_hp;
+  int           *energies_int;
+  int           *energies_mb;
+  FLT_OR_DBL    *exp_energies_ext;
+  FLT_OR_DBL    *exp_energies_hp;
+  FLT_OR_DBL    *exp_energies_int;
+  FLT_OR_DBL    *exp_energies_mb;
+
+  /*
+  **********************************
+    below are lists to store the
+    outside partition function for
+    each motif starting at each
+    position
+  **********************************
+  */
+  unsigned int            *outside_ext_count;
+  struct default_outside  **outside_ext;
+  unsigned int            *outside_hp_count;
+  struct default_outside  **outside_hp;
+  unsigned int            *outside_int_count;
+  struct default_outside  **outside_int;
+  unsigned int            *outside_mb_count;
+  struct default_outside  **outside_mb;
+
+  FLT_OR_DBL  (*default_cb[32])(int, int, struct ligands_up_data_default *);
+  FLT_OR_DBL  *exp_e_mx[32];
+};
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+
+PRIVATE void        remove_ligands_up(vrna_fold_compound_t *vc);
+PRIVATE void        init_ligands_up(vrna_fold_compound_t *vc);
+
+PRIVATE void        add_ligand_motif(vrna_fold_compound_t *vc, const char *motif, double motif_en, unsigned int loop_type);
+PRIVATE void        remove_default_data(void *d);
+
+/* default implementations for unstructured domains feature */
+PRIVATE void        default_prod_rule(vrna_fold_compound_t *vc, void *d);
+PRIVATE void        default_exp_prod_rule(vrna_fold_compound_t *vc, void *d);
+PRIVATE int         default_energy(vrna_fold_compound_t *vc, int i, int j, unsigned int loop_type, void *d);
+PRIVATE FLT_OR_DBL  default_exp_energy( vrna_fold_compound_t *vc, int i, int j, unsigned int loop_type, void *d);
+PRIVATE void        default_probs_add(vrna_fold_compound_t *vc, int i, int j, unsigned int loop_type, FLT_OR_DBL exp_energy, void *data);
+PRIVATE FLT_OR_DBL  default_probs_get(vrna_fold_compound_t *vc, int i, int j, unsigned int loop_type, int motif, void *data);
+
+/* helper functions for default implementatations of unstructured domains feature */
+PRIVATE int         default_energy_ext_motif(int i, int j, struct ligands_up_data_default *data);
+PRIVATE int         default_energy_hp_motif(int i, int j, struct ligands_up_data_default *data);
+PRIVATE int         default_energy_int_motif(int i, int j, struct ligands_up_data_default *data);
+PRIVATE int         default_energy_mb_motif(int i, int j, struct ligands_up_data_default *data);
+PRIVATE FLT_OR_DBL  default_exp_energy_ext_motif(int i, int j, struct ligands_up_data_default *data);
+PRIVATE FLT_OR_DBL  default_exp_energy_hp_motif(int i, int j, struct ligands_up_data_default *data);
+PRIVATE FLT_OR_DBL  default_exp_energy_int_motif(int i, int j, struct ligands_up_data_default *data);
+PRIVATE FLT_OR_DBL  default_exp_energy_mb_motif(int i, int j, struct ligands_up_data_default *data);
+PRIVATE void        free_default_data_matrices(struct ligands_up_data_default *data);
+PRIVATE void        free_default_data_exp_matrices(struct ligands_up_data_default *data);
+PRIVATE void        prepare_matrices( vrna_fold_compound_t *vc, struct ligands_up_data_default *data);
+PRIVATE void        prepare_exp_matrices( vrna_fold_compound_t *vc, struct ligands_up_data_default *data);
+PRIVATE struct ligands_up_data_default *get_default_data(void);
+PRIVATE void        prepare_default_data(vrna_fold_compound_t *vc, struct ligands_up_data_default *data);
+PRIVATE void        free_default_data(struct ligands_up_data_default *data);
+PRIVATE int         *get_motifs(vrna_fold_compound_t *vc, int i, unsigned int loop_type);
+PRIVATE void        annotate_ud(vrna_fold_compound_t *vc, int start, int end, char l, vrna_ud_motif_t **list, int *list_size, int *list_pos);
+
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+PUBLIC void
+vrna_ud_remove( vrna_fold_compound_t *vc){
+
+  if(vc && vc->domains_up)
+    remove_ligands_up(vc);
+}
+
+PUBLIC void
+vrna_ud_set_data( vrna_fold_compound_t                *vc,
+                          void                        *data,
+                          vrna_callback_free_auxdata  *free_cb){
+
+  if(vc){
+    /* init if not already present */
+    if(!vc->domains_up)
+      init_ligands_up(vc);
+
+    /* free previous data if 'free_data' function present */
+    if(vc->domains_up->free_data)
+      vc->domains_up->free_data(vc->domains_up->data);
+
+    /* set new data and free callback */
+    vc->domains_up->free_data = free_cb;
+    vc->domains_up->data      = data;
+  }
+}
+
+PUBLIC void
+vrna_ud_set_prod_rule_cb( vrna_fold_compound_t        *vc,
+                          vrna_callback_ud_production *pre_cb,
+                          vrna_callback_ud_energy     *e_cb){
+
+  if(vc){
+    /* init if not already present */
+    if(!vc->domains_up)
+      init_ligands_up(vc);
+
+    /* set new callback */
+    vc->domains_up->prod_cb   = pre_cb;
+    vc->domains_up->energy_cb = e_cb;
+  }
+}
+
+PUBLIC void
+vrna_ud_set_exp_prod_rule_cb( vrna_fold_compound_t            *vc,
+                              vrna_callback_ud_exp_production *pre_cb,
+                              vrna_callback_ud_exp_energy     *exp_e_cb){
+
+  if(vc){
+    /* init if not already present */
+    if(!vc->domains_up)
+      init_ligands_up(vc);
+
+    /* set new callback */
+    vc->domains_up->exp_prod_cb   = pre_cb;
+    vc->domains_up->exp_energy_cb = exp_e_cb;
+  }
+}
+
+
+PUBLIC void
+vrna_ud_set_prob_cb(vrna_fold_compound_t        *vc,
+                    vrna_callback_ud_probs_add  *setter,
+                    vrna_callback_ud_probs_get  *getter){
+
+  if(vc){
+    /* init if not already present */
+    if(!vc->domains_up)
+      init_ligands_up(vc);
+
+    /* set new callback */
+    vc->domains_up->probs_add = setter;
+    vc->domains_up->probs_get = getter;
+  }
+}
+
+PUBLIC void
+vrna_ud_add_motif(vrna_fold_compound_t  *vc,
+                  const char            *motif,
+                  double                motif_en,
+                  unsigned int          loop_type){
+
+  if(vc){
+    if(!vc->domains_up){
+      /* set all default callbacks */
+      vrna_ud_set_prod_rule_cb(vc, &default_prod_rule, &default_energy);
+      vrna_ud_set_exp_prod_rule_cb(vc, &default_exp_prod_rule, &default_exp_energy);
+      vrna_ud_set_data(vc, get_default_data(), &remove_default_data);
+      vrna_ud_set_prob_cb(vc, &default_probs_add, &default_probs_get);
+    }
+    add_ligand_motif(vc, motif, motif_en, loop_type);
+  }
+}
+
+
+PUBLIC int *
+vrna_ud_get_motif_size_at(vrna_fold_compound_t  *vc,
+                          int                   i,
+                          unsigned int          loop_type){
+
+  if(vc && vc->domains_up){
+    int k, l, cnt, *ret, *ptr;
+
+    ret = NULL;
+    if((i > 0) && (i <= vc->length)){
+      ptr = get_motifs(vc, i, loop_type);
+      if(ptr){
+        for(k = 0; ptr[k] != -1; k++) /* replace motif number with its size */
+          ptr[k] = vc->domains_up->motif_size[ptr[k]];
+        /* make the list unique */
+        ret     = (int *)vrna_alloc(sizeof(int) * (k + 1));
+        ret[0]  = -1;
+        cnt     = 0;
+        for(k = 0; ptr[k] != -1; k++){
+          for(l = 0; l < cnt; l++){
+            if(ptr[k] == ret[l])
+              break; /* we've already seen this size */
+          }
+          if(l == cnt){ /* we've not seen this size before */
+            ret[cnt]      = ptr[k];
+            ret[cnt + 1]  = -1;
+            cnt++;
+          }
+        }
+        /* resize ret array */
+        ret = (int *)vrna_realloc(ret, sizeof(int) * (cnt + 1));
+      }
+      free(ptr);
+    }
+    return ret;
+  }
+  return NULL;
+}
+
+PUBLIC int *
+vrna_ud_get_motifs_at(vrna_fold_compound_t  *vc,
+                      int                   i,
+                      unsigned int          loop_type){
+
+  if(vc && vc->domains_up){
+    if((i > 0) && (i <= vc->length)){
+      return get_motifs(vc, i, loop_type);
+    }
+  }
+  return NULL;
+}
+
+vrna_ud_motif_t *
+vrna_ud_detect_motifs(vrna_fold_compound_t  *vc,
+                      const char            *structure){
+
+  int list_size, list_pos;
+  vrna_ud_motif_t *motif_list;
+
+  motif_list = NULL;
+
+  if(structure && vc->domains_up){
+    int   l, start, end;
+    char  last, *loops;
+
+    l           = 0;
+    list_pos    = 0;
+    list_size   = 15;
+    motif_list  = (vrna_ud_motif_t *)vrna_alloc(sizeof(vrna_ud_motif_t) * list_size);
+    loops       = vrna_db_to_element_string(structure);
+
+    while(l < vc->length){
+      /* skip uppercase encodings */
+      while(l < vc->length){
+        if(islower(loops[l]))
+          break;
+        l++;
+      }
+
+      if(l < vc->length){
+        start = 1 + l;
+        last  = loops[l];
+        while(loops[l++] == last){
+          if(l == vc->length)
+            break;
+        }
+        end = l - 1;
+        annotate_ud(vc, start, end, last, &motif_list, &list_size, &list_pos);
+      }
+    }
+
+    motif_list = (vrna_ud_motif_t *)vrna_realloc(motif_list, sizeof(vrna_ud_motif_t) * (list_pos + 1));
+    motif_list[list_pos].start = 0;
+    motif_list[list_pos].number = -1;
+    free(loops);
+  }
+
+  return motif_list;
+}
+
+/*
+#####################################
+# BEGIN OF STATIC HELPER FUNCTIONS  #
+#####################################
+*/
+PRIVATE struct ligands_up_data_default *
+get_default_data(void){
+
+  struct ligands_up_data_default *data = vrna_alloc(sizeof(struct ligands_up_data_default));
+  data->n                 = 0;
+  data->motif_list_ext    = NULL;
+  data->motif_list_hp     = NULL;
+  data->motif_list_int    = NULL;
+  data->motif_list_mb     = NULL;
+  data->dG                = NULL;
+  data->exp_dG            = NULL;
+  data->energies_ext      = NULL;
+  data->energies_hp       = NULL;
+  data->energies_int      = NULL;
+  data->energies_mb       = NULL;
+  data->exp_energies_ext  = NULL;
+  data->exp_energies_hp   = NULL;
+  data->exp_energies_int  = NULL;
+  data->exp_energies_mb   = NULL;
+  data->outside_ext       = NULL;
+  data->outside_hp        = NULL;
+  data->outside_int       = NULL;
+  data->outside_mb        = NULL;
+  data->outside_ext_count = NULL;
+  data->outside_hp_count  = NULL;
+  data->outside_int_count = NULL;
+  data->outside_mb_count  = NULL;
+  return data;
+}
+
+PRIVATE void
+remove_ligands_up(vrna_fold_compound_t *vc){
+
+  int i;
+
+  /* free auxiliary data */
+  if(vc->domains_up->free_data)
+    vc->domains_up->free_data(vc->domains_up->data);
+
+  for( i = 0; i < vc->domains_up->motif_count; i++ ){
+    free(vc->domains_up->motif[i]);
+  }
+  free(vc->domains_up->motif);
+  free(vc->domains_up->motif_size);
+  free(vc->domains_up->motif_en);
+  free(vc->domains_up->motif_type);
+
+  free(vc->domains_up->uniq_motif_size);
+
+  free(vc->domains_up);
+
+  vc->domains_up = NULL;
+}
+
+PRIVATE void
+init_ligands_up(vrna_fold_compound_t *vc){
+
+  vc->domains_up = (vrna_ud_t *)vrna_alloc(sizeof(vrna_ud_t));
+
+  vc->domains_up->uniq_motif_count  = 0;
+  vc->domains_up->uniq_motif_size   = NULL;
+  vc->domains_up->motif_count       = 0;
+  vc->domains_up->motif             = NULL;
+  vc->domains_up->motif_size        = NULL;
+  vc->domains_up->motif_en          = NULL;
+  vc->domains_up->motif_type        = NULL;
+  vc->domains_up->prod_cb           = NULL;
+  vc->domains_up->exp_prod_cb       = NULL;
+  vc->domains_up->energy_cb         = NULL;
+  vc->domains_up->exp_energy_cb     = NULL;
+  vc->domains_up->data              = NULL;
+  vc->domains_up->free_data         = NULL;
+  vc->domains_up->probs_add         = NULL;
+  vc->domains_up->probs_get         = NULL;
+}
+
+/*
+**********************************
+  Default implementation for
+  ligand binding to unpaired
+  stretches follows below
+**********************************
+*/
+
+PRIVATE void
+add_ligand_motif( vrna_fold_compound_t *vc,
+                  const char *motif,
+                  double motif_en,
+                  unsigned int loop_type){
+
+  unsigned int  i, n, same_size;
+  vrna_ud_t     *ud;
+
+  n   = (unsigned int)strlen(motif);
+  ud  = vc->domains_up;
+
+  /* First, we update the list of unique motif lengths */
+  for(same_size = i = 0; i < ud->uniq_motif_count; i++){
+    if(ud->uniq_motif_size[i] == n){
+      same_size = 1;
+      break;
+    }
+  }
+
+  if(!same_size){
+    ud->uniq_motif_size = (unsigned int *)vrna_realloc(ud->uniq_motif_size, sizeof(unsigned int *) * (ud->uniq_motif_count + 1));
+    ud->uniq_motif_size[ud->uniq_motif_count] = n;
+    ud->uniq_motif_count++;
+  }
+
+  /* And finally, we store the motif */
+  ud->motif                       = (char **)vrna_realloc(ud->motif, sizeof(char *) * (ud->motif_count + 1));
+  ud->motif[ud->motif_count]      = strdup(motif);
+  ud->motif_size                  = (unsigned int *)vrna_realloc(ud->motif_size, sizeof(unsigned int *) * (ud->motif_count + 1));
+  ud->motif_size[ud->motif_count] = n;
+  ud->motif_en                    = (double *)vrna_realloc(ud->motif_en, sizeof(double) * (ud->motif_count + 1));
+  ud->motif_en[ud->motif_count]   = motif_en;
+  ud->motif_type                  = (unsigned int *)vrna_realloc(ud->motif_type, sizeof(double) * (ud->motif_count + 1));
+  ud->motif_type[ud->motif_count] = loop_type;
+  ud->motif_count++;
+
+}
+
+PRIVATE void
+remove_default_data(void *d){
+
+  struct ligands_up_data_default  *data;
+
+  data = (struct ligands_up_data_default *)d;
+
+  free_default_data_matrices(data);
+  free_default_data_exp_matrices(data);
+  free_default_data(data);
+
+  free(data->dG);
+  free(data->exp_dG);
+}
+
+PRIVATE void
+free_default_data(struct ligands_up_data_default *data){
+
+  int i;
+  if(data->motif_list_ext){
+    for(i=0; i <= data->n; i++)
+      free(data->motif_list_ext[i]);
+    free(data->motif_list_ext);
+  }
+  if(data->motif_list_hp){
+    for(i=0; i <= data->n; i++)
+      free(data->motif_list_hp[i]);
+    free(data->motif_list_hp);
+  }
+  if(data->motif_list_int){
+    for(i=0; i <= data->n; i++)
+      free(data->motif_list_int[i]);
+    free(data->motif_list_int);
+  }
+  if(data->motif_list_mb){
+    for(i=0; i <= data->n; i++)
+      free(data->motif_list_mb[i]);
+    free(data->motif_list_mb);
+  }
+
+  free(data->len);
+
+}
+
+PRIVATE void
+free_default_data_matrices(struct ligands_up_data_default *data){
+
+  /* the following four pointers may point to the same memory */
+  if(data->energies_ext){
+    /* check whether one of the other b* points to the same memory location */
+    if(data->energies_ext == data->energies_hp)
+      data->energies_hp = NULL;
+    if(data->energies_ext == data->energies_int)
+      data->energies_int = NULL;
+    if(data->energies_ext == data->energies_mb)
+      data->energies_mb = NULL;
+    free(data->energies_ext);
+    data->energies_ext = NULL;
+  }
+  if(data->energies_hp){
+    /* check whether one of the other b* points to the same memory location */
+    if(data->energies_hp == data->energies_int)
+      data->energies_int = NULL;
+    if(data->energies_hp == data->energies_mb)
+      data->energies_mb = NULL;
+    free(data->energies_hp);
+    data->energies_hp = NULL;
+  }
+  if(data->energies_int){
+    /* check whether one of the other b* points to the same memory location */
+    if(data->energies_int == data->energies_mb)
+      data->energies_mb = NULL;
+    free(data->energies_int);
+    data->energies_int = NULL;
+  }
+  free(data->energies_mb);
+  data->energies_mb = NULL;
+}
+
+PRIVATE void
+free_default_data_exp_matrices(struct ligands_up_data_default *data){
+
+  int i;
+
+  /* the following four pointers may point to the same memory */
+  if(data->exp_energies_ext){
+    /* check whether one of the other b* points to the same memory location */
+    if(data->exp_energies_ext == data->exp_energies_hp)
+      data->exp_energies_hp = NULL;
+    if(data->exp_energies_ext == data->exp_energies_int)
+      data->exp_energies_int = NULL;
+    if(data->exp_energies_ext == data->exp_energies_mb)
+      data->exp_energies_mb = NULL;
+    free(data->exp_energies_ext);
+    data->exp_energies_ext = NULL;
+  }
+  if(data->exp_energies_hp){
+    /* check whether one of the other b* points to the same memory location */
+    if(data->exp_energies_hp == data->exp_energies_int)
+      data->exp_energies_int = NULL;
+    if(data->exp_energies_hp == data->exp_energies_mb)
+      data->exp_energies_mb = NULL;
+    free(data->exp_energies_hp);
+    data->exp_energies_hp = NULL;
+  }
+  if(data->exp_energies_int){
+    /* check whether one of the other b* points to the same memory location */
+    if(data->exp_energies_int == data->exp_energies_mb)
+      data->exp_energies_mb = NULL;
+    free(data->exp_energies_int);
+    data->exp_energies_int = NULL;
+  }
+  free(data->exp_energies_mb);
+  data->exp_energies_mb = NULL;
+
+  if(data->outside_ext)
+    for(i = 0; i <= data->n; i++)
+      if(data->outside_ext[i])
+        free(data->outside_ext[i]);
+  free(data->outside_ext);
+  free(data->outside_ext_count);
+
+  if(data->outside_hp)
+    for(i = 0; i <= data->n; i++)
+      if(data->outside_hp[i])
+        free(data->outside_hp[i]);
+  free(data->outside_hp);
+  free(data->outside_hp_count);
+
+  if(data->outside_int)
+    for(i = 0; i <= data->n; i++)
+      if(data->outside_int[i])
+        free(data->outside_int[i]);
+  free(data->outside_int);
+  free(data->outside_int_count);
+
+  if(data->outside_mb)
+    for(i = 0; i <= data->n; i++)
+      if(data->outside_mb[i])
+        free(data->outside_mb[i]);
+  free(data->outside_mb);
+  free(data->outside_mb_count);
+}
+
+PRIVATE int *
+get_motifs(vrna_fold_compound_t *vc, int i, unsigned int loop_type){
+
+  int               k, j, u, n, *motif_list, cnt, guess;
+  char              *sequence;
+  vrna_ud_t         *domains_up;
+
+  sequence    = vc->sequence;
+  n           = (int)vc->length;
+  domains_up  = vc->domains_up;
+
+  cnt         = 0;
+  guess       = domains_up->motif_count;
+  motif_list  = (int *)vrna_alloc(sizeof(int) * (guess + 1));
+
+  /* collect list of motif numbers we find that start at position i */
+  for(k = 0; k < domains_up->motif_count; k++){
+
+    if(!(domains_up->motif_type[k] & loop_type))
+      continue;
+
+    j = i + domains_up->motif_size[k] - 1;
+    if(j <= n){ /* only consider motif that does not exceed sequence length (does not work for circular RNAs!) */
+      for(u = i; u <= j; u++){
+        if(!vrna_nucleotide_IUPAC_identity(sequence[u-1], domains_up->motif[k][u-i]))
+          break;
+      }
+      if(u > j) /* got a complete motif match */
+        motif_list[cnt++] = k;
+    }
+  }
+
+  if(cnt == 0){
+    free(motif_list);
+    return NULL;
+  }
+  
+  motif_list = (int *)vrna_realloc(motif_list, sizeof(int) * (cnt + 1));
+  motif_list[cnt] = -1; /* end of list marker */
+
+  return motif_list;
+}
+
+
+static void
+annotate_ud(vrna_fold_compound_t *vc,
+            int start,
+            int end,
+            char l,
+            vrna_ud_motif_t **list,
+            int *list_size,
+            int *list_pos){
+
+  int i,j;
+
+  /* get motifs in segment [start,end] */
+  for(i = start; i <= end; i++){
+    unsigned int type = 0;
+    switch(l){
+      case 'e': type = VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP;
+                break;
+      case 'h': type = VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP;
+                break;
+      case 'i': type = VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP;
+                break;
+      case 'm': type = VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP;
+                break;
+    }
+
+    int *m = vrna_ud_get_motifs_at(vc, i, type);
+    if(m){
+      for(j = 0; m[j] != -1; j++){
+        int size = vc->domains_up->motif_size[m[j]];
+
+        if(i + size - 1 <= end){
+          if(*list_pos == *list_size){
+            *list_size *= 1.2;
+            *list = (vrna_ud_motif_t *)vrna_realloc(*list, sizeof(vrna_ud_motif_t) * (*list_size));
+          }
+          (*list)[*list_pos].start = i;
+          (*list)[*list_pos].number = m[j];
+          (*list_pos)++;
+        }
+      }
+    }
+    free(m);
+  }
+}
+
+
+PRIVATE void
+prepare_matrices( vrna_fold_compound_t *vc,
+                  struct ligands_up_data_default *data){
+
+  int         i,j,k,n,size;
+  vrna_ud_t   *domains_up;
+
+  n             = (int)vc->length;
+  size          = ((n+1)*(n+2))/2 + 1;
+  domains_up    = vc->domains_up;
+
+  free_default_data_matrices(data);
+
+  /* here we save memory by re-using DP matrices */
+  unsigned int lt[4] = {  VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP,
+                          VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+                          VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                          VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP };
+  int **m[4], *mx;
+  m[0] = &data->energies_ext;
+  m[1] = &data->energies_hp;
+  m[2] = &data->energies_int;
+  m[3] = &data->energies_mb;
+
+  for(i=0; i<4; i++){
+    unsigned int *col,*col2;
+    if(*(m[i]))
+      continue;
+
+    mx      = (int *)vrna_alloc(sizeof(int) * size);
+    col     = (unsigned int *)vrna_alloc(sizeof(unsigned int) * domains_up->motif_count);
+    col2    = (unsigned int *)vrna_alloc(sizeof(unsigned int) * domains_up->motif_count);
+    *(m[i]) = mx;
+
+    for(k = 0; k < domains_up->motif_count; k++)
+      col[k] = domains_up->motif_type[k] & lt[i];
+
+    /* check if any of the remaining DP matrices can point to the same location */
+    for(j=i+1;j<4;j++){
+      for(k = 0; k < domains_up->motif_count; k++){
+        col2[k] = domains_up->motif_type[k] & lt[j];
+        if(col[k] != col2[k])
+          break;
+      }
+      if(k == domains_up->motif_count){
+        *(m[j]) = mx;
+      }
+    }
+
+    free(col);
+    free(col2);
+  }
+}
+
+PRIVATE void
+prepare_exp_matrices( vrna_fold_compound_t *vc,
+                      struct ligands_up_data_default *data){
+
+  int         i,j,k,n,size;
+  vrna_ud_t   *domains_up;
+
+  n             = (int)vc->length;
+  size          = ((n+1)*(n+2))/2 + 1;
+  domains_up    = vc->domains_up;
+
+  free_default_data_exp_matrices(data);
+
+  /* here we save memory by re-using DP matrices */
+  unsigned int lt[4] = {  VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP,
+                          VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+                          VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP,
+                          VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP };
+  FLT_OR_DBL **m[4], *mx;
+  m[0] = &data->exp_energies_ext;
+  m[1] = &data->exp_energies_hp;
+  m[2] = &data->exp_energies_int;
+  m[3] = &data->exp_energies_mb;
+
+  for(i=0; i<4; i++){
+    unsigned int *col,*col2;
+    if(*(m[i]))
+      continue;
+
+    mx      = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * size);
+    col     = (unsigned int *)vrna_alloc(sizeof(unsigned int) * domains_up->motif_count);
+    col2    = (unsigned int *)vrna_alloc(sizeof(unsigned int) * domains_up->motif_count);
+    *(m[i]) = mx;
+
+    for(k = 0; k < domains_up->motif_count; k++)
+      col[k] = domains_up->motif_type[k] & lt[i];
+
+    /* check if any of the remaining DP matrices can point to the same location */
+    for(j=i+1;j<4;j++){
+      for(k = 0; k < domains_up->motif_count; k++){
+        col2[k] = domains_up->motif_type[k] & lt[j];
+        if(col[k] != col2[k])
+          break;
+      }
+      if(k == domains_up->motif_count){
+        *(m[j]) = mx;
+      }
+    }
+
+    free(col);
+    free(col2);
+  }
+
+  /* now prepate memory for outside partition function */
+  data->outside_ext = (struct default_outside **)vrna_alloc(sizeof(struct default_outside *) * (n + 2));
+  data->outside_hp  = (struct default_outside **)vrna_alloc(sizeof(struct default_outside *) * (n + 2));
+  data->outside_int = (struct default_outside **)vrna_alloc(sizeof(struct default_outside *) * (n + 2));
+  data->outside_mb  = (struct default_outside **)vrna_alloc(sizeof(struct default_outside *) * (n + 2));
+  data->outside_ext_count = (unsigned int *)vrna_alloc(sizeof(unsigned int) * (n + 2));
+  data->outside_hp_count  = (unsigned int *)vrna_alloc(sizeof(unsigned int) * (n + 2));
+  data->outside_int_count = (unsigned int *)vrna_alloc(sizeof(unsigned int) * (n + 2));
+  data->outside_mb_count  = (unsigned int *)vrna_alloc(sizeof(unsigned int) * (n + 2));
+}
+
+PRIVATE void
+prepare_default_data( vrna_fold_compound_t *vc,
+                      struct ligands_up_data_default *data){
+
+  int         i, n;
+  vrna_ud_t   *domains_up;
+
+  n           = (int)vc->length;
+  domains_up  = vc->domains_up;
+
+  data->n = n;
+  free_default_data(data);
+
+  /*
+      create motif_list for associating a nucleotide position with all
+      motifs that start there
+  */
+  data->motif_list_ext  = (int **)vrna_alloc(sizeof(int *) * (n+1));
+  data->motif_list_hp   = (int **)vrna_alloc(sizeof(int *) * (n+1));
+  data->motif_list_int  = (int **)vrna_alloc(sizeof(int *) * (n+1));
+  data->motif_list_mb   = (int **)vrna_alloc(sizeof(int *) * (n+1));
+  data->motif_list_ext[0] = NULL;
+  data->motif_list_hp[0]  = NULL;
+  data->motif_list_int[0] = NULL;
+  data->motif_list_mb[0]  = NULL;
+  for(i = 1; i <= n; i++){
+    data->motif_list_ext[i] = get_motifs(vc, i, VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP);
+    data->motif_list_hp[i]  = get_motifs(vc, i, VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP);
+    data->motif_list_int[i] = get_motifs(vc, i, VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP);
+    data->motif_list_mb[i]  = get_motifs(vc, i, VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP);
+  }
+
+  /*  store length of motifs in 'data' */
+  data->len = (int *)vrna_alloc(sizeof(int) * domains_up->motif_count);
+  for(i = 0; i < domains_up->motif_count; i++)
+    data->len[i] = domains_up->motif_size[i];
+
+}
+
+PRIVATE void
+default_prod_rule(vrna_fold_compound_t *vc,
+                  void *d){
+
+  int                             i,j,k,l,u,n,size,e_ext, e_hp, e_int, e_mb,en,en2,*idx;
+  unsigned int                    loop_type;
+  vrna_ud_t                       *domains_up;
+  struct ligands_up_data_default  *data;
+
+  int           *energies_ext;
+  int           *energies_hp;
+  int           *energies_int;
+  int           *energies_mb;
+
+  n             = (int)vc->length;
+  size          = ((n+1)*(n+2))/2 + 1;
+  idx           = vc->jindx;
+  domains_up    = vc->domains_up;
+  data          = (struct ligands_up_data_default *)d;
+
+  prepare_default_data(vc, data);
+  prepare_matrices(vc, data);
+
+  energies_ext  = data->energies_ext;
+  energies_hp   = data->energies_hp;
+  energies_int  = data->energies_int;
+  energies_mb   = data->energies_mb;
+
+  data->default_cb[VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP] = default_exp_energy_ext_motif;
+  data->default_cb[VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP]  = default_exp_energy_hp_motif;
+  data->default_cb[VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP] = default_exp_energy_int_motif;
+  data->default_cb[VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP]  = default_exp_energy_mb_motif;
+
+  /*  precompute energy contributions of the motifs */
+  data->dG = (int *)vrna_alloc(sizeof(int) * domains_up->motif_count);
+  for(i = 0; i < domains_up->motif_count; i++)
+    data->dG[i] = (int)roundf(domains_up->motif_en[i] * 100.);
+
+  /* now we can start to fill the DP matrices */
+  for(i=n; i>0; i--){
+    int *list_ext = data->motif_list_ext[i];
+    int *list_hp  = data->motif_list_hp[i];
+    int *list_int = data->motif_list_int[i];
+    int *list_mb  = data->motif_list_mb[i];
+    for(j=i;j<=n;j++){
+      if(i < j){
+        e_ext = energies_ext[idx[j]+i+1];
+        e_hp  = energies_hp[idx[j]+i+1];
+        e_int = energies_int[idx[j]+i+1];
+        e_mb  = energies_mb[idx[j]+i+1];
+      } else {
+        e_ext = INF;
+        e_hp  = INF;
+        e_int = INF;
+        e_mb  = INF;
+      }
+      if(list_ext){
+        for(k = 0; -1 != (l = list_ext[k]); k++){
+          u   = i + data->len[l] - 1;
+          en  = data->dG[l];
+          if(u <= j){
+            e_ext = MIN2(e_ext, en);
+            if(u < j){
+              en2 = en + energies_ext[idx[j]+u+1];
+              e_ext = MIN2(e_ext, en2);
+            }
+          }
+        }
+      }
+      if(list_hp){
+        for(k = 0; -1 != (l = list_hp[k]); k++){
+          u   = i + data->len[l] - 1;
+          en  = data->dG[l];
+          if(u <= j){
+            e_hp = MIN2(e_hp, en);
+            if(u < j){
+              en2 = en + energies_hp[idx[j]+u+1];
+              e_hp = MIN2(e_hp, en2);
+            }
+          }
+        }
+      }
+      if(list_int){
+        for(k = 0; -1 != (l = list_int[k]); k++){
+          u   = i + data->len[l] - 1;
+          en  = data->dG[l];
+          if(u <= j){
+            e_int = MIN2(e_int, en);
+            if(u < j){
+              en2 = en + energies_int[idx[j]+u+1];
+              e_int = MIN2(e_int, en2);
+            }
+          }
+        }
+      }
+      if(list_mb){
+        for(k = 0; -1 != (l = list_mb[k]); k++){
+          u   = i + data->len[l] - 1;
+          en  = data->dG[l];
+          if(u <= j){
+            e_mb = MIN2(e_mb, en);
+            if( u < j){
+              en2 = en + energies_mb[idx[j]+u+1];
+              e_mb = MIN2(e_mb, en2);
+            }
+          }
+        }
+      }
+
+      energies_ext[idx[j]+i]  = e_ext;
+      energies_hp[idx[j]+i]   = e_hp;
+      energies_int[idx[j]+i]  = e_int;
+      energies_mb[idx[j]+i]   = e_mb;
+    }
+  }
+}
+
+PRIVATE void
+default_exp_prod_rule(vrna_fold_compound_t *vc,
+                      void *d){
+
+  int                             i,j,k,l,u,n,size,*idx;
+  unsigned int                    loop_type;
+  FLT_OR_DBL                      q_ext, q_hp, q_int, q_mb, q, qq;
+  vrna_ud_t                       *domains_up;
+  struct ligands_up_data_default  *data;
+
+  FLT_OR_DBL    *exp_energies_ext;
+  FLT_OR_DBL    *exp_energies_hp;
+  FLT_OR_DBL    *exp_energies_int;
+  FLT_OR_DBL    *exp_energies_mb;
+  double        kT;
+
+  n             = (int)vc->length;
+  size          = ((n+1)*(n+2))/2 + 1;
+  idx           = vc->iindx;
+  domains_up    = vc->domains_up;
+  data          = (struct ligands_up_data_default *)d;
+  kT            = vc->exp_params->kT;
+
+  prepare_default_data(vc, data);
+  prepare_exp_matrices(vc, data);
+
+  exp_energies_ext  = data->exp_energies_ext;
+  exp_energies_hp   = data->exp_energies_hp;
+  exp_energies_int  = data->exp_energies_int;
+  exp_energies_mb   = data->exp_energies_mb;
+
+  data->default_cb[VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP] = default_exp_energy_ext_motif;
+  data->default_cb[VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP]  = default_exp_energy_hp_motif;
+  data->default_cb[VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP] = default_exp_energy_int_motif;
+  data->default_cb[VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP]  = default_exp_energy_mb_motif;
+
+  data->exp_e_mx[VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP] = data->exp_energies_ext;
+  data->exp_e_mx[VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP]  = data->exp_energies_hp;
+  data->exp_e_mx[VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP] = data->exp_energies_int;
+  data->exp_e_mx[VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP]  = data->exp_energies_mb;
+
+  /*  precompute energy contributions of the motifs */
+  data->exp_dG = (FLT_OR_DBL *)vrna_alloc(sizeof(FLT_OR_DBL) * domains_up->motif_count);
+  for(i = 0; i < domains_up->motif_count; i++){
+    double GT = domains_up->motif_en[i] * 1000.; /* in cal/mol */
+    data->exp_dG[i] = (FLT_OR_DBL)exp( -GT / kT);
+  }
+
+  /* now we can start to fill the DP matrices */
+  for(i=n; i>0; i--){
+    int *list_ext = data->motif_list_ext[i];
+    int *list_hp  = data->motif_list_hp[i];
+    int *list_int = data->motif_list_int[i];
+    int *list_mb  = data->motif_list_mb[i];
+    for(j = i; j <= n; j++){
+      if(i < j){
+        q_ext = exp_energies_ext[idx[i + 1] - j];
+        q_hp  = exp_energies_hp[idx[i + 1] - j];
+        q_int = exp_energies_int[idx[i + 1] - j];
+        q_mb  = exp_energies_mb[idx[i + 1] - j];
+      } else {
+        q_ext = 0;
+        q_hp  = 0;
+        q_int = 0;
+        q_mb  = 0;
+      }
+      if(list_ext){
+        for(k = 0; -1 != (l = list_ext[k]); k++){
+          u = i + data->len[l] - 1;
+          q = data->exp_dG[l];
+          if(u <= j){
+            q_ext += q;
+            if(u < j)
+              q_ext += q * exp_energies_ext[idx[u + 1] - j];
+          }
+        }
+      }
+      if(list_hp){
+        for(k = 0; -1 != (l = list_hp[k]); k++){
+          u   = i + data->len[l] - 1;
+          q  = data->exp_dG[l];
+          if(u <= j){
+            q_hp += q;
+            if(u < j)
+              q_hp += q * exp_energies_hp[idx[u + 1] - j];
+          }
+        }
+      }
+      if(list_int){
+        for(k = 0; -1 != (l = list_int[k]); k++){
+          u   = i + data->len[l] - 1;
+          q  = data->exp_dG[l];
+          if(u <= j){
+            q_int += q;
+            if(u < j)
+              q_int += q * exp_energies_int[idx[u + 1] - j];
+          }
+        }
+      }
+      if(list_mb){
+        for(k = 0; -1 != (l = list_mb[k]); k++){
+          u   = i + data->len[l] - 1;
+          q  = data->exp_dG[l];
+          if(u <= j){
+            q_mb += q;
+            if(u < j)
+              q_mb += q * exp_energies_mb[idx[u + 1] - j];
+          }
+        }
+      }
+
+      exp_energies_ext[idx[i] - j]  = q_ext;
+      exp_energies_hp[idx[i] - j]   = q_hp;
+      exp_energies_int[idx[i] - j]  = q_int;
+      exp_energies_mb[idx[i] - j]   = q_mb;
+    }
+  }
+}
+
+PRIVATE int
+default_energy( vrna_fold_compound_t *vc,
+                int i,
+                int j,
+                unsigned int loop_type,
+                void *d){
+
+  int en, ij, *idx = vc->jindx;
+  struct ligands_up_data_default *data = (struct ligands_up_data_default *)d;
+
+  en = INF;
+  ij = idx[j] + i;
+
+  if(j < i)
+    return INF;
+
+  if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_MOTIF){
+    if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP)
+      en = default_energy_ext_motif(i, j, data);
+    else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP)
+      en = default_energy_hp_motif(i, j, data);
+    else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP)
+      en = default_energy_int_motif(i, j, data);
+    else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP)
+      en = default_energy_mb_motif(i, j, data);
+  } else {
+    if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP){
+      if(data->energies_ext)
+        en = data->energies_ext[ij];
+    } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP){
+      if(data->energies_hp)
+        en = data->energies_hp[ij];
+    } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP){
+      if(data->energies_int)
+        en = data->energies_int[ij];
+    } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP){
+      if(data->energies_mb)
+        en = data->energies_mb[ij];
+    }
+  }
+
+  return en;
+}
+
+PRIVATE FLT_OR_DBL
+default_exp_energy( vrna_fold_compound_t *vc,
+                    int i,
+                    int j,
+                    unsigned int loop_type,
+                    void *d){
+
+  FLT_OR_DBL                      q;
+  int                             ij, *idx;
+  struct ligands_up_data_default  *data;
+
+  q     = 0;
+  data  = (struct ligands_up_data_default *)d;
+
+  if(j < i)
+    return 0.;
+
+  if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_MOTIF){
+    q = data->default_cb[loop_type & ~(VRNA_UNSTRUCTURED_DOMAIN_MOTIF)](i, j, data);
+  } else {
+    idx = vc->iindx;
+    ij  = idx[i] - j;
+    q   = data->exp_e_mx[loop_type][ij];
+  }
+
+  return q;
+}
+
+PRIVATE int
+default_energy_ext_motif( int i,
+                          int j,
+                          struct ligands_up_data_default *data){
+
+  int k, m;
+  int e = INF;
+
+  if(data->motif_list_ext[i]){
+    k = 0;
+    while(-1 != (m = data->motif_list_ext[i][k])){
+      if((i + data->len[m] - 1) == j)
+        e = MIN2(e, data->dG[m]);
+      k++;
+    }
+  }
+  return e;
+}
+
+PRIVATE int
+default_energy_hp_motif(int i,
+                        int j,
+                        struct ligands_up_data_default *data){
+
+  int k, m;
+  int e = INF;
+
+  if(data->motif_list_hp[i]){
+    k = 0;
+    while(-1 != (m = data->motif_list_hp[i][k])){
+      if((i + data->len[m] - 1) == j)
+        e = MIN2(e, data->dG[m]);
+      k++;
+    }
+  }
+  return e;
+}
+
+PRIVATE int
+default_energy_int_motif( int i,
+                          int j,
+                          struct ligands_up_data_default *data){
+
+  int k, m;
+  int e = INF;
+
+  if(data->motif_list_int[i]){
+    k = 0;
+    while(-1 != (m = data->motif_list_int[i][k])){
+      if((i + data->len[m] - 1) == j)
+        e = MIN2(e, data->dG[m]);
+      k++;
+    }
+  }
+  return e;
+}
+
+PRIVATE int
+default_energy_mb_motif(int i,
+                        int j,
+                        struct ligands_up_data_default *data){
+
+  int k, m;
+  int e = INF;
+
+  if(data->motif_list_mb[i]){
+    k = 0;
+    while(-1 != (m = data->motif_list_mb[i][k])){
+      if((i + data->len[m] - 1) == j)
+        e = MIN2(2, data->dG[m]);
+      k++;
+    }
+  }
+  return e;
+}
+
+PRIVATE FLT_OR_DBL
+default_exp_energy_ext_motif( int i,
+                              int j,
+                              struct ligands_up_data_default *data){
+
+  int         k, m;
+  FLT_OR_DBL  q = 0;
+
+  if(data->motif_list_ext[i]){
+    k = 0;
+    while(-1 != (m = data->motif_list_ext[i][k])){
+      if((i + data->len[m] - 1) == j)
+        q += data->exp_dG[m];
+      k++;
+    }
+  }
+
+  return q;
+}
+
+PRIVATE FLT_OR_DBL
+default_exp_energy_hp_motif(int i,
+                            int j,
+                            struct ligands_up_data_default *data){
+
+  int         k, m;
+  FLT_OR_DBL  q = 0;
+
+  if(data->motif_list_hp[i]){
+    k = 0;
+    while(-1 != (m = data->motif_list_hp[i][k])){
+      if((i + data->len[m] - 1) == j)
+        q += data->exp_dG[m];
+      k++;
+    }
+  }
+
+  return q;
+}
+
+PRIVATE FLT_OR_DBL
+default_exp_energy_int_motif( int i,
+                              int j,
+                              struct ligands_up_data_default *data){
+
+  int         k, m;
+  FLT_OR_DBL  q = 0;
+
+  if(data->motif_list_int[i]){
+    k = 0;
+    while(-1 != (m = data->motif_list_int[i][k])){
+      if((i + data->len[m] - 1) == j)
+        q += data->exp_dG[m];
+      k++;
+    }
+  }
+
+  return q;
+}
+
+PRIVATE FLT_OR_DBL
+default_exp_energy_mb_motif(int i,
+                            int j,
+                            struct ligands_up_data_default *data){
+
+  int         k, m;
+  FLT_OR_DBL  q = 0;
+
+  if(data->motif_list_mb[i]){
+    k = 0;
+    while(-1 != (m = data->motif_list_mb[i][k])){
+      if((i + data->len[m] - 1) == j)
+        q += data->exp_dG[m];
+      k++;
+    }
+  }
+
+  return q;
+}
+
+PRIVATE void
+default_probs_add(vrna_fold_compound_t *vc,
+                  int i,
+                  int j,
+                  unsigned int loop_type,
+                  FLT_OR_DBL exp_energy,
+                  void *data){
+
+  int                             **motif_list, k, l, m;
+  unsigned int                    *size, *cnt, o;
+  struct ligands_up_data_default  *d;
+  struct default_outside          **storage, **st;
+
+  d = (struct ligands_up_data_default  *)data;
+
+  if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_MOTIF){
+    if(j < i)
+      return;
+
+    if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP){
+      motif_list  = d->motif_list_ext;
+      storage     = &(d->outside_ext[i]);
+      size        = &(d->outside_ext_count[i]);
+    } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP) {
+      motif_list = d->motif_list_hp;
+      storage     = &(d->outside_hp[i]);
+      size        = &(d->outside_hp_count[i]);
+    } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP){
+      motif_list = d->motif_list_int;
+      storage     = &(d->outside_int[i]);
+      size        = &(d->outside_int_count[i]);
+    } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP){
+      motif_list = d->motif_list_mb;
+      storage     = &(d->outside_mb[i]);
+      size        = &(d->outside_mb_count[i]);
+    } else{
+      vrna_message_warning("Unknown unstructured domain loop type");
+      return;
+    }
+
+    k = 0;
+    while(-1 != (m = motif_list[i][k])){
+      if((i + d->len[m] - 1) == j){
+
+        /* check for addition first */
+        for(o = 0; o < *size; o++)
+          if((*storage)[o].motif_num == m){ /* found previously added motif constribution */
+            (*storage)[o].exp_energy += exp_energy;
+            break;
+          }
+
+        /* if we haven't added yet, create new list entry */
+        if(o == *size){
+          *storage = (struct default_outside *)vrna_realloc(*storage, sizeof(struct default_outside) * (*size + 1));
+          (*storage)[*size].motif_num   = m;
+          (*storage)[*size].exp_energy  = exp_energy;
+          (*size)++;
+        }
+      }
+      k++;
+    }
+
+  } else {
+    if(j < i)
+      return;
+
+    FLT_OR_DBL pf, exp_e;
+    pf = default_exp_energy(vc, i, j, loop_type, data);
+
+    if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP){
+      motif_list  = d->motif_list_ext;
+      storage     = d->outside_ext;
+      size        = d->outside_ext_count;
+    } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP) {
+      motif_list = d->motif_list_hp;
+      storage     = d->outside_hp;
+      size        = d->outside_hp_count;
+    } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP){
+      motif_list = d->motif_list_int;
+      storage     = d->outside_int;
+      size        = d->outside_int_count;
+    } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP){
+      motif_list = d->motif_list_mb;
+      storage     = d->outside_mb;
+      size        = d->outside_mb_count;
+    } else{
+      vrna_message_warning("Unknown unstructured domain loop type");
+      return;
+    }
+
+    /* check for each motif starting at any k with i <= k <= j */
+    for(k = i; k <= j; k++){
+      if(motif_list[k]){
+        st  = &(storage[k]);
+        cnt = &(size[k]);
+        for(l = 0; motif_list[k][l] != -1; l++){
+          m = motif_list[k][l];
+
+          if(j < k + d->len[m] - 1) /* motifs must be sorted be length */
+            continue;
+
+          exp_e         = d->exp_dG[m];
+          FLT_OR_DBL p  = exp_e / pf;
+
+          /* add/insert contribution */
+
+          /* check for addition first */
+          for(o = 0; o < *cnt; o++)
+            if((*st)[o].motif_num == m){ /* found previously added motif constribution */
+              (*st)[o].exp_energy += p * exp_energy;
+              break;
+            }
+
+          /* if we haven't added yet, create new list entry */
+          if(o == *cnt){
+            *st = (struct default_outside *)vrna_realloc(*st, sizeof(struct default_outside) * (*cnt + 1));
+            (*st)[*cnt].motif_num   = m;
+            (*st)[*cnt].exp_energy  = p * exp_energy;
+            (*cnt)++;
+          }
+        }
+      }
+    }
+  }
+
+}
+
+PRIVATE FLT_OR_DBL
+default_probs_get(vrna_fold_compound_t *vc,
+                  int i,
+                  int j,
+                  unsigned int loop_type,
+                  int motif,
+                  void *data){
+
+  FLT_OR_DBL                      outside = 0.;
+  unsigned int                    *size, k;
+  struct ligands_up_data_default  *d;
+  struct default_outside          **storage;
+
+  d = (struct ligands_up_data_default  *)data;
+
+  if(j < i)
+    return 0.;
+
+  if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP){
+    storage     = &(d->outside_ext[i]);
+    size        = &(d->outside_ext_count[i]);
+  } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP) {
+    storage     = &(d->outside_hp[i]);
+    size        = &(d->outside_hp_count[i]);
+  } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP){
+    storage     = &(d->outside_int[i]);
+    size        = &(d->outside_int_count[i]);
+  } else if(loop_type & VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP){
+    storage     = &(d->outside_mb[i]);
+    size        = &(d->outside_mb_count[i]);
+  } else{
+    vrna_message_warning("Unknown unstructured domain loop type");
+    return 0.;
+  }
+
+  for(k = 0; k < *size; k++){
+    /* check for motif number match */
+    if((*storage)[k].motif_num == motif)
+      /* check for length match */
+      if(i + d->len[motif] - 1 == j){
+        outside += (*storage)[k].exp_energy;
+      }
+  }
+
+  return outside;
+}
diff --git a/C/ViennaRNA/unstructured_domains.h b/C/ViennaRNA/unstructured_domains.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/unstructured_domains.h
@@ -0,0 +1,343 @@
+#ifndef VIENNA_RNA_PACKAGE_UNSTRUCTURED_DOMAIN_H
+#define VIENNA_RNA_PACKAGE_UNSTRUCTURED_DOMAIN_H
+
+/**
+ *  @file unstructured_domains.h
+ *  @ingroup domains_up
+ *  @brief    Functions to modify unstructured domains, e.g. to incorporate ligands binding to unpaired stretches
+ */
+
+/**
+ *  @addtogroup domains_up
+ *
+ *  @brief  Add and modify unstructured domains to the RNA folding grammar
+ *
+ *  This module provides the tools to add and modify unstructured domains to the production rules of the RNA folding grammar.
+ *  Usually this functionality is utilized for incorporating ligand binding to unpaired stretches of an RNA.
+ *
+ *  Unstructured domains appear in the production rules of the RNA folding grammar
+ *  whereever new unpaired nucleotides are attached to a growing substructure (see also @cite lorenz:2016b):
+ *  @image html   Crecursion.svg
+ *  @image latex  Crecursion.eps
+ *
+ *  The white boxes represent the stretch of RNA bound to the ligand and represented by a more or less specific
+ *  sequence motif. The motif itself is considered unable to form basepairs. The additional production rule @em U
+ *  is used to precompute the contribution of unpaired stretches possibly bound by one or more ligands. The
+ *  auxiliary DP matrix for this production rule is filled right before processing the other (regular) production
+ *  rules of the RNA folding grammar.
+ *
+ *  In a context with @ref domains_struc the grammar is extended as follows:
+ *
+ *  @image html   GCrecursion.svg
+ *  @image latex  GCrecursion.eps
+ *
+ *  @bug  Although the additional production rule(s) for unstructured domains in the descriptions of this feature
+ *        are always treated as 'segments possibly bound to one or more ligands', the current implementation requires
+ *        that at least one ligand is bound. The default implementation already takes care of the required changes,
+ *        however, upon using callback functions other than the default ones, one has to take care of this fact.
+ *        Please also note, that this behavior might change in one of the next releases, such that the decomposition
+ *        schemes as shown above comply with the actual implementation.
+ *
+ *  A default implementation allows one to readily use this feature by simply adding sequence motifs and corresponding
+ *  binding free energies with the function vrna_ud_add_motif() (see also @ref ligands_up).
+ *
+ *  The grammar extension is realized using a callback function that
+ *  - evaluates the binding free energy of a ligand to its target sequence segment (white boxes in the figures above), or
+ *  - returns the free energy of an unpaired stretch possibly bound by a ligand, stored in the additional @em U DP matrix.
+ *
+ *  The callback is passed the segment positions, the loop context, and which of the two above mentioned
+ *  evaluations are required. A second callback implements the pre-processing step that
+ *  prepares the @em U DP matrix by evaluating all possible cases of the additional production rule.
+ *  Both callbacks have a default implementation in @em RNAlib, but may be over-written by a
+ *  user-implementation, making it fully user-customizable.
+ *
+ *  For equilibrium probability computations, two additional callbacks exist. One to store/add and one to retrieve the
+ *  probability of unstructured domains at particular positions. Our implementation already takes care of computing
+ *  the probabilities, but users of the unstructured domain feature are required to provide a mechanism to efficiently
+ *  store/add the corresponding values into some external data structure.
+ */
+
+/** @brief Typename for the ligand binding extension data structure #vrna_unstructured_domain_s
+ *  @ingroup domains_up
+ */
+typedef struct vrna_unstructured_domain_s  vrna_ud_t;
+
+typedef struct vrna_unstructured_domain_motif_s  vrna_ud_motif_t;
+
+#include <ViennaRNA/data_structures.h>
+
+/**
+ *  @brief Callback to retrieve binding free energy of a ligand bound to an unpaired sequence segment
+ *  @ingroup domains_up
+ */
+typedef int (vrna_callback_ud_energy)(vrna_fold_compound_t *vc, int i, int j, unsigned int loop_type, void *data);
+
+/**
+ *  @brief Callback to retrieve Boltzmann factor of the binding free energy of a ligand bound to an unpaired sequence segment
+ *  @ingroup domains_up
+ */
+typedef FLT_OR_DBL (vrna_callback_ud_exp_energy)(vrna_fold_compound_t *vc, int i, int j, unsigned int loop_type, void *data);
+
+/**
+ *  @brief Callback for pre-processing the production rule of the ligand binding to unpaired stretches feature
+ *  @ingroup domains_up
+ */
+typedef void (vrna_callback_ud_production)(vrna_fold_compound_t *vc, void *data);
+
+/**
+ *  @brief Callback for pre-processing the production rule of the ligand binding to unpaired stretches feature (partition function variant)
+ *  @ingroup domains_up
+ */
+typedef void (vrna_callback_ud_exp_production)(vrna_fold_compound_t *vc, void *data);
+
+
+/**
+ *  @brief Callback to store/add equilibrium probability for a ligand bound to an unpaired sequence segment
+ *  @ingroup domains_up
+ */
+typedef void (vrna_callback_ud_probs_add)(vrna_fold_compound_t *vc, int i, int j, unsigned int loop_type, FLT_OR_DBL exp_energy, void *data);
+
+/**
+ *  @brief Callback to retrieve equilibrium probability for a ligand bound to an unpaired sequence segment
+ *  @ingroup domains_up
+ */
+typedef FLT_OR_DBL (vrna_callback_ud_probs_get)(vrna_fold_compound_t *vc, int i, int j, unsigned int loop_type, int motif, void *data);
+
+
+/**
+ *  @brief Flag to indicate ligand bound to unpiared stretch in the exterior loop
+ *  @ingroup domains_up
+ */
+#define VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP    1U
+
+/**
+ *  @brief Flag to indicate ligand bound to unpaired stretch in a hairpin loop
+ *  @ingroup domains_up
+ */
+#define VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP     2U
+
+/**
+ *  @brief Flag to indicate ligand bound to unpiared stretch in an interior loop
+ *  @ingroup domains_up
+ */
+#define VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP    4U
+
+/**
+ *  @brief Flag to indicate ligand bound to unpiared stretch in a multibranch loop
+ *  @ingroup domains_up
+ */
+#define VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP     8U
+
+/**
+ *  @brief Flag to indicate ligand binding without additional unbound nucleotides (motif-only)
+ *  @ingroup domains_up
+ */
+#define VRNA_UNSTRUCTURED_DOMAIN_MOTIF       16U
+
+/**
+ *  @brief Flag to indicate ligand bound to unpiared stretch in any loop (convenience macro)
+ *  @ingroup domains_up
+ */
+#define VRNA_UNSTRUCTURED_DOMAIN_ALL_LOOPS   (VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP | VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP | VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP)
+
+/**
+ *  @brief  Data structure to store all functionality for ligand binding
+ *  @ingroup domains_up
+ */
+struct vrna_unstructured_domain_s {
+
+  /*
+  **********************************
+    Keep track of all added motifs
+  **********************************
+  */
+  int                             uniq_motif_count; /**<  @brief The unique number of motifs of different lengths */ 
+  unsigned int                    *uniq_motif_size; /**<  @brief An array storing a unique list of motif lengths */
+
+  int                             motif_count;      /**<  @brief Total number of distinguished motifs */
+  char                            **motif;          /**<  @brief Motif sequences */
+  unsigned int                    *motif_size;      /**<  @brief Motif lengths */
+  double                          *motif_en;        /**<  @brief Ligand binding free energy contribution */
+  unsigned int                    *motif_type;      /**<  @brief Type of motif, i.e. loop type the ligand binds to */
+
+  /*
+  **********************************
+    Grammar extension for ligand
+    binding
+  **********************************
+  */
+  vrna_callback_ud_production     *prod_cb;       /**<  @brief Callback to ligand binding production rule, i.e. create/fill DP free energy matrices
+                                                   *    @details This callback will be executed right before the actual secondary structure decompositions,
+                                                   *    and, therefore, any implementation must not interleave with the regular DP matrices.
+                                                   */
+  vrna_callback_ud_exp_production *exp_prod_cb;   /**<  @brief Callback to ligand binding production rule, i.e. create/fill DP partition function matrices */
+  vrna_callback_ud_energy         *energy_cb;     /**<  @brief Callback to evaluate free energy of ligand binding to a particular unpaired stretch */
+  vrna_callback_ud_exp_energy     *exp_energy_cb; /**<  @brief Callback to evaluate Boltzmann factor of ligand binding to a particular unpaired stretch */
+  void                            *data;          /**<  @brief Auxiliary data structure passed to energy evaluation callbacks */
+  vrna_callback_free_auxdata      *free_data;     /**<  @brief Callback to free auxiliary data structure */
+  vrna_callback_ud_probs_add      *probs_add;     /**<  @brief Callback to store/add outside partition function */
+  vrna_callback_ud_probs_get      *probs_get;     /**<  @brief Callback to retrieve outside partition function */
+};
+
+
+struct vrna_unstructured_domain_motif_s {
+  int start;
+  int number;
+};
+
+
+/**
+ *  @brief  Add an unstructured domain motif, e.g. for ligand binding
+ *
+ *  This function adds a ligand binding motif and the associated binding free energy
+ *  to the #vrna_ud_t attribute of a #vrna_fold_compound_t. The motif data
+ *  will then be used in subsequent secondary structure predictions. Multiple calls
+ *  to this function with different motifs append all additional data to a list of
+ *  ligands, which all will be evaluated. Ligand motif data can be removed from the
+ *  #vrna_fold_compound_t again using the vrna_ud_remove() function. The loop
+ *  type parameter allows one to limit the ligand binding to particular loop type,
+ *  such as the exterior loop, hairpin loops, interior loops, or multibranch loops.
+ *
+ *  @see  #VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP, #VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP,
+ *  #VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP, #VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP, #VRNA_UNSTRUCTURED_DOMAIN_ALL_LOOPS,
+ *  vrna_ud_remove()
+ *
+ *  @ingroup domains_up
+ *
+ *  @param  vc        The #vrna_fold_compound_t data structure the ligand motif should be bound to
+ *  @param  motif     The sequence motif the ligand binds to
+ *  @param  motif_en  The binding free energy of the ligand in kcal/mol
+ *  @param  loop_type The loop type the ligand binds to
+ *
+ */
+void  vrna_ud_add_motif(vrna_fold_compound_t *vc,
+                        const char *motif,
+                        double motif_en,
+                        unsigned int loop_type);
+
+
+/**
+ *  @brief  Get a list of unique motif sizes that start at a certain position within the sequence
+ *
+ */
+int *vrna_ud_get_motif_size_at( vrna_fold_compound_t *vc,
+                                int i,
+                                unsigned int loop_type);
+
+
+int *
+vrna_ud_get_motifs_at(vrna_fold_compound_t *vc,
+                      int i,
+                      unsigned int loop_type);
+
+
+vrna_ud_motif_t *
+vrna_ud_detect_motifs(vrna_fold_compound_t *vc,
+                      const char *structure);
+
+
+/**
+ *  @brief Remove ligand binding to unpaired stretches
+ *
+ *  This function removes all ligand motifs that were bound to a #vrna_fold_compound_t using
+ *  the vrna_ud_add_motif() function.
+ *
+ *  @ingroup domains_up
+ *
+ *  @param vc The #vrna_fold_compound_t data structure the ligand motif data should be removed from
+ */
+void  vrna_ud_remove(vrna_fold_compound_t *vc);
+
+/**
+ *  @brief  Attach an auxiliary data structure
+ *
+ *  This function binds an arbitrary, auxiliary data structure for user-implemented ligand binding.
+ *  The optional callback @p free will be passed the bound data structure whenever the #vrna_fold_compound_t
+ *  is removed from memory to avoid memory leaks.
+ *
+ *  @see vrna_ud_set_prod_rule_cb(), vrna_ud_set_exp_prod_rule_cb(),
+ *  vrna_ud_remove()
+ *
+ *  @ingroup domains_up
+ *
+ *  @param  vc      The #vrna_fold_compound_t data structure the auxiliary data structure should be bound to
+ *  @param  data    A pointer to the auxiliary data structure
+ *  @param  free_cb A pointer to a callback function that free's memory occupied by @p data
+ */
+void  vrna_ud_set_data( vrna_fold_compound_t        *vc,
+                        void                        *data,
+                        vrna_callback_free_auxdata  *free_cb);
+
+/**
+ *  @brief Attach production rule callbacks for free energies computations
+ *
+ *  Use this function to bind a user-implemented grammar extension for unstructured
+ *  domains.
+ *
+ *  The callback @p e_cb needs to evaluate the free energy contribution @f$f(i,j)@f$ of
+ *  the unpaired segment @f$[i,j]@f$. It will be executed in each of the regular secondary
+ *  structure production rules. Whenever the callback is passed the #VRNA_UNSTRUCTURED_DOMAIN_MOTIF
+ *  flag via its @p loop_type parameter the contribution of any ligand that consecutively
+ *  binds from position @f$i@f$ to @f$j@f$ (the white box) is requested. Otherwise, the callback
+ *  usually performs a lookup in the precomputed @p B matrices. Which @p B matrix is
+ *  addressed will be indicated by the flags #VRNA_UNSTRUCTURED_DOMAIN_EXT_LOOP, #VRNA_UNSTRUCTURED_DOMAIN_HP_LOOP
+ *  #VRNA_UNSTRUCTURED_DOMAIN_INT_LOOP, and #VRNA_UNSTRUCTURED_DOMAIN_MB_LOOP. As their names already imply,
+ *  they specify exterior loops (@p F production rule), hairpin loops and interior loops
+ *  (@p C production rule), and multibranch loops (@p M and @p M1 production rule).
+ *  
+ *  @image html   ligands_up_callback.svg
+ *  @image latex  ligands_up_callback.eps
+ *
+ *  The @p pre_cb callback will be executed as a pre-processing step right before the
+ *  regular secondary structure rules. Usually one would use this callback to fill the
+ *  dynamic programming matrices @p U and preparations of the auxiliary data structure
+ *  #vrna_unstructured_domain_s.data
+ *
+ *  @image html   B_prod_rule.svg
+ *  @image latex  B_prod_rule.eps
+ *
+ *  @ingroup domains_up
+ *
+ *  @param  vc      The #vrna_fold_compound_t data structure the callback will be bound to
+ *  @param  pre_cb  A pointer to a callback function for the @p B production rule
+ *  @param  e_cb    A pointer to a callback function for free energy evaluation
+ */
+void vrna_ud_set_prod_rule_cb(vrna_fold_compound_t        *vc,
+                              vrna_callback_ud_production *pre_cb,
+                              vrna_callback_ud_energy     *e_cb);
+
+
+/**
+ *  @brief Attach production rule for partition function
+ *
+ *  This function is the partition function companion of vrna_ud_set_prod_rule_cb().
+ *
+ *  Use it to bind callbacks to (i) fill the @p U production rule dynamic programming
+ *  matrices and/or prepare the #vrna_unstructured_domain_s.data, and (ii) provide a callback
+ *  to retrieve partition functions for subsegments @f$ [i,j] @f$.
+ *
+ *  @image html   B_prod_rule.svg
+ *  @image latex  B_prod_rule.eps
+ *
+ *  @image html   ligands_up_callback.svg
+ *  @image latex  ligands_up_callback.eps
+ *
+ *  @ingroup domains_up
+ *
+ *  @see vrna_ud_set_prod_rule_cb()
+ *
+ *  @param  vc        The #vrna_fold_compound_t data structure the callback will be bound to
+ *  @param  pre_cb    A pointer to a callback function for the @p B production rule
+ *  @param  exp_e_cb  A pointer to a callback function that retrieves the partition function
+ *                    for a segment @f$[i,j]@f$ that may be bound by one or more ligands.
+ */
+void  vrna_ud_set_exp_prod_rule_cb( vrna_fold_compound_t            *vc,
+                                    vrna_callback_ud_exp_production *pre_cb,
+                                    vrna_callback_ud_exp_energy     *exp_e_cb);
+
+
+void  vrna_ud_set_prob_cb(vrna_fold_compound_t        *vc,
+                          vrna_callback_ud_probs_add  *setter,
+                          vrna_callback_ud_probs_get  *getter);
+
+#endif
diff --git a/C/ViennaRNA/utils.c b/C/ViennaRNA/utils.c
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/utils.c
@@ -0,0 +1,524 @@
+/*
+                               utils.c
+
+                 c  Ivo L Hofacker and Walter Fontana
+                          Vienna RNA package
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <time.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdint.h>
+#include <stdarg.h>
+#include <errno.h>
+
+/* for getpid() we need some distinction between UNIX and Win systems */
+#ifdef _WIN32
+#include <windows.h>
+#define getpid() GetCurrentProcessId() /* rename windows specific getpid function */
+#else
+#include <unistd.h>
+#endif
+
+#include "ViennaRNA/utils.h"
+
+#ifdef WITH_DMALLOC
+#include "dmalloc.h"
+#endif
+
+#define PRIVATE  static
+#define PUBLIC
+
+#define EXIT_ON_ERROR
+
+#include "ViennaRNA/color_output.inc"
+
+/*
+#################################
+# GLOBAL VARIABLES              #
+#################################
+*/
+/*@notnull@ @only@*/
+PUBLIC unsigned short xsubi[3];
+
+
+/*
+#################################
+# PRIVATE VARIABLES             #
+#################################
+*/
+PRIVATE char  scale1[] = "....,....1....,....2....,....3....,....4";
+PRIVATE char  scale2[] = "....,....5....,....6....,....7....,....8";
+PRIVATE char  *inbuf = NULL;
+PRIVATE char  *inbuf2 = NULL;
+PRIVATE unsigned int typebuf2 = 0;
+
+
+/*
+#################################
+# PRIVATE FUNCTION DECLARATIONS #
+#################################
+*/
+PRIVATE uint32_t  rj_mix( uint32_t a, uint32_t b, uint32_t c);
+
+
+/*
+#################################
+# BEGIN OF FUNCTION DEFINITIONS #
+#################################
+*/
+
+#ifndef WITH_DMALLOC
+/* include the following two functions only if not including <dmalloc.h> */
+
+PUBLIC void *
+vrna_alloc(unsigned size){
+
+  void *pointer;
+
+  if ( (pointer = (void *) calloc(1, (size_t) size)) == NULL) {
+#ifdef EINVAL
+    if (errno==EINVAL) {
+      fprintf(stderr,"vrna_alloc: requested size: %d\n", size);
+      vrna_message_error("Memory allocation failure -> EINVAL");
+    }
+    if (errno==ENOMEM)
+#endif
+      vrna_message_error("Memory allocation failure -> no memory");
+  }
+  return  pointer;
+}
+
+PUBLIC void *
+vrna_realloc(void *p, unsigned size){
+
+  if (p == NULL)
+    return vrna_alloc(size);
+  p = (void *) realloc(p, size);
+  if (p == NULL) {
+#ifdef EINVAL
+    if (errno==EINVAL) {
+      fprintf(stderr,"vrna_realloc: requested size: %d\n", size);
+      vrna_message_error("vrna_realloc allocation failure -> EINVAL");
+    }
+    if (errno==ENOMEM)
+#endif
+      vrna_message_error("vrna_realloc allocation failure -> no memory");
+  }
+  return p;
+}
+
+#endif
+
+/*------------------------------------------------------------------------*/
+
+PUBLIC void
+vrna_message_error(const char *format, ...){
+
+  va_list args;
+  va_start(args, format);
+  vrna_message_verror(format, args);
+  va_end(args);
+}
+
+
+PUBLIC void
+vrna_message_verror(const char *format, va_list args){
+
+#ifndef WITHOUT_TTY_COLORS
+  if(isatty(fileno(stderr))){
+    fprintf(stderr, ANSI_COLOR_RED_B "ERROR: " ANSI_COLOR_RESET ANSI_COLOR_BRIGHT);
+    vfprintf(stderr, format, args);
+    fprintf(stderr, ANSI_COLOR_RESET "\n");
+  } else {
+#endif
+    fprintf(stderr, "ERROR: ");
+    vfprintf(stderr, format, args);
+    fprintf(stderr, "\n");
+#ifndef WITHOUT_TTY_COLORS
+  }
+#endif
+
+#ifdef EXIT_ON_ERROR
+  exit(EXIT_FAILURE);
+#endif
+}
+
+
+PUBLIC void
+vrna_message_warning(const char *format, ...){
+
+  va_list args;
+  va_start(args, format);
+  vrna_message_vwarning(format, args);
+  va_end(args);
+}
+
+
+PUBLIC void
+vrna_message_vwarning(const char *format, va_list args){
+
+#ifndef WITHOUT_TTY_COLORS
+  if(isatty(fileno(stderr))){
+    fprintf(stderr, ANSI_COLOR_MAGENTA_B "WARNING: " ANSI_COLOR_RESET ANSI_COLOR_BRIGHT);
+    vfprintf(stderr, format, args);
+    fprintf(stderr, ANSI_COLOR_RESET "\n");
+  } else {
+#endif
+    fprintf(stderr, "WARNING: ");
+    vfprintf(stderr, format, args);
+    fprintf(stderr, "\n");
+#ifndef WITHOUT_TTY_COLORS
+  }
+#endif
+}
+
+
+PUBLIC void
+vrna_message_info(FILE *fp, const char *format, ...){
+
+  va_list args;
+  va_start(args, format);
+  vrna_message_vinfo(fp, format, args);
+  va_end(args);
+}
+
+
+PUBLIC void
+vrna_message_vinfo(FILE *fp, const char *format, va_list args){
+
+  if(!fp)
+    fp = stdout;
+
+#ifndef WITHOUT_TTY_COLORS
+  if(isatty(fileno(fp))){
+    fprintf(fp, ANSI_COLOR_BLUE_B);
+    vfprintf(fp, format, args);
+    fprintf(fp, ANSI_COLOR_RESET "\n");
+  } else {
+#endif
+    vfprintf(fp, format, args);
+    fprintf(fp, "\n");
+#ifndef WITHOUT_TTY_COLORS
+  }
+#endif
+}
+
+
+/*------------------------------------------------------------------------*/
+PUBLIC void
+vrna_init_rand(void){
+
+  uint32_t seed = rj_mix(clock(), time(NULL), getpid());
+
+  xsubi[0] = xsubi[1] = xsubi[2] = (unsigned short) seed;  /* lower 16 bit */
+  xsubi[1] += (unsigned short) ((unsigned)seed >> 6);
+  xsubi[2] += (unsigned short) ((unsigned)seed >> 12);
+#ifndef HAVE_ERAND48
+  srand((unsigned int) seed);
+#endif
+}
+
+/*------------------------------------------------------------------------*/
+
+/* uniform random number generator; vrna_urn() is in [0,1] */
+/* uses a linear congruential library routine */
+/* 48 bit arithmetic */
+PUBLIC double
+vrna_urn(void){
+
+#ifdef HAVE_ERAND48
+  extern double erand48(unsigned short[]);
+  return erand48(xsubi);
+#else
+  return ((double) rand())/RAND_MAX;
+#endif
+}
+
+/*------------------------------------------------------------------------*/
+
+PUBLIC int
+vrna_int_urn(int from, int to){
+
+  return ( ( (int) (vrna_urn()*(to-from+1)) ) + from );
+}
+
+/*------------------------------------------------------------------------*/
+
+/*-----------------------------------------------------------------*/
+
+PUBLIC char *
+vrna_time_stamp(void){
+
+  time_t  cal_time;
+
+  cal_time = time(NULL);
+  return ( ctime(&cal_time) );
+}
+
+/*-----------------------------------------------------------------*/
+
+PUBLIC  unsigned int get_input_line(char **string, unsigned int option){
+  char  *line;
+  int   i, l, r;
+
+  /*
+  * read lines until informative data appears or
+  * report an error if anything goes wrong
+  */
+  if((line = vrna_read_line(stdin))==NULL) return VRNA_INPUT_ERROR;
+
+  if(!(option & VRNA_INPUT_NOSKIP_COMMENTS))
+    while((*line=='*')||(*line=='\0')){
+      free(line);
+      if((line = vrna_read_line(stdin))==NULL) return VRNA_INPUT_ERROR;
+    }
+
+  l = (int) strlen(line);
+
+  /* break on '@' sign if not disabled */
+  if(*line == '@'){
+    free(line);
+    return VRNA_INPUT_QUIT;
+  }
+  /* print line read if not disabled */
+  /* if(!(option & VRNA_INPUT_NOPRINT)) printf("%s\n", line); */
+
+  /* eliminate whitespaces at the end of the line read */
+  if(!(option & VRNA_INPUT_NO_TRUNCATION)){
+    for(i = l-1; i >= 0; i--){
+      if      (line[i] == ' ')  continue;
+      else if (line[i] == '\t') continue;
+      else                      break;
+    }
+    line[(i >= 0) ? (i+1) : 0] = '\0';
+  }
+
+  if(*line == '>'){
+    /* fasta header */
+    /* alloc memory for the string */
+    *string = (char *) vrna_alloc(sizeof(char) * (strlen(line) + 1));
+    r = VRNA_INPUT_FASTA_HEADER;
+    i = sscanf(line, ">%s", *string);
+    if(i > 0){
+      i       = (int)     strlen(*string);
+      *string = (char *)  vrna_realloc(*string, (i+1)*sizeof(char));
+      free(line);
+      return r;
+    }
+    else{
+      free(line);
+      free(*string);
+      *string = NULL;
+      return VRNA_INPUT_ERROR;
+    }
+  }
+  else{
+    *string = strdup(line);
+    free(line);
+  }
+  return VRNA_INPUT_MISC;
+}
+
+
+PUBLIC void
+vrna_message_input_seq_simple(void){
+
+  vrna_message_input_seq("Input string (upper or lower case)");
+}
+
+PUBLIC  void
+vrna_message_input_seq(const char *s){
+#ifndef WITHOUT_TTY_COLORS
+  if(isatty(fileno(stdout))){
+    printf("\n" ANSI_COLOR_CYAN "%s; @ to quit" ANSI_COLOR_RESET "\n", s);
+    printf(ANSI_COLOR_BRIGHT "%s%s" ANSI_COLOR_RESET "\n", scale1, scale2);
+  } else {
+#endif
+    printf("\n%s; @ to quit\n", s);
+    printf("%s%s\n", scale1, scale2);
+#ifndef WITHOUT_TTY_COLORS
+  }
+#endif
+  (void) fflush(stdout);
+}
+
+PUBLIC int *
+vrna_idx_row_wise(unsigned int length){
+
+  int i;
+  int *idx = (int *)vrna_alloc(sizeof(int) * (length+1));
+  for (i=1; i <= length; i++)
+    idx[i] = (((length + 1 - i) * (length - i)) / 2) + length + 1;
+  return idx;
+}
+
+PUBLIC int *
+vrna_idx_col_wise(unsigned int length){
+
+  unsigned int i;
+  int *idx = (int *)vrna_alloc(sizeof(int) * (length+1));
+  for (i = 1; i <= length; i++)
+    idx[i] = (i*(i-1)) / 2; 
+  return idx;
+}
+
+
+/*
+#################################
+# STATIC helper functions below #
+#################################
+*/
+PRIVATE uint32_t
+rj_mix( uint32_t a,
+        uint32_t b,
+        uint32_t c){
+
+/*
+  This is Robert Jenkins' 96 bit Mix function
+
+  we use it to produce a more diverse seed for our random number
+  generators. E.g.:
+  
+  seed = rj_mix(clock(), time(NULL), getpid());
+
+  original comments on that function can be found below
+*/
+
+
+/*
+--------------------------------------------------------------------
+mix -- mix 3 32-bit values reversibly.
+For every delta with one or two bits set, and the deltas of all three
+  high bits or all three low bits, whether the original value of a,b,c
+  is almost all zero or is uniformly distributed,
+* If mix() is run forward or backward, at least 32 bits in a,b,c
+  have at least 1/4 probability of changing.
+* If mix() is run forward, every bit of c will change between 1/3 and
+  2/3 of the time.  (Well, 22/100 and 78/100 for some 2-bit deltas.)
+mix() was built out of 36 single-cycle latency instructions in a 
+  structure that could supported 2x parallelism, like so:
+      a -= b; 
+      a -= c; x = (c>>13);
+      b -= c; a ^= x;
+      b -= a; x = (a<<8);
+      c -= a; b ^= x;
+      c -= b; x = (b>>13);
+      ...
+  Unfortunately, superscalar Pentiums and Sparcs can't take advantage 
+  of that parallelism.  They've also turned some of those single-cycle
+  latency instructions into multi-cycle latency instructions.  Still,
+  this is the fastest good hash I could find.  There were about 2^^68
+  to choose from.  I only looked at a billion or so.
+--------------------------------------------------------------------
+*/
+
+  a=a-b;  a=a-c;  a=a^(c >> 13);
+  b=b-c;  b=b-a;  b=b^(a << 8); 
+  c=c-a;  c=c-b;  c=c^(b >> 13);
+  a=a-b;  a=a-c;  a=a^(c >> 12);
+  b=b-c;  b=b-a;  b=b^(a << 16);
+  c=c-a;  c=c-b;  c=c^(b >> 5);
+  a=a-b;  a=a-c;  a=a^(c >> 3);
+  b=b-c;  b=b-a;  b=b^(a << 10);
+  c=c-a;  c=c-b;  c=c^(b >> 15);
+  return c;
+}
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+/*###########################################*/
+/*# deprecated functions below              #*/
+/*###########################################*/
+
+PUBLIC int *
+get_iindx(unsigned int length){
+
+  return vrna_idx_row_wise(length);
+}
+
+PUBLIC int *
+get_indx(unsigned int length){
+
+  return vrna_idx_col_wise(length);
+}
+
+PUBLIC void
+print_tty_input_seq(void){
+
+  vrna_message_input_seq_simple();
+}
+
+PUBLIC void
+print_tty_input_seq_str(const char *s){
+
+  vrna_message_input_seq(s);
+}
+
+PUBLIC void
+warn_user(const char message[]){
+
+  vrna_message_warning(message);
+}
+
+PUBLIC void
+nrerror(const char message[]){
+
+  vrna_message_error(message);
+}
+
+PUBLIC void *space(unsigned size) {
+
+  return vrna_alloc(size);
+}
+
+#undef  xrealloc
+/* dmalloc.h #define's vrna_realloc */
+PUBLIC void *xrealloc(void *p, unsigned size){
+
+  return vrna_realloc(p, size);
+}
+
+PUBLIC void
+init_rand(void){
+
+  vrna_init_rand();
+}
+
+PUBLIC double urn(void){
+
+  return vrna_urn();
+}
+
+PUBLIC int
+int_urn(int from, int to){
+
+  return vrna_int_urn(from, to);
+}
+
+PUBLIC void
+filecopy(FILE *from, FILE *to){
+
+  vrna_file_copy(from, to);
+}
+
+PUBLIC char *
+time_stamp(void){
+
+  return vrna_time_stamp();
+}
+
+PUBLIC char *
+get_line(FILE *fp){ /* reads lines of arbitrary length from fp */
+
+  return vrna_read_line(fp);
+}
+#endif
diff --git a/C/ViennaRNA/utils.h b/C/ViennaRNA/utils.h
new file mode 100644
--- /dev/null
+++ b/C/ViennaRNA/utils.h
@@ -0,0 +1,471 @@
+#ifndef VIENNA_RNA_PACKAGE_UTILS_H
+#define VIENNA_RNA_PACKAGE_UTILS_H
+
+/* make this interface backward compatible with RNAlib < 2.2.0 */
+#define VRNA_BACKWARD_COMPAT
+
+#ifdef DEPRECATION_WARNINGS
+# ifdef __GNUC__
+#  define DEPRECATED(func) func __attribute__ ((deprecated))
+# else
+#  define DEPRECATED(func) func
+# endif
+#else
+# define DEPRECATED(func) func
+#endif
+
+/**
+ *  @file     utils.h
+ *  @ingroup  utils
+ *  @brief    General utility- and helper-functions used throughout the @em ViennaRNA @em Package
+ */
+
+/**
+ *  @{
+ *  @ingroup  utils
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#include <ViennaRNA/data_structures.h>
+#include <ViennaRNA/string_utils.h>
+#include <ViennaRNA/structure_utils.h>
+#include <ViennaRNA/file_utils.h>
+#include <ViennaRNA/alphabet.h>
+
+/* two helper macros to indicate whether a function should be exported in
+the library or stays hidden */
+#define PUBLIC
+#define PRIVATE static
+
+/**
+ *  @brief Output flag of get_input_line():  @e "An ERROR has occured, maybe EOF"
+ */
+#define VRNA_INPUT_ERROR                  1U
+/**
+ *  @brief @brief Output flag of get_input_line():  @e "the user requested quitting the program"
+ */
+#define VRNA_INPUT_QUIT                   2U
+/**
+ *  @brief Output flag of get_input_line():  @e "something was read"
+ */
+#define VRNA_INPUT_MISC                   4U
+
+/**
+ *  @brief  Input/Output flag of get_input_line():\n
+ *  if used as input option this tells get_input_line() that the data to be read should comply
+ *  with the FASTA format
+ * 
+ *  the function will return this flag if a fasta header was read
+ */
+#define VRNA_INPUT_FASTA_HEADER           8U
+
+/*
+ *  @brief  Input flag for get_input_line():\n
+ *  Tell get_input_line() that we assume to read a nucleotide sequence
+ * 
+ */
+#define VRNA_INPUT_SEQUENCE               16U
+
+/** @brief  Input flag for get_input_line():\n
+ *  Tell get_input_line() that we assume to read a structure constraint
+ * 
+ */
+#define VRNA_INPUT_CONSTRAINT             32U
+
+/**
+ *  @brief  Input switch for get_input_line():
+ *  @e "do not trunkate the line by eliminating white spaces at end of line"
+ */
+#define VRNA_INPUT_NO_TRUNCATION          256U
+
+/**
+ *  @brief  Input switch for vrna_file_fasta_read_record():  @e "do fill rest array"
+ */
+#define VRNA_INPUT_NO_REST                512U
+
+/**
+ *  @brief  Input switch for vrna_file_fasta_read_record():  @e "never allow data to span more than one line"
+ */
+#define VRNA_INPUT_NO_SPAN                1024U
+
+/**
+ *  @brief  Input switch for vrna_file_fasta_read_record():  @e "do not skip empty lines"
+ */
+#define VRNA_INPUT_NOSKIP_BLANK_LINES     2048U
+
+/**
+ *  @brief  Output flag for vrna_file_fasta_read_record():  @e "read an empty line"
+ */
+#define VRNA_INPUT_BLANK_LINE             4096U
+
+/**
+ *  @brief Input switch for get_input_line():  @e "do not skip comment lines"
+ */
+#define VRNA_INPUT_NOSKIP_COMMENTS        128U
+
+/**
+ *  @brief  Output flag for vrna_file_fasta_read_record():  @e "read a comment"
+ */
+#define VRNA_INPUT_COMMENT                8192U
+
+/**
+ *  @brief Get the minimum of two comparable values
+ */
+#define MIN2(A, B)      ((A) < (B) ? (A) : (B))
+
+/**
+ *  @brief Get the maximum of two comparable values
+ */
+#define MAX2(A, B)      ((A) > (B) ? (A) : (B))
+
+/**
+ *  @brief Get the minimum of three comparable values
+ */
+#define MIN3(A, B, C)   (MIN2(  (MIN2((A),(B))) ,(C)))
+
+/**
+ *  @brief Get the maximum of three comparable values
+ */
+#define MAX3(A, B, C)   (MAX2(  (MAX2((A),(B))) ,(C)))
+
+
+#ifdef WITH_DMALLOC
+/* use dmalloc library to check for memory management bugs */
+#include "dmalloc.h"
+#define vrna_alloc(S)       calloc(1,(S))
+#define vrna_realloc(p, S)  xrealloc(p, S)
+#else
+
+/**
+ *  @brief Allocate space safely
+ *
+ *  @param size The size of the memory to be allocated in bytes
+ *  @return     A pointer to the allocated memory
+ */
+void  *vrna_alloc(unsigned size);
+
+/**
+ *  @brief Reallocate space safely
+ *
+ *  @param p    A pointer to the memory region to be reallocated
+ *  @param size The size of the memory to be allocated in bytes
+ *  @return     A pointer to the newly allocated memory
+ */
+void  *vrna_realloc(void *p, unsigned size);
+
+#endif
+
+/**
+ *  @brief Print an error message and die
+ *
+ *  This function is a wrapper to @em fprintf(stderr, ...) that
+ *  puts a capital <b>ERROR:</b> in front of the message and then exits
+ *  the calling program.
+ *
+ *  @see vrna_message_verror(), vrna_message_warning(), vrna_message_info()
+ *
+ *  @param format The error message to be printed
+ *  @param ...    Optional arguments for the formatted message string
+ */
+void vrna_message_error(const char *format, ...);
+
+
+/**
+ *  @brief Print an error message and die
+ *
+ *  This function is a wrapper to @em vfprintf(stderr, ...) that
+ *  puts a capital <b>ERROR:</b> in front of the message and then exits
+ *  the calling program.
+ *
+ *  @see vrna_message_error(), vrna_message_warning(), vrna_message_info()
+ *
+ *  @param format The error message to be printed
+ *  @param args   The argument list for the formatted message string
+ */
+void vrna_message_verror(const char *format, va_list args);
+
+
+/**
+ *  @brief Print a warning message
+ *
+ *  This function is a wrapper to @em fprintf(stderr, ...) that
+ *  puts a capital <b>WARNING:</b> in front of the message.
+ *
+ *  @see vrna_message_vwarning(), vrna_message_error(), vrna_message_info()
+ *
+ *  @param format The warning message to be printed
+ *  @param ...    Optional arguments for the formatted message string
+ */
+void vrna_message_warning(const char *format, ...);
+
+
+/**
+ *  @brief Print a warning message
+ *
+ *  This function is a wrapper to @em fprintf(stderr, ...) that
+ *  puts a capital <b>WARNING:</b> in front of the message.
+ *
+ *  @see vrna_message_vwarning(), vrna_message_error(), vrna_message_info()
+ *
+ *  @param format The warning message to be printed
+ *  @param args   The argument list for the formatted message string
+ */
+void vrna_message_vwarning(const char *format, va_list args);
+
+
+/**
+ *  @brief Print an info message
+ *
+ *  This function is a wrapper to @em fprintf(...).
+ *
+ *  @see vrna_message_vinfo(), vrna_message_error(), vrna_message_warning()
+ *
+ *  @param fp     The file pointer where the message is printed to
+ *  @param format The warning message to be printed
+ *  @param ...    Optional arguments for the formatted message string
+ */
+void vrna_message_info(FILE *fp, const char *format, ...);
+
+
+/**
+ *  @brief Print an info message
+ *
+ *  This function is a wrapper to @em fprintf(...).
+ *
+ *  @see vrna_message_vinfo(), vrna_message_error(), vrna_message_warning()
+ *
+ *  @param fp     The file pointer where the message is printed to
+ *  @param format The info message to be printed
+ *  @param args   The argument list for the formatted message string
+ */
+void vrna_message_vinfo(FILE *fp, const char *format, va_list args);
+
+
+/**
+ *  @brief  Initialize seed for random number generator
+ */
+void vrna_init_rand(void);
+
+/**
+ * @brief Current 48 bit random number
+ *
+ *  This variable is used by vrna_urn(). These should be set to some
+ *  random number seeds before the first call to vrna_urn().
+ *
+ *  @see vrna_urn()
+ */
+extern unsigned short xsubi[3];
+
+/**
+ *  @brief get a random number from [0..1]
+ *
+ *  @see  vrna_int_urn(), vrna_init_rand()
+ *  @note Usually implemented by calling @e erand48().
+ *  @return   A random number in range [0..1]
+ */
+double vrna_urn(void);
+
+/**
+ *  @brief Generates a pseudo random integer in a specified range
+ *
+ *  @see  vrna_urn(), vrna_init_rand()
+ *  @param from   The first number in range
+ *  @param to     The last number in range
+ *  @return       A pseudo random number in range [from, to]
+ */
+int vrna_int_urn(int from, int to);
+
+/**
+ *  @brief Get a timestamp
+ *
+ *  Returns a string containing the current date in the format
+ *  @verbatim Fri Mar 19 21:10:57 1993 @endverbatim
+ *
+ *  @return A string containing the timestamp
+ */
+char  *vrna_time_stamp(void);
+
+/**
+ *  Retrieve a line from 'stdin' savely while skipping comment characters and
+ *  other features
+ *  This function returns the type of input it has read if recognized.
+ *  An option argument allows one to switch between different reading modes.\n
+ *  Currently available options are:\n
+ *  #VRNA_INPUT_NOPRINT_COMMENTS, #VRNA_INPUT_NOSKIP_COMMENTS, #VRNA_INPUT_NOELIM_WS_SUFFIX
+ * 
+ *  pass a collection of options as one value like this:
+ *  @verbatim get_input_line(string, option_1 | option_2 | option_n) @endverbatim
+ * 
+ *  If the function recognizes the type of input, it will report it in the return
+ *  value. It also reports if a user defined 'quit' command (@-sign on 'stdin')
+ *  was given. Possible return values are:\n
+ *  #VRNA_INPUT_FASTA_HEADER, #VRNA_INPUT_ERROR, #VRNA_INPUT_MISC, #VRNA_INPUT_QUIT
+ * 
+ *  @param string   A pointer to the character array that contains the line read
+ *  @param options  A collection of options for switching the functions behavior
+ *  @return         A flag with information about what has been read
+ */
+unsigned int get_input_line(char **string,
+                            unsigned int options);
+
+
+/**
+ *  @brief Print a line to @e stdout that asks for an input sequence
+ *
+ *  There will also be a ruler (scale line) printed that helps orientation of the sequence positions
+ */
+void vrna_message_input_seq_simple(void);
+
+
+/**
+ *  @brief Print a line with a user defined string and a ruler to stdout.
+ *
+ *  (usually this is used to ask for user input)
+ *  There will also be a ruler (scale line) printed that helps orientation of the sequence positions
+ * 
+ *  @param s A user defined string that will be printed to stdout
+ */
+void vrna_message_input_seq(const char *s);
+
+/**
+ *  @brief Get an index mapper array (iindx) for accessing the energy matrices, e.g. in partition function related functions.
+ *
+ *  Access of a position "(i,j)" is then accomplished by using @verbatim (i,j) ~ iindx[i]-j @endverbatim
+ *  This function is necessary as most of the two-dimensional energy matrices are actually one-dimensional arrays throughout
+ *  the ViennaRNA Package
+ * 
+ *  Consult the implemented code to find out about the mapping formula ;)
+ * 
+ *  @see vrna_idx_col_wise()
+ *  @param length The length of the RNA sequence
+ *  @return       The mapper array
+ */
+int *vrna_idx_row_wise(unsigned int length);
+
+/**
+ *  @brief Get an index mapper array (indx) for accessing the energy matrices, e.g. in MFE related functions.
+ *
+ *  Access of a position "(i,j)" is then accomplished by using @verbatim (i,j) ~ indx[j]+i @endverbatim
+ *  This function is necessary as most of the two-dimensional energy matrices are actually one-dimensional arrays throughout
+ *  the ViennaRNAPackage
+ * 
+ *  Consult the implemented code to find out about the mapping formula ;)
+ * 
+ *  @see vrna_idx_row_wise()
+ *  @param length The length of the RNA sequence
+ *  @return       The mapper array
+ * 
+ */
+int *vrna_idx_col_wise(unsigned int length);
+
+/**
+ *  @}
+ */
+
+#ifdef  VRNA_BACKWARD_COMPAT
+
+DEPRECATED(int   *get_indx(unsigned int length));
+
+DEPRECATED(int   *get_iindx(unsigned int length));
+
+/**
+ *  @brief Read a line of arbitrary length from a stream
+ *
+ *  Returns a pointer to the resulting string. The necessary memory is
+ *  allocated and should be released using @e free() when the string is
+ *  no longer needed.
+ *
+ *	@deprecated	Use vrna_read_line() as a substitute!
+ *
+ *  @param  fp  A file pointer to the stream where the function should read from
+ *  @return     A pointer to the resulting string
+ */
+DEPRECATED(char  *get_line(FILE *fp));
+
+/**
+ *  @brief Print a line to @e stdout that asks for an input sequence
+ *
+ *  There will also be a ruler (scale line) printed that helps orientation of the sequence positions
+ *  @deprecated Use vrna_message_input_seq_simple() instead!
+ */
+DEPRECATED(void print_tty_input_seq(void));
+
+/**
+ *  @brief Print a line with a user defined string and a ruler to stdout.
+ *
+ *  (usually this is used to ask for user input)
+ *  There will also be a ruler (scale line) printed that helps orientation of the sequence positions
+ * 
+ *  @deprecated Use vrna_message_input_seq() instead!
+ */
+DEPRECATED(void print_tty_input_seq_str(const char *s));
+
+/**
+ *  @brief Print a warning message
+ *
+ *  Print a warning message to @e stderr
+ *
+ *  @deprecated Use vrna_message_warning() instead!
+ */
+DEPRECATED(void warn_user(const char message[]));
+
+/**
+ *  @brief Die with an error message
+ *
+ *  @deprecated Use vrna_message_error() instead!
+ */
+DEPRECATED(void nrerror(const char message[]));
+
+/**
+ *  @brief Allocate space safely
+ *
+ *  @deprecated Use vrna_alloc() instead!
+ */
+DEPRECATED(void *space(unsigned size));
+
+/**
+ *  @brief Reallocate space safely
+ *
+ *  @deprecated Use vrna_realloc() instead!
+ */
+DEPRECATED(void *xrealloc(void *p, unsigned size));
+
+/**
+ *  @brief  Make random number seeds
+ *  @deprecated Use vrna_init_rand() instead!
+ */
+DEPRECATED(void init_rand(void));
+
+/**
+ *  @brief get a random number from [0..1]
+ *
+ *  @deprecated Use vrna_urn() instead!
+ */
+DEPRECATED(double urn(void));
+
+/**
+ *  @brief Generates a pseudo random integer in a specified range
+ *
+ *  @deprecated Use vrna_int_urn() instead!
+ */
+DEPRECATED(int int_urn(int from, int to));
+
+/**
+ *  @brief  Inefficient `cp`
+ *
+ *  @deprecated Use vrna_file_copy() instead!
+ */
+DEPRECATED(void filecopy(FILE *from, FILE *to));
+
+/**
+ *  @brief Get a timestamp
+ *
+ *  @deprecated Use vrna_time_stamp() instead!
+ */
+DEPRECATED(char *time_stamp(void));
+
+#endif
+
+#endif
diff --git a/C/ffiwrap_centroid.c b/C/ffiwrap_centroid.c
new file mode 100644
--- /dev/null
+++ b/C/ffiwrap_centroid.c
@@ -0,0 +1,42 @@
+
+// functions wrapped in here need a C-wrapper because they do "more work"
+// before they can be called from C.
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "ViennaRNA/part_func.h"
+#include "ViennaRNA/part_func_co.h"
+#include "ViennaRNA/duplex.h"
+#include "ViennaRNA/plex.h"
+#include "ViennaRNA/alifold.h"
+#include "ViennaRNA/fold.h"
+
+double ffiwrap_centroid_temp (double temp, const char *sequence, char *structure)
+{
+  double                dist, e;
+  char*                 cent;
+  char*                 pf_struc;
+  double                cent_en;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vrna_md_set_default(&md);
+  md.noLP = 1;
+  md.dangles = 2;
+//  md.noGUclosure = 1;
+  md.temperature = temp;
+  vc  = vrna_fold_compound(sequence, &md, 0);
+  e = vrna_pf(vc, pf_struc);
+  cent = vrna_centroid(vc, &dist);
+  cent_en = vrna_eval_structure(vc, (const char*) cent);
+  strcpy (structure, cent);
+  free (cent);
+  free (pf_struc);
+
+  vrna_fold_compound_free(vc);
+
+  return cent_en;
+}
+
diff --git a/C/ffiwrap_fold.c b/C/ffiwrap_fold.c
new file mode 100644
--- /dev/null
+++ b/C/ffiwrap_fold.c
@@ -0,0 +1,52 @@
+
+// functions wrapped in here need a C-wrapper because they do "more work"
+// before they can be called from C.
+
+#include <stdio.h>
+
+#include "ViennaRNA/part_func.h"
+#include "ViennaRNA/part_func_co.h"
+#include "ViennaRNA/duplex.h"
+#include "ViennaRNA/plex.h"
+#include "ViennaRNA/alifold.h"
+#include "ViennaRNA/fold.h"
+
+float ffiwrap_fold_temp (float temp, const char *sequence, char *structure)
+{
+  float                 mfe;
+  vrna_fold_compound_t  *vc;
+  vrna_md_t             md;
+
+  vrna_md_set_default(&md);
+  md.noLP = 1;
+  md.temperature = temp;
+  vc  = vrna_fold_compound(sequence, &md, 0);
+  mfe = vrna_mfe(vc, structure);
+
+  vrna_fold_compound_free(vc);
+
+  return mfe;
+}
+
+float
+ffiwrap_eos_temp (float temp, const char *string, const char *structure)
+{
+  float e;
+
+  vrna_md_t             md;
+  vrna_md_set_default(&md);
+  md.temperature = temp;
+
+  /* create fold_compound with default parameters and without DP matrices */
+  vrna_fold_compound_t *vc = vrna_fold_compound(string, &md, VRNA_OPTION_EVAL_ONLY);
+
+  /* evaluate structure */
+  e = vrna_eval_structure(vc, structure);
+
+  /* free fold_compound */
+  vrna_fold_compound_free(vc);
+
+  return e;
+}
+
+
diff --git a/C/ffiwrap_part_func.c b/C/ffiwrap_part_func.c
new file mode 100644
--- /dev/null
+++ b/C/ffiwrap_part_func.c
@@ -0,0 +1,50 @@
+
+// functions wrapped in here need a C-wrapper because they do "more work"
+// before they can be called from C.
+
+#include <stdio.h>
+
+#include "ViennaRNA/part_func.h"
+#include "ViennaRNA/part_func_co.h"
+#include "ViennaRNA/duplex.h"
+#include "ViennaRNA/plex.h"
+#include "ViennaRNA/alifold.h"
+
+// wrap the RNAfold constrained partition function
+
+float ffiwrap_pf_fold_constrained (const char *sequence, char *structure, int constrained)
+{
+  return pf_fold_par (sequence, structure, 0, 1, constrained, 0);
+}
+
+// wrap the RNAfold constrained partition function for circular RNAs
+
+float ffiwrap_pf_circ_fold_constrained (const char *sequence, char *structure, int constrained)
+{
+  return pf_fold_par (sequence, structure, 0, 1, constrained, 1);
+}
+
+// wrap the RNAcofold constrained partition function.
+
+void ffiwrap_co_pf_fold_constrained (cofoldF * x, char *sequence, char *structure, int constrained)
+{
+  *x = co_pf_fold_par (sequence, structure, 0, 1, constrained);
+  return;
+}
+
+// wrap RNAcofold partition function
+
+void ffiwrap_co_pf_fold (cofoldF * x, char * inp, char * str)
+{
+  *x = co_pf_fold (inp, str);
+  return;
+}
+
+// wrap folding a duplex
+
+void ffiwrap_duplexfold (duplexT * x, char * linp, char * rinp)
+{
+  *x = duplexfold (linp, rinp);
+  return;
+}
+
diff --git a/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+[![Build Status](https://travis-ci.org/choener/ViennaRNA-bindings.svg?branch=master)](https://travis-ci.org/choener/ViennaRNA-bindings)
+
+# ViennaRNA Bindings
+
+This package provides bindings to a subset of the functions provided by the
+ViennaRNA package, v2. The relevant C functionality is provided directly.
+
+
+
+#### Contact
+
+Christian Hoener zu Siederdissen  
+Leipzig University, Leipzig, Germany  
+choener@bioinf.uni-leipzig.de  
+http://www.bioinf.uni-leipzig.de/~choener/  
+
diff --git a/ViennaRNA-bindings.cabal b/ViennaRNA-bindings.cabal
--- a/ViennaRNA-bindings.cabal
+++ b/ViennaRNA-bindings.cabal
@@ -1,96 +1,147 @@
-name:                ViennaRNA-bindings
-version:             0.1.2.2
-synopsis:            ViennaRNA v2 bindings
-homepage:            http://www.tbi.univie.ac.at/~choener/
-license:             OtherLicense
-license-file:        LICENSE
-author:              Christian Hoener zu Siederdissen (bindings) 2013-4, The ViennaRNA Team (library) 1994-2014
-maintainer:          choener@tbi.univie.ac.at
-copyright:           The ViennaRNA Team 1994-2014
-category:            Bioinformatics, FFI
-build-type:          Simple
-cabal-version:       >=1.8
+name:           ViennaRNA-bindings
+version:        0.233.1.1
+maintainer:     choener@tbi.univie.ac.at
+homepage:       https://github.com/choener/ViennaRNA-bindings
+bug-reports:    https://github.com/choener/ViennaRNA-bindings/issues
+license:        OtherLicense
+license-file:   LICENSE
+author:         Christian Hoener zu Siederdissen (bindings) 2013-2017, The ViennaRNA Team (library) 1994-2017
+copyright:      The ViennaRNA Team 1994-2017
+category:       Bioinformatics, Bindings, FFI
+build-type:     Simple
+cabal-version:  >=1.10
+tested-with:    GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1, GHC == 8.0.2
+synopsis:       ViennaRNA v2 bindings
+description:    Bindings to the ViennaRNA package, version 2.3.3.
+                .
+                Only a partial set of bindings is provided. If you need
+                additional functions, please open an issue on github.
+                .
+                The ViennaRNA bindings package now directly provide all
+                necessary functionality. Please note that this package uses the
+                same license as the ViennaRNA package.
+                .
+                If you use this software, please cite:
+                .
+                @
+                R. Lorenz, S.H. Bernhart, C. Hoener zu Siederdissen, H. Tafer, C. Flamm, P.F. Stadler and I.L. Hofacker (2011)
+                ViennaRNA Package 2.0
+                Algorithms for Molecular Biology: 6:26
+                @
+                .
+                <http://www.almob.org/content/6/1/26>
 
-description:
-  Bindings to the ViennaRNA package, version 2.x.y.
-  .
-  Only a partial set of bindings is provided. If you need additional functions,
-  please open an issue on github.
-  .
-  The ViennaRNA bindings package now directly provide all necessary
-  functionality. Please note that this package uses the same license as the
-  ViennaRNA package.
-  .
-  If you use this software, please cite:
-  .
-  @
-  R. Lorenz, S.H. Bernhart, C. Hoener zu Siederdissen, H. Tafer, C. Flamm, P.F. Stadler and I.L. Hofacker (2011)
-  ViennaRNA Package 2.0
-  Algorithms for Molecular Biology: 6:26
-  @
-  .
-  <http://www.almob.org/content/6/1/26>
 
+
 extra-source-files:
-  cbits/circfold.inc
-  include/1.8.4_epars.h
-  include/1.8.4_intloops.h
-  include/aln_util.h
-  include/cofold.h
-  include/config.h
-  include/data_structures.h
-  include/energy_const.h
-  include/energy_par.h
-  include/fold.h
-  include/fold_vars.h
-  include/gquad.h
-  include/intl11dH.h
-  include/intl11.h
-  include/intl21dH.h
-  include/intl21.h
-  include/intl22dH.h
-  include/intl22.h
-  include/list.h
-  include/loop_energies.h
-  include/naview.h
-  include/pair_mat.h
-  include/params.h,
-  include/part_func_co.h
-  include/part_func.h
-  include/plot_layouts.h
-  include/PS_dot.h
-  include/subopt.h
-  include/utils.h
-  changelog
+  C/ViennaRNA/*.h
+  C/ViennaRNA/*.c
+  C/ViennaRNA/*.inc
 
+  changelog.md
+  README.md
 
+
+
 library
   exposed-modules:
     -- public interfaces
     BioInf.ViennaRNA.Bindings
     -- the FFI
+    BioInf.ViennaRNA.Bindings.FFI.Centroid
     BioInf.ViennaRNA.Bindings.FFI.CoFold
+    BioInf.ViennaRNA.Bindings.FFI.Duplex
     BioInf.ViennaRNA.Bindings.FFI.Fold
     BioInf.ViennaRNA.Bindings.FFI.PartFunc
     BioInf.ViennaRNA.Bindings.FFI.Utils
-  build-depends:
-    base == 4.* ,
-    array
+  build-depends: base == 4.*
+               , array
   build-tools:
     c2hs
   extra-libraries:
+  default-language:
+    Haskell2010
+  default-extensions: CPP
+                    , ForeignFunctionInterface
+                    , NondecreasingIndentation
+                    , ScopedTypeVariables
   c-sources:
-    cbits/fold.c
-    cbits/utils.c
-    cbits/fold_vars.c
-    cbits/energy_par.c
-    cbits/gquad.c
-    cbits/params.c
-    cbits/part_func.c
-    cbits/part_func_co.c
-    cbits/cofold.c
-    cbits/ffiwrap_part_func.c
+    C/ffiwrap_part_func.c
+    C/ffiwrap_fold.c
+    C/ffiwrap_centroid.c
+    -- remove all of these, then @stack build --test@ and include files that have the missing definitions
+    C/ViennaRNA/aln_util.c
+    C/ViennaRNA/alphabet.c
+    C/ViennaRNA/boltzmann_sampling.c
+    C/ViennaRNA/centroid.c
+    C/ViennaRNA/cofold.c
+    C/ViennaRNA/commands.c
+    C/ViennaRNA/constraints.c
+    C/ViennaRNA/constraints_hard.c
+    C/ViennaRNA/constraints_SHAPE.c
+    C/ViennaRNA/constraints_soft.c
+    C/ViennaRNA/data_structures.c
+    C/ViennaRNA/dp_matrices.c
+    C/ViennaRNA/duplex.c
+    C/ViennaRNA/energy_par.c
+    C/ViennaRNA/equilibrium_probs.c
+    C/ViennaRNA/eval.c
+    C/ViennaRNA/exterior_loops.c
+    C/ViennaRNA/file_formats.c
+    C/ViennaRNA/file_formats_msa.c
+    C/ViennaRNA/file_utils.c
+    C/ViennaRNA/fold.c
+    C/ViennaRNA/gquad.c
+    C/ViennaRNA/hairpin_loops.c
+    C/ViennaRNA/interior_loops.c
+    C/ViennaRNA/list.c
+    C/ViennaRNA/mfe.c
+    C/ViennaRNA/mm.c
+    C/ViennaRNA/model.c
+    C/ViennaRNA/multibranch_loops.c
+    C/ViennaRNA/params.c
+    C/ViennaRNA/part_func.c
+    C/ViennaRNA/part_func_co.c
+    C/ViennaRNA/plex.c
+    C/ViennaRNA/plex_functions.c
+    C/ViennaRNA/ribo.c
+    C/ViennaRNA/string_utils.c
+    C/ViennaRNA/structure_utils.c
+    C/ViennaRNA/subopt.c
+    C/ViennaRNA/unstructured_domains.c
+    C/ViennaRNA/utils.c
   cc-options:
-  include-dirs: include
-  includes: config.h
+    -fPIC -DHAVE_STRDUP
+  include-dirs:
+    C
+
+
+
+test-suite properties
+  type:
+    exitcode-stdio-1.0
+  main-is:
+    properties.hs
+  ghc-options:
+    -O2 -rtsopts
+  hs-source-dirs:
+    tests
+  default-language:
+    Haskell2010
+  default-extensions: CPP
+                    , TemplateHaskell
+  build-depends: base
+               , array
+               , QuickCheck
+               , tasty                >= 0.11
+               , tasty-hunit          >= 0.9
+               , tasty-silver         >= 3.1
+               , tasty-th             >= 0.1
+               , ViennaRNA-bindings
+
+
+
+source-repository head
+  type: git
+  location: git://github.com/choener/ViennaRNA-bindings
 
diff --git a/cbits/circfold.inc b/cbits/circfold.inc
deleted file mode 100644
--- a/cbits/circfold.inc
+++ /dev/null
@@ -1,211 +0,0 @@
-/* -*-C-*- */
-/* this file contains code for folding circular RNAs */
-/* it's #include'd into fold.c */
-
-PRIVATE void fill_arrays_circ(const char *string, int *bt){
-  /* variant of fold() for circular RNAs */
-  /* auxiliarry arrays:
-     fM2 = multiloop region with exactly two stems, extending to 3' end
-     for stupid dangles=1 case we also need:
-     fM_d3 = multiloop region with >= 2 stems, starting at pos 2
-             (a pair (k,n) will form 3' dangle with pos 1)
-     fM_d5 = multiloop region with >= 2 stems, extending to pos n-1
-             (a pair (1,k) will form a 5' dangle with pos n)
-  */
-  int Hi, Hj, Ii, Ij, Ip, Iq, Mi;
-  int *fM_d3, *fM_d5, Md3i, Md5i, FcMd3, FcMd5;
-  int i,j, p,q,length, energy;
-  int dangle_model = P->model_details.dangles;
-
-  length = (int) strlen(string);
-
-  FcH = FcI= FcM = FcMd3= FcMd5= Fc = INF;
-  for (i=1; i<length; i++)
-    for (j=i+TURN+1; j <= length; j++) {
-      int ij, bonus=0, type, u, new_c, no_close;
-      u = length-j + i-1;
-      if (u<TURN) continue;
-
-      ij = indx[j]+i;
-      type = ptype[ij];
-
-      /* enforcing structure constraints */
-      if ((BP[i]==j)||(BP[i]==-1)||(BP[i]==-2)) bonus -= BONUS;
-      if ((BP[j]==-1)||(BP[j]==-3)) bonus -= BONUS;
-      if ((BP[i]==-4)||(BP[j]==-4)) type=0;
-
-      no_close = (((type==3)||(type==4))&&no_closingGU&&(bonus==0));
-
-      /* if (j-i-1 > max_separation) type = 0; */  /* forces locality degree */
-
-      type=rtype[type];
-      if (!type) continue;
-      if (no_close) new_c = FORBIDDEN;
-      else {
-        char loopseq[10];
-        /*int si1, sj1;*/
-        if (u<7) {
-          strcpy(loopseq , string+j-1);
-          strncat(loopseq, string, i);
-        }
-        new_c = E_Hairpin(u, type, S1[j+1], S1[i-1],  loopseq, P)+bonus+c[ij];
-      }
-      if (new_c<FcH) {
-        FcH = new_c; Hi=i; Hj=j;
-      }
-
-      for (p = j+1; p < length ; p++) {
-        int u1, qmin;
-        u1 = p-j-1;
-        if (u1+i-1>MAXLOOP) break;
-        qmin = u1+i-1+length-MAXLOOP;
-        if (qmin<p+TURN+1) qmin = p+TURN+1;
-        for (q = qmin; q <=length; q++) {
-          int u2, type_2/*, si1, sq1*/;
-          type_2 = rtype[ptype[indx[q]+p]];
-          if (type_2==0) continue;
-          u2 = i-1 + length-q;
-          if (u1+u2>MAXLOOP) continue;
-          energy = E_IntLoop(u1, u2, type, type_2, S1[j+1], S1[i-1], S1[p-1], S1[q+1], P);
-          new_c = c[ij] + c[indx[q]+p] + energy;
-          if (new_c<FcI) {
-            FcI = new_c; Ii=i; Ij=j; Ip=p; Iq=q;
-          }
-        }
-      }
-    }
-  Fc = MIN2(FcI, FcH);
-
-  /* compute the fM2 array (multi loops with exactly 2 helices) */
-  /* to get a unique ML decomposition, just use fM1 instead of fML
-     below. However, that will not work with dangle_model==1  */
-  for (i=1; i<length-TURN; i++) {
-    int u;
-    fM2[i] = INF;
-    for (u=i+TURN; u<length-TURN; u++)
-      fM2[i] = MIN2(fM2[i], fML[indx[u]+i] + fML[indx[length]+u+1]);
-  }
-
-  for (i=TURN+1; i<length-2*TURN; i++) {
-    int fm;
-    fm = fML[indx[i]+1]+fM2[i+1]+P->MLclosing;
-    if (fm<FcM) {
-      FcM=fm; Mi=i;
-    }
-  }
-  Fc = MIN2(Fc, FcM);
-
-  if (dangle_model==1) {
-    int u;
-    fM_d3 =  (int *) space(sizeof(int)*(length+2));
-    fM_d5 =  (int *) space(sizeof(int)*(length+2));
-    for (i=TURN+1; i<length-TURN; i++) {
-      fM_d3[i] = INF;
-      for (u=2+TURN; u<i-TURN; u++)
-        fM_d3[i] = MIN2(fM_d3[i], fML[indx[u]+2] + fML[indx[i]+u+1]);
-    }
-    for (i=2*TURN+1; i<length-TURN; i++) {
-      int fm, type;
-      type = ptype[indx[length]+i+1];
-      if (type==0) continue;
-      fm = fM_d3[i]+c[indx[length]+i+1]+E_MLstem(type, -1, S1[1], P) + P->MLclosing;
-      if (fm<FcMd3) {
-        FcMd3=fm; Md3i=i;
-      }
-      fm = fM_d3[i-1]+c[indx[length]+i+1]+E_MLstem(type, S1[i], S1[1], P) + P->MLclosing;
-      if (fm<FcMd3) {
-        FcMd3=fm; Md3i=-i;
-      }
-    }
-
-    for (i=TURN+1; i<length-TURN; i++) {
-      fM_d5[i] = INF;
-      for (u=i+TURN; u<length-TURN; u++)
-        fM_d5[i] = MIN2(fM_d5[i], fML[indx[u]+i] + fML[indx[length-1]+u+1]);
-    }
-    for (i=TURN+1; i<length-2*TURN; i++) {
-      int fm, type;
-      type = ptype[indx[i]+1];
-      if (type==0) continue;
-      fm = E_MLstem(type, S1[length], -1, P) + c[indx[i]+1] + fM_d5[i+1] + P->MLclosing;
-      if (fm<FcMd5) {
-        FcMd5=fm; Md5i=i;
-      }
-      fm = E_MLstem(type, S1[length], S1[i+1], P) + c[indx[i]+1] + fM_d5[i+2] + P->MLclosing;
-      if (fm<FcMd5) {
-        FcMd5=fm; Md5i=-i;
-      }
-    }
-    if (FcMd5<MIN2(Fc,FcMd3)) {
-      /* looks like we have to do this ... */
-      sector[++(*bt)].i = 1;
-      sector[(*bt)].j = (Md5i>0)?Md5i:-Md5i;
-      sector[(*bt)].ml = 2;
-      i = (Md5i>0)?Md5i+1 : -Md5i+2; /* let's backtrack fm_d5[Md5i+1] */
-      for (u=i+TURN; u<length-TURN; u++)
-        if (fM_d5[i] == fML[indx[u]+i] + fML[indx[length-1]+u+1]) {
-          sector[++(*bt)].i = i;
-          sector[(*bt)].j = u;
-          sector[(*bt)].ml = 1;
-          sector[++(*bt)].i =u+1;
-          sector[(*bt)].j = length-1;
-          sector[(*bt)].ml = 1;
-          break;
-        }
-      Fc = FcMd5;
-    } else if (FcMd3<Fc) {
-      /* here we go again... */
-      sector[++(*bt)].i = (Md3i>0)?Md3i+1:-Md3i+1;
-      sector[(*bt)].j = length;
-      sector[(*bt)].ml = 2;
-      i = (Md3i>0)? Md3i : -Md3i-1; /* let's backtrack fm_d3[Md3i] */
-      for (u=2+TURN; u<i-TURN; u++)
-        if (fM_d3[i] == fML[indx[u]+2] + fML[indx[i]+u+1]) {
-          sector[++(*bt)].i = 2;
-          sector[(*bt)].j = u;
-          sector[(*bt)].ml = 1;
-          sector[++(*bt)].i =u+1;
-          sector[(*bt)].j = i;
-          sector[(*bt)].ml = 1;
-          break;
-        }
-      Fc = FcMd3;
-    }
-    free(fM_d3);
-    free(fM_d5);
-  }
-  else if(Fc < INF){
-    if (FcH==Fc) {
-      sector[++(*bt)].i = Hi;
-      sector[(*bt)].j = Hj;
-      sector[(*bt)].ml = 2;
-    }
-    else if (FcI==Fc) {
-      sector[++(*bt)].i = Ii;
-      sector[(*bt)].j = Ij;
-      sector[(*bt)].ml = 2;
-      sector[++(*bt)].i = Ip;
-      sector[(*bt)].j = Iq;
-      sector[(*bt)].ml = 2;
-    }
-    else if (FcM==Fc) { /* grumpf we found a Multiloop */
-      int fm, u;
-      /* backtrack in fM2 */
-      fm = fM2[Mi+1];
-      for (u=Mi+TURN+1; u<length-TURN; u++)
-        if (fm == fML[indx[u]+Mi+1] + fML[indx[length]+u+1]) {
-                sector[++(*bt)].i=Mi+1;
-                sector[(*bt)].j=u;
-                sector[(*bt)].ml = 1;
-                sector[++(*bt)].i=u+1;
-                sector[(*bt)].j=length;
-                sector[(*bt)].ml = 1;
-                break;
-        }
-      sector[++(*bt)].i = 1;
-      sector[(*bt)].j = Mi;
-      sector[(*bt)].ml = 1;
-    }
-  }
-}
-
diff --git a/cbits/cofold.c b/cbits/cofold.c
deleted file mode 100644
--- a/cbits/cofold.c
+++ /dev/null
@@ -1,1502 +0,0 @@
-/* Last changed Time-stamp: <2008-12-03 17:44:38 ivo> */
-/*
-                  minimum free energy
-                  RNA secondary structure prediction
-
-                  c Ivo Hofacker, Chrisoph Flamm
-                  original implementation by
-                  Walter Fontana
-
-                  Vienna RNA package
-*/
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <ctype.h>
-#include <string.h>
-#include <limits.h>
-
-#include "utils.h"
-#include "energy_par.h"
-#include "fold_vars.h"
-#include "pair_mat.h"
-#include "params.h"
-#include "subopt.h"
-#include "fold.h"
-#include "loop_energies.h"
-#include "gquad.h"
-#include "cofold.h"
-
-#ifdef _OPENMP
-#include <omp.h>
-#endif
-
-#define PAREN
-
-#define STACK_BULGE1      1       /* stacking energies for bulges of size 1 */
-#define NEW_NINIO         1       /* new asymetry penalty */
-#define MAXSECTORS        500     /* dimension for a backtrack array */
-#define LOCALITY          0.      /* locality parameter for base-pairs */
-#undef TURN
-#define TURN              0       /* reset minimal base pair span for intermolecular pairings */
-#define TURN2             3       /* used by zukersubopt */
-#define SAME_STRAND(I,J)  (((I)>=cut_point)||((J)<cut_point))
-
-/*
-#################################
-# GLOBAL VARIABLES              #
-#################################
-*/
-
-
-/*
-#################################
-# PRIVATE VARIABLES             #
-#################################
-*/
-
-PRIVATE float   mfe1, mfe2;       /* minimum free energies of the monomers */
-PRIVATE int     *indx   = NULL;   /* index for moving in the triangle matrices c[] and fMl[]*/
-PRIVATE int     *c      = NULL;   /* energy array, given that i-j pair */
-PRIVATE int     *cc     = NULL;   /* linear array for calculating canonical structures */
-PRIVATE int     *cc1    = NULL;   /*   "     "        */
-PRIVATE int     *f5     = NULL;   /* energy of 5' end */
-PRIVATE int     *fc     = NULL;   /* energy from i to cutpoint (and vice versa if i>cut) */
-PRIVATE int     *fML    = NULL;   /* multi-loop auxiliary energy array */
-PRIVATE int     *fM1    = NULL;   /* second ML array, only for subopt */
-PRIVATE int     *Fmi    = NULL;   /* holds row i of fML (avoids jumps in memory) */
-PRIVATE int     *DMLi   = NULL;   /* DMLi[j] holds MIN(fML[i,k]+fML[k+1,j])  */
-PRIVATE int     *DMLi1  = NULL;   /*             MIN(fML[i+1,k]+fML[k+1,j])  */
-PRIVATE int     *DMLi2  = NULL;   /*             MIN(fML[i+2,k]+fML[k+1,j])  */
-PRIVATE char    *ptype  = NULL;   /* precomputed array of pair types */
-PRIVATE short   *S = NULL, *S1 = NULL;
-PRIVATE paramT  *P          = NULL;
-PRIVATE int     init_length = -1;
-PRIVATE int     zuker       = 0; /* Do Zuker style suboptimals? */
-PRIVATE sect    sector[MAXSECTORS];   /* stack for backtracking */
-PRIVATE int     length;
-PRIVATE bondT   *base_pair2 = NULL;
-PRIVATE int     *BP; /* contains the structure constrainsts: BP[i]
-                        -1: | = base must be paired
-                        -2: < = base must be paired with j<i
-                        -3: > = base must be paired with j>i
-                        -4: x = base must not pair
-                        positive int: base is paired with int      */
-PRIVATE int     struct_constrained  = 0;
-PRIVATE int     with_gquad          = 0;
-
-PRIVATE int     *ggg = NULL;    /* minimum free energies of the gquadruplexes */
-
-#ifdef _OPENMP
-
-#pragma omp threadprivate(mfe1, mfe2, indx, c, cc, cc1, f5, fc, fML, fM1, Fmi, DMLi, DMLi1, DMLi2,\
-                          ptype, S, S1, P, zuker, sector, length, base_pair2, BP, struct_constrained,\
-                          ggg, with_gquad)
-
-#endif
-
-/*
-#################################
-# PRIVATE FUNCTION DECLARATIONS #
-#################################
-*/
-
-PRIVATE void  init_cofold(int length, paramT *parameters);
-PRIVATE void  get_arrays(unsigned int size);
-/* PRIVATE void  scale_parameters(void); */
-PRIVATE void  make_ptypes(const short *S, const char *structure);
-PRIVATE void  backtrack(const char *sequence);
-PRIVATE int   fill_arrays(const char *sequence);
-PRIVATE void  free_end(int *array, int i, int start);
-
-/*
-#################################
-# BEGIN OF FUNCTION DEFINITIONS #
-#################################
-*/
-
-/*--------------------------------------------------------------------------*/
-PRIVATE void init_cofold(int length, paramT *parameters){
-
-#ifdef _OPENMP
-/* Explicitly turn off dynamic threads */
-  omp_set_dynamic(0);
-#endif
-
-  if (length<1) nrerror("init_cofold: argument must be greater 0");
-  free_co_arrays();
-  get_arrays((unsigned) length);
-  init_length=length;
-
-  indx = get_indx((unsigned) length);
-
-  update_cofold_params_par(parameters);
-}
-
-/*--------------------------------------------------------------------------*/
-
-PRIVATE void get_arrays(unsigned int size){
-  if(size >= (unsigned int)sqrt((double)INT_MAX))
-    nrerror("get_arrays@cofold.c: sequence length exceeds addressable range");
-
-  c     = (int *) space(sizeof(int)*((size*(size+1))/2+2));
-  fML   = (int *) space(sizeof(int)*((size*(size+1))/2+2));
-  if (uniq_ML)
-    fM1    = (int *) space(sizeof(int)*((size*(size+1))/2+2));
-
-  ptype = (char *) space(sizeof(char)*((size*(size+1))/2+2));
-  f5    = (int *) space(sizeof(int)*(size+2));
-  fc    = (int *) space(sizeof(int)*(size+2));
-  cc    = (int *) space(sizeof(int)*(size+2));
-  cc1   = (int *) space(sizeof(int)*(size+2));
-  Fmi   = (int *) space(sizeof(int)*(size+1));
-  DMLi  = (int *) space(sizeof(int)*(size+1));
-  DMLi1 = (int *) space(sizeof(int)*(size+1));
-  DMLi2 = (int *) space(sizeof(int)*(size+1));
-
-  base_pair2 = (bondT *) space(sizeof(bondT)*(1+size/2));
-}
-
-/*--------------------------------------------------------------------------*/
-
-PUBLIC void free_co_arrays(void){
-  if(indx)        free(indx);
-  if(c)           free(c);
-  if(fML)         free(fML);
-  if(f5)          free(f5);
-  if(cc)          free(cc);
-  if(cc1)         free(cc1);
-  if(fc)          free(fc);
-  if(ptype)       free(ptype);
-  if(fM1)         free(fM1);
-  if(base_pair2)  free(base_pair2);
-  if(Fmi)         free(Fmi);
-  if(DMLi)        free(DMLi);
-  if(DMLi1)       free(DMLi1);
-  if(DMLi2)       free(DMLi2);
-  if(P)           free(P);
-  if(ggg)         free(ggg);
-
-  indx = c = fML = f5 = cc = cc1 = fc = fM1 = Fmi = DMLi = DMLi1 = DMLi2 = ggg = NULL;
-  ptype       = NULL;
-  base_pair2  = NULL;
-  P           = NULL;
-  init_length = 0;
-}
-
-
-/*--------------------------------------------------------------------------*/
-
-PUBLIC void export_cofold_arrays_gq(  int **f5_p,
-                                      int **c_p,
-                                      int **fML_p,
-                                      int **fM1_p,
-                                      int **fc_p,
-                                      int **ggg_p,
-                                      int **indx_p,
-                                      char **ptype_p){
-
-  /* make the DP arrays available to routines such as subopt() */
-  *f5_p = f5; *c_p = c;
-  *fML_p = fML; *fM1_p = fM1;
-  *ggg_p = ggg;
-  *indx_p = indx; *ptype_p = ptype;
-  *fc_p =fc;
-}
-
-PUBLIC void export_cofold_arrays( int **f5_p,
-                                  int **c_p,
-                                  int **fML_p,
-                                  int **fM1_p,
-                                  int **fc_p,
-                                  int **indx_p,
-                                  char **ptype_p){
-
-  /* make the DP arrays available to routines such as subopt() */
-  *f5_p = f5; *c_p = c;
-  *fML_p = fML; *fM1_p = fM1;
-  *indx_p = indx; *ptype_p = ptype;
-  *fc_p =fc;
-}
-
-/*--------------------------------------------------------------------------*/
-
-PUBLIC float cofold(const char *string, char *structure) {
-  return cofold_par(string, structure, NULL, fold_constrained);
-}
-
-PUBLIC float cofold_par(const char *string,
-                        char *structure,
-                        paramT *parameters,
-                        int is_constrained){
-
-  int i, length, energy, bonus=0, bonus_cnt=0;
-
-  zuker = 0;
-
-  struct_constrained  = is_constrained;
-  length              = (int) strlen(string);
-
-#ifdef _OPENMP
-  /* always init everything since all global static variables are uninitialized when entering a thread */
-  init_cofold(length, parameters);
-#else
-  if(parameters) init_cofold(length, parameters);
-  else if (length>init_length) init_cofold(length, parameters);
-  else if (fabs(P->temperature - temperature)>1e-6) update_cofold_params_par(parameters);
-#endif
-
-  with_gquad  = P->model_details.gquad;
-  S           = encode_sequence(string, 0);
-  S1          = encode_sequence(string, 1);
-  S1[0]       = S[0]; /* store length at pos. 0 */
-
-  BP = (int *)space(sizeof(int)*(length+2));
-  if(with_gquad){ /* add a guess of how many G's may be involved in a G quadruplex */
-    if(base_pair2)
-      free(base_pair2);
-    base_pair2 = (bondT *) space(sizeof(bondT)*(4*(1+length/2)));
-  }
-
-  make_ptypes(S, structure);
-
-  energy = fill_arrays(string);
-
-  backtrack(string);
-
-#ifdef PAREN
-  parenthesis_structure(structure, base_pair2, length);
-#else
-  letter_structure(structure, base_pair2, length);
-#endif
-
-  /*
-  *  Backward compatibility:
-  *  This block may be removed if deprecated functions
-  *  relying on the global variable "base_pair" vanish from within the package!
-  */
-  base_pair = base_pair2;
-  /*
-  {
-    if(base_pair) free(base_pair);
-    base_pair = (bondT *)space(sizeof(bondT) * (1+length/2));
-    memcpy(base_pair, base_pair2, sizeof(bondT) * (1+length/2));
-  }
-  */
-
-  /* check constraints */
-  for(i=1;i<=length;i++) {
-    if((BP[i]<0)&&(BP[i]>-4)) {
-      bonus_cnt++;
-      if((BP[i]==-3)&&(structure[i-1]==')')) bonus++;
-      if((BP[i]==-2)&&(structure[i-1]=='(')) bonus++;
-      if((BP[i]==-1)&&(structure[i-1]!='.')) bonus++;
-    }
-
-    if(BP[i]>i) {
-      int l;
-      bonus_cnt++;
-      for(l=1; l<=base_pair2[0].i; l++)
-        if(base_pair2[l].i != base_pair2[l].j)
-          if((i==base_pair2[l].i)&&(BP[i]==base_pair2[l].j)) bonus++;
-    }
-  }
-
-  if (bonus_cnt>bonus) fprintf(stderr,"\ncould not enforce all constraints\n");
-  bonus*=BONUS;
-
-  free(S); free(S1); free(BP);
-
-  energy += bonus;      /*remove bonus energies from result */
-
-  if (backtrack_type=='C')
-    return (float) c[indx[length]+1]/100.;
-  else if (backtrack_type=='M')
-    return (float) fML[indx[length]+1]/100.;
-  else
-    return (float) energy/100.;
-}
-
-PRIVATE int fill_arrays(const char *string) {
-  /* fill "c", "fML" and "f5" arrays and return  optimal energy */
-
-  int   i, j, k, length, energy;
-  int   decomp, new_fML, max_separation;
-  int   no_close, type, type_2, tt, maxj;
-  int   bonus=0;
-  int   dangle_model  = P->model_details.dangles;
-  int   noGUclosure   = P->model_details.noGUclosure;
-  int   noLP          = P->model_details.noLP;
-
-  length = (int) strlen(string);
-
-  max_separation = (int) ((1.-LOCALITY)*(double)(length-2)); /* not in use */
-
-  if(with_gquad)
-    ggg = get_gquad_matrix(S, P);
-
-  for (j=1; j<=length; j++) {
-    Fmi[j]=DMLi[j]=DMLi1[j]=DMLi2[j]=INF;
-    fc[j]=0;
-  }
-
-  for (j = 1; j<=length; j++)
-    for (i=1; i<=j; i++) {
-      c[indx[j]+i] = fML[indx[j]+i] = INF;
-      if (uniq_ML) fM1[indx[j]+i] = INF;
-    }
-
-  for (i = length-TURN-1; i >= 1; i--) { /* i,j in [1..length] */
-
-    maxj=(zuker)? (MIN2(i+cut_point-1,length)):length;
-    for (j = i+TURN+1; j <= maxj; j++) {
-      int p, q, ij;
-      ij = indx[j]+i;
-      bonus = 0;
-      type = ptype[ij];
-
-      /* enforcing structure constraints */
-      if ((BP[i]==j)||(BP[i]==-1)||(BP[i]==-2)) bonus -= BONUS;
-      if ((BP[j]==-1)||(BP[j]==-3)) bonus -= BONUS;
-      if ((BP[i]==-4)||(BP[j]==-4)) type=0;
-
-      no_close = (((type==3)||(type==4))&&noGUclosure&&(bonus==0));
-
-      if (j-i-1 > max_separation) type = 0;  /* forces locality degree */
-
-      if (type) {   /* we have a pair */
-        int new_c=0, stackEnergy=INF;
-        short si, sj;
-        si  = SAME_STRAND(i, i+1) ? S1[i+1] : -1;
-        sj  = SAME_STRAND(j-1, j) ? S1[j-1] : -1;
-        /* hairpin ----------------------------------------------*/
-
-        if (SAME_STRAND(i,j)) {
-          if (no_close) new_c = FORBIDDEN;
-          else
-            new_c = E_Hairpin(j-i-1, type, si, sj, string+i-1, P);
-        }
-        else {
-          if (dangle_model)
-            new_c += E_ExtLoop(rtype[type], sj, si, P);
-          else
-            new_c += E_ExtLoop(rtype[type], -1, -1, P);
-        }
-        /*--------------------------------------------------------
-          check for elementary structures involving more than one
-          closing pair.
-          --------------------------------------------------------*/
-
-        for (p = i+1; p <= MIN2(j-2-TURN,i+MAXLOOP+1) ; p++) {
-          int minq = j-i+p-MAXLOOP-2;
-          if (minq<p+1+TURN) minq = p+1+TURN;
-          for (q = minq; q < j; q++) {
-            type_2 = ptype[indx[q]+p];
-
-            if (type_2==0) continue;
-            type_2 = rtype[type_2];
-
-            if (noGUclosure)
-              if (no_close||(type_2==3)||(type_2==4))
-                if ((p>i+1)||(q<j-1)) continue;  /* continue unless stack */
-
-            if (SAME_STRAND(i,p) && SAME_STRAND(q,j))
-              energy = E_IntLoop(p-i-1, j-q-1, type, type_2, si, sj, S1[p-1], S1[q+1], P);
-            else
-              energy = E_IntLoop_Co(rtype[type], rtype[type_2],
-                                    i, j, p, q,
-                                    cut_point,
-                                    si, sj,
-                                    S1[p-1], S1[q+1],
-                                    dangle_model,
-                                    P);
-
-            new_c = MIN2(energy+c[indx[q]+p], new_c);
-            if ((p==i+1)&&(j==q+1)) stackEnergy = energy; /* remember stack energy */
-
-          } /* end q-loop */
-        } /* end p-loop */
-
-        /* multi-loop decomposition ------------------------*/
-
-
-        if (!no_close) {
-          int MLenergy;
-
-          if((si >= 0) && (sj >= 0)){
-            decomp = DMLi1[j-1];
-            tt = rtype[type];
-            MLenergy = P->MLclosing;
-            switch(dangle_model){
-              case 0:   MLenergy += decomp + E_MLstem(tt, -1, -1, P);
-                        break;
-              case 2:   MLenergy += decomp + E_MLstem(tt, sj, si, P);
-                        break;
-              default:  decomp += E_MLstem(tt, -1, -1, P);
-                        decomp = MIN2(decomp, DMLi1[j-2] + E_MLstem(tt, sj, -1, P) + P->MLbase);
-                        decomp = MIN2(decomp, DMLi2[j-1] + E_MLstem(tt, -1, si, P) + P->MLbase);
-                        decomp = MIN2(decomp, DMLi2[j-2] + E_MLstem(tt, sj, si, P) + 2*P->MLbase);
-                        MLenergy += decomp;
-                        break;
-            }
-            new_c = MIN2(new_c, MLenergy);
-          }
-
-          if (!SAME_STRAND(i,j)) { /* cut is somewhere in the multiloop*/
-            decomp = fc[i+1] + fc[j-1];
-            tt = rtype[type];
-            switch(dangle_model){
-              case 0:   decomp += E_ExtLoop(tt, -1, -1, P);
-                        break;
-              case 2:   decomp += E_ExtLoop(tt, sj, si, P);
-                        break;
-              default:  decomp += E_ExtLoop(tt, -1, -1, P);
-                        decomp = MIN2(decomp, fc[i+2] + fc[j-2] + E_ExtLoop(tt, sj, si, P));
-                        decomp = MIN2(decomp, fc[i+2] + fc[j-1] + E_ExtLoop(tt, -1, si, P));
-                        decomp = MIN2(decomp, fc[i+1] + fc[j-2] + E_ExtLoop(tt, sj, -1, P));
-                        break;
-            }
-            new_c = MIN2(new_c, decomp);
-          }
-        } /* end >> if (!no_close) << */
-
-        /* coaxial stacking of (i.j) with (i+1.k) or (k+1.j-1) */
-
-        if (dangle_model==3) {
-          decomp = INF;
-          for (k = i+2+TURN; k < j-2-TURN; k++) {
-            type_2 = ptype[indx[k]+i+1]; type_2 = rtype[type_2];
-            if (type_2)
-              decomp = MIN2(decomp, c[indx[k]+i+1]+P->stack[type][type_2]+
-                            fML[indx[j-1]+k+1]);
-            type_2 = ptype[indx[j-1]+k+1]; type_2 = rtype[type_2];
-            if (type_2)
-              decomp = MIN2(decomp, c[indx[j-1]+k+1]+P->stack[type][type_2]+
-                            fML[indx[k]+i+1]);
-          }
-          /* no TermAU penalty if coax stack */
-          decomp += 2*P->MLintern[1] + P->MLclosing;
-          new_c = MIN2(new_c, decomp);
-        }
-
-        if(with_gquad){
-          /* include all cases where a g-quadruplex may be enclosed by base pair (i,j) */
-          if (!no_close && SAME_STRAND(i,j)) {
-            tt = rtype[type];
-            energy = E_GQuad_IntLoop(i, j, type, S1, ggg, indx, P);
-            new_c = MIN2(new_c, energy);
-          }
-        }
-
-        new_c = MIN2(new_c, cc1[j-1]+stackEnergy);
-        cc[j] = new_c + bonus;
-        if (noLP){
-          if (SAME_STRAND(i,i+1) && SAME_STRAND(j-1,j))
-            c[ij] = cc1[j-1]+stackEnergy+bonus;
-          else /* currently we don't allow stacking over the cut point */
-            c[ij] = FORBIDDEN;
-        }
-        else
-          c[ij] = cc[j];
-
-      } /* end >> if (pair) << */
-
-      else c[ij] = INF;
-
-
-      /* done with c[i,j], now compute fML[i,j] */
-      /* free ends ? -----------------------------------------*/
-      new_fML=INF;
-      if (SAME_STRAND(i-1,i)) {
-        if (SAME_STRAND(i,i+1)) new_fML = fML[ij+1]+P->MLbase;
-        if (SAME_STRAND(j-1,j)) new_fML = MIN2(fML[indx[j-1]+i]+P->MLbase, new_fML);
-        if (SAME_STRAND(j,j+1)) {
-          energy = c[ij];
-          if(dangle_model == 2)
-            energy += E_MLstem(type,(i>1) ? S1[i-1] : -1, (j<length) ? S1[j+1] : -1, P);
-          else
-            energy += E_MLstem(type, -1, -1, P);
-
-          new_fML = MIN2(new_fML, energy);
-
-          if(with_gquad){
-            int gggg = ggg[ij] + E_MLstem(0, -1, -1, P);
-            energy = MIN2(energy, gggg);
-            new_fML = MIN2(new_fML, energy);
-          }
-
-          if(uniq_ML){
-            fM1[ij] = energy;
-            if(SAME_STRAND(j-1,j))
-              fM1[ij] = MIN2(energy, fM1[indx[j-1]+i] + P->MLbase);
-          }
-        }
-        if (dangle_model%2==1) {  /* normal dangles */
-          if (SAME_STRAND(i,i+1)) {
-            tt = ptype[ij+1]; /* i+1,j */
-            new_fML = MIN2(new_fML, c[ij+1] + P->MLbase + E_MLstem(tt, S1[i], -1, P));
-          }
-          if (SAME_STRAND(j-1,j)) {
-            tt = ptype[indx[j-1]+i]; /* i,j-1 */
-            new_fML = MIN2(new_fML, c[indx[j-1]+i] + P->MLbase + E_MLstem(tt, -1, S1[j], P));
-          }
-          if ((SAME_STRAND(j-1,j))&&(SAME_STRAND(i,i+1))) {
-            tt = ptype[indx[j-1]+i+1]; /* i+1,j-1 */
-            new_fML = MIN2(new_fML, c[indx[j-1]+i+1] + 2*P->MLbase + E_MLstem(tt, S1[i], S1[j], P));
-          }
-        }
-      }
-
-      if(with_gquad){
-        if(SAME_STRAND(i, j))
-          new_fML = MIN2(new_fML, ggg[indx[j] + i] + E_MLstem(0, -1, -1, P));
-      }
-
-      /* modular decomposition -------------------------------*/
-
-      {
-        int stopp;     /*loop 1 up to cut, then loop 2*/
-        stopp=(cut_point>0)? (cut_point):(j-2-TURN);
-        for (decomp=INF, k = i+1+TURN; k<stopp; k++)
-          decomp = MIN2(decomp, Fmi[k]+fML[indx[j]+k+1]);
-        k++;
-        for (;k <= j-2-TURN;k++)
-          decomp = MIN2(decomp, Fmi[k]+fML[indx[j]+k+1]);
-      }
-      DMLi[j] = decomp;               /* store for use in ML decompositon */
-      new_fML = MIN2(new_fML,decomp);
-
-      /* coaxial stacking */
-      if (dangle_model==3) {
-        int stopp;
-        stopp=(cut_point>0)? (cut_point):(j-2-TURN);
-        /* additional ML decomposition as two coaxially stacked helices */
-        for (decomp = INF, k = i+1+TURN; k<stopp; k++) {
-          type = ptype[indx[k]+i]; type = rtype[type];
-          type_2 = ptype[indx[j]+k+1]; type_2 = rtype[type_2];
-          if (type && type_2)
-            decomp = MIN2(decomp,
-                          c[indx[k]+i]+c[indx[j]+k+1]+P->stack[type][type_2]);
-        }
-        k++;
-        for (;k <= j-2-TURN; k++) {
-          type = ptype[indx[k]+i]; type = rtype[type];
-          type_2 = ptype[indx[j]+k+1]; type_2 = rtype[type_2];
-          if (type && type_2)
-            decomp = MIN2(decomp,
-                          c[indx[k]+i]+c[indx[j]+k+1]+P->stack[type][type_2]);
-        }
-
-        decomp += 2*P->MLintern[1];
-
-#if 0
-        /* This is needed for Y shaped ML loops with coax stacking of
-           interior pairs, but backtracking will fail if activated */
-        DMLi[j] = MIN2(DMLi[j], decomp);
-        if (SAME_STRAND(j-1,j)) DMLi[j] = MIN2(DMLi[j], DMLi[j-1]+P->MLbase);
-        if (SAME_STRAND(i,i+1)) DMLi[j] = MIN2(DMLi[j], DMLi1[j]+P->MLbase);
-        new_fML = MIN2(new_fML, DMLi[j]);
-#endif
-        new_fML = MIN2(new_fML, decomp);
-      }
-
-      fML[ij] = Fmi[j] = new_fML;     /* substring energy */
-
-    }
-
-    if (i==cut_point)
-      for (j=i; j<=maxj; j++)
-        free_end(fc, j, cut_point);
-    if (i<cut_point)
-      free_end(fc,i,cut_point-1);
-
-
-    {
-      int *FF; /* rotate the auxilliary arrays */
-      FF = DMLi2; DMLi2 = DMLi1; DMLi1 = DMLi; DMLi = FF;
-      FF = cc1; cc1=cc; cc=FF;
-      for (j=1; j<=maxj; j++) {cc[j]=Fmi[j]=DMLi[j]=INF; }
-    }
-  }
-
-  /* calculate energies of 5' and 3' fragments */
-
-  for (i=1; i<=length; i++)
-    free_end(f5, i, 1);
-
-  if (cut_point>0) {
-    mfe1=f5[cut_point-1];
-    mfe2=fc[length];
-    /* add DuplexInit, check whether duplex*/
-    for (i=cut_point; i<=length; i++) {
-      f5[i]=MIN2(f5[i]+P->DuplexInit, fc[i]+fc[1]);
-    }
-  }
-
-  energy = f5[length];
-  if (cut_point<1) mfe1=mfe2=energy;
-  return energy;
-}
-
-PRIVATE void backtrack_co(const char *string, int s, int b /* b=0: start new structure, b \ne 0: add to existing structure */) {
-
-  /*------------------------------------------------------------------
-    trace back through the "c", "fc", "f5" and "fML" arrays to get the
-    base pairing list. No search for equivalent structures is done.
-    This is fast, since only few structure elements are recalculated.
-    ------------------------------------------------------------------*/
-
-  int   i, j, k, length, energy, new;
-  int   no_close, type, type_2, tt;
-  int   bonus;
-  int   dangle_model  = P->model_details.dangles;
-  int   noGUclosure   = P->model_details.noGUclosure;
-  int   noLP          = P->model_details.noLP;
-
-  /* int   b=0;*/
-
-  length = strlen(string);
-  if (s==0) {
-    sector[++s].i = 1;
-    sector[s].j   = length;
-    sector[s].ml  = (backtrack_type=='M') ? 1 : ((backtrack_type=='C')?2:0);
-  }
-  while (s>0) {
-    int ml, fij, fi, cij, traced, i1, j1, mm, p, q, jj=0, gq=0;
-    int canonical = 1;     /* (i,j) closes a canonical structure */
-    i  = sector[s].i;
-    j  = sector[s].j;
-    ml = sector[s--].ml;   /* ml is a flag indicating if backtracking is to
-                              occur in the fML- (1) or in the f-array (0) */
-    if (ml==2) {
-      base_pair2[++b].i = i;
-      base_pair2[b].j   = j;
-      goto repeat1;
-    }
-
-    if (j < i+TURN+1) continue; /* no more pairs in this interval */
-
-
-    if (ml==0) {fij = f5[j]; fi = f5[j-1];}
-    else if (ml==1) {fij = fML[indx[j]+i]; fi = fML[indx[j-1]+i]+P->MLbase;}
-    else /* 3 or 4 */ {
-      fij = fc[j];
-      fi = (ml==3) ? INF : fc[j-1];
-    }
-    if (fij == fi) {  /* 3' end is unpaired */
-      sector[++s].i = i;
-      sector[s].j   = j-1;
-      sector[s].ml  = ml;
-      continue;
-    }
-
-    if (ml==0 || ml==4) { /* backtrack in f5 or fc[i=cut,j>cut] */
-      int *ff;
-      ff = (ml==4) ? fc : f5;
-      switch(dangle_model){
-        case 0:   /* j or j-1 is paired. Find pairing partner */
-                  for (k=j-TURN-1,traced=0; k>=i; k--) {
-                    int cc;
-
-                    if(with_gquad){
-                      if(fij == ff[k-1] + ggg[indx[j]+k]){
-                        /* found the decomposition */
-                        traced = j; jj = k - 1; gq = 1;
-                        break;
-                      }
-                    }
-
-                    type = ptype[indx[j]+k];
-                    if(type){
-                      cc = c[indx[j]+k];
-                      if(!SAME_STRAND(k,j)) cc += P->DuplexInit;
-                      if(fij == ff[k-1] + cc + E_ExtLoop(type, -1, -1, P)){
-                        traced = j; jj = k-1;
-                      }
-                    }
-                    if(traced) break;
-                  }
-
-                  break;
-
-        case 2:   /* j or j-1 is paired. Find pairing partner */
-                  for (k=j-TURN-1,traced=0; k>=i; k--) {
-                    int cc;
-
-                    if(with_gquad){
-                      if(fij == ff[k-1] + ggg[indx[j]+k]){
-                        /* found the decomposition */
-                        traced = j; jj = k - 1; gq = 1;
-                        break;
-                      }
-                    }
-
-                    type = ptype[indx[j]+k];
-                    if(type){
-                      cc = c[indx[j]+k];
-                      if(!SAME_STRAND(k,j)) cc += P->DuplexInit;
-                      if(fij == ff[k-1] + cc + E_ExtLoop(type, (k>1) && SAME_STRAND(k-1,k) ? S1[k-1] : -1, (j<length) && SAME_STRAND(j,j+1) ? S1[j+1] : -1, P)){
-                        traced = j; jj = k-1;
-                      }
-                    }
-                    if(traced) break;
-                  }
-                  break;
-
-        default:  for(k=j-TURN-1,traced=0; k>=i; k--){
-                    int cc;
-                    type = ptype[indx[j]+k];
-
-                    if(with_gquad){
-                      if(fij == ff[k-1] + ggg[indx[j]+k]){
-                        /* found the decomposition */
-                        traced = j; jj = k - 1; gq = 1;
-                        break;
-                      }
-                    }
-
-                    if(type){
-                      cc = c[indx[j]+k];
-                      if(!SAME_STRAND(k,j)) cc += P->DuplexInit;
-                      if(fij == ff[k-1] + cc + E_ExtLoop(type, -1, -1, P)){
-                        traced = j; jj = k-1; break;
-                      }
-                      if((k>1) && SAME_STRAND(k-1,k))
-                        if(fij == ff[k-2] + cc + E_ExtLoop(type, S1[k-1], -1, P)){
-                              traced=j; jj=k-2; break;
-                        }
-                    }
-
-                    type = ptype[indx[j-1]+k];
-                    if(type && SAME_STRAND(j-1,j)){
-                      cc = c[indx[j-1]+k];
-                      if (!SAME_STRAND(k,j-1)) cc += P->DuplexInit; /*???*/
-                      if (fij == cc + ff[k-1] + E_ExtLoop(type, -1, S1[j], P)){
-                            traced=j-1; jj = k-1; break;
-                      }
-                      if(k>i){
-                        if (fij == ff[k-2] + cc + E_ExtLoop(type, SAME_STRAND(k-1,k) ? S1[k-1] : -1, S1[j], P)){
-                          traced=j-1; jj=k-2; break;
-                        }
-                      }
-                    }
-                  }
-
-                  break;
-      }
-      if (!traced) nrerror("backtrack failed in f5 (or fc)");
-      sector[++s].i = i;
-      sector[s].j   = jj;
-      sector[s].ml  = ml;
-
-      i=k; j=traced;
-
-      if(with_gquad && gq){
-        /* goto backtrace of gquadruplex */
-        goto repeat_gquad;
-      }
-
-      base_pair2[++b].i = i;
-      base_pair2[b].j   = j;
-      goto repeat1;
-    }
-    else if (ml==3) { /* backtrack in fc[i<cut,j=cut-1] */
-      if (fc[i] == fc[i+1]) { /* 5' end is unpaired */
-        sector[++s].i = i+1;
-        sector[s].j   = j;
-        sector[s].ml  = ml;
-        continue;
-      }
-      /* i or i+1 is paired. Find pairing partner */
-      switch(dangle_model){
-        case 0:   for (k=i+TURN+1, traced=0; k<=j; k++){
-                    jj=k+1;
-                    type = ptype[indx[k]+i];
-                    if (type) {
-                      if(fc[i] == fc[k+1] + c[indx[k]+i] + E_ExtLoop(type, -1, -1, P)){
-                        traced = i;
-                      }
-                    } else if (with_gquad){
-                      if(fc[i] == fc[k+1] + ggg[indx[k]+i]){
-                        traced = i; gq = 1;
-                        break;
-                      }
-                    }
-
-                    if (traced) break;
-                  }
-                  break;
-        case 2:   for (k=i+TURN+1, traced=0; k<=j; k++){
-                    jj=k+1;
-                    type = ptype[indx[k]+i];
-                    if(type){
-                      if(fc[i] == fc[k+1] + c[indx[k]+i] + E_ExtLoop(type,(i>1 && SAME_STRAND(i-1,i)) ? S1[i-1] : -1,  SAME_STRAND(k,k+1) ? S1[k+1] : -1, P)){
-                        traced = i;
-                      }
-                    } else if (with_gquad){
-                      if(fc[i] == fc[k+1] + ggg[indx[k]+i]){
-                        traced = i; gq = 1;
-                        break;
-                      }
-                    }
-                    if (traced) break;
-                  }
-                  break;
-        default:  for(k=i+TURN+1, traced=0; k<=j; k++){
-                    jj=k+1;
-                    type = ptype[indx[k]+i];
-                    if(type){
-                      if(fc[i] == fc[k+1] + c[indx[k]+i] + E_ExtLoop(type, -1, -1, P)){
-                        traced = i; break;
-                      }
-                      else if(fc[i] == fc[k+2] + c[indx[k]+i] + E_ExtLoop(type, -1, SAME_STRAND(k,k+1) ? S1[k+1] : -1, P)){
-                        traced = i; jj=k+2; break;
-                      }
-                    } else if (with_gquad){
-                      if(fc[i] == fc[k+1] + ggg[indx[k]+i]){
-                        traced = i; gq = 1;
-                        break;
-                      }
-                    }
-
-                    type = ptype[indx[k]+i+1];
-                    if(type){
-                      if(fc[i] == fc[k+1] + c[indx[k]+i+1] + E_ExtLoop(type, SAME_STRAND(i, i+1) ? S1[i] : -1, -1, P)){
-                        traced = i+1; break;
-                      }
-                      if(k<j){
-                        if(fc[i] == fc[k+2] + c[indx[k]+i+1] + E_ExtLoop(type, SAME_STRAND(i, i+1) ? S1[i] : -1, SAME_STRAND(k, k+1) ? S1[k+1] : -1, P)){
-                          traced = i+1; jj=k+2; break;
-                        }
-                      }
-                    }
-                  }
-                  break;
-      }
-
-      if (!traced) nrerror("backtrack failed in fc[] 5' of cut");
-
-      sector[++s].i = jj;
-      sector[s].j   = j;
-      sector[s].ml  = ml;
-
-      j=k; i=traced;
-      if(with_gquad && gq){
-        /* goto backtrace of gquadruplex */
-        goto repeat_gquad;
-      }
-
-
-      base_pair2[++b].i = i;
-      base_pair2[b].j   = j;
-      goto repeat1;
-    }
-
-    else { /* true multi-loop backtrack in fML */
-      if (fML[indx[j]+i+1]+P->MLbase == fij) { /* 5' end is unpaired */
-        sector[++s].i = i+1;
-        sector[s].j   = j;
-        sector[s].ml  = ml;
-        continue;
-      }
-
-      if(with_gquad){
-        if(fij == ggg[indx[j]+i] + E_MLstem(0, -1, -1, P)){
-          /* go to backtracing of quadruplex */
-          goto repeat_gquad;
-        }
-      }
-
-      tt  = ptype[indx[j]+i];
-      cij = c[indx[j]+i];
-      switch(dangle_model){
-        case 0:   if(fij == cij + E_MLstem(tt, -1, -1, P)){
-                    base_pair2[++b].i  = i;
-                    base_pair2[b].j    = j;
-                    goto repeat1;
-                  }
-                  break;
-        case 2:   if(fij == cij + E_MLstem(tt, (i>1) ? S1[i-1] : -1, (j<length) ? S1[j+1] : -1, P)){
-                    base_pair2[++b].i  = i;
-                    base_pair2[b].j    = j;
-                    goto repeat1;
-                  }
-                  break;
-        default:  if(fij == cij + E_MLstem(tt, -1, -1, P)){
-                    base_pair2[++b].i  = i;
-                    base_pair2[b].j    = j;
-                    goto repeat1;
-                  }
-                  tt = ptype[indx[j]+i+1];
-                  if(fij == c[indx[j]+i+1] + P->MLbase + E_MLstem(tt, S1[i], -1, P)){
-                    i++;
-                    base_pair2[++b].i  = i;
-                    base_pair2[b].j    = j;
-                    goto repeat1;
-                  }
-                  tt = ptype[indx[j-1]+i];
-                  if(fij == c[indx[j-1]+i] + P->MLbase + E_MLstem(tt, -1, S1[j], P)){
-                    j--;
-                    base_pair2[++b].i  = i;
-                    base_pair2[b].j    = j;
-                    goto repeat1;
-                  }
-                  tt = ptype[indx[j-1]+i+1];
-                  if(fij == c[indx[j-1]+i+1] + 2*P->MLbase + E_MLstem(tt, S1[i], S1[j], P)){
-                    i++; j--;
-                    base_pair2[++b].i  = i;
-                    base_pair2[b].j    = j;
-                    goto repeat1;
-                  }
-                  break;
-      }
-
-      /* find next component of multiloop */
-      for (k = i+1+TURN; k <= j-2-TURN; k++)
-        if (fij == (fML[indx[k]+i]+fML[indx[j]+k+1]))
-          break;
-
-      if ((dangle_model==3)&&(k>j-2-TURN)) { /* must be coax stack */
-        ml = 2;
-        for (k = i+1+TURN; k <= j-2-TURN; k++) {
-          type = ptype[indx[k]+i];  type= rtype[type];
-          type_2 = ptype[indx[j]+k+1]; type_2= rtype[type_2];
-          if (type && type_2)
-            if (fij == c[indx[k]+i]+c[indx[j]+k+1]+P->stack[type][type_2]+
-                2*P->MLintern[1])
-              break;
-        }
-      }
-
-      sector[++s].i = i;
-      sector[s].j   = k;
-      sector[s].ml  = ml;
-      sector[++s].i = k+1;
-      sector[s].j   = j;
-      sector[s].ml  = ml;
-
-      if (k>j-2-TURN) nrerror("backtrack failed in fML");
-      continue;
-    }
-
-  repeat1:
-
-    /*----- begin of "repeat:" -----*/
-    if (canonical)  cij = c[indx[j]+i];
-    type = ptype[indx[j]+i];
-
-    bonus = 0;
-
-    if ((BP[i]==j)||(BP[i]==-1)||(BP[i]==-2)) bonus -= BONUS;
-    if ((BP[j]==-1)||(BP[j]==-3)) bonus -= BONUS;
-
-    if (noLP)
-      if (cij == c[indx[j]+i]) {
-        /* (i.j) closes canonical structures, thus
-           (i+1.j-1) must be a pair                */
-        type_2 = ptype[indx[j-1]+i+1]; type_2 = rtype[type_2];
-        cij -= P->stack[type][type_2] + bonus;
-        base_pair2[++b].i = i+1;
-        base_pair2[b].j   = j-1;
-        i++; j--;
-        canonical=0;
-        goto repeat1;
-      }
-    canonical = 1;
-
-
-    no_close = (((type==3)||(type==4))&&noGUclosure&&(bonus==0));
-    if (SAME_STRAND(i,j)) {
-      if (no_close) {
-        if (cij == FORBIDDEN) continue;
-      } else
-        if (cij == E_Hairpin(j-i-1, type, S1[i+1], S1[j-1],string+i-1, P)+bonus)
-          continue;
-    }
-    else {
-      if(dangle_model){
-        if(cij == E_ExtLoop(rtype[type], SAME_STRAND(j-1,j) ? S1[j-1] : -1, SAME_STRAND(i,i+1) ? S1[i+1] : -1, P)) continue;
-      }
-      else if(cij == E_ExtLoop(rtype[type], -1, -1, P)) continue;
-    }
-
-    for (p = i+1; p <= MIN2(j-2-TURN,i+MAXLOOP+1); p++) {
-      int minq;
-      minq = j-i+p-MAXLOOP-2;
-      if (minq<p+1+TURN) minq = p+1+TURN;
-      for (q = j-1; q >= minq; q--) {
-
-        type_2 = ptype[indx[q]+p];
-        if (type_2==0) continue;
-        type_2 = rtype[type_2];
-        if (noGUclosure)
-          if (no_close||(type_2==3)||(type_2==4))
-            if ((p>i+1)||(q<j-1)) continue;  /* continue unless stack */
-
-        /* energy = oldLoopEnergy(i, j, p, q, type, type_2); */
-        if (SAME_STRAND(i,p) && SAME_STRAND(q,j))
-          energy = E_IntLoop(p-i-1, j-q-1, type, type_2,
-                              S1[i+1], S1[j-1], S1[p-1], S1[q+1], P);
-        else {
-          energy = E_IntLoop_Co(rtype[type], rtype[type_2], i, j, p, q, cut_point, S1[i+1], S1[j-1], S1[p-1], S1[q+1], dangle_model, P);
-        }
-
-        new = energy+c[indx[q]+p]+bonus;
-        traced = (cij == new);
-        if (traced) {
-          base_pair2[++b].i = p;
-          base_pair2[b].j   = q;
-          i = p, j = q;
-          goto repeat1;
-        }
-      }
-    }
-
-    /* end of repeat: --------------------------------------------------*/
-
-    /* (i.j) must close a fake or true multi-loop */
-    tt = rtype[type];
-    i1 = i+1;
-    j1 = j-1;
-
-    if(with_gquad){
-      /*
-        The case that is handled here actually resembles something like
-        an interior loop where the enclosing base pair is of regular
-        kind and the enclosed pair is not a canonical one but a g-quadruplex
-        that should then be decomposed further...
-      */
-      if(SAME_STRAND(i,j)){
-        if(backtrack_GQuad_IntLoop(cij - bonus, i, j, type, S, ggg, indx, &p, &q, P)){
-          i = p; j = q;
-          goto repeat_gquad;
-        }
-      }
-    }
-
-    /* fake multi-loop */
-    if(!SAME_STRAND(i,j)){
-      int ii, jj, decomp;
-      ii = jj = 0;
-      decomp = fc[i1] + fc[j1];
-      switch(dangle_model){
-        case 0:   if(cij == decomp + E_ExtLoop(tt, -1, -1, P)){
-                    ii=i1, jj=j1;
-                  }
-                  break;
-        case 2:   if(cij == decomp + E_ExtLoop(tt, SAME_STRAND(j-1,j) ? S1[j-1] : -1, SAME_STRAND(i,i+1) ? S1[i+1] : -1, P)){
-                    ii=i1, jj=j1;
-                  }
-
-                  break;
-        default:  if(cij == decomp + E_ExtLoop(tt, -1, -1, P)){
-                    ii=i1, jj=j1;
-                  }
-                  else if(cij == fc[i+2] + fc[j-1] + E_ExtLoop(tt, -1, SAME_STRAND(i,i+1) ? S1[i+1] : -1, P)){
-                    ii = i+2; jj = j1;
-                  }
-                  else if(cij == fc[i+1] + fc[j-2] + E_ExtLoop(tt, SAME_STRAND(j-1,j) ? S1[j-1] : -1, -1, P)){
-                    ii = i1; jj = j-2;
-                  }
-                  else if(cij == fc[i+2] + fc[j-2] + E_ExtLoop(tt, SAME_STRAND(j-1,j) ? S1[j-1] : -1, SAME_STRAND(i,i+1) ? S1[i+1] : -1, P)){
-                    ii = i+2; jj = j-2;
-                  }
-                  break;
-      }
-      if(ii){
-        sector[++s].i = ii;
-        sector[s].j   = cut_point-1;
-        sector[s].ml  = 3;
-        sector[++s].i = cut_point;
-        sector[s].j   = jj;
-        sector[s].ml  = 4;
-        continue;
-      }
-    }
-
-    /* true multi-loop */
-    mm = bonus + P->MLclosing;
-    sector[s+1].ml  = sector[s+2].ml = 1;
-    int ml0   = E_MLstem(tt, -1, -1, P);
-    int ml5   = E_MLstem(tt, SAME_STRAND(j-1,j) ? S1[j-1] : -1, -1, P);
-    int ml3   = E_MLstem(tt, -1, SAME_STRAND(i,i+1) ? S1[i+1] : -1, P);
-    int ml53  = E_MLstem(tt, SAME_STRAND(j-1,j) ? S1[j-1] : -1, SAME_STRAND(i,i+1) ? S1[i+1] : -1, P);
-    for (traced = 0, k = i+2+TURN; k < j-2-TURN; k++) {
-      switch(dangle_model){
-        case 0:   /* no dangles */
-                  if(cij == mm + fML[indx[k]+i+1] + fML[indx[j-1]+k+1] + ml0)
-                    traced = i+1;
-                  break;
-        case 2:   /*double dangles */
-                  if(cij == mm + fML[indx[k]+i+1] + fML[indx[j-1]+k+1] + ml53)
-                    traced = i+1;
-                  break;
-        default:  /* normal dangles */
-                  if(cij == mm + fML[indx[k]+i+1] + fML[indx[j-1]+k+1] + ml0){
-                    traced = i+1;
-                    break;
-                  }
-                  else if (cij == fML[indx[k]+i+2] + fML[indx[j-1]+k+1] + ml3 + mm + P->MLbase){
-                    traced = i1 = i+2;
-                    break;
-                  }
-                  else if (cij == fML[indx[k]+i+1] + fML[indx[j-2]+k+1] + ml5 + mm + P->MLbase){
-                    traced = i1 = i+1; j1 = j-2;
-                    break;
-                  }
-                  else if (cij == fML[indx[k]+i+2] + fML[indx[j-2]+k+1] + ml53 + mm + 2*P->MLbase){
-                    traced = i1 = i+2; j1 = j-2;
-                    break;
-                  }
-                  break;
-      }
-      if(traced) break;
-      /* coaxial stacking of (i.j) with (i+1.k) or (k.j-1) */
-      /* use MLintern[1] since coax stacked pairs don't get TerminalAU */
-      if (dangle_model==3) {
-        int en;
-        type_2 = ptype[indx[k]+i+1]; type_2 = rtype[type_2];
-        if (type_2) {
-          en = c[indx[k]+i+1]+P->stack[type][type_2]+fML[indx[j-1]+k+1];
-          if (cij == en+2*P->MLintern[1]+P->MLclosing) {
-            ml = 2;
-            sector[s+1].ml  = 2;
-            break;
-          }
-        }
-        type_2 = ptype[indx[j-1]+k+1]; type_2 = rtype[type_2];
-        if (type_2) {
-          en = c[indx[j-1]+k+1]+P->stack[type][type_2]+fML[indx[k]+i+1];
-          if (cij == en+2*P->MLintern[1]+P->MLclosing) {
-            sector[s+2].ml = 2;
-            break;
-          }
-        }
-      }
-    }
-    if (k<=j-3-TURN) { /* found the decomposition */
-      sector[++s].i = i1;
-      sector[s].j   = k;
-      sector[++s].i = k+1;
-      sector[s].j   = j1;
-    } else {
-#if 0
-      /* Y shaped ML loops don't work yet */
-      if (dangle_model==3) {
-        /* (i,j) must close a Y shaped ML loop with coax stacking */
-        if (cij == fML[indx[j-2]+i+2] + mm + d3 + d5 + P->MLbase + P->MLbase) {
-          i1 = i+2;
-          j1 = j-2;
-        } else if (cij ==  fML[indx[j-2]+i+1] + mm + d5 + P->MLbase)
-          j1 = j-2;
-        else if (cij ==  fML[indx[j-1]+i+2] + mm + d3 + P->MLbase)
-          i1 = i+2;
-        else /* last chance */
-          if (cij != fML[indx[j-1]+i+1] + mm + P->MLbase)
-            fprintf(stderr,  "backtracking failed in repeat");
-        /* if we arrive here we can express cij via fML[i1,j1]+dangles */
-        sector[++s].i = i1;
-        sector[s].j   = j1;
-      }
-      else
-#endif
-        nrerror("backtracking failed in repeat");
-    }
-
-    continue; /* this is a workarround to not accidentally proceed in the following block */
-
-  repeat_gquad:
-    /*
-      now we do some fancy stuff to backtrace the stacksize and linker lengths
-      of the g-quadruplex that should reside within position i,j
-    */
-    {
-      int l[3], L, a;
-      L = -1;
-      
-      get_gquad_pattern_mfe(S, i, j, P, &L, l);
-      if(L != -1){
-        /* fill the G's of the quadruplex into base_pair2 */
-        for(a=0;a<L;a++){
-          base_pair2[++b].i = i+a;
-          base_pair2[b].j   = i+a;
-          base_pair2[++b].i = i+L+l[0]+a;
-          base_pair2[b].j   = i+L+l[0]+a;
-          base_pair2[++b].i = i+L+l[0]+L+l[1]+a;
-          base_pair2[b].j   = i+L+l[0]+L+l[1]+a;
-          base_pair2[++b].i = i+L+l[0]+L+l[1]+L+l[2]+a;
-          base_pair2[b].j   = i+L+l[0]+L+l[1]+L+l[2]+a;
-        }
-        goto repeat_gquad_exit;
-      }
-      nrerror("backtracking failed in repeat_gquad");
-    }
-  repeat_gquad_exit:
-    asm("nop");
-
-  } /* end >> while (s>0) << */
-
-  base_pair2[0].i = b;    /* save the total number of base pairs */
-}
-
-PRIVATE void free_end(int *array, int i, int start) {
-  int inc, type, energy, length, j, left, right;
-  int dangle_model = P->model_details.dangles;
-
-  inc = (i>start)? 1:-1;
-  length = S[0];
-
-  if (i==start) array[i]=0;
-  else array[i] = array[i-inc];
-  if (inc>0) {
-    left = start; right=i;
-  } else {
-    left = i; right = start;
-  }
-
-  for (j=start; inc*(i-j)>TURN; j+=inc) {
-    int ii, jj;
-    short si, sj;
-    if (i>j) { ii = j; jj = i;} /* inc>0 */
-    else     { ii = i; jj = j;} /* inc<0 */
-    type = ptype[indx[jj]+ii];
-    if (type) {  /* i is paired with j */
-      si = (ii>1)       && SAME_STRAND(ii-1,ii) ? S1[ii-1] : -1;
-      sj = (jj<length)  && SAME_STRAND(jj,jj+1) ? S1[jj+1] : -1;
-      energy = c[indx[jj]+ii];
-      switch(dangle_model){
-        case 0:   
-                  array[i] = MIN2(array[i], array[j-inc] + energy + E_ExtLoop(type, -1, -1, P));
-                  break;
-        case 2:   
-                  array[i] = MIN2(array[i], array[j-inc] + energy + E_ExtLoop(type, si, sj, P));
-                  break;
-        default:     
-                  array[i] = MIN2(array[i], array[j-inc] + energy + E_ExtLoop(type, -1, -1, P));
-                  if(inc > 0){
-                    if(j > left)
-                    array[i] = MIN2(array[i], array[j-2] + energy + E_ExtLoop(type, si, -1, P));
-                  }
-                  else if(j < right)
-                    array[i] = MIN2(array[i], array[j+2] + energy + E_ExtLoop(type, -1, sj, P));
-                  break;
-      }
-    }
-
-    if(with_gquad){
-      if(SAME_STRAND(ii, jj))
-        array[i] = MIN2(array[i], array[j-inc] + ggg[indx[jj]+ii]);
-    }
-
-    if (dangle_model%2==1) {
-      /* interval ends in a dangle (i.e. i-inc is paired) */
-      if (i>j) { ii = j; jj = i-1;} /* inc>0 */
-      else     { ii = i+1; jj = j;} /* inc<0 */
-      type = ptype[indx[jj]+ii];
-      if (!type) continue;
-
-      si = (ii > left)  && SAME_STRAND(ii-1,ii) ? S1[ii-1] : -1;
-      sj = (jj < right) && SAME_STRAND(jj,jj+1) ? S1[jj+1] : -1;
-      energy = c[indx[jj]+ii];
-      if(inc>0)
-        array[i] = MIN2(array[i], array[j - inc] + energy + E_ExtLoop(type, -1, sj, P));
-      else
-        array[i] = MIN2(array[i], array[j - inc] + energy + E_ExtLoop(type, si, -1, P));
-      if(j!= start){ /* dangle_model on both sides */
-        array[i] = MIN2(array[i], array[j-2*inc] + energy + E_ExtLoop(type, si, sj, P));
-      }
-    }
-  }
-}
-
-PUBLIC void update_cofold_params(void){
-  update_cofold_params_par(NULL);
-}
-
-PUBLIC void update_cofold_params_par(paramT *parameters){
-  if(P) free(P);
-
-  if(parameters){
-    P = get_parameter_copy(parameters);
-  } else {
-    model_detailsT md;
-    set_model_details(&md);
-    P = get_scaled_parameters(temperature, md);
-  }
-  make_pair_matrix();
-  if (init_length < 0) init_length=0;
-}
-
-/*---------------------------------------------------------------------------*/
-
-PRIVATE void make_ptypes(const short *S, const char *structure) {
-  int n,i,j,k,l;
-  int noLP = P->model_details.noLP;
-
-  n=S[0];
-  for (k=1; k<n-TURN; k++)
-    for (l=1; l<=2; l++) {
-      int type,ntype=0,otype=0;
-      i=k; j = i+TURN+l; if (j>n) continue;
-      type = pair[S[i]][S[j]];
-      while ((i>=1)&&(j<=n)) {
-        if ((i>1)&&(j<n)) ntype = pair[S[i-1]][S[j+1]];
-        if (noLP && (!otype) && (!ntype))
-          type = 0; /* i.j can only form isolated pairs */
-        ptype[indx[j]+i] = (char) type;
-        otype =  type;
-        type  = ntype;
-        i--; j++;
-      }
-    }
-
-  if (struct_constrained && (structure != NULL))
-    constrain_ptypes(structure, (unsigned int)n, ptype, BP, TURN, 0);
-}
-
-PUBLIC void get_monomere_mfes(float *e1, float *e2) {
-  /*exports monomere free energies*/
-  *e1 = mfe1;
-  *e2 = mfe2;
-}
-
-PRIVATE void backtrack(const char *sequence) {
-  /*routine to call backtrack_co from 1 to n, backtrack type??*/
-  backtrack_co(sequence, 0,0);
-}
-
-PRIVATE int comp_pair(const void *A, const void *B) {
-  bondT *x,*y;
-  int ex, ey;
-  x = (bondT *) A;
-  y = (bondT *) B;
-  ex = c[indx[x->j]+x->i]+c[indx[x->i+length]+x->j];
-  ey = c[indx[y->j]+y->i]+c[indx[y->i+length]+y->j];
-  if (ex>ey) return 1;
-  if (ex<ey) return -1;
-  return (indx[x->j]+x->i - indx[y->j]+y->i);
-}
-
-PUBLIC SOLUTION *zukersubopt(const char *string) {
-  return zukersubopt_par(string, NULL);
-}
-
-PUBLIC SOLUTION *zukersubopt_par(const char *string, paramT *parameters){
-
-/* Compute zuker suboptimal. Here, we're abusing the cofold() code
-   "double" sequence, compute dimerarray entries, track back every base pair.
-   This is slightly wasteful compared to the normal solution */
-
-  char      *doubleseq, *structure, *mfestructure, **todo;
-  int       i, j, counter, num_pairs, psize, p;
-  float     energy;
-  SOLUTION  *zukresults;
-  bondT     *pairlist;
-
-  num_pairs       = counter = 0;
-  zuker           = 1;
-  length          = (int)strlen(string);
-  doubleseq       = (char *)space((2*length+1)*sizeof(char));
-  mfestructure    = (char *) space((unsigned) 2*length+1);
-  structure       = (char *) space((unsigned) 2*length+1);
-  zukresults      = (SOLUTION *)space(((length*(length-1))/2)*sizeof(SOLUTION));
-  mfestructure[0] = '\0';
-  BP              = (int *)space(sizeof(int)*(2*length+2));
-
-  /* double the sequence */
-  strcpy(doubleseq,string);
-  strcat(doubleseq,string);
-  cut_point = length + 1;
-
-  /* get mfe and do forward recursion */
-#ifdef _OPENMP
-  /* always init everything since all global static variables are uninitialized when entering a thread */
-  init_cofold(2 * length, parameters);
-#else
-  if(parameters) init_cofold(2 * length, parameters);
-  else if ((2 * length) > init_length) init_cofold(2 * length, parameters);
-  else if (fabs(P->temperature - temperature)>1e-6) update_cofold_params_par(parameters);
-#endif
-
-
-  S     = encode_sequence(doubleseq, 0);
-  S1    = encode_sequence(doubleseq, 1);
-  S1[0] = S[0]; /* store length at pos. 0 */
-  make_ptypes(S, NULL); /* no constraint folding possible (yet?) with zukersubopt */
-
-  (void)fill_arrays(doubleseq);
-
-  psize     = length;
-  pairlist  = (bondT *) space(sizeof(bondT)*(psize+1));
-  todo      = (char **) space(sizeof(char *)*(length+1));
-  for (i=1; i<length; i++) {
-    todo[i] = (char *) space(sizeof(char)*(length+1));
-  }
-
-  /* Make a list of all base pairs */
-  for (i=1; i<length; i++) {
-    for (j=i+TURN2+1/*??*/; j<=length; j++) {
-      if (ptype[indx[j]+i]==0) continue;
-      if (num_pairs>=psize) {
-        psize = 1.2*psize + 32;
-        pairlist = xrealloc(pairlist, sizeof(bondT)*(psize+1));
-      }
-      pairlist[num_pairs].i   = i;
-      pairlist[num_pairs++].j = j;
-      todo[i][j]=1;
-    }
-  }
-  qsort(pairlist, num_pairs, sizeof(bondT), comp_pair);
-
-  for (p=0; p<num_pairs; p++) {
-    i=pairlist[p].i;
-    j=pairlist[p].j;
-    if (todo[i][j]) {
-      int k;
-      sector[1].i   = i;
-      sector[1].j   = j;
-      sector[1].ml  = 2;
-      backtrack_co(doubleseq, 1,0);
-      sector[1].i   = j;
-      sector[1].j   = i + length;
-      sector[1].ml  = 2;
-      backtrack_co(doubleseq, 1,base_pair2[0].i);
-      energy = c[indx[j]+i]+c[indx[i+length]+j];
-      parenthesis_zuker(structure, base_pair2, length);
-      zukresults[counter].energy      = energy;
-      zukresults[counter++].structure = strdup(structure);
-      for (k = 1; k <= base_pair2[0].i; k++) { /* mark all pairs in structure as done */
-        int x,y;
-        x=base_pair2[k].i;
-        y=base_pair2[k].j;
-        if (x>length) x-=length;
-        if (y>length) y-=length;
-        if (x>y) {
-          int temp;
-          temp=x; x=y; y=temp;
-        }
-        todo[x][y] = 0;
-      }
-    }
-  }
-  /*free zeugs*/
-  free(pairlist);
-  for (i=1; i<length; i++)
-    free(todo[i]);
-  free(todo);
-  free(structure);
-  free(mfestructure);
-  free(doubleseq);
-  zuker=0;
-  free(S); free(S1); free(BP);
-  return zukresults;
-}
-
-
-/*###########################################*/
-/*# deprecated functions below              #*/
-/*###########################################*/
-
-PUBLIC void initialize_cofold(int length){ /* DO NOTHING */ }
diff --git a/cbits/energy_par.c b/cbits/energy_par.c
deleted file mode 100644
--- a/cbits/energy_par.c
+++ /dev/null
@@ -1,791 +0,0 @@
-
-
-/*
-    Automatically generated using the TurnerParser
-    TurnerParser (c) 2008,2009,2010
-      Christian Hoener zu Siederdissen, TBI Vienna
-      choener (at) tbi.univie.ac.at
-
-    The library enabling this can be found at:
-    http://hackage.haskell.org/package/BiobaseVienna
-    the program can be found at:
-    (sorry, not yet)
-    install using cabal: cabal install (sorry, not yet)
-*/
-
-/*
-     Current free energy parameters are summarized in:
-
-     D.H.Mathews, J. Sabina, M. ZUker, D.H. Turner
-     "Expanded sequence dependence of thermodynamic parameters improves
-     prediction of RNA secondary structure"
-     JMB, 288, pp 911-940, 1999
-
-     Enthalpies taken from:
-
-     A. Walter, D Turner, J Kim, M Lyttle, P M"uller, D Mathews, M Zuker
-     "Coaxial stacking of helices enhances binding of oligoribonucleotides.."
-     PNAS, 91, pp 9218-9222, 1994
-
-     D.H. Turner, N. Sugimoto, and S.M. Freier.
-     "RNA Structure Prediction",
-     Ann. Rev. Biophys. Biophys. Chem. 17, 167-192, 1988.
-
-     John A.Jaeger, Douglas H.Turner, and Michael Zuker.
-     "Improved predictions of secondary structures for RNA",
-     PNAS, 86, 7706-7710, October 1989.
-
-     L. He, R. Kierzek, J. SantaLucia, A.E. Walter, D.H. Turner
-     "Nearest-Neighbor Parameters for GU Mismatches...."
-     Biochemistry 1991, 30 11124-11132
-
-     A.E. Peritz, R. Kierzek, N, Sugimoto, D.H. Turner
-     "Thermodynamic Study of Internal Loops in Oligoribonucleotides..."
-     Biochemistry 1991, 30, 6428--6435
-*/
-
-
-
-#include "energy_const.h"
-/*@unused@*/
-static char rcsid[] = "$Id: energy_par.c,v 1.6 2004/08/12 12:11:57 ivo Exp $";
-
-#define NST 0     /* Energy for nonstandard stacked pairs */
-#define DEF -50   /* Default terminal mismatch, used for I */
-                  /* and any non_pairing bases */
-#define NSM 0     /* terminal mismatch for non standard pairs */
-
-#define PUBLIC
-
-PUBLIC double Tmeasure = 37+K0;  /* temperature of param measurements */
-
-
-/* PUBLIC double lxc37=107.9; */
-PUBLIC double lxc37=107.856;
-PUBLIC int ML_intern37=-90;
-PUBLIC int ML_interndH=-220;
-PUBLIC int ML_closing37=930;
-PUBLIC int ML_closingdH=3000;
-PUBLIC int ML_BASE37=0;
-PUBLIC int ML_BASEdH=0;
-PUBLIC int MAX_NINIO=300;
-PUBLIC int ninio37=60;
-PUBLIC int niniodH=320;
-PUBLIC int TerminalAU37=50;
-PUBLIC int TerminalAUdH=370;
-PUBLIC int DuplexInit37=410;
-PUBLIC int DuplexInitdH=360;
-PUBLIC int TripleC37=100;
-PUBLIC int TripleCdH=1860;
-PUBLIC int MultipleCA37=30;
-PUBLIC int MultipleCAdH=340;
-PUBLIC int MultipleCB37=160;
-PUBLIC int MultipleCBdH=760;
-
-PUBLIC int GQuadAlpha37 = -1800;
-PUBLIC int GQuadAlphadH = -11934;
-PUBLIC int GQuadBeta37 = 1200;
-PUBLIC int GQuadBetadH = 0;
-
-PUBLIC int stack37[NBPAIRS+1][NBPAIRS+1] =
-{{   INF,   INF,   INF,   INF,   INF,   INF,   INF,   INF}
-,{   INF,  -240,  -330,  -210,  -140,  -210,  -210,  -140}
-,{   INF,  -330,  -340,  -250,  -150,  -220,  -240,  -150}
-,{   INF,  -210,  -250,   130,   -50,  -140,  -130,   130}
-,{   INF,  -140,  -150,   -50,    30,   -60,  -100,    30}
-,{   INF,  -210,  -220,  -140,   -60,  -110,   -90,   -60}
-,{   INF,  -210,  -240,  -130,  -100,   -90,  -130,   -90}
-,{   INF,  -140,  -150,   130,    30,   -60,   -90,   130}};
-PUBLIC int stackdH[NBPAIRS+1][NBPAIRS+1] =
-{{   INF,   INF,   INF,   INF,   INF,   INF,   INF,   INF}
-,{   INF, -1060, -1340, -1210,  -560, -1050, -1040,  -560}
-,{   INF, -1340, -1490, -1260,  -830, -1140, -1240,  -830}
-,{   INF, -1210, -1260, -1460, -1350,  -880, -1280,  -880}
-,{   INF,  -560,  -830, -1350,  -930,  -320,  -700,  -320}
-,{   INF, -1050, -1140,  -880,  -320,  -940,  -680,  -320}
-,{   INF, -1040, -1240, -1280,  -700,  -680,  -770,  -680}
-,{   INF,  -560,  -830,  -880,  -320,  -320,  -680,  -320}};
-
-PUBLIC int hairpin37[31] = {   INF,   INF,   INF,   540,   560,   570,   540,   600,   550,   640,   650,   660,   670,   680,   690,   690,   700,   710,   710,   720,   720,   730,   730,   740,   740,   750,   750,   750,   760,   760,   770};
-PUBLIC int hairpindH[31] = {   INF,   INF,   INF,   130,   480,   360,  -290,   130,  -290,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500,   500};
-PUBLIC int bulge37[31] = {   INF,   380,   280,   320,   360,   400,   440,   460,   470,   480,   490,   500,   510,   520,   530,   540,   540,   550,   550,   560,   570,   570,   580,   580,   580,   590,   590,   600,   600,   600,   610};
-PUBLIC int bulgedH[31] = {   INF,  1060,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710,   710};
-PUBLIC int internal_loop37[31] = {   INF,   INF,   100,   100,   110,   200,   200,   210,   230,   240,   250,   260,   270,   280,   290,   290,   300,   310,   310,   320,   330,   330,   340,   340,   350,   350,   350,   360,   360,   370,   370};
-PUBLIC int internal_loopdH[31] = {   INF,   INF,   -720,   -720,  -720,  -680,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130,  -130};
-
-PUBLIC int mismatchI37[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,   -80,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,  -100,     0,  -100,     0}
- ,{     0,     0,     0,     0,   -60}
- }
-,{{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,   -80,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,  -100,     0,  -100,     0}
- ,{     0,     0,     0,     0,   -60}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,   -10,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,   -30,    70,   -30,    70}
- ,{    70,    70,    70,    70,    10}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,   -10,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,   -30,    70,   -30,    70}
- ,{    70,    70,    70,    70,    10}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,   -10,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,   -30,    70,   -30,    70}
- ,{    70,    70,    70,    70,    10}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,   -10,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,   -30,    70,   -30,    70}
- ,{    70,    70,    70,    70,    10}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,   -10,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,   -30,    70,   -30,    70}
- ,{    70,    70,    70,    70,    10}
- }};
-PUBLIC int mismatchIdH[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{   280,     0,     0,   280,     0}
- ,{     0,     0,     0,  -340,     0}
- ,{     0,     0,     0,     0,     0}
- ,{   280,  -760,     0,   280,     0}
- ,{     0,     0,     0,     0,  -580}
- }
-,{{   280,     0,     0,   280,     0}
- ,{     0,     0,     0,  -340,     0}
- ,{     0,     0,     0,     0,     0}
- ,{   280,  -760,     0,   280,     0}
- ,{     0,     0,     0,     0,  -580}
- }
-,{{   790,   500,   500,   790,   500}
- ,{   500,   500,   500,   170,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   790,  -260,   500,   790,   500}
- ,{   500,   500,   500,   500,   -80}
- }
-,{{   790,   500,   500,   790,   500}
- ,{   500,   500,   500,   170,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   790,  -260,   500,   790,   500}
- ,{   500,   500,   500,   500,   -80}
- }
-,{{   790,   500,   500,   790,   500}
- ,{   500,   500,   500,   170,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   790,  -260,   500,   790,   500}
- ,{   500,   500,   500,   500,   -80}
- }
-,{{   790,   500,   500,   790,   500}
- ,{   500,   500,   500,   170,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   790,  -260,   500,   790,   500}
- ,{   500,   500,   500,   500,   -80}
- }
-,{{   790,   500,   500,   790,   500}
- ,{   500,   500,   500,   170,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   790,  -260,   500,   790,   500}
- ,{   500,   500,   500,   500,   -80}
- }};
-
-PUBLIC int mismatchH37[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{   -80,  -100,  -110,  -100,   -80}
- ,{  -140,  -150,  -150,  -140,  -150}
- ,{   -80,  -100,  -110,  -100,   -80}
- ,{  -150,  -230,  -150,  -240,  -150}
- ,{  -100,  -100,  -140,  -100,  -210}
- }
-,{{   -50,  -110,   -70,  -110,   -50}
- ,{  -110,  -110,  -150,  -130,  -150}
- ,{   -50,  -110,   -70,  -110,   -50}
- ,{  -150,  -250,  -150,  -220,  -150}
- ,{  -100,  -110,  -100,  -110,  -160}
- }
-,{{    20,    20,   -20,   -10,   -20}
- ,{    20,    20,   -50,   -30,   -50}
- ,{   -10,   -10,   -20,   -10,   -20}
- ,{   -50,  -100,   -50,  -110,   -50}
- ,{   -10,   -10,   -30,   -10,  -100}
- }
-,{{     0,   -20,   -10,   -20,     0}
- ,{   -30,   -50,   -30,   -60,   -30}
- ,{     0,   -20,   -10,   -20,     0}
- ,{   -30,   -90,   -30,  -110,   -30}
- ,{   -10,   -20,   -10,   -20,   -90}
- }
-,{{   -10,   -10,   -20,   -10,   -20}
- ,{   -30,   -30,   -50,   -30,   -50}
- ,{   -10,   -10,   -20,   -10,   -20}
- ,{   -50,  -120,   -50,  -110,   -50}
- ,{   -10,   -10,   -30,   -10,  -120}
- }
-,{{     0,   -20,   -10,   -20,     0}
- ,{   -30,   -50,   -30,   -50,   -30}
- ,{     0,   -20,   -10,   -20,     0}
- ,{   -30,  -150,   -30,  -150,   -30}
- ,{   -10,   -20,   -10,   -20,   -90}
- }
-,{{    20,    20,   -10,   -10,     0}
- ,{    20,    20,   -30,   -30,   -30}
- ,{     0,   -10,   -10,   -10,     0}
- ,{   -30,   -90,   -30,  -110,   -30}
- ,{   -10,   -10,   -10,   -10,   -90}
- }};
-PUBLIC int mismatchHdH[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{   560,  -570,   560,  -560,  -270}
- ,{  -560,  -910,  -560,  -560,  -560}
- ,{  -270,  -570,  -340,  -570,  -270}
- ,{   560, -1400,   560,  -920,  -560}
- ,{  -530,  -570,  -530,  -570, -1440}
- }
-,{{    50,  -520,    50,  -560,  -400}
- ,{  -400,  -520,  -400,  -560,  -400}
- ,{    50,  -720,    50,  -720,  -420}
- ,{  -400, -1290,  -400,  -620,  -400}
- ,{   -30,  -720,   -30,  -720, -1080}
- }
-,{{   970,   140,   970,   140,   570}
- ,{   570,    30,   570,    20,   570}
- ,{   970,   140,   970,   140,   340}
- ,{   570,  -270,   570,    20,   570}
- ,{   830,   140,   830,   140,   -50}
- }
-,{{   230,   100,   230,   220,   190}
- ,{  -110,  -110,  -260,  -520,  -260}
- ,{   190,   -60,  -140,   -60,   190}
- ,{   220,   100,  -260,   220,  -260}
- ,{   230,   -60,   230,   -60,   -70}
- }
-,{{   970,   140,   970,   140,   570}
- ,{   570,   -20,   570,    20,   570}
- ,{   970,   140,   970,   140,   340}
- ,{   570,  -520,   570,    20,   570}
- ,{   830,   140,   830,   140,  -380}
- }
-,{{   230,   -30,   230,   -60,   190}
- ,{   -30,   -30,  -260,  -520,  -260}
- ,{   190,   -60,  -140,   -60,   190}
- ,{  -260,  -590,  -260,  -520,  -260}
- ,{   230,   -60,   230,   -60,   -70}
- }
-,{{   970,   140,   970,   220,   570}
- ,{   570,    30,   570,    20,   570}
- ,{   970,   140,   970,   140,   340}
- ,{   570,   100,   570,   220,   570}
- ,{   830,   140,   830,   140,   -50}
- }};
-
-PUBLIC int mismatchM37[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{   -80,  -100,  -110,  -100,   -80}
- ,{  -140,  -150,  -150,  -140,  -150}
- ,{   -80,  -100,  -110,  -100,   -80}
- ,{  -140,  -140,  -150,  -160,  -150}
- ,{  -100,  -100,  -140,  -100,  -120}
- }
-,{{   -50,  -110,   -70,  -110,   -50}
- ,{  -110,  -110,  -150,  -130,  -150}
- ,{   -50,  -110,   -70,  -110,   -50}
- ,{  -140,  -160,  -150,  -140,  -150}
- ,{   -70,  -110,  -100,  -110,   -70}
- }
-,{{   -30,   -30,   -70,   -60,   -60}
- ,{   -30,   -30,  -100,   -80,  -100}
- ,{   -60,   -60,   -70,   -60,   -70}
- ,{   -60,   -60,  -100,   -80,  -100}
- ,{   -60,   -60,   -80,   -60,   -60}
- }
-,{{   -50,   -50,   -60,   -70,   -50}
- ,{   -80,  -100,   -80,  -110,   -80}
- ,{   -50,   -70,   -60,   -70,   -50}
- ,{   -50,   -50,   -80,   -80,   -80}
- ,{   -50,   -70,   -60,   -70,   -50}
- }
-,{{   -60,   -60,   -70,   -60,   -70}
- ,{   -80,   -80,  -100,   -80,  -100}
- ,{   -60,   -60,   -70,   -60,   -70}
- ,{   -80,   -80,  -100,   -80,  -100}
- ,{   -60,   -60,   -80,   -60,   -80}
- }
-,{{   -50,   -70,   -60,   -70,   -50}
- ,{   -80,  -100,   -80,  -110,   -80}
- ,{   -50,   -70,   -60,   -70,   -50}
- ,{   -80,  -110,   -80,  -120,   -80}
- ,{   -50,   -70,   -60,   -70,   -50}
- }
-,{{   -30,   -30,   -60,   -60,   -50}
- ,{   -30,   -30,   -80,   -80,   -80}
- ,{   -50,   -60,   -60,   -60,   -50}
- ,{   -50,   -50,   -80,   -80,   -80}
- ,{   -50,   -60,   -60,   -60,   -50}
- }};
-PUBLIC int mismatchMdH[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{  -270,  -570,  -340,  -560,  -270}
- ,{  -560,  -910,  -560,  -560,  -560}
- ,{  -270,  -570,  -340,  -570,  -270}
- ,{  -560,  -820,  -560,  -920,  -560}
- ,{  -530,  -570,  -530,  -570,  -860}
- }
-,{{    50,  -520,    50,  -560,  -400}
- ,{  -400,  -520,  -400,  -560,  -400}
- ,{    50,  -720,    50,  -720,  -420}
- ,{  -400,  -710,  -400,  -620,  -400}
- ,{   -30,  -720,   -30,  -720,  -500}
- }
-,{{   600,   -60,   600,  -230,   200}
- ,{   200,  -340,   200,  -350,   200}
- ,{   600,  -230,   600,  -230,   -30}
- ,{   200,   -60,   200,  -350,   200}
- ,{   460,  -230,   460,  -230,   160}
- }
-,{{   310,   310,  -140,  -150,   140}
- ,{  -480,  -480,  -630,  -890,  -630}
- ,{  -180,  -430,  -510,  -430,  -180}
- ,{   310,   310,  -630,  -150,  -630}
- ,{   140,  -430,  -140,  -430,   140}
- }
-,{{   600,  -230,   600,  -230,   200}
- ,{   200,  -390,   200,  -350,   200}
- ,{   600,  -230,   600,  -230,   -30}
- ,{   200,  -310,   200,  -350,   200}
- ,{   460,  -230,   460,  -230,  -170}
- }
-,{{   140,  -380,  -140,  -430,   140}
- ,{  -400,  -400,  -630,  -890,  -630}
- ,{  -180,  -430,  -510,  -430,  -180}
- ,{  -380,  -380,  -630,  -890,  -630}
- ,{   140,  -430,  -140,  -430,   140}
- }
-,{{   600,   310,   600,  -150,   200}
- ,{   200,  -340,   200,  -350,   200}
- ,{   600,  -230,   600,  -230,   -30}
- ,{   310,   310,   200,  -150,   200}
- ,{   460,  -230,   460,  -230,   160}
- }};
-
-PUBLIC int mismatch1nI37[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- }
-,{{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- }};
-PUBLIC int mismatch1nIdH[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- }
-,{{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- }
-,{{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- }
-,{{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- }
-,{{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- }
-,{{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- }
-,{{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- }};
-
-PUBLIC int mismatch23I37[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,   -50,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,  -110,     0,   -70,     0}
- ,{     0,     0,     0,     0,   -30}
- }
-,{{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,  -120,     0,   -70,     0}
- ,{     0,     0,     0,     0,   -30}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,   -40,    70,     0,    70}
- ,{    70,    70,    70,    70,    40}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    20,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,   -40,    70,     0,    70}
- ,{    70,    70,    70,    70,    40}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,   -40,    70,     0,    70}
- ,{    70,    70,    70,    70,    40}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    20,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,   -40,    70,     0,    70}
- ,{    70,    70,    70,    70,    40}
- }
-,{{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,    70,    70,    70,    70}
- ,{    70,   -40,    70,     0,    70}
- ,{    70,    70,    70,    70,    40}
- }};
-PUBLIC int mismatch23IdH[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,  -570,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,  -860,     0,  -900,     0}
- ,{     0,     0,     0,     0,  -640}
- }
-,{{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0,     0,     0,     0,     0}
- ,{     0, -1090,     0,  -900,     0}
- ,{     0,     0,     0,     0,  -640}
- }
-,{{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,  -580,   500,  -400,   500}
- ,{   500,   500,   500,   500,  -140}
- }
-,{{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   -60,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,  -360,   500,  -400,   500}
- ,{   500,   500,   500,   500,  -140}
- }
-,{{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,  -580,   500,  -400,   500}
- ,{   500,   500,   500,   500,  -140}
- }
-,{{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   -60,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,  -360,   500,  -400,   500}
- ,{   500,   500,   500,   500,  -140}
- }
-,{{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,   500,   500,   500,   500}
- ,{   500,  -360,   500,  -400,   500}
- ,{   500,   500,   500,   500,  -140}
- }};
-
-PUBLIC int mismatchExt37[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{   -80,  -100,  -110,  -100,   -80}
- ,{  -140,  -150,  -150,  -140,  -150}
- ,{   -80,  -100,  -110,  -100,   -80}
- ,{  -140,  -140,  -150,  -160,  -150}
- ,{  -100,  -100,  -140,  -100,  -120}
- }
-,{{   -50,  -110,   -70,  -110,   -50}
- ,{  -110,  -110,  -150,  -130,  -150}
- ,{   -50,  -110,   -70,  -110,   -50}
- ,{  -140,  -160,  -150,  -140,  -150}
- ,{   -70,  -110,  -100,  -110,   -70}
- }
-,{{   -30,   -30,   -70,   -60,   -60}
- ,{   -30,   -30,  -100,   -80,  -100}
- ,{   -60,   -60,   -70,   -60,   -70}
- ,{   -60,   -60,  -100,   -80,  -100}
- ,{   -60,   -60,   -80,   -60,   -60}
- }
-,{{   -50,   -50,   -60,   -70,   -50}
- ,{   -80,  -100,   -80,  -110,   -80}
- ,{   -50,   -70,   -60,   -70,   -50}
- ,{   -50,   -50,   -80,   -80,   -80}
- ,{   -50,   -70,   -60,   -70,   -50}
- }
-,{{   -60,   -60,   -70,   -60,   -70}
- ,{   -80,   -80,  -100,   -80,  -100}
- ,{   -60,   -60,   -70,   -60,   -70}
- ,{   -80,   -80,  -100,   -80,  -100}
- ,{   -60,   -60,   -80,   -60,   -80}
- }
-,{{   -50,   -70,   -60,   -70,   -50}
- ,{   -80,  -100,   -80,  -110,   -80}
- ,{   -50,   -70,   -60,   -70,   -50}
- ,{   -80,  -110,   -80,  -120,   -80}
- ,{   -50,   -70,   -60,   -70,   -50}
- }
-,{{   -30,   -30,   -60,   -60,   -50}
- ,{   -30,   -30,   -80,   -80,   -80}
- ,{   -50,   -60,   -60,   -60,   -50}
- ,{   -50,   -50,   -80,   -80,   -80}
- ,{   -50,   -60,   -60,   -60,   -50}
- }};
-PUBLIC int mismatchExtdH[NBPAIRS+1][5][5] =
-{{{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- ,{   INF,   INF,   INF,   INF,   INF}
- }
-,{{  -270,  -570,  -340,  -560,  -270}
- ,{  -560,  -910,  -560,  -560,  -560}
- ,{  -270,  -570,  -340,  -570,  -270}
- ,{  -560,  -820,  -560,  -920,  -560}
- ,{  -530,  -570,  -530,  -570,  -860}
- }
-,{{    50,  -520,    50,  -560,  -400}
- ,{  -400,  -520,  -400,  -560,  -400}
- ,{    50,  -720,    50,  -720,  -420}
- ,{  -400,  -710,  -400,  -620,  -400}
- ,{   -30,  -720,   -30,  -720,  -500}
- }
-,{{   600,   -60,   600,  -230,   200}
- ,{   200,  -340,   200,  -350,   200}
- ,{   600,  -230,   600,  -230,   -30}
- ,{   200,   -60,   200,  -350,   200}
- ,{   460,  -230,   460,  -230,   160}
- }
-,{{   310,   310,  -140,  -150,   140}
- ,{  -480,  -480,  -630,  -890,  -630}
- ,{  -180,  -430,  -510,  -430,  -180}
- ,{   310,   310,  -630,  -150,  -630}
- ,{   140,  -430,  -140,  -430,   140}
- }
-,{{   600,  -230,   600,  -230,   200}
- ,{   200,  -390,   200,  -350,   200}
- ,{   600,  -230,   600,  -230,   -30}
- ,{   200,  -310,   200,  -350,   200}
- ,{   460,  -230,   460,  -230,  -170}
- }
-,{{   140,  -380,  -140,  -430,   140}
- ,{  -400,  -400,  -630,  -890,  -630}
- ,{  -180,  -430,  -510,  -430,  -180}
- ,{  -380,  -380,  -630,  -890,  -630}
- ,{   140,  -430,  -140,  -430,   140}
- }
-,{{   600,   310,   600,  -150,   200}
- ,{   200,  -340,   200,  -350,   200}
- ,{   600,  -230,   600,  -230,   -30}
- ,{   310,   310,   200,  -150,   200}
- ,{   460,  -230,   460,  -230,   160}
- }};
-
-
-PUBLIC int dangle3_37[NBPAIRS+1][5] =
-{{   INF,   INF,   INF,   INF,   INF}
-,{   -80,  -170,   -80,  -170,  -120}
-,{   -40,  -110,   -40,  -130,   -60}
-,{   -50,   -80,   -50,   -80,   -60}
-,{   -10,   -70,   -10,   -70,   -10}
-,{   -50,   -80,   -50,   -80,   -60}
-,{   -10,   -70,   -10,   -70,   -10}
-,{   -10,   -70,   -10,   -70,   -10}};
-PUBLIC int dangle3_dH[NBPAIRS+1][5] =
-{{   INF,   INF,   INF,   INF,   INF}
-,{  -410,  -900,  -410,  -860,  -750}
-,{  -280,  -740,  -280,  -640,  -360}
-,{   -90,  -490,   -90,  -550,  -230}
-,{   -70,  -570,   -70,  -580,  -220}
-,{   -90,  -490,   -90,  -550,  -230}
-,{   -70,  -570,   -70,  -580,  -220}
-,{   -70,  -490,   -70,  -550,  -220}};
-PUBLIC int dangle5_37[NBPAIRS+1][5] =
-{{   INF,   INF,   INF,   INF,   INF}
-,{     0,   -20,   -30,     0,     0}
-,{   -10,   -50,   -30,   -20,   -10}
-,{   -10,   -30,   -10,   -20,   -20}
-,{   -20,   -30,   -30,   -40,   -20}
-,{   -10,   -30,   -10,   -20,   -20}
-,{   -20,   -30,   -30,   -40,   -20}
-,{     0,   -20,   -10,     0,     0}};
-PUBLIC int dangle5_dH[NBPAIRS+1][5] =
-{{   INF,   INF,   INF,   INF,   INF}
-,{    70,  -160,    70,  -460,   -40}
-,{   330,  -240,   330,    80,  -140}
-,{   690,   -50,   690,    60,    60}
-,{   310,   160,   220,    70,   310}
-,{   690,   -50,   690,    60,    60}
-,{   310,   160,   220,    70,   310}
-,{   690,   160,   690,    80,   310}};
-
-PUBLIC char Triloops[241] =
-  "CAACG "
-  "GUUAC "
-;
-PUBLIC int Triloop37[40] = {   680,   690};
-PUBLIC int TriloopdH[40] = {  2370,  1080};
-
-PUBLIC char Tetraloops[281] =
-  "CAACGG "
-  "CCAAGG "
-  "CCACGG "
-  "CCCAGG "
-  "CCGAGG "
-  "CCGCGG "
-  "CCUAGG "
-  "CCUCGG "
-  "CUAAGG "
-  "CUACGG "
-  "CUCAGG "
-  "CUCCGG "
-  "CUGCGG "
-  "CUUAGG "
-  "CUUCGG "
-  "CUUUGG "
-;
-PUBLIC int Tetraloop37[40] = {   550,   330,   370,   340,   350,   360,   370,   250,   360,   280,   370,   270,   280,   350,   370,   370};
-PUBLIC int TetraloopdH[40] = {   690, -1030,  -330,  -890,  -660,  -750,  -350, -1390,  -760, -1070,  -660, -1290, -1070,  -620, -1530,  -680};
-
-PUBLIC char Hexaloops[361] =
-  "ACAGUACU "
-  "ACAGUGAU "
-  "ACAGUGCU "
-  "ACAGUGUU "
-;
-PUBLIC int Hexaloop37[40] = {   280,   360,   290,   180};
-PUBLIC int HexaloopdH[40] = { -1680, -1140, -1280, -1540};
-
-#include "intl11.h"
-#include "intl11dH.h"
-#include "intl21.h"
-#include "intl21dH.h"
-#include "intl22.h"
-#include "intl22dH.h"
-
diff --git a/cbits/ffiwrap_part_func.c b/cbits/ffiwrap_part_func.c
deleted file mode 100644
--- a/cbits/ffiwrap_part_func.c
+++ /dev/null
@@ -1,32 +0,0 @@
-
-// functions wrapped in here need a C-wrapper because they do "more work"
-// before they can be called from C.
-
-#include <stdio.h>
-
-#include "part_func.h"
-#include "part_func_co.h"
-
-// wrap the RNAfold constrained partition function
-
-float ffiwrap_pf_fold_constrained (const char *sequence, char *structure, int constrained)
-{
-  return pf_fold_par (sequence, structure, 0, 1, constrained, 0);
-}
-
-// wrap the RNAcofold constrained partition function.
-
-void ffiwrap_co_pf_fold_constrained (cofoldF * x, char *sequence, char *structure, int constrained)
-{
-  *x = co_pf_fold_par (sequence, structure, 0, 1, constrained);
-  return;
-}
-
-// wrap RNAcofold partition function
-
-void ffiwrap_co_pf_fold (cofoldF * x, char * inp, char * str)
-{
-  *x = co_pf_fold (inp, str);
-  return;
-}
-
diff --git a/cbits/fold.c b/cbits/fold.c
deleted file mode 100644
--- a/cbits/fold.c
+++ /dev/null
@@ -1,2765 +0,0 @@
-/** \file **/
-
-/*
-                  minimum free energy
-                  RNA secondary structure prediction
-
-                  c Ivo Hofacker, Chrisoph Flamm
-                  original implementation by
-                  Walter Fontana
-                  g-quadruplex support and threadsafety
-                  by Ronny Lorenz
-
-                  Vienna RNA package
-*/
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <ctype.h>
-#include <string.h>
-#include <limits.h>
-
-#include "utils.h"
-#include "energy_par.h"
-#include "fold_vars.h"
-#include "pair_mat.h"
-#include "params.h"
-#include "loop_energies.h"
-#include "data_structures.h"
-#include "gquad.h"
-#include "fold.h"
-
-#ifdef _OPENMP
-#include <omp.h>
-#endif
-
-
-#define PAREN
-#define STACK_BULGE1      1       /* stacking energies for bulges of size 1 */
-#define NEW_NINIO         1       /* new asymetry penalty */
-#define MAXSECTORS        500     /* dimension for a backtrack array */
-#define LOCALITY          0.      /* locality parameter for base-pairs */
-
-#define SAME_STRAND(I,J)  (((I)>=cut_point)||((J)<cut_point))
-
-/*
-#################################
-# GLOBAL VARIABLES              #
-#################################
-*/
-PUBLIC  int logML     = 0;  /* if nonzero use logarithmic ML energy in energy_of_struct */
-PUBLIC  int uniq_ML   = 0;  /* do ML decomposition uniquely (for subopt) */
-PUBLIC  int cut_point = -1; /* set to first pos of second seq for cofolding */
-PUBLIC  int eos_debug = 0;  /* verbose info from energy_of_struct */
-
-/*
-#################################
-# PRIVATE VARIABLES             #
-#################################
-*/
-PRIVATE int     *indx     = NULL; /* index for moving in the triangle matrices c[] and fMl[]*/
-PRIVATE int     *c        = NULL; /* energy array, given that i-j pair */
-PRIVATE int     *cc       = NULL; /* linear array for calculating canonical structures */
-PRIVATE int     *cc1      = NULL; /*   "     "        */
-PRIVATE int     *f5       = NULL; /* energy of 5' end */
-PRIVATE int     *f53      = NULL; /* energy of 5' end with 3' nucleotide not available for mismatches */
-PRIVATE int     *fML      = NULL; /* multi-loop auxiliary energy array */
-PRIVATE int     *fM1      = NULL; /* second ML array, only for subopt */
-PRIVATE int     *fM2      = NULL; /* fM2 = multiloop region with exactly two stems, extending to 3' end        */
-PRIVATE int     *Fmi      = NULL; /* holds row i of fML (avoids jumps in memory) */
-PRIVATE int     *DMLi     = NULL; /* DMLi[j] holds MIN(fML[i,k]+fML[k+1,j])  */
-PRIVATE int     *DMLi1    = NULL; /*             MIN(fML[i+1,k]+fML[k+1,j])  */
-PRIVATE int     *DMLi2    = NULL; /*             MIN(fML[i+2,k]+fML[k+1,j])  */
-PRIVATE int     *DMLi_a   = NULL; /* DMLi_a[j] holds min energy for at least two multiloop stems in [i,j], where j is available for dangling onto a surrounding stem */
-PRIVATE int     *DMLi_o   = NULL; /* DMLi_o[j] holds min energy for at least two multiloop stems in [i,j], where j is unavailable for dangling onto a surrounding stem */
-PRIVATE int     *DMLi1_a  = NULL;
-PRIVATE int     *DMLi1_o  = NULL;
-PRIVATE int     *DMLi2_a  = NULL;
-PRIVATE int     *DMLi2_o  = NULL;
-PRIVATE int     Fc, FcH, FcI, FcM;  /* parts of the exterior loop energies */
-PRIVATE sect    sector[MAXSECTORS]; /* stack of partial structures for backtracking */
-PRIVATE char    *ptype = NULL;      /* precomputed array of pair types */
-PRIVATE short   *S = NULL, *S1 = NULL;
-PRIVATE paramT  *P          = NULL;
-PRIVATE int     init_length = -1;
-PRIVATE int     *BP = NULL; /* contains the structure constrainsts: BP[i]
-                        -1: | = base must be paired
-                        -2: < = base must be paired with j<i
-                        -3: > = base must be paired with j>i
-                        -4: x = base must not pair
-                        positive int: base is paired with int      */
-PRIVATE short   *pair_table         = NULL; /* needed by energy of struct */
-PRIVATE bondT   *base_pair2         = NULL; /* this replaces base_pair from fold_vars.c */
-PRIVATE int     circular            = 0;
-PRIVATE int     struct_constrained  = 0;
-PRIVATE int     with_gquad          = 0;
-
-PRIVATE int     *ggg = NULL;    /* minimum free energies of the gquadruplexes */
-
-#ifdef _OPENMP
-
-#pragma omp threadprivate(indx, c, cc, cc1, f5, f53, fML, fM1, fM2, Fmi,\
-                          DMLi, DMLi1, DMLi2, DMLi_a, DMLi_o, DMLi1_a, DMLi1_o, DMLi2_a, DMLi2_o,\
-                          Fc, FcH, FcI, FcM,\
-                          sector, ptype, S, S1, P, init_length, BP, pair_table, base_pair2, circular, struct_constrained,\
-                          ggg, with_gquad)
-
-#endif
-
-/*
-#################################
-# PRIVATE FUNCTION DECLARATIONS #
-#################################
-*/
-PRIVATE void  get_arrays(unsigned int size);
-PRIVATE int   stack_energy(int i, const char *string, int verbostiy_level);
-PRIVATE int   energy_of_extLoop_pt(int i, short *pair_table);
-PRIVATE int   energy_of_ml_pt(int i, short *pt);
-PRIVATE int   ML_Energy(int i, int is_extloop);
-PRIVATE void  make_ptypes(const short *S, const char *structure);
-PRIVATE void  backtrack(const char *sequence, int s);
-PRIVATE int   fill_arrays(const char *sequence);
-PRIVATE void  fill_arrays_circ(const char *string, int *bt);
-PRIVATE void  init_fold(int length, paramT *parameters);
-/* needed by cofold/eval */
-PRIVATE int   cut_in_loop(int i);
-
-/* deprecated functions */
-/*@unused@*/
-int oldLoopEnergy(int i, int j, int p, int q, int type, int type_2);
-int LoopEnergy(int n1, int n2, int type, int type_2, int si1, int sj1, int sp1, int sq1);
-int HairpinE(int size, int type, int si1, int sj1, const char *string);
-
-
-/*
-#################################
-# BEGIN OF FUNCTION DEFINITIONS #
-#################################
-*/
-
-/* allocate memory for folding process */
-PRIVATE void init_fold(int length, paramT *parameters){
-
-#ifdef _OPENMP
-/* Explicitly turn off dynamic threads */
-  omp_set_dynamic(0);
-#endif
-
-  if (length<1) nrerror("initialize_fold: argument must be greater 0");
-  free_arrays();
-  get_arrays((unsigned) length);
-  init_length=length;
-
-  indx = get_indx((unsigned)length);
-
-  update_fold_params_par(parameters);
-}
-
-/*--------------------------------------------------------------------------*/
-
-PRIVATE void get_arrays(unsigned int size){
-  if(size >= (unsigned int)sqrt((double)INT_MAX))
-    nrerror("get_arrays@fold.c: sequence length exceeds addressable range");
-
-  c     = (int *) space(sizeof(int)*((size*(size+1))/2+2));
-  fML   = (int *) space(sizeof(int)*((size*(size+1))/2+2));
-  if (uniq_ML)
-    fM1 = (int *) space(sizeof(int)*((size*(size+1))/2+2));
-
-  ptype = (char *)space(sizeof(char)*((size*(size+1))/2+2));
-  f5    = (int *) space(sizeof(int)*(size+2));
-  f53   = (int *) space(sizeof(int)*(size+2));
-  cc    = (int *) space(sizeof(int)*(size+2));
-  cc1   = (int *) space(sizeof(int)*(size+2));
-  Fmi   = (int *) space(sizeof(int)*(size+1));
-  DMLi  = (int *) space(sizeof(int)*(size+1));
-  DMLi1 = (int *) space(sizeof(int)*(size+1));
-  DMLi2 = (int *) space(sizeof(int)*(size+1));
-
-  DMLi_a  = (int *) space(sizeof(int)*(size+1));
-  DMLi_o  = (int *) space(sizeof(int)*(size+1));
-  DMLi1_a = (int *) space(sizeof(int)*(size+1));
-  DMLi1_o = (int *) space(sizeof(int)*(size+1));
-  DMLi2_a = (int *) space(sizeof(int)*(size+1));
-  DMLi2_o = (int *) space(sizeof(int)*(size+1));
-
-  base_pair2 = (bondT *) space(sizeof(bondT)*(1+size/2));
-
-  /* extra array(s) for circfold() */
-  if(circular) fM2 =  (int *) space(sizeof(int)*(size+2));
-}
-
-/*--------------------------------------------------------------------------*/
-
-PUBLIC void free_arrays(void){
-  if(indx)      free(indx);
-  if(c)         free(c);
-  if(fML)       free(fML);
-  if(f5)        free(f5);
-  if(f53)       free(f53);
-  if(cc)        free(cc);
-  if(cc1)       free(cc1);
-  if(ptype)     free(ptype);
-  if(fM1)       free(fM1);
-  if(fM2)       free(fM2);
-  if(base_pair2) free(base_pair2);
-  if(Fmi)       free(Fmi);
-  if(DMLi)      free(DMLi);
-  if(DMLi1)     free(DMLi1);
-  if(DMLi2)     free(DMLi2);
-  if(DMLi_a)    free(DMLi_a);
-  if(DMLi_o)    free(DMLi_o);
-  if(DMLi1_a)   free(DMLi1_a);
-  if(DMLi1_o)   free(DMLi1_o);
-  if(DMLi2_a)   free(DMLi2_a);
-  if(DMLi2_o)   free(DMLi2_o);
-  if(P)         free(P);
-  if(ggg)       free(ggg);
-
-  indx = c = fML = f5 = f53 = cc = cc1 = fM1 = fM2 = Fmi = DMLi = DMLi1 = DMLi2 = ggg = NULL;
-  DMLi_a = DMLi_o = DMLi1_a = DMLi1_o = DMLi2_a = DMLi2_o = NULL;
-  ptype       = NULL;
-  base_pair   = NULL;
-  base_pair2  = NULL;
-  P           = NULL;
-  init_length = 0;
-}
-
-/*--------------------------------------------------------------------------*/
-
-PUBLIC void export_fold_arrays( int **f5_p,
-                                int **c_p,
-                                int **fML_p,
-                                int **fM1_p,
-                                int **indx_p,
-                                char **ptype_p){
-  /* make the DP arrays available to routines such as subopt() */
-  *f5_p     = f5;
-  *c_p      = c;
-  *fML_p    = fML;
-  *fM1_p    = fM1;
-  *indx_p   = indx;
-  *ptype_p  = ptype;
-}
-
-PUBLIC void export_fold_arrays_par( int **f5_p,
-                                    int **c_p,
-                                    int **fML_p,
-                                    int **fM1_p,
-                                    int **indx_p,
-                                    char **ptype_p,
-                                    paramT **P_p){
-  export_fold_arrays(f5_p, c_p, fML_p, fM1_p, indx_p,ptype_p);
-  *P_p = P;
-}
-
-PUBLIC void export_circfold_arrays( int *Fc_p,
-                                    int *FcH_p,
-                                    int *FcI_p,
-                                    int *FcM_p,
-                                    int **fM2_p,
-                                    int **f5_p,
-                                    int **c_p,
-                                    int **fML_p,
-                                    int **fM1_p,
-                                    int **indx_p,
-                                    char **ptype_p){
-  /* make the DP arrays available to routines such as subopt() */
-  *f5_p     = f5;
-  *c_p      = c;
-  *fML_p    = fML;
-  *fM1_p    = fM1;
-  *fM2_p    = fM2;
-  *Fc_p     = Fc;
-  *FcH_p    = FcH;
-  *FcI_p    = FcI;
-  *FcM_p    = FcM;
-  *indx_p   = indx;
-  *ptype_p  = ptype;
-}
-
-PUBLIC void export_circfold_arrays_par( int *Fc_p,
-                                    int *FcH_p,
-                                    int *FcI_p,
-                                    int *FcM_p,
-                                    int **fM2_p,
-                                    int **f5_p,
-                                    int **c_p,
-                                    int **fML_p,
-                                    int **fM1_p,
-                                    int **indx_p,
-                                    char **ptype_p,
-                                    paramT **P_p){
-  export_circfold_arrays(Fc_p, FcH_p, FcI_p, FcM_p, fM2_p, f5_p, c_p, fML_p, fM1_p, indx_p, ptype_p);
-  *P_p = P;
-}
-/*--------------------------------------------------------------------------*/
-
-
-PUBLIC float fold(const char *string, char *structure){
-  return fold_par(string, structure, NULL, fold_constrained, 0);
-}
-
-PUBLIC float circfold(const char *string, char *structure){
-  return fold_par(string, structure, NULL, fold_constrained, 1);
-}
-
-PUBLIC float fold_par(const char *string,
-                      char *structure,
-                      paramT *parameters,
-                      int is_constrained,
-                      int is_circular){
-
-  int i, length, energy, bonus, bonus_cnt, s;
-
-  bonus               = 0;
-  bonus_cnt           = 0;
-  s                   = 0;
-  circular            = is_circular;
-  struct_constrained  = is_constrained;
-  length              = (int) strlen(string);
-
-#ifdef _OPENMP
-  init_fold(length, parameters);
-#else
-  if (parameters) init_fold(length, parameters);
-  else if (length>init_length) init_fold(length, parameters);
-  else if (fabs(P->temperature - temperature)>1e-6) update_fold_params();
-#endif
-
-  with_gquad  = P->model_details.gquad;
-  S           = encode_sequence(string, 0);
-  S1          = encode_sequence(string, 1);
-  BP          = (int *)space(sizeof(int)*(length+2));
-  if(with_gquad){ /* add a guess of how many G's may be involved in a G quadruplex */
-    if(base_pair2)
-      free(base_pair2);
-    base_pair2 = (bondT *) space(sizeof(bondT)*(4*(1+length/2)));
-  }
-
-  make_ptypes(S, structure);
-
-  energy = fill_arrays(string);
-
-  if(circular){
-    fill_arrays_circ(string, &s);
-    energy = Fc;
-  }
-  backtrack(string, s);
-
-#ifdef PAREN
-  parenthesis_structure(structure, base_pair2, length);
-#else
-  letter_structure(structure, base_pair2, length);
-#endif
-
-  /*
-  *  Backward compatibility:
-  *  This block may be removed if deprecated functions
-  *  relying on the global variable "base_pair" vanishs from within the package!
-  */
-  base_pair = base_pair2;
-  /*
-  {
-    if(base_pair) free(base_pair);
-    base_pair = (bondT *)space(sizeof(bondT) * (1+length/2));
-    memcpy(base_pair, base_pair2, sizeof(bondT) * (1+length/2));
-  }
-  */
-
-  /* check constraints */
-  for(i=1;i<=length;i++) {
-    if((BP[i]<0)&&(BP[i]>-4)) {
-      bonus_cnt++;
-      if((BP[i]==-3)&&(structure[i-1]==')')) bonus++;
-      if((BP[i]==-2)&&(structure[i-1]=='(')) bonus++;
-      if((BP[i]==-1)&&(structure[i-1]!='.')) bonus++;
-    }
-
-    if(BP[i]>i) {
-      int l;
-      bonus_cnt++;
-      for(l=1; l<=base_pair2[0].i; l++)
-        if(base_pair2[l].i != base_pair2[l].j)
-          if((i==base_pair2[l].i)&&(BP[i]==base_pair2[l].j)) bonus++;
-    }
-  }
-
-  if (bonus_cnt>bonus) fprintf(stderr,"\ncould not enforce all constraints\n");
-  bonus*=BONUS;
-
-  free(S); free(S1); free(BP);
-
-  energy += bonus;      /*remove bonus energies from result */
-
-  if (backtrack_type=='C')
-    return (float) c[indx[length]+1]/100.;
-  else if (backtrack_type=='M')
-    return (float) fML[indx[length]+1]/100.;
-  else
-    return (float) energy/100.;
-}
-
-/**
-*** fill "c", "fML" and "f5" arrays and return  optimal energy
-**/
-PRIVATE int fill_arrays(const char *string) {
-
-  int   i, j, k, length, energy, en, mm5, mm3;
-  int   decomp, new_fML, max_separation;
-  int   no_close, type, type_2, tt;
-  int   bonus=0;
-  
-  int   dangle_model, noGUclosure, with_gquads;
-
-  dangle_model  = P->model_details.dangles;
-  noGUclosure   = P->model_details.noGUclosure;
-
-  length = (int) strlen(string);
-
-  max_separation = (int) ((1.-LOCALITY)*(double)(length-2)); /* not in use */
-
-  if(with_gquad)
-    ggg = get_gquad_matrix(S, P);
-
-
-  for (j=1; j<=length; j++) {
-    Fmi[j]=DMLi[j]=DMLi1[j]=DMLi2[j]=INF;
-  }
-
-  for (j = 1; j<=length; j++)
-    for (i=(j>TURN?(j-TURN):1); i<j; i++) {
-      c[indx[j]+i] = fML[indx[j]+i] = INF;
-      if (uniq_ML) fM1[indx[j]+i] = INF;
-    }
-
-  if (length <= TURN) return 0;
-
-  for (i = length-TURN-1; i >= 1; i--) { /* i,j in [1..length] */
-
-    for (j = i+TURN+1; j <= length; j++) {
-      int p, q, ij, jj, ee;
-      int minq, maxq, l1, up, c0, c1, c2, c3;
-      int MLenergy;
-      ij = indx[j]+i;
-      bonus = 0;
-      type = ptype[ij];
-      energy = INF;
-      /* enforcing structure constraints */
-      if ((BP[i]==j)||(BP[i]==-1)||(BP[i]==-2)) bonus -= BONUS;
-      if ((BP[j]==-1)||(BP[j]==-3)) bonus -= BONUS;
-      if ((BP[i]==-4)||(BP[j]==-4)) type=0;
-
-      no_close = (((type==3)||(type==4))&&noGUclosure&&(bonus==0));
-
-      if (j-i-1 > max_separation) type = 0;  /* forces locality degree */
-
-      if (type) {   /* we have a pair */
-        int new_c=0, stackEnergy=INF;
-        /* hairpin ----------------------------------------------*/
-
-        new_c = (no_close) ? FORBIDDEN : E_Hairpin(j-i-1, type, S1[i+1], S1[j-1], string+i-1, P);
-
-        /*--------------------------------------------------------
-          check for elementary structures involving more than one
-          closing pair.
-          --------------------------------------------------------*/
-
-        for (p = i+1; p <= MIN2(j-2-TURN,i+MAXLOOP+1) ; p++) {
-          minq = j-i+p-MAXLOOP-2;
-          if (minq<p+1+TURN) minq = p+1+TURN;
-          for (q = minq; q < j; q++) {
-            type_2 = ptype[indx[q]+p];
-
-            if (type_2==0) continue;
-            type_2 = rtype[type_2];
-
-            if (noGUclosure)
-              if (no_close||(type_2==3)||(type_2==4))
-                if ((p>i+1)||(q<j-1)) continue;  /* continue unless stack */
-
-            energy = E_IntLoop(p-i-1, j-q-1, type, type_2,
-                                S1[i+1], S1[j-1], S1[p-1], S1[q+1], P);
-
-            ee = energy+c[indx[q]+p];
-            new_c = MIN2(new_c, ee);
-            if ((p==i+1)&&(j==q+1)) stackEnergy = energy; /* remember stack energy */
-
-          } /* end q-loop */
-        } /* end p-loop */
-        /* multi-loop decomposition ------------------------*/
-
-
-        if (!no_close) {
-          decomp = DMLi1[j-1];
-          tt = rtype[type];
-          switch(dangle_model){
-            /* no dangles */
-            case 0:   decomp += E_MLstem(tt, -1, -1, P);
-                      break;
-
-            /* double dangles */
-            case 2:   decomp += E_MLstem(tt, S1[j-1], S1[i+1], P);
-                      break;
-
-            /* normal dangles, aka dangles = 1 || 3 */
-            default:  decomp += E_MLstem(tt, -1, -1, P);
-                      decomp = MIN2(decomp, DMLi2[j-1] + E_MLstem(tt, -1, S1[i+1], P) + P->MLbase);
-                      decomp = MIN2(decomp, DMLi2[j-2] + E_MLstem(tt, S1[j-1], S1[i+1], P) + 2*P->MLbase);
-                      decomp = MIN2(decomp, DMLi1[j-2] + E_MLstem(tt, S1[j-1], -1, P) + P->MLbase);
-                      break;
-          }
-          MLenergy = decomp + P->MLclosing;
-          new_c = MIN2(new_c, MLenergy);
-        }
-
-        /* coaxial stacking of (i.j) with (i+1.k) or (k+1.j-1) */
-
-        if (dangle_model==3) {
-          decomp = INF;
-          for (k = i+2+TURN; k < j-2-TURN; k++) {
-            type_2 = rtype[ptype[indx[k]+i+1]];
-            if (type_2)
-              decomp = MIN2(decomp, c[indx[k]+i+1]+P->stack[type][type_2]+fML[indx[j-1]+k+1]);
-            type_2 = rtype[ptype[indx[j-1]+k+1]];
-            if (type_2)
-              decomp = MIN2(decomp, c[indx[j-1]+k+1]+P->stack[type][type_2]+fML[indx[k]+i+1]);
-          }
-          /* no TermAU penalty if coax stack */
-          decomp += 2*P->MLintern[1] + P->MLclosing;
-          new_c = MIN2(new_c, decomp);
-        }
-
-        if(with_gquad){
-          /* include all cases where a g-quadruplex may be enclosed by base pair (i,j) */
-          if (!no_close) {
-            tt = rtype[type];
-            energy = E_GQuad_IntLoop(i, j, type, S1, ggg, indx, P);
-            new_c = MIN2(new_c, energy);
-          }
-        }
-
-        new_c = MIN2(new_c, cc1[j-1]+stackEnergy);
-        cc[j] = new_c + bonus;
-        if (noLonelyPairs)
-          c[ij] = cc1[j-1]+stackEnergy+bonus;
-        else
-          c[ij] = cc[j];
-
-      } /* end >> if (pair) << */
-
-      else c[ij] = INF;
-
-      /* done with c[i,j], now compute fML[i,j] and fM1[i,j] */
-
-      /* (i,j) + MLstem ? */
-      new_fML = INF;
-      if(type){
-        new_fML = c[ij];
-        switch(dangle_model){
-          case 2:   new_fML += E_MLstem(type, (i==1) ? S1[length] : S1[i-1], S1[j+1], P);
-                    break;
-          default:  new_fML += E_MLstem(type, -1, -1, P);
-                    break;
-        }
-      }
-
-      if(with_gquad){
-        new_fML = MIN2(new_fML, ggg[indx[j] + i] + E_MLstem(0, -1, -1, P));
-      }
-
-      if (uniq_ML){
-        fM1[ij] = MIN2(fM1[indx[j-1]+i] + P->MLbase, new_fML);
-      }
-
-      /* free ends ? -----------------------------------------*/
-      /*  we must not just extend 3'/5' end by unpaired nucleotides if
-      *   dangle_model == 1, this could lead to d5+d3 contributions were
-      *   mismatch must be taken!
-      */
-      switch(dangle_model){
-        /* no dangles */
-        case 0:   new_fML = MIN2(new_fML, fML[ij+1]+P->MLbase);
-                  new_fML = MIN2(fML[indx[j-1]+i]+P->MLbase, new_fML);
-                  break;
-
-        /* double dangles */
-        case 2:   new_fML = MIN2(new_fML, fML[ij+1]+P->MLbase);
-                  new_fML = MIN2(fML[indx[j-1]+i]+P->MLbase, new_fML);
-                  break;
-
-        /* normal dangles, aka dangle_model = 1 || 3 */
-        default:  mm5 = ((i>1) || circular) ? S1[i] : -1;
-                  mm3 = ((j<length) || circular) ? S1[j] : -1;
-                  new_fML = MIN2(new_fML, fML[ij+1] + P->MLbase);
-                  new_fML = MIN2(new_fML, fML[indx[j-1]+i] + P->MLbase);
-                  tt = ptype[ij+1];
-                  if(tt) new_fML = MIN2(new_fML, c[ij+1] + E_MLstem(tt, mm5, -1, P) + P->MLbase);
-                  tt = ptype[indx[j-1]+i];
-                  if(tt) new_fML = MIN2(new_fML, c[indx[j-1]+i] + E_MLstem(tt, -1, mm3, P) + P->MLbase);
-                  tt = ptype[indx[j-1]+i+1];
-                  if(tt) new_fML = MIN2(new_fML, c[indx[j-1]+i+1] + E_MLstem(tt, mm5, mm3, P) + 2*P->MLbase);
-                  break;
-      }
-
-      /* modular decomposition -------------------------------*/
-      for (decomp = INF, k = i + 1 + TURN; k <= j - 2 - TURN; k++)
-        decomp = MIN2(decomp, Fmi[k]+fML[indx[j]+k+1]);
-      DMLi[j] = decomp;               /* store for use in ML decompositon */
-      new_fML = MIN2(new_fML,decomp);
-
-      /* coaxial stacking */
-      if (dangle_model==3) {
-        /* additional ML decomposition as two coaxially stacked helices */
-        for (decomp = INF, k = i+1+TURN; k <= j-2-TURN; k++) {
-          type = ptype[indx[k]+i]; type = rtype[type];
-          type_2 = ptype[indx[j]+k+1]; type_2 = rtype[type_2];
-          if (type && type_2)
-            decomp = MIN2(decomp,
-                          c[indx[k]+i]+c[indx[j]+k+1]+P->stack[type][type_2]);
-        }
-
-        decomp += 2*P->MLintern[1];        /* no TermAU penalty if coax stack */
-#if 0
-        /* This is needed for Y shaped ML loops with coax stacking of
-           interior pairts, but backtracking will fail if activated */
-        DMLi[j] = MIN2(DMLi[j], decomp);
-        DMLi[j] = MIN2(DMLi[j], DMLi[j-1]+P->MLbase);
-        DMLi[j] = MIN2(DMLi[j], DMLi1[j]+P->MLbase);
-        new_fML = MIN2(new_fML, DMLi[j]);
-#endif
-        new_fML = MIN2(new_fML, decomp);
-      }
-      fML[ij] = Fmi[j] = new_fML;     /* substring energy */
-
-    }
-
-    {
-      int *FF; /* rotate the auxilliary arrays */
-      FF = DMLi2; DMLi2 = DMLi1; DMLi1 = DMLi; DMLi = FF;
-      FF = cc1; cc1=cc; cc=FF;
-      for (j=1; j<=length; j++) {cc[j]=Fmi[j]=DMLi[j]=INF; }
-    }
-  }
-
-  /* calculate energies of 5' and 3' fragments */
-
-  f5[TURN+1]= 0;
-  /* duplicated code may be faster than conditions inside loop ;) */
-  switch(dangle_model){
-    /* dont use dangling end and mismatch contributions at all */
-    case 0:   for(j=TURN+2; j<=length; j++){
-                f5[j] = f5[j-1];
-                for (i=j-TURN-1; i>1; i--){
-
-                  if(with_gquad){
-                    f5[j] = MIN2(f5[j], f5[i-1] + ggg[indx[j]+i]);
-                  }
-
-                  type = ptype[indx[j]+i];
-                  if(!type) continue;
-                  en = c[indx[j]+i];
-                  f5[j] = MIN2(f5[j], f5[i-1] + en + E_ExtLoop(type, -1, -1, P));
-                }
-
-                if(with_gquad){
-                  f5[j] = MIN2(f5[j], ggg[indx[j]+1]);
-                }
-
-                type=ptype[indx[j]+1];
-                if(!type) continue;
-                en = c[indx[j]+1];
-                f5[j] = MIN2(f5[j], en + E_ExtLoop(type, -1, -1, P));
-              }
-              break;
-
-    /* always use dangles on both sides */
-    case 2:   for(j=TURN+2; j<length; j++){
-                f5[j] = f5[j-1];
-                for (i=j-TURN-1; i>1; i--){
-
-                  if(with_gquad){
-                    f5[j] = MIN2(f5[j], f5[i-1] + ggg[indx[j]+i]);
-                  }
-
-                  type = ptype[indx[j]+i];
-                  if(!type) continue;
-                  en = c[indx[j]+i];
-                  f5[j] = MIN2(f5[j], f5[i-1] + en + E_ExtLoop(type, S1[i-1], S1[j+1], P));
-                }
-
-                if(with_gquad){
-                  f5[j] = MIN2(f5[j], ggg[indx[j]+1]);
-                }
-
-                type=ptype[indx[j]+1];
-                if(!type) continue;
-                en = c[indx[j]+1];
-                f5[j] = MIN2(f5[j], en + E_ExtLoop(type, -1, S1[j+1], P));
-              }
-              f5[length] = f5[length-1];
-              for (i=length-TURN-1; i>1; i--){
-
-                if(with_gquad){
-                  f5[length] = MIN2(f5[length], f5[i-1] + ggg[indx[length]+i]);
-                }
-
-                type = ptype[indx[length]+i];
-                if(!type) continue;
-                en = c[indx[length]+i];
-                f5[length] = MIN2(f5[length], f5[i-1] + en + E_ExtLoop(type, S1[i-1], -1, P));
-              }
-
-              if(with_gquad){
-                f5[length] = MIN2(f5[length], ggg[indx[length]+1]);
-              }
-
-              type=ptype[indx[length]+1];
-              if(!type) break;
-              en = c[indx[length]+1];
-              f5[length] = MIN2(f5[length], en + E_ExtLoop(type, -1, -1, P));
-
-
-              break;
-
-    /* normal dangles, aka dangle_model = 1 || 3 */
-    default:  for(j=TURN+2; j<=length; j++){
-                f5[j] = f5[j-1];
-                for (i=j-TURN-1; i>1; i--){
-
-                  if(with_gquad){
-                    f5[j] = MIN2(f5[j], f5[i-1] + ggg[indx[j]+i]);
-                  }
-
-                  type = ptype[indx[j]+i];
-                  if(type){
-                    en = c[indx[j]+i];
-                    f5[j] = MIN2(f5[j], f5[i-1] + en + E_ExtLoop(type, -1, -1, P));
-                    f5[j] = MIN2(f5[j], f5[i-2] + en + E_ExtLoop(type, S1[i-1], -1, P));
-                  }
-                  type = ptype[indx[j-1]+i];
-                  if(type){
-                    en = c[indx[j-1]+i];
-                    f5[j] = MIN2(f5[j], f5[i-1] + en + E_ExtLoop(type, -1, S1[j], P));
-                    f5[j] = MIN2(f5[j], f5[i-2] + en + E_ExtLoop(type, S1[i-1], S1[j], P));
-                  }
-                }
-
-                if(with_gquad){
-                  f5[j] = MIN2(f5[j], ggg[indx[j]+1]);
-                }
-
-                type = ptype[indx[j]+1];
-                if(type) f5[j] = MIN2(f5[j], c[indx[j]+1] + E_ExtLoop(type, -1, -1, P));
-                type = ptype[indx[j-1]+1];
-                if(type) f5[j] = MIN2(f5[j], c[indx[j-1]+1] + E_ExtLoop(type, -1, S1[j], P));
-              }
-  }
-  return f5[length];
-}
-
-#include "circfold.inc"
-
-/**
-*** trace back through the "c", "f5" and "fML" arrays to get the
-*** base pairing list. No search for equivalent structures is done.
-*** This is fast, since only few structure elements are recalculated.
-***
-*** normally s=0.
-*** If s>0 then s items have been already pushed onto the sector stack
-**/
-PRIVATE void backtrack(const char *string, int s) {
-  int   i, j, ij, k, l1, mm5, mm3, length, energy, en, new;
-  int   no_close, type, type_2, tt, minq, maxq, c0, c1, c2, c3;
-  int   bonus;
-  int   b=0;
-  int   dangle_model = P->model_details.dangles;
-
-  length = strlen(string);
-  if (s==0) {
-    sector[++s].i = 1;
-    sector[s].j = length;
-    sector[s].ml = (backtrack_type=='M') ? 1 : ((backtrack_type=='C')? 2: 0);
-  }
-  while (s>0) {
-    int ml, fij, fi, cij, traced, i1, j1, p, q, jj=0, gq=0;
-    int canonical = 1;     /* (i,j) closes a canonical structure */
-    i  = sector[s].i;
-    j  = sector[s].j;
-    ml = sector[s--].ml;   /* ml is a flag indicating if backtracking is to
-                              occur in the fML- (1) or in the f-array (0) */
-    if (ml==2) {
-      base_pair2[++b].i = i;
-      base_pair2[b].j   = j;
-      goto repeat1;
-    }
-
-    else if(ml==7) { /* indicates that i,j are enclosing a gquadruplex */
-      /* actually, do something here */
-    }
-
-    if (j < i+TURN+1) continue; /* no more pairs in this interval */
-
-    fij = (ml == 1)? fML[indx[j]+i] : f5[j];
-    fi  = (ml == 1)?(fML[indx[j-1]+i]+P->MLbase): f5[j-1];
-
-    if (fij == fi) {  /* 3' end is unpaired */
-      sector[++s].i = i;
-      sector[s].j   = j-1;
-      sector[s].ml  = ml;
-      continue;
-    }
-
-    if (ml == 0) { /* backtrack in f5 */
-      switch(dangle_model){
-        case 0:   /* j is paired. Find pairing partner */
-                  for(k=j-TURN-1,traced=0; k>=1; k--){
-
-                    if(with_gquad){
-                      if(fij == f5[k-1] + ggg[indx[j]+k]){
-                        /* found the decomposition */
-                        traced = j; jj = k - 1; gq = 1;
-                        break;
-                      }
-                    }
-
-                    type = ptype[indx[j]+k];
-                    if(type)
-                      if(fij == E_ExtLoop(type, -1, -1, P) + c[indx[j]+k] + f5[k-1]){
-                        traced=j; jj = k-1;
-                        break;
-                      }
-                  }
-                  break;
-
-        case 2:   mm3 = (j<length) ? S1[j+1] : -1;
-                  for(k=j-TURN-1,traced=0; k>=1; k--){
-
-                    if(with_gquad){
-                      if(fij == f5[k-1] + ggg[indx[j]+k]){
-                        /* found the decomposition */
-                        traced = j; jj = k - 1; gq = 1;
-                        break;
-                      }
-                    }
-
-                    type = ptype[indx[j]+k];
-                    if(type)
-                      if(fij == E_ExtLoop(type, (k>1) ? S1[k-1] : -1, mm3, P) + c[indx[j]+k] + f5[k-1]){
-                        traced=j; jj = k-1;
-                        break;
-                      }
-                  }
-                  break;
-
-        default:  for(traced = 0, k=j-TURN-1; k>1; k--){
-
-                    if(with_gquad){
-                      if(fij == f5[k-1] + ggg[indx[j]+k]){
-                        /* found the decomposition */
-                        traced = j; jj = k - 1; gq = 1;
-                        break;
-                      }
-                    }
-
-                    type = ptype[indx[j] + k];
-                    if(type){
-                      en = c[indx[j] + k];
-                      if(fij == f5[k-1] + en + E_ExtLoop(type, -1, -1, P)){
-                        traced = j;
-                        jj = k-1;
-                        break;
-                      }
-                      if(fij == f5[k-2] + en + E_ExtLoop(type, S1[k-1], -1, P)){
-                        traced = j;
-                        jj = k-2;
-                        break;
-                      }
-                    }
-                    type = ptype[indx[j-1] + k];
-                    if(type){
-                      en = c[indx[j-1] + k];
-                      if(fij == f5[k-1] + en + E_ExtLoop(type, -1, S1[j], P)){
-                        traced = j-1;
-                        jj = k-1;
-                        break;
-                      }
-                      if(fij == f5[k-2] + en + E_ExtLoop(type, S1[k-1], S1[j], P)){
-                        traced = j-1;
-                        jj = k-2;
-                        break;
-                      }
-                    }
-                  }
-                  if(!traced){
-
-                    if(with_gquad){
-                      if(fij == ggg[indx[j]+1]){
-                        /* found the decomposition */
-                        traced = j; jj = 0; gq = 1;
-                        break;
-                      }
-                    }
-
-                    type = ptype[indx[j]+1];
-                    if(type){
-                      if(fij == c[indx[j]+1] + E_ExtLoop(type, -1, -1, P)){
-                        traced = j;
-                        jj = 0;
-                        break;
-                      }
-                    }
-                    type = ptype[indx[j-1]+1];
-                    if(type){
-                      if(fij == c[indx[j-1]+1] + E_ExtLoop(type, -1, S1[j], P)){
-                        traced = j-1;
-                        jj = 0;
-                        break;
-                      }
-                    }
-                  }
-                  break;
-      }
-
-      if (!traced){
-        fprintf(stderr, "%s\n", string);
-        nrerror("backtrack failed in f5");
-      }
-      /* push back the remaining f5 portion */
-      sector[++s].i = 1;
-      sector[s].j   = jj;
-      sector[s].ml  = ml;
-
-      /* trace back the base pair found */
-      i=k; j=traced;
-
-      if(with_gquad && gq){
-        /* goto backtrace of gquadruplex */
-        goto repeat_gquad;
-      }
-
-      base_pair2[++b].i = i;
-      base_pair2[b].j   = j;
-      goto repeat1;
-    }
-    else { /* trace back in fML array */
-      if (fML[indx[j]+i+1]+P->MLbase == fij) { /* 5' end is unpaired */
-        sector[++s].i = i+1;
-        sector[s].j   = j;
-        sector[s].ml  = ml;
-        continue;
-      }
-
-      ij  = indx[j]+i;
-
-      if(with_gquad){
-        if(fij == ggg[ij] + E_MLstem(0, -1, -1, P)){
-          /* go to backtracing of quadruplex */
-          goto repeat_gquad;
-        }
-      }
-
-      tt  = ptype[ij];
-      en  = c[ij];
-      switch(dangle_model){
-        case 0:   if(fij == en + E_MLstem(tt, -1, -1, P)){
-                    base_pair2[++b].i = i;
-                    base_pair2[b].j   = j;
-                    goto repeat1;
-                  }
-                  break;
-
-        case 2:   if(fij == en + E_MLstem(tt, S1[i-1], S1[j+1], P)){
-                    base_pair2[++b].i = i;
-                    base_pair2[b].j   = j;
-                    goto repeat1;
-                  }
-                  break;
-
-        default:  if(fij == en + E_MLstem(tt, -1, -1, P)){
-                    base_pair2[++b].i = i;
-                    base_pair2[b].j   = j;
-                    goto repeat1;
-                  }
-                  tt = ptype[ij+1];
-                  if(fij == c[ij+1] + E_MLstem(tt, S1[i], -1, P) + P->MLbase){
-                    base_pair2[++b].i = ++i;
-                    base_pair2[b].j   = j;
-                    goto repeat1;
-                  }
-                  tt = ptype[indx[j-1]+i];
-                  if(fij == c[indx[j-1]+i] + E_MLstem(tt, -1, S1[j], P) + P->MLbase){
-                    base_pair2[++b].i = i;
-                    base_pair2[b].j   = --j;
-                    goto repeat1;
-                  }
-                  tt = ptype[indx[j-1]+i+1];
-                  if(fij == c[indx[j-1]+i+1] + E_MLstem(tt, S1[i], S1[j], P) + 2*P->MLbase){
-                    base_pair2[++b].i = ++i;
-                    base_pair2[b].j   = --j;
-                    goto repeat1;
-                  }
-                  break;
-      }
-
-      for(k = i + 1 + TURN; k <= j - 2 - TURN; k++)
-        if(fij == (fML[indx[k]+i]+fML[indx[j]+k+1]))
-          break;
-
-      if ((dangle_model==3)&&(k > j - 2 - TURN)) { /* must be coax stack */
-        ml = 2;
-        for (k = i+1+TURN; k <= j - 2 - TURN; k++) {
-          type    = rtype[ptype[indx[k]+i]];
-          type_2  = rtype[ptype[indx[j]+k+1]];
-          if (type && type_2)
-            if (fij == c[indx[k]+i]+c[indx[j]+k+1]+P->stack[type][type_2]+
-                       2*P->MLintern[1])
-              break;
-        }
-      }
-      sector[++s].i = i;
-      sector[s].j   = k;
-      sector[s].ml  = ml;
-      sector[++s].i = k+1;
-      sector[s].j   = j;
-      sector[s].ml  = ml;
-
-      if (k>j-2-TURN) nrerror("backtrack failed in fML");
-      continue;
-    }
-
-  repeat1:
-
-    /*----- begin of "repeat:" -----*/
-    ij = indx[j]+i;
-    if (canonical)  cij = c[ij];
-
-    type = ptype[ij];
-
-    bonus = 0;
-    if (struct_constrained) {
-      if ((BP[i]==j)||(BP[i]==-1)||(BP[i]==-2)) bonus -= BONUS;
-      if ((BP[j]==-1)||(BP[j]==-3)) bonus -= BONUS;
-    }
-    if (noLonelyPairs)
-      if (cij == c[ij]){
-        /* (i.j) closes canonical structures, thus
-           (i+1.j-1) must be a pair                */
-        type_2 = ptype[indx[j-1]+i+1]; type_2 = rtype[type_2];
-        cij -= P->stack[type][type_2] + bonus;
-        base_pair2[++b].i = i+1;
-        base_pair2[b].j   = j-1;
-        i++; j--;
-        canonical=0;
-        goto repeat1;
-      }
-    canonical = 1;
-
-
-    no_close = (((type==3)||(type==4))&&no_closingGU&&(bonus==0));
-    if (no_close) {
-      if (cij == FORBIDDEN) continue;
-    } else
-      if (cij == E_Hairpin(j-i-1, type, S1[i+1], S1[j-1],string+i-1, P)+bonus)
-        continue;
-
-    for (p = i+1; p <= MIN2(j-2-TURN,i+MAXLOOP+1); p++) {
-      minq = j-i+p-MAXLOOP-2;
-      if (minq<p+1+TURN) minq = p+1+TURN;
-      for (q = j-1; q >= minq; q--) {
-
-        type_2 = ptype[indx[q]+p];
-        if (type_2==0) continue;
-        type_2 = rtype[type_2];
-        if (no_closingGU)
-          if (no_close||(type_2==3)||(type_2==4))
-            if ((p>i+1)||(q<j-1)) continue;  /* continue unless stack */
-
-        /* energy = oldLoopEnergy(i, j, p, q, type, type_2); */
-        energy = E_IntLoop(p-i-1, j-q-1, type, type_2,
-                            S1[i+1], S1[j-1], S1[p-1], S1[q+1], P);
-
-        new = energy+c[indx[q]+p]+bonus;
-        traced = (cij == new);
-        if (traced) {
-          base_pair2[++b].i = p;
-          base_pair2[b].j   = q;
-          i = p, j = q;
-          goto repeat1;
-        }
-      }
-    }
-
-    /* end of repeat: --------------------------------------------------*/
-
-    /* (i.j) must close a multi-loop */
-    tt = rtype[type];
-    i1 = i+1; j1 = j-1;
-
-    if(with_gquad){
-      /*
-        The case that is handled here actually resembles something like
-        an interior loop where the enclosing base pair is of regular
-        kind and the enclosed pair is not a canonical one but a g-quadruplex
-        that should then be decomposed further...
-      */
-      if(backtrack_GQuad_IntLoop(cij - bonus, i, j, type, S, ggg, indx, &p, &q, P)){
-        i = p; j = q;
-        goto repeat_gquad;
-      }
-    }
-
-    sector[s+1].ml  = sector[s+2].ml = 1;
-
-    switch(dangle_model){
-      case 0:   en = cij - E_MLstem(tt, -1, -1, P) - P->MLclosing - bonus;
-                for(k = i+2+TURN; k < j-2-TURN; k++){
-                  if(en == fML[indx[k]+i+1] + fML[indx[j-1]+k+1])
-                    break;
-                }
-                break;
-
-      case 2:   en = cij - E_MLstem(tt, S1[j-1], S1[i+1], P) - P->MLclosing - bonus;
-                for(k = i+2+TURN; k < j-2-TURN; k++){
-                    if(en == fML[indx[k]+i+1] + fML[indx[j-1]+k+1])
-                      break;
-                }
-                break;
-
-      default:  for(k = i+2+TURN; k < j-2-TURN; k++){
-                  en = cij - P->MLclosing - bonus;
-                  if(en == fML[indx[k]+i+1] + fML[indx[j-1]+k+1] + E_MLstem(tt, -1, -1, P)){
-                    break;
-                  }
-                  else if(en == fML[indx[k]+i+2] + fML[indx[j-1]+k+1] + E_MLstem(tt, -1, S1[i+1], P) + P->MLbase){
-                    i1 = i+2;
-                    break;
-                  }
-                  else if(en == fML[indx[k]+i+1] + fML[indx[j-2]+k+1] + E_MLstem(tt, S1[j-1], -1, P) + P->MLbase){
-                    j1 = j-2;
-                    break;
-                  }
-                  else if(en == fML[indx[k]+i+2] + fML[indx[j-2]+k+1] + E_MLstem(tt, S1[j-1], S1[i+1], P) + 2*P->MLbase){
-                    i1 = i+2;
-                    j1 = j-2;
-                    break;
-                  }
-                  /* coaxial stacking of (i.j) with (i+1.k) or (k.j-1) */
-                  /* use MLintern[1] since coax stacked pairs don't get TerminalAU */
-                  if(dangle_model == 3){
-                    type_2 = rtype[ptype[indx[k]+i+1]];
-                    if (type_2) {
-                      en = c[indx[k]+i+1]+P->stack[type][type_2]+fML[indx[j-1]+k+1];
-                      if (cij == en+2*P->MLintern[1]+P->MLclosing) {
-                        ml = 2;
-                        sector[s+1].ml  = 2;
-                        traced = 1;
-                        break;
-                      }
-                    }
-                    type_2 = rtype[ptype[indx[j-1]+k+1]];
-                    if (type_2) {
-                      en = c[indx[j-1]+k+1]+P->stack[type][type_2]+fML[indx[k]+i+1];
-                      if (cij == en+2*P->MLintern[1]+P->MLclosing) {
-                        sector[s+2].ml = 2;
-                        traced = 1;
-                        break;
-                      }
-                    }
-                  }
-                }
-                break;
-    }
-
-    if (k<=j-3-TURN) { /* found the decomposition */
-      sector[++s].i = i1;
-      sector[s].j   = k;
-      sector[++s].i = k+1;
-      sector[s].j   = j1;
-    } else {
-#if 0
-      /* Y shaped ML loops fon't work yet */
-      if (dangle_model==3) {
-        d5 = P->dangle5[tt][S1[j-1]];
-        d3 = P->dangle3[tt][S1[i+1]];
-        /* (i,j) must close a Y shaped ML loop with coax stacking */
-        if (cij ==  fML[indx[j-2]+i+2] + mm + d3 + d5 + P->MLbase + P->MLbase) {
-          i1 = i+2;
-          j1 = j-2;
-        } else if (cij ==  fML[indx[j-2]+i+1] + mm + d5 + P->MLbase)
-          j1 = j-2;
-        else if (cij ==  fML[indx[j-1]+i+2] + mm + d3 + P->MLbase)
-          i1 = i+2;
-        else /* last chance */
-          if (cij != fML[indx[j-1]+i+1] + mm + P->MLbase)
-            fprintf(stderr,  "backtracking failed in repeat");
-        /* if we arrive here we can express cij via fML[i1,j1]+dangles */
-        sector[++s].i = i1;
-        sector[s].j   = j1;
-      }
-      else
-#endif
-        nrerror("backtracking failed in repeat");
-    }
-
-    continue; /* this is a workarround to not accidentally proceed in the following block */
-
-  repeat_gquad:
-    /*
-      now we do some fancy stuff to backtrace the stacksize and linker lengths
-      of the g-quadruplex that should reside within position i,j
-    */
-    {
-      int l[3], L, a;
-      L = -1;
-      
-      get_gquad_pattern_mfe(S, i, j, P, &L, l);
-      if(L != -1){
-        /* fill the G's of the quadruplex into base_pair2 */
-        for(a=0;a<L;a++){
-          base_pair2[++b].i = i+a;
-          base_pair2[b].j   = i+a;
-          base_pair2[++b].i = i+L+l[0]+a;
-          base_pair2[b].j   = i+L+l[0]+a;
-          base_pair2[++b].i = i+L+l[0]+L+l[1]+a;
-          base_pair2[b].j   = i+L+l[0]+L+l[1]+a;
-          base_pair2[++b].i = i+L+l[0]+L+l[1]+L+l[2]+a;
-          base_pair2[b].j   = i+L+l[0]+L+l[1]+L+l[2]+a;
-        }
-        goto repeat_gquad_exit;
-      }
-      nrerror("backtracking failed in repeat_gquad");
-    }
-  repeat_gquad_exit:
-    asm("nop");
-
-  } /* end of infinite while loop */
-
-  base_pair2[0].i = b;    /* save the total number of base pairs */
-}
-
-PUBLIC char *backtrack_fold_from_pair(char *sequence, int i, int j) {
-  char *structure;
-  sector[1].i  = i;
-  sector[1].j  = j;
-  sector[1].ml = 2;
-  base_pair2[0].i=0;
-  S   = encode_sequence(sequence, 0);
-  S1  = encode_sequence(sequence, 1);
-  backtrack(sequence, 1);
-  structure = (char *) space((strlen(sequence)+1)*sizeof(char));
-  parenthesis_structure(structure, base_pair2, strlen(sequence));
-  free(S);free(S1);
-  return structure;
-}
-
-/*---------------------------------------------------------------------------*/
-
-PUBLIC void letter_structure(char *structure, bondT *bp, int length){
-  int   n, k, x, y;
-  char  alpha[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-  for (n = 0; n < length; structure[n++] = ' ');
-  structure[length] = '\0';
-
-  for (n = 0, k = 1; k <= bp[0].i; k++) {
-    y = bp[k].j;
-    x = bp[k].i;
-    if (x-1 > 0 && y+1 <= length) {
-      if (structure[x-2] != ' ' && structure[y] == structure[x-2]) {
-        structure[x-1] = structure[x-2];
-        structure[y-1] = structure[x-1];
-        continue;
-      }
-    }
-    if (structure[x] != ' ' && structure[y-2] == structure[x]) {
-      structure[x-1] = structure[x];
-      structure[y-1] = structure[x-1];
-      continue;
-    }
-    n++;
-    structure[x-1] = alpha[n-1];
-    structure[y-1] = alpha[n-1];
-  }
-}
-
-/*---------------------------------------------------------------------------*/
-
-PUBLIC void parenthesis_structure(char *structure, bondT *bp, int length){
-  int n, k;
-
-  for (n = 0; n < length; structure[n++] = '.');
-  structure[length] = '\0';
-
-  for (k = 1; k <= bp[0].i; k++){
-
-    if(bp[k].i == bp[k].j){ /* Gquad bonds are marked as bp[i].i == bp[i].j */
-      structure[bp[k].i-1] = '+';
-    } else { /* the following ones are regular base pairs */
-      structure[bp[k].i-1] = '(';
-      structure[bp[k].j-1] = ')';
-    }
-  }
-}
-
-PUBLIC void parenthesis_zuker(char *structure, bondT *bp, int length){
-  int k, i, j, temp;
-
-  for (k = 0; k < length; structure[k++] = '.');
-  structure[length] = '\0';
-
-  for (k = 1; k <= bp[0].i; k++) {
-    i=bp[k].i;
-    j=bp[k].j;
-    if (i>length) i-=length;
-    if (j>length) j-=length;
-    if (i>j) {
-      temp=i; i=j; j=temp;
-    }
-    if(i == j){ /* Gquad bonds are marked as bp[i].i == bp[i].j */
-      structure[i-1] = '+';
-    } else { /* the following ones are regular base pairs */
-      structure[i-1] = '(';
-      structure[j-1] = ')';
-    }
-  }
-}
-
-
-/*---------------------------------------------------------------------------*/
-
-PUBLIC void update_fold_params(void){
-  update_fold_params_par(NULL);
-}
-
-PUBLIC void update_fold_params_par(paramT *parameters){
-  if(P) free(P);
-  if(parameters){
-    P = get_parameter_copy(parameters);
-  } else {
-    model_detailsT md;
-    set_model_details(&md);
-    P = get_scaled_parameters(temperature, md);
-  }
-  make_pair_matrix();
-  if (init_length < 0) init_length=0;
-}
-
-/*---------------------------------------------------------------------------*/
-PUBLIC float energy_of_structure(const char *string, const char *structure, int verbosity_level){
-  return energy_of_struct_par(string, structure, NULL, verbosity_level);
-}
-
-PUBLIC float energy_of_struct_par(const char *string,
-                                  const char *structure,
-                                  paramT *parameters,
-                                  int verbosity_level){
-  int   energy;
-  short *ss, *ss1;
-
-  update_fold_params_par(parameters);
-
-  if (strlen(structure)!=strlen(string))
-    nrerror("energy_of_struct: string and structure have unequal length");
-
-  /* save the S and S1 pointers in case they were already in use */
-  ss = S; ss1 = S1;
-  S   = encode_sequence(string, 0);
-  S1  = encode_sequence(string, 1);
-
-  pair_table = make_pair_table(structure);
-
-  energy = energy_of_structure_pt(string, pair_table, S, S1, verbosity_level);
-
-  free(pair_table);
-  free(S); free(S1);
-  S=ss; S1=ss1;
-  return  (float) energy/100.;
-}
-
-/*  returns a correction term that may be added to the energy retrieved
-    from energy_of_struct_par() to correct misinterpreted loops. This
-    correction is necessary since energy_of_struct_par() will forget 
-    about the existance of gquadruplexes and just treat them as unpaired
-    regions.
-
-    recursive variant
-*/
-PRIVATE int en_corr_of_loop_gquad(int i,
-                                  int j,
-                                  const char *string,
-                                  const char *structure,
-                                  short *pt,
-                                  int *loop_idx,
-                                  const short *s1){
-
-  int pos, energy, p, q, r, s, u, type, type2;
-  int L, l[3];
-
-  energy = 0;
-  q = i;
-  while((pos = parse_gquad(structure + q-1, &L, l)) > 0){
-    q += pos-1;
-    p = q - 4*L - l[0] - l[1] - l[2] + 1;
-    if(q > j) break;
-    /* we've found the first g-quadruplex at position [p,q] */
-    energy += E_gquad(L, l, P);
-    /* check if it's enclosed in a base pair */
-    if(loop_idx[p] == 0){ q++; continue; /* g-quad in exterior loop */}
-    else{
-      energy += E_MLstem(0, -1, -1, P); /*  do not forget to remove this energy if
-                                            the gquad is the only one surrounded by
-                                            the enclosing pair
-                                        */
-
-      /*  find its enclosing pair */
-      int num_elem, num_g, elem_i, elem_j, up_mis;
-      num_elem  = 0;
-      num_g     = 1;
-      r         = p - 1;
-      up_mis    = q - p + 1;
-
-      /* seek for first pairing base located 5' of the g-quad */
-      for(r = p - 1; !pt[r] && (r >= i); r--);
-      if(r < i) nrerror("this should not happen");
-
-      if(r < pt[r]){ /* found the enclosing pair */
-        s = pt[r];
-      } else {
-        num_elem++;
-        elem_i = pt[r];
-        elem_j = r;
-        r = pt[r]-1 ;
-        /* seek for next pairing base 5' of r */
-        for(; !pt[r] && (r >= i); r--);
-        if(r < i) nrerror("so nich");
-        if(r < pt[r]){ /* found the enclosing pair */
-          s = pt[r];
-        } else {
-          /* hop over stems and unpaired nucleotides */
-          while((r > pt[r]) && (r >= i)){
-            if(pt[r]){ r = pt[r]; num_elem++;}
-            r--;
-          }
-          if(r < i) nrerror("so nich");
-          s = pt[r]; /* found the enclosing pair */
-        }
-      }
-      /* now we have the enclosing pair (r,s) */
-
-      u = q+1;
-      /* we know everything about the 5' part of this loop so check the 3' part */
-      while(u<s){
-        if(structure[u-1] == '.') u++;
-        else if (structure[u-1] == '+'){ /* found another gquad */
-          pos = parse_gquad(structure + u - 1, &L, l);
-          if(pos > 0){
-            energy += E_gquad(L, l, P) + E_MLstem(0, -1, -1, P);
-            up_mis += pos;
-            u += pos;
-            num_g++;
-          }
-        } else { /* we must have found a stem */
-          if(!(u < pt[u])) nrerror("wtf!");
-          num_elem++; elem_i = u; elem_j = pt[u];
-          energy += en_corr_of_loop_gquad(u, pt[u], string, structure, pt, loop_idx, s1);
-          u = pt[u] + 1;
-        }
-      }
-      if(u!=s) nrerror("what the hell");
-      else{ /* we are done since we've found no other 3' structure element */
-        switch(num_elem){
-          /* g-quad was misinterpreted as hairpin closed by (r,s) */
-          case 0:   /* if(num_g == 1)
-                      if((p-r-1 == 0) || (s-q-1 == 0))
-                        nrerror("too few unpaired bases");
-                    */
-                    type = pair[s1[r]][s1[s]];
-                    if(dangles == 2)
-                      energy += P->mismatchI[type][s1[r+1]][s1[s-1]];
-                    if(type > 2)
-                      energy += P->TerminalAU;
-                    energy += P->internal_loop[s - r - 1 - up_mis];
-                    energy -= E_MLstem(0, -1, -1, P);
-                    energy -= E_Hairpin(s - r - 1,
-                                        type,
-                                        s1[r + 1],
-                                        s1[s - 1],
-                                        string + r - 1,
-                                        P);
-                    break;
-          /* g-quad was misinterpreted as interior loop closed by (r,s) with enclosed pair (elem_i, elem_j) */
-          case 1:   type = pair[s1[r]][s1[s]];
-                    type2 = pair[s1[elem_i]][s1[elem_j]];
-                    energy += P->MLclosing
-                              + E_MLstem(rtype[type], s1[s-1], s1[r+1], P)
-                              + (elem_i - r - 1 + s - elem_j - 1 - up_mis) * P->MLbase
-                              + E_MLstem(type2, s1[elem_i-1], s1[elem_j+1], P);
-                    energy -= E_IntLoop(elem_i - r - 1,
-                                        s - elem_j - 1,
-                                        type,
-                                        rtype[type2],
-                                        s1[r + 1],
-                                        s1[s - 1],
-                                        s1[elem_i - 1],
-                                        s1[elem_j + 1],
-                                        P);
-                    break;
-          /* gquad was misinterpreted as unpaired nucleotides in a multiloop */
-          default:  energy -= (up_mis) * P->MLbase;
-                    break;
-        }
-      }
-      q = s+1;
-    }
-  }
-  return energy;
-}
-
-PUBLIC float
-energy_of_gquad_structure(const char *string,
-                          const char *structure,
-                          int verbosity_level){
-
-  return energy_of_gquad_struct_par(string, structure, NULL, verbosity_level);
-}
-
-PUBLIC float
-energy_of_gquad_struct_par( const char *string,
-                            const char *structure,
-                            paramT *parameters,
-                            int verbosity_level){
-
-  int   energy, gge, *loop_idx;
-  short *ss, *ss1;
-
-  update_fold_params_par(parameters);
-
-  if (strlen(structure)!=strlen(string))
-    nrerror("energy_of_struct: string and structure have unequal length");
-
-  /* save the S and S1 pointers in case they were already in use */
-  ss = S; ss1 = S1;
-  S   = encode_sequence(string, 0);
-  S1  = encode_sequence(string, 1);
-
-  /* the pair_table looses every information about the gquad position
-     thus we have to find add the energy contributions for each loop
-     that contains a gquad by ourself, substract all miscalculated
-     contributions, i.e. loops that actually contain a gquad, from
-     energy_of_structure_pt()
-  */
-  pair_table  = make_pair_table(structure);
-  energy      = energy_of_structure_pt(string, pair_table, S, S1, verbosity_level);
-
-  loop_idx    = make_loop_index_pt(pair_table);
-  gge         = en_corr_of_loop_gquad(1, S[0], string, structure, pair_table, loop_idx, S1);
-  energy     += gge;
-
-  free(pair_table);
-  free(loop_idx);
-  free(S); free(S1);
-  S=ss; S1=ss1;
-  return  (float) energy/100.;
-}
-
-PUBLIC int energy_of_structure_pt(const char *string,
-                                  short *ptable,
-                                  short *s,
-                                  short *s1,
-                                  int verbosity_level){
-  return energy_of_struct_pt_par(string, ptable, s, s1, NULL, verbosity_level);
-}
-
-PUBLIC int energy_of_struct_pt_par( const char *string,
-                                    short *ptable,
-                                    short *s,
-                                    short *s1,
-                                    paramT *parameters,
-                                    int verbosity_level){
-  /* auxiliary function for kinfold,
-     for most purposes call energy_of_struct instead */
-
-  int   i, length, energy;
-  short *ss, *ss1;
-
-  update_fold_params_par(parameters);
-
-  pair_table = ptable;
-  ss  = S;
-  ss1 = S1;
-  S = s;
-  S1 = s1;
-
-  length = S[0];
-/*   energy =  backtrack_type=='M' ? ML_Energy(0, 0) : ML_Energy(0, 1); */
-    energy =  backtrack_type=='M' ? energy_of_ml_pt(0, ptable) : energy_of_extLoop_pt(0, ptable);
-  if (verbosity_level>0)
-    printf("External loop                           : %5d\n", energy);
-  for (i=1; i<=length; i++) {
-    if (pair_table[i]==0) continue;
-    energy += stack_energy(i, string, verbosity_level);
-    i=pair_table[i];
-  }
-  for (i=1; !SAME_STRAND(i,length); i++) {
-    if (!SAME_STRAND(i,pair_table[i])) {
-      energy+=P->DuplexInit;
-      break;
-    }
-  }
-  S   = ss;
-  S1  = ss1;
-  return energy;
-}
-
-PUBLIC float energy_of_circ_structure(const char *string,
-                                      const char *structure,
-                                      int verbosity_level){
-  return energy_of_circ_struct_par(string, structure, NULL, verbosity_level);
-}
-
-PUBLIC float energy_of_circ_struct_par( const char *string,
-                                        const char *structure,
-                                        paramT *parameters,
-                                        int verbosity_level){
-
-  int   i, j, length, energy=0, en0, degree=0, type;
-  short *ss, *ss1;
-
-  update_fold_params_par(parameters);
-
-  int dangle_model = P->model_details.dangles;
-
-  if (strlen(structure)!=strlen(string))
-    nrerror("energy_of_struct: string and structure have unequal length");
-
-  /* save the S and S1 pointers in case they were already in use */
-  ss = S; ss1 = S1;
-  S   = encode_sequence(string, 0);
-  S1  = encode_sequence(string, 1);
-
-  pair_table = make_pair_table(structure);
-
-  length = S[0];
-
-  for (i=1; i<=length; i++) {
-    if (pair_table[i]==0) continue;
-    degree++;
-    energy += stack_energy(i, string, verbosity_level);
-    i=pair_table[i];
-  }
-
-  if (degree==0) return 0.;
-  for (i=1; pair_table[i]==0; i++);
-  j = pair_table[i];
-  type=pair[S[j]][S[i]];
-  if (type==0) type=7;
-  if (degree==1) {
-    char loopseq[10];
-    int u, si1, sj1;
-    for (i=1; pair_table[i]==0; i++);
-    u = length-j + i-1;
-    if (u<7) {
-      strcpy(loopseq , string+j-1);
-      strncat(loopseq, string, i);
-    }
-    si1 = (i==1)?S1[length] : S1[i-1];
-    sj1 = (j==length)?S1[1] : S1[j+1];
-    en0 = E_Hairpin(u, type, sj1, si1, loopseq, P);
-  } else
-    if (degree==2) {
-      int p,q, u1,u2, si1, sq1, type_2;
-      for (p=j+1; pair_table[p]==0; p++);
-      q=pair_table[p];
-      u1 = p-j-1;
-      u2 = i-1 + length-q;
-      type_2 = pair[S[q]][S[p]];
-      if (type_2==0) type_2=7;
-      si1 = (i==1)? S1[length] : S1[i-1];
-      sq1 = (q==length)? S1[1] : S1[q+1];
-      en0 = E_IntLoop(u1, u2, type, type_2,
-                       S1[j+1], si1, S1[p-1], sq1,P);
-    } else { /* degree > 2 */
-      en0 = ML_Energy(0, 0) - P->MLintern[0];
-      if (dangle_model) {
-        int d5, d3;
-        if (pair_table[1]) {
-          j = pair_table[1];
-          type = pair[S[1]][S[j]];
-          if (dangle_model==2)
-            en0 += P->dangle5[type][S1[length]];
-          else { /* dangle_model==1 */
-            if (pair_table[length]==0) {
-              d5 = P->dangle5[type][S1[length]];
-              if (pair_table[length-1]!=0) {
-                int tt;
-                tt = pair[S[pair_table[length-1]]][S[length-1]];
-                d3 = P->dangle3[tt][S1[length]];
-                if (d3<d5) d5 = 0;
-                else d5 -= d3;
-              }
-              en0 += d5;
-            }
-          }
-        }
-        if (pair_table[length]) {
-          i = pair_table[length];
-          type = pair[S[i]][S[length]];
-          if (dangle_model==2)
-            en0 += P->dangle3[type][S1[1]];
-          else { /* dangle_model==1 */
-            if (pair_table[1]==0) {
-              d3 = P->dangle3[type][S1[1]];
-              if (pair_table[2]) {
-                int tt;
-                tt = pair[S[2]][S[pair_table[2]]];
-                d5 = P->dangle5[tt][1];
-                if (d5<d3) d3=0;
-                else d3 -= d5;
-              }
-              en0 += d3;
-            }
-          }
-        }
-      }
-    }
-
-  if (verbosity_level>0)
-    printf("External loop                           : %5d\n", en0);
-  energy += en0;
-  /* fprintf(stderr, "ext loop degree %d tot %d\n", degree, energy); */
-  free(S); free(S1);
-  S=ss; S1=ss1;
-  return  (float) energy/100.0;
-}
-
-/*---------------------------------------------------------------------------*/
-PRIVATE int stack_energy(int i, const char *string, int verbosity_level)
-{
-  /* calculate energy of substructure enclosed by (i,j) */
-  int ee, energy = 0;
-  int j, p, q, type;
-
-  j=pair_table[i];
-  type = pair[S[i]][S[j]];
-  if (type==0) {
-    type=7;
-    if (verbosity_level>=0)
-      fprintf(stderr,"WARNING: bases %d and %d (%c%c) can't pair!\n", i, j,
-              string[i-1],string[j-1]);
-  }
-
-  p=i; q=j;
-  while (p<q) { /* process all stacks and interior loops */
-    int type_2;
-    while (pair_table[++p]==0);
-    while (pair_table[--q]==0);
-    if ((pair_table[q]!=(short)p)||(p>q)) break;
-    type_2 = pair[S[q]][S[p]];
-    if (type_2==0) {
-      type_2=7;
-      if (verbosity_level>=0)
-        fprintf(stderr,"WARNING: bases %d and %d (%c%c) can't pair!\n", p, q,
-                string[p-1],string[q-1]);
-    }
-    /* energy += LoopEnergy(i, j, p, q, type, type_2); */
-    if ( SAME_STRAND(i,p) && SAME_STRAND(q,j) )
-      ee = E_IntLoop(p-i-1, j-q-1, type, type_2, S1[i+1], S1[j-1], S1[p-1], S1[q+1],P);
-    else
-      ee = energy_of_extLoop_pt(cut_in_loop(i), pair_table);
-    if (verbosity_level>0)
-      printf("Interior loop (%3d,%3d) %c%c; (%3d,%3d) %c%c: %5d\n",
-             i,j,string[i-1],string[j-1],p,q,string[p-1],string[q-1], ee);
-    energy += ee;
-    i=p; j=q; type = rtype[type_2];
-  } /* end while */
-
-  /* p,q don't pair must have found hairpin or multiloop */
-
-  if (p>q) {                       /* hair pin */
-    if (SAME_STRAND(i,j))
-      ee = E_Hairpin(j-i-1, type, S1[i+1], S1[j-1], string+i-1, P);
-    else
-      ee = energy_of_extLoop_pt(cut_in_loop(i), pair_table);
-    energy += ee;
-    if (verbosity_level>0)
-      printf("Hairpin  loop (%3d,%3d) %c%c              : %5d\n",
-             i, j, string[i-1],string[j-1], ee);
-
-    return energy;
-  }
-
-  /* (i,j) is exterior pair of multiloop */
-  while (p<j) {
-    /* add up the contributions of the substructures of the ML */
-    energy += stack_energy(p, string, verbosity_level);
-    p = pair_table[p];
-    /* search for next base pair in multiloop */
-    while (pair_table[++p]==0);
-  }
-  {
-    int ii;
-    ii = cut_in_loop(i);
-    ee = (ii==0) ? energy_of_ml_pt(i, pair_table) : energy_of_extLoop_pt(ii, pair_table);
-  }
-  energy += ee;
-  if (verbosity_level>0)
-    printf("Multi    loop (%3d,%3d) %c%c              : %5d\n",
-           i,j,string[i-1],string[j-1],ee);
-
-  return energy;
-}
-
-/*---------------------------------------------------------------------------*/
-
-
-
-/**
-*** Calculate the energy contribution of
-*** stabilizing dangling-ends/mismatches
-*** for all stems branching off the exterior
-*** loop
-**/
-PRIVATE int energy_of_extLoop_pt(int i, short *pair_table) {
-  int energy, mm5, mm3;
-  int p, q, q_prev;
-  int length = (int)pair_table[0];
-
-  /* helper variables for dangles == 1 case */
-  int E3_available;  /* energy of 5' part where 5' mismatch is available for current stem */
-  int E3_occupied;   /* energy of 5' part where 5' mismatch is unavailable for current stem */
-
-  int dangle_model = P->model_details.dangles;
-
-  /* initialize vars */
-  energy      = 0;
-  p           = (i==0) ? 1 : i;
-  q_prev      = -1;
-
-  if(dangle_model%2 == 1){
-    E3_available = INF;
-    E3_occupied  = 0;
-  }
-
-  /* seek to opening base of first stem */
-  while(p <= length && !pair_table[p]) p++;
-
-  while(p < length){
-    int tt;
-    /* p must have a pairing partner */
-    q  = (int)pair_table[p];
-    /* get type of base pair (p,q) */
-    tt = pair[S[p]][S[q]];
-    if(tt==0) tt=7;
-
-    switch(dangle_model){
-      /* no dangles */
-      case 0:   energy += E_ExtLoop(tt, -1, -1, P);
-                break;
-      /* the beloved double dangles */
-      case 2:   mm5 = ((SAME_STRAND(p-1,p)) && (p>1))       ? S1[p-1] : -1;
-                mm3 = ((SAME_STRAND(q,q+1)) && (q<length))  ? S1[q+1] : -1;
-                energy += E_ExtLoop(tt, mm5, mm3, P);
-                break;
-
-      default:  {
-                  int tmp;
-                  if(q_prev + 2 < p){
-                    E3_available = MIN2(E3_available, E3_occupied);
-                    E3_occupied  = E3_available;
-                  }
-                  mm5 = ((SAME_STRAND(p-1,p)) && (p>1) && !pair_table[p-1])       ? S1[p-1] : -1;
-                  mm3 = ((SAME_STRAND(q,q+1)) && (q<length) && !pair_table[q+1])  ? S1[q+1] : -1;
-                  tmp = MIN2(
-                                                E3_occupied  + E_ExtLoop(tt, -1, mm3, P),
-                                                E3_available + E_ExtLoop(tt, mm5, mm3, P)
-                                              );
-                  E3_available =       MIN2(
-                                                E3_occupied  + E_ExtLoop(tt, -1, -1, P),
-                                                E3_available + E_ExtLoop(tt, mm5, -1, P)
-                                              );
-                  E3_occupied = tmp;
-                }
-                break;
-
-    } /* end switch dangle_model */
-    /* seek to the next stem */
-    p = q + 1;
-    q_prev = q;
-    while (p <= length && !pair_table[p]) p++;
-    if(p==i) break; /* cut was in loop */
-  }
-
-  if(dangle_model%2 == 1)
-    energy = MIN2(E3_occupied, E3_available);
-
-  return energy;
-}
-
-/**
-*** i is the 5'-base of the closing pair
-***
-*** since each helix can coaxially stack with at most one of its
-*** neighbors we need an auxiliarry variable  cx_energy
-*** which contains the best energy given that the last two pairs stack.
-*** energy  holds the best energy given the previous two pairs do not
-*** stack (i.e. the two current helices may stack)
-*** We don't allow the last helix to stack with the first, thus we have to
-*** walk around the Loop twice with two starting points and take the minimum
-***/
-PRIVATE int energy_of_ml_pt(int i, short *pt){
-
-  int energy, cx_energy, tmp, tmp2, best_energy=INF;
-  int i1, j, p, q, q_prev, q_prev2, u, x, type, count, mm5, mm3, tt, ld5, new_cx, dang5, dang3, dang;
-  int mlintern[NBPAIRS+1];
-
-  /* helper variables for dangles == 1|5 case */
-  int E_mm5_available;  /* energy of 5' part where 5' mismatch of current stem is available */
-  int E_mm5_occupied;   /* energy of 5' part where 5' mismatch of current stem is unavailable */
-  int E2_mm5_available; /* energy of 5' part where 5' mismatch of current stem is available with possible 3' dangle for enclosing pair (i,j) */
-  int E2_mm5_occupied;  /* energy of 5' part where 5' mismatch of current stem is unavailable with possible 3' dangle for enclosing pair (i,j) */
-  int dangle_model = P->model_details.dangles;
-
-  if(i >= pt[i])
-    nrerror("energy_of_ml_pt: i is not 5' base of a closing pair!");
-
-  j = (int)pt[i];
-
-  /* init the variables */
-  energy      = 0;
-  p           = i+1;
-  q_prev      = i-1;
-  q_prev2     = i;
-
-  for (x = 0; x <= NBPAIRS; x++) mlintern[x] = P->MLintern[x];
-
-  /* seek to opening base of first stem */
-  while(p <= j && !pair_table[p]) p++;
-  u = p - i - 1;
-
-  switch(dangle_model){
-    case 0:   while(p < j){
-                /* p must have a pairing partner */
-                q  = (int)pair_table[p];
-                /* get type of base pair (p,q) */
-                tt = pair[S[p]][S[q]];
-                if(tt==0) tt=7;
-                energy += E_MLstem(tt, -1, -1, P);
-                /* seek to the next stem */
-                p = q + 1;
-                q_prev = q_prev2 = q;
-                while (p <= j && !pair_table[p]) p++;
-                u += p - q - 1; /* add unpaired nucleotides */
-              }
-              /* now lets get the energy of the enclosing stem */
-              type = pair[S[j]][S[i]]; if (type==0) type=7;
-              energy += E_MLstem(type, -1, -1, P);
-              break;
-
-    case 2:   while(p < j){
-                /* p must have a pairing partner */
-                q  = (int)pair_table[p];
-                /* get type of base pair (p,q) */
-                tt = pair[S[p]][S[q]];
-                if(tt==0) tt=7;
-                mm5 = (SAME_STRAND(p-1,p))  ? S1[p-1] : -1;
-                mm3 = (SAME_STRAND(q,q+1))  ? S1[q+1] : -1;
-                energy += E_MLstem(tt, mm5, mm3, P);
-                /* seek to the next stem */
-                p = q + 1;
-                q_prev = q_prev2 = q;
-                while (p <= j && !pair_table[p]) p++;
-                u += p - q - 1; /* add unpaired nucleotides */
-              }
-              type = pair[S[j]][S[i]]; if (type==0) type=7;
-              mm5 = ((SAME_STRAND(j-1,j)) && !pair_table[j-1])  ? S1[j-1] : -1;
-              mm3 = ((SAME_STRAND(i,i+1)) && !pair_table[i+1])  ? S1[i+1] : -1;
-              energy += E_MLstem(type, S1[j-1], S1[i+1], P);
-              break;
-
-    case 3:   /* we treat helix stacking different */
-              for (count=0; count<2; count++) { /* do it twice */
-                ld5 = 0; /* 5' dangle energy on prev pair (type) */
-                if ( i==0 ) {
-                  j = (unsigned int)pair_table[0]+1;
-                  type = 0;  /* no pair */
-                }
-                else {
-                  j = (unsigned int)pair_table[i];
-                  type = pair[S[j]][S[i]]; if (type==0) type=7;
-                  /* prime the ld5 variable */
-                  if (SAME_STRAND(j-1,j)) {
-                    ld5 = P->dangle5[type][S1[j-1]];
-                    if ((p=(unsigned int)pair_table[j-2]) && SAME_STRAND(j-2, j-1))
-                    if (P->dangle3[pair[S[p]][S[j-2]]][S1[j-1]]<ld5) ld5 = 0;
-                  }
-                }
-                i1=i; p = i+1; u=0;
-                energy = 0; cx_energy=INF;
-                do { /* walk around the multi-loop */
-                  new_cx = INF;
-
-                  /* hop over unpaired positions */
-                  while (p <= (unsigned int)pair_table[0] && pair_table[p]==0) p++;
-
-                  /* memorize number of unpaired positions */
-                  u += p-i1-1;
-                  /* get position of pairing partner */
-                  if ( p == (unsigned int)pair_table[0]+1 ){
-                    q = 0;tt = 0; /* virtual root pair */
-                  } else {
-                    q  = (unsigned int)pair_table[p];
-                    /* get type of base pair P->q */
-                    tt = pair[S[p]][S[q]]; if (tt==0) tt=7;
-                  }
-
-                  energy += mlintern[tt];
-                  cx_energy += mlintern[tt];
-
-                  dang5=dang3=0;
-                  if ((SAME_STRAND(p-1,p))&&(p>1))
-                    dang5=P->dangle5[tt][S1[p-1]];      /* 5'dangle of pq pair */
-                  if ((SAME_STRAND(i1,i1+1))&&(i1<(unsigned int)S[0]))
-                    dang3 = P->dangle3[type][S1[i1+1]]; /* 3'dangle of previous pair */
-
-                  switch (p-i1-1) {
-                    case 0:   /* adjacent helices */
-                              if (i1!=0){
-                                if (SAME_STRAND(i1,p)) {
-                                  new_cx = energy + P->stack[rtype[type]][rtype[tt]];
-                                  /* subtract 5'dangle and TerminalAU penalty */
-                                  new_cx += -ld5 - mlintern[tt]-mlintern[type]+2*mlintern[1];
-                                }
-                                ld5=0;
-                                energy = MIN2(energy, cx_energy);
-                              }
-                              break;
-                    case 1:   /* 1 unpaired base between helices */
-                              dang = MIN2(dang3, dang5);
-                              energy = energy +dang; ld5 = dang - dang3;
-                              /* may be problem here: Suppose
-                                cx_energy>energy, cx_energy+dang5<energy
-                                and the following helices are also stacked (i.e.
-                                we'll subtract the dang5 again */
-                              if (cx_energy+dang5 < energy) {
-                                energy = cx_energy+dang5;
-                                ld5 = dang5;
-                              }
-                              new_cx = INF;  /* no coax stacking with mismatch for now */
-                              break;
-                    default:  /* many unpaired base between helices */
-                              energy += dang5 +dang3;
-                              energy = MIN2(energy, cx_energy + dang5);
-                              new_cx = INF;  /* no coax stacking possible */
-                              ld5 = dang5;
-                              break;
-                  }
-                  type = tt;
-                  cx_energy = new_cx;
-                  i1 = q; p=q+1;
-                } while (q!=i);
-                best_energy = MIN2(energy, best_energy); /* don't use cx_energy here */
-                /* fprintf(stderr, "%6.2d\t", energy); */
-                /* skip a helix and start again */
-                while (pair_table[p]==0) p++;
-                if (i == (unsigned int)pair_table[p]) break;
-                i = (unsigned int)pair_table[p];
-              } /* end doing it twice */
-              energy = best_energy;
-              break;
-
-    default:  E_mm5_available = E2_mm5_available  = INF;
-              E_mm5_occupied  = E2_mm5_occupied   = 0;
-              while(p < j){
-                /* p must have a pairing partner */
-                q  = (int)pair_table[p];
-                /* get type of base pair (p,q) */
-                tt = pair[S[p]][S[q]];
-                if(tt==0) tt=7;
-                if(q_prev + 2 < p){
-                  E_mm5_available = MIN2(E_mm5_available, E_mm5_occupied);
-                  E_mm5_occupied  = E_mm5_available;
-                }
-                if(q_prev2 + 2 < p){
-                  E2_mm5_available  = MIN2(E2_mm5_available, E2_mm5_occupied);
-                  E2_mm5_occupied   = E2_mm5_available;
-                }
-                mm5 = ((SAME_STRAND(p-1,p)) && !pair_table[p-1])  ? S1[p-1] : -1;
-                mm3 = ((SAME_STRAND(q,q+1)) && !pair_table[q+1])  ? S1[q+1] : -1;
-                tmp =                   MIN2(
-                                              E_mm5_occupied  + E_MLstem(tt, -1, mm3, P),
-                                              E_mm5_available + E_MLstem(tt, mm5, mm3, P)
-                                            );
-                tmp   =                 MIN2(tmp, E_mm5_available + E_MLstem(tt, -1, mm3, P));
-                tmp2  =                 MIN2(
-                                              E_mm5_occupied  + E_MLstem(tt, -1, -1, P),
-                                              E_mm5_available + E_MLstem(tt, mm5, -1, P)
-                                            );
-                E_mm5_available =       MIN2(tmp2, E_mm5_available  + E_MLstem(tt, -1, -1, P));
-                E_mm5_occupied  = tmp;
-
-                tmp =                  MIN2(
-                                              E2_mm5_occupied  + E_MLstem(tt, -1, mm3, P),
-                                              E2_mm5_available + E_MLstem(tt, mm5, mm3, P)
-                                            );
-                tmp =                   MIN2(tmp, E2_mm5_available + E_MLstem(tt, -1, mm3, P));
-                tmp2 =                  MIN2(
-                                              E2_mm5_occupied  + E_MLstem(tt, -1, -1, P),
-                                              E2_mm5_available + E_MLstem(tt, mm5, -1, P)
-                                            );
-                E2_mm5_available =      MIN2(tmp2, E2_mm5_available + E_MLstem(tt, -1, -1, P));
-                E2_mm5_occupied = tmp;
-                /* printf("(%d,%d): \n E_o = %d, E_a = %d, E2_o = %d, E2_a = %d\n", p, q, E_mm5_occupied,E_mm5_available,E2_mm5_occupied,E2_mm5_available); */
-                /* seek to the next stem */
-                p = q + 1;
-                q_prev = q_prev2 = q;
-                while (p <= j && !pair_table[p]) p++;
-                u += p - q - 1; /* add unpaired nucleotides */
-              }
-              /* now lets see how we get the minimum including the enclosing stem */
-              type = pair[S[j]][S[i]]; if (type==0) type=7;
-              mm5 = ((SAME_STRAND(j-1,j)) && !pair_table[j-1])  ? S1[j-1] : -1;
-              mm3 = ((SAME_STRAND(i,i+1)) && !pair_table[i+1])  ? S1[i+1] : -1;
-              if(q_prev + 2 < p){
-                E_mm5_available = MIN2(E_mm5_available, E_mm5_occupied);
-                E_mm5_occupied  = E_mm5_available;
-              }
-              if(q_prev2 + 2 < p){
-                E2_mm5_available  = MIN2(E2_mm5_available, E2_mm5_occupied);
-                E2_mm5_occupied   = E2_mm5_available;
-              }
-              energy = MIN2(E_mm5_occupied  + E_MLstem(type, -1, -1, P),
-                            E_mm5_available + E_MLstem(type, mm5, -1, P)
-                          );
-              energy = MIN2(energy, E_mm5_available   + E_MLstem(type, -1, -1, P));
-              energy = MIN2(energy, E2_mm5_occupied   + E_MLstem(type, -1, mm3, P));
-              energy = MIN2(energy, E2_mm5_occupied   + E_MLstem(type, -1, -1, P));
-              energy = MIN2(energy, E2_mm5_available  + E_MLstem(type, mm5, mm3, P));
-              energy = MIN2(energy, E2_mm5_available  + E_MLstem(type, -1, mm3, P));
-              energy = MIN2(energy, E2_mm5_available  + E_MLstem(type, mm5, -1, P));
-              energy = MIN2(energy, E2_mm5_available  + E_MLstem(type, -1, -1, P));
-              break;
-  }/* end switch dangle_model */
-
-  energy += P->MLclosing;
-  /* logarithmic ML loop energy if logML */
-  if(logML && (u>6))
-    energy += 6*P->MLbase+(int)(P->lxc*log((double)u/6.));
-  else
-    energy += (u*P->MLbase);
-
-  return energy;
-}
-
-/*---------------------------------------------------------------------------*/
-
-PUBLIC int loop_energy(short * ptable, short *s, short *s1, int i) {
-  /* compute energy of a single loop closed by base pair (i,j) */
-  int j, type, p,q, energy;
-  short *Sold, *S1old, *ptold;
-
-  ptold=pair_table;   Sold = S;   S1old = S1;
-  pair_table = ptable;   S = s;   S1 = s1;
-
-  if (i==0) { /* evaluate exterior loop */
-    energy = energy_of_extLoop_pt(0,pair_table);
-    pair_table=ptold; S=Sold; S1=S1old;
-    return energy;
-  }
-  j = pair_table[i];
-  if (j<i) nrerror("i is unpaired in loop_energy()");
-  type = pair[S[i]][S[j]];
-  if (type==0) {
-    type=7;
-    if (eos_debug>=0)
-      fprintf(stderr,"WARNING: bases %d and %d (%c%c) can't pair!\n", i, j,
-              Law_and_Order[S[i]],Law_and_Order[S[j]]);
-  }
-  p=i; q=j;
-
-
-  while (pair_table[++p]==0);
-  while (pair_table[--q]==0);
-  if (p>q) { /* Hairpin */
-    char loopseq[8] = "";
-    if (SAME_STRAND(i,j)) {
-      if (j-i-1<7) {
-        int u;
-        for (u=0; i+u<=j; u++) loopseq[u] = Law_and_Order[S[i+u]];
-        loopseq[u] = '\0';
-      }
-      energy = E_Hairpin(j-i-1, type, S1[i+1], S1[j-1], loopseq, P);
-    } else {
-      energy = energy_of_extLoop_pt(cut_in_loop(i), pair_table);
-    }
-  }
-  else if (pair_table[q]!=(short)p) { /* multi-loop */
-    int ii;
-    ii = cut_in_loop(i);
-    energy = (ii==0) ? energy_of_ml_pt(i, pair_table) : energy_of_extLoop_pt(ii, pair_table);
-  }
-  else { /* found interior loop */
-    int type_2;
-    type_2 = pair[S[q]][S[p]];
-    if (type_2==0) {
-      type_2=7;
-      if (eos_debug>=0)
-        fprintf(stderr,"WARNING: bases %d and %d (%c%c) can't pair!\n", p, q,
-                Law_and_Order[S[p]],Law_and_Order[S[q]]);
-    }
-    /* energy += LoopEnergy(i, j, p, q, type, type_2); */
-    if ( SAME_STRAND(i,p) && SAME_STRAND(q,j) )
-      energy = E_IntLoop(p-i-1, j-q-1, type, type_2,
-                          S1[i+1], S1[j-1], S1[p-1], S1[q+1], P);
-    else
-      energy = energy_of_extLoop_pt(cut_in_loop(i), pair_table);
-  }
-
-  pair_table=ptold; S=Sold; S1=S1old;
-  return energy;
-}
-
-/*---------------------------------------------------------------------------*/
-
-
-PUBLIC float energy_of_move(const char *string, const char *structure, int m1, int m2) {
-  int   energy;
-  short *ss, *ss1;
-
-#ifdef _OPENMP
-  if(P == NULL) update_fold_params();
-#else
-  if((init_length<0)||(P==NULL)) update_fold_params();
-#endif
-
-  if (fabs(P->temperature - temperature)>1e-6) update_fold_params();
-
-  if (strlen(structure)!=strlen(string))
-    nrerror("energy_of_struct: string and structure have unequal length");
-
-  /* save the S and S1 pointers in case they were already in use */
-  ss = S; ss1 = S1;
-  S   = encode_sequence(string, 0);
-  S1  = encode_sequence(string, 1);
-
-  pair_table = make_pair_table(structure);
-
-  energy = energy_of_move_pt(pair_table, S, S1, m1, m2);
-
-  free(pair_table);
-  free(S); free(S1);
-  S=ss; S1=ss1;
-  return  (float) energy/100.;
-}
-
-/*---------------------------------------------------------------------------*/
-
-PUBLIC int energy_of_move_pt(short *pt, short *s, short *s1, int m1, int m2) {
-  /*compute change in energy given by move (m1,m2)*/
-  int en_post, en_pre, i,j,k,l, len;
-
-  len = pt[0];
-  k = (m1>0)?m1:-m1;
-  l = (m2>0)?m2:-m2;
-  /* first find the enclosing pair i<k<l<j */
-  for (j=l+1; j<=len; j++) {
-    if (pt[j]<=0) continue; /* unpaired */
-    if (pt[j]<k) break;   /* found it */
-    if (pt[j]>j) j=pt[j]; /* skip substructure */
-    else {
-      fprintf(stderr, "%d %d %d %d ", m1, m2, j, pt[j]);
-      nrerror("illegal move or broken pair table in energy_of_move()");
-    }
-  }
-  i = (j<=len) ? pt[j] : 0;
-  en_pre = loop_energy(pt, s, s1, i);
-  en_post = 0;
-  if (m1<0) { /*it's a delete move */
-    en_pre += loop_energy(pt, s, s1, k);
-    pt[k]=0;
-    pt[l]=0;
-  } else { /* insert move */
-    pt[k]=l;
-    pt[l]=k;
-    en_post += loop_energy(pt, s, s1, k);
-  }
-  en_post += loop_energy(pt, s, s1, i);
-  /*  restore pair table */
-  if (m1<0) {
-    pt[k]=l;
-    pt[l]=k;
-  } else {
-    pt[k]=0;
-    pt[l]=0;
-  }
-  return (en_post - en_pre);
-}
-
-
-
-PRIVATE int cut_in_loop(int i) {
-  /* walk around the loop;  return j pos of pair after cut if
-     cut_point in loop else 0 */
-  int  p, j;
-  p = j = pair_table[i];
-  do {
-    i  = pair_table[p];  p = i+1;
-    while ( pair_table[p]==0 ) p++;
-  } while (p!=j && SAME_STRAND(i,p));
-  return SAME_STRAND(i,p) ? 0 : j;
-}
-
-/*---------------------------------------------------------------------------*/
-
-PRIVATE void make_ptypes(const short *S, const char *structure) {
-  int n,i,j,k,l;
-
-  n=S[0];
-  for (k=1; k<n-TURN; k++)
-    for (l=1; l<=2; l++) {
-      int type,ntype=0,otype=0;
-      i=k; j = i+TURN+l; if (j>n) continue;
-      type = pair[S[i]][S[j]];
-      while ((i>=1)&&(j<=n)) {
-        if ((i>1)&&(j<n)) ntype = pair[S[i-1]][S[j+1]];
-        if (noLonelyPairs && (!otype) && (!ntype))
-          type = 0; /* i.j can only form isolated pairs */
-        ptype[indx[j]+i] = (char) type;
-        otype =  type;
-        type  = ntype;
-        i--; j++;
-      }
-    }
-
-  if (struct_constrained && (structure != NULL))
-    constrain_ptypes(structure, (unsigned int)n, ptype, BP, TURN, 0);
-}
-
-PUBLIC void assign_plist_from_db(plist **pl, const char *struc, float pr){
-  /* convert bracket string to plist */
-  short *pt;
-  int i, k = 0, size, n;
-  plist *gpl, *ptr;
-
-  size  = strlen(struc);
-  n     = 2;
-
-  pt  = make_pair_table(struc);
-  *pl = (plist *)space(n*size*sizeof(plist));
-  for(i = 1; i < size; i++){
-    if(pt[i]>i){
-      (*pl)[k].i      = i;
-      (*pl)[k].j      = pt[i];
-      (*pl)[k].p      = pr;
-      (*pl)[k++].type = 0;
-    }
-  }
-
-  gpl = get_plist_gquad_from_db(struc, pr);
-  for(ptr = gpl; ptr->i != 0; ptr++){
-    if (k == n * size - 1){
-      n *= 2;
-      *pl = (plist *)xrealloc(*pl, n * size * sizeof(plist));
-    }
-    (*pl)[k].i      = ptr->i;
-    (*pl)[k].j      = ptr->j;
-    (*pl)[k].p       = ptr->p;
-    (*pl)[k++].type = ptr->type;
-  }
-  free(gpl);
-
-  (*pl)[k].i      = 0;
-  (*pl)[k].j      = 0;
-  (*pl)[k].p      = 0.;
-  (*pl)[k++].type = 0.;
-  free(pt);
-  *pl = (plist *)xrealloc(*pl, k * sizeof(plist));
-}
-
-
-/*###########################################*/
-/*# deprecated functions below              #*/
-/*###########################################*/
-
-PUBLIC int HairpinE(int size, int type, int si1, int sj1, const char *string) {
-  int energy;
-
-  energy = (size <= 30) ? P->hairpin[size] :
-    P->hairpin[30]+(int)(P->lxc*log((size)/30.));
-
-  if (tetra_loop){
-    if (size == 4) { /* check for tetraloop bonus */
-      char tl[7]={0}, *ts;
-      strncpy(tl, string, 6);
-      if ((ts=strstr(P->Tetraloops, tl)))
-        return (P->Tetraloop_E[(ts - P->Tetraloops)/7]);
-    }
-    if (size == 6) {
-      char tl[9]={0}, *ts;
-      strncpy(tl, string, 8);
-      if ((ts=strstr(P->Hexaloops, tl)))
-        return (energy = P->Hexaloop_E[(ts - P->Hexaloops)/9]);
-    }
-    if (size == 3) {
-      char tl[6]={0,0,0,0,0,0}, *ts;
-      strncpy(tl, string, 5);
-      if ((ts=strstr(P->Triloops, tl))) {
-        return (P->Triloop_E[(ts - P->Triloops)/6]);
-      }
-      if (type>2)  /* neither CG nor GC */
-        energy += P->TerminalAU; /* penalty for closing AU GU pair IVOO??
-                                    sind dass jetzt beaunuesse oder mahlnuesse (vorzeichen?)*/
-      return energy;
-    }
-   }
-   energy += P->mismatchH[type][si1][sj1];
-
-  return energy;
-}
-
-/*---------------------------------------------------------------------------*/
-
-PUBLIC int oldLoopEnergy(int i, int j, int p, int q, int type, int type_2) {
-  /* compute energy of degree 2 loop (stack bulge or interior) */
-  int n1, n2, m, energy;
-  n1 = p-i-1;
-  n2 = j-q-1;
-
-  if (n1>n2) { m=n1; n1=n2; n2=m; } /* so that n2>=n1 */
-
-  if (n2 == 0)
-    energy = P->stack[type][type_2];   /* stack */
-
-  else if (n1==0) {                  /* bulge */
-    energy = (n2<=MAXLOOP)?P->bulge[n2]:
-      (P->bulge[30]+(int)(P->lxc*log(n2/30.)));
-
-#if STACK_BULGE1
-    if (n2==1) energy+=P->stack[type][type_2];
-#endif
-  } else {                           /* interior loop */
-
-    if ((n1+n2==2)&&(james_rule))
-      /* special case for loop size 2 */
-      energy = P->int11[type][type_2][S1[i+1]][S1[j-1]];
-    else {
-      energy = (n1+n2<=MAXLOOP)?(P->internal_loop[n1+n2]):
-        (P->internal_loop[30]+(int)(P->lxc*log((n1+n2)/30.)));
-
-#if NEW_NINIO
-      energy += MIN2(MAX_NINIO, (n2-n1)*P->ninio[2]);
-#else
-      m       = MIN2(4, n1);
-      energy += MIN2(MAX_NINIO,((n2-n1)*P->ninio[m]));
-#endif
-      energy += P->mismatchI[type][S1[i+1]][S1[j-1]]+
-        P->mismatchI[type_2][S1[q+1]][S1[p-1]];
-    }
-  }
-  return energy;
-}
-
-/*--------------------------------------------------------------------------*/
-
-PUBLIC int LoopEnergy(int n1, int n2, int type, int type_2,
-                      int si1, int sj1, int sp1, int sq1) {
-  /* compute energy of degree 2 loop (stack bulge or interior) */
-  int nl, ns, energy;
-
-  if (n1>n2) { nl=n1; ns=n2;}
-  else {nl=n2; ns=n1;}
-
-  if (nl == 0)
-    return P->stack[type][type_2];    /* stack */
-
-  if (ns==0) {                       /* bulge */
-    energy = (nl<=MAXLOOP)?P->bulge[nl]:
-      (P->bulge[30]+(int)(P->lxc*log(nl/30.)));
-    if (nl==1) energy += P->stack[type][type_2];
-    else {
-      if (type>2) energy += P->TerminalAU;
-      if (type_2>2) energy += P->TerminalAU;
-    }
-    return energy;
-  }
-  else {                             /* interior loop */
-    if (ns==1) {
-      if (nl==1)                     /* 1x1 loop */
-        return P->int11[type][type_2][si1][sj1];
-      if (nl==2) {                   /* 2x1 loop */
-        if (n1==1)
-          energy = P->int21[type][type_2][si1][sq1][sj1];
-        else
-          energy = P->int21[type_2][type][sq1][si1][sp1];
-        return energy;
-      }
-        else {  /* 1xn loop */
-        energy = (nl+1<=MAXLOOP)?(P->internal_loop[nl+1]):
-        (P->internal_loop[30]+(int)(P->lxc*log((nl+1)/30.)));
-        energy += MIN2(MAX_NINIO, (nl-ns)*P->ninio[2]);
-        energy += P->mismatch1nI[type][si1][sj1]+
-        P->mismatch1nI[type_2][sq1][sp1];
-        return energy;
-        }
-    }
-    else if (ns==2) {
-      if(nl==2)      {   /* 2x2 loop */
-        return P->int22[type][type_2][si1][sp1][sq1][sj1];}
-      else if (nl==3)  { /* 2x3 loop */
-        energy = P->internal_loop[5]+P->ninio[2];
-        energy += P->mismatch23I[type][si1][sj1]+
-          P->mismatch23I[type_2][sq1][sp1];
-        return energy;
-      }
-
-    }
-    { /* generic interior loop (no else here!)*/
-      energy = (n1+n2<=MAXLOOP)?(P->internal_loop[n1+n2]):
-        (P->internal_loop[30]+(int)(P->lxc*log((n1+n2)/30.)));
-
-      energy += MIN2(MAX_NINIO, (nl-ns)*P->ninio[2]);
-
-      energy += P->mismatchI[type][si1][sj1]+
-        P->mismatchI[type_2][sq1][sp1];
-    }
-  }
-  return energy;
-}
-
-PRIVATE int ML_Energy(int i, int is_extloop) {
-  /* i is the 5'-base of the closing pair (or 0 for exterior loop)
-     loop is scored as ML if extloop==0 else as exterior loop
-
-     since each helix can coaxially stack with at most one of its
-     neighbors we need an auxiliarry variable  cx_energy
-     which contains the best energy given that the last two pairs stack.
-     energy  holds the best energy given the previous two pairs do not
-     stack (i.e. the two current helices may stack)
-     We don't allow the last helix to stack with the first, thus we have to
-     walk around the Loop twice with two starting points and take the minimum
-  */
-
-  int energy, cx_energy, best_energy=INF;
-  int i1, j, p, q, u, x, type, count;
-  int mlintern[NBPAIRS+1], mlclosing, mlbase;
-  int dangle_model = P->model_details.dangles;
-
-  if (is_extloop) {
-    for (x = 0; x <= NBPAIRS; x++)
-      mlintern[x] = P->MLintern[x]-P->MLintern[1]; /* 0 or TerminalAU */
-    mlclosing = mlbase = 0;
-  } else {
-    for (x = 0; x <= NBPAIRS; x++) mlintern[x] = P->MLintern[x];
-    mlclosing = P->MLclosing; mlbase = P->MLbase;
-  }
-
-  /*  as we do not only have dangling end but also mismatch contributions,
-  **  we do this a bit different to previous implementations
-  */
-  if(is_extloop){
-    energy = 0;
-    i1  = i;
-    p   = i+1;
-
-    int E_mm5_available, E_mm5_occupied;
-    /* find out if we may have 5' mismatch for the next stem */
-    while (p <= (int)pair_table[0] && pair_table[p]==0) p++;
-    /* get position of pairing partner */
-    if(p < (int)pair_table[0]){
-        E_mm5_occupied  = (p - i - 1 > 0) ? INF : 0;
-        E_mm5_available = (p - i - 1 > 0) ? 0 : INF;
-    }
-
-    if(p < (int)pair_table[0])
-      do{
-        int tt;
-        /* p must have a pairing partner */
-        q  = (int)pair_table[p];
-        /* get type of base pair (p,q) */
-        tt = pair[S[p]][S[q]];
-        if(tt==0) tt=7;
-
-        int mm5 = ((SAME_STRAND(p-1,p)) && (p>1)) ? S1[p-1]: -1;
-        int mm3 = ((SAME_STRAND(q,q+1)) && (q<(unsigned int)pair_table[0])) ? S1[q+1]: -1;
-
-        switch(dangle_model){
-          /* dangle_model == 0 */
-          case 0: energy += E_ExtLoop(tt, -1, -1, P);
-                  break;
-          /* dangle_model == 1 */
-          case 1: {
-                    /* check for unpaired nucleotide 3' to the current stem */
-                    int u3 = ((q < pair_table[0]) && (pair_table[q+1] == 0)) ? 1 : 0;
-                    if(pair_table[p-1] != 0) mm5 = -1;
-
-                    if(!u3){
-                      mm3 = -1;
-                      E_mm5_occupied  = MIN2(
-                                              E_mm5_occupied  + E_ExtLoop(tt, -1, -1, P),
-                                              E_mm5_available + E_ExtLoop(tt, mm5, -1, P)
-                                            );
-                      E_mm5_available = E_mm5_occupied;
-                    }
-                    else{
-                      E_mm5_occupied  = MIN2(
-                                              E_mm5_occupied  + E_ExtLoop(tt, -1, mm3, P),
-                                              E_mm5_available + E_ExtLoop(tt, mm5, mm3, P)
-                                            );
-                      E_mm5_available = MIN2(
-                                              E_mm5_occupied  + E_ExtLoop(tt, -1, -1, P),
-                                              E_mm5_available + E_ExtLoop(tt, mm5, -1, P)
-                                            );
-                    }
-                  }
-                  break;
-
-          /* the beloved case dangle_model == 2 */
-          case 2: energy += E_ExtLoop(tt, mm5, mm3, P);
-                  break;
-
-          /* dangle_model == 3 a.k.a. helix stacking */
-          case 3: break;
-
-        } /* end switch dangle_model */
-
-        /* seek to the next stem */
-        p = q + 1;
-        while (p <= (int)pair_table[0] && pair_table[p]==0) p++;
-        if(p == (int)pair_table[0] + 1){
-          if(dangle_model == 1)
-            energy = (p > q + 1) ? E_mm5_occupied : E_mm5_available;
-          q = 0;
-          break;
-        }
-      } while(q != i);
-  }
-  /* not exterior loop */
-  else{
-    for (count=0; count<2; count++) { /* do it twice */
-      int ld5 = 0; /* 5' dangle energy on prev pair (type) */
-      if ( i==0 ) {
-        j = (unsigned int)pair_table[0]+1;
-        type = 0;  /* no pair */
-      }
-      else {
-        j = (unsigned int)pair_table[i];
-        type = pair[S[j]][S[i]]; if (type==0) type=7;
-
-        if (dangle_model==3) { /* prime the ld5 variable */
-          if (SAME_STRAND(j-1,j)) {
-            ld5 = P->dangle5[type][S1[j-1]];
-            if ((p=(unsigned int)pair_table[j-2]) && SAME_STRAND(j-2, j-1))
-                if (P->dangle3[pair[S[p]][S[j-2]]][S1[j-1]]<ld5) ld5 = 0;
-          }
-        }
-      }
-      i1=i; p = i+1; u=0;
-      energy = 0; cx_energy=INF;
-      do { /* walk around the multi-loop */
-        int tt, new_cx = INF;
-
-        /* hop over unpaired positions */
-        while (p <= (unsigned int)pair_table[0] && pair_table[p]==0) p++;
-
-        /* memorize number of unpaired positions */
-        u += p-i1-1;
-        /* get position of pairing partner */
-        if ( p == (unsigned int)pair_table[0]+1 ){
-          q = 0;tt = 0; /* virtual root pair */
-        } else {
-        q  = (unsigned int)pair_table[p];
-          /* get type of base pair P->q */
-        tt = pair[S[p]][S[q]]; if (tt==0) tt=7;
-        }
-
-        energy += mlintern[tt];
-        cx_energy += mlintern[tt];
-
-        if (dangle_model) {
-          int dang5=0, dang3=0, dang;
-          if ((SAME_STRAND(p-1,p))&&(p>1))
-            dang5=P->dangle5[tt][S1[p-1]];      /* 5'dangle of pq pair */
-          if ((SAME_STRAND(i1,i1+1))&&(i1<(unsigned int)S[0]))
-            dang3 = P->dangle3[type][S1[i1+1]]; /* 3'dangle of previous pair */
-
-          switch (p-i1-1) {
-          case 0: /* adjacent helices */
-            if (dangle_model==2)
-              energy += dang3+dang5;
-            else if (dangle_model==3 && i1!=0) {
-              if (SAME_STRAND(i1,p)) {
-                new_cx = energy + P->stack[rtype[type]][rtype[tt]];
-                /* subtract 5'dangle and TerminalAU penalty */
-                new_cx += -ld5 - mlintern[tt]-mlintern[type]+2*mlintern[1];
-              }
-              ld5=0;
-              energy = MIN2(energy, cx_energy);
-            }
-            break;
-          case 1: /* 1 unpaired base between helices */
-            dang = (dangle_model==2)?(dang3+dang5):MIN2(dang3, dang5);
-            if (dangle_model==3) {
-              energy = energy +dang; ld5 = dang - dang3;
-              /* may be problem here: Suppose
-                 cx_energy>energy, cx_energy+dang5<energy
-                 and the following helices are also stacked (i.e.
-                 we'll subtract the dang5 again */
-              if (cx_energy+dang5 < energy) {
-                energy = cx_energy+dang5;
-                ld5 = dang5;
-              }
-              new_cx = INF;  /* no coax stacking with mismatch for now */
-            } else
-              energy += dang;
-            break;
-          default: /* many unpaired base between helices */
-            energy += dang5 +dang3;
-            if (dangle_model==3) {
-              energy = MIN2(energy, cx_energy + dang5);
-              new_cx = INF;  /* no coax stacking possible */
-              ld5 = dang5;
-            }
-          }
-          type = tt;
-        }
-        if (dangle_model==3) cx_energy = new_cx;
-        i1 = q; p=q+1;
-      } while (q!=i);
-      best_energy = MIN2(energy, best_energy); /* don't use cx_energy here */
-      /* fprintf(stderr, "%6.2d\t", energy); */
-      if (dangle_model!=3 || is_extloop) break;  /* may break cofold with co-ax */
-      /* skip a helix and start again */
-      while (pair_table[p]==0) p++;
-      if (i == (unsigned int)pair_table[p]) break;
-      i = (unsigned int)pair_table[p];
-    }
-    energy = best_energy;
-    energy += mlclosing;
-    /* logarithmic ML loop energy if logML */
-    if ( (!is_extloop) && logML && (u>6) )
-      energy += 6*mlbase+(int)(P->lxc*log((double)u/6.));
-    else
-      energy += mlbase*u;
-    /* fprintf(stderr, "\n"); */
-  }
-  return energy;
-}
-
-PUBLIC void initialize_fold(int length){
-  /* DO NOTHING */
-}
-
-PUBLIC float energy_of_struct(const char *string, const char *structure){
-  return energy_of_structure(string, structure, eos_debug);
-}
-
-PUBLIC int energy_of_struct_pt(const char *string, short * ptable, short *s, short *s1){
-  return energy_of_structure_pt(string, ptable, s, s1, eos_debug);
-}
-
-PUBLIC float energy_of_circ_struct(const char *string, const char *structure){
-  return energy_of_circ_structure(string, structure, eos_debug);
-}
-
diff --git a/cbits/fold_vars.c b/cbits/fold_vars.c
deleted file mode 100644
--- a/cbits/fold_vars.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Last changed Time-stamp: <2008-06-27 17:21:42 ivo> */
-
-/**
-*** \file fold_vars.c
-*** global variables to change behaviour of folding routines<BR>
-*** Also there are some functions that make the live easier when
-*** using functions of the Vienna RNA package
-**/
-#include <string.h>
-#include <stdio.h>
-#include "fold_vars.h"
-
-int         circ = 0;
-
-int         noGU = 0;             /* GU not allowed at all */
-
-int         no_closingGU = 0;     /* GU allowed only inside stacks */
-
-int         tetra_loop = 1;       /* Fold with specially stable 4-loops */
-
-int         energy_set = 0;       /* 0 = BP; 1=any with GC; 2=any with AU parameters */
-
-int         dangles = 2;          /* use dangling end energies */
-
-char        *nonstandards = (char *)0;  /* contains allowed non standard bases */
-
-double      temperature = 37.0;
-
-int         james_rule = 1;       /* interior loops of size 2 get energy 0.8Kcal and
-                                    no mismatches (no longer used) */
-
-int         oldAliEn = 0;         /* use old alifold-energies (without removing gaps) */
-
-int         ribo = 0;             /* use ribosum instead of classic covariance term */
-
-char        *RibosumFile = NULL;  /* TODO: compile ribosums into program
-                                    Warning: this variable will vanish */
-
-int         csv = 0;              /*generate comma seperated output*/
-
-bondT       *base_pair = NULL;
-
-FLT_OR_DBL  *pr = NULL;           /* base pairing prob. matrix */
-
-int         *iindx = NULL;        /* pr[i,j] -> pr[iindx[i]-j] */
-
-double      pf_scale = -1;        /* scaling factor to avoid floating point overflows */
-
-int         fold_constrained = 0; /* fold with constraints */
-
-int         do_backtrack = 1;     /* calculate pair prob matrix in part_func() */
-
-int         noLonelyPairs = 0;    /* avoid helices of length 1 */
-
-char        backtrack_type = 'F'; /* 'C' require (1,N) to be bonded;
-                                    'M' seq is part of s multi loop */
-
-int         *cut_points;
-
-int         *strand;
-
-int         gquad = 0;            /* consider g-qudruplexes in the calculations */
-
-PUBLIC char * option_string(void){
-  static char options[100];
-  *options = '\0';
-  if (noGU) strcat(options, "-noGU ");
-  if (no_closingGU) strcat(options, "-noCloseGU ");
-  if (!tetra_loop) strcat(options, "-4 ");
-  if (noLonelyPairs) strcat(options, "-noLP ");
-  if (fold_constrained) strcat(options, "-C ");
-  if (dangles!=1) sprintf(options+strlen(options), "-d%d ", dangles);
-  if (temperature!=37.0)
-    sprintf(options+strlen(options), "-T %f ", temperature);
-  return options;
-}
-
-PUBLIC void set_model_details(model_detailsT *md){
-  if(md){
-    md->dangles     = dangles;
-    md->special_hp  = tetra_loop;
-    md->noLP        = noLonelyPairs;
-    md->noGU        = noGU;
-    md->noGUclosure = no_closingGU;
-    md->logML       = logML;
-    md->gquad       = gquad;
-  }
-}
diff --git a/cbits/gquad.c b/cbits/gquad.c
deleted file mode 100644
--- a/cbits/gquad.c
+++ /dev/null
@@ -1,1043 +0,0 @@
-/*
-  gquad.c
-
-  Ronny Lorenz 2012
-
-  Vienna RNA package
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#include "config.h" // chzs
-#include "fold_vars.h"
-#include "data_structures.h"
-#include "energy_const.h"
-#include "utils.h"
-#include "aln_util.h"
-#include "gquad.h"
-
-#ifndef INLINE
-#ifdef __GNUC__
-# define INLINE inline
-#else
-# define INLINE
-#endif
-#endif
-
-/**
- *  Use this macro to loop over each G-quadruplex
- *  delimited by a and b within the subsequence [c,d]
- */
-#define FOR_EACH_GQUAD(a, b, c, d)  \
-          for((a) = (d) - VRNA_GQUAD_MIN_BOX_SIZE + 1; (a) >= (c); (a)--)\
-            for((b) = (a) + VRNA_GQUAD_MIN_BOX_SIZE - 1;\
-                (b) <= MIN2((d), (a) + VRNA_GQUAD_MAX_BOX_SIZE - 1);\
-                (b)++)
-
-/**
- *  This macro does almost the same as FOR_EACH_GQUAD() but keeps
- *  the 5' delimiter fixed. 'b' is the 3' delimiter of the gquad,
- *  for gquads within subsequence [a,c] that have 5' delimiter 'a'
- */
-#define FOR_EACH_GQUAD_AT(a, b, c)  \
-          for((b) = (a) + VRNA_GQUAD_MIN_BOX_SIZE - 1;\
-              (b) <= MIN2((c), (a) + VRNA_GQUAD_MAX_BOX_SIZE - 1);\
-              (b)++)
-
-
-/*
-#################################
-# PRIVATE FUNCTION DECLARATIONS #
-#################################
-*/
-
-PRIVATE INLINE
-int *
-get_g_islands(short *S);
-
-PRIVATE INLINE
-int *
-get_g_islands_sub(short *S, int i, int j);
-
-/**
- *  IMPORTANT:
- *  If you don't know how to use this function, DONT'T USE IT!
- *
- *  The function pointer this function takes as argument is
- *  used for individual calculations with each g-quadruplex
- *  delimited by [i,j].
- *  The function it points to always receives as first 3 arguments
- *  position i, the stack size L and an array l[3] containing the
- *  individual linker sizes.
- *  The remaining 4 (void *) pointers of the callback function receive
- *  the parameters 'data', 'P', 'aux1' and 'aux2' and thus may be
- *  used to pass whatever data you like to.
- *  As the names of those parameters suggest the convention is that
- *  'data' should be used as a pointer where data is stored into,
- *  e.g the MFE or PF and the 'P' parameter should actually be a
- *  'paramT *' or 'pf_paramT *' type.
- *  However, what you actually pass obviously depends on the
- *  function the pointer is pointing to.
- *
- *  Although all of this may look like an overkill, it is found
- *  to be almost as fast as implementing g-quadruplex enumeration
- *  in each individual scenario, i.e. code duplication.
- *  Using this function, however, ensures that all g-quadruplex
- *  enumerations are absolutely identical.
- */
-PRIVATE
-void
-process_gquad_enumeration(int *gg,
-                          int i,
-                          int j,
-                          void (*f)(int, int, int *,
-                                    void *, void *, void *, void *),
-                          void *data,
-                          void *P,
-                          void *aux1,
-                          void *aux2);
-
-/**
- *  MFE callback for process_gquad_enumeration()
- */
-PRIVATE
-void
-gquad_mfe(int i,
-          int L,
-          int *l,
-          void *data,
-          void *P,
-          void *NA,
-          void *NA2);
-
-PRIVATE
-void
-gquad_mfe_pos(int i,
-              int L,
-              int *l,
-              void *data,
-              void *P,
-              void *Lmfe,
-              void *lmfe);
-
-PRIVATE
-void
-gquad_pos_exhaustive( int i,
-                      int L,
-                      int *l,
-                      void *data,
-                      void *P,
-                      void *Lex,
-                      void *lex);
-
-/**
- * Partition function callback for process_gquad_enumeration()
- */
-PRIVATE
-void
-gquad_pf( int i,
-          int L,
-          int *l,
-          void *data,
-          void *P,
-          void *NA,
-          void *NA2);
-
-/**
- * Partition function callback for process_gquad_enumeration()
- * in contrast to gquad_pf() it stores the stack size L and
- * the linker lengths l[3] of the g-quadruplex that dominates
- * the interval [i,j]
- * (FLT_OR_DBL *)data must be 0. on entry
- */
-PRIVATE
-void
-gquad_pf_pos( int i,
-              int L,
-              int *l,
-              void *data,
-              void *pf,
-              void *Lmax,
-              void *lmax);
-
-/**
- * MFE (alifold) callback for process_gquad_enumeration()
- */
-PRIVATE
-void
-gquad_mfe_ali(int i,
-              int L,
-              int *l,
-              void *data,
-              void *P,
-              void *S,
-              void *n_seq);
-
-/**
- * MFE (alifold) callback for process_gquad_enumeration()
- * with seperation of free energy and penalty contribution
- */
-PRIVATE
-void
-gquad_mfe_ali_en( int i,
-                  int L,
-                  int *l,
-                  void *data,
-                  void *P,
-                  void *S,
-                  void *n_seq);
-
-PRIVATE
-void
-gquad_interact( int i,
-                int L,
-                int *l,
-                void *data,
-                void *pf,
-                void *index,
-                void *NA2);
-
-PRIVATE
-void
-gquad_count(int i,
-            int L,
-            int *l,
-            void *data,
-            void *NA,
-            void *NA2,
-            void *NA3);
-
-PRIVATE
-void
-gquad_count_layers( int i,
-                    int L,
-                    int *l,
-                    void *data,
-                    void *NA,
-                    void *NA2,
-                    void *NA3);
-
-/* other useful static functions */
-
-PRIVATE
-int
-gquad_ali_penalty(int i,
-                  int L,
-                  int l[3],
-                  const short **S,
-                  paramT *P);
-
-/*
-#########################################
-# BEGIN OF PUBLIC FUNCTION DEFINITIONS  #
-#      (all available in RNAlib)        #
-#########################################
-*/
-
-/********************************
-  Here are the G-quadruplex energy
-  contribution functions
-*********************************/
-
-PUBLIC int E_gquad( int L,
-                    int l[3],
-                    paramT *P){
-
-  int i, c = INF;
-
-  for(i=0;i<3;i++){
-    if(l[i] > VRNA_GQUAD_MAX_LINKER_LENGTH) return c;
-    if(l[i] < VRNA_GQUAD_MIN_LINKER_LENGTH) return c;
-  }
-  if(L > VRNA_GQUAD_MAX_STACK_SIZE) return c;
-  if(L < VRNA_GQUAD_MIN_STACK_SIZE) return c;
-  
-  gquad_mfe(0, L, l,
-            (void *)(&c),
-            (void *)P,
-            NULL,
-            NULL);
-  return c;
-}
-
-PUBLIC FLT_OR_DBL exp_E_gquad(int L,
-                              int l[3],
-                              pf_paramT *pf){
-
-  int i;
-  FLT_OR_DBL q = 0.;
-
-  for(i=0;i<3;i++){
-    if(l[i] > VRNA_GQUAD_MAX_LINKER_LENGTH) return q;
-    if(l[i] < VRNA_GQUAD_MIN_LINKER_LENGTH) return q;
-  }
-  if(L > VRNA_GQUAD_MAX_STACK_SIZE) return q;
-  if(L < VRNA_GQUAD_MIN_STACK_SIZE) return q;
-
-  gquad_pf( 0, L, l,
-            (void *)(&q),
-            (void *)pf,
-            NULL,
-            NULL);
-  return q;
-}
-
-PUBLIC int E_gquad_ali( int i,
-                        int L,
-                        int l[3],
-                        const short **S,
-                        int n_seq,
-                        paramT *P){
-
-  int en[2];
-  E_gquad_ali_en(i, L, l, S, n_seq, en, P);
-  return en[0] + en[1];
-}
-
-
-PUBLIC void E_gquad_ali_en( int i,
-                            int L,
-                            int l[3],
-                            const short **S,
-                            int n_seq,
-                            int en[2],
-                            paramT *P){
-
-  int j;
-  en[0] = en[1] = INF;
-
-  for(j=0;j<3;j++){
-    if(l[j] > VRNA_GQUAD_MAX_LINKER_LENGTH) return;
-    if(l[j] < VRNA_GQUAD_MIN_LINKER_LENGTH) return;
-  }
-  if(L > VRNA_GQUAD_MAX_STACK_SIZE) return;
-  if(L < VRNA_GQUAD_MIN_STACK_SIZE) return;
-
-  gquad_mfe_ali_en( i, L, l,
-                    (void *)(&(en[0])),
-                    (void *)P,
-                    (void *)S,
-                    (void *)(&n_seq));
-}
-
-/********************************
-  Now, the triangular matrix
-  generators for the G-quadruplex
-  contributions are following
-*********************************/
-
-PUBLIC int *get_gquad_matrix(short *S, paramT *P){
-
-  int n, size, i, j, *gg, *my_index, *data;
-
-  n         = S[0];
-  my_index  = get_indx(n);
-  gg        = get_g_islands(S);
-  size      = (n * (n+1))/2 + 2;
-  data      = (int *)space(sizeof(int) * size);
-
-  /* prefill the upper triangular matrix with INF */
-  for(i = 0; i < size; i++) data[i] = INF;
-
-  FOR_EACH_GQUAD(i, j, 1, n){
-    process_gquad_enumeration(gg, i, j,
-                              &gquad_mfe,
-                              (void *)(&(data[my_index[j]+i])),
-                              (void *)P,
-                              NULL,
-                              NULL);
-  }
-
-  free(my_index);
-  free(gg);
-  return data;
-}
-
-PUBLIC FLT_OR_DBL *get_gquad_pf_matrix( short *S,
-                                        FLT_OR_DBL *scale,
-                                        pf_paramT *pf){
-
-  int n, size, *gg, i, j, *my_index;
-  FLT_OR_DBL *data;
-
-
-  n         = S[0];
-  size      = (n * (n+1))/2 + 2;
-  data      = (FLT_OR_DBL *)space(sizeof(FLT_OR_DBL) * size);
-  gg        = get_g_islands(S);
-  my_index  = get_iindx(n);
-
-  FOR_EACH_GQUAD(i, j, 1, n){
-    process_gquad_enumeration(gg, i, j,
-                              &gquad_pf,
-                              (void *)(&(data[my_index[i]-j])),
-                              (void *)pf,
-                              NULL,
-                              NULL);
-    data[my_index[i]-j] *= scale[j-i+1];
-  }
-
-  free(my_index);
-  free(gg);
-  return data;
-}
-
-PUBLIC int *get_gquad_ali_matrix( short *S_cons,
-                                  short **S,
-                                  int n_seq,
-                                  paramT *P){
-
-  int n, size, *data, *gg;
-  int i, j, *my_index;
-
-
-  n         = S[0][0];
-  size      = (n * (n+1))/2 + 2;
-  data      = (int *)space(sizeof(int) * size);
-  gg        = get_g_islands(S_cons);
-  my_index  = get_indx(n);
-
-  /* prefill the upper triangular matrix with INF */
-  for(i=0;i<size;i++) data[i] = INF;
-
-  FOR_EACH_GQUAD(i, j, 1, n){
-    process_gquad_enumeration(gg, i, j,
-                              &gquad_mfe_ali,
-                              (void *)(&(data[my_index[j]+i])),
-                              (void *)P,
-                              (void *)S,
-                              (void *)(&n_seq));
-  }
-
-  free(my_index);
-  free(gg);
-  return data;
-}
-
-PUBLIC int **get_gquad_L_matrix(short *S,
-                                int start,
-                                int maxdist,
-                                int **g,
-                                paramT *P){
-
-  int **data;
-  int n, i, j, k, l, *gg;
-  
-  n   = S[0];
-  gg  = get_g_islands_sub(S, start, MIN2(n, start + maxdist + 4));
-
-  if(g){ /* we just update the gquadruplex contribution for the current
-            start and rotate the rest */
-    data = g;
-    /* we re-use the memory allocated previously */
-    data[start] = data[start + maxdist + 5];
-    data[start + maxdist + 5] = NULL;
-
-    /* prefill with INF */
-    for(i = 0; i < maxdist + 5; i++)
-      data[start][i] = INF;
-
-    /*  now we compute contributions for all gquads with 5' delimiter at
-        position 'start'
-    */
-    FOR_EACH_GQUAD_AT(start, j, start + maxdist + 4){
-      process_gquad_enumeration(gg, start, j,
-                                &gquad_mfe,
-                                (void *)(&(data[start][j-start])),
-                                (void *)P,
-                                NULL,
-                                NULL);
-    }
-
-  } else { /* create a new matrix from scratch since this is the first
-              call to this function */
-
-    /* allocate memory and prefill with INF */
-    data = (int **) space(sizeof(int *) * (n+1));
-    for(k = n; (k>n-maxdist-5) && (k>=0); k--){
-      data[k] = (int *) space(sizeof(int)*(maxdist+5));
-      for(i = 0; i < maxdist+5; i++) data[k][i] = INF;
-    }
-    
-    /* compute all contributions for the gquads in this interval */
-    FOR_EACH_GQUAD(i, j, n - maxdist - 4, n){
-      process_gquad_enumeration(gg, i, j,
-                                &gquad_mfe,
-                                (void *)(&(data[i][j-i])),
-                                (void *)P,
-                                NULL,
-                                NULL);
-    }
-  }
-
-  gg += start - 1;
-  free(gg);
-  return data;
-}
-
-PUBLIC plist *get_plist_gquad_from_db(const char *structure, float pr){
-  int x, size, actual_size, L, n, ge, ee, gb, l[3];
-  plist *pl;
-
-  actual_size = 0;
-  ge          = 0;
-  n           = 2;
-  size        = strlen(structure);
-  pl          = (plist *)space(n*size*sizeof(plist));
-
-  while((ee = parse_gquad(structure + ge, &L, l)) > 0){
-    ge += ee;
-    gb = ge - L*4 - l[0] - l[1] - l[2] + 1;
-    /* add pseudo-base pair encloding gquad */
-    for(x = 0; x < L; x++){
-      if (actual_size >= n * size - 5){
-        n *= 2;
-        pl = (plist *)xrealloc(pl, n * size * sizeof(plist));
-      }
-      pl[actual_size].i = gb + x;
-      pl[actual_size].j = ge + x - L + 1;
-      pl[actual_size].p = pr;
-      pl[actual_size++].type = 0;
-
-      pl[actual_size].i = gb + x;
-      pl[actual_size].j = gb + x + l[0] + L;
-      pl[actual_size].p = pr;
-      pl[actual_size++].type = 0;
-
-      pl[actual_size].i = gb + x + l[0] + L;
-      pl[actual_size].j = ge + x - 2*L - l[2] + 1;
-      pl[actual_size].p = pr;
-      pl[actual_size++].type = 0;
-
-      pl[actual_size].i = ge + x - 2*L - l[2] + 1;
-      pl[actual_size].j = ge + x - L + 1;
-      pl[actual_size].p = pr;
-      pl[actual_size++].type = 0;
-    }
-  } 
-
-  pl[actual_size].i = pl[actual_size].j = 0;
-  pl[actual_size++].p = 0;
-  pl = (plist *)xrealloc(pl, actual_size * sizeof(plist));
-  return pl;
-}
-
-PUBLIC void get_gquad_pattern_mfe(short *S,
-                                  int i,
-                                  int j,
-                                  paramT *P,
-                                  int *L,
-                                  int l[3]){
-
-  int *gg = get_g_islands_sub(S, i, j);
-  int c = INF;
-
-  process_gquad_enumeration(gg, i, j,
-                            &gquad_mfe_pos,
-                            (void *)(&c),
-                            (void *)P,
-                            (void *)L,
-                            (void *)l);
-
-  gg += i - 1;
-  free(gg);
-}
-
-PUBLIC void
-get_gquad_pattern_exhaustive( short *S,
-                              int i,
-                              int j,
-                              paramT *P,
-                              int *L,
-                              int *l,
-                              int threshold){
-
-  int *gg = get_g_islands_sub(S, i, j);
-
-  process_gquad_enumeration(gg, i, j,
-                            &gquad_pos_exhaustive,
-                            (void *)(&threshold),
-                            (void *)P,
-                            (void *)L,
-                            (void *)l);
-
-  gg += i - 1;
-  free(gg);
-}
-
-PUBLIC void get_gquad_pattern_pf( short *S,
-                                  int i,
-                                  int j,
-                                  pf_paramT *pf,
-                                  int *L,
-                                  int l[3]){
-
-  int *gg = get_g_islands_sub(S, i, j);
-  FLT_OR_DBL q = 0.;
-
-  process_gquad_enumeration(gg, i, j,
-                            &gquad_pf_pos,
-                            (void *)(&q),
-                            (void *)pf,
-                            (void *)L,
-                            (void *)l);
-
-  gg += i - 1;
-  free(gg);
-}
-
-PUBLIC plist *get_plist_gquad_from_pr(short *S,
-                                      int gi,
-                                      int gj,
-                                      FLT_OR_DBL *G,
-                                      FLT_OR_DBL *probs,
-                                      FLT_OR_DBL *scale,
-                                      pf_paramT *pf){
-
-  int L, l[3];
-  return  get_plist_gquad_from_pr_max(S, gi, gj, G, probs, scale, &L, l, pf);
-}
-
-
-PUBLIC plist *get_plist_gquad_from_pr_max(short *S,
-                                      int gi,
-                                      int gj,
-                                      FLT_OR_DBL *G,
-                                      FLT_OR_DBL *probs,
-                                      FLT_OR_DBL *scale,
-                                      int *Lmax,
-                                      int lmax[3],
-                                      pf_paramT *pf){ 
-
-  int n, size, *gg, counter, i, j, *my_index;
-  FLT_OR_DBL pp, *tempprobs;
-  plist *pl;
-  
-  n         = S[0];
-  size      = (n * (n + 1))/2 + 2;
-  tempprobs = (FLT_OR_DBL *)space(sizeof(FLT_OR_DBL) * size);
-  pl        = (plist *)space((S[0]*S[0])*sizeof(plist));
-  gg        = get_g_islands_sub(S, gi, gj);
-  counter   = 0;
-  my_index  = get_iindx(n);
-
-  process_gquad_enumeration(gg, gi, gj,
-                            &gquad_interact,
-                            (void *)tempprobs,
-                            (void *)pf,
-                            (void *)my_index,
-                            NULL);
-
-  pp = 0.;
-  process_gquad_enumeration(gg, gi, gj,
-                            &gquad_pf_pos,
-                            (void *)(&pp),
-                            (void *)pf,
-                            (void *)Lmax,
-                            (void *)lmax);
-
-  pp = probs[my_index[gi]-gj] * scale[gj-gi+1] / G[my_index[gi]-gj];
-  for (i=gi;i<gj; i++) {
-    for (j=i; j<=gj; j++) {
-      if (tempprobs[my_index[i]-j]>0.) {
-        pl[counter].i=i;
-        pl[counter].j=j;
-        pl[counter++].p = pp * tempprobs[my_index[i]-j];
-      }
-    }
-  }
-  pl[counter].i = pl[counter].j = 0;
-  pl[counter++].p = 0.;
-  /* shrink memory to actual size needed */
-  pl = (plist *) xrealloc(pl, counter * sizeof(plist));
-
-  gg += gi - 1; free(gg);
-  free(my_index);
-  free (tempprobs);
-  return pl;
-}
-
-PUBLIC int
-get_gquad_count(short *S,
-                int i,
-                int j){
-
-  int *gg     = get_g_islands_sub(S, i, j);
-  int p,q,counter = 0;
-
-  FOR_EACH_GQUAD(p, q, i, j)
-    process_gquad_enumeration(gg, p, q,
-                              &gquad_count,
-                              (void *)(&counter),
-                              NULL,
-                              NULL,
-                              NULL);
-
-  gg += i - 1;
-  free(gg);
-  return counter;
-}
-
-PUBLIC int
-get_gquad_layer_count(short *S,
-                      int i,
-                      int j){
-
-  int *gg     = get_g_islands_sub(S, i, j);
-  int p,q,counter = 0;
-
-  FOR_EACH_GQUAD(p, q, i, j)
-    process_gquad_enumeration(gg, p, q,
-                              &gquad_count_layers,
-                              (void *)(&counter),
-                              NULL,
-                              NULL,
-                              NULL);
-
-  gg += i - 1;
-  free(gg);
-  return counter;
-}
-
-PUBLIC int parse_gquad(const char *struc, int *L, int l[3]) {
-  int i, il, start, end, len;
-
-  for (i=0; struc[i] && struc[i]!='+'; i++);
-  if (struc[i] == '+') { /* start of gquad */
-    for (il=0; il<=3; il++) {
-      start=i; /* pos of first '+' */
-      while (struc[++i] == '+'){
-        if((il) && (i-start == *L))
-          break;
-      }
-      end=i; len=end-start; 
-      if (il==0) *L=len;
-      else if (len!=*L)
-        nrerror("unequal stack lengths in gquad");
-      if (il==3) break;
-      while (struc[++i] == '.'); /* linker */
-      l[il] = i-end;
-      if (struc[i] != '+')
-        nrerror("illegal character in gquad linker region");
-    }
-  }
-  else return 0;
-  /* printf("gquad at %d %d %d %d %d\n", end, *L, l[0], l[1], l[2]); */
-  return end;
-}
-
-
-
-/*
-#########################################
-# BEGIN OF PRIVATE FUNCTION DEFINITIONS #
-#          (internal use only)          #
-#########################################
-*/
-
-PRIVATE int gquad_ali_penalty(int i,
-                              int L,
-                              int l[3],
-                              const short **S,
-                              paramT *P){
-
-  int s, cnt;
-  int penalty     = 0;
-  int gg_mismatch = 0;
-
-  /* check for compatibility in the alignment */
-  for(s = 0; S[s]; s++){
-    unsigned int  ld  = 0; /* !=0 if layer destruction was detected */
-    int           pen = 0;
-
-    /* check bottom layer */
-    if(S[s][i] != 3)                            ld |= 1U;
-    if(S[s][i + L + l[0]] != 3)                 ld |= 2U;
-    if(S[s][i + 2*L + l[0] + l[1]] != 3)        ld |= 4U;
-    if(S[s][i + 3*L + l[0] + l[1] + l[2]] != 3) ld |= 8U;
-     /* add 1x penalty for missing bottom layer */
-    if(ld) pen += VRNA_GQUAD_MISMATCH_PENALTY;
-
-    /* check top layer */
-    ld = 0;
-    if(S[s][i + L - 1] != 3)                        ld |= 1U;
-    if(S[s][i + 2*L + l[0] - 1] != 3)               ld |= 2U;
-    if(S[s][i + 3*L + l[0] + l[1] - 1] != 3)        ld |= 4U;
-    if(S[s][i + 4*L + l[0] + l[1] + l[2] - 1] != 3) ld |= 8U;
-     /* add 1x penalty for missing top layer */
-    if(ld) pen += VRNA_GQUAD_MISMATCH_PENALTY;
-
-    /* check inner layers */
-    for(cnt=1;cnt<L-1;cnt++){
-      if(S[s][i + cnt] != 3)                            ld |= 1U;
-      if(S[s][i + L + l[0] + cnt] != 3)                 ld |= 2U;
-      if(S[s][i + 2*L + l[0] + l[1] + cnt] != 3)        ld |= 4U;
-      if(S[s][i + 3*L + l[0] + l[1] + l[2] + cnt] != 3) ld |= 8U;
-      /* add 2x penalty for missing inner layer */
-      if(ld) pen += 2*VRNA_GQUAD_MISMATCH_PENALTY;
-    }
-
-    /* if all layers are missing, we have a complete gg mismatch */
-    if(pen >= (2*VRNA_GQUAD_MISMATCH_PENALTY * (L-1)))
-      gg_mismatch++;
-
-    /* add the penalty to the score */
-    penalty += pen;
-  }
-  /* if gg_mismatch exceeds maximum allowed, this g-quadruplex is forbidden */
-  if(gg_mismatch > VRNA_GQUAD_MISMATCH_NUM_ALI) return INF;
-  else return penalty;
-}
-
-
-PRIVATE void gquad_mfe( int i,
-                        int L,
-                        int *l,
-                        void *data,
-                        void *P,
-                        void *NA,
-                        void *NA2){
-
-  int cc = ((paramT *)P)->gquad[L][l[0] + l[1] + l[2]];
-  if(cc < *((int *)data))
-    *((int *)data) = cc;
-}
-
-PRIVATE void gquad_mfe_pos( int i,
-                            int L,
-                            int *l,
-                            void *data,
-                            void *P,
-                            void *Lmfe,
-                            void *lmfe){
-
-  int cc = ((paramT *)P)->gquad[L][l[0] + l[1] + l[2]];
-  if(cc < *((int *)data)){
-    *((int *)data)        = cc;
-    *((int *)Lmfe)        = L;
-    *((int *)lmfe)        = l[0];
-    *(((int *)lmfe) + 1)  = l[1];
-    *(((int *)lmfe) + 2)  = l[2];
-  }
-}
-
-PRIVATE
-void
-gquad_pos_exhaustive( int i,
-                      int L,
-                      int *l,
-                      void *data,
-                      void *P,
-                      void *Lex,
-                      void *lex){
-
-  int cnt;
-  int cc = ((paramT *)P)->gquad[L][l[0] + l[1] + l[2]];
-  if(cc <= *((int *)data)){
-    /*  since Lex is an array of L values and lex an
-        array of l triples we need to find out where
-        the current gquad position is to be stored...
-		the below implementation might be slow but we
-		still use it for now
-    */
-    for(cnt = 0; ((int *)Lex)[cnt] != -1; cnt++);
-
-    *((int *)Lex + cnt)           = L;
-    *((int *)Lex + cnt + 1)       = -1;
-    *(((int *)lex) + (3*cnt) + 0) = l[0];
-    *(((int *)lex) + (3*cnt) + 1) = l[1];
-    *(((int *)lex) + (3*cnt) + 2) = l[2];
-  }
-}
-
-PRIVATE
-void
-gquad_count(int i,
-            int L,
-            int *l,
-            void *data,
-            void *NA,
-            void *NA2,
-            void *NA3){
-
-  *((int *)data) += 1;
-}
-
-PRIVATE
-void
-gquad_count_layers( int i,
-                    int L,
-                    int *l,
-                    void *data,
-                    void *NA,
-                    void *NA2,
-                    void *NA3){
-
-  *((int *)data) += L;
-}
-
-
-PRIVATE void gquad_pf(int i,
-                      int L,
-                      int *l,
-                      void *data,
-                      void *pf,
-                      void *NA,
-                      void *NA2){
-
-  *((FLT_OR_DBL *)data) += ((pf_paramT *)pf)->expgquad[L][l[0] + l[1] + l[2]];
-}
-
-PRIVATE void gquad_pf_pos(int i,
-                          int L,
-                          int *l,
-                          void *data,
-                          void *pf,
-                          void *Lmax,
-                          void *lmax){
-
-  FLT_OR_DBL gq = ((pf_paramT *)pf)->expgquad[L][l[0] + l[1] + l[2]];
-  if(gq > *((FLT_OR_DBL *)data)){
-    *((FLT_OR_DBL *)data) = gq;
-    *((int *)Lmax)        = L;
-    *((int *)lmax)        = l[0];
-    *(((int *)lmax) + 1)  = l[1];
-    *(((int *)lmax) + 2)  = l[2];
-  }
-}
-
-PRIVATE void gquad_mfe_ali( int i,
-                            int L,
-                            int *l,
-                            void *data,
-                            void *P,
-                            void *S,
-                            void *n_seq){
-
-  int en[2], cc;
-  en[0] = en[1] = INF;
-  gquad_mfe_ali_en(i, L, l, (void *)(&(en[0])), P, S, n_seq);
-  if(en[1] != INF){
-    cc  = en[0] + en[1];
-    if(cc < *((int *)data)) *((int *)data) = cc;
-  }
-}
-
-PRIVATE void gquad_mfe_ali_en(int i,
-                              int L,
-                              int *l,
-                              void *data,
-                              void *P,
-                              void *S,
-                              void *n_seq){
-
-  int en[2], cc, dd;
-  en[0] = ((paramT *)P)->gquad[L][l[0] + l[1] + l[2]] * (*(int *)n_seq);
-  en[1] = gquad_ali_penalty(i, L, l, (const short **)S, (paramT *)P);
-  if(en[1] != INF){
-    cc = en[0] + en[1];
-    dd = ((int *)data)[0] + ((int *)data)[1];
-    if(cc < dd){
-      ((int *)data)[0] = en[0];
-      ((int *)data)[1] = en[1];
-    }
-  }
-}
-
-PRIVATE void gquad_interact(int i,
-                      int L,
-                      int *l,
-                      void *data,
-                      void *pf,
-                      void *index,
-                      void *NA2){
-
-  int x, *idx;
-  FLT_OR_DBL gq, *pp;
-
-  idx = (int *)index;
-  pp  = (FLT_OR_DBL *)data;
-  gq  = exp_E_gquad(L, l, (pf_paramT *)pf);
-
-  for(x = 0; x < L; x++){
-    pp[idx[i + x] - (i + x + 3*L + l[0] + l[1] + l[2])] += gq;
-    pp[idx[i + x] - (i + x + L + l[0])] += gq;
-    pp[idx[i + x + L + l[0]] - (i + x + 2*L + l[0] + l[1])] += gq;
-    pp[idx[i + x + 2*L + l[0] + l[1]] - (i + x + 3*L + l[0] + l[1] + l[2])] += gq;
-  }
-  
-}
-
-PRIVATE INLINE int *get_g_islands(short *S){
-  return get_g_islands_sub(S, 1, S[0]);
-}
-
-PRIVATE INLINE int *get_g_islands_sub(short *S, int i, int j){
-  int x, *gg;
-
-  gg = (int *)space(sizeof(int)*(j-i+2));
-  gg -= i - 1;
-
-  if(S[j]==3) gg[j] = 1;
-  for(x = j - 1; x >= i; x--)
-    if(S[x] == 3)
-      gg[x] = gg[x+1]+1;
-
-  return gg;
-}
-
-/**
- *  We could've also created a macro that loops over all G-quadruplexes
- *  delimited by i and j. However, for the fun of it we use this function
- *  that receives a pointer to a callback function which in turn does the
- *  actual computation for each quadruplex found.
- */
-PRIVATE
-void
-process_gquad_enumeration(int *gg,
-                          int i,
-                          int j,
-                          void (*f)(int, int, int *,
-                                    void *, void *, void *, void *),
-                          void *data,
-                          void *P,
-                          void *aux1,
-                          void *aux2){
-
-  int L, l[3], n, max_linker, maxl0, maxl1;
-
-  n = j - i + 1;
-
-  if((n >= VRNA_GQUAD_MIN_BOX_SIZE) && (n <= VRNA_GQUAD_MAX_BOX_SIZE))
-    for(L = MIN2(gg[i], VRNA_GQUAD_MAX_STACK_SIZE);
-        L >= VRNA_GQUAD_MIN_STACK_SIZE;
-        L--)
-      if(gg[j-L+1] >= L){
-        max_linker = n-4*L;
-        if(     (max_linker >= 3*VRNA_GQUAD_MIN_LINKER_LENGTH)
-            &&  (max_linker <= 3*VRNA_GQUAD_MAX_LINKER_LENGTH)){
-          maxl0 = MIN2( VRNA_GQUAD_MAX_LINKER_LENGTH,
-                        max_linker - 2*VRNA_GQUAD_MIN_LINKER_LENGTH
-                      );
-          for(l[0] = VRNA_GQUAD_MIN_LINKER_LENGTH;
-              l[0] <= maxl0;
-              l[0]++)
-            if(gg[i+L+l[0]] >= L){
-              maxl1 = MIN2( VRNA_GQUAD_MAX_LINKER_LENGTH,
-                            max_linker - l[0] - VRNA_GQUAD_MIN_LINKER_LENGTH
-                          );
-              for(l[1] = VRNA_GQUAD_MIN_LINKER_LENGTH;
-                  l[1] <= maxl1;
-                  l[1]++)
-                if(gg[i + 2*L + l[0] + l[1]] >= L){
-                  l[2] = max_linker - l[0] - l[1];
-                  f(i, L, &(l[0]), data, P, aux1, aux2);
-                }
-            }
-        }
-      }
-}
-
diff --git a/cbits/params.c b/cbits/params.c
deleted file mode 100644
--- a/cbits/params.c
+++ /dev/null
@@ -1,751 +0,0 @@
-/*
-
-                  c Ivo Hofacker
-
-                  Vienna RNA package
-*/
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include "energy_par.h"
-#include "fold_vars.h"
-#include "utils.h"
-#include "params.h"
-/**
-*** \file params.c
-*** <P>
-*** This file provides functions that return temperature scaled energy parameters and
-*** Boltzmann weights packed in datastructures
-*** </P>
-***/
-
-/*@unused@*/
-static char rcsid[] UNUSED = "$Id: params.c,v 1.9 2008/07/04 14:29:14 ivo Exp $";
-
-PRIVATE paramT p;
-PRIVATE int id=-1;
-/* variables for partition function */
-PRIVATE pf_paramT pf;
-PRIVATE int pf_id=-1;
-
-#ifdef _OPENMP
-#pragma omp threadprivate(id, pf_id)
-#endif
-
-PUBLIC paramT *scale_parameters(void){
-  model_detailsT  md;
-  set_model_details(&md);
-  return get_scaled_parameters(temperature, md);
-}
-
-PUBLIC paramT *get_scaled_parameters( double temp,
-                                      model_detailsT md){
-
-  unsigned int i,j,k,l;
-  double tempf;
-  paramT *params;
-
-  params  = (paramT *)space(sizeof(paramT));
-
-  /* store the model details */
-  params->model_details = md;
-  params->temperature   = temp;
-  tempf                 = ((params->temperature+K0)/Tmeasure);
-
-  for(i = VRNA_GQUAD_MIN_STACK_SIZE; i <= VRNA_GQUAD_MAX_STACK_SIZE; i++)
-    for(j = 3*VRNA_GQUAD_MIN_LINKER_LENGTH; j <= 3*VRNA_GQUAD_MAX_LINKER_LENGTH; j++){
-      double GQuadAlpha_T = (double)GQuadAlphadH - (double)(GQuadAlphadH - GQuadAlpha37) * tempf;
-      double GQuadBeta_T = (double)GQuadBetadH - (double)(GQuadBetadH - GQuadBeta37) * tempf;
-      params->gquad[i][j] = (int)GQuadAlpha_T*(i-1) + (int)(((double)GQuadBeta_T)*log(j - 2));
-    }
-
-  for (i=0; i<31; i++)
-    params->hairpin[i]  = hairpindH[i] - (hairpindH[i] - hairpin37[i])*tempf;
-  for (i=0; i<=MIN2(30,MAXLOOP); i++) {
-    params->bulge[i]          = bulgedH[i] - (bulgedH[i] - bulge37[i]) * tempf;
-    params->internal_loop[i]  = internal_loopdH[i] - (internal_loopdH[i] - internal_loop37[i]) * tempf;
-  }
-  params->lxc = lxc37*tempf;
-  for (; i<=MAXLOOP; i++) {
-    params->bulge[i] = params->bulge[30]+(int)(params->lxc*log((double)(i)/30.));
-    params->internal_loop[i] = params->internal_loop[30]+(int)(params->lxc*log((double)(i)/30.));
-  }
-
-  params->ninio[2] = niniodH - (niniodH - ninio37) * tempf;
-
-  params->TripleC = TripleCdH - (TripleCdH - TripleC37) * tempf;
-  params->MultipleCA = MultipleCAdH - (MultipleCAdH - MultipleCA37) * tempf;
-  params->MultipleCB = MultipleCBdH - (MultipleCBdH - MultipleCB37) * tempf;
-
-  for (i=0; (i*7)<strlen(Tetraloops); i++)
-    params->Tetraloop_E[i] = TetraloopdH[i] - (TetraloopdH[i]-Tetraloop37[i])*tempf;
-  for (i=0; (i*5)<strlen(Triloops); i++)
-    params->Triloop_E[i] =  TriloopdH[i] - (TriloopdH[i]-Triloop37[i])*tempf;
-  for (i=0; (i*9)<strlen(Hexaloops); i++)
-    params->Hexaloop_E[i] =  HexaloopdH[i] - (HexaloopdH[i]-Hexaloop37[i])*tempf;
-
-  params->TerminalAU = TerminalAUdH - (TerminalAUdH - TerminalAU37) * tempf;
-
-  params->DuplexInit = DuplexInitdH - (DuplexInitdH - DuplexInit37) *tempf;
-
-  params->MLbase = ML_BASEdH - (ML_BASEdH - ML_BASE37) * tempf;
-
-  for (i=0; i<=NBPAIRS; i++)
-    params->MLintern[i] = ML_interndH - (ML_interndH - ML_intern37) * tempf;
-
-  params->MLclosing = ML_closingdH - (ML_closingdH - ML_closing37) * tempf;
-
-
-  /* stacks    G(T) = H - [H - G(T0)]*T/T0 */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      params->stack[i][j] = stackdH[i][j] - (stackdH[i][j] - stack37[i][j])*tempf;
-
-  /* mismatches */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<5; j++)
-      for (k=0; k<5; k++) {
-        int mm;
-        params->mismatchI[i][j][k]    = mismatchIdH[i][j][k] - (mismatchIdH[i][j][k] - mismatchI37[i][j][k])*tempf;
-        params->mismatchH[i][j][k]    = mismatchHdH[i][j][k] - (mismatchHdH[i][j][k] - mismatchH37[i][j][k])*tempf;
-        params->mismatch1nI[i][j][k]  = mismatch1nIdH[i][j][k]-(mismatch1nIdH[i][j][k]-mismatch1nI37[i][j][k])*tempf;/* interior nx1 loops */
-        params->mismatch23I[i][j][k]  = mismatch23IdH[i][j][k]-(mismatch23IdH[i][j][k]-mismatch23I37[i][j][k])*tempf;/* interior 2x3 loops */
-        if(md.dangles){
-          mm                      = mismatchMdH[i][j][k] - (mismatchMdH[i][j][k] - mismatchM37[i][j][k])*tempf;
-          params->mismatchM[i][j][k]    = (mm > 0) ? 0 : mm;
-          mm                      = mismatchExtdH[i][j][k] - (mismatchExtdH[i][j][k] - mismatchExt37[i][j][k])*tempf;
-          params->mismatchExt[i][j][k]  = (mm > 0) ? 0 : mm;
-        }
-        else{
-          params->mismatchM[i][j][k] = params->mismatchExt[i][j][k] = 0;
-        }
-      }
-
-  /* dangles */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<5; j++) {
-      int dd;
-      dd = dangle5_dH[i][j] - (dangle5_dH[i][j] - dangle5_37[i][j])*tempf;
-      params->dangle5[i][j] = (dd>0) ? 0 : dd;  /* must be <= 0 */
-      dd = dangle3_dH[i][j] - (dangle3_dH[i][j] - dangle3_37[i][j])*tempf;
-      params->dangle3[i][j] = (dd>0) ? 0 : dd;  /* must be <= 0 */
-    }
-  /* interior 1x1 loops */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++)
-          params->int11[i][j][k][l] = int11_dH[i][j][k][l] - (int11_dH[i][j][k][l] - int11_37[i][j][k][l])*tempf;
-
-  /* interior 2x1 loops */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++) {
-          int m;
-          for (m=0; m<5; m++)
-            params->int21[i][j][k][l][m] = int21_dH[i][j][k][l][m] - (int21_dH[i][j][k][l][m] - int21_37[i][j][k][l][m])*tempf;
-        }
-  /* interior 2x2 loops */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++) {
-          int m,n;
-          for (m=0; m<5; m++)
-            for (n=0; n<5; n++)
-              params->int22[i][j][k][l][m][n] = int22_dH[i][j][k][l][m][n] - (int22_dH[i][j][k][l][m][n]-int22_37[i][j][k][l][m][n])*tempf;
-        }
-
-  strncpy(params->Tetraloops, Tetraloops, 281);
-  strncpy(params->Triloops, Triloops, 241);
-  strncpy(params->Hexaloops, Hexaloops, 361);
-
-  params->id = ++id;
-  return params;
-}
-
-
-/*------------------------------------------------------------------------*/
-#define SCALE 10
-/**
-*** dangling ends should never be destabilizing, i.e. expdangle>=1<BR>
-*** specific heat needs smooth function (2nd derivative)<BR>
-*** we use a*(sin(x+b)+1)^2, with a=2/(3*sqrt(3)), b=Pi/6-sqrt(3)/2,
-*** in the interval b<x<sqrt(3)/2
-*/
-#define SMOOTH(X) ((X)/SCALE<-1.2283697)?0:(((X)/SCALE>0.8660254)?(X):\
-          SCALE*0.38490018*(sin((X)/SCALE-0.34242663)+1)*(sin((X)/SCALE-0.34242663)+1))
-
-/* #define SMOOTH(X) ((X)<0 ? 0 : (X)) */
-
-
-PUBLIC pf_paramT *get_scaled_pf_parameters(void){
-  model_detailsT  md;
-  set_model_details(&md);
-  return get_boltzmann_factors(temperature, 1.0, md, pf_scale);
-}
-
-PUBLIC pf_paramT *get_boltzmann_factors(double temp,
-                                        double betaScale,
-                                        model_detailsT md,
-                                        double pf_scale){
-
-  unsigned  int i, j, k, l;
-  double        kT, TT;
-  double        GT;
-  pf_paramT     *pf;
-
-  pf                = (pf_paramT *)space(sizeof(pf_paramT));
-  pf->model_details = md;
-  pf->temperature   = temp;
-  pf->alpha         = betaScale;
-  pf->kT = kT       = betaScale*(temp+K0)*GASCONST;   /* kT in cal/mol  */
-  pf->pf_scale      = pf_scale;
-  TT                = (temp+K0)/(Tmeasure);
-
-  for(i = VRNA_GQUAD_MIN_STACK_SIZE; i <= VRNA_GQUAD_MAX_STACK_SIZE; i++)
-    for(j = 3*VRNA_GQUAD_MIN_LINKER_LENGTH; j <= 3*VRNA_GQUAD_MAX_LINKER_LENGTH; j++){
-      double GQuadAlpha_T = (double)GQuadAlphadH - (double)(GQuadAlphadH - GQuadAlpha37) * TT;
-      double GQuadBeta_T = (double)GQuadBetadH - (double)(GQuadBetadH - GQuadBeta37) * TT;
-      GT = ((double)GQuadAlpha_T)*((double)(i-1)) + ((double)GQuadBeta_T)*log(((double)j) - 2.);
-      pf->expgquad[i][j] = exp( -GT*10./kT);
-    }
-
-  /* loop energies: hairpins, bulges, interior, mulit-loops */
-  for (i=0; i<31; i++){
-    GT  = hairpindH[i] - (hairpindH[i] - hairpin37[i])*TT;
-    pf->exphairpin[i] = exp( -GT*10./kT);
-  }
-
-  for (i=0; i<=MIN2(30, MAXLOOP); i++) {
-    GT =  bulgedH[i]- (bulgedH[i] - bulge37[i])*TT;
-    pf->expbulge[i] = exp( -GT*10./kT);
-    GT =  internal_loopdH[i] - (internal_loopdH[i] - internal_loop37[i])*TT;
-    pf->expinternal[i] = exp( -GT*10./kT);
-  }
-  /* special case of size 2 interior loops (single mismatch) */
-  if (james_rule) pf->expinternal[2] = exp ( -80*10./kT);
-
-  pf->lxc = lxc37*TT;
-
-  GT =  DuplexInitdH - (DuplexInitdH - DuplexInit37)*TT;
-  pf->expDuplexInit = exp( -GT*10./kT);
-
-  for (i=31; i<=MAXLOOP; i++) {
-    GT = bulge37[30]*TT + (pf->lxc*log( i/30.));
-    pf->expbulge[i] = exp( -GT*10./kT);
-    GT = internal_loop37[30]*TT + (pf->lxc*log( i/30.));
-    pf->expinternal[i] = exp( -GT*10./kT);
-  }
-
-  GT = niniodH - (niniodH - ninio37)*TT;
-  for (j=0; j<=MAXLOOP; j++)
-      pf->expninio[2][j]=exp(-MIN2(MAX_NINIO,j*GT)*10./kT);
-
-  for (i=0; (i*7)<strlen(Tetraloops); i++) {
-    GT = TetraloopdH[i] - (TetraloopdH[i]-Tetraloop37[i])*TT;
-    pf->exptetra[i] = exp( -GT*10./kT);
-  }
-  for (i=0; (i*5)<strlen(Triloops); i++) {
-    GT = TriloopdH[i] - (TriloopdH[i]-Triloop37[i])*TT;
-    pf->exptri[i] = exp( -GT*10./kT);
-  }
-  for (i=0; (i*9)<strlen(Hexaloops); i++) {
-    GT = HexaloopdH[i] - (HexaloopdH[i]-Hexaloop37[i])*TT;
-    pf->exphex[i] = exp( -GT*10./kT);
-  }
-  GT =  ML_closingdH - (ML_closingdH - ML_closing37)*TT;
-  pf->expMLclosing = exp( -GT*10./kT);
-
-  for (i=0; i<=NBPAIRS; i++) {
-    GT =  ML_interndH - (ML_interndH - ML_intern37)*TT;
-    /* if (i>2) GT += TerminalAU; */
-    pf->expMLintern[i] = exp( -GT*10./kT);
-  }
-  GT = TerminalAUdH - (TerminalAUdH - TerminalAU37)*TT;
-  pf->expTermAU = exp(-GT*10./kT);
-
-  GT = ML_BASEdH - (ML_BASEdH - ML_BASE37)*TT;
-
-  pf->expMLbase=exp(-10.*GT/kT);
-
-
-  /* if dangles==0 just set their energy to 0,
-     don't let dangle energies become > 0 (at large temps),
-     but make sure go smoothly to 0                        */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=4; j++) {
-      if (md.dangles) {
-        GT = dangle5_dH[i][j] - (dangle5_dH[i][j] - dangle5_37[i][j])*TT;
-        pf->expdangle5[i][j] = exp(SMOOTH(-GT)*10./kT);
-        GT = dangle3_dH[i][j] - (dangle3_dH[i][j] - dangle3_37[i][j])*TT;
-        pf->expdangle3[i][j] =  exp(SMOOTH(-GT)*10./kT);
-      } else
-        pf->expdangle3[i][j] = pf->expdangle5[i][j] = 1;
-    }
-
-  /* stacking energies */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++) {
-      GT =  stackdH[i][j] - (stackdH[i][j] - stack37[i][j])*TT;
-      pf->expstack[i][j] = exp( -GT*10./kT);
-    }
-
-  /* mismatch energies */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<5; j++)
-      for (k=0; k<5; k++) {
-        GT =  mismatchIdH[i][j][k] - ( mismatchIdH[i][j][k] - mismatchI37[i][j][k])*TT;
-        pf->expmismatchI[i][j][k] = exp(-GT*10.0/kT);
-        GT = mismatch1nIdH[i][j][k] - (mismatch1nIdH[i][j][k] - mismatch1nI37[i][j][k])*TT;
-        pf->expmismatch1nI[i][j][k] = exp(-GT*10.0/kT);
-        GT = mismatchHdH[i][j][k] - (mismatchHdH[i][j][k] - mismatchH37[i][j][k])*TT;
-        pf->expmismatchH[i][j][k] = exp(-GT*10.0/kT);
-        if (md.dangles) {
-          GT = mismatchMdH[i][j][k] - (mismatchMdH[i][j][k] - mismatchM37[i][j][k])*TT;
-          pf->expmismatchM[i][j][k] = exp(SMOOTH(-GT)*10.0/kT);
-          GT = mismatchExtdH[i][j][k] - (mismatchExtdH[i][j][k] - mismatchExt37[i][j][k])*TT;
-          pf->expmismatchExt[i][j][k] = exp(SMOOTH(-GT)*10.0/kT);
-        }
-        else{
-          pf->expmismatchM[i][j][k] = pf->expmismatchExt[i][j][k] = 1.;
-        }
-        GT = mismatch23IdH[i][j][k] - (mismatch23IdH[i][j][k] - mismatch23I37[i][j][k])*TT;
-        pf->expmismatch23I[i][j][k] = exp(-GT*10.0/kT);
-      }
-
-  /* interior lops of length 2 */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++) {
-          GT = int11_dH[i][j][k][l] -
-            (int11_dH[i][j][k][l] - int11_37[i][j][k][l])*TT;
-          pf->expint11[i][j][k][l] = exp(-GT*10./kT);
-        }
-  /* interior 2x1 loops */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++) {
-          int m;
-          for (m=0; m<5; m++) {
-            GT = int21_dH[i][j][k][l][m] -
-              (int21_dH[i][j][k][l][m] - int21_37[i][j][k][l][m])*TT;
-            pf->expint21[i][j][k][l][m] = exp(-GT*10./kT);
-          }
-        }
-
-  /* interior 2x2 loops */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++) {
-          int m,n;
-          for (m=0; m<5; m++)
-            for (n=0; n<5; n++) {
-              GT = int22_dH[i][j][k][l][m][n] -
-                (int22_dH[i][j][k][l][m][n]-int22_37[i][j][k][l][m][n])*TT;
-              pf->expint22[i][j][k][l][m][n] = exp(-GT*10./kT);
-            }
-        }
-
-  strncpy(pf->Tetraloops, Tetraloops, 281);
-  strncpy(pf->Triloops, Triloops, 241);
-  strncpy(pf->Hexaloops, Hexaloops, 361);
-
-  return pf;
-}
-
-PUBLIC pf_paramT *get_scaled_alipf_parameters(unsigned int n_seq){
-  model_detailsT  md;
-  set_model_details(&md);
-  return get_boltzmann_factors_ali(n_seq, temperature, 1.0, md, pf_scale);
-}
-
-PUBLIC pf_paramT *get_boltzmann_factors_ali(unsigned int n_seq,
-                                            double temperature,
-                                            double betaScale,
-                                            model_detailsT md,
-                                            double pf_scale){
-
-  /* scale energy parameters and pre-calculate Boltzmann weights */
-  unsigned int  i, j, k, l;
-  double        kTn, TT;
-  double        GT;
-  pf_paramT     *pf;
-
-  pf                = (pf_paramT *)space(sizeof(pf_paramT));
-  pf->model_details = md;
-  pf->alpha         = betaScale;
-  pf->temperature   = temperature;
-  pf->pf_scale      = pf_scale;
-  pf->kT = kTn      = ((double)n_seq)*betaScale*(temperature+K0)*GASCONST;   /* kT in cal/mol  */
-  TT                = (temperature+K0)/(Tmeasure);
-
-
-   /* loop energies: hairpins, bulges, interior, mulit-loops */
-  for (i=0; i<31; i++) {
-    GT =  hairpindH[i] - (hairpindH[i] - hairpin37[i])*TT;
-    pf->exphairpin[i] = exp( -GT*10./kTn);
-  }
-  /*add penalty for too short hairpins*/
-  for (i=0; i<3; i++) {
-    GT= 600/*Penalty*/*TT;
-    pf->exphairpin[i] = exp( -GT*10./kTn);
-  }
-
-  for (i=0; i<=MIN2(30, MAXLOOP); i++) {
-    GT =  bulgedH[i]- (bulgedH[i] - bulge37[i])*TT;
-    pf->expbulge[i] = exp( -GT*10./kTn);
-    GT =  internal_loopdH[i] - (internal_loopdH[i] - internal_loop37[i])*TT;
-    pf->expinternal[i] = exp( -GT*10./kTn);
-  }
-  /* special case of size 2 interior loops (single mismatch) */
-  if (james_rule) pf->expinternal[2] = exp ( -80*10./kTn);
-
-  pf->lxc = lxc37*TT;
-
-  GT =  DuplexInitdH - (DuplexInitdH - DuplexInit37)*TT;
-  pf->expDuplexInit = exp( -GT*10./kTn);
-
-  for (i=31; i<=MAXLOOP; i++) {
-    GT = bulge37[30]*TT + (pf->lxc*log( i/30.));
-    pf->expbulge[i] = exp( -GT*10./kTn);
-    GT = internal_loop37[30]*TT + (pf->lxc*log( i/30.));
-    pf->expinternal[i] = exp( -GT*10./kTn);
-  }
-
-  GT = niniodH - (niniodH - ninio37)*TT;
-  for (j=0; j<=MAXLOOP; j++)
-    pf->expninio[2][j]=exp(-MIN2(MAX_NINIO,j*GT)*10./kTn);
-
-  for (i=0; (i*7)<strlen(Tetraloops); i++) {
-    GT = TetraloopdH[i] - (TetraloopdH[i]-Tetraloop37[i])*TT;
-    pf->exptetra[i] = exp( -GT*10./kTn);
-  }
-  for (i=0; (i*5)<strlen(Triloops); i++) {
-    GT = TriloopdH[i] - (TriloopdH[i]-Triloop37[i])*TT;
-    pf->exptri[i] = exp( -GT*10./kTn);
-  }
-  for (i=0; (i*9)<strlen(Hexaloops); i++) {
-    GT = HexaloopdH[i] - (HexaloopdH[i]-Hexaloop37[i])*TT;
-    pf->exphex[i] = exp( -GT*10./kTn);
-  }
-  GT =  ML_closingdH - (ML_closingdH - ML_closing37)*TT;
-  pf->expMLclosing = exp( -GT*10./kTn);
-
-  for (i=0; i<=NBPAIRS; i++) { /* includes AU penalty */
-    GT =  ML_interndH - (ML_interndH - ML_intern37)*TT;
-    /* if (i>2) GT += TerminalAU; */
-    pf->expMLintern[i] = exp( -GT*10./kTn);
-  }
-  GT = TerminalAUdH - (TerminalAUdH - TerminalAU37)*TT;
-  pf->expTermAU = exp(-GT*10./kTn);
-
-  GT = ML_BASEdH - (ML_BASEdH - ML_BASE37)*TT;
-  pf->expMLbase=exp(-10.*GT/(kTn/n_seq));
-
-
-  /* if dangle_model==0 just set their energy to 0,
-     don't let dangle energies become > 0 (at large temps),
-     but make sure go smoothly to 0                        */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=4; j++) {
-      if (md.dangles) {
-        GT = dangle5_dH[i][j] - (dangle5_dH[i][j] - dangle5_37[i][j])*TT;
-        pf->expdangle5[i][j] = exp(SMOOTH(-GT)*10./kTn);
-        GT = dangle3_dH[i][j] - (dangle3_dH[i][j] - dangle3_37[i][j])*TT;
-        pf->expdangle3[i][j] =  exp(SMOOTH(-GT)*10./kTn);
-      } else
-        pf->expdangle3[i][j] = pf->expdangle5[i][j] = 1;
-    }
-
-  /* stacking energies */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++) {
-      GT =  stackdH[i][j] - (stackdH[i][j] - stack37[i][j])*TT;
-      pf->expstack[i][j] = exp( -GT*10./kTn);
-    }
-
-  /* mismatch energies */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<5; j++)
-      for (k=0; k<5; k++) {
-        GT =  mismatchIdH[i][j][k] - ( mismatchIdH[i][j][k] - mismatchI37[i][j][k])*TT;
-        pf->expmismatchI[i][j][k] = exp(-GT*10.0/kTn);
-        GT = mismatch1nIdH[i][j][k] - (mismatch1nIdH[i][j][k] - mismatch1nI37[i][j][k])*TT;
-        pf->expmismatch1nI[i][j][k] = exp(-GT*10.0/kTn);
-        GT = mismatchHdH[i][j][k] - (mismatchHdH[i][j][k] - mismatchH37[i][j][k])*TT;
-        pf->expmismatchH[i][j][k] = exp(-GT*10.0/kTn);
-        if (md.dangles) {
-          GT = mismatchMdH[i][j][k] - (mismatchMdH[i][j][k] - mismatchM37[i][j][k])*TT;
-          pf->expmismatchM[i][j][k] = exp(SMOOTH(-GT)*10.0/kTn);
-          GT = mismatchExtdH[i][j][k] - (mismatchExtdH[i][j][k] - mismatchExt37[i][j][k])*TT;
-          pf->expmismatchExt[i][j][k] = exp(SMOOTH(-GT)*10.0/kTn);
-        }
-        else{
-          pf->expmismatchM[i][j][k] = pf->expmismatchExt[i][j][k] = 1.;
-        }
-        GT = mismatch23IdH[i][j][k] - (mismatch23IdH[i][j][k] - mismatch23I37[i][j][k])*TT;
-        pf->expmismatch23I[i][j][k] = exp(-GT*10.0/kTn);
-      }
-
-
-  /* interior lops of length 2 */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++) {
-          GT = int11_dH[i][j][k][l] -
-            (int11_dH[i][j][k][l] - int11_37[i][j][k][l])*TT;
-          pf->expint11[i][j][k][l] = exp(-GT*10./kTn);
-        }
-  /* interior 2x1 loops */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++) {
-          int m;
-          for (m=0; m<5; m++) {
-            GT = int21_dH[i][j][k][l][m] -
-              (int21_dH[i][j][k][l][m] - int21_37[i][j][k][l][m])*TT;
-            pf->expint21[i][j][k][l][m] = exp(-GT*10./kTn);
-          }
-        }
-
-  /* interior 2x2 loops */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++) {
-          int m,n;
-          for (m=0; m<5; m++)
-            for (n=0; n<5; n++) {
-              GT = int22_dH[i][j][k][l][m][n] -
-                (int22_dH[i][j][k][l][m][n]-int22_37[i][j][k][l][m][n])*TT;
-              pf->expint22[i][j][k][l][m][n] = exp(-GT*10./kTn);
-            }
-        }
-
-  strncpy(pf->Tetraloops, Tetraloops, 281);
-  strncpy(pf->Triloops, Triloops, 241);
-  strncpy(pf->Hexaloops, Hexaloops, 361);
-
-  return pf;
-}
-
-PUBLIC pf_paramT *get_boltzmann_factor_copy(pf_paramT *par){
-  pf_paramT *copy = NULL;
-  if(par){
-    copy = (pf_paramT *) space(sizeof(pf_paramT));
-    memcpy(copy, par, sizeof(pf_paramT));
-  }
-  return copy;
-}
-
-PUBLIC paramT *get_parameter_copy(paramT *par){
-  paramT *copy = NULL;
-  if(par){
-    copy = (paramT *) space(sizeof(paramT));
-    memcpy(copy, par, sizeof(paramT));
-  }
-  return copy;
-}
-
-/*###########################################*/
-/*# deprecated functions below              #*/
-/*###########################################*/
-
-PUBLIC paramT *copy_parameters(void){
-  paramT *copy;
-  if (p.id != id) scale_parameters();
-  copy = (paramT *) space(sizeof(paramT));
-  memcpy(copy, &p, sizeof(paramT));
-  return copy;
-}
-
-PUBLIC paramT *set_parameters(paramT *dest){
-  memcpy(&p, dest, sizeof(paramT));
-  return &p;
-}
-
-PUBLIC pf_paramT *copy_pf_param(void){
-  pf_paramT *copy;
-  if (pf.id != pf_id) scale_pf_parameters();
-  copy = (pf_paramT *) space(sizeof(pf_paramT));
-  memcpy(copy, &pf, sizeof(pf_paramT));
-  return copy;
-}
-
-PUBLIC pf_paramT *set_pf_param(paramT *dest){
-  memcpy(&pf, dest, sizeof(pf_paramT));
-  return &pf;
-}
-
-PUBLIC pf_paramT *scale_pf_parameters(void){
-  return get_scaled_pf_parameters();
-#if 0
-  /* scale energy parameters and pre-calculate Boltzmann weights */
-  unsigned int i, j, k, l;
-  double  kT, TT;
-  double  GT;
-
-  /* scale pf_params() in partfunc.c is only a wrapper, that calls
-     this functions !! */
-
-  pf.temperature = temperature;
-  kT = (pf.temperature+K0)*GASCONST;   /* kT in cal/mol  */
-  TT = (pf.temperature+K0)/(Tmeasure);
-
-   /* loop energies: hairpins, bulges, interior, mulit-loops */
-  for (i=0; i<31; i++) {
-    GT =  hairpin37[i]*TT;
-    pf.exphairpin[i] = exp( -GT*10./kT);
-  }
-  for (i=0; i<=MIN2(30, MAXLOOP); i++) {
-    GT =  bulge37[i]*TT;
-    pf.expbulge[i] = exp( -GT*10./kT);
-    GT =  internal_loop37[i]*TT;
-    pf.expinternal[i] = exp( -GT*10./kT);
-  }
-  /* special case of size 2 interior loops (single mismatch) */
-  if (james_rule) pf.expinternal[2] = exp ( -80*10./kT);
-
-  pf.lxc = lxc37*TT;
-
-  GT =  DuplexInitdH - (DuplexInitdH - DuplexInit37)*TT;
-  pf.expDuplexInit = exp( -GT*10./kT);
-
-  for (i=31; i<=MAXLOOP; i++) {
-    GT = bulge37[30]*TT + (pf.lxc*log( i/30.));
-    pf.expbulge[i] = exp( -GT*10./kT);
-    GT = internal_loop37[30]*TT + (pf.lxc*log( i/30.));
-    pf.expinternal[i] = exp( -GT*10./kT);
-  }
-
-  GT = niniodH - (niniodH - ninio37)*TT;
-  for (j=0; j<=MAXLOOP; j++)
-      pf.expninio[2][j]=exp(-MIN2(MAX_NINIO,j*GT)*10./kT);
-
-  for (i=0; (i*7)<strlen(Tetraloops); i++) {
-    GT = TetraloopdH[i] - (TetraloopdH[i]-Tetraloop37[i])*TT;
-    pf.exptetra[i] = exp( -GT*10./kT);
-  }
-  for (i=0; (i*5)<strlen(Triloops); i++) {
-    GT = TriloopdH[i] - (TriloopdH[i]-Triloop37[i])*TT;
-    pf.exptri[i] = exp( -GT*10./kT);
-  }
-  for (i=0; (i*9)<strlen(Hexaloops); i++) {
-    GT = HexaloopdH[i] - (HexaloopdH[i]-Hexaloop37[i])*TT;
-    pf.exphex[i] = exp( -GT*10./kT);
-  }
-  GT =  ML_closing37*TT;
-  pf.expMLclosing = exp( -GT*10./kT);
-
-  for (i=0; i<=NBPAIRS; i++) { /* includes AU penalty */
-    GT =  ML_intern37*TT;
-    /* if (i>2) GT += TerminalAU; */
-    pf.expMLintern[i] = exp( -GT*10./kT);
-  }
-  GT = TerminalAUdH - (TerminalAUdH - TerminalAU37)*TT;
-  pf.expTermAU = exp(-GT*10./kT);
-
-  GT = ML_BASE37*TT;
-  pf.expMLbase=exp(-10.*GT/kT);
-
-
-  /* if dangle_model==0 just set their energy to 0,
-     don't let dangle energies become > 0 (at large temps),
-     but make sure go smoothly to 0                        */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=4; j++) {
-      if (dangles) {
-        GT = dangle5_dH[i][j] - (dangle5_dH[i][j] - dangle5_37[i][j])*TT;
-        pf.expdangle5[i][j] = exp(SMOOTH(-GT)*10./kT);
-        GT = dangle3_dH[i][j] - (dangle3_dH[i][j] - dangle3_37[i][j])*TT;
-        pf.expdangle3[i][j] =  exp(SMOOTH(-GT)*10./kT);
-      } else
-        pf.expdangle3[i][j] = pf.expdangle5[i][j] = 1;
-      if (i>2) /* add TermAU penalty into dangle3 */
-        pf.expdangle3[i][j] *= pf.expTermAU;
-    }
-
-  /* stacking energies */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++) {
-      GT =  stackdH[i][j] - (stackdH[i][j] - stack37[i][j])*TT;
-      pf.expstack[i][j] = exp( -GT*10./kT);
-    }
-
-  /* mismatch energies */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<5; j++)
-      for (k=0; k<5; k++) {
-        GT =  mismatchIdH[i][j][k] - ( mismatchIdH[i][j][k] - mismatchI37[i][j][k])*TT;
-        pf.expmismatchI[i][j][k] = exp(-GT*10./kT);
-        GT = mismatch1nIdH[i][j][k] - (mismatch1nIdH[i][j][k] - mismatch1nI37[i][j][k])*TT;
-        pf.expmismatch1nI[i][j][k] = exp(-GT*10./kT);
-        GT = mismatchHdH[i][j][k] - (mismatchHdH[i][j][k] - mismatchH37[i][j][k])*TT;
-        pf.expmismatchH[i][j][k] = exp(-GT*10./kT);
-        GT = mismatch23IdH[i][j][k] - (mismatch23IdH[i][j][k] - mismatch23I37[i][j][k])*TT;
-        pf.expmismatch23I[i][j][k] = exp(-GT*10./kT);
-        if (dangles) {
-          GT = mismatchMdH[i][j][k] - (mismatchMdH[i][j][k] - mismatchM37[i][j][k])*TT;
-          pf.expmismatchM[i][j][k] = exp(-GT*10./kT);
-          GT =  mismatchExtdH[i][j][k] - ( mismatchExtdH[i][j][k] - mismatchExt37[i][j][k])*TT;
-          pf.expmismatchExt[i][j][k] = exp(-GT*10./kT);
-        }
-        else{
-          pf.expmismatchM[i][j][k] = pf.expmismatchExt[i][j][k] = 1.;
-        }
-      }
-
-
-  /* interior lops of length 2 */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++) {
-          GT = int11_dH[i][j][k][l] -
-            (int11_dH[i][j][k][l] - int11_37[i][j][k][l])*TT;
-          pf.expint11[i][j][k][l] = exp(-GT*10./kT);
-        }
-  /* interior 2x1 loops */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++) {
-          int m;
-          for (m=0; m<5; m++) {
-            GT = int21_dH[i][j][k][l][m] -
-              (int21_dH[i][j][k][l][m] - int21_37[i][j][k][l][m])*TT;
-            pf.expint21[i][j][k][l][m] = exp(-GT*10./kT);
-          }
-        }
-
-  /* interior 2x2 loops */
-  for (i=0; i<=NBPAIRS; i++)
-    for (j=0; j<=NBPAIRS; j++)
-      for (k=0; k<5; k++)
-        for (l=0; l<5; l++) {
-          int m,n;
-          for (m=0; m<5; m++)
-            for (n=0; n<5; n++) {
-              GT = int22_dH[i][j][k][l][m][n] -
-                (int22_dH[i][j][k][l][m][n]-int22_37[i][j][k][l][m][n])*TT;
-              pf.expint22[i][j][k][l][m][n] = exp(-GT*10./kT);
-            }
-        }
-
-  strncpy(pf.Tetraloops, Tetraloops, 281);
-  strncpy(pf.Triloops, Triloops, 241);
-  strncpy(pf.Hexaloops, Hexaloops, 361);
-
-  pf.id = ++pf_id;
-  return &pf;
-#endif
-}
diff --git a/cbits/part_func.c b/cbits/part_func.c
deleted file mode 100644
--- a/cbits/part_func.c
+++ /dev/null
@@ -1,1714 +0,0 @@
-/*
-                  partiton function for RNA secondary structures
-
-                  Ivo L Hofacker
-                  Vienna RNA package
-*/
-/*
-  $Log: part_func.c,v $
-  Revision 1.29  2008/02/23 10:10:49  ivo
-  list returned from StackProb was sometimes not terminated correctly
-
-  Revision 1.28  2008/01/08 15:08:10  ivo
-  circular fold would fail for open chain
-
-  Revision 1.27  2007/12/05 13:04:04  ivo
-  add various circfold variants from Ronny
-
-  Revision 1.26  2007/09/19 12:41:56  ivo
-  add computation of centroid() structure for RNAfold -p
-
-  Revision 1.25  2007/04/30 15:12:00  ivo
-  merge RNAup into package
-
-  Revision 1.24  2007/03/03 17:57:44  ivo
-  make sure entries in scale[] decrease to 0
-
-  Revision 1.23  2006/12/01 12:40:23  ivo
-  undo Ulli's accidental commit
-
-  Revision 1.21  2006/08/04 15:39:06  ivo
-  new function stackProb returns probability for stacks
-  p[(i,j)(i+1,j-1)]
-
-  Revision 1.20  2004/08/12 12:14:46  ivo
-  update
-
-  Revision 1.19  2004/05/14 16:28:05  ivo
-  fix the bug in make_ptype here too (fixed in 1.27 of fold.c)
-
-  Revision 1.18  2004/02/17 10:46:52  ivo
-  make sure init_pf_fold is called before scale_parameters
-
-  Revision 1.17  2004/02/09 18:37:59  ivo
-  new mean_bp_dist() function to compute ensemble diversity
-
-  Revision 1.16  2003/08/04 09:14:09  ivo
-  finish up stochastic backtracking
-
-  Revision 1.15  2002/03/19 16:51:12  ivo
-  more on stochastic backtracking (still incomplete)
-
-  Revision 1.14  2002/02/08 17:37:23  ivo
-  set freed S,S1 pointers to NULL
-
-  Revision 1.13  2001/11/16 17:30:04  ivo
-  add stochastic backtracking (still incomplete)
-*/
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <float.h>    /* #defines FLT_MAX ... */
-#include <limits.h>
-
-#include "utils.h"
-#include "energy_par.h"
-#include "fold_vars.h"
-#include "pair_mat.h"
-#include "params.h"
-#include "loop_energies.h"
-#include "gquad.h"
-#include "part_func.h"
-
-#ifdef _OPENMP
-#include <omp.h>
-#endif
-
-#define ISOLATED  256.0
-
-/*
-#################################
-# GLOBAL VARIABLES              #
-#################################
-*/
-PUBLIC  int         st_back = 0;
-
-/*
-#################################
-# PRIVATE VARIABLES             #
-#################################
-*/
-PRIVATE FLT_OR_DBL  *q = NULL, *qb=NULL, *qm = NULL, *qm1 = NULL, *qqm = NULL, *qqm1 = NULL, *qq = NULL, *qq1 = NULL;
-PRIVATE FLT_OR_DBL  *probs=NULL, *prml=NULL, *prm_l=NULL, *prm_l1=NULL, *q1k=NULL, *qln=NULL;
-PRIVATE FLT_OR_DBL  *scale=NULL;
-PRIVATE FLT_OR_DBL  *expMLbase=NULL;
-PRIVATE FLT_OR_DBL  qo=0., qho=0., qio=0., qmo=0., *qm2=NULL;
-PRIVATE int         *jindx=NULL;
-PRIVATE int         *my_iindx=NULL;
-PRIVATE int         init_length = -1;   /* length in last call to init_pf_fold() */
-PRIVATE int         circular=0;
-PRIVATE int         do_bppm = 1;             /* do backtracking per default */
-PRIVATE int         struct_constrained = 0;
-PRIVATE char        *pstruc=NULL;
-PRIVATE char        *sequence=NULL;
-PRIVATE char        *ptype=NULL;        /* precomputed array of pair types */
-PRIVATE pf_paramT   *pf_params=NULL;    /* the precomputed Boltzmann weights */
-PRIVATE short       *S=NULL, *S1=NULL;
-PRIVATE int         with_gquad = 0;
-
-PRIVATE FLT_OR_DBL  *G = NULL, *Gj = NULL, *Gj1 = NULL;
-
-#ifdef _OPENMP
-
-#pragma omp threadprivate(q, qb, qm, qm1, qqm, qqm1, qq, qq1, prml, prm_l, prm_l1, q1k, qln,\
-                          probs, scale, expMLbase, qo, qho, qio, qmo, qm2, jindx, my_iindx, init_length,\
-                          circular, pstruc, sequence, ptype, pf_params, S, S1, do_bppm, struct_constrained,\
-                          G, Gj, Gj1, with_gquad)
-
-#endif
-
-/*
-#################################
-# PRIVATE FUNCTION DECLARATIONS #
-#################################
-*/
-PRIVATE void  init_partfunc(int length, pf_paramT *parameters);
-PRIVATE void  scale_pf_params(unsigned int length, pf_paramT *parameters);
-PRIVATE void  get_arrays(unsigned int length);
-PRIVATE void  make_ptypes(const short *S, const char *structure);
-PRIVATE void  pf_circ(const char *sequence, char *structure);
-PRIVATE void  pf_linear(const char *sequence, char *structure);
-PRIVATE void  pf_create_bppm(const char *sequence, char *structure);
-PRIVATE void  backtrack(int i, int j);
-PRIVATE void  backtrack_qm(int i, int j);
-PRIVATE void  backtrack_qm1(int i,int j);
-PRIVATE void  backtrack_qm2(int u, int n);
-
-/*
-#################################
-# BEGIN OF FUNCTION DEFINITIONS #
-#################################
-*/
-
-PRIVATE void init_partfunc(int length, pf_paramT *parameters){
-  if (length<1) nrerror("init_pf_fold: length must be greater 0");
-
-#ifdef _OPENMP
-/* Explicitly turn off dynamic threads */
-  omp_set_dynamic(0);
-  free_pf_arrays(); /* free previous allocation */
-#else
-  if (init_length>0) free_pf_arrays(); /* free previous allocation */
-#endif
-
-#ifdef SUN4
-  nonstandard_arithmetic();
-#else
-#ifdef HP9
-  fpsetfastmode(1);
-#endif
-#endif
-  make_pair_matrix();
-  get_arrays((unsigned) length);
-  scale_pf_params((unsigned) length, parameters);
-
-  init_length = length;
-}
-
-PRIVATE void get_arrays(unsigned int length){
-  unsigned int size;
-
-  if((length +1) >= (unsigned int)sqrt((double)INT_MAX))
-    nrerror("get_arrays@part_func.c: sequence length exceeds addressable range");
-
-  size  = sizeof(FLT_OR_DBL) * ((length+1)*(length+2)/2);
-
-  q     = (FLT_OR_DBL *) space(size);
-  qb    = (FLT_OR_DBL *) space(size);
-  qm    = (FLT_OR_DBL *) space(size);
-  qm1   = (st_back || circular) ? (FLT_OR_DBL *) space(size) : NULL;
-  qm2   = (circular) ? (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2)) : NULL;
-  probs = (do_bppm) ? (FLT_OR_DBL *) space(size) : NULL;
-
-  ptype     = (char *) space(sizeof(char)*((length+1)*(length+2)/2));
-  q1k       = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+1));
-  qln       = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  qq        = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  qq1       = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  qqm       = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  qqm1      = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  prm_l     = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  prm_l1    = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  prml      = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  expMLbase = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+1));
-  scale     = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+1));
-
-  Gj        = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  Gj1       = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-
-  my_iindx  = get_iindx(length);
-  iindx     = get_iindx(length); /* for backward compatibility and Perl wrapper */
-  jindx     = get_indx(length);
-}
-
-/**
-*** Allocate memory for all matrices and other stuff
-**/
-PUBLIC void free_pf_arrays(void){
-  if(q)         free(q);
-  if(qb)        free(qb);
-  if(qm)        free(qm);
-  if(qm1)       free(qm1);
-  if(qm2)       free(qm2);
-  if(ptype)     free(ptype);
-  if(qq)        free(qq);
-  if(qq1)       free(qq1);
-  if(qqm)       free(qqm);
-  if(qqm1)      free(qqm1);
-  if(q1k)       free(q1k);
-  if(qln)       free(qln);
-  if(probs)     free(probs);
-  if(prm_l)     free(prm_l);
-  if(prm_l1)    free(prm_l1);
-  if(prml)      free(prml);
-  if(expMLbase) free(expMLbase);
-  if(scale)     free(scale);
-  if(my_iindx)  free(my_iindx);
-  if(iindx)     free(iindx); /* for backward compatibility and Perl wrapper */
-  if(jindx)     free(jindx);
-  if(S)         free(S);
-  if(S1)        free(S1);
-  if(G)         free(G);
-  if(Gj)        free(Gj);
-  if(Gj1)       free(Gj1);
-
-  S = S1 = NULL;
-  q = pr = probs = qb = qm = qm1 = qm2 = qq = qq1 = qqm = qqm1 = q1k = qln = prm_l = prm_l1 = prml = expMLbase = scale = G = Gj = Gj1 = NULL;
-  my_iindx = jindx = iindx = NULL;
-
-  ptype = NULL;
-
-#ifdef SUN4
-  standard_arithmetic();
-#else
-#ifdef HP9
-  fpsetfastmode(0);
-#endif
-#endif
-
-  init_length = 0;
-}
-
-/*-----------------------------------------------------------------*/
-PUBLIC float pf_fold(const char *sequence, char *structure){
-  return pf_fold_par(sequence, structure, NULL, do_backtrack, fold_constrained, 0);
-}
-
-PUBLIC float pf_circ_fold(const char *sequence, char *structure){
-  return pf_fold_par(sequence, structure, NULL, do_backtrack, fold_constrained, 1);
-}
-
-PUBLIC float pf_fold_par( const char *sequence,
-                          char *structure,
-                          pf_paramT *parameters,
-                          int calculate_bppm,
-                          int is_constrained,
-                          int is_circular){
-
-  FLT_OR_DBL  Q;
-  double      free_energy;
-  int         n = (int) strlen(sequence);
-
-  circular            = is_circular;
-  do_bppm             = calculate_bppm;
-  struct_constrained  = is_constrained;
-
-#ifdef _OPENMP
-  init_partfunc(n, parameters);
-#else
-  if(parameters) init_partfunc(n, parameters);
-  else if (n > init_length) init_partfunc(n, parameters);
-  else if (fabs(pf_params->temperature - temperature)>1e-6) update_pf_params_par(n, parameters);
-#endif
-
-  with_gquad  = pf_params->model_details.gquad;
-  S           = encode_sequence(sequence, 0);
-  S1          = encode_sequence(sequence, 1);
-
-  make_ptypes(S, structure);
-
-  /* do the linear pf fold and fill all matrices  */
-  pf_linear(sequence, structure);
-
-  if(circular)
-    pf_circ(sequence, structure); /* do post processing step for circular RNAs */
-
-  if (backtrack_type=='C')      Q = qb[my_iindx[1]-n];
-  else if (backtrack_type=='M') Q = qm[my_iindx[1]-n];
-  else Q = (circular) ? qo : q[my_iindx[1]-n];
-
-  /* ensemble free energy in Kcal/mol              */
-  if (Q<=FLT_MIN) fprintf(stderr, "pf_scale too large\n");
-  free_energy = (-log(Q)-n*log(pf_params->pf_scale))*pf_params->kT/1000.0;
-  /* in case we abort because of floating point errors */
-  if (n>1600) fprintf(stderr, "free energy = %8.2f\n", free_energy);
-
-  /* calculate base pairing probability matrix (bppm)  */
-  if(do_bppm){
-    pf_create_bppm(sequence, structure);
-    /*
-    *  Backward compatibility:
-    *  This block may be removed if deprecated functions
-    *  relying on the global variable "pr" vanish from within the package!
-    */
-    pr = probs;
-    /*
-     {
-      if(pr) free(pr);
-      pr = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL) * ((n+1)*(n+2)/2));
-      memcpy(pr, probs, sizeof(FLT_OR_DBL) * ((n+1)*(n+2)/2));
-    }
-    */
-  }
-  return free_energy;
-}
-
-PRIVATE void pf_linear(const char *sequence, char *structure){
-
-  int n, i,j,k,l, ij, u,u1,d,ii, type, type_2, tt, minl, maxl;
-
-  int noGUclosure;
-  FLT_OR_DBL expMLstem = 0.;
-
-  FLT_OR_DBL temp, Qmax=0;
-  FLT_OR_DBL qbt1, *tmp;
-
-  FLT_OR_DBL  expMLclosing = pf_params->expMLclosing;
-  double      max_real;
-
-  max_real = (sizeof(FLT_OR_DBL) == sizeof(float)) ? FLT_MAX : DBL_MAX;
-
-  n = (int) strlen(sequence);
-
-
-  noGUclosure = pf_params->model_details.noGUclosure;
-
-  /*array initialization ; qb,qm,q
-    qb,qm,q (i,j) are stored as ((n+1-i)*(n-i) div 2 + n+1-j */
-
-  if(with_gquad){
-    expMLstem = exp_E_MLstem(0, -1, -1, pf_params);
-    G         = get_gquad_pf_matrix(S, scale, pf_params);
-  }
-
-  for (d=0; d<=TURN; d++)
-    for (i=1; i<=n-d; i++) {
-      j=i+d;
-      ij = my_iindx[i]-j;
-      q[ij]=1.0*scale[d+1];
-      qb[ij]=qm[ij]=0.0;
-    }
- 
-  for (i=1; i<=n; i++)
-    qq[i]=qq1[i]=qqm[i]=qqm1[i]=0;
-
-  for (j=TURN+2;j<=n; j++) {
-    for (i=j-TURN-1; i>=1; i--) {
-      /* construction of partition function of segment i,j*/
-      /*firstly that given i binds j : qb(i,j) */
-      u = j-i-1; ij = my_iindx[i]-j;
-      type = ptype[ij];
-      if (type!=0) {
-        /*hairpin contribution*/
-        if (((type==3)||(type==4))&&noGUclosure) qbt1 = 0;
-        else
-          qbt1 = exp_E_Hairpin(u, type, S1[i+1], S1[j-1], sequence+i-1, pf_params) * scale[u+2];
-        /* interior loops with interior pair k,l */
-        for (k=i+1; k<=MIN2(i+MAXLOOP+1,j-TURN-2); k++) {
-          u1 = k-i-1;
-          for (l=MAX2(k+TURN+1,j-1-MAXLOOP+u1); l<j; l++) {
-            type_2 = ptype[my_iindx[k]-l];
-            if (type_2) {
-              type_2 = rtype[type_2];
-              qbt1 += qb[my_iindx[k]-l] * (scale[u1+j-l+1] *
-                                        exp_E_IntLoop(u1, j-l-1, type, type_2,
-                                        S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params));
-            }
-          }
-        }
-        /*multiple stem loop contribution*/
-        ii = my_iindx[i+1]; /* ii-k=[i+1,k-1] */
-        temp = 0.0;
-        for (k=i+2; k<=j-1; k++) temp += qm[ii-(k-1)]*qqm1[k];
-        tt = rtype[type];
-        qbt1 += temp * expMLclosing * exp_E_MLstem(tt, S1[j-1], S1[i+1], pf_params) * scale[2];
-
-        if(with_gquad){
-          qbt1 += exp_E_GQuad_IntLoop(i, j, type, S1, G, my_iindx, pf_params) * scale[2];
-        }
-
-        qb[ij] = qbt1;
-      }
-      /* end if (type!=0) */
-      else
-        qb[ij] = 0.0;
-
-      /* construction of qqm matrix containing final stem
-         contributions to multiple loop partition function
-         from segment i,j */
-      qqm[i] = qqm1[i]*expMLbase[1];
-      if (type) {
-        qbt1 = qb[ij] * exp_E_MLstem(type, ((i>1) || circular) ? S1[i-1] : -1, ((j<n) || circular) ? S1[j+1] : -1, pf_params);
-        qqm[i] += qbt1;
-      }
-
-      if(with_gquad){
-        /*include gquads into qqm*/
-        qqm[i] += G[my_iindx[i]-j] * expMLstem;
-      }
-
-      if (qm1) qm1[jindx[j]+i] = qqm[i]; /* for stochastic backtracking and circfold */
-
-      /*construction of qm matrix containing multiple loop
-        partition function contributions from segment i,j */
-      temp = 0.0;
-      ii = my_iindx[i];  /* ii-k=[i,k-1] */
-      for (k=j; k>i; k--) temp += (qm[ii-(k-1)] + expMLbase[k-i])*qqm[k];
-      qm[ij] = (temp + qqm[i]);
-
-      /*auxiliary matrix qq for cubic order q calculation below */
-      qbt1=0.0;
-      if (type){
-        qbt1 += qb[ij];
-        qbt1 *= exp_E_ExtLoop(type, ((i>1) || circular) ? S1[i-1] : -1, ((j<n) || circular) ? S1[j+1] : -1, pf_params);
-      }
-
-      if(with_gquad){
-        qbt1 += G[ij];
-      }
-
-      qq[i] = qq1[i]*scale[1] + qbt1;
-
-      /*construction of partition function for segment i,j */
-      temp = 1.0*scale[1+j-i] + qq[i];
-      for (k=i; k<=j-1; k++) temp += q[ii-k]*qq[k+1];
-      q[ij] = temp;
-      if (temp>Qmax) {
-        Qmax = temp;
-        if (Qmax>max_real/10.)
-          fprintf(stderr, "Q close to overflow: %d %d %g\n", i,j,temp);
-      }
-      if (temp>=max_real) {
-        PRIVATE char msg[128];
-        sprintf(msg, "overflow in pf_fold while calculating q[%d,%d]\n"
-                     "use larger pf_scale", i,j);
-        nrerror(msg);
-      }
-    }
-    tmp = qq1;  qq1 =qq;  qq =tmp;
-    tmp = qqm1; qqm1=qqm; qqm=tmp;
-
-    if(with_gquad){ /* rotate the auxilary g-quadruplex matrices */
-      tmp = Gj1; Gj1=Gj; Gj=tmp;
-    }
-  }
-}
-
-/* calculate partition function for circular case */
-/* NOTE: this is the postprocessing step ONLY     */
-/* You have to call pf_linear first to calculate  */
-/* complete circular case!!!                      */
-PRIVATE void pf_circ(const char *sequence, char *structure){
-
-  int u, p, q, k, l;
-  int noGUclosure;
-  int n = (int) strlen(sequence);
-
-  FLT_OR_DBL  qot;
-  FLT_OR_DBL  expMLclosing  = pf_params->expMLclosing;
-
-  noGUclosure = pf_params->model_details.noGUclosure;
-  qo = qho = qio = qmo = 0.;
-
-  /* construct qm2 matrix from qm1 entries  */
-  for(k=1; k<n-TURN-1; k++){
-    qot = 0.;
-    for (u=k+TURN+1; u<n-TURN-1; u++)
-      qot += qm1[jindx[u]+k]*qm1[jindx[n]+(u+1)];
-    qm2[k] = qot;
-   }
-
-  for(p = 1; p < n; p++){
-    for(q = p + TURN + 1; q <= n; q++){
-      int type;
-      /* 1. get exterior hairpin contribution  */
-      u = n-q + p-1;
-      if (u<TURN) continue;
-      type = ptype[my_iindx[p]-q];
-      if (!type) continue;
-       /* cause we want to calc the exterior loops, we need the reversed pair type from now on  */
-      type=rtype[type];
-
-      char loopseq[10];
-      if (u<7){
-        strcpy(loopseq , sequence+q-1);
-        strncat(loopseq, sequence, p);
-      }
-      qho += (((type==3)||(type==4))&&noGUclosure) ? 0. : qb[my_iindx[p]-q] * exp_E_Hairpin(u, type, S1[q+1], S1[p-1],  loopseq, pf_params) * scale[u];
-
-      /* 2. exterior interior loops, i "define" the (k,l) pair as "outer pair"  */
-      /* so "outer type" is rtype[type[k,l]] and inner type is type[p,q]        */
-      qot = 0.;
-      for(k=q+1; k < n; k++){
-        int ln1, lstart;
-        ln1 = k - q - 1;
-        if(ln1+p-1>MAXLOOP) break;
-        lstart = ln1+p-1+n-MAXLOOP;
-        if(lstart<k+TURN+1) lstart = k + TURN + 1;
-        for(l=lstart;l <= n; l++){
-          int ln2, type2;
-          ln2 = (p - 1) + (n - l);
-
-          if((ln1+ln2) > MAXLOOP) continue;
-
-          type2 = ptype[my_iindx[k]-l];
-          if(!type2) continue;
-          qio += qb[my_iindx[p]-q] * qb[my_iindx[k]-l] * exp_E_IntLoop(ln2, ln1, rtype[type2], type, S1[l+1], S1[k-1], S1[p-1], S1[q+1], pf_params) * scale[ln1+ln2];
-        }
-      } /* end of kl double loop */
-    }
-  } /* end of pq double loop */
-
-  /* 3. Multiloops  */
-  for(k=TURN+2; k<n-2*TURN-3; k++)
-    qmo += qm[my_iindx[1]-k] * qm2[k+1] * expMLclosing;
-
-  /* add an additional pf of 1.0 to take the open chain into account too           */
-  qo = qho + qio + qmo + 1.0*scale[n];
-}
-
-/* calculate base pairing probs */
-PUBLIC void pf_create_bppm(const char *sequence, char *structure){
-  int n, i,j,k,l, ij, kl, ii, i1, ll, type, type_2, tt, u1, ov=0;
-  FLT_OR_DBL  temp, Qmax=0, prm_MLb;
-  FLT_OR_DBL  prmt,prmt1;
-  FLT_OR_DBL  *tmp;
-  FLT_OR_DBL  tmp2;
-  FLT_OR_DBL  expMLclosing = pf_params->expMLclosing;
-  double      max_real;
-
-  FLT_OR_DBL  expMLstem = (with_gquad) ? exp_E_MLstem(0, -1, -1, pf_params) : 0;
-
-  max_real = (sizeof(FLT_OR_DBL) == sizeof(float)) ? FLT_MAX : DBL_MAX;
-
-  if((S != NULL) && (S1 != NULL)){
-    n = S[0];
-    Qmax=0;
-
-    for (k=1; k<=n; k++) {
-      q1k[k] = q[my_iindx[1] - k];
-      qln[k] = q[my_iindx[k] -n];
-    }
-    q1k[0] = 1.0;
-    qln[n+1] = 1.0;
-
-/*  pr = q; */     /* recycling */
-
-
-    /* 1. exterior pair i,j and initialization of pr array */
-    if(circular){
-      for (i=1; i<=n; i++) {
-        for (j=i; j<=MIN2(i+TURN,n); j++)
-          probs[my_iindx[i]-j] = 0;
-        for (j=i+TURN+1; j<=n; j++) {
-          ij = my_iindx[i]-j;
-          type = ptype[ij];
-          if (type&&(qb[ij]>0.)) {
-            probs[ij] = 1./qo;
-            int rt = rtype[type];
-
-            /* 1.1. Exterior Hairpin Contribution */
-            int u = i + n - j -1;
-            /* get the loop sequence */
-            char loopseq[10];
-            if (u<7){
-              strcpy(loopseq , sequence+j-1);
-              strncat(loopseq, sequence, i);
-            }
-            tmp2 = exp_E_Hairpin(u, rt, S1[j+1], S1[i-1], loopseq, pf_params) * scale[u];
-
-            /* 1.2. Exterior Interior Loop Contribution                    */
-            /* 1.2.1. i,j  delimtis the "left" part of the interior loop    */
-            /* (j,i) is "outer pair"                                                */
-            for(k=1; k < i-TURN-1; k++){
-              int ln1, lstart;
-              ln1 = k + n - j - 1;
-              if(ln1>MAXLOOP) break;
-              lstart = ln1+i-1-MAXLOOP;
-              if(lstart<k+TURN+1) lstart = k + TURN + 1;
-              for(l=lstart; l < i; l++){
-                int ln2, type_2;
-                type_2 = ptype[my_iindx[k]-l];
-                if (type_2==0) continue;
-                ln2 = i - l - 1;
-                if(ln1+ln2>MAXLOOP) continue;
-                tmp2 += qb[my_iindx[k] - l]
-                        * exp_E_IntLoop(ln1,
-                                        ln2,
-                                        rt,
-                                        rtype[type_2],
-                                        S1[j+1],
-                                        S1[i-1],
-                                        S1[k-1],
-                                        S1[l+1],
-                                        pf_params)
-                        * scale[ln1 + ln2];
-              }
-            }
-            /* 1.2.2. i,j  delimtis the "right" part of the interior loop  */
-            for(k=j+1; k < n-TURN; k++){
-              int ln1, lstart;
-              ln1 = k - j - 1;
-              if((ln1 + i - 1)>MAXLOOP) break;
-              lstart = ln1+i-1+n-MAXLOOP;
-              if(lstart<k+TURN+1) lstart = k + TURN + 1;
-              for(l=lstart; l <= n; l++){
-                int ln2, type_2;
-                type_2 = ptype[my_iindx[k]-l];
-                if (type_2==0) continue;
-                ln2 = i - 1 + n - l;
-                if(ln1+ln2>MAXLOOP) continue;
-                tmp2 += qb[my_iindx[k] - l]
-                        * exp_E_IntLoop(ln2,
-                                        ln1,
-                                        rtype[type_2],
-                                        rt,
-                                        S1[l+1],
-                                        S1[k-1],
-                                        S1[i-1],
-                                        S1[j+1],
-                                        pf_params)
-                        * scale[ln1 + ln2];
-              }
-            }
-            /* 1.3 Exterior multiloop decomposition */
-            /* 1.3.1 Middle part                    */
-            if((i>TURN+2) && (j<n-TURN-1))
-              tmp2 += qm[my_iindx[1]-i+1]
-                      * qm[my_iindx[j+1]-n]
-                      * expMLclosing
-                      * exp_E_MLstem(type, S1[i-1], S1[j+1], pf_params);
-
-            /* 1.3.2 Left part                      */
-            for(k=TURN+2; k < i-TURN-2; k++)
-              tmp2 += qm[my_iindx[1]-k]
-                      * qm1[jindx[i-1]+k+1]
-                      * expMLbase[n-j]
-                      * expMLclosing
-                      * exp_E_MLstem(type, S1[i-1], S1[j+1], pf_params);
-
-            /* 1.3.3 Right part                      */
-            for(k=j+TURN+2; k < n-TURN-1;k++)
-              tmp2 += qm[my_iindx[j+1]-k]
-                      * qm1[jindx[n]+k+1]
-                      * expMLbase[i-1]
-                      * expMLclosing
-                      * exp_E_MLstem(type, S1[i-1], S1[j+1], pf_params);
-
-            /* all exterior loop decompositions for pair i,j done  */
-            probs[ij] *= tmp2;
-
-          }
-          else probs[ij] = 0;
-        }
-      }
-    } /* end if(circular)  */
-    else {
-      for (i=1; i<=n; i++) {
-        for (j=i; j<=MIN2(i+TURN,n); j++) probs[my_iindx[i]-j] = 0;
-        for (j=i+TURN+1; j<=n; j++) {
-          ij = my_iindx[i]-j;
-          type = ptype[ij];
-          if (type&&(qb[ij]>0.)) {
-            probs[ij] = q1k[i-1]*qln[j+1]/q1k[n];
-            probs[ij] *= exp_E_ExtLoop(type, (i>1) ? S1[i-1] : -1, (j<n) ? S1[j+1] : -1, pf_params);
-          }
-          else
-            probs[ij] = 0.;
-        }
-      }
-    } /* end if(!circular)  */
-
-    for (l=n; l>TURN+1; l--) {
-
-      /* 2. bonding k,l as substem of 2:loop enclosed by i,j */
-      for (k=1; k<l-TURN; k++) {
-        kl = my_iindx[k]-l;
-        type_2 = ptype[kl]; 
-        if (type_2==0) continue;
-        type_2 = rtype[type_2];
-        if (qb[kl]==0.) continue;
-
-        tmp2 = 0.;
-        for (i=MAX2(1,k-MAXLOOP-1); i<=k-1; i++)
-          for (j=l+1; j<=MIN2(l+ MAXLOOP -k+i+2,n); j++) {
-            ij = my_iindx[i] - j;
-            type = ptype[ij];
-            if (type && (probs[ij]>0.)) {
-              /* add *scale[u1+u2+2] */
-              tmp2 +=  probs[ij]
-                       * (scale[k-i+j-l]
-                       * exp_E_IntLoop(k - i - 1,
-                                       j - l - 1,
-                                       type,
-                                       type_2,
-                                       S1[i + 1],
-                                       S1[j - 1],
-                                       S1[k - 1],
-                                       S1[l + 1],
-                                       pf_params));
-            }
-          }
-        probs[kl] += tmp2;
-      }
-
-      if(with_gquad){
-        /* 2.5. bonding k,l as gquad enclosed by i,j */
-        FLT_OR_DBL *expintern = &(pf_params->expinternal[0]);
-        FLT_OR_DBL qe;
-
-        if(l < n - 3){
-          for(k = 2; k <= l - VRNA_GQUAD_MIN_BOX_SIZE; k++){
-            kl = my_iindx[k]-l;
-            if (G[kl]==0.) continue;
-            tmp2 = 0.;
-            i = k - 1;
-            for(j = MIN2(l + MAXLOOP + 1, n); j > l + 3; j--){
-              ij = my_iindx[i] - j;
-              type = ptype[ij];
-              if(!type) continue;
-              qe = (type > 2) ? pf_params->expTermAU : 1.;
-              tmp2 += probs[ij] * qe * expintern[j-l-1] * pf_params->expmismatchI[type][S1[i+1]][S1[j-1]] * scale[2];
-            }
-            probs[kl] += tmp2 * G[kl];
-          }
-        }
-
-        if (l < n - 1){
-          for (k=3; k<=l-VRNA_GQUAD_MIN_BOX_SIZE; k++) {
-            kl = my_iindx[k]-l;
-            if (G[kl]==0.) continue;
-            tmp2 = 0.;
-            for (i=MAX2(1,k-MAXLOOP-1); i<=k-2; i++){
-              u1 = k - i - 1;
-              for (j=l+2; j<=MIN2(l + MAXLOOP - u1 + 1,n); j++) {
-                ij = my_iindx[i] - j;
-                type = ptype[ij];
-                if(!type) continue;
-                qe = (type > 2) ? pf_params->expTermAU : 1.;
-                tmp2 += probs[ij] * qe * expintern[u1+j-l-1] * pf_params->expmismatchI[type][S1[i+1]][S1[j-1]] * scale[2];
-              }
-            }
-            probs[kl] += tmp2 * G[kl];
-          }
-        }
-
-        if(l < n){
-          for(k = 4; k <= l - VRNA_GQUAD_MIN_BOX_SIZE; k++){
-            kl = my_iindx[k]-l;
-            if (G[kl]==0.) continue;
-            tmp2 = 0.;
-            j = l + 1;
-            for (i=MAX2(1,k-MAXLOOP-1); i < k - 3; i++){
-              ij = my_iindx[i] - j;
-              type = ptype[ij];
-              if(!type) continue;
-              qe = (type > 2) ? pf_params->expTermAU : 1.;
-              tmp2 += probs[ij] * qe * expintern[k - i - 1] * pf_params->expmismatchI[type][S1[i+1]][S1[j-1]] * scale[2];
-            }
-            probs[kl] += tmp2 * G[kl];
-          }
-        }
-      }
-
-      /* 3. bonding k,l as substem of multi-loop enclosed by i,j */
-      prm_MLb = 0.;
-      if (l<n) for (k=2; k<l-TURN; k++) {
-        i = k-1;
-        prmt = prmt1 = 0.0;
-
-        ii = my_iindx[i];     /* ii-j=[i,j]     */
-        ll = my_iindx[l+1];   /* ll-j=[l+1,j-1] */
-        tt = ptype[ii-(l+1)]; tt=rtype[tt];
-        /* (i, l+1) closes the ML with substem (k,l) */
-        if(tt)
-          prmt1 = probs[ii-(l+1)] * expMLclosing * exp_E_MLstem(tt, S1[l], S1[i+1], pf_params);
-
-        /* (i,j) with j>l+1 closes the ML with substem (k,l) */
-        for (j=l+2; j<=n; j++) {
-          tt = ptype[ii-j]; tt = rtype[tt];
-          if(tt)
-            prmt += probs[ii-j] * exp_E_MLstem(tt, S1[j-1], S1[i+1], pf_params) * qm[ll-(j-1)];
-        }
-        kl = my_iindx[k]-l;
-        tt = ptype[kl];
-        prmt *= expMLclosing;
-        prml[ i] = prmt;
-        prm_l[i] = prm_l1[i]*expMLbase[1]+prmt1;
-
-        prm_MLb = prm_MLb*expMLbase[1] + prml[i];
-        /* same as:    prm_MLb = 0;
-           for (i=1; i<=k-1; i++) prm_MLb += prml[i]*expMLbase[k-i-1]; */
-
-        prml[i] = prml[ i] + prm_l[i];
-
-        if(with_gquad){
-          if ((!tt) && (G[kl] == 0.)) continue;
-        } else {
-          if (qb[kl] == 0.) continue;
-        }
-
-        temp = prm_MLb;
-
-        for (i=1;i<=k-2; i++)
-          temp += prml[i]*qm[my_iindx[i+1] - (k-1)];
-
-        if(with_gquad){
-          if(tt)
-            temp    *= exp_E_MLstem(tt, (k>1) ? S1[k-1] : -1, (l<n) ? S1[l+1] : -1, pf_params) * scale[2];
-          else
-            temp    *= G[kl] * expMLstem * scale[2];
-        } else {
-          temp    *= exp_E_MLstem(tt, (k>1) ? S1[k-1] : -1, (l<n) ? S1[l+1] : -1, pf_params) * scale[2];
-        }
-
-        probs[kl]  += temp;
-
-        if (probs[kl]>Qmax) {
-          Qmax = probs[kl];
-          if (Qmax>max_real/10.)
-            fprintf(stderr, "P close to overflow: %d %d %g %g\n",
-              i, j, probs[kl], qb[kl]);
-        }
-        if (probs[kl]>=max_real) {
-          ov++;
-          probs[kl]=FLT_MAX;
-        }
-
-      } /* end for (k=..) */
-      tmp = prm_l1; prm_l1=prm_l; prm_l=tmp;
-
-    }  /* end for (l=..)   */
-
-    for (i=1; i<=n; i++)
-      for (j=i+TURN+1; j<=n; j++) {
-        ij = my_iindx[i]-j;
-
-        if(with_gquad){
-          if (qb[ij] > 0.)
-            probs[ij] *= qb[ij];
-          if (G[ij] > 0.){
-            probs[ij] += q1k[i-1] * G[ij] * qln[j+1]/q1k[n];
-          }
-        } else {
-          if (qb[ij] > 0.)
-            probs[ij] *= qb[ij];
-        }
-      }
-
-    if (structure!=NULL)
-      bppm_to_structure(structure, probs, n);
-    if (ov>0) fprintf(stderr, "%d overflows occurred while backtracking;\n"
-        "you might try a smaller pf_scale than %g\n",
-        ov, pf_params->pf_scale);
-  } /* end if((S != NULL) && (S1 != NULL))  */
-  else
-    nrerror("bppm calculations have to be done after calling forward recursion\n");
-  return;
-}
-
-PRIVATE void scale_pf_params(unsigned int length, pf_paramT *parameters){
-  unsigned int  i;
-  double        scaling_factor;
-
-  if(pf_params) free(pf_params);
-
-  if(parameters){
-    pf_params = get_boltzmann_factor_copy(parameters);
-  } else {
-    model_detailsT md;
-    set_model_details(&md);
-    pf_params = get_boltzmann_factors(temperature, 1.0, md, pf_scale);
-  }
-
-  scaling_factor = pf_params->pf_scale;
-
-  /* scaling factors (to avoid overflows) */
-  if (scaling_factor == -1) { /* mean energy for random sequences: 184.3*length cal */
-    scaling_factor = exp(-(-185+(pf_params->temperature-37.)*7.27)/pf_params->kT);
-    if (scaling_factor<1) scaling_factor=1;
-    pf_params->pf_scale = scaling_factor;
-    pf_scale = pf_params->pf_scale; /* compatibility with RNAup, may be removed sometime */
-  }
-  scale[0] = 1.;
-  scale[1] = 1./scaling_factor;
-  expMLbase[0] = 1;
-  expMLbase[1] = pf_params->expMLbase/scaling_factor;
-  for (i=2; i<=length; i++) {
-    scale[i] = scale[i/2]*scale[i-(i/2)];
-    expMLbase[i] = pow(pf_params->expMLbase, (double)i) * scale[i];
-  }
-}
-
-/*---------------------------------------------------------------------------*/
-
-PUBLIC void update_pf_params(int length){
-  update_pf_params_par(length, NULL);
-}
-
-PUBLIC void update_pf_params_par(int length, pf_paramT *parameters){
-#ifdef _OPENMP
-  make_pair_matrix(); /* is this really necessary? */
-  scale_pf_params((unsigned) length, parameters);
-#else
-  if(parameters) init_partfunc(length, parameters);
-  else if (length>init_length) init_partfunc(length, parameters);  /* init not update */
-  else {
-    make_pair_matrix();
-    scale_pf_params((unsigned) length, parameters);
-  }
-#endif
-}
-
-/*---------------------------------------------------------------------------*/
-
-PUBLIC char bppm_symbol(const float *x){
-/*  if( ((x[1]-x[2])*(x[1]-x[2]))<0.1&&x[0]<=0.677) return '|'; */
-  if( x[0] > 0.667 )  return '.';
-  if( x[1] > 0.667 )  return '(';
-  if( x[2] > 0.667 )  return ')';
-  if( (x[1]+x[2]) > x[0] ) {
-    if( (x[1]/(x[1]+x[2])) > 0.667) return '{';
-    if( (x[2]/(x[1]+x[2])) > 0.667) return '}';
-    else return '|';
-  }
-  if( x[0] > (x[1]+x[2]) ) return ',';
-  return ':';
-}
-
-PUBLIC void bppm_to_structure(char *structure, FLT_OR_DBL *p, unsigned int length){
-  int    i, j;
-  int   *index = get_iindx(length);
-  float  P[3];   /* P[][0] unpaired, P[][1] upstream p, P[][2] downstream p */
-
-  for( j=1; j<=length; j++ ) {
-    P[0] = 1.0;
-    P[1] = P[2] = 0.0;
-    for( i=1; i<j; i++) {
-      P[2] += p[index[i]-j];    /* j is paired downstream */
-      P[0] -= p[index[i]-j];    /* j is unpaired */
-    }
-    for( i=j+1; i<=length; i++ ) {
-      P[1] += p[index[j]-i];    /* j is paired upstream */
-      P[0] -= p[index[j]-i];    /* j is unpaired */
-    }
-    structure[j-1] = bppm_symbol(P);
-  }
-  structure[length] = '\0';
-  free(index);
-}
-
-
-/*---------------------------------------------------------------------------*/
-PRIVATE void make_ptypes(const short *S, const char *structure){
-  int n,i,j,k,l, noLP;
-
-  noLP = pf_params->model_details.noLP;
-
-  n=S[0];
-  for (k=1; k<n-TURN; k++)
-    for (l=1; l<=2; l++) {
-      int type,ntype=0,otype=0;
-      i=k; j = i+TURN+l; if (j>n) continue;
-      type = pair[S[i]][S[j]];
-      while ((i>=1)&&(j<=n)) {
-        if ((i>1)&&(j<n)) ntype = pair[S[i-1]][S[j+1]];
-        if (noLP && (!otype) && (!ntype))
-          type = 0; /* i.j can only form isolated pairs */
-        qb[my_iindx[i]-j] = 0.;
-        ptype[my_iindx[i]-j] = (char) type;
-        otype =  type;
-        type  = ntype;
-        i--; j++;
-      }
-    }
-
-  if (struct_constrained && (structure != NULL))
-    constrain_ptypes(structure, (unsigned int)n, ptype, NULL, TURN, 1);
-}
-
-/*
-  stochastic backtracking in pf_fold arrays
-  returns random structure S with Boltzman probabilty
-  p(S) = exp(-E(S)/kT)/Z
-*/
-char *pbacktrack(char *seq){
-  double r, qt;
-  int i,j,n, start;
-  sequence = seq;
-  n = strlen(sequence);
-
-  if (init_length<1)
-    nrerror("can't backtrack without pf arrays.\n"
-            "Call pf_fold() before pbacktrack()");
-  pstruc = space((n+1)*sizeof(char));
-
-  for (i=0; i<n; i++) pstruc[i] = '.';
-
-  start = 1;
-  while (start<n) {
-  /* find i position of first pair */
-    for (i=start; i<n; i++) {
-      r = urn() * qln[i];
-      if (r > qln[i+1]*scale[1])  break; /* i is paired */
-    }
-    if (i>=n) break; /* no more pairs */
-    /* now find the pairing partner j */
-    r = urn() * (qln[i] - qln[i+1]*scale[1]);
-    for (qt=0, j=i+1; j<=n; j++) {
-      int type;
-      type = ptype[my_iindx[i]-j];
-      if (type) {
-        double qkl;
-        qkl = qb[my_iindx[i]-j];
-        if (j<n) qkl *= qln[j+1];
-        qkl *=  exp_E_ExtLoop(type, (i>1) ? S1[i-1] : -1, (j<n) ? S1[j+1] : -1, pf_params);
-        qt += qkl;
-        if (qt > r) break; /* j is paired */
-      }
-    }
-    if (j==n+1) nrerror("backtracking failed in ext loop");
-    start = j+1;
-    backtrack(i,j);
-  }
-
-  return pstruc;
-}
-char *pbacktrack_circ(char *seq){
-  double r, qt;
-  int i, j, k, l, n;
-  FLT_OR_DBL  expMLclosing      = pf_params->expMLclosing;
-
-  sequence = seq;
-  n = strlen(sequence);
-
-  if (init_length<1)
-    nrerror("can't backtrack without pf arrays.\n"
-      "Call pf_circ_fold() before pbacktrack_circ()");
-  pstruc = space((n+1)*sizeof(char));
-
-  /* initialize pstruct with single bases  */
-  for (i=0; i<n; i++) pstruc[i] = '.';
-
-  qt = 1.0*scale[n];
-  r = urn() * qo;
-
-  /* open chain? */
-  if(qt > r) return pstruc;
-
-  for(i=1; (i < n); i++){
-    for(j=i+TURN+1;(j<=n); j++){
-
-      int type, u;
-      /* 1. first check, wether we can do a hairpin loop  */
-      u = n-j + i-1;
-      if (u<TURN) continue;
-
-      type = ptype[my_iindx[i]-j];
-      if (!type) continue;
-
-      type=rtype[type];
-
-      char loopseq[10];
-      if (u<7){
-        strcpy(loopseq , sequence+j-1);
-        strncat(loopseq, sequence, i);
-      }
-
-      qt += qb[my_iindx[i]-j] * exp_E_Hairpin(u, type, S1[j+1], S1[i-1],  loopseq, pf_params) * scale[u];
-      /* found a hairpin? so backtrack in the enclosed part and we're done  */
-      if(qt>r){ backtrack(i,j); return pstruc;}
-
-      /* 2. search for (k,l) with which we can close an interior loop  */
-      for(k=j+1; (k < n); k++){
-        int ln1, lstart;
-        ln1 = k - j - 1;
-        if(ln1+i-1>MAXLOOP) break;
-
-        lstart = ln1+i-1+n-MAXLOOP;
-        if(lstart<k+TURN+1) lstart = k + TURN + 1;
-        for(l=lstart; (l <= n); l++){
-            int ln2, type2;
-            ln2 = (i - 1) + (n - l);
-            if((ln1+ln2) > MAXLOOP) continue;
-
-            type2 = ptype[my_iindx[k]-l];
-            if(!type) continue;
-            type2 = rtype[type2];
-            qt += qb[my_iindx[i]-j] * qb[my_iindx[k]-l] * exp_E_IntLoop(ln2, ln1, type2, type, S1[l+1], S1[k-1], S1[i-1], S1[j+1], pf_params) * scale[ln1 + ln2];
-            /* found an exterior interior loop? also this time, we can go straight  */
-            /* forward and backtracking the both enclosed parts and we're done      */
-            if(qt>r){ backtrack(i,j); backtrack(k,l); return pstruc;}
-        }
-      } /* end of kl double loop */
-    }
-  } /* end of ij double loop  */
-  {
-    /* as we reach this part, we have to search for our barrier between qm and qm2  */
-    qt = 0.;
-    r = urn()*qmo;
-    for(k=TURN+2; k<n-2*TURN-3; k++){
-      qt += qm[my_iindx[1]-k] * qm2[k+1] * expMLclosing;
-      /* backtrack in qm and qm2 if we've found a valid barrier k  */
-      if(qt>r){ backtrack_qm(1,k); backtrack_qm2(k+1,n); return pstruc;}
-    }
-  }
-  /* if we reach the actual end of this function, an error has occured  */
-  /* cause we HAVE TO find an exterior loop or an open chain!!!         */
-  nrerror("backtracking failed in exterior loop");
-  return pstruc;
-}
-
-PRIVATE void backtrack_qm(int i, int j){
-  /* divide multiloop into qm and qm1  */
-  double qmt, r;
-  int k;
-  while(j>i){
-    /* now backtrack  [i ... j] in qm[] */
-    r = urn() * qm[my_iindx[i] - j];
-    qmt = qm1[jindx[j]+i]; k=i;
-    if(qmt<r)
-      for(k=i+1; k<=j; k++){
-        qmt += (qm[my_iindx[i]-(k-1)]+expMLbase[k-i])*qm1[jindx[j]+k];
-        if(qmt >= r) break;
-      }
-    if(k>j) nrerror("backtrack failed in qm");
-
-    backtrack_qm1(k,j);
-
-    if(k<i+TURN) break; /* no more pairs */
-    r = urn() * (qm[my_iindx[i]-(k-1)] + expMLbase[k-i]);
-    if(expMLbase[k-i] >= r) break; /* no more pairs */
-    j = k-1;
-  }
-}
-
-PRIVATE void backtrack_qm1(int i,int j){
-  /* i is paired to l, i<l<j; backtrack in qm1 to find l */
-  int ii, l, type;
-  double qt, r;
-  r = urn() * qm1[jindx[j]+i];
-  ii = my_iindx[i];
-  for (qt=0., l=i+TURN+1; l<=j; l++) {
-    type = ptype[ii-l];
-    if (type)
-      qt +=  qb[ii-l] * exp_E_MLstem(type, S1[i-1], S1[l+1], pf_params) * expMLbase[j-l];
-    if (qt>=r) break;
-  }
-  if (l>j) nrerror("backtrack failed in qm1");
-  backtrack(i,l);
-}
-
-PRIVATE void backtrack_qm2(int k, int n){
-  double qom2t, r;
-  int u;
-  r= urn()*qm2[k];
-  /* we have to search for our barrier u between qm1 and qm1  */
-  for (qom2t = 0.,u=k+TURN+1; u<n-TURN-1; u++){
-    qom2t += qm1[jindx[u]+k]*qm1[jindx[n]+(u+1)];
-    if(qom2t > r) break;
-  }
-  if(u==n-TURN) nrerror("backtrack failed in qm2");
-  backtrack_qm1(k,u);
-  backtrack_qm1(u+1,n);
-}
-
-PRIVATE void backtrack(int i, int j){
-  int noGUclosure = pf_params->model_details.noGUclosure;
-
-  do {
-    double r, qbt1;
-    int k, l, type, u, u1;
-
-    pstruc[i-1] = '('; pstruc[j-1] = ')';
-
-    r = urn() * qb[my_iindx[i]-j];
-    type = ptype[my_iindx[i]-j];
-    u = j-i-1;
-    /*hairpin contribution*/
-    if (((type==3)||(type==4))&&noGUclosure) qbt1 = 0;
-    else
-      qbt1 = exp_E_Hairpin(u, type, S1[i+1], S1[j-1], sequence+i-1, pf_params)*
-        scale[u+2]; /* add scale[u+2] */
-
-    if (qbt1>=r) return; /* found the hairpin we're done */
-
-    for (k=i+1; k<=MIN2(i+MAXLOOP+1,j-TURN-2); k++) {
-      u1 = k-i-1;
-      for (l=MAX2(k+TURN+1,j-1-MAXLOOP+u1); l<j; l++) {
-        int type_2;
-        type_2 = ptype[my_iindx[k]-l];
-        if (type_2) {
-          type_2 = rtype[type_2];
-          /* add *scale[u1+u2+2] */
-          qbt1 += qb[my_iindx[k]-l] * (scale[u1+j-l+1] *
-            exp_E_IntLoop(u1, j-l-1, type, type_2,
-                          S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params));
-        }
-        if (qbt1 > r) break;
-      }
-      if (qbt1 > r) break;
-    }
-    if (l<j) {
-      i=k; j=l;
-    }
-    else break;
-  } while (1);
-
-  /* backtrack in multi-loop */
-  {
-    double r, qt;
-    int k, ii, jj;
-
-    i++; j--;
-    /* find the first split index */
-    ii = my_iindx[i]; /* ii-j=[i,j] */
-    jj = jindx[j]; /* jj+i=[j,i] */
-    for (qt=0., k=i+1; k<j; k++) qt += qm[ii-(k-1)]*qm1[jj+k];
-    r = urn() * qt;
-    for (qt=0., k=i+1; k<j; k++) {
-      qt += qm[ii-(k-1)]*qm1[jj+k];
-      if (qt>=r) break;
-    }
-    if (k>=j) nrerror("backtrack failed, can't find split index ");
-
-    backtrack_qm1(k, j);
-
-    j = k-1;
-    backtrack_qm(i,j);
-  }
-}
-
-PUBLIC void assign_plist_from_pr(plist **pl, FLT_OR_DBL *probs, int length, double cut_off){
-  int i, j, n, count, *index;
-  count = 0;
-  n     = 2;
-
-  index = get_iindx(length);
-
-  /* first guess of the size needed for pl */
-  *pl = (plist *)space(n*length*sizeof(plist));
-
-  for (i=1; i<length; i++) {
-    for (j=i+1; j<=length; j++) {
-      /* skip all entries below the cutoff */
-      if (probs[index[i]-j] < cut_off) continue;
-      /* do we need to allocate more memory? */
-      if (count == n * length - 1){
-        n *= 2;
-        *pl = (plist *)xrealloc(*pl, n * length * sizeof(plist));
-      }
-      (*pl)[count].i    = i;
-      (*pl)[count].j    = j;
-      (*pl)[count].p  = probs[index[i] - j];
-      (*pl)[count++].type = 0;
-    }
-  }
-  /* mark the end of pl */
-  (*pl)[count].i   = 0;
-  (*pl)[count].j   = 0;
-  (*pl)[count].p = 0.;
-  (*pl)[count++].type = 0;
-  /* shrink memory to actual size needed */
-  *pl = (plist *)xrealloc(*pl, count * sizeof(plist));
-
-  free(index);
-}
-
-/* this doesn't work if free_pf_arrays() is called before */
-PUBLIC void assign_plist_gquad_from_pr( plist **pl,
-                                        int length,
-                                        double cut_off){
-
-  int i, j, k, n, count, *index;
-  count = 0;
-  n     = 2;
-
-  if(!probs){ *pl = NULL; return;}
-
-  index = get_iindx(length);
-
-  /* first guess of the size needed for pl */
-  *pl = (plist *)space(n*length*sizeof(plist));
-
-  for (i=1; i<length; i++) {
-    for (j=i+1; j<=length; j++) {
-      /* skip all entries below the cutoff */
-      if (probs[index[i]-j] < cut_off) continue;
-
-      /* do we need to allocate more memory? */
-      if (count == n * length - 1){
-        n *= 2;
-        *pl = (plist *)xrealloc(*pl, n * length * sizeof(plist));
-      }
-
-      /* check for presence of gquadruplex */
-      if((S[i] == 3) && (S[j] == 3)){
-          /* add probability of a gquadruplex at position (i,j)
-             for dot_plot
-          */
-          (*pl)[count].i      = i;
-          (*pl)[count].j      = j;
-          (*pl)[count].p      = probs[index[i] - j];
-          (*pl)[count++].type = 1;
-          /* now add the probabilies of it's actual pairing patterns */
-          plist *inner, *ptr;
-          inner = get_plist_gquad_from_pr(S, i, j, G, probs, scale, pf_params);
-          for(ptr=inner; ptr->i != 0; ptr++){
-              if (count == n * length - 1){
-                n *= 2;
-                *pl = (plist *)xrealloc(*pl, n * length * sizeof(plist));
-              }
-              /* check if we've already seen this pair */
-              for(k = 0; k < count; k++)
-                if(((*pl)[k].i == ptr->i) && ((*pl)[k].j == ptr->j))
-                  break;
-              (*pl)[k].i      = ptr->i;
-              (*pl)[k].j      = ptr->j;
-              (*pl)[k].type = 0;
-              if(k == count){
-                (*pl)[k].p  = ptr->p;
-                count++;
-              } else
-                (*pl)[k].p  += ptr->p;
-          }
-      } else {
-          (*pl)[count].i      = i;
-          (*pl)[count].j      = j;
-          (*pl)[count].p      = probs[index[i] - j];
-          (*pl)[count++].type = 0;
-      }
-    }
-  }
-  /* mark the end of pl */
-  (*pl)[count].i   = 0;
-  (*pl)[count].j   = 0;
-  (*pl)[count++].p = 0.;
-  /* shrink memory to actual size needed */
-  *pl = (plist *)xrealloc(*pl, count * sizeof(plist));
-  free(index);
-}
-
-/* this doesn't work if free_pf_arrays() is called before */
-PUBLIC char *get_centroid_struct_gquad_pr( int length,
-                                          double *dist){
-
-  /* compute the centroid structure of the ensemble, i.e. the strutcure
-     with the minimal average distance to all other structures
-     <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij}
-     Thus, the centroid is simply the structure containing all pairs with
-     p_ij>0.5 */
-  int i,j, k;
-  double p;
-  char  *centroid;
-  int   *my_iindx = get_iindx(length);
-
-  if (probs == NULL)
-    nrerror("get_centroid_struct_pr: probs==NULL!");
-
-  *dist = 0.;
-  centroid = (char *) space((length+1)*sizeof(char));
-  for (i=0; i<length; i++) centroid[i]='.';
-  for (i=1; i<=length; i++)
-    for (j=i+TURN+1; j<=length; j++) {
-      if ((p=probs[my_iindx[i]-j])>0.5) {
-        /* check for presence of gquadruplex */
-        if((S[i] == 3) && (S[j] == 3)){
-          int L, l[3];
-          get_gquad_pattern_pf(S, i, j, pf_params, &L, l);
-          for(k=0;k<L;k++){
-            centroid[i+k-1]\
-            = centroid[i+k+L+l[0]-1]\
-            = centroid[i+k+2*L+l[0]+l[1]-1]\
-            = centroid[i+k+3*L+l[0]+l[1]+l[2]-1]\
-            = '+';
-          }
-          /* skip everything within the gquad */
-          i = j; j = j+TURN+1;
-          *dist += (1-p); /* right? */
-          break;
-        } else {
-            centroid[i-1] = '(';
-            centroid[j-1] = ')';
-        }
-        *dist += (1-p);
-      } else
-        *dist += p;
-    }
-  free(my_iindx);
-  centroid[length] = '\0';
-  return centroid;
-}
-
-/* this function is a threadsafe replacement for centroid() */
-PUBLIC char *get_centroid_struct_pl(int length, double *dist, plist *pl){
-  /* compute the centroid structure of the ensemble, i.e. the strutcure
-     with the minimal average distance to all other structures
-     <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij}
-     Thus, the centroid is simply the structure containing all pairs with
-     p_ij>0.5 */
-  int i;
-  char *centroid;
-
-  if (pl==NULL)
-    nrerror("get_centroid_struct: pl==NULL!");
-
-  *dist = 0.;
-  centroid = (char *) space((length+1)*sizeof(char));
-  for (i=0; i<length; i++) centroid[i]='.';
-  for (i=0; pl[i].i>0; i++){
-    if ((pl[i].p)>0.5) {
-      centroid[pl[i].i-1] = '(';
-      centroid[pl[i].j-1] = ')';
-      *dist += (1-pl[i].p);
-    } else
-      *dist += pl[i].p;
-  }
-  centroid[length] = '\0';
-  return centroid;
-}
-
-/* this function is a threadsafe replacement for centroid() */
-PUBLIC char *get_centroid_struct_pr(int length, double *dist, FLT_OR_DBL *probs){
-  /* compute the centroid structure of the ensemble, i.e. the strutcure
-     with the minimal average distance to all other structures
-     <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij}
-     Thus, the centroid is simply the structure containing all pairs with
-     p_ij>0.5 */
-  int i,j;
-  double p;
-  char  *centroid;
-  int   *index = get_iindx(length);
-
-  if (probs == NULL)
-    nrerror("get_centroid_struct_pr: probs==NULL!");
-
-  *dist = 0.;
-  centroid = (char *) space((length+1)*sizeof(char));
-  for (i=0; i<length; i++) centroid[i]='.';
-  for (i=1; i<=length; i++)
-    for (j=i+TURN+1; j<=length; j++) {
-      if ((p=probs[index[i]-j])>0.5) {
-        centroid[i-1] = '(';
-        centroid[j-1] = ')';
-        *dist += (1-p);
-      } else
-        *dist += p;
-    }
-  free(index);
-  centroid[length] = '\0';
-  return centroid;
-}
-
-PUBLIC plist *stackProb(double cutoff){
-  plist *pl;
-  int i,j,plsize=256;
-  int num = 0;
-
-  if (probs==NULL)
-    nrerror("probs==NULL. You need to call pf_fold() before stackProb()");
-
-  int length  = S[0];
-  int *index  = get_iindx(length);
-
-  pl = (plist *) space(plsize*sizeof(plist));
-
-  for (i=1; i<length; i++)
-    for (j=i+TURN+3; j<=length; j++) {
-      double p;
-      if((p=probs[index[i]-j]) < cutoff) continue;
-      if (qb[index[i+1]-(j-1)]<FLT_MIN) continue;
-      p *= qb[index[i+1]-(j-1)]/qb[index[i]-j];
-      p *= exp_E_IntLoop(0,0,ptype[index[i]-j],rtype[ptype[index[i+1]-(j-1)]],
-                         0,0,0,0, pf_params)*scale[2];/* add *scale[u1+u2+2] */
-      if (p>cutoff) {
-        pl[num].i = i;
-        pl[num].j = j;
-        pl[num++].p = p;
-        if (num>=plsize) {
-          plsize *= 2;
-          pl = xrealloc(pl, plsize*sizeof(plist));
-        }
-      }
-    }
-  pl[num].i=0;
-  free(index);
-  return pl;
-}
-
-/*-------------------------------------------------------------------------*/
-/* make arrays used for pf_fold available to other routines */
-PUBLIC int get_pf_arrays( short **S_p,
-                          short **S1_p,
-                          char **ptype_p,
-                          FLT_OR_DBL **qb_p,
-                          FLT_OR_DBL **qm_p,
-                          FLT_OR_DBL **q1k_p,
-                          FLT_OR_DBL **qln_p){
-
-  if(qb == NULL) return(0); /* check if pf_fold() has been called */
-  *S_p = S; *S1_p = S1; *ptype_p = ptype;
-  *qb_p = qb; *qm_p = qm;
-  *q1k_p = q1k; *qln_p = qln;
-  return(1); /* success */
-}
-
-/* get the free energy of a subsequence from the q[] array */
-PUBLIC double get_subseq_F(int i, int j){
-  if (!q)
-    nrerror("call pf_fold() to fill q[] array before calling get_subseq_F()");
-  return ((-log(q[my_iindx[i]-j])-(j-i+1)*log(pf_params->pf_scale))*pf_params->kT/1000.0);
-}
-
-
-PUBLIC double mean_bp_distance(int length){
-  return mean_bp_distance_pr(length, probs);
-}
-
-PUBLIC double mean_bp_distance_pr(int length, FLT_OR_DBL *p){
-  /* compute the mean base pair distance in the thermodynamic ensemble */
-  /* <d> = \sum_{a,b} p_a p_b d(S_a,S_b)
-     this can be computed from the pair probs p_ij as
-     <d> = \sum_{ij} p_{ij}(1-p_{ij}) */
-  int i,j;
-  double d=0;
-  int *index = get_iindx((unsigned int) length);
-
-  if (p==NULL)
-    nrerror("p==NULL. You need to supply a valid probability matrix for mean_bp_distance_pr()");
-
-  for (i=1; i<=length; i++)
-    for (j=i+TURN+1; j<=length; j++)
-      d += p[index[i]-j] * (1-p[index[i]-j]);
-
-  free(index);
-  return 2*d;
-}
-
-PUBLIC FLT_OR_DBL *export_bppm(void){
-  return probs;
-}
-
-/*###########################################*/
-/*# deprecated functions below              #*/
-/*###########################################*/
-
-/* this function is deprecated since it is not threadsafe */
-PUBLIC char *centroid(int length, double *dist) {
-  /* compute the centroid structure of the ensemble, i.e. the strutcure
-     with the minimal average distance to all other structures
-     <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij}
-     Thus, the centroid is simply the structure containing all pairs with
-     p_ij>0.5 */
-  int i,j;
-  double p;
-  char *centroid;
-
-  if (pr==NULL)
-    nrerror("pr==NULL. You need to call pf_fold() before centroid()");
-
-  *dist = 0.;
-  centroid = (char *) space((length+1)*sizeof(char));
-  for (i=0; i<length; i++) centroid[i]='.';
-  for (i=1; i<=length; i++)
-    for (j=i+TURN+1; j<=length; j++) {
-      if ((p=pr[my_iindx[i]-j])>0.5) {
-        centroid[i-1] = '(';
-        centroid[j-1] = ')';
-        *dist += (1-p);
-      } else
-        *dist += p;
-    }
-  return centroid;
-}
-
-
-/* This function is deprecated since it uses the global array pr for calculations */
-PUBLIC double mean_bp_dist(int length) {
-  /* compute the mean base pair distance in the thermodynamic ensemble */
-  /* <d> = \sum_{a,b} p_a p_b d(S_a,S_b)
-     this can be computed from the pair probs p_ij as
-     <d> = \sum_{ij} p_{ij}(1-p_{ij}) */
-  int i,j;
-  double d=0;
-
-  if (pr==NULL)
-    nrerror("pr==NULL. You need to call pf_fold() before mean_bp_dist()");
-
-  for (i=1; i<=length; i++)
-    for (j=i+TURN+1; j<=length; j++)
-      d += pr[my_iindx[i]-j] * (1-pr[my_iindx[i]-j]);
-  return 2*d;
-}
-
-/*----------------------------------------------------------------------*/
-PUBLIC double expHairpinEnergy(int u, int type, short si1, short sj1,
-                                const char *string) {
-/* compute Boltzmann weight of a hairpin loop, multiply by scale[u+2] */
-  double q, kT;
-  kT = pf_params->kT;   /* kT in cal/mol  */
-  if(u <= 30)
-    q = pf_params->exphairpin[u];
-  else
-    q = pf_params->exphairpin[30] * exp( -(pf_params->lxc*log( u/30.))*10./kT);
-  if ((tetra_loop)&&(u==4)) {
-    char tl[7]={0}, *ts;
-    strncpy(tl, string, 6);
-    if ((ts=strstr(pf_params->Tetraloops, tl)))
-      return (pf_params->exptetra[(ts-pf_params->Tetraloops)/7]);
-  }
-  if ((tetra_loop)&&(u==6)) {
-    char tl[9]={0}, *ts;
-    strncpy(tl, string, 6);
-    if ((ts=strstr(pf_params->Hexaloops, tl)))
-      return  (pf_params->exphex[(ts-pf_params->Hexaloops)/9]);
-  }
-  if (u==3) {
-    char tl[6]={0}, *ts;
-    strncpy(tl, string, 5);
-    if ((ts=strstr(pf_params->Triloops, tl)))
-      return (pf_params->exptri[(ts-pf_params->Triloops)/6]);
-    if (type>2)
-      q *= pf_params->expTermAU;
-  }
-  else /* no mismatches for tri-loops */
-    q *= pf_params->expmismatchH[type][si1][sj1];
-
-  return q;
-}
-PUBLIC double expLoopEnergy(int u1, int u2, int type, int type2,
-                             short si1, short sj1, short sp1, short sq1) {
-/* compute Boltzmann weight of interior loop,
-   multiply by scale[u1+u2+2] for scaling */
-  double z=0;
-  int no_close = 0;
-
-  if ((no_closingGU) && ((type2==3)||(type2==4)||(type==2)||(type==4)))
-    no_close = 1;
-
-  if ((u1==0) && (u2==0)) /* stack */
-    z = pf_params->expstack[type][type2];
-  else if (no_close==0) {
-    if ((u1==0)||(u2==0)) { /* bulge */
-      int u;
-      u = (u1==0)?u2:u1;
-      z = pf_params->expbulge[u];
-      if (u2+u1==1) z *= pf_params->expstack[type][type2];
-      else {
-        if (type>2) z *= pf_params->expTermAU;
-        if (type2>2) z *= pf_params->expTermAU;
-      }
-    }
-    else {     /* interior loop */
-      if (u1+u2==2) /* size 2 is special */
-        z = pf_params->expint11[type][type2][si1][sj1];
-      else if ((u1==1) && (u2==2))
-        z = pf_params->expint21[type][type2][si1][sq1][sj1];
-      else if ((u1==2) && (u2==1))
-        z = pf_params->expint21[type2][type][sq1][si1][sp1];
-      else if ((u1==2) && (u2==2))
-        z = pf_params->expint22[type][type2][si1][sp1][sq1][sj1];
-      else if (((u1==2)&&(u2==3))||((u1==3)&&(u2==2))){ /*2-3 is special*/
-        z = pf_params->expinternal[5]*
-          pf_params->expmismatch23I[type][si1][sj1]*
-          pf_params->expmismatch23I[type2][sq1][sp1];
-        z *= pf_params->expninio[2][1];
-      }
-      else if ((u1==1)||(u2==1)) {  /*1-n is special*/
-        z = pf_params->expinternal[u1+u2]*
-          pf_params->expmismatch1nI[type][si1][sj1]*
-          pf_params->expmismatch1nI[type2][sq1][sp1];
-        z *= pf_params->expninio[2][abs(u1-u2)];
-      }
-      else {
-        z = pf_params->expinternal[u1+u2]*
-          pf_params->expmismatchI[type][si1][sj1]*
-          pf_params->expmismatchI[type2][sq1][sp1];
-        z *= pf_params->expninio[2][abs(u1-u2)];
-      }
-    }
-  }
-  return z;
-}
-
-PUBLIC void init_pf_circ_fold(int length){
-/* DO NOTHING */
-}
-
-PUBLIC void init_pf_fold(int length){
-/* DO NOTHING */
-}
-
-
diff --git a/cbits/part_func_co.c b/cbits/part_func_co.c
deleted file mode 100644
--- a/cbits/part_func_co.c
+++ /dev/null
@@ -1,1046 +0,0 @@
-/* Last changed Time-stamp: <2007-05-09 16:11:21 ivo> */
-/*
-                  partiton function for RNA secondary structures
-
-                  Ivo L Hofacker
-                  Stephan Bernhart
-                  Vienna RNA package
-*/
-/*
-  $Log: part_func_co.c,v $
-  Revision 1.10  2007/05/10 17:27:01  ivo
-  make sure the relative error eps is positive in newton iteration
-
-  Revision 1.9  2006/05/10 15:12:11  ivo
-  some compiler choked on  double semicolon after declaration
-
-  Revision 1.8  2006/04/05 12:52:31  ivo
-  Fix performance bug (O(n^4) loop)
-
-  Revision 1.7  2006/01/19 11:30:04  ivo
-  compute_probabilities should only look at one dimer at a time
-
-  Revision 1.6  2006/01/18 12:55:40  ivo
-  major cleanup of berni code
-  fix bugs related to confusing which free energy is returned by co_pf_fold()
-
-  Revision 1.5  2006/01/16 11:32:25  ivo
-  small bug in multiloop pair probs
-
-  Revision 1.4  2006/01/05 18:13:40  ivo
-  update
-
-  Revision 1.3  2006/01/04 15:14:29  ivo
-  fix bug in concentration calculations
-
-  Revision 1.2  2004/12/23 12:14:41  berni
-  *** empty log message ***
-
-  Revision 1.1  2004/12/22 10:46:17  berni
-
-  Partition function Cofolding 0.9, Computation of concentrations.
-
-  Revision 1.16  2003/08/04 09:14:09  ivo
-  finish up stochastic backtracking
-
-  Revision 1.15  2002/03/19 16:51:12  ivo
-  more on stochastic backtracking (still incomplete)
-
-  Revision 1.13  2001/11/16 17:30:04  ivo
-  add stochastic backtracking (still incomplete)
-*/
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <float.h>    /* #defines FLT_MAX ... */
-#include <limits.h>
-
-#include "utils.h"
-#include "energy_par.h"
-#include "fold_vars.h"
-#include "pair_mat.h"
-#include "PS_dot.h"
-#include "params.h"
-#include "loop_energies.h"
-#include "part_func.h"
-#include "part_func_co.h"
-
-#ifdef _OPENMP
-#include <omp.h>
-#endif
-
-
-/*@unused@*/
-PRIVATE char rcsid[] UNUSED = "$Id: part_func_co.c,v 1.10 2007/05/10 17:27:01 ivo Exp $";
-
-#define ISOLATED  256.0
-#undef TURN
-#define TURN 0
-#define SAME_STRAND(I,J) (((I)>=cut_point)||((J)<cut_point))
-
-/* #define SAME_STRAND(I,J) (((J)<cut_point)||((I)>=cut_point2)||(((I)>=cut_point)&&((J)<cut_point2)))
- */
-
-/*
-#################################
-# GLOBAL VARIABLES              #
-#################################
-*/
-int     mirnatog      = 0;
-double  F_monomer[2]  = {0,0}; /* free energies of the two monomers */
-
-/*
-#################################
-# PRIVATE VARIABLES             #
-#################################
-*/
-PRIVATE FLT_OR_DBL  *expMLbase=NULL;
-PRIVATE FLT_OR_DBL  *q=NULL, *qb=NULL, *qm=NULL, *qm1=NULL, *qqm=NULL, *qqm1=NULL, *qq=NULL, *qq1=NULL;
-PRIVATE FLT_OR_DBL  *prml=NULL, *prm_l=NULL, *prm_l1=NULL, *q1k=NULL, *qln=NULL, *probs=NULL;
-PRIVATE FLT_OR_DBL  *scale=NULL;
-PRIVATE pf_paramT   *pf_params = NULL;
-PRIVATE char        *ptype=NULL; /* precomputed array of pair types */
-PRIVATE int         *jindx=NULL;
-PRIVATE int         *my_iindx=NULL;
-PRIVATE int         init_length; /* length in last call to init_pf_fold() */
-PRIVATE int         do_bppm = 1;             /* do backtracking per default */
-PRIVATE short       *S=NULL, *S1=NULL;
-PRIVATE char        *pstruc=NULL;
-PRIVATE char        *sequence=NULL;
-PRIVATE double      alpha = 1.0;
-PRIVATE int         struct_constrained = 0;
-
-#ifdef _OPENMP
-
-/* NOTE: all variables are assumed to be uninitialized if they are declared as threadprivate
-*/
-#pragma omp threadprivate(expMLbase, q, qb, qm, qm1, qqm, qqm1, qq, qq1, prml, prm_l, prm_l1, q1k, qln,\
-                          scale, pf_params, ptype, jindx, my_iindx, init_length, S, S1, pstruc, sequence, probs, do_bppm, alpha, struct_constrained)
-
-#endif
-
-
-/*
-#################################
-# PRIVATE FUNCTION DECLARATIONS #
-#################################
-*/
-PRIVATE void    init_partfunc_co(int length, pf_paramT *parameters);
-PRIVATE void    pf_co(const char *sequence);
-PRIVATE void    pf_co_bppm(const char *sequence, char *structure);
-PRIVATE double  *Newton_Conc(double ZAB, double ZAA, double ZBB, double concA, double concB,double* ConcVec);
-PRIVATE void    scale_pf_params(unsigned int length, pf_paramT *parameters);
-PRIVATE void    get_arrays(unsigned int length);
-PRIVATE void    make_ptypes(const short *S, const char *structure);
-PRIVATE void    backtrack(int i, int j);
-
-
-/*
-#################################
-# BEGIN OF FUNCTION DEFINITIONS #
-#################################
-*/
-
-PRIVATE void init_partfunc_co(int length, pf_paramT *parameters){
-  if (length<1) nrerror("init_pf_fold: length must be greater 0");
-
-#ifdef _OPENMP
-/* Explicitly turn off dynamic threads */
-  omp_set_dynamic(0);
-  free_co_pf_arrays(); /* free previous allocation */
-#else
-  if (init_length>0) free_co_pf_arrays(); /* free previous allocation */
-#endif
-
-#ifdef SUN4
-  nonstandard_arithmetic();
-#else
-#ifdef HP9
-  fpsetfastmode(1);
-#endif
-#endif
-  make_pair_matrix();
-  get_arrays((unsigned) length);
-  scale_pf_params((unsigned) length, parameters);
-  init_length = length;
-}
-
-PRIVATE void get_arrays(unsigned int length){
-  unsigned int size;
-
-  if((length +1) >= (unsigned int)sqrt((double)INT_MAX))
-    nrerror("get_arrays@part_func_co.c: sequence length exceeds addressable range");
-
-  size      = sizeof(FLT_OR_DBL) * ((length+1)*(length+2)/2);
-  q         = (FLT_OR_DBL *) space(size);
-  qb        = (FLT_OR_DBL *) space(size);
-  qm        = (FLT_OR_DBL *) space(size);
-  probs     = (FLT_OR_DBL *) space(size);
-  qm1       = (FLT_OR_DBL *) space(size);
-  q1k       = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+1));
-  qln       = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  qq        = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  qq1       = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  qqm       = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  qqm1      = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  prm_l     = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  prm_l1    = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  prml      = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+2));
-  expMLbase = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+1));
-  scale     = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL)*(length+1));
-  ptype     = (char *) space(sizeof(char)*((length+1)*(length+2)/2));
-  my_iindx  = get_iindx(length);
-  iindx     = get_iindx(length); /* for backward compatibility and Perl wrapper */
-  jindx     = get_indx(length);
-}
-
-PUBLIC void free_co_pf_arrays(void){
-  if(q)         free(q);
-  if(qb)        free(qb);
-  if(qm)        free(qm);
-  if(qm1)       free(qm1);
-  if(ptype)     free(ptype);
-  if(qq)        free(qq);
-  if(qq1)       free(qq1);
-  if(qqm)       free(qqm);
-  if(qqm1)      free(qqm1);
-  if(q1k)       free(q1k);
-  if(qln)       free(qln);
-  if(prm_l)     free(prm_l);
-  if(prm_l1)    free(prm_l1);
-  if(prml)      free(prml);
-  if(probs)     free(probs);
-  if(expMLbase) free(expMLbase);
-  if(scale)     free(scale);
-  if(my_iindx)  free(my_iindx);
-  if(iindx)     free(iindx); /* for backward compatibility and Perl wrapper */
-  if(jindx)     free(jindx);
-  if(S)         free(S);
-  if(S1)        free(S1);
-
-  init_length=0;
-  q = qb = qm = qm1 = qq = qq1 = qqm = qqm1 = q1k = qln = prm_l = prm_l1 = prml = expMLbase = scale = probs = NULL;
-  ptype = NULL;
-  S = S1 = NULL;
-  my_iindx = jindx = iindx = NULL;
-
-#ifdef SUN4
-  standard_arithmetic();
-#else
-#ifdef HP9
-  fpsetfastmode(0);
-#endif
-#endif
-}
-
-/*-----------------------------------------------------------------*/
-PUBLIC cofoldF co_pf_fold(char *sequence, char *structure){
-  return co_pf_fold_par(sequence, structure, NULL, do_backtrack, fold_constrained);
-}
-
-PUBLIC cofoldF co_pf_fold_par(char *sequence,
-                              char *structure,
-                              pf_paramT *parameters,
-                              int calculate_bppm,
-                              int is_constrained){
-
-  int         n;
-  FLT_OR_DBL  Q;
-  cofoldF     X;
-  double      free_energy;
-
-  n                   = (int) strlen(sequence);
-  do_bppm             = calculate_bppm;
-  struct_constrained  = is_constrained;
-
-#ifdef _OPENMP
-  /* always init everything since all global static variables are uninitialized when entering a thread */
-  init_partfunc_co(n, parameters);
-#else
-  if(parameters) init_partfunc_co(n, parameters);
-  else if (n > init_length) init_partfunc_co(n, parameters);
-  else if (fabs(pf_params->temperature - temperature)>1e-6) update_co_pf_params_par(n, parameters);
-#endif
-
- /* printf("mirnatog=%d\n",mirnatog); */
-
-  if(S) free(S);
-  S   = encode_sequence(sequence, 0);
-  if(S1) free(S1);
-  S1  = encode_sequence(sequence, 1);
-
-  make_ptypes(S, structure);
-
-  pf_co(sequence);
-
-  if (backtrack_type=='C')      Q = qb[my_iindx[1]-n];
-  else if (backtrack_type=='M') Q = qm[my_iindx[1]-n];
-  else Q = q[my_iindx[1]-n];
-  /* ensemble free energy in Kcal/mol */
-  if (Q<=FLT_MIN) fprintf(stderr, "pf_scale too large\n");
-  free_energy = (-log(Q)-n*log(pf_params->pf_scale))*pf_params->kT/1000.0;
-  /* in case we abort because of floating point errors */
-  if (n>1600) fprintf(stderr, "free energy = %8.2f\n", free_energy);
-  /*probability of molecules being bound together*/
-
-
-  /*Computation of "real" Partition function*/
-  /*Need that for concentrations*/
-  if (cut_point>0){
-    double kT, pbound, QAB, QToT, Qzero;
-
-    kT = pf_params->kT/1000.0;
-    Qzero=q[my_iindx[1]-n];
-    QAB=(q[my_iindx[1]-n]-q[my_iindx[1]-(cut_point-1)]*q[my_iindx[cut_point]-n])*pf_params->expDuplexInit;
-    /*correction for symmetry*/
-    if((n-(cut_point-1)*2)==0) {
-      if ((strncmp(sequence, sequence+cut_point-1, cut_point-1))==0) {
-        QAB/=2;
-      }}
-
-    QToT=q[my_iindx[1]-(cut_point-1)]*q[my_iindx[cut_point]-n]+QAB;
-    pbound=1-(q[my_iindx[1]-(cut_point-1)]*q[my_iindx[cut_point]-n]/QToT);
-     X.FAB  = -kT*(log(QToT)+n*log(pf_params->pf_scale));
-    X.F0AB = -kT*(log(Qzero)+n*log(pf_params->pf_scale));
-    X.FcAB = (QAB>1e-17) ? -kT*(log(QAB)+n*log(pf_params->pf_scale)) : 999;
-    X.FA = -kT*(log(q[my_iindx[1]-(cut_point-1)]) + (cut_point-1)*log(pf_params->pf_scale));
-    X.FB = -kT*(log(q[my_iindx[cut_point]-n]) + (n-cut_point+1)*log(pf_params->pf_scale));
-
-    /* printf("QAB=%.9f\tQtot=%.9f\n",QAB/scale[n],QToT/scale[n]);*/
-  }
-  else {
-    X.FA = X.FB = X.FAB = X.F0AB = free_energy;
-    X.FcAB = 0;
-  }
-
-  /* backtracking to construct binding probabilities of pairs*/
-  if(do_bppm){
-    pf_co_bppm(sequence, structure);
-    /*
-    *  Backward compatibility:
-    *  This block may be removed if deprecated functions
-    *  relying on the global variable "pr" vanish from within the package!
-    */
-    pr = probs;
-    /*
-    {
-      if(pr) free(pr);
-      pr = (FLT_OR_DBL *) space(sizeof(FLT_OR_DBL) * ((n+1)*(n+2)/2));
-      memcpy(pr, probs, sizeof(FLT_OR_DBL) * ((n+1)*(n+2)/2));
-    }
-    */
-  }
-  return X;
-}
-
-/* forward recursion of pf cofolding */
-PRIVATE void pf_co(const char *sequence){
-  int         n, i,j,k,l, ij, u,u1,ii, type, type_2, tt;
-  FLT_OR_DBL  temp, Qmax=0;
-  FLT_OR_DBL  qbt1, *tmp;
-  FLT_OR_DBL  expMLclosing;
-  double      max_real;
-  int         noGUclosure = pf_params->model_details.noGUclosure;
-
-  max_real = (sizeof(FLT_OR_DBL) == sizeof(float)) ? FLT_MAX : DBL_MAX;
-  n = (int) strlen(sequence);
-
-  expMLclosing = pf_params->expMLclosing;
-
-
-  /*array initialization ; qb,qm,q
-    qb,qm,q (i,j) are stored as ((n+1-i)*(n-i) div 2 + n+1-j */
-
-  /* for (d=0; d<=TURN; d++) */
-  for (i=1; i<=n/*-d*/; i++) {
-      ij = my_iindx[i]-i;
-      q[ij]=scale[1];
-      qb[ij]=qm[ij]=0.0;
-    }
-
-  for (i=0; i<=n; i++)
-    qq[i]=qq1[i]=qqm[i]=qqm1[i]=prm_l[i]=prm_l1[i]=prml[i]=0;
-
-  for (j=TURN+2;j<=n; j++) {
-    for (i=j-TURN-1; i>=1; i--) {
-      /* construction of partition function of segment i,j*/
-       /*firstly that given i bound to j : qb(i,j) */
-      u = j-i-1; ij = my_iindx[i]-j;
-      type = ptype[ij];
-      qbt1=0;
-      if (type!=0) {
-        /*hairpin contribution*/
-        if SAME_STRAND(i,j){
-          if (((type==3)||(type==4))&&noGUclosure) qbt1 = 0;
-          else
-            qbt1 = exp_E_Hairpin(u, type, S1[i+1], S1[j-1], sequence+i-1, pf_params)*scale[u+2];
-
-        }
-
-        /* interior loops with interior pair k,l */
-        for (k=i+1; k<=MIN2(i+MAXLOOP+1,j-TURN-2); k++) {
-          u1 = k-i-1;
-          for (l=MAX2(k+TURN+1,j-1-MAXLOOP+u1); l<j; l++) {
-            if ((SAME_STRAND(i,k))&&(SAME_STRAND(l,j))){
-              type_2 = ptype[my_iindx[k]-l];
-              if (type_2) {
-                type_2 = rtype[type_2];
-                qbt1 += qb[my_iindx[k]-l] *
-                  exp_E_IntLoop(u1, j-l-1, type, type_2,
-                                S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params)*scale[u1+j-l+1];
-              }
-            }
-          }
-        }
-        /*multiple stem loop contribution*/
-        ii = my_iindx[i+1]; /* ii-k=[i+1,k-1] */
-        temp = 0.0;
-        if (SAME_STRAND(i,i+1) && SAME_STRAND(j-1,j)) {
-          for (k=i+2; k<=j-1; k++) {
-            if (SAME_STRAND(k-1,k))
-              temp += qm[ii-(k-1)]*qqm1[k];
-          }
-          tt = rtype[type];
-          temp*=exp_E_MLstem(tt, S1[j-1], S1[i+1], pf_params)*scale[2];
-          temp*=expMLclosing;
-          qbt1 += temp;
-        }
-        /*qc contribution*/
-        temp=0.0;
-        if (!SAME_STRAND(i,j)){
-          tt = rtype[type];
-          temp=q[my_iindx[i+1]-(cut_point-1)]*q[my_iindx[cut_point]-(j-1)];
-          if ((j==cut_point)&&(i==cut_point-1)) temp=scale[2];
-          else if (i==cut_point-1) temp=q[my_iindx[cut_point]-(j-1)]*scale[1];
-          else if (j==cut_point) temp=q[my_iindx[i+1]-(cut_point-1)]*scale[1];
-          if (j>cut_point) temp*=scale[1];
-          if (i<cut_point-1) temp*=scale[1];
-          temp *= exp_E_ExtLoop(tt, SAME_STRAND(j-1,j) ? S1[j-1] : -1, SAME_STRAND(i,i+1) ? S1[i+1] : -1, pf_params);
-          qbt1+=temp;
-        }
-        qb[ij] = qbt1;
-      } /* end if (type!=0) */
-      else qb[ij] = 0.0;
-      /* construction of qqm matrix containing final stem
-         contributions to multiple loop partition function
-         from segment i,j */
-      if (SAME_STRAND(j-1,j)) {
-        qqm[i] = qqm1[i]*expMLbase[1];
-      }
-      else qqm[i]=0;
-      if (type&&SAME_STRAND(i-1,i)&&SAME_STRAND(j,j+1)) {
-        qbt1 = qb[ij];
-        qbt1 *= exp_E_MLstem(type, (i>1) ? S1[i-1] : -1, (j<n) ? S1[j+1] : -1, pf_params);
-        qqm[i] += qbt1;
-      }
-
-      if (qm1) qm1[jindx[j]+i] = qqm[i]; /* for stochastic backtracking */
-
-
-      /*construction of qm matrix containing multiple loop
-        partition function contributions from segment i,j */
-      temp = 0.0;
-      ii = my_iindx[i];  /* ii-k=[i,k] */
-
-      for (k=i+1; k<=j; k++) {
-        if (SAME_STRAND(k-1,k)) temp += (qm[ii-(k-1)])*qqm[k];
-        if (SAME_STRAND(i,k))   temp += expMLbase[k-i]*qqm[k];
-
-      }
-
-      qm[ij] = (temp + qqm[i]);
-
-      /*auxiliary matrix qq for cubic order q calculation below */
-      qbt1 = qb[ij];
-      if (type) {
-        qbt1 *= exp_E_ExtLoop(type, ((i>1)&&(SAME_STRAND(i-1,i))) ? S1[i-1] : -1, ((j<n)&&(SAME_STRAND(j,j+1))) ? S1[j+1] : -1, pf_params);
-      }
-      qq[i] = qq1[i]*scale[1] + qbt1;
-       /*construction of partition function for segment i,j */
-      temp = 1.0*scale[1+j-i] + qq[i];
-      for (k=i; k<=j-1; k++) temp += q[ii-k]*qq[k+1];
-      q[ij] = temp;
-
-      if (temp>Qmax) {
-        Qmax = temp;
-        if (Qmax>max_real/10.)
-          fprintf(stderr, "Q close to overflow: %d %d %g\n", i,j,temp);
-      }
-      if (temp>=max_real) {
-        PRIVATE char msg[128];
-        snprintf(msg, 127, "overflow in co_pf_fold while calculating q[%d,%d]\n"
-                "use larger pf_scale", i,j);
-        nrerror(msg);
-      }
-    }
-    tmp = qq1;  qq1 =qq;  qq =tmp;
-    tmp = qqm1; qqm1=qqm; qqm=tmp;
-  }
-}
-
-/* backward recursion of pf cofolding */
-PRIVATE void pf_co_bppm(const char *sequence, char *structure){
-  int         n, i,j,k,l, ij, kl, ii, ll, type, type_2, tt, ov=0;
-  FLT_OR_DBL  temp, Qmax=0, prm_MLb;
-  FLT_OR_DBL  prmt,prmt1;
-  FLT_OR_DBL  *tmp;
-  FLT_OR_DBL  expMLclosing;
-  double      max_real;
-
-  max_real = (sizeof(FLT_OR_DBL) == sizeof(float)) ? FLT_MAX : DBL_MAX;
-  n = (int) strlen(sequence);
-
-  expMLclosing = pf_params->expMLclosing;
-
-  /* backtracking to construct binding probabilities of pairs*/
-  if ((S != NULL) && (S1 != NULL)) {
-    FLT_OR_DBL   *Qlout, *Qrout;
-    Qmax=0;
-    Qrout=(FLT_OR_DBL *)space(sizeof(FLT_OR_DBL) * (n+2));
-    Qlout=(FLT_OR_DBL *)space(sizeof(FLT_OR_DBL) * (cut_point+2));
-
-    for (k=1; k<=n; k++) {
-      q1k[k] = q[my_iindx[1] - k];
-      qln[k] = q[my_iindx[k] -n];
-    }
-    q1k[0] = 1.0;
-    qln[n+1] = 1.0;
-
-    /*    pr = q;     /  * recycling */
-
-    /* 1. exterior pair i,j and initialization of pr array */
-    for (i=1; i<=n; i++) {
-      for (j=i; j<=MIN2(i+TURN,n); j++) probs[my_iindx[i]-j] = 0;
-      for (j=i+TURN+1; j<=n; j++) {
-        ij = my_iindx[i]-j;
-        type = ptype[ij];
-        if (type&&(qb[ij]>0.)) {
-          probs[ij] = q1k[i-1]*qln[j+1]/q1k[n];
-          probs[ij] *= exp_E_ExtLoop(type, ((i>1)&&(SAME_STRAND(i-1,i))) ? S1[i-1] : -1, ((j<n)&&(SAME_STRAND(j,j+1))) ? S1[j+1] : -1, pf_params);
-        } else
-          probs[ij] = 0;
-      }
-    }
-
-    for (l=n; l>TURN+1; l--) {
-
-      /* 2. bonding k,l as substem of 2:loop enclosed by i,j */
-      for (k=1; k<l-TURN; k++) {
-        kl = my_iindx[k]-l;
-        type_2 = ptype[kl]; type_2 = rtype[type_2];
-        if (qb[kl]==0) continue;
-
-        for (i=MAX2(1,k-MAXLOOP-1); i<=k-1; i++)
-          for (j=l+1; j<=MIN2(l+ MAXLOOP -k+i+2,n); j++) {
-            if ((SAME_STRAND(i,k))&&(SAME_STRAND(l,j))){
-              ij = my_iindx[i] - j;
-              type = ptype[ij];
-              if ((probs[ij]>0)) {
-                probs[kl] += probs[ij]*exp_E_IntLoop(k-i-1, j-l-1, type, type_2,
-                                               S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params)*scale[k-i+j-l];
-              }
-            }
-          }
-      }
-      /* 3. bonding k,l as substem of multi-loop enclosed by i,j */
-      prm_MLb = 0.;
-      if ((l<n)&&(SAME_STRAND(l,l+1)))
-        for (k=2; k<l-TURN; k++) {
-          i = k-1;
-          prmt = prmt1 = 0.0;
-
-          ii = my_iindx[i];     /* ii-j=[i,j]     */
-          ll = my_iindx[l+1];   /* ll-j=[l+1,j] */
-          tt = ptype[ii-(l+1)]; tt=rtype[tt];
-          if (SAME_STRAND(i,k)){
-            prmt1 = probs[ii-(l+1)]*expMLclosing;
-            prmt1 *= exp_E_MLstem(tt, S1[l], S1[i+1], pf_params);
-            for (j=l+2; j<=n; j++) {
-              if (SAME_STRAND(j-1,j)){ /*??*/
-                tt = ptype[ii-j]; tt = rtype[tt];
-                prmt += probs[ii-j]*exp_E_MLstem(tt, S1[j-1], S1[i+1], pf_params)*qm[ll-(j-1)];
-              }
-            }
-          }
-          kl = my_iindx[k]-l;
-          tt = ptype[kl];
-          prmt *= expMLclosing;
-          prml[ i] = prmt;
-          prm_l[i] = prm_l1[i]*expMLbase[1]+prmt1;
-
-          prm_MLb = prm_MLb*expMLbase[1] + prml[i];
-          /* same as:    prm_MLb = 0;
-             for (i=1; i<=k-1; i++) prm_MLb += prml[i]*expMLbase[k-i-1]; */
-
-          prml[i] = prml[ i] + prm_l[i];
-
-          if (qb[kl] == 0.) continue;
-
-          temp = prm_MLb;
-
-          for (i=1;i<=k-2; i++) {
-            if ((SAME_STRAND(i,i+1))&&(SAME_STRAND(k-1,k))){
-              temp += prml[i]*qm[my_iindx[i+1] - (k-1)];
-            }
-          }
-          temp *= exp_E_MLstem( tt,
-                                ((k>1)&&SAME_STRAND(k-1,k)) ? S1[k-1] : -1,
-                                ((l<n)&&SAME_STRAND(l,l+1)) ? S1[l+1] : -1,
-                                pf_params) * scale[2];
-          probs[kl] += temp;
-
-          if (probs[kl]>Qmax) {
-            Qmax = probs[kl];
-            if (Qmax>max_real/10.)
-              fprintf(stderr, "P close to overflow: %d %d %g %g\n",
-                      i, j, probs[kl], qb[kl]);
-          }
-          if (probs[kl]>=max_real) {
-            ov++;
-            probs[kl]=FLT_MAX;
-          }
-
-        } /* end for (k=..) multloop*/
-      else  /* set prm_l to 0 to get prm_l1 to be 0 */
-        for (i=0; i<=n; i++) prm_l[i]=0;
-
-      tmp = prm_l1; prm_l1=prm_l; prm_l=tmp;
-      /*computation of .(..(...)..&..). type features?*/
-      if (cut_point<=0) continue;  /* no .(..(...)..&..). type features*/
-      if ((l==n)||(l<=2)) continue; /* no .(..(...)..&..). type features*/
-      /*new version with O(n^3)??*/
-      if (l>cut_point) {
-        if (l<n) {
-          int t,kt;
-          for (t=n; t>l; t--) {
-            for (k=1; k<cut_point; k++) {
-              kt=my_iindx[k]-t;
-              type=rtype[ptype[kt]];
-              temp = probs[kt] * exp_E_ExtLoop(type, S1[t-1], (SAME_STRAND(k,k+1)) ? S1[k+1] : -1, pf_params) * scale[2];
-              if (l+1<t)               temp*=q[my_iindx[l+1]-(t-1)];
-              if (SAME_STRAND(k,k+1))  temp*=q[my_iindx[k+1]-(cut_point-1)];
-              Qrout[l]+=temp;
-            }
-          }
-        }
-        for (k=l-1; k>=cut_point; k--) {
-          if (qb[my_iindx[k]-l]) {
-            kl=my_iindx[k]-l;
-            type=ptype[kl];
-            temp = Qrout[l];
-            temp *= exp_E_ExtLoop(type, (k>cut_point) ? S1[k-1] : -1, (l < n) ? S1[l+1] : -1, pf_params);
-            if (k>cut_point) temp*=q[my_iindx[cut_point]-(k-1)];
-            probs[kl]+=temp;
-          }
-        }
-      }
-      else if (l==cut_point ) {
-        int t, sk,s;
-        for (t=2; t<cut_point;t++) {
-          for (s=1; s<t; s++) {
-            for (k=cut_point; k<=n; k++) {
-              sk=my_iindx[s]-k;
-              if (qb[sk]) {
-                type=rtype[ptype[sk]];
-                temp=probs[sk]*exp_E_ExtLoop(type, (SAME_STRAND(k-1,k)) ? S1[k-1] : -1, S1[s+1], pf_params)*scale[2];
-                if (s+1<t)               temp*=q[my_iindx[s+1]-(t-1)];
-                if (SAME_STRAND(k-1,k))  temp*=q[my_iindx[cut_point]-(k-1)];
-                Qlout[t]+=temp;
-              }
-            }
-          }
-        }
-      }
-      else if (l<cut_point) {
-        for (k=1; k<l; k++) {
-          if (qb[my_iindx[k]-l]) {
-            type=ptype[my_iindx[k]-l];
-            temp=Qlout[k];
-            temp *= exp_E_ExtLoop(type, (k>1) ? S1[k-1] : -1, (l<(cut_point-1)) ? S1[l+1] : -1, pf_params);
-            if (l+1<cut_point) temp*=q[my_iindx[l+1]-(cut_point-1)];
-            probs[my_iindx[k]-l]+=temp;
-          }
-        }
-      }
-    }  /* end for (l=..)   */
-    free(Qlout);
-    free(Qrout);
-    for (i=1; i<=n; i++)
-      for (j=i+TURN+1; j<=n; j++) {
-        ij = my_iindx[i]-j;
-        probs[ij] *= qb[ij];
-      }
-
-    if (structure!=NULL)
-      bppm_to_structure(structure, probs, n);
-  }   /* end if (do_backtrack)*/
-
-  if (ov>0) fprintf(stderr, "%d overflows occurred while backtracking;\n"
-                    "you might try a smaller pf_scale than %g\n",
-                    ov, pf_params->pf_scale);
-}
-
-
-PRIVATE void scale_pf_params(unsigned int length, pf_paramT *parameters){
-  unsigned int  i;
-  double        kT, scaling_factor;
-
-  if(pf_params) free(pf_params);
-
-  if(parameters){
-    pf_params = get_boltzmann_factor_copy(parameters);
-  } else {
-    model_detailsT md;
-    set_model_details(&md);
-    pf_params = get_boltzmann_factors(temperature, alpha, md, pf_scale);
-  }
-
-  scaling_factor  = pf_params->pf_scale;
-  kT              = pf_params->kT;        /* kT in cal/mol  */
-
-   /* scaling factors (to avoid overflows) */
-  if (scaling_factor == -1) { /* mean energy for random sequences: 184.3*length cal */
-    scaling_factor = exp(-(-185+(pf_params->temperature-37.)*7.27)/kT);
-    if (scaling_factor<1) scaling_factor=1;
-    pf_params->pf_scale = scaling_factor;
-  }
-  scale[0] = 1.;
-  scale[1] = 1./scaling_factor;
-  expMLbase[0] = 1;
-  expMLbase[1] = pf_params->expMLbase/scaling_factor;
-  for (i=2; i<=length; i++) {
-    scale[i] = scale[i/2]*scale[i-(i/2)];
-    expMLbase[i] = pow(pf_params->expMLbase, (double)i) * scale[i];
-  }
-}
-
-/*----------------------------------------------------------------------*/
-
-/*----------------------------------------------------------------------*/
-
-/*---------------------------------------------------------------------------*/
-
-PUBLIC void update_co_pf_params(int length){
-  update_co_pf_params_par(length, NULL);
-}
-
-PUBLIC void update_co_pf_params_par(int length, pf_paramT *parameters){
-  make_pair_matrix();
-  scale_pf_params((unsigned) length, parameters);
-}
-
-/*---------------------------------------------------------------------------*/
-PRIVATE void make_ptypes(const short *S, const char *structure) {
-  int n,i,j,k,l;
-  int noLP = pf_params->model_details.noLP;
-
-  n=S[0];
-  for (k=1; k<=n-TURN-1; k++)
-    for (l=1; l<=2; l++) {
-      int type,ntype=0,otype=0;
-      i=k; j = i+TURN+l;
-      if (j>n) continue;
-      type = pair[S[i]][S[j]];
-      while ((i>=1)&&(j<=n)) {
-        if ((i>1)&&(j<n)) ntype = pair[S[i-1]][S[j+1]];
-        if (noLP && (!otype) && (!ntype))
-          type = 0; /* i.j can only form isolated pairs */
-        qb[my_iindx[i]-j] = 0.;
-        ptype[my_iindx[i]-j] = (char) type;
-        otype =  type;
-        type  = ntype;
-        i--; j++;
-      }
-
-    }
-
-  if (struct_constrained&&(structure!=NULL)) {
-    constrain_ptypes(structure, (unsigned int)n, ptype, NULL, TURN, 1);
-    for(j=1; j<=n; j++) {
-      switch (structure[j-1]) {
-        case 'l': /*only intramolecular basepairing*/
-                  if (j<cut_point) for (l=cut_point; l<=n; l++) ptype[my_iindx[j]-l] = 0;
-                  else for (l=1; l<cut_point; l++) ptype[my_iindx[l]-j] =0;
-                  break;
-        case 'e': /*only intermolecular bp*/
-                  if (j<cut_point) {
-                    for (l=1; l<j; l++) ptype[my_iindx[l]-j] =0;
-                    for (l=j+1; l<cut_point; l++) ptype[my_iindx[j]-l] = 0;
-                  }
-                  else {
-                    for (l=cut_point; l<j; l++) ptype[my_iindx[l]-j] =0;
-                    for (l=j+1; l<=n; l++) ptype[my_iindx[j]-l] = 0;
-                  }
-                  break;
-      }
-    }
-  }
-  if (mirnatog==1) {   /*microRNA toggle: no intramolec. bp in 2. molec*/
-    for (j=cut_point; j<n; j++) {
-      for (l=j+1; l<=n; l++) {
-        ptype[my_iindx[j]-l] = 0;
-      }
-    }
-  }
-}
-
-/*
-  stochastic backtracking in pf_fold arrays
-  returns random structure S with Boltzman probabilty
-  p(S) = exp(-E(S)/kT)/Z
-*/
-PRIVATE void backtrack_qm1(int i,int j) {
-  /* i is paired to l, i<l<j; backtrack in qm1 to find l */
-  int ii, l, type;
-  double qt, r;
-  r = urn() * qm1[jindx[j]+i];
-  ii = my_iindx[i];
-  for (qt=0., l=i+TURN+1; l<=j; l++) {
-    type = ptype[ii-l];
-    if (type)
-      qt +=  qb[ii-l]*exp_E_MLstem(type, S1[i-1], S1[l+1], pf_params) * expMLbase[j-l];
-    if (qt>=r) break;
-  }
-  if (l>j) nrerror("backtrack failed in qm1");
-  backtrack(i,l);
-}
-
-PRIVATE void backtrack(int i, int j) {
-  int noGUclosure = pf_params->model_details.noGUclosure;
-
-  do {
-    double r, qbt1;
-    int k, l, type, u, u1;
-
-    pstruc[i-1] = '('; pstruc[j-1] = ')';
-
-    r = urn() * qb[my_iindx[i]-j];
-    type = ptype[my_iindx[i]-j];
-    u = j-i-1;
-    /*hairpin contribution*/
-    if (((type==3)||(type==4))&&noGUclosure) qbt1 = 0;
-    else
-      qbt1 = exp_E_Hairpin(u, type, S1[i+1], S1[j-1], sequence+i-1, pf_params)*scale[u+2];
-
-    if (qbt1>r) return; /* found the hairpin we're done */
-
-    for (k=i+1; k<=MIN2(i+MAXLOOP+1,j-TURN-2); k++) {
-      u1 = k-i-1;
-      for (l=MAX2(k+TURN+1,j-1-MAXLOOP+u1); l<j; l++) {
-        int type_2;
-        type_2 = ptype[my_iindx[k]-l];
-        if (type_2) {
-          type_2 = rtype[type_2];
-          qbt1 += qb[my_iindx[k]-l] *
-            exp_E_IntLoop(u1, j-l-1, type, type_2,
-                          S1[i+1], S1[j-1], S1[k-1], S1[l+1], pf_params)*scale[u1+j-l+1];
-        }
-        if (qbt1 > r) break;
-      }
-      if (qbt1 > r) break;
-    }
-    if (l<j) {
-      i=k; j=l;
-    }
-    else break;
-  } while (1);
-
-  /* backtrack in multi-loop */
-  {
-    double r, qt;
-    int k, ii, jj;
-
-    i++; j--;
-    /* find the first split index */
-    ii = my_iindx[i]; /* ii-j=[i,j] */
-    jj = jindx[j]; /* jj+i=[j,i] */
-    for (qt=0., k=i+1; k<j; k++) qt += qm[ii-(k-1)]*qm1[jj+k];
-    r = urn() * qt;
-    for (qt=0., k=i+1; k<j; k++) {
-      qt += qm[ii-(k-1)]*qm1[jj+k];
-      if (qt>=r) break;
-    }
-    if (k>=j) nrerror("backtrack failed, can't find split index ");
-
-    backtrack_qm1(k, j);
-
-    j = k-1;
-    while (j>i) {
-      /* now backtrack  [i ... j] in qm[] */
-      jj = jindx[j];
-      ii = my_iindx[i];
-      r = urn() * qm[ii - j];
-      qt = qm1[jj+i]; k=i;
-      if (qt<r)
-        for (k=i+1; k<=j; k++) {
-          qt += (qm[ii-(k-1)]+expMLbase[k-i])*qm1[jj+k];
-          if (qt >= r) break;
-        }
-      if (k>j) nrerror("backtrack failed in qm");
-
-      backtrack_qm1(k,j);
-
-      if (k<i+TURN) break; /* no more pairs */
-      r = urn() * (qm[ii-(k-1)] + expMLbase[k-i]);
-      if (expMLbase[k-i] >= r) break; /* no more pairs */
-      j = k-1;
-    }
-  }
-}
-
-PUBLIC void compute_probabilities(double FAB, double FA,double FB,
-                                  struct plist *prAB,
-                                  struct plist *prA, struct plist *prB,
-                                  int Alength) {
-  /*computes binding probabilities and dimer free energies*/
-  int i, j;
-  double pAB;
-  double mykT;
-  struct plist  *lp1, *lp2;
-  int offset;
-
-  mykT=pf_params->kT/1000.;
-
-  /* pair probabilities in pr are relative to the null model (without DuplexInit) */
-
-  /*Compute probabilities pAB, pAA, pBB*/
-
-  pAB=1.-exp((1/mykT)*(FAB-FA-FB));
-
-  /* compute pair probabilities given that it is a dimer */
-  /* AB dimer */
-  offset=0;
-  lp2=prA;
-  if (pAB>0)
-    for (lp1=prAB; lp1->j>0; lp1++) {
-      float pp=0;
-      i=lp1->i; j=lp1->j;
-      while (offset+lp2->i < i && lp2->i>0) lp2++;
-      if (offset+lp2->i == i)
-        while ((offset+lp2->j) < j  && (lp2->j>0)) lp2++;
-      if (lp2->j == 0) {lp2=prB; offset=Alength;}/* jump to next list */
-      if ((offset+lp2->i==i) && (offset+lp2->j ==j)) {
-        pp = lp2->p;
-        lp2++;
-      }
-      lp1->p=(lp1->p-(1-pAB)*pp)/pAB;
-      if(lp1->p < 0.){
-        warn_user("part_func_co: numeric instability detected, probability below zero!");
-        lp1->p = 0.;
-      }
-    }
-  return;
-}
-
-PRIVATE double *Newton_Conc(double KAB, double KAA, double KBB, double concA, double concB,double* ConcVec) {
-  double TOL, EPS, xn, yn, det, cA, cB;
-  int i=0;
-  /*Newton iteration for computing concentrations*/
-  cA=concA;
-  cB=concB;
-  TOL=1e-6; /*Tolerance for convergence*/
-  ConcVec=(double*)space(5*sizeof(double)); /* holds concentrations */
-  do {
-    /* det = (4.0 * KAA * cA + KAB *cB + 1.0) * (4.0 * KBB * cB + KAB *cA + 1.0) - (KAB *cB) * (KAB *cA); */
-    det = 1 + 16. *KAA*KBB*cA*cB + KAB*(cA+cB) + 4.*KAA*cA + 4.*KBB*cB + 4.*KAB*(KBB*cB*cB + KAA*cA*cA);
-    /* xn  = ( (2.0 * KBB * cB*cB + KAB *cA *cB + cB - concB) * (KAB *cA) -
-       (2.0 * KAA * cA*cA + KAB *cA *cB + cA - concA) * (4.0 * KBB * cB + KAB *cA + 1.0) ) /det; */
-    xn  = ( (2.0 * KBB * cB*cB + cB - concB) * (KAB *cA) - KAB*cA*cB*(4. * KBB*cB + 1.) -
-	    (2.0 * KAA * cA*cA + cA - concA) * (4.0 * KBB * cB + KAB *cA + 1.0) ) /det;
-    /* yn  = ( (2.0 * KAA * cA*cA + KAB *cA *cB + cA - concA) * (KAB *cB) -
-       (2.0 * KBB * cB*cB + KAB *cA *cB + cB - concB) * (4.0 * KAA * cA + KAB *cB + 1.0) ) /det; */
-    yn  = ( (2.0 * KAA * cA*cA + cA - concA) * (KAB *cB) - KAB*cA*cB*(4. * KAA*cA + 1.) -
-            (2.0 * KBB * cB*cB + cB - concB) * (4.0 * KAA * cA + KAB *cB + 1.0) ) /det;
-    EPS = fabs(xn/cA) + fabs(yn/cB);
-    cA += xn;
-    cB += yn;
-    i++;
-    if (i>10000) {
-      fprintf(stderr, "Newton did not converge after %d steps!!\n",i);
-      break;
-    }
-  } while(EPS>TOL);
-
-  ConcVec[0]= cA*cB*KAB ;/*AB concentration*/
-  ConcVec[1]= cA*cA*KAA ;/*AA concentration*/
-  ConcVec[2]= cB*cB*KBB ;/*BB concentration*/
-  ConcVec[3]= cA;        /* A concentration*/
-  ConcVec[4]= cB;        /* B concentration*/
-
-  return ConcVec;
-}
-
-PUBLIC struct ConcEnt *get_concentrations(double FcAB, double FcAA, double FcBB, double FEA, double FEB, double *startconc)
-{
-  /*takes an array of start concentrations, computes equilibrium concentrations of dimers, monomers, returns array of concentrations in strucutre ConcEnt*/
-  double *ConcVec;
-  int i;
-  struct ConcEnt *Concentration;
-  double KAA, KAB, KBB, kT;
-
-  kT=pf_params->kT/1000.;
-  Concentration=(struct ConcEnt *)space(20*sizeof(struct ConcEnt));
- /* Compute equilibrium constants */
-  /* again note the input free energies are not from the null model (without DuplexInit) */
-
-  KAA = exp(( 2.0 * FEA - FcAA)/kT);
-  KBB = exp(( 2.0 * FEB - FcBB)/kT);
-  KAB = exp(( FEA + FEB - FcAB)/kT);
-  /* printf("Kaa..%g %g %g\n", KAA, KBB, KAB); */
-  for (i=0; ((startconc[i]!=0)||(startconc[i+1]!=0));i+=2) {
-    ConcVec=Newton_Conc(KAB, KAA, KBB, startconc[i], startconc[i+1], ConcVec);
-    Concentration[i/2].A0=startconc[i];
-    Concentration[i/2].B0=startconc[i+1];
-    Concentration[i/2].ABc=ConcVec[0];
-    Concentration[i/2].AAc=ConcVec[1];
-    Concentration[i/2].BBc=ConcVec[2];
-    Concentration[i/2].Ac=ConcVec[3];
-    Concentration[i/2].Bc=ConcVec[4];
-
-   if (!(((i+2)/2)%20))  {
-     Concentration=(struct ConcEnt *)xrealloc(Concentration,((i+2)/2+20)*sizeof(struct ConcEnt));
-     }
-    free(ConcVec);
-  }
-
-  return Concentration;
-}
-
-PUBLIC FLT_OR_DBL *export_co_bppm(void){
-  return probs;
-}
-
-/*###########################################*/
-/*# deprecated functions below              #*/
-/*###########################################*/
-
-
-PUBLIC struct plist *get_plist(struct plist *pl, int length, double cut_off) {
-  int i, j,n, count;
-  /*get pair probibilities out of pr array*/
-  count=0;
-  n=2;
-  for (i=1; i<length; i++) {
-    for (j=i+1; j<=length; j++) {
-      if (pr[my_iindx[i]-j]<cut_off) continue;
-      if (count==n*length-1) {
-        n*=2;
-        pl=(struct plist *)xrealloc(pl,n*length*sizeof(struct plist));
-      }
-      pl[count].i=i;
-      pl[count].j=j;
-      pl[count++].p=pr[my_iindx[i]-j];
-      /*      printf("gpl: %2d %2d %.9f\n",i,j,pr[my_iindx[i]-j]);*/
-    }
-  }
-  pl[count].i=0;
-  pl[count].j=0; /*->??*/
-  pl[count++].p=0.;
-  pl=(struct plist *)xrealloc(pl,(count)*sizeof(struct plist));
-  return pl;
-}
-
-PUBLIC void init_co_pf_fold(int length){ /* DO NOTHING */ }
diff --git a/cbits/utils.c b/cbits/utils.c
deleted file mode 100644
--- a/cbits/utils.c
+++ /dev/null
@@ -1,1154 +0,0 @@
-/*
-                               utils.c
-
-                 c  Ivo L Hofacker and Walter Fontana
-                          Vienna RNA package
-*/
-/* Last changed Time-stamp: <2008-11-25 16:34:36 ivo> */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <errno.h>
-#include <time.h>
-#include <string.h>
-#include "config.h" // chzs
-#include "utils.h"
-
-#ifdef WITH_DMALLOC
-#include "dmalloc.h"
-#endif
-
-#define PRIVATE  static
-#define PUBLIC
-
-/*@notnull@ @only@*/
-PUBLIC unsigned short xsubi[3];
-
-PRIVATE char  scale1[] = "....,....1....,....2....,....3....,....4";
-PRIVATE char  scale2[] = "....,....5....,....6....,....7....,....8";
-PRIVATE char  *inbuf = NULL;
-
-PRIVATE char  *inbuf2 = NULL;
-PRIVATE unsigned int typebuf2 = 0;
-
-/*-------------------------------------------------------------------------*/
-
-PUBLIC void *space(unsigned size) {
-  void *pointer;
-
-  if ( (pointer = (void *) calloc(1, (size_t) size)) == NULL) {
-#ifdef EINVAL
-    if (errno==EINVAL) {
-      fprintf(stderr,"SPACE: requested size: %d\n", size);
-      nrerror("SPACE allocation failure -> EINVAL");
-    }
-    if (errno==ENOMEM)
-#endif
-      nrerror("SPACE allocation failure -> no memory");
-  }
-  return  pointer;
-}
-
-#ifdef WITH_DMALLOC
-#define space(S) calloc(1,(S))
-#endif
-
-#undef xrealloc
-/* dmalloc.h #define's xrealloc */
-void *xrealloc (void *p, unsigned size) {
-  if (p == 0)
-    return space(size);
-  p = (void *) realloc(p, size);
-  if (p == NULL) {
-#ifdef EINVAL
-    if (errno==EINVAL) {
-      fprintf(stderr,"xrealloc: requested size: %d\n", size);
-      nrerror("xrealloc allocation failure -> EINVAL");
-    }
-    if (errno==ENOMEM)
-#endif
-      nrerror("xrealloc allocation failure -> no memory");
-  }
-  return p;
-}
-
-/*------------------------------------------------------------------------*/
-
-PUBLIC void nrerror(const char message[])       /* output message upon error */
-{
-  fprintf(stderr, "ERROR: %s\n", message);
-  exit(EXIT_FAILURE);
-}
-
-PUBLIC void warn_user(const char message[]){
-  fprintf(stderr, "WARNING: %s\n", message);
-}
-
-/*------------------------------------------------------------------------*/
-PUBLIC void init_rand(void)
-{
-  time_t t;
-  (void) time(&t);
-  xsubi[0] = xsubi[1] = xsubi[2] = (unsigned short) t;  /* lower 16 bit */
-  xsubi[1] += (unsigned short) ((unsigned)t >> 6);
-  xsubi[2] += (unsigned short) ((unsigned)t >> 12);
-#ifndef HAVE_ERAND48
-  srand((unsigned int) t);
-#endif
-}
-
-/*------------------------------------------------------------------------*/
-
-PUBLIC double urn(void)
-     /* uniform random number generator; urn() is in [0,1] */
-     /* uses a linear congruential library routine */
-     /* 48 bit arithmetic */
-{
-#ifdef HAVE_ERAND48
-  extern double erand48(unsigned short[]);
-  return erand48(xsubi);
-#else
-  return ((double) rand())/RAND_MAX;
-#endif
-}
-
-/*------------------------------------------------------------------------*/
-
-PUBLIC int int_urn(int from, int to)
-{
-  return ( ( (int) (urn()*(to-from+1)) ) + from );
-}
-
-/*------------------------------------------------------------------------*/
-
-PUBLIC void filecopy(FILE *from, FILE *to)
-{
-  int c;
-
-  while ((c = getc(from)) != EOF) (void)putc(c, to);
-}
-
-/*-----------------------------------------------------------------*/
-
-PUBLIC char *time_stamp(void)
-{
-  time_t  cal_time;
-
-  cal_time = time(NULL);
-  return ( ctime(&cal_time) );
-}
-
-/*-----------------------------------------------------------------*/
-
-PUBLIC char *random_string(int l, const char symbols[])
-{
-  char *r;
-  int   i, rn, base;
-
-  base = (int) strlen(symbols);
-  r = (char *) space(sizeof(char)*(l+1));
-
-  for (i = 0; i < l; i++) {
-    rn = (int) (urn()*base);  /* [0, base-1] */
-    r[i] = symbols[rn];
-  }
-  r[l] = '\0';
-  return r;
-}
-
-/*-----------------------------------------------------------------*/
-
-PUBLIC int   hamming(const char *s1, const char *s2)
-{
-  int h=0;
-
-  for (; *s1 && *s2; s1++, s2++)
-    if (*s1 != *s2) h++;
-  return h;
-}
-
-PUBLIC int   hamming_bound(const char *s1, const char *s2, int boundary)
-{
-  int h=0;
-
-  for (; *s1 && *s2 && boundary; s1++, s2++, boundary--)
-    if (*s1 != *s2) h++;
-  return h;
-}
-/*-----------------------------------------------------------------*/
-
-PUBLIC char *get_line(FILE *fp) /* reads lines of arbitrary length from fp */
-{
-  char s[512], *line, *cp;
-  int len=0, size=0, l;
-  line=NULL;
-  do {
-    if (fgets(s, 512, fp)==NULL) break;
-    cp = strchr(s, '\n');
-    if (cp != NULL) *cp = '\0';
-    l = len + (int)strlen(s);
-    if (l+1>size) {
-      size = (int)((l+1)*1.2);
-      line = (char *) xrealloc(line, size*sizeof(char));
-    }
-    strcat(line+len, s);
-    len=l;
-  } while(cp==NULL);
-
-  return line;
-}
-
-PUBLIC int  skip_comment_lines(char **line){
-  if((*line = get_line(stdin))==NULL) return -1;
-
-  while((**line=='*')||(**line=='\0')){
-    free(*line);
-    if((*line = get_line(stdin))==NULL) return -1;
-  }
-  return 0;
-}
-
-PUBLIC  unsigned int get_input_line(char **string, unsigned int option){
-  char  *line;
-  int   i, l, r;
-
-  /*
-  * read lines until informative data appears or
-  * report an error if anything goes wrong
-  */
-  if((line = get_line(stdin))==NULL) return VRNA_INPUT_ERROR;
-
-  if(!(option & VRNA_INPUT_NOSKIP_COMMENTS))
-    while((*line=='*')||(*line=='\0')){
-      free(line);
-      if((line = get_line(stdin))==NULL) return VRNA_INPUT_ERROR;
-    }
-
-  l = (int) strlen(line);
-
-  /* break on '@' sign if not disabled */
-  if(*line == '@'){
-    free(line);
-    return VRNA_INPUT_QUIT;
-  }
-  /* print line read if not disabled */
-  /* if(!(option & VRNA_INPUT_NOPRINT)) printf("%s\n", line); */
-
-  /* eliminate whitespaces at the end of the line read */
-  if(!(option & VRNA_INPUT_NO_TRUNCATION)){
-    for(i = l-1; i >= 0; i--){
-      if      (line[i] == ' ')  continue;
-      else if (line[i] == '\t') continue;
-      else                      break;
-    }
-    line[(i >= 0) ? (i+1) : 0] = '\0';
-  }
-
-  if(*line == '>'){
-    /* fasta header */
-    /* alloc memory for the string */
-    *string = (char *) space(sizeof(char) * (strlen(line) + 1));
-    r = VRNA_INPUT_FASTA_HEADER;
-    i = sscanf(line, ">%s", *string);
-    if(i > 0){
-      i       = (int)     strlen(*string);
-      *string = (char *)  xrealloc(*string, (i+1)*sizeof(char));
-      free(line);
-      return r;
-    }
-    else{
-      free(line);
-      free(*string);
-      *string = NULL;
-      return VRNA_INPUT_ERROR;
-    }
-  }
-  else{
-    *string = strdup(line);
-    free(line);
-  }
-  return VRNA_INPUT_MISC;
-}
-
-PUBLIC  unsigned int get_multi_input_line(char **string, unsigned int option){
-  char  *line;
-  int   i, l;
-  int   state = 0;
-  int   str_length = 0;
-
-  line = (inbuf) ? inbuf : get_line(stdin);
-  inbuf = NULL;
-  do{
-
-    /*
-    * read lines until informative data appears or
-    * report an error if anything goes wrong
-    */
-    if(!line) return VRNA_INPUT_ERROR;
-
-    l = (int)strlen(line);
-
-    /* eliminate whitespaces at the end of the line read */
-    if(!(option & VRNA_INPUT_NO_TRUNCATION)){
-      for(i = l-1; i >= 0; i--){
-        if      (line[i] == ' ')  continue;
-        else if (line[i] == '\t') continue;
-        else                      break;
-      }
-      line[(i >= 0) ? (i+1) : 0] = '\0';
-    }
-
-    l           = (int)strlen(line);
-    str_length  = (*string) ? (int) strlen(*string) : 0;
-
-    switch(*line){
-      case  '@':    /* user abort */
-                    if(state) inbuf = line;
-                    else      free(line);
-                    return (state==2) ? VRNA_INPUT_CONSTRAINT : (state==1) ? VRNA_INPUT_SEQUENCE : VRNA_INPUT_QUIT;
-
-      case  '\0':   /* empty line */
-                    if(option & VRNA_INPUT_NOSKIP_BLANK_LINES){
-                      if(state) inbuf = line;
-                      else      free(line);
-                      return (state==2) ? VRNA_INPUT_CONSTRAINT : (state==1) ? VRNA_INPUT_SEQUENCE : VRNA_INPUT_BLANK_LINE;
-                    }
-                    break;
-
-      case  '#': case  '%': case  ';': case  '/': case  '*': case ' ':
-                    /* comments */
-                    if(option & VRNA_INPUT_NOSKIP_COMMENTS){
-                      if(state) inbuf   = line;
-                      else      *string = line;
-                      return (state == 2) ? VRNA_INPUT_CONSTRAINT : (state==1) ? VRNA_INPUT_SEQUENCE : VRNA_INPUT_COMMENT;
-                    }
-                    break;
-
-      case  '>':    /* fasta header */
-                    if(state) inbuf   = line;
-                    else      *string = line;
-                    return (state==2) ? VRNA_INPUT_CONSTRAINT : (state==1) ? VRNA_INPUT_SEQUENCE : VRNA_INPUT_FASTA_HEADER;
-
-      case  'x': case 'e': case 'l': case '&':   /* seems to be a constraint or line starting with second sequence for dimer calculations */
-                    i = 1;
-                    /* lets see if this assumption holds for the complete line */
-                    while((line[i] == 'x') || (line[i] == 'e') || (line[i] == 'l')) i++;
-                    /* lines solely consisting of 'x's, 'e's or 'l's will be considered as structure constraint */
-                    
-                    if(
-                            ((line[i]>64) && (line[i]<91))  /* A-Z */
-                        ||  ((line[i]>96) && (line[i]<123)) /* a-z */
-                      ){
-                      if(option & VRNA_INPUT_FASTA_HEADER){
-                        /* are we in structure mode? Then we remember this line for the next round */
-                        if(state == 2){ inbuf = line; return VRNA_INPUT_CONSTRAINT;}
-                        else{
-                          *string = (char *)xrealloc(*string, sizeof(char) * (str_length + l + 1));
-                          strcpy(*string + str_length, line);
-                          state = 1;
-                        }
-                        break;
-                      }
-                      /* otherwise return line read */
-                      else{ *string = line; return VRNA_INPUT_SEQUENCE;}
-                    }
-                    /* mmmh? it really seems to be a constraint */
-                    /* fallthrough */
-      case  '<': case  '.': case  '|': case  '(': case ')': case '[': case ']': case '{': case '}': case ',': case '+':
-                    /* seems to be a structure or a constraint */
-                    /* either we concatenate this line to one that we read previously */
-                    if(option & VRNA_INPUT_FASTA_HEADER){
-                      if(state == 1){
-                        inbuf = line;
-                        return VRNA_INPUT_SEQUENCE;
-                      }
-                      else{
-                        *string = (char *)xrealloc(*string, sizeof(char) * (str_length + l + 1));
-                        strcpy(*string + str_length, line);
-                        state = 2;
-                      }
-                    }
-                    /* or we return it as it is */
-                    else{
-                      *string = line;
-                      return VRNA_INPUT_CONSTRAINT;
-                    }
-                    break;
-      default:      if(option & VRNA_INPUT_FASTA_HEADER){
-                      /* are we already in sequence mode? */
-                      if(state == 2){
-                        inbuf = line;
-                        return VRNA_INPUT_CONSTRAINT;
-                      }
-                      else{
-                        *string = (char *)xrealloc(*string, sizeof(char) * (str_length + l + 1));
-                        strcpy(*string + str_length, line);
-                        state = 1;
-                      }
-                    }
-                    /* otherwise return line read */
-                    else{
-                      *string = line;
-                      return VRNA_INPUT_SEQUENCE;
-                    }
-    }
-    free(line);
-    line = get_line(stdin);
-  }while(line);
-
-  return (state==2) ? VRNA_INPUT_CONSTRAINT : (state==1) ? VRNA_INPUT_SEQUENCE : VRNA_INPUT_ERROR;
-}
-
-PUBLIC  unsigned int read_record(char **header, char **sequence, char ***rest, unsigned int options){
-  unsigned int  input_type, return_type, tmp_type;
-  int           rest_count;
-  char          *input_string;
-
-  rest_count    = 0;
-  return_type   = tmp_type = 0;
-  input_string  = *header = *sequence = NULL;
-  *rest         = (char **)space(sizeof(char *));
-
-  /* remove unnecessary option flags from options variable... */
-  options &= ~VRNA_INPUT_FASTA_HEADER;
-
-  /* read first input or last buffered input */
-  if(typebuf2){
-    input_type    = typebuf2;
-    input_string  = inbuf2;
-    typebuf2      = 0;
-    inbuf2        = NULL;
-  }
-  else input_type  = get_multi_input_line(&input_string, options);
-
-  if(input_type & (VRNA_INPUT_QUIT | VRNA_INPUT_ERROR)) return input_type;
-
-  /* skip everything until we read either a fasta header or a sequence */
-  while(input_type & (VRNA_INPUT_MISC | VRNA_INPUT_CONSTRAINT | VRNA_INPUT_BLANK_LINE)){
-    free(input_string); input_string = NULL;
-    input_type    = get_multi_input_line(&input_string, options);
-    if(input_type & (VRNA_INPUT_QUIT | VRNA_INPUT_ERROR)) return input_type;
-  }
-
-  if(input_type & VRNA_INPUT_FASTA_HEADER){
-    return_type  |= VRNA_INPUT_FASTA_HEADER; /* remember that we've read a fasta header */
-    *header       = input_string;
-    input_string  = NULL;
-    /* get next data-block with fasta support if not explicitely forbidden by VRNA_INPUT_NO_SPAN */
-    input_type  = get_multi_input_line(
-                    &input_string,
-                    ((options & VRNA_INPUT_NO_SPAN) ? 0 : VRNA_INPUT_FASTA_HEADER) | options
-                  );
-    if(input_type & (VRNA_INPUT_QUIT | VRNA_INPUT_ERROR)) return (return_type | input_type);
-  }
-
-  if(input_type & VRNA_INPUT_SEQUENCE){
-    return_type  |= VRNA_INPUT_SEQUENCE; /* remember that we've read a sequence */
-    *sequence     = input_string;
-    input_string  = NULL;
-  } else nrerror("sequence input missing");
-
-  /* read the rest until we find user abort, EOF, new sequence or new fasta header */
-  if(!(options & VRNA_INPUT_NO_REST)){
-    options |= VRNA_INPUT_NOSKIP_COMMENTS; /* allow commetns to appear in rest output */
-    tmp_type = VRNA_INPUT_QUIT | VRNA_INPUT_ERROR | VRNA_INPUT_SEQUENCE | VRNA_INPUT_FASTA_HEADER;
-    if(options & VRNA_INPUT_NOSKIP_BLANK_LINES) tmp_type |= VRNA_INPUT_BLANK_LINE;
-    while(!((input_type = get_multi_input_line(&input_string, options)) & tmp_type)){
-      *rest = xrealloc(*rest, sizeof(char **)*(++rest_count + 1));
-      (*rest)[rest_count-1] = input_string;
-      input_string = NULL;
-    }
-    /*
-    if(input_type & (VRNA_INPUT_QUIT | VRNA_INPUT_ERROR)) return input_type;
-    */
-
-    /*  finished reading everything...
-    *   we now put the last line into the buffer if necessary
-    *   since it should belong to the next record
-    */
-    inbuf2 = input_string;
-    typebuf2 = input_type;
-  }
-  (*rest)[rest_count] = NULL;
-  return (return_type);
-}
-
-
-/*-----------------------------------------------------------------*/
-
-PUBLIC char *pack_structure(const char *struc) {
-  /* 5:1 compression using base 3 encoding */
-  int i,j,l,pi;
-  unsigned char *packed;
-
-  l = (int) strlen(struc);
-  packed = (unsigned char *) space(((l+4)/5+1)*sizeof(unsigned char));
-
-  j=i=pi=0;
-  while (i<l) {
-    register int p;
-    for (p=pi=0; pi<5; pi++) {
-      p *= 3;
-      switch (struc[i]) {
-      case '(':
-      case '\0':
-        break;
-      case '.':
-        p++;
-        break;
-      case ')':
-        p += 2;
-        break;
-      default: nrerror("pack_structure: illegal charcter in structure");
-      }
-      if (i<l) i++;
-    }
-    packed[j++] = (unsigned char) (p+1); /* never use 0, so we can use
-                                            strcmp()  etc. */
-  }
-  packed[j] = '\0';      /* for str*() functions */
-  return (char *) packed;
-}
-
-PUBLIC char *unpack_structure(const char *packed) {
-  /* 5:1 compression using base 3 encoding */
-  int i,j,l;
-  char *struc;
-  unsigned const char *pp;
-  char code[3] = {'(', '.', ')'};
-
-  l = (int) strlen(packed);
-  pp = (const unsigned char *) packed;
-  struc = (char *) space((l*5+1)*sizeof(char));   /* up to 4 byte extra */
-
-  for (i=j=0; i<l; i++) {
-    register int p, c, k;
-
-    p = (int) pp[i] - 1;
-    for (k=4; k>=0; k--) {
-      c = p % 3;
-      p /= 3;
-      struc[j+k] = code[c];
-    }
-    j += 5;
-  }
-  struc[j--] = '\0';
-  while (struc[j] == '(') /* strip trailing ( */
-    struc[j--] = '\0';
-
-  return struc;
-}
-
-/*--------------------------------------------------------------------------*/
-
-PUBLIC short *make_pair_table(const char *structure)
-{
-    /* returns array representation of structure.
-       table[i] is 0 if unpaired or j if (i.j) pair.  */
-   short i,j,hx;
-   short length;
-   short *stack;
-   short *table;
-
-   length = (short) strlen(structure);
-   stack = (short *) space(sizeof(short)*(length+1));
-   table = (short *) space(sizeof(short)*(length+2));
-   table[0] = length;
-
-   for (hx=0, i=1; i<=length; i++) {
-      switch (structure[i-1]) {
-       case '(':
-         stack[hx++]=i;
-         break;
-       case ')':
-         j = stack[--hx];
-         if (hx<0) {
-            fprintf(stderr, "%s\n", structure);
-            nrerror("unbalanced brackets in make_pair_table");
-         }
-         table[i]=j;
-         table[j]=i;
-         break;
-       default:   /* unpaired base, usually '.' */
-         table[i]= 0;
-         break;
-      }
-   }
-   if (hx!=0) {
-      fprintf(stderr, "%s\n", structure);
-      nrerror("unbalanced brackets in make_pair_table");
-   }
-   free(stack);
-   return(table);
-}
-
-PUBLIC short *make_pair_table_pk(const char *structure){
-   short i,j,hx, hx2;
-   short length;
-   short *stack;
-   short *stack2;
-   short *table;
-
-   length = (short) strlen(structure);
-   stack  = (short *) space(sizeof(short)*(length+1));
-   stack2 = (short *) space(sizeof(short)*(length+1));
-   table  = (short *) space(sizeof(short)*(length+2));
-   table[0] = length;
-
-   for (hx=0, hx2=0, i=1; i<=length; i++) {
-      switch (structure[i-1]) {
-       case '(':
-         stack[hx++]=i;
-         break;
-       case ')':
-         j = stack[--hx];
-         if (hx<0) {
-            fprintf(stderr, "%s\n", structure);
-            nrerror("unbalanced '()' brackets in make_pair_table_pk");
-         }
-         table[i]=j;
-         table[j]=i;
-         break;
-       case '[':
-         stack2[hx2++]=i;
-         break;
-       case ']':
-         j = stack2[--hx2];
-         if (hx2<0) {
-            fprintf(stderr, "%s\n", structure);
-            nrerror("unbalanced '[]' brackets in make_pair_table_pk");
-         }
-         table[i]=j;
-         table[j]=i;
-         break;
-       default:   /* unpaired base, usually '.' */
-         table[i]= 0;
-         break;
-      }
-   }
-   if (hx!=0) {
-      fprintf(stderr, "%s\n", structure);
-      nrerror("unbalanced '()' brackets in make_pair_table_pk");
-   } else if (hx2!=0) {
-      fprintf(stderr, "%s\n", structure);
-      nrerror("unbalanced '[]' brackets in make_pair_table_pk");
-   }
-   free(stack);
-   free(stack2);
-   return(table);
-}
-
-PUBLIC short *make_pair_table_snoop(const char *structure)
-{
-    /* returns array representation of structure.
-       table[i] is 0 if unpaired or j if (i.j) pair.  */
-   short i,j,hx;
-   short length;
-   short *stack;
-   short *table;
-
-   length = (short) strlen(structure);
-   stack = (short *) space(sizeof(short)*(length+1));
-   table = (short *) space(sizeof(short)*(length+2));
-   table[0] = length;
-
-   for (hx=0, i=1; i<=length; i++) {
-     switch (structure[i-1]) {
-     case '<':
-       stack[hx++]=i;
-       break;
-     case '>':
-       j = stack[--hx];
-       if (hx<0) {
-	 fprintf(stderr, "%s\n", structure);
-	 nrerror("unbalanced brackets in make_pair_table");
-       }
-       table[i]=j;
-       table[j]=i;
-       break;
-     default:   /* unpaired base, usually '.' */
-       table[i]= table[i];
-       break;
-     }
-   }
-   if (hx!=0) {
-     fprintf(stderr, "%s\n", structure);
-     nrerror("unbalanced brackets in make_pair_table");
-   }
-   free(stack);
-   return table ;
-}
-
-
-PUBLIC short *alimake_pair_table(const char *structure)
-{
-    /* returns array representation of structure.
-       table[i] is 0 if unpaired or j if (i.j) pair.  */
-   short i,j,hx;
-   short length;
-   short *stack;
-   short *table;
-
-   length = (short) strlen(structure);
-   stack = (short *) space(sizeof(short)*(length+1));
-   table = (short *) space(sizeof(short)*(length+2));
-   table[0] = length;
-
-   for (hx=0, i=1; i<=length; i++) {
-      switch (structure[i-1]) {
-       case '(':
-	 stack[hx++]=i;
-	 break;
-       case ')':
-	 j = stack[--hx];
-	 if (hx<0) {
-	    fprintf(stderr, "%s\n", structure);
-	    nrerror("unbalanced brackets in make_pair_table");
-	 }
-	 table[i]=j;
-	 table[j]=i;
-	 break;
-       default:   /* unpaired base, usually '.' */
-	 table[i]= 0;
-	 break;
-      }
-   }
-   for (hx=0, i=1; i<=length; i++) {
-      switch (structure[i-1]) {
-       case '<':
-	 stack[hx++]=i;
-	 break;
-       case '>':
-	 j = stack[--hx];
-	 if (hx<0) {
-	    fprintf(stderr, "%s\n", structure);
-	    nrerror("unbalanced brackets in make_pair_table");
-	 }
-	 table[i]=j;
-	 table[j]=i;
-	 break;
-       default:   /* unpaired base, usually '.' */
-	 table[i]= table[i];
-	 break;
-      }
-   }
-   for (hx=0, i=1; i<=length; i++) {
-     switch (structure[i-1]) {
-     case '[':
-       stack[hx++]=i;
-       break;
-     case ']':
-       j = stack[--hx];
-       if (hx<0) {
-	 fprintf(stderr, "%s\n", structure);
-	 nrerror("unbalanced brackets in make_pair_table");
-       }
-       table[i]=j;
-       table[j]=i;
-       break;
-     default:   /* unpaired base, usually '.' */
-       break;
-     }
-   }
-   if (hx!=0) {
-      fprintf(stderr, "%s\n", structure);
-      nrerror("unbalanced brackets in make_pair_table");
-   }
-   free(stack);
-   return(table);
-}
-
-PUBLIC short *copy_pair_table(const short *pt){
-  short *table = (short *)space(sizeof(short) * (pt[0]+2));
-  memcpy(table, pt, sizeof(short)*(pt[0]+2));
-  return table;
-}
-
-
-PUBLIC int *make_loop_index_pt(short *pt){
-
-  /* number each position by which loop it belongs to (positions start
-     at 1) */
-  int i,hx,l,nl;
-  int length;
-  int *stack = NULL;
-  int *loop = NULL;
-
-  length = pt[0];
-  stack  = (int *) space(sizeof(int)*(length+1));
-  loop   = (int *) space(sizeof(int)*(length+2));
-  hx=l=nl=0;
-
-  for (i=1; i<=length; i++) {
-    if ((pt[i] != 0) && (i < pt[i])) { /* ( */
-      nl++; l=nl;
-      stack[hx++]=i;
-    }
-    loop[i]=l;
-
-    if ((pt[i] != 0) && (i > pt[i])) { /* ) */
-      --hx;
-      if (hx>0)
-        l = loop[stack[hx-1]];  /* index of enclosing loop   */
-      else l=0;                 /* external loop has index 0 */
-      if (hx<0) {
-        nrerror("unbalanced brackets in make_pair_table");
-      }
-    }
-  }
-  loop[0] = nl;
-  free(stack);
-  return (loop);
-}
-
-/*---------------------------------------------------------------------------*/
-
-PUBLIC int bp_distance(const char *str1, const char *str2)
-{
-  /* dist = {number of base pairs in one structure but not in the other} */
-  /* same as edit distance with pair_open pair_close as move set */
-   int dist;
-   short i,l;
-   short *t1, *t2;
-
-   dist = 0;
-   t1 = make_pair_table(str1);
-   t2 = make_pair_table(str2);
-
-   l = (t1[0]<t2[0])?t1[0]:t2[0];    /* minimum of the two lengths */
-
-   for (i=1; i<=l; i++)
-     if (t1[i]!=t2[i]) {
-       if (t1[i]>i) dist++;
-       if (t2[i]>i) dist++;
-     }
-   free(t1); free(t2);
-   return dist;
-}
-
-#ifndef HAVE_STRDUP
-char *strdup(const char *s) {
-  char *dup;
-
-  dup = space(strlen(s)+1);
-  strcpy(dup, s);
-  return(dup);
-}
-#endif
-
-PUBLIC  void  print_tty_input_seq(void){
-  print_tty_input_seq_str("Input string (upper or lower case)");
-}
-
-PUBLIC  void  print_tty_input_seq_str(const char *s){
-  printf("\n%s; @ to quit\n", s);
-  printf("%s%s\n", scale1, scale2);
-  (void) fflush(stdout);
-}
-
-PUBLIC  void  print_tty_constraint_full(void){
-  print_tty_constraint(VRNA_CONSTRAINT_PIPE | VRNA_CONSTRAINT_DOT | VRNA_CONSTRAINT_X | VRNA_CONSTRAINT_ANG_BRACK | VRNA_CONSTRAINT_RND_BRACK);
-}
-
-PUBLIC  void  print_tty_constraint(unsigned int option){
-  if(!(option & VRNA_CONSTRAINT_NO_HEADER)) printf("Input structure constraints using the following notation:\n");
-  if(option & VRNA_CONSTRAINT_PIPE)       printf("| : paired with another base\n");
-  if(option & VRNA_CONSTRAINT_DOT)        printf(". : no constraint at all\n");
-  if(option & VRNA_CONSTRAINT_X)          printf("x : base must not pair\n");
-  if(option & VRNA_CONSTRAINT_ANG_BRACK)  printf("< : base i is paired with a base j<i\n> : base i is paired with a base j>i\n");
-  if(option & VRNA_CONSTRAINT_RND_BRACK)  printf("matching brackets ( ): base i pairs base j\n");
-}
-
-PUBLIC  void  str_DNA2RNA(char *sequence){
-  unsigned int l, i;
-  if(sequence != NULL){
-    l = strlen(sequence);
-    for(i = 0; i < l; i++){
-      if(sequence[i] == 'T') sequence[i] = 'U';
-      if(sequence[i] == 't') sequence[i] = 'u';
-    }
-  }
-}
-
-PUBLIC void str_uppercase(char *sequence){
-  unsigned int l, i;
-  if(sequence){
-    l = strlen(sequence);
-    for(i=0;i<l;i++)
-      sequence[i] = toupper(sequence[i]);
-  }
-}
-
-PUBLIC int *get_iindx(unsigned int length){
-  int i;
-  int *idx = (int *)space(sizeof(int) * (length+1));
-  for (i=1; i <= length; i++)
-    idx[i] = (((length + 1 - i) * (length - i))>>1) + length + 1;
-  return idx;
-}
-
-PUBLIC int *get_indx(unsigned int length){
-  unsigned int i;
-  int *idx = (int *)space(sizeof(int) * (length+1));
-  for (i = 1; i <= length; i++)
-    idx[i] = (i*(i-1)) >> 1;        /* i(i-1)/2 */
-  return idx;
-}
-
-PUBLIC void getConstraint(char **cstruc, const char **lines, unsigned int option){
-  int r, i, l, cl, stop;
-  char *c, *ptr;
-  if(lines){
-    if(option & VRNA_CONSTRAINT_ALL)
-      option |= VRNA_CONSTRAINT_PIPE | VRNA_CONSTRAINT_ANG_BRACK | VRNA_CONSTRAINT_RND_BRACK | VRNA_CONSTRAINT_X | VRNA_CONSTRAINT_G;
-
-    for(r=i=stop=0;lines[i];i++){
-      l   = (int)strlen(lines[i]);
-      c   = (char *) space(sizeof(char) * (l+1));
-      (void) sscanf(lines[i], "%s", c);
-      cl  = (int)strlen(c);
-      /* line commented out ? */
-      if((*c == '#') || (*c == '%') || (*c == ';') || (*c == '/') || (*c == '*' || (*c == '\0'))){
-        /* skip leading comments only, i.e. do not allow comments inside the constraint */
-        if(!r)  continue;
-        else    break;
-      }
-
-      /* check current line for actual constraining structure */
-      for(ptr = c;*c;c++){
-        switch(*c){
-          case '|':   if(!(option & VRNA_CONSTRAINT_PIPE)){
-                        warn_user("constraints of type '|' not allowed");
-                        *c = '.';
-                      }
-                      break;
-          case '<':   
-          case '>':   if(!(option & VRNA_CONSTRAINT_ANG_BRACK)){
-                        warn_user("constraints of type '<' or '>' not allowed");
-                        *c = '.';
-                      }
-                      break;
-          case '(':
-          case ')':   if(!(option & VRNA_CONSTRAINT_RND_BRACK)){
-                        warn_user("constraints of type '(' or ')' not allowed");
-                        *c = '.';
-                      }
-                      break;
-          case 'x':   if(!(option & VRNA_CONSTRAINT_X)){
-                        warn_user("constraints of type 'x' not allowed");
-                        *c = '.';
-                      }
-                      break;
-          case '+':   if(!(option & VRNA_CONSTRAINT_G)){
-                        warn_user("character '+' ignored in structure");
-                        *c = '.';
-                      }
-          case '.':   break;
-          case '&':   break; /* ignore concatenation char */
-          default:    warn_user("unrecognized character in constraint structure");
-                      break;
-        }
-      }
-
-      r += cl+1;
-      *cstruc = (char *)xrealloc(*cstruc, r*sizeof(char));
-      strcat(*cstruc, ptr);
-      free(ptr);
-      /* stop if not in fasta mode or multiple words on line */
-      if(!(option & VRNA_CONSTRAINT_MULTILINE) || (cl != l)) break;
-    }
-  }
-}
-
-PUBLIC char *extract_record_rest_structure( const char **lines,
-                                            unsigned int length,
-                                            unsigned int option){
-
-  char *structure = NULL;
-  int r, i, l, cl, stop;
-  char *c;
-
-  if(lines){
-    for(r = i = stop = 0; lines[i]; i++){
-      l   = (int)strlen(lines[i]);
-      c   = (char *) space(sizeof(char) * (l+1));
-      (void) sscanf(lines[i], "%s", c);
-      cl  = (int)strlen(c);
-
-      /* line commented out ? */
-      if((*c == '#') || (*c == '%') || (*c == ';') || (*c == '/') || (*c == '*' || (*c == '\0'))){
-        /* skip leading comments only, i.e. do not allow comments inside the constraint */
-        if(!r)  continue;
-        else    break;
-      }
-
-      /* append the structure part to the output */
-      r += cl+1;
-      structure = (char *)xrealloc(structure, r*sizeof(char));
-      strcat(structure, c);
-      free(c);
-      /* stop if the assumed structure length has been reached */
-      if((length > 0) && (r-1 == length)) break;
-      /* stop if not allowed to read from multiple lines */
-      if(!(option & VRNA_OPTION_MULTILINE)) break;
-    }
-  }
-  return structure;
-}
-
-
-
-PUBLIC void constrain_ptypes(const char *constraint, unsigned int length, char *ptype, int *BP, int min_loop_size, unsigned int idx_type){
-  int n,i,j,k,l;
-  int hx, *stack;
-  char type;
-  int *index;
-
-  if(constraint == NULL) return;
-
-  n = (int)strlen(constraint);
-
-  stack = (int *) space(sizeof(int)*(n+1));
-
-  if(!idx_type){ /* index allows access in energy matrices at pos (i,j) via index[j]+i */
-    index = get_indx(length);
-
-    for(hx=0, j=1; j<=n; j++){
-      switch(constraint[j-1]){
-        case '|':   if(BP) BP[j] = -1;
-                    break;
-        case 'x':   /* can't pair */
-                    for (l=1; l<j-min_loop_size; l++) ptype[index[j]+l] = 0;
-                    for (l=j+min_loop_size+1; l<=(int)length; l++) ptype[index[l]+j] = 0;
-                    break;
-        case '(':   stack[hx++]=j;
-                    /* fallthrough */
-        case '<':   /* pairs upstream */
-                    for (l=1; l<j-min_loop_size; l++) ptype[index[j]+l] = 0;
-                    break;
-        case ')':   if (hx<=0) {
-                      fprintf(stderr, "%s\n", constraint);
-                      nrerror("unbalanced brackets in constraint");
-                    }
-                    i = stack[--hx];
-                    type = ptype[index[j]+i];
-                    for (k=i+1; k<=(int)length; k++) ptype[index[k]+i] = 0;
-                    /* don't allow pairs i<k<j<l */
-                    for (l=j; l<=(int)length; l++)
-                      for (k=i+1; k<=j; k++) ptype[index[l]+k] = 0;
-                    /* don't allow pairs k<i<l<j */
-                    for (l=i; l<=j; l++)
-                      for (k=1; k<=i; k++) ptype[index[l]+k] = 0;
-                    for (k=1; k<j; k++) ptype[index[j]+k] = 0;
-                    ptype[index[j]+i] = (type==0) ? 7 : type;
-                    /* fallthrough */
-        case '>':   /* pairs downstream */
-                    for (l=j+min_loop_size+1; l<=(int)length; l++) ptype[index[l]+j] = 0;
-                    break;
-      }
-    }
-  }
-  else{ /* index allows access in energy matrices at pos (i,j) via index[i]-j */
-    index = get_iindx(length);
-
-    for(hx=0, j=1; j<=n; j++) {
-      switch (constraint[j-1]) {
-        case 'x':   /* can't pair */
-                    for (l=1; l<j-min_loop_size; l++) ptype[index[l]-j] = 0;
-                    for (l=j+min_loop_size+1; l<=(int)length; l++) ptype[index[j]-l] = 0;
-                    break;
-        case '(':   stack[hx++]=j;
-                    /* fallthrough */
-        case '<':   /* pairs upstream */
-                    for (l=1; l<j-min_loop_size; l++) ptype[index[l]-j] = 0;
-                    break;
-        case ')':   if (hx<=0) {
-                      fprintf(stderr, "%s\n", constraint);
-                      nrerror("unbalanced brackets in constraints");
-                    }
-                    i = stack[--hx];
-                    type = ptype[index[i]-j];
-                    /* don't allow pairs i<k<j<l */
-                    for (k=i; k<=j; k++)
-                      for (l=j; l<=(int)length; l++) ptype[index[k]-l] = 0;
-                    /* don't allow pairs k<i<l<j */
-                    for (k=1; k<=i; k++)
-                      for (l=i; l<=j; l++) ptype[index[k]-l] = 0;
-                    ptype[index[i]-j] = (type==0) ? 7 : type;
-                    /* fallthrough */
-        case '>':   /* pairs downstream */
-                    for (l=j+min_loop_size+1; l<=(int)length; l++) ptype[index[j]-l] = 0;
-                    break;
-      }
-    }
-  }
-  if (hx!=0) {
-    fprintf(stderr, "%s\n", constraint);
-    nrerror("unbalanced brackets in constraint string");
-  }
-  free(index);
-  free(stack);
-}
-
-/* get a matrix containing the number of basepairs of a reference structure for each interval [i,j] with i<j
-*  access it via iindx!!!
-*/
-PUBLIC unsigned int *make_referenceBP_array(short *reference_pt, unsigned int turn){
-  unsigned int i,j,k,ij,length;
-  int *iindx;
-  unsigned int *array;
-  unsigned int size;
-  length = (unsigned int)reference_pt[0];
-  size  = ((length+1)*(length+2))/2;
-  iindx = get_iindx(length);
-  array = (unsigned int *) space(sizeof(unsigned int)*size);    /* matrix containing number of basepairs of reference structure1 in interval [i,j] */;
-  for (k=0; k<=turn; k++)
-    for (i=1; i<=length-k; i++) {
-      j=i+k;
-      ij = iindx[i]-j;
-      array[ij] = 0;
-    }
-
-  for (i = length-turn-1; i >= 1; i--)
-    for (j = i+turn+1; j <= length; j++){
-      int bps;
-      ij = iindx[i]-j;
-      bps = array[ij+1];
-      if((i<=(unsigned int)reference_pt[j]) && ((unsigned int)reference_pt[j] < j))
-        bps++;
-      array[ij] = bps;
-    }
-  free(iindx);
-  return array;
-}
-
-PUBLIC unsigned int *compute_BPdifferences(short *pt1, short *pt2, unsigned int turn){
-  unsigned int *array;
-  unsigned int n, size, i, j, ij, d;
-  n = (unsigned int)pt1[0];
-  size = ((n+1)*(n+2))/2;
-  array = (unsigned int *)space(sizeof(unsigned int) * size);
-  int *iindx = get_iindx(n);
-  for(i = n - turn - 1; i>=1; i--){
-    d = 0;
-    for(j = i+turn+1; j <= n; j++){
-      ij = iindx[i]-j;
-      d = array[ij+1];
-      if(pt1[j] != pt2[j]){
-        if(i <= (unsigned int)pt1[j] && (unsigned int)pt1[j] < j){
-          /* we got an additional base pair in reference structure 1 */
-          d++;
-        }
-        if(i <= (unsigned int)pt2[j] && (unsigned int)pt2[j] < j){
-          /* we got another base pair in reference structure 2 */
-          d++;
-        }
-      }
-      array[ij] = d;
-
-    }
-  }
-  free(iindx);
-  return array;
-}
diff --git a/changelog b/changelog
deleted file mode 100644
--- a/changelog
+++ /dev/null
@@ -1,23 +0,0 @@
-0.1.2.1
-
-- removed debug statements
-
-0.1.2.0
-
-- constrained cofold partition function added
-
-0.1.1.1
-
-- export everything in the bindings
-
-0.1.1.0
--------
-
-- breaking changes to PartFunc.chs
-- constrained partition function folding
-- includes should now all be local (that one was bad)
-
-0.1.0.0
--------
-
-- relevant cbits are now provided as part of the cabal package
diff --git a/changelog.md b/changelog.md
new file mode 100644
--- /dev/null
+++ b/changelog.md
@@ -0,0 +1,57 @@
+0.233.1.1
+---------
+
+- track ViennaRNA version numbers in 2nd component
+- bump to v 2.3.3
+
+0.1.6.0
+-------
+
+- partial bindings to ViennaRNA 2.2.5
+- tests/properties.hs
+
+0.1.5.0
+-------
+
+- added stack.yaml file
+
+0.1.4.0
+-------
+
+- added circular folding and partition function calculations
+- NOTE due to circular dependencies in fold / fold_vars we currently can not
+  cabal repl on ghc 7.8.{1,2,3}
+
+0.1.3.0
+-------
+
+- added duplexfold
+- added a bunch of c/h files due to duplexfold dependencies
+
+0.1.2.1
+-------
+
+- removed debug statements
+
+0.1.2.0
+-------
+
+- constrained cofold partition function added
+
+0.1.1.1
+-------
+
+- export everything in the bindings
+
+0.1.1.0
+-------
+
+- breaking changes to PartFunc.chs
+- constrained partition function folding
+- includes should now all be local (that one was bad)
+
+0.1.0.0
+-------
+
+- relevant cbits are now provided as part of the cabal package
+
diff --git a/include/1.8.4_epars.h b/include/1.8.4_epars.h
deleted file mode 100644
--- a/include/1.8.4_epars.h
+++ /dev/null
@@ -1,366 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_OLD_EPARS__
-#define __VIENNA_RNA_PACKAGE_OLD_EPARS__
-/**
-    \file 1.8.4_epars.h
-    \brief Free energy parameters for parameter file conversion
-
-    This file contains the free energy parameters used in ViennaRNAPackage 1.8.4.
-    They are summarized in:
-
-    D.H.Mathews, J. Sabina, M. ZUker, D.H. Turner
-    "Expanded sequence dependence of thermodynamic parameters improves
-    prediction of RNA secondary structure"
-    JMB, 288, pp 911-940, 1999
-
-    Enthalpies taken from:
-
-    A. Walter, D Turner, J Kim, M Lyttle, P M"uller, D Mathews, M Zuker
-    "Coaxial stckaing of helices enhances binding of oligoribonucleotides.."
-    PNAS, 91, pp 9218-9222, 1994
-
-    D.H. Turner, N. Sugimoto, and S.M. Freier.
-    "RNA Structure Prediction",
-    Ann. Rev. Biophys. Biophys. Chem. 17, 167-192, 1988.
-
-    John A.Jaeger, Douglas H.Turner, and Michael Zuker.
-    "Improved predictions of secondary structures for RNA",
-    PNAS, 86, 7706-7710, October 1989.
-
-    L. He, R. Kierzek, J. SantaLucia, A.E. Walter, D.H. Turner
-    "Nearest-Neughbor Parameters for GU Mismatches...."
-    Biochemistry 1991, 30 11124-11132
-
-    A.E. Peritz, R. Kierzek, N, Sugimoto, D.H. Turner
-    "Thermodynamic Study of Internal Loops in Oligoribonucleotides..."
-    Biochemistry 1991, 30, 6428--6435
-*/
-
-#define K0        273.15
-#ifdef INF
-#undef INF
-#endif
-#define INF       1000000
-#define NBPAIRS   7
-#define NST       0     /* Energy for nonstandard stacked pairs */
-#define DEF       -50   /* Default terminal mismatch, used for I */
-                        /* and any non_pairing bases */
-#define NSM       0     /* terminal mismatch for non standard pairs */
-
-PRIVATE double Tmeasure_184 = 37 + K0;  /* temperature of param measurements */
-PRIVATE double lxc37_184    = 107.856;  /* parameter for logarithmic loop
-                                           energy extrapolation */
-
-PRIVATE int stack37_184[NBPAIRS+1][NBPAIRS+1] =
-/*          CG     GC     GU     UG     AU     UA  */
-{ {  INF,   INF,   INF,   INF,   INF,   INF,   INF, INF},
-  {  INF,  -240,  -330,  -210,  -140,  -210,  -210, NST},
-  {  INF,  -330,  -340,  -250,  -150,  -220,  -240, NST},
-  {  INF,  -210,  -250,   130,   -50,  -140,  -130, NST},
-  {  INF,  -140,  -150,   -50,    30,   -60,  -100, NST},
-  {  INF,  -210,  -220,  -140,   -60,  -110,   -90, NST},
-  {  INF,  -210,  -240,  -130,  -100,   -90,  -130, NST},
-  {  INF,   NST,   NST,   NST,   NST,   NST,   NST, NST}};
-
-/* enthalpies (0.01*kcal/mol at 37 C) for stacked pairs */
-/* different from mfold-2.3, which uses values from mfold-2.2 */
-PRIVATE int enthalpies_184[NBPAIRS+1][NBPAIRS+1] =
-/*          CG     GC     GU     UG     AU     UA  */
-{ {  INF,   INF,   INF,   INF,   INF,   INF,   INF, INF},
-  {  INF, -1060, -1340, -1210,  -560, -1050, -1040, NST},
-  {  INF, -1340, -1490, -1260,  -830, -1140, -1240, NST},
-  {  INF, -1210, -1260, -1460, -1350,  -880, -1280, NST},
-  {  INF,  -560,  -830, -1350,  -930,  -320,  -700, NST},
-  {  INF, -1050, -1140,  -880,  -320,  -940,  -680, NST},
-  {  INF, -1040, -1240, -1280,  -700,  -680,  -770, NST},
-  {  INF,   NST,   NST,   NST,   NST,   NST,   NST, NST}};
-
-
-/* old values are here just for comparison */
-PRIVATE int oldhairpin37_184[31] = { /* from ViennaRNA 1.3 */
-  INF, INF, INF, 410, 490, 440, 470, 500, 510, 520, 531,
-       542, 551, 560, 568, 575, 582, 589, 595, 601, 606,
-       611, 616, 621, 626, 630, 634, 638, 642, 646, 650};
-
-PRIVATE int hairpin37_184[31] = {
-  INF, INF, INF, 570, 560, 560, 540, 590, 560, 640, 650,
-       660, 670, 678, 686, 694, 701, 707, 713, 719, 725,
-       730, 735, 740, 744, 749, 753, 757, 761, 765, 769};
-
-PRIVATE int oldbulge37_184[31] = {
-  INF, 390, 310, 350, 420, 480, 500, 516, 531, 543, 555,
-       565, 574, 583, 591, 598, 605, 612, 618, 624, 630,
-       635, 640, 645, 649, 654, 658, 662, 666, 670, 673};
-
-PRIVATE int bulge37_184[31] = {
-  INF, 380, 280, 320, 360, 400, 440, 459, 470, 480, 490,
-       500, 510, 519, 527, 534, 541, 548, 554, 560, 565,
-  571, 576, 580, 585, 589, 594, 598, 602, 605, 609};
-
-PRIVATE int oldinternal_loop37_184[31] = {
-  INF, INF, 410, 510, 490, 530, 570, 587, 601, 614, 625,
-       635, 645, 653, 661, 669, 676, 682, 688, 694, 700,
-       705, 710, 715, 720, 724, 728, 732, 736, 740, 744};
-
-PRIVATE int internal_loop37_184[31] = {
-  INF, INF, 410, 510, 170, 180, 200, 220, 230, 240, 250,
-       260, 270, 278, 286, 294, 301, 307, 313, 319, 325,
-       330, 335, 340, 345, 349, 353, 357, 361, 365, 369};
-
-/* terminal mismatches */
-/* mismatch free energies for interior loops at 37C */
-PRIVATE int mismatchI37_184[NBPAIRS+1][5][5] =
-{ /* @@ */
-  {{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}},
-  { /* CG */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   {   0,    0,    0, -110,    0}, /* A@  AA  AC  AG  AU */
-   {   0,    0,    0,    0,    0}, /* C@  CA  CC  CG  CU */
-   {   0, -110,    0,    0,    0}, /* G@  GA  GC  GG  GU */
-   {   0,    0,    0,    0,  -70}},/* U@  UA  UC  UG  UU */
-  { /* GC */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   {   0,    0,    0, -110,    0}, /* A@  AA  AC  AG  AU */
-   {   0,    0,    0,    0,    0}, /* C@  CA  CC  CG  CU */
-   {   0, -110,    0,    0,    0}, /* G@  GA  GC  GG  GU */
-   {   0,    0,    0,    0,  -70}},/* U@  UA  UC  UG  UU */
-  { /* GU */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   {   0,   70,   70,  -40,   70}, /* A@  AA  AC  AG  AU */
-   {   0,   70,   70,   70,   70}, /* C@  CA  CC  CG  CU */
-   {   0,  -40,   70,   70,   70}, /* G@  GA  GC  GG  GU */
-   {   0,   70,   70,   70,    0}},/* U@  UA  UC  UG  UU */
-  { /* UG */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   {   0,   70,   70,  -40,   70}, /* A@  AA  AC  AG  AU */
-   {   0,   70,   70,   70,   70}, /* C@  CA  CC  CG  CU */
-   {   0,  -40,   70,   70,   70}, /* G@  GA  GC  GG  GU */
-   {   0,   70,   70,   70,    0}},/* U@  UA  UC  UG  UU */
-  { /* AU */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   {   0,   70,   70,  -40,   70}, /* A@  AA  AC  AG  AU */
-   {   0,   70,   70,   70,   70}, /* C@  CA  CC  CG  CU */
-   {   0,  -40,   70,   70,   70}, /* G@  GA  GC  GG  GU */
-   {   0,   70,   70,   70,    0}},/* U@  UA  UC  UG  UU */
-  { /* UA */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   {   0,   70,   70,  -40,   70}, /* A@  AA  AC  AG  AU */
-   {   0,   70,   70,   70,   70}, /* C@  CA  CC  CG  CU */
-   {   0,  -40,   70,   70,   70}, /* G@  GA  GC  GG  GU */
-   {   0,   70,   70,   70,    0}},/* U@  UA  UC  UG  UU */
-  { /* @@ */
-   { 90, 90, 90, 90, 90},{ 90, 90, 90, 90,-20},{ 90, 90, 90, 90, 90},
-   { 90,-20, 90, 90, 90},{ 90, 90, 90, 90, 20}}
-};
-
-/* mismatch free energies for hairpins at 37C */
-PRIVATE int mismatchH37_184[NBPAIRS+1][5][5] =
-{ /* @@ */
-  {{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}},
-  { /* CG */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   { -90, -150, -150, -140, -180}, /* A@  AA  AC  AG  AU */
-   { -90, -100,  -90, -290,  -80}, /* C@  CA  CC  CG  CU */
-   { -90, -220, -200, -160, -110}, /* G@  GA  GC  GG  GU */
-   { -90, -170, -140, -180, -200}},/* U@  UA  UC  UG  UU */
-  { /* GC */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   { -70, -110, -150, -130, -210}, /* A@  AA  AC  AG  AU */
-   { -70, -110,  -70, -240,  -50}, /* C@  CA  CC  CG  CU */
-   { -70, -240, -290, -140, -120}, /* G@  GA  GC  GG  GU */
-   { -70, -190, -100, -220, -150}},/* U@  UA  UC  UG  UU */
-  { /* GU */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   {   0,   20,  -50,  -30,  -30}, /* A@  AA  AC  AG  AU */
-   {   0,  -10,  -20, -150,  -20}, /* C@  CA  CC  CG  CU */
-   {   0,  -90, -110,  -30,    0}, /* G@  GA  GC  GG  GU */
-   {   0,  -30,  -30,  -40, -110}},/* U@  UA  UC  UG  UU */
-  { /* UG */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   {   0,  -50,  -30,  -60,  -50}, /* A@  AA  AC  AG  AU */
-   {   0,  -20,  -10, -170,    0}, /* C@  CA  CC  CG  CU */
-   {   0,  -80, -120,  -30,  -70}, /* G@  GA  GC  GG  GU */
-   {   0,  -60,  -10,  -60,  -80}},/* U@  UA  UC  UG  UU */
-  { /* AU */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   {   0,  -30,  -50,  -30,  -30}, /* A@  AA  AC  AG  AU */
-   {   0,  -10,  -20, -150,  -20}, /* C@  CA  CC  CG  CU */
-   {   0, -110, -120,  -20,   20}, /* G@  GA  GC  GG  GU */
-   {   0,  -30,  -30,  -60, -110}},/* U@  UA  UC  UG  UU */
-  { /* UA */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   {   0,  -50,  -30,  -60,  -50}, /* A@  AA  AC  AG  AU */
-   {   0,  -20,  -10, -120,   -0}, /* C@  CA  CC  CG  CU */
-   {   0, -140, -120,  -70,  -20}, /* G@  GA  GC  GG  GU */
-   {   0,  -30,  -10,  -50,  -80}},/* U@  UA  UC  UG  UU */
-  { /* @@ */
-   {  0,  0,  0,  0,  0},{  0,  0,  0,  0,  0},{  0,  0,  0,  0,  0},
-   {  0,  0,  0,  0,  0},{  0,  0,  0,  0,  0}}
-};
-
-/* mismatch energies in multiloops */
-PRIVATE int mismatchM37_184[NBPAIRS+1][5][5];
-
-/* these are probably junk */
-/* mismatch enthalpies for temperature scaling */
-PRIVATE int mism_H_184[NBPAIRS+1][5][5] =
-{ /* no pair */
-  {{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0},{0,0,0,0,0}},
-  { /* CG */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   { DEF,-1030, -950,-1030,-1030}, /* A@  AA  AC  AG  AU */
-   { DEF, -520, -450, -520, -670}, /* C@  CA  CC  CG  CU */
-   { DEF, -940, -940, -940, -940}, /* G@  GA  GC  GG  GU */
-   { DEF, -810, -740, -810, -860}},/* U@  UA  UC  UG  UU */
-  { /* GC */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   { DEF, -520, -880, -560, -880}, /* A@  AA  AC  AG  AU */
-   { DEF, -720, -310, -310, -390}, /* C@  CA  CC  CG  CU */
-   { DEF, -710, -740, -620, -740}, /* G@  GA  GC  GG  GU */
-   { DEF, -500, -500, -500, -570}},/* U@  UA  UC  UG  UU */
-  { /* GU */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   { DEF, -430, -600, -600, -600}, /* A@  AA  AC  AG  AU */
-   { DEF, -260, -240, -240, -240}, /* C@  CA  CC  CG  CU */
-   { DEF, -340, -690, -690, -690}, /* G@  GA  GC  GG  GU */
-   { DEF, -330, -330, -330, -330}},/* U@  UA  UC  UG  UU */
-  { /* UG */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   { DEF, -720, -790, -960, -810}, /* A@  AA  AC  AG  AU */
-   { DEF, -480, -480, -360, -480}, /* C@  CA  CC  CG  CU */
-   { DEF, -660, -810, -920, -810}, /* G@  GA  GC  GG  GU */
-   { DEF, -550, -440, -550, -360}},/* U@  UA  UC  UG  UU */
-  { /* AU */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   { DEF, -430, -600, -600, -600}, /* A@  AA  AC  AG  AU */
-   { DEF, -260, -240, -240, -240}, /* C@  CA  CC  CG  CU */
-   { DEF, -340, -690, -690, -690}, /* G@  GA  GC  GG  GU */
-   { DEF, -330, -330, -330, -330}},/* U@  UA  UC  UG  UU */
-  { /* UA */
-   {   0,    0,    0,    0,    0}, /* @@  @A  @C  @G  @U */
-   { DEF, -400, -630, -890, -590}, /* A@  AA  AC  AG  AU */
-   { DEF, -430, -510, -200, -180}, /* C@  CA  CC  CG  CU */
-   { DEF, -380, -680, -890, -680}, /* G@  GA  GC  GG  GU */
-   { DEF, -280, -140, -280, -140}},/* U@  UA  UC  UG  UU */
-  { /* nonstandard pair */
-   {DEF,DEF,DEF,DEF,DEF},{DEF,DEF,DEF,DEF,DEF},{DEF,DEF,DEF,DEF,DEF},
-   {DEF,DEF,DEF,DEF,DEF},{DEF,DEF,DEF,DEF,DEF}}
-};
-
-/* 5' dangling ends (unpaird base stacks on first paired base) */
-PRIVATE int dangle5_37_184[NBPAIRS+1][5]=
-{/*   @     A     C     G     U   */
-   { INF,  INF,  INF,  INF,  INF}, /* no pair */
-   { INF,  -50,  -30,  -20,  -10}, /* CG  (stacks on C) */
-   { INF,  -20,  -30,   -0,   -0}, /* GC  (stacks on G) */
-   { INF,  -30,  -30,  -40,  -20}, /* GU */
-   { INF,  -30,  -10,  -20,  -20}, /* UG */
-   { INF,  -30,  -30,  -40,  -20}, /* AU */
-   { INF,  -30,  -10,  -20,  -20}, /* UA */
-   {   0,    0,     0,    0,   0}  /*  @ */
-};
-
-/* 3' dangling ends (unpaired base stacks on second paired base */
-PRIVATE int dangle3_37_184[NBPAIRS+1][5]=
-{/*   @     A     C     G     U   */
-   { INF,  INF,  INF,  INF,  INF},  /* no pair */
-   { INF, -110,  -40, -130,  -60},  /* CG  (stacks on G) */
-   { INF, -170,  -80, -170, -120},  /* GC */
-   { INF,  -70,  -10,  -70,  -10},  /* GU */
-   { INF,  -80,  -50,  -80,  -60},  /* UG */
-   { INF,  -70,  -10,  -70,  -10},  /* AU */
-   { INF,  -80,  -50,  -80,  -60},  /* UA */
-   {   0,    0,     0,    0,   0}   /*  @ */
-};
-
-/* enthalpies for temperature scaling */
-PRIVATE int dangle3_H_184[NBPAIRS+1][5] =
-{/*   @     A     C     G     U   */
-   { INF,  INF,  INF,  INF,  INF},  /* no pair */
-   {   0, -740, -280, -640, -360},
-   {   0, -900, -410, -860, -750},
-   {   0, -740, -240, -720, -490},
-   {   0, -490,  -90, -550, -230},
-   {   0, -570,  -70, -580, -220},
-   {   0, -490,  -90, -550, -230},
-   {   0,    0,    0,    0,   0}
-};
-
-PRIVATE int dangle5_H_184[NBPAIRS+1][5] =
-{/*   @     A     C     G     U   */
-   { INF,  INF,  INF,  INF,  INF},  /* no pair */
-   {   0, -240,  330,   80, -140},
-   {   0, -160,   70, -460,  -40},
-   {   0,  160,  220,   70,  310},
-   {   0, -150,  510,   10,  100},
-   {   0,  160,  220,   70,  310},
-   {   0,  -50,  690,  -60,  -60},
-   {   0,    0,    0,    0,   0}
-};
-
-
-/* constants for linearly destabilizing contributions for multi-loops
-   F = ML_closing + ML_intern*k + ML_BASE*u  */
-/* old versions erroneously used ML_intern*(k-1) */
-PRIVATE int ML_BASE37_184 = 0;
-PRIVATE int ML_closing37_184 = 340;
-PRIVATE int ML_intern37_184 =  40;
-
-/* Ninio-correction for asymmetric internal loops with branches n1 and n2 */
-/*    ninio_energy = min{max_ninio, |n1-n2|*F_ninio[min{4.0, n1, n2}] } */
-PRIVATE int MAX_NINIO_184 = 300;                   /* maximum correction */
-PRIVATE int F_ninio37_184[5] = { 0, 40, 50, 20, 10 };      /* only F[2] used */
-
-/* stabilizing contribution due to special hairpins of size 4 (tetraloops) */
-
-PRIVATE char Tetraloops_184[1400] =  /* place for up to 200 tetra loops */
-  "GGGGAC "
-  "GGUGAC "
-  "CGAAAG "
-  "GGAGAC "
-  "CGCAAG "
-  "GGAAAC "
-  "CGGAAG "
-  "CUUCGG "
-  "CGUGAG "
-  "CGAAGG "
-  "CUACGG "
-  "GGCAAC "
-  "CGCGAG "
-  "UGAGAG "
-  "CGAGAG "
-  "AGAAAU "
-  "CGUAAG "
-  "CUAACG "
-  "UGAAAG "
-  "GGAAGC "
-  "GGGAAC "
-  "UGAAAA "
-  "AGCAAU "
-  "AGUAAU "
-  "CGGGAG "
-  "AGUGAU "
-  "GGCGAC "
-  "GGGAGC "
-  "GUGAAC "
-  "UGGAAA "
-;
-
-PRIVATE int   TETRA_ENERGY37_184[200] = {
-  -300, -300, -300, -300, -300, -300, -300, -300, -300, -250, -250, -250,
-  -250, -250, -200, -200, -200, -200, -200, -150, -150, -150, -150, -150,
-  -150, -150, -150, -150, -150, -150};
-
-PRIVATE int   TETRA_ENTH37_184   = -400;
-
-PRIVATE char Triloops_184[241] = "";
-
-PRIVATE int Triloop_E37_184[40];
-
-/* penalty for AU (or GU) terminating helix) */
-/* mismatches already contain these */
-PRIVATE int TerminalAU_184 = 50;
-
-/* penalty for forming a bi-molecular duplex */
-PRIVATE int DuplexInit_184 = 410;
-
-#endif
diff --git a/include/1.8.4_intloops.h b/include/1.8.4_intloops.h
deleted file mode 100644
--- a/include/1.8.4_intloops.h
+++ /dev/null
@@ -1,11073 +0,0 @@
-/**
-*** \file 1.8.4_intloops.h
-*** \brief Free energy parameters for interior loop contributions needed by the parameter file conversion functions
-**/
-PRIVATE int int11_37_184[NBPAIRS+1][NBPAIRS+1][5][5] =
-{ /* noPair */ {{{0}}},
-{ /* noPair */ {{0}},
-/* CG..CG */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110,  40,  40,  40},
-{ 110,  40,  40,  40,  40},
-{ 110,  40,  40, -140,  40},
-{ 110,  40,  40,  40,  40}
-},
-/* CG..GC */
-{{ 110, 110, 110, 110, 110},
-{ 110,  40, -40,  40,  40},
-{ 110,  30,  50,  40,  50},
-{ 110, -10,  40, -170,  40},
-{ 110,  40,   0,  40, -30}
-},
-/* CG..GU */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* CG..UG */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* CG..AU */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* CG..UA */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* CG..?? */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110}
-}
-},
-{ /* noPair */ {{0}},
-/* GC..CG */
-{{ 110, 110, 110, 110, 110},
-{ 110,  40,  30, -10,  40},
-{ 110, -40,  50,  40,   0},
-{ 110,  40,  40, -170,  40},
-{ 110,  40,  50,  40, -30}
-},
-/* GC..GC */
-{{ 110, 110, 110, 110, 110},
-{ 110,  80,  40,  40,  40},
-{ 110,  40,  40,  40,  40},
-{ 110,  40,  40, -210,  40},
-{ 110,  40,  40,  40, -70}
-},
-/* GC..GU */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* GC..UG */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* GC..AU */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 100}
-},
-/* GC..UA */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* GC..?? */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110}
-}
-},
-{ /* noPair */ {{0}},
-/* GU..CG */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* GU..GC */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* GU..GU */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* GU..UG */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* GU..AU */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* GU..UA */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* GU..?? */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170}
-}
-},
-{ /* noPair */ {{0}},
-/* UG..CG */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* UG..GC */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* UG..GU */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* UG..UG */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* UG..AU */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* UG..UA */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* UG..?? */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170}
-}
-},
-{ /* noPair */ {{0}},
-/* AU..CG */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* AU..GC */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 100}
-},
-/* AU..GU */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* AU..UG */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* AU..AU */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 120}
-},
-/* AU..UA */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 150}
-},
-/* AU..?? */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170}
-}
-},
-{ /* noPair */ {{0}},
-/* UA..CG */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* UA..GC */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, -100, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* UA..GU */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* UA..UG */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* UA..AU */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 150}
-},
-/* UA..UA */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, -40, 170},
-{ 170, 170, 170, 170, 180}
-},
-/* UA..?? */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170}
-}
-},
-{ /* noPair */ {{0}},
-/* ??..CG */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* ??..GC */
-{{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110},
-{ 110, 110, 110, 110, 110}
-},
-/* ??..GU */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* ??..UG */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* ??..AU */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* ??..UA */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170}
-},
-/* ??..?? */
-{{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170},
-{ 170, 170, 170, 170, 170}
-}
-}
-};
-
-PRIVATE int int11_H_184[NBPAIRS+1][NBPAIRS+1][5][5] =
- /* GC..GC */
-{ /* noPair */ {{{0}}},
-{ /* noPair */ {{0}},
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GC..CG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GC..GU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GC..UG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GC..AU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GC..UA */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GC.. @ */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}}},
- /* CG..GC */
-{ /* noPair */ {{0}},
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* CG..CG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* CG..GU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* CG..UG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* CG..AU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* CG..UA */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* CG.. @ */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}}},
- /* GU..GC */
-{ /* noPair */ {{0}},
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GU..CG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GU..GU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GU..UG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GU..AU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GU..UA */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* GU.. @ */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}}},
- /* UG..GC */
-{ /* noPair */ {{0}},
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UG..CG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UG..GU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UG..UG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UG..AU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UG..UA */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UG.. @ */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}}},
- /* AU..GC */
-{ /* noPair */ {{0}},
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* AU..CG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* AU..GU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* AU..UG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* AU..AU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* AU..UA */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* AU.. @ */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}}},
- /* UA..GC */
-{ /* noPair */ {{0}},
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UA..CG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UA..GU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UA..UG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UA..AU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UA..UA */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /* UA.. @ */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}}},
- /*  @..GC */
-{ /* noPair */ {{0}},
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /*  @..CG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /*  @..GU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /*  @..UG */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /*  @..AU */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /*  @..UA */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}},
- /*  @.. @ */
-{ {  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0},
-{  0, 0, 0, 0, 0}}}};
-
-PRIVATE int int21_37_184[NBPAIRS+1][NBPAIRS+1][5][5][5] =
-{ /* noPair */ {{{{0}}}},
-{ /* noPair */ {{{0}}},
-{
-/* CG.@..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* CG.A..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 240, 220, 160, 400},{ 550, 210, 170, 160, 400},{ 550, 100,  60,  40, 400},{ 550, 400, 400, 400, 400}},
-/* CG.C..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 230, 220, 400, 220},{ 550, 220, 250, 400, 220},{ 550, 400, 400, 400, 400},{ 550, 250, 190, 400, 220}},
-/* CG.G..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 170, 400,  80, 400},{ 550, 400, 400, 400, 400},{ 550,  80, 400, 220, 400},{ 550, 400, 400, 400, 400}},
-/* CG.U..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 400, 400, 400, 400},{ 550, 400, 220, 400, 130},{ 550, 400, 400, 400, 400},{ 550, 400, 170, 400, 120}}
-},
-{
-/* CG.@..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* CG.A..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 230, 220, 110, 400},{ 550, 210, 170, 160, 400},{ 550,  80,  60,  40, 400},{ 550, 400, 400, 400, 400}},
-/* CG.C..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 230, 220, 400, 220},{ 550, 220, 250, 400, 220},{ 550, 400, 400, 400, 400},{ 550, 250, 190, 400, 220}},
-/* CG.G..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 170, 400,  80, 400},{ 550, 400, 400, 400, 400},{ 550,  80, 400, 220, 400},{ 550, 400, 400, 400, 400}},
-/* CG.U..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 400, 400, 400, 400},{ 550, 400, 220, 400, 150},{ 550, 400, 400, 400, 400},{ 550, 400, 170, 400, 120}}
-},
-{
-/* CG.@..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* CG.A..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* CG.C..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* CG.G..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* CG.U..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* CG.@..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* CG.A..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* CG.C..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* CG.G..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* CG.U..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* CG.@..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* CG.A..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* CG.C..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* CG.G..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* CG.U..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* CG.@..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* CG.A..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* CG.C..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* CG.G..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* CG.U..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* CG.@..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* CG.A..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* CG.C..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* CG.G..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* CG.U..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/* GC.@..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GC.A..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 220, 210, 400},{ 550, 210, 170, 160, 400},{ 550, 120,  60,  40, 400},{ 550, 400, 400, 400, 400}},
-/* GC.C..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 230, 220, 400, 220},{ 550, 220, 250, 400, 220},{ 550, 400, 400, 400, 400},{ 550, 250, 190, 400, 220}},
-/* GC.G..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 170, 400,  80, 400},{ 550, 400, 400, 400, 400},{ 550,  80, 400, 220, 400},{ 550, 400, 400, 400, 400}},
-/* GC.U..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 400, 400, 400, 400},{ 550, 400, 220, 400, 120},{ 550, 400, 400, 400, 400},{ 550, 400, 170, 400, 120}}
-},
-{
-/* GC.@..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GC.A..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 240, 220, 160, 400},{ 550, 210, 170, 160, 400},{ 550, 100,  60,  40, 400},{ 550, 400, 400, 400, 400}},
-/* GC.C..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 230, 220, 400, 220},{ 550, 220, 250, 400, 220},{ 550, 400, 400, 400, 400},{ 550, 250, 190, 400, 220}},
-/* GC.G..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 170, 400,  80, 400},{ 550, 400, 400, 400, 400},{ 550,  80, 400, 220, 400},{ 550, 400, 400, 400, 400}},
-/* GC.U..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 400, 400, 400, 400},{ 550, 400, 220, 400, 130},{ 550, 400, 400, 400, 400},{ 550, 400, 170, 400, 120}}
-},
-{
-/* GC.@..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GC.A..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* GC.C..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* GC.G..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* GC.U..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* GC.@..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GC.A..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* GC.C..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* GC.G..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* GC.U..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* GC.@..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GC.A..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* GC.C..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* GC.G..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* GC.U..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* GC.@..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GC.A..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* GC.C..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* GC.G..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* GC.U..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* GC.@..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GC.A..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GC.C..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GC.G..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GC.U..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/* GU.@..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GU.A..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* GU.C..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* GU.G..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* GU.U..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* GU.@..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GU.A..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* GU.C..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* GU.G..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* GU.U..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* GU.@..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GU.A..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* GU.C..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* GU.G..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* GU.U..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* GU.@..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GU.A..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* GU.C..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* GU.G..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* GU.U..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* GU.@..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GU.A..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* GU.C..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* GU.G..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* GU.U..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* GU.@..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GU.A..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* GU.C..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* GU.G..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* GU.U..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* GU.@..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GU.A..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GU.C..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GU.G..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* GU.U..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/* UG.@..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UG.A..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* UG.C..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* UG.G..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* UG.U..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* UG.@..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UG.A..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* UG.C..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* UG.G..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* UG.U..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* UG.@..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UG.A..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* UG.C..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* UG.G..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* UG.U..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* UG.@..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UG.A..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* UG.C..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* UG.G..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* UG.U..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* UG.@..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UG.A..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* UG.C..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* UG.G..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* UG.U..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* UG.@..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UG.A..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* UG.C..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* UG.G..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* UG.U..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* UG.@..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UG.A..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UG.C..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UG.G..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UG.U..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/* AU.@..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* AU.A..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* AU.C..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* AU.G..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* AU.U..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* AU.@..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* AU.A..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* AU.C..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* AU.G..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* AU.U..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* AU.@..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* AU.A..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* AU.C..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* AU.G..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* AU.U..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* AU.@..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* AU.A..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* AU.C..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* AU.G..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* AU.U..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* AU.@..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* AU.A..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* AU.C..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* AU.G..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* AU.U..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* AU.@..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* AU.A..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* AU.C..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* AU.G..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* AU.U..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* AU.@..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* AU.A..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* AU.C..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* AU.G..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* AU.U..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/* UA.@..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UA.A..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* UA.C..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* UA.G..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* UA.U..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* UA.@..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UA.A..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 300, 240, 480},{ 550, 290, 250, 240, 480},{ 550, 180, 140, 120, 480},{ 550, 480, 480, 480, 480}},
-/* UA.C..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 310, 300, 480, 300},{ 550, 300, 330, 480, 300},{ 550, 480, 480, 480, 480},{ 550, 330, 270, 480, 300}},
-/* UA.G..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 250, 480, 160, 480},{ 550, 480, 480, 480, 480},{ 550, 160, 480, 300, 480},{ 550, 480, 480, 480, 480}},
-/* UA.U..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 480, 480, 480, 480},{ 550, 480, 300, 480, 210},{ 550, 480, 480, 480, 480},{ 550, 480, 250, 480, 200}}
-},
-{
-/* UA.@..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UA.A..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* UA.C..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* UA.G..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* UA.U..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* UA.@..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UA.A..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* UA.C..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* UA.G..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* UA.U..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* UA.@..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UA.A..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* UA.C..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* UA.G..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* UA.U..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* UA.@..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UA.A..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 390, 370, 310, 550},{ 550, 360, 320, 310, 550},{ 550, 250, 210, 190, 550},{ 550, 550, 550, 550, 550}},
-/* UA.C..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 380, 370, 550, 370},{ 550, 370, 400, 550, 370},{ 550, 550, 550, 550, 550},{ 550, 400, 340, 550, 370}},
-/* UA.G..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 320, 550, 230, 550},{ 550, 550, 550, 550, 550},{ 550, 230, 550, 370, 550},{ 550, 550, 550, 550, 550}},
-/* UA.U..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 370, 550, 280},{ 550, 550, 550, 550, 550},{ 550, 550, 320, 550, 270}}
-},
-{
-/* UA.@..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UA.A..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UA.C..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UA.G..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* UA.U..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/* ??.@..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.A..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.C..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.G..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.U..GC */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-},
-{
-/* ??.@..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.A..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.C..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.G..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.U..CG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-},
-{
-/* ??.@..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.A..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.C..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.G..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.U..UG */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-},
-{
-/* ??.@..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.A..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.C..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.G..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.U..GU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-},
-{
-/* ??.@..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.A..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.C..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.G..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.U..UA */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-},
-{
-/* ??.@..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.A..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.C..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.G..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.U..AU */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-},
-{
-/* ??.@..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.A..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.C..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.G..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}},
-/* ??.U..?? */
-{{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550},{ 550, 550, 550, 550, 550}}
-}
-}
-};
-
-PRIVATE int int21_H_184[NBPAIRS+1][NBPAIRS+1][5][5][5] =
-{ /* noPair */ {{{{0}}}},
-{ /* noPair */ {{{0}}},
-{
-/* CG.@..CG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.A..CG */
-{{  DEF,-1029, -949,-1029,-1029},{-1079,-2058,-1978,-2058,-2058},{ -569,-1548,-1468,-1548,-1548},{ -989,-1968,-1888,-1968,-1968},{ -859,-1838,-1758,-1838,-1838}},
-/* CG.C..CG */
-{{  DEF, -519, -449, -519, -669},{ -999,-1468,-1398,-1468,-1618},{ -499, -968, -898, -968,-1118},{ -989,-1458,-1388,-1458,-1608},{ -789,-1258,-1188,-1258,-1408}},
-/* CG.G..CG */
-{{  DEF, -939, -939, -939, -939},{-1079,-1968,-1968,-1968,-1968},{ -569,-1458,-1458,-1458,-1458},{ -989,-1878,-1878,-1878,-1878},{ -859,-1748,-1748,-1748,-1748}},
-/* CG.U..CG */
-{{  DEF, -809, -739, -809, -859},{-1079,-1838,-1768,-1838,-1888},{ -719,-1478,-1408,-1478,-1528},{ -989,-1748,-1678,-1748,-1798},{ -909,-1668,-1598,-1668,-1718}}
-},
-{
-/* CG.@..GC */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.A..GC */
-{{  DEF,-1029, -949,-1029,-1029},{ -569,-1548,-1468,-1548,-1548},{ -769,-1748,-1668,-1748,-1748},{ -759,-1738,-1658,-1738,-1738},{ -549,-1528,-1448,-1528,-1528}},
-/* CG.C..GC */
-{{  DEF, -519, -449, -519, -669},{ -929,-1398,-1328,-1398,-1548},{ -359, -828, -758, -828, -978},{ -789,-1258,-1188,-1258,-1408},{ -549,-1018, -948,-1018,-1168}},
-/* CG.G..GC */
-{{  DEF, -939, -939, -939, -939},{ -609,-1498,-1498,-1498,-1498},{ -359,-1248,-1248,-1248,-1248},{ -669,-1558,-1558,-1558,-1558},{ -549,-1438,-1438,-1438,-1438}},
-/* CG.U..GC */
-{{  DEF, -809, -739, -809, -859},{ -929,-1688,-1618,-1688,-1738},{ -439,-1198,-1128,-1198,-1248},{ -789,-1548,-1478,-1548,-1598},{ -619,-1378,-1308,-1378,-1428}}
-},
-{
-/* CG.@..GU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.A..GU */
-{{  DEF,-1029, -949,-1029,-1029},{ -479,-1458,-1378,-1458,-1458},{ -309,-1288,-1208,-1288,-1288},{ -389,-1368,-1288,-1368,-1368},{ -379,-1358,-1278,-1358,-1358}},
-/* CG.C..GU */
-{{  DEF, -519, -449, -519, -669},{ -649,-1118,-1048,-1118,-1268},{ -289, -758, -688, -758, -908},{ -739,-1208,-1138,-1208,-1358},{ -379, -848, -778, -848, -998}},
-/* CG.G..GU */
-{{  DEF, -939, -939, -939, -939},{ -649,-1538,-1538,-1538,-1538},{ -289,-1178,-1178,-1178,-1178},{ -739,-1628,-1628,-1628,-1628},{ -379,-1268,-1268,-1268,-1268}},
-/* CG.U..GU */
-{{  DEF, -809, -739, -809, -859},{ -649,-1408,-1338,-1408,-1458},{ -289,-1048, -978,-1048,-1098},{ -739,-1498,-1428,-1498,-1548},{ -379,-1138,-1068,-1138,-1188}}
-},
-{
-/* CG.@..UG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.A..UG */
-{{  DEF,-1029, -949,-1029,-1029},{ -769,-1748,-1668,-1748,-1748},{ -529,-1508,-1428,-1508,-1508},{ -709,-1688,-1608,-1688,-1688},{ -599,-1578,-1498,-1578,-1578}},
-/* CG.C..UG */
-{{  DEF, -519, -449, -519, -669},{ -839,-1308,-1238,-1308,-1458},{ -529, -998, -928, -998,-1148},{ -859,-1328,-1258,-1328,-1478},{ -489, -958, -888, -958,-1108}},
-/* CG.G..UG */
-{{  DEF, -939, -939, -939, -939},{-1009,-1898,-1898,-1898,-1898},{ -409,-1298,-1298,-1298,-1298},{ -969,-1858,-1858,-1858,-1858},{ -599,-1488,-1488,-1488,-1488}},
-/* CG.U..UG */
-{{  DEF, -809, -739, -809, -859},{ -859,-1618,-1548,-1618,-1668},{ -529,-1288,-1218,-1288,-1338},{ -859,-1618,-1548,-1618,-1668},{ -409,-1168,-1098,-1168,-1218}}
-},
-{
-/* CG.@..AU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.A..AU */
-{{  DEF,-1029, -949,-1029,-1029},{ -479,-1458,-1378,-1458,-1458},{ -309,-1288,-1208,-1288,-1288},{ -389,-1368,-1288,-1368,-1368},{ -379,-1358,-1278,-1358,-1358}},
-/* CG.C..AU */
-{{  DEF, -519, -449, -519, -669},{ -649,-1118,-1048,-1118,-1268},{ -289, -758, -688, -758, -908},{ -739,-1208,-1138,-1208,-1358},{ -379, -848, -778, -848, -998}},
-/* CG.G..AU */
-{{  DEF, -939, -939, -939, -939},{ -649,-1538,-1538,-1538,-1538},{ -289,-1178,-1178,-1178,-1178},{ -739,-1628,-1628,-1628,-1628},{ -379,-1268,-1268,-1268,-1268}},
-/* CG.U..AU */
-{{  DEF, -809, -739, -809, -859},{ -649,-1408,-1338,-1408,-1458},{ -289,-1048, -978,-1048,-1098},{ -739,-1498,-1428,-1498,-1548},{ -379,-1138,-1068,-1138,-1188}}
-},
-{
-/* CG.@..UA */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.A..UA */
-{{  DEF,-1029, -949,-1029,-1029},{ -449,-1428,-1348,-1428,-1428},{ -479,-1458,-1378,-1458,-1458},{ -429,-1408,-1328,-1408,-1408},{ -329,-1308,-1228,-1308,-1308}},
-/* CG.C..UA */
-{{  DEF, -519, -449, -519, -669},{ -679,-1148,-1078,-1148,-1298},{ -559,-1028, -958,-1028,-1178},{ -729,-1198,-1128,-1198,-1348},{ -189, -658, -588, -658, -808}},
-/* CG.G..UA */
-{{  DEF, -939, -939, -939, -939},{ -939,-1828,-1828,-1828,-1828},{ -249,-1138,-1138,-1138,-1138},{ -939,-1828,-1828,-1828,-1828},{ -329,-1218,-1218,-1218,-1218}},
-/* CG.U..UA */
-{{  DEF, -809, -739, -809, -859},{ -639,-1398,-1328,-1398,-1448},{ -229, -988, -918, -988,-1038},{ -729,-1488,-1418,-1488,-1538},{ -190, -949, -879, -949, -999}}
-},
-{
-/* CG.@.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.A.. @ */
-{{ -100,-1079, -999,-1079,-1079},{ -100,-1079, -999,-1079,-1079},{ -100,-1079, -999,-1079,-1079},{ -100,-1079, -999,-1079,-1079},{ -100,-1079, -999,-1079,-1079}},
-/* CG.C.. @ */
-{{ -100, -569, -499, -569, -719},{ -100, -569, -499, -569, -719},{ -100, -569, -499, -569, -719},{ -100, -569, -499, -569, -719},{ -100, -569, -499, -569, -719}},
-/* CG.G.. @ */
-{{ -100, -989, -989, -989, -989},{ -100, -989, -989, -989, -989},{ -100, -989, -989, -989, -989},{ -100, -989, -989, -989, -989},{ -100, -989, -989, -989, -989}},
-/* CG.U.. @ */
-{{ -100, -859, -789, -859, -909},{ -100, -859, -789, -859, -909},{ -100, -859, -789, -859, -909},{ -100, -859, -789, -859, -909},{ -100, -859, -789, -859, -909}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/* GC.@..CG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.A..CG */
-{{  DEF, -519, -879, -559, -879},{-1079,-1548,-1908,-1588,-1908},{ -569,-1038,-1398,-1078,-1398},{ -989,-1458,-1818,-1498,-1818},{ -859,-1328,-1688,-1368,-1688}},
-/* GC.C..CG */
-{{  DEF, -719, -309, -309, -389},{ -999,-1668,-1258,-1258,-1338},{ -499,-1168, -758, -758, -838},{ -989,-1658,-1248,-1248,-1328},{ -789,-1458,-1048,-1048,-1128}},
-/* GC.G..CG */
-{{  DEF, -709, -739, -619, -739},{-1079,-1738,-1768,-1648,-1768},{ -569,-1228,-1258,-1138,-1258},{ -989,-1648,-1678,-1558,-1678},{ -859,-1518,-1548,-1428,-1548}},
-/* GC.U..CG */
-{{  DEF, -499, -499, -499, -569},{-1079,-1528,-1528,-1528,-1598},{ -719,-1168,-1168,-1168,-1238},{ -989,-1438,-1438,-1438,-1508},{ -909,-1358,-1358,-1358,-1428}}
-},
-{
-/* GC.@..GC */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.A..GC */
-{{  DEF, -519, -879, -559, -879},{ -569,-1038,-1398,-1078,-1398},{ -769,-1238,-1598,-1278,-1598},{ -759,-1228,-1588,-1268,-1588},{ -549,-1018,-1378,-1058,-1378}},
-/* GC.C..GC */
-{{  DEF, -719, -309, -309, -389},{ -929,-1598,-1188,-1188,-1268},{ -359,-1028, -618, -618, -698},{ -789,-1458,-1048,-1048,-1128},{ -549,-1218, -808, -808, -888}},
-/* GC.G..GC */
-{{  DEF, -709, -739, -619, -739},{ -609,-1268,-1298,-1178,-1298},{ -359,-1018,-1048, -928,-1048},{ -669,-1328,-1358,-1238,-1358},{ -549,-1208,-1238,-1118,-1238}},
-/* GC.U..GC */
-{{  DEF, -499, -499, -499, -569},{ -929,-1378,-1378,-1378,-1448},{ -439, -888, -888, -888, -958},{ -789,-1238,-1238,-1238,-1308},{ -619,-1068,-1068,-1068,-1138}}
-},
-{
-/* GC.@..GU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.A..GU */
-{{  DEF, -519, -879, -559, -879},{ -479, -948,-1308, -988,-1308},{ -309, -778,-1138, -818,-1138},{ -389, -858,-1218, -898,-1218},{ -379, -848,-1208, -888,-1208}},
-/* GC.C..GU */
-{{  DEF, -719, -309, -309, -389},{ -649,-1318, -908, -908, -988},{ -289, -958, -548, -548, -628},{ -739,-1408, -998, -998,-1078},{ -379,-1048, -638, -638, -718}},
-/* GC.G..GU */
-{{  DEF, -709, -739, -619, -739},{ -649,-1308,-1338,-1218,-1338},{ -289, -948, -978, -858, -978},{ -739,-1398,-1428,-1308,-1428},{ -379,-1038,-1068, -948,-1068}},
-/* GC.U..GU */
-{{  DEF, -499, -499, -499, -569},{ -649,-1098,-1098,-1098,-1168},{ -289, -738, -738, -738, -808},{ -739,-1188,-1188,-1188,-1258},{ -379, -828, -828, -828, -898}}
-},
-{
-/* GC.@..UG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.A..UG */
-{{  DEF, -519, -879, -559, -879},{ -769,-1238,-1598,-1278,-1598},{ -529, -998,-1358,-1038,-1358},{ -709,-1178,-1538,-1218,-1538},{ -599,-1068,-1428,-1108,-1428}},
-/* GC.C..UG */
-{{  DEF, -719, -309, -309, -389},{ -839,-1508,-1098,-1098,-1178},{ -529,-1198, -788, -788, -868},{ -859,-1528,-1118,-1118,-1198},{ -489,-1158, -748, -748, -828}},
-/* GC.G..UG */
-{{  DEF, -709, -739, -619, -739},{-1009,-1668,-1698,-1578,-1698},{ -409,-1068,-1098, -978,-1098},{ -969,-1628,-1658,-1538,-1658},{ -599,-1258,-1288,-1168,-1288}},
-/* GC.U..UG */
-{{  DEF, -499, -499, -499, -569},{ -859,-1308,-1308,-1308,-1378},{ -529, -978, -978, -978,-1048},{ -859,-1308,-1308,-1308,-1378},{ -409, -858, -858, -858, -928}}
-},
-{
-/* GC.@..AU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.A..AU */
-{{  DEF, -519, -879, -559, -879},{ -479, -948,-1308, -988,-1308},{ -309, -778,-1138, -818,-1138},{ -389, -858,-1218, -898,-1218},{ -379, -848,-1208, -888,-1208}},
-/* GC.C..AU */
-{{  DEF, -719, -309, -309, -389},{ -649,-1318, -908, -908, -988},{ -289, -958, -548, -548, -628},{ -739,-1408, -998, -998,-1078},{ -379,-1048, -638, -638, -718}},
-/* GC.G..AU */
-{{  DEF, -709, -739, -619, -739},{ -649,-1308,-1338,-1218,-1338},{ -289, -948, -978, -858, -978},{ -739,-1398,-1428,-1308,-1428},{ -379,-1038,-1068, -948,-1068}},
-/* GC.U..AU */
-{{  DEF, -499, -499, -499, -569},{ -649,-1098,-1098,-1098,-1168},{ -289, -738, -738, -738, -808},{ -739,-1188,-1188,-1188,-1258},{ -379, -828, -828, -828, -898}}
-},
-{
-/* GC.@..UA */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.A..UA */
-{{  DEF, -519, -879, -559, -879},{ -449, -918,-1278, -958,-1278},{ -479, -948,-1308, -988,-1308},{ -429, -898,-1258, -938,-1258},{ -329, -798,-1158, -838,-1158}},
-/* GC.C..UA */
-{{  DEF, -719, -309, -309, -389},{ -679,-1348, -938, -938,-1018},{ -559,-1228, -818, -818, -898},{ -729,-1398, -988, -988,-1068},{ -189, -858, -448, -448, -528}},
-/* GC.G..UA */
-{{  DEF, -709, -739, -619, -739},{ -939,-1598,-1628,-1508,-1628},{ -249, -908, -938, -818, -938},{ -939,-1598,-1628,-1508,-1628},{ -329, -988,-1018, -898,-1018}},
-/* GC.U..UA */
-{{  DEF, -499, -499, -499, -569},{ -639,-1088,-1088,-1088,-1158},{ -229, -678, -678, -678, -748},{ -729,-1178,-1178,-1178,-1248},{ -190, -639, -639, -639, -709}}
-},
-{
-/* GC.@.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.A.. @ */
-{{ -100, -569, -929, -609, -929},{ -100, -569, -929, -609, -929},{ -100, -569, -929, -609, -929},{ -100, -569, -929, -609, -929},{ -100, -569, -929, -609, -929}},
-/* GC.C.. @ */
-{{ -100, -769, -359, -359, -439},{ -100, -769, -359, -359, -439},{ -100, -769, -359, -359, -439},{ -100, -769, -359, -359, -439},{ -100, -769, -359, -359, -439}},
-/* GC.G.. @ */
-{{ -100, -759, -789, -669, -789},{ -100, -759, -789, -669, -789},{ -100, -759, -789, -669, -789},{ -100, -759, -789, -669, -789},{ -100, -759, -789, -669, -789}},
-/* GC.U.. @ */
-{{ -100, -549, -549, -549, -619},{ -100, -549, -549, -549, -619},{ -100, -549, -549, -549, -619},{ -100, -549, -549, -549, -619},{ -100, -549, -549, -549, -619}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/* GU.@..CG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.A..CG */
-{{  DEF, -429, -599, -599, -599},{-1079,-1458,-1628,-1628,-1628},{ -569, -948,-1118,-1118,-1118},{ -989,-1368,-1538,-1538,-1538},{ -859,-1238,-1408,-1408,-1408}},
-/* GU.C..CG */
-{{  DEF, -259, -239, -239, -239},{ -999,-1208,-1188,-1188,-1188},{ -499, -708, -688, -688, -688},{ -989,-1198,-1178,-1178,-1178},{ -789, -998, -978, -978, -978}},
-/* GU.G..CG */
-{{  DEF, -339, -689, -689, -689},{-1079,-1368,-1718,-1718,-1718},{ -569, -858,-1208,-1208,-1208},{ -989,-1278,-1628,-1628,-1628},{ -859,-1148,-1498,-1498,-1498}},
-/* GU.U..CG */
-{{  DEF, -329, -329, -329, -329},{-1079,-1358,-1358,-1358,-1358},{ -719, -998, -998, -998, -998},{ -989,-1268,-1268,-1268,-1268},{ -909,-1188,-1188,-1188,-1188}}
-},
-{
-/* GU.@..GC */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.A..GC */
-{{  DEF, -429, -599, -599, -599},{ -569, -948,-1118,-1118,-1118},{ -769,-1148,-1318,-1318,-1318},{ -759,-1138,-1308,-1308,-1308},{ -549, -928,-1098,-1098,-1098}},
-/* GU.C..GC */
-{{  DEF, -259, -239, -239, -239},{ -929,-1138,-1118,-1118,-1118},{ -359, -568, -548, -548, -548},{ -789, -998, -978, -978, -978},{ -549, -758, -738, -738, -738}},
-/* GU.G..GC */
-{{  DEF, -339, -689, -689, -689},{ -609, -898,-1248,-1248,-1248},{ -359, -648, -998, -998, -998},{ -669, -958,-1308,-1308,-1308},{ -549, -838,-1188,-1188,-1188}},
-/* GU.U..GC */
-{{  DEF, -329, -329, -329, -329},{ -929,-1208,-1208,-1208,-1208},{ -439, -718, -718, -718, -718},{ -789,-1068,-1068,-1068,-1068},{ -619, -898, -898, -898, -898}}
-},
-{
-/* GU.@..GU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.A..GU */
-{{  DEF, -429, -599, -599, -599},{ -479, -858,-1028,-1028,-1028},{ -309, -688, -858, -858, -858},{ -389, -768, -938, -938, -938},{ -379, -758, -928, -928, -928}},
-/* GU.C..GU */
-{{  DEF, -259, -239, -239, -239},{ -649, -858, -838, -838, -838},{ -289, -498, -478, -478, -478},{ -739, -948, -928, -928, -928},{ -379, -588, -568, -568, -568}},
-/* GU.G..GU */
-{{  DEF, -339, -689, -689, -689},{ -649, -938,-1288,-1288,-1288},{ -289, -578, -928, -928, -928},{ -739,-1028,-1378,-1378,-1378},{ -379, -668,-1018,-1018,-1018}},
-/* GU.U..GU */
-{{  DEF, -329, -329, -329, -329},{ -649, -928, -928, -928, -928},{ -289, -568, -568, -568, -568},{ -739,-1018,-1018,-1018,-1018},{ -379, -658, -658, -658, -658}}
-},
-{
-/* GU.@..UG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.A..UG */
-{{  DEF, -429, -599, -599, -599},{ -769,-1148,-1318,-1318,-1318},{ -529, -908,-1078,-1078,-1078},{ -709,-1088,-1258,-1258,-1258},{ -599, -978,-1148,-1148,-1148}},
-/* GU.C..UG */
-{{  DEF, -259, -239, -239, -239},{ -839,-1048,-1028,-1028,-1028},{ -529, -738, -718, -718, -718},{ -859,-1068,-1048,-1048,-1048},{ -489, -698, -678, -678, -678}},
-/* GU.G..UG */
-{{  DEF, -339, -689, -689, -689},{-1009,-1298,-1648,-1648,-1648},{ -409, -698,-1048,-1048,-1048},{ -969,-1258,-1608,-1608,-1608},{ -599, -888,-1238,-1238,-1238}},
-/* GU.U..UG */
-{{  DEF, -329, -329, -329, -329},{ -859,-1138,-1138,-1138,-1138},{ -529, -808, -808, -808, -808},{ -859,-1138,-1138,-1138,-1138},{ -409, -688, -688, -688, -688}}
-},
-{
-/* GU.@..AU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.A..AU */
-{{  DEF, -429, -599, -599, -599},{ -479, -858,-1028,-1028,-1028},{ -309, -688, -858, -858, -858},{ -389, -768, -938, -938, -938},{ -379, -758, -928, -928, -928}},
-/* GU.C..AU */
-{{  DEF, -259, -239, -239, -239},{ -649, -858, -838, -838, -838},{ -289, -498, -478, -478, -478},{ -739, -948, -928, -928, -928},{ -379, -588, -568, -568, -568}},
-/* GU.G..AU */
-{{  DEF, -339, -689, -689, -689},{ -649, -938,-1288,-1288,-1288},{ -289, -578, -928, -928, -928},{ -739,-1028,-1378,-1378,-1378},{ -379, -668,-1018,-1018,-1018}},
-/* GU.U..AU */
-{{  DEF, -329, -329, -329, -329},{ -649, -928, -928, -928, -928},{ -289, -568, -568, -568, -568},{ -739,-1018,-1018,-1018,-1018},{ -379, -658, -658, -658, -658}}
-},
-{
-/* GU.@..UA */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.A..UA */
-{{  DEF, -429, -599, -599, -599},{ -449, -828, -998, -998, -998},{ -479, -858,-1028,-1028,-1028},{ -429, -808, -978, -978, -978},{ -329, -708, -878, -878, -878}},
-/* GU.C..UA */
-{{  DEF, -259, -239, -239, -239},{ -679, -888, -868, -868, -868},{ -559, -768, -748, -748, -748},{ -729, -938, -918, -918, -918},{ -189, -398, -378, -378, -378}},
-/* GU.G..UA */
-{{  DEF, -339, -689, -689, -689},{ -939,-1228,-1578,-1578,-1578},{ -249, -538, -888, -888, -888},{ -939,-1228,-1578,-1578,-1578},{ -329, -618, -968, -968, -968}},
-/* GU.U..UA */
-{{  DEF, -329, -329, -329, -329},{ -639, -918, -918, -918, -918},{ -229, -508, -508, -508, -508},{ -729,-1008,-1008,-1008,-1008},{ -190, -469, -469, -469, -469}}
-},
-{
-/* GU.@.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.A.. @ */
-{{ -100, -479, -649, -649, -649},{ -100, -479, -649, -649, -649},{ -100, -479, -649, -649, -649},{ -100, -479, -649, -649, -649},{ -100, -479, -649, -649, -649}},
-/* GU.C.. @ */
-{{ -100, -309, -289, -289, -289},{ -100, -309, -289, -289, -289},{ -100, -309, -289, -289, -289},{ -100, -309, -289, -289, -289},{ -100, -309, -289, -289, -289}},
-/* GU.G.. @ */
-{{ -100, -389, -739, -739, -739},{ -100, -389, -739, -739, -739},{ -100, -389, -739, -739, -739},{ -100, -389, -739, -739, -739},{ -100, -389, -739, -739, -739}},
-/* GU.U.. @ */
-{{ -100, -379, -379, -379, -379},{ -100, -379, -379, -379, -379},{ -100, -379, -379, -379, -379},{ -100, -379, -379, -379, -379},{ -100, -379, -379, -379, -379}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/* UG.@..CG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.A..CG */
-{{  DEF, -719, -789, -959, -809},{-1079,-1748,-1818,-1988,-1838},{ -569,-1238,-1308,-1478,-1328},{ -989,-1658,-1728,-1898,-1748},{ -859,-1528,-1598,-1768,-1618}},
-/* UG.C..CG */
-{{  DEF, -479, -479, -359, -479},{ -999,-1428,-1428,-1308,-1428},{ -499, -928, -928, -808, -928},{ -989,-1418,-1418,-1298,-1418},{ -789,-1218,-1218,-1098,-1218}},
-/* UG.G..CG */
-{{  DEF, -659, -809, -919, -809},{-1079,-1688,-1838,-1948,-1838},{ -569,-1178,-1328,-1438,-1328},{ -989,-1598,-1748,-1858,-1748},{ -859,-1468,-1618,-1728,-1618}},
-/* UG.U..CG */
-{{  DEF, -549, -439, -549, -359},{-1079,-1578,-1468,-1578,-1388},{ -719,-1218,-1108,-1218,-1028},{ -989,-1488,-1378,-1488,-1298},{ -909,-1408,-1298,-1408,-1218}}
-},
-{
-/* UG.@..GC */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.A..GC */
-{{  DEF, -719, -789, -959, -809},{ -569,-1238,-1308,-1478,-1328},{ -769,-1438,-1508,-1678,-1528},{ -759,-1428,-1498,-1668,-1518},{ -549,-1218,-1288,-1458,-1308}},
-/* UG.C..GC */
-{{  DEF, -479, -479, -359, -479},{ -929,-1358,-1358,-1238,-1358},{ -359, -788, -788, -668, -788},{ -789,-1218,-1218,-1098,-1218},{ -549, -978, -978, -858, -978}},
-/* UG.G..GC */
-{{  DEF, -659, -809, -919, -809},{ -609,-1218,-1368,-1478,-1368},{ -359, -968,-1118,-1228,-1118},{ -669,-1278,-1428,-1538,-1428},{ -549,-1158,-1308,-1418,-1308}},
-/* UG.U..GC */
-{{  DEF, -549, -439, -549, -359},{ -929,-1428,-1318,-1428,-1238},{ -439, -938, -828, -938, -748},{ -789,-1288,-1178,-1288,-1098},{ -619,-1118,-1008,-1118, -928}}
-},
-{
-/* UG.@..GU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.A..GU */
-{{  DEF, -719, -789, -959, -809},{ -479,-1148,-1218,-1388,-1238},{ -309, -978,-1048,-1218,-1068},{ -389,-1058,-1128,-1298,-1148},{ -379,-1048,-1118,-1288,-1138}},
-/* UG.C..GU */
-{{  DEF, -479, -479, -359, -479},{ -649,-1078,-1078, -958,-1078},{ -289, -718, -718, -598, -718},{ -739,-1168,-1168,-1048,-1168},{ -379, -808, -808, -688, -808}},
-/* UG.G..GU */
-{{  DEF, -659, -809, -919, -809},{ -649,-1258,-1408,-1518,-1408},{ -289, -898,-1048,-1158,-1048},{ -739,-1348,-1498,-1608,-1498},{ -379, -988,-1138,-1248,-1138}},
-/* UG.U..GU */
-{{  DEF, -549, -439, -549, -359},{ -649,-1148,-1038,-1148, -958},{ -289, -788, -678, -788, -598},{ -739,-1238,-1128,-1238,-1048},{ -379, -878, -768, -878, -688}}
-},
-{
-/* UG.@..UG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.A..UG */
-{{  DEF, -719, -789, -959, -809},{ -769,-1438,-1508,-1678,-1528},{ -529,-1198,-1268,-1438,-1288},{ -709,-1378,-1448,-1618,-1468},{ -599,-1268,-1338,-1508,-1358}},
-/* UG.C..UG */
-{{  DEF, -479, -479, -359, -479},{ -839,-1268,-1268,-1148,-1268},{ -529, -958, -958, -838, -958},{ -859,-1288,-1288,-1168,-1288},{ -489, -918, -918, -798, -918}},
-/* UG.G..UG */
-{{  DEF, -659, -809, -919, -809},{-1009,-1618,-1768,-1878,-1768},{ -409,-1018,-1168,-1278,-1168},{ -969,-1578,-1728,-1838,-1728},{ -599,-1208,-1358,-1468,-1358}},
-/* UG.U..UG */
-{{  DEF, -549, -439, -549, -359},{ -859,-1358,-1248,-1358,-1168},{ -529,-1028, -918,-1028, -838},{ -859,-1358,-1248,-1358,-1168},{ -409, -908, -798, -908, -718}}
-},
-{
-/* UG.@..AU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.A..AU */
-{{  DEF, -719, -789, -959, -809},{ -479,-1148,-1218,-1388,-1238},{ -309, -978,-1048,-1218,-1068},{ -389,-1058,-1128,-1298,-1148},{ -379,-1048,-1118,-1288,-1138}},
-/* UG.C..AU */
-{{  DEF, -479, -479, -359, -479},{ -649,-1078,-1078, -958,-1078},{ -289, -718, -718, -598, -718},{ -739,-1168,-1168,-1048,-1168},{ -379, -808, -808, -688, -808}},
-/* UG.G..AU */
-{{  DEF, -659, -809, -919, -809},{ -649,-1258,-1408,-1518,-1408},{ -289, -898,-1048,-1158,-1048},{ -739,-1348,-1498,-1608,-1498},{ -379, -988,-1138,-1248,-1138}},
-/* UG.U..AU */
-{{  DEF, -549, -439, -549, -359},{ -649,-1148,-1038,-1148, -958},{ -289, -788, -678, -788, -598},{ -739,-1238,-1128,-1238,-1048},{ -379, -878, -768, -878, -688}}
-},
-{
-/* UG.@..UA */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.A..UA */
-{{  DEF, -719, -789, -959, -809},{ -449,-1118,-1188,-1358,-1208},{ -479,-1148,-1218,-1388,-1238},{ -429,-1098,-1168,-1338,-1188},{ -329, -998,-1068,-1238,-1088}},
-/* UG.C..UA */
-{{  DEF, -479, -479, -359, -479},{ -679,-1108,-1108, -988,-1108},{ -559, -988, -988, -868, -988},{ -729,-1158,-1158,-1038,-1158},{ -189, -618, -618, -498, -618}},
-/* UG.G..UA */
-{{  DEF, -659, -809, -919, -809},{ -939,-1548,-1698,-1808,-1698},{ -249, -858,-1008,-1118,-1008},{ -939,-1548,-1698,-1808,-1698},{ -329, -938,-1088,-1198,-1088}},
-/* UG.U..UA */
-{{  DEF, -549, -439, -549, -359},{ -639,-1138,-1028,-1138, -948},{ -229, -728, -618, -728, -538},{ -729,-1228,-1118,-1228,-1038},{ -190, -689, -579, -689, -499}}
-},
-{
-/* UG.@.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.A.. @ */
-{{ -100, -769, -839,-1009, -859},{ -100, -769, -839,-1009, -859},{ -100, -769, -839,-1009, -859},{ -100, -769, -839,-1009, -859},{ -100, -769, -839,-1009, -859}},
-/* UG.C.. @ */
-{{ -100, -529, -529, -409, -529},{ -100, -529, -529, -409, -529},{ -100, -529, -529, -409, -529},{ -100, -529, -529, -409, -529},{ -100, -529, -529, -409, -529}},
-/* UG.G.. @ */
-{{ -100, -709, -859, -969, -859},{ -100, -709, -859, -969, -859},{ -100, -709, -859, -969, -859},{ -100, -709, -859, -969, -859},{ -100, -709, -859, -969, -859}},
-/* UG.U.. @ */
-{{ -100, -599, -489, -599, -409},{ -100, -599, -489, -599, -409},{ -100, -599, -489, -599, -409},{ -100, -599, -489, -599, -409},{ -100, -599, -489, -599, -409}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/* AU.@..CG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.A..CG */
-{{  DEF, -429, -599, -599, -599},{-1079,-1458,-1628,-1628,-1628},{ -569, -948,-1118,-1118,-1118},{ -989,-1368,-1538,-1538,-1538},{ -859,-1238,-1408,-1408,-1408}},
-/* AU.C..CG */
-{{  DEF, -259, -239, -239, -239},{ -999,-1208,-1188,-1188,-1188},{ -499, -708, -688, -688, -688},{ -989,-1198,-1178,-1178,-1178},{ -789, -998, -978, -978, -978}},
-/* AU.G..CG */
-{{  DEF, -339, -689, -689, -689},{-1079,-1368,-1718,-1718,-1718},{ -569, -858,-1208,-1208,-1208},{ -989,-1278,-1628,-1628,-1628},{ -859,-1148,-1498,-1498,-1498}},
-/* AU.U..CG */
-{{  DEF, -329, -329, -329, -329},{-1079,-1358,-1358,-1358,-1358},{ -719, -998, -998, -998, -998},{ -989,-1268,-1268,-1268,-1268},{ -909,-1188,-1188,-1188,-1188}}
-},
-{
-/* AU.@..GC */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.A..GC */
-{{  DEF, -429, -599, -599, -599},{ -569, -948,-1118,-1118,-1118},{ -769,-1148,-1318,-1318,-1318},{ -759,-1138,-1308,-1308,-1308},{ -549, -928,-1098,-1098,-1098}},
-/* AU.C..GC */
-{{  DEF, -259, -239, -239, -239},{ -929,-1138,-1118,-1118,-1118},{ -359, -568, -548, -548, -548},{ -789, -998, -978, -978, -978},{ -549, -758, -738, -738, -738}},
-/* AU.G..GC */
-{{  DEF, -339, -689, -689, -689},{ -609, -898,-1248,-1248,-1248},{ -359, -648, -998, -998, -998},{ -669, -958,-1308,-1308,-1308},{ -549, -838,-1188,-1188,-1188}},
-/* AU.U..GC */
-{{  DEF, -329, -329, -329, -329},{ -929,-1208,-1208,-1208,-1208},{ -439, -718, -718, -718, -718},{ -789,-1068,-1068,-1068,-1068},{ -619, -898, -898, -898, -898}}
-},
-{
-/* AU.@..GU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.A..GU */
-{{  DEF, -429, -599, -599, -599},{ -479, -858,-1028,-1028,-1028},{ -309, -688, -858, -858, -858},{ -389, -768, -938, -938, -938},{ -379, -758, -928, -928, -928}},
-/* AU.C..GU */
-{{  DEF, -259, -239, -239, -239},{ -649, -858, -838, -838, -838},{ -289, -498, -478, -478, -478},{ -739, -948, -928, -928, -928},{ -379, -588, -568, -568, -568}},
-/* AU.G..GU */
-{{  DEF, -339, -689, -689, -689},{ -649, -938,-1288,-1288,-1288},{ -289, -578, -928, -928, -928},{ -739,-1028,-1378,-1378,-1378},{ -379, -668,-1018,-1018,-1018}},
-/* AU.U..GU */
-{{  DEF, -329, -329, -329, -329},{ -649, -928, -928, -928, -928},{ -289, -568, -568, -568, -568},{ -739,-1018,-1018,-1018,-1018},{ -379, -658, -658, -658, -658}}
-},
-{
-/* AU.@..UG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.A..UG */
-{{  DEF, -429, -599, -599, -599},{ -769,-1148,-1318,-1318,-1318},{ -529, -908,-1078,-1078,-1078},{ -709,-1088,-1258,-1258,-1258},{ -599, -978,-1148,-1148,-1148}},
-/* AU.C..UG */
-{{  DEF, -259, -239, -239, -239},{ -839,-1048,-1028,-1028,-1028},{ -529, -738, -718, -718, -718},{ -859,-1068,-1048,-1048,-1048},{ -489, -698, -678, -678, -678}},
-/* AU.G..UG */
-{{  DEF, -339, -689, -689, -689},{-1009,-1298,-1648,-1648,-1648},{ -409, -698,-1048,-1048,-1048},{ -969,-1258,-1608,-1608,-1608},{ -599, -888,-1238,-1238,-1238}},
-/* AU.U..UG */
-{{  DEF, -329, -329, -329, -329},{ -859,-1138,-1138,-1138,-1138},{ -529, -808, -808, -808, -808},{ -859,-1138,-1138,-1138,-1138},{ -409, -688, -688, -688, -688}}
-},
-{
-/* AU.@..AU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.A..AU */
-{{  DEF, -429, -599, -599, -599},{ -479, -858,-1028,-1028,-1028},{ -309, -688, -858, -858, -858},{ -389, -768, -938, -938, -938},{ -379, -758, -928, -928, -928}},
-/* AU.C..AU */
-{{  DEF, -259, -239, -239, -239},{ -649, -858, -838, -838, -838},{ -289, -498, -478, -478, -478},{ -739, -948, -928, -928, -928},{ -379, -588, -568, -568, -568}},
-/* AU.G..AU */
-{{  DEF, -339, -689, -689, -689},{ -649, -938,-1288,-1288,-1288},{ -289, -578, -928, -928, -928},{ -739,-1028,-1378,-1378,-1378},{ -379, -668,-1018,-1018,-1018}},
-/* AU.U..AU */
-{{  DEF, -329, -329, -329, -329},{ -649, -928, -928, -928, -928},{ -289, -568, -568, -568, -568},{ -739,-1018,-1018,-1018,-1018},{ -379, -658, -658, -658, -658}}
-},
-{
-/* AU.@..UA */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.A..UA */
-{{  DEF, -429, -599, -599, -599},{ -449, -828, -998, -998, -998},{ -479, -858,-1028,-1028,-1028},{ -429, -808, -978, -978, -978},{ -329, -708, -878, -878, -878}},
-/* AU.C..UA */
-{{  DEF, -259, -239, -239, -239},{ -679, -888, -868, -868, -868},{ -559, -768, -748, -748, -748},{ -729, -938, -918, -918, -918},{ -189, -398, -378, -378, -378}},
-/* AU.G..UA */
-{{  DEF, -339, -689, -689, -689},{ -939,-1228,-1578,-1578,-1578},{ -249, -538, -888, -888, -888},{ -939,-1228,-1578,-1578,-1578},{ -329, -618, -968, -968, -968}},
-/* AU.U..UA */
-{{  DEF, -329, -329, -329, -329},{ -639, -918, -918, -918, -918},{ -229, -508, -508, -508, -508},{ -729,-1008,-1008,-1008,-1008},{ -190, -469, -469, -469, -469}}
-},
-{
-/* AU.@.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.A.. @ */
-{{ -100, -479, -649, -649, -649},{ -100, -479, -649, -649, -649},{ -100, -479, -649, -649, -649},{ -100, -479, -649, -649, -649},{ -100, -479, -649, -649, -649}},
-/* AU.C.. @ */
-{{ -100, -309, -289, -289, -289},{ -100, -309, -289, -289, -289},{ -100, -309, -289, -289, -289},{ -100, -309, -289, -289, -289},{ -100, -309, -289, -289, -289}},
-/* AU.G.. @ */
-{{ -100, -389, -739, -739, -739},{ -100, -389, -739, -739, -739},{ -100, -389, -739, -739, -739},{ -100, -389, -739, -739, -739},{ -100, -389, -739, -739, -739}},
-/* AU.U.. @ */
-{{ -100, -379, -379, -379, -379},{ -100, -379, -379, -379, -379},{ -100, -379, -379, -379, -379},{ -100, -379, -379, -379, -379},{ -100, -379, -379, -379, -379}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/* UA.@..CG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.A..CG */
-{{  DEF, -399, -629, -889, -589},{-1079,-1428,-1658,-1918,-1618},{ -569, -918,-1148,-1408,-1108},{ -989,-1338,-1568,-1828,-1528},{ -859,-1208,-1438,-1698,-1398}},
-/* UA.C..CG */
-{{  DEF, -429, -509, -199, -179},{ -999,-1378,-1458,-1148,-1128},{ -499, -878, -958, -648, -628},{ -989,-1368,-1448,-1138,-1118},{ -789,-1168,-1248, -938, -918}},
-/* UA.G..CG */
-{{  DEF, -379, -679, -889, -679},{-1079,-1408,-1708,-1918,-1708},{ -569, -898,-1198,-1408,-1198},{ -989,-1318,-1618,-1828,-1618},{ -859,-1188,-1488,-1698,-1488}},
-/* UA.U..CG */
-{{  DEF, -279, -139, -279, -140},{-1079,-1308,-1168,-1308,-1169},{ -719, -948, -808, -948, -809},{ -989,-1218,-1078,-1218,-1079},{ -909,-1138, -998,-1138, -999}}
-},
-{
-/* UA.@..GC */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.A..GC */
-{{  DEF, -399, -629, -889, -589},{ -569, -918,-1148,-1408,-1108},{ -769,-1118,-1348,-1608,-1308},{ -759,-1108,-1338,-1598,-1298},{ -549, -898,-1128,-1388,-1088}},
-/* UA.C..GC */
-{{  DEF, -429, -509, -199, -179},{ -929,-1308,-1388,-1078,-1058},{ -359, -738, -818, -508, -488},{ -789,-1168,-1248, -938, -918},{ -549, -928,-1008, -698, -678}},
-/* UA.G..GC */
-{{  DEF, -379, -679, -889, -679},{ -609, -938,-1238,-1448,-1238},{ -359, -688, -988,-1198, -988},{ -669, -998,-1298,-1508,-1298},{ -549, -878,-1178,-1388,-1178}},
-/* UA.U..GC */
-{{  DEF, -279, -139, -279, -140},{ -929,-1158,-1018,-1158,-1019},{ -439, -668, -528, -668, -529},{ -789,-1018, -878,-1018, -879},{ -619, -848, -708, -848, -709}}
-},
-{
-/* UA.@..GU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.A..GU */
-{{  DEF, -399, -629, -889, -589},{ -479, -828,-1058,-1318,-1018},{ -309, -658, -888,-1148, -848},{ -389, -738, -968,-1228, -928},{ -379, -728, -958,-1218, -918}},
-/* UA.C..GU */
-{{  DEF, -429, -509, -199, -179},{ -649,-1028,-1108, -798, -778},{ -289, -668, -748, -438, -418},{ -739,-1118,-1198, -888, -868},{ -379, -758, -838, -528, -508}},
-/* UA.G..GU */
-{{  DEF, -379, -679, -889, -679},{ -649, -978,-1278,-1488,-1278},{ -289, -618, -918,-1128, -918},{ -739,-1068,-1368,-1578,-1368},{ -379, -708,-1008,-1218,-1008}},
-/* UA.U..GU */
-{{  DEF, -279, -139, -279, -140},{ -649, -878, -738, -878, -739},{ -289, -518, -378, -518, -379},{ -739, -968, -828, -968, -829},{ -379, -608, -468, -608, -469}}
-},
-{
-/* UA.@..UG */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.A..UG */
-{{  DEF, -399, -629, -889, -589},{ -769,-1118,-1348,-1608,-1308},{ -529, -878,-1108,-1368,-1068},{ -709,-1058,-1288,-1548,-1248},{ -599, -948,-1178,-1438,-1138}},
-/* UA.C..UG */
-{{  DEF, -429, -509, -199, -179},{ -839,-1218,-1298, -988, -968},{ -529, -908, -988, -678, -658},{ -859,-1238,-1318,-1008, -988},{ -489, -868, -948, -638, -618}},
-/* UA.G..UG */
-{{  DEF, -379, -679, -889, -679},{-1009,-1338,-1638,-1848,-1638},{ -409, -738,-1038,-1248,-1038},{ -969,-1298,-1598,-1808,-1598},{ -599, -928,-1228,-1438,-1228}},
-/* UA.U..UG */
-{{  DEF, -279, -139, -279, -140},{ -859,-1088, -948,-1088, -949},{ -529, -758, -618, -758, -619},{ -859,-1088, -948,-1088, -949},{ -409, -638, -498, -638, -499}}
-},
-{
-/* UA.@..AU */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.A..AU */
-{{  DEF, -399, -629, -889, -589},{ -479, -828,-1058,-1318,-1018},{ -309, -658, -888,-1148, -848},{ -389, -738, -968,-1228, -928},{ -379, -728, -958,-1218, -918}},
-/* UA.C..AU */
-{{  DEF, -429, -509, -199, -179},{ -649,-1028,-1108, -798, -778},{ -289, -668, -748, -438, -418},{ -739,-1118,-1198, -888, -868},{ -379, -758, -838, -528, -508}},
-/* UA.G..AU */
-{{  DEF, -379, -679, -889, -679},{ -649, -978,-1278,-1488,-1278},{ -289, -618, -918,-1128, -918},{ -739,-1068,-1368,-1578,-1368},{ -379, -708,-1008,-1218,-1008}},
-/* UA.U..AU */
-{{  DEF, -279, -139, -279, -140},{ -649, -878, -738, -878, -739},{ -289, -518, -378, -518, -379},{ -739, -968, -828, -968, -829},{ -379, -608, -468, -608, -469}}
-},
-{
-/* UA.@..UA */
-{{    0,    0,    0,    0,    0},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.A..UA */
-{{  DEF, -399, -629, -889, -589},{ -449, -798,-1028,-1288, -988},{ -479, -828,-1058,-1318,-1018},{ -429, -778,-1008,-1268, -968},{ -329, -678, -908,-1168, -868}},
-/* UA.C..UA */
-{{  DEF, -429, -509, -199, -179},{ -679,-1058,-1138, -828, -808},{ -559, -938,-1018, -708, -688},{ -729,-1108,-1188, -878, -858},{ -189, -568, -648, -338, -318}},
-/* UA.G..UA */
-{{  DEF, -379, -679, -889, -679},{ -939,-1268,-1568,-1778,-1568},{ -249, -578, -878,-1088, -878},{ -939,-1268,-1568,-1778,-1568},{ -329, -658, -958,-1168, -958}},
-/* UA.U..UA */
-{{  DEF, -279, -139, -279, -140},{ -639, -868, -728, -868, -729},{ -229, -458, -318, -458, -319},{ -729, -958, -818, -958, -819},{ -190, -419, -279, -419, -280}}
-},
-{
-/* UA.@.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF},{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.A.. @ */
-{{ -100, -449, -679, -939, -639},{ -100, -449, -679, -939, -639},{ -100, -449, -679, -939, -639},{ -100, -449, -679, -939, -639},{ -100, -449, -679, -939, -639}},
-/* UA.C.. @ */
-{{ -100, -479, -559, -249, -229},{ -100, -479, -559, -249, -229},{ -100, -479, -559, -249, -229},{ -100, -479, -559, -249, -229},{ -100, -479, -559, -249, -229}},
-/* UA.G.. @ */
-{{ -100, -429, -729, -939, -729},{ -100, -429, -729, -939, -729},{ -100, -429, -729, -939, -729},{ -100, -429, -729, -939, -729},{ -100, -429, -729, -939, -729}},
-/* UA.U.. @ */
-{{ -100, -329, -189, -329, -190},{ -100, -329, -189, -329, -190},{ -100, -329, -189, -329, -190},{ -100, -329, -189, -329, -190},{ -100, -329, -189, -329, -190}}
-}
-},
-{ /* noPair */ {{{0}}},
-{
-/*  @.@..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100}},
-/*  @.A..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{-1079,-1079,-1079,-1079,-1079},{ -569, -569, -569, -569, -569},{ -989, -989, -989, -989, -989},{ -859, -859, -859, -859, -859}},
-/*  @.C..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -999, -999, -999, -999, -999},{ -499, -499, -499, -499, -499},{ -989, -989, -989, -989, -989},{ -789, -789, -789, -789, -789}},
-/*  @.G..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{-1079,-1079,-1079,-1079,-1079},{ -569, -569, -569, -569, -569},{ -989, -989, -989, -989, -989},{ -859, -859, -859, -859, -859}},
-/*  @.U..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{-1079,-1079,-1079,-1079,-1079},{ -719, -719, -719, -719, -719},{ -989, -989, -989, -989, -989},{ -909, -909, -909, -909, -909}}
-},
-{
-/*  @.@..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100}},
-/*  @.A..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -569, -569, -569, -569, -569},{ -769, -769, -769, -769, -769},{ -759, -759, -759, -759, -759},{ -549, -549, -549, -549, -549}},
-/*  @.C..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -929, -929, -929, -929, -929},{ -359, -359, -359, -359, -359},{ -789, -789, -789, -789, -789},{ -549, -549, -549, -549, -549}},
-/*  @.G..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -609, -609, -609, -609, -609},{ -359, -359, -359, -359, -359},{ -669, -669, -669, -669, -669},{ -549, -549, -549, -549, -549}},
-/*  @.U..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -929, -929, -929, -929, -929},{ -439, -439, -439, -439, -439},{ -789, -789, -789, -789, -789},{ -619, -619, -619, -619, -619}}
-},
-{
-/*  @.@..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100}},
-/*  @.A..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -479, -479, -479, -479, -479},{ -309, -309, -309, -309, -309},{ -389, -389, -389, -389, -389},{ -379, -379, -379, -379, -379}},
-/*  @.C..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -649, -649, -649, -649, -649},{ -289, -289, -289, -289, -289},{ -739, -739, -739, -739, -739},{ -379, -379, -379, -379, -379}},
-/*  @.G..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -649, -649, -649, -649, -649},{ -289, -289, -289, -289, -289},{ -739, -739, -739, -739, -739},{ -379, -379, -379, -379, -379}},
-/*  @.U..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -649, -649, -649, -649, -649},{ -289, -289, -289, -289, -289},{ -739, -739, -739, -739, -739},{ -379, -379, -379, -379, -379}}
-},
-{
-/*  @.@..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100}},
-/*  @.A..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -769, -769, -769, -769, -769},{ -529, -529, -529, -529, -529},{ -709, -709, -709, -709, -709},{ -599, -599, -599, -599, -599}},
-/*  @.C..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -839, -839, -839, -839, -839},{ -529, -529, -529, -529, -529},{ -859, -859, -859, -859, -859},{ -489, -489, -489, -489, -489}},
-/*  @.G..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{-1009,-1009,-1009,-1009,-1009},{ -409, -409, -409, -409, -409},{ -969, -969, -969, -969, -969},{ -599, -599, -599, -599, -599}},
-/*  @.U..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -859, -859, -859, -859, -859},{ -529, -529, -529, -529, -529},{ -859, -859, -859, -859, -859},{ -409, -409, -409, -409, -409}}
-},
-{
-/*  @.@..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100}},
-/*  @.A..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -479, -479, -479, -479, -479},{ -309, -309, -309, -309, -309},{ -389, -389, -389, -389, -389},{ -379, -379, -379, -379, -379}},
-/*  @.C..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -649, -649, -649, -649, -649},{ -289, -289, -289, -289, -289},{ -739, -739, -739, -739, -739},{ -379, -379, -379, -379, -379}},
-/*  @.G..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -649, -649, -649, -649, -649},{ -289, -289, -289, -289, -289},{ -739, -739, -739, -739, -739},{ -379, -379, -379, -379, -379}},
-/*  @.U..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -649, -649, -649, -649, -649},{ -289, -289, -289, -289, -289},{ -739, -739, -739, -739, -739},{ -379, -379, -379, -379, -379}}
-},
-{
-/*  @.@..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100}},
-/*  @.A..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -449, -449, -449, -449, -449},{ -479, -479, -479, -479, -479},{ -429, -429, -429, -429, -429},{ -329, -329, -329, -329, -329}},
-/*  @.C..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -679, -679, -679, -679, -679},{ -559, -559, -559, -559, -559},{ -729, -729, -729, -729, -729},{ -189, -189, -189, -189, -189}},
-/*  @.G..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -939, -939, -939, -939, -939},{ -249, -249, -249, -249, -249},{ -939, -939, -939, -939, -939},{ -329, -329, -329, -329, -329}},
-/*  @.U..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},{ -639, -639, -639, -639, -639},{ -229, -229, -229, -229, -229},{ -729, -729, -729, -729, -729},{ -190, -190, -190, -190, -190}}
-},
-{
-/*  @.@.. @ */
-{{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100}},
-/*  @.A.. @ */
-{{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100}},
-/*  @.C.. @ */
-{{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100}},
-/*  @.G.. @ */
-{{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100}},
-/*  @.U.. @ */
-{{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100},{ -100, -100, -100, -100, -100}}
-}
-}
-};
-
-PRIVATE int int22_37_184[NBPAIRS+1][NBPAIRS+1][5][5][5][5] = {
-/* noPair */ {{{{{0}}}}},
-{ /* noPair */ {{{{0}}}},
-/* CG....CG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 160,  30, 200},{ 340, 120, 150,  20, 200},{ 340,  30,  60, -70, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 160, 200,  60, 200},{ 340, 210, 180, 150, 200},{ 340, 200, 200, 200, 200},{ 340, 190, 170, 130, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  30,  60, -70, 200},{ 340, 200, 200, 200, 200},{ 340, 100, 140,   0, 200},{ 340, -40, -110, -60, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 190, 170, 130, 200},{ 340, 110,  40,  90, 200},{ 340, 140,  80, 130, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 120, 210, 200, 190},{ 340, 110, 140, 200, 120},{ 340,  20, 150, 200, 130},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 180, 200, 170},{ 340, 140, 170, 200, 150},{ 340, 200, 200, 200, 200},{ 340, 120, 150, 200, 140}},
-{{ 340, 340, 340, 340, 340},{ 340,  20, 150, 200, 130},{ 340, 200, 200, 200, 200},{ 340,  90, 180, 200, 170},{ 340, -150, -20, 200, -40}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 120, 150, 200, 140},{ 340,   0, 130, 200, 110},{ 340,  30,  60, 200,  50}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340,  30, 200, 100, 110},{ 340,  20, 200,  90,   0},{ 340, -70, 200,   0,  90},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  60, 200, 140,  40},{ 340, 150, 200, 180, 130},{ 340, 200, 200, 200, 200},{ 340, 130, 200, 170, 110}},
-{{ 340, 340, 340, 340, 340},{ 340, -70, 200,   0,  90},{ 340, 200, 200, 200, 200},{ 340,   0, 200,  80,  90},{ 340, -60, 200, -70, -260}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 130, 200, 170, 110},{ 340,  90, 200,  90, -110},{ 340, 130, 200, 120, 110}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 190, -40, 140},{ 340, 200, 120, -150,  30},{ 340, 200, 130, -60, 130},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 170, -110,  80},{ 340, 200, 150, -20,  60},{ 340, 200, 200, 200, 200},{ 340, 200, 140, -40,  50}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 130, -60, 130},{ 340, 200, 200, 200, 200},{ 340, 200, 170, -70, 120},{ 340, 200, -40, -420, -50}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 140, -40,  50},{ 340, 200, 110, -260, 110},{ 340, 200,  50, -50, -40}}
-}
-},
-/* CG....GC */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340,  50,  60,   0, 200},{ 340, 110, 150, -70, 200},{ 340, -30,  10, -160, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 110, 110, -100, 200},{ 340, 170, 150, -60, 200},{ 340, 200, 200, 200, 200},{ 340,  70,  50,  20, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  40,  50, -70, 200},{ 340, 200, 200, 200, 200},{ 340, 100, 140,   0, 200},{ 340,  10, -70, -80, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 180, 150, 120, 200},{ 340, -50, -60, -60, 200},{ 340, 150,   0,  90, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 220, 200, 200},{ 340, 100, 130, 200, 120},{ 340, -70,  70, 200,  40},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 190, 200, 110},{ 340, 100, 130, 200, 120},{ 340, 200, 200, 200, 200},{ 340,   0,  30, 200, 170}},
-{{ 340, 340, 340, 340, 340},{ 340,  70,  70, 200, 100},{ 340, 200, 200, 200, 200},{ 340,  90, 180, 200, 170},{ 340, -190, -30, 200, -70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 110, 140, 200, 120},{ 340, -150, -20, 200, -30},{ 340, -20, -10, 200,  20}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, -20, 200, 110,  90},{ 340, -40, 200,  90,   0},{ 340, -170, 200, -90,  30},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  70, 200,  80, -10},{ 340, 110, 200, 150, 100},{ 340, 200, 200, 200, 200},{ 340,  20, 200,  50,   0}},
-{{ 340, 340, 340, 340, 340},{ 340, -50, 200, -20,  60},{ 340, 200, 200, 200, 200},{ 340,   0, 200,  80,  90},{ 340, -90, 200, -100, -300}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 120, 200, 150, 100},{ 340, -130, 200, -60, -240},{ 340,  90, 200, 110,  60}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, -10, 140},{ 340, 200, 120, -160,  30},{ 340, 200,  40, -160,  50},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 110, -160,  30},{ 340, 200, 120, -60,  30},{ 340, 200, 200, 200, 200},{ 340, 200,  20, -160,  10}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  50, -60, 140},{ 340, 200, 200, 200, 200},{ 340, 200, 170, -70, 120},{ 340, 200, -70, -440, -100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 120, -50,  30},{ 340, 200, -10, -410,  10},{ 340, 200,  40, -100,  60}}
-}
-},
-/* CG....GU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, 100, 200},{ 340, 180, 210,  80, 200},{ 340,  80, 110, -20, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 220,  90, 200},{ 340, 230, 210, 170, 200},{ 340, 200, 200, 200, 200},{ 340, 230, 210, 170, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  80, 110, -20, 200},{ 340, 200, 200, 200, 200},{ 340, 130, 170,  30, 200},{ 340,  60,   0,  40, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 230, 210, 170, 200},{ 340, 160,  90, 140, 200},{ 340, 190, 130, 180, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 280, 200, 270},{ 340, 170, 200, 200, 180},{ 340,  70, 200, 200, 180},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 180, 210, 200, 190},{ 340, 160, 190, 200, 180},{ 340, 200, 200, 200, 200},{ 340, 160, 190, 200, 180}},
-{{ 340, 340, 340, 340, 340},{ 340,  70, 200, 200, 180},{ 340, 200, 200, 200, 200},{ 340, 120, 210, 200, 200},{ 340, -50,  80, 200,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 160, 190, 200, 180},{ 340,  50, 180, 200, 160},{ 340,  80, 110, 200, 100}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 200, 180, 180},{ 340,  80, 200, 150,  60},{ 340, -20, 200,  50, 140},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  90, 200, 160,  70},{ 340, 170, 200, 210, 150},{ 340, 200, 200, 200, 200},{ 340, 170, 200, 210, 150}},
-{{ 340, 340, 340, 340, 340},{ 340, -20, 200,  50, 140},{ 340, 200, 200, 200, 200},{ 340,  30, 200, 110, 110},{ 340,  40, 200,  40, -160}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 170, 200, 210, 150},{ 340, 140, 200, 130, -60},{ 340, 180, 200, 170, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 270,  30, 220},{ 340, 200, 180, -90,  90},{ 340, 200, 180, -10, 180},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 190, -80, 100},{ 340, 200, 180,   0,  90},{ 340, 200, 200, 200, 200},{ 340, 200, 180,   0,  90}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 180, -10, 180},{ 340, 200, 200, 200, 200},{ 340, 200, 200, -40, 150},{ 340, 200,  70, -310,  60}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 180,   0,  90},{ 340, 200, 160, -210, 160},{ 340, 200, 100,   0,  10}}
-}
-},
-/* CG....UG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, 100, 200},{ 340, 160, 190,  60, 200},{ 340, 100, 130,   0, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, 100, 200},{ 340, 260, 240, 200, 200},{ 340, 200, 200, 200, 200},{ 340, 260, 240, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 130,   0, 200},{ 340, 200, 200, 200, 200},{ 340, 140, 170,  40, 200},{ 340,  20, -40,   0, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 230, 210, 170, 200},{ 340, 150,  80, 130, 200},{ 340, 220, 150, 200, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 280, 200, 270},{ 340, 150, 180, 200, 160},{ 340,  90, 220, 200, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 220, 200, 210},{ 340, 190, 220, 200, 210},{ 340, 200, 200, 200, 200},{ 340, 190, 220, 200, 210}},
-{{ 340, 340, 340, 340, 340},{ 340,  90, 220, 200, 200},{ 340, 200, 200, 200, 200},{ 340, 130, 220, 200, 200},{ 340, -90,  40, 200,  30}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 160, 190, 200, 180},{ 340,  40, 170, 200, 150},{ 340, 110, 140, 200, 120}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 200, 180, 180},{ 340,  60, 200, 130,  40},{ 340,   0, 200,  70, 160},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 200, 180,  80},{ 340, 200, 200, 240, 180},{ 340, 200, 200, 200, 200},{ 340, 200, 200, 240, 180}},
-{{ 340, 340, 340, 340, 340},{ 340,   0, 200,  70, 160},{ 340, 200, 200, 200, 200},{ 340,  40, 200, 110, 120},{ 340,   0, 200,   0, -200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 170, 200, 210, 150},{ 340, 130, 200, 120, -70},{ 340, 200, 200, 190, 180}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 270,  30, 220},{ 340, 200, 160, -110,  70},{ 340, 200, 200,  10, 190},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 210, -70, 120},{ 340, 200, 210,  30, 120},{ 340, 200, 200, 200, 200},{ 340, 200, 210,  30, 120}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200,  10, 190},{ 340, 200, 200, 200, 200},{ 340, 200, 200, -30, 150},{ 340, 200,  30, -350,  20}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 180,   0,  90},{ 340, 200, 150, -220, 150},{ 340, 200, 120,  30,  30}}
-}
-},
-/* CG....AU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, 100, 200},{ 340, 180, 210,  80, 200},{ 340,  80, 110, -20, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 220,  90, 200},{ 340, 230, 210, 170, 200},{ 340, 200, 200, 200, 200},{ 340, 230, 210, 170, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  80, 110, -20, 200},{ 340, 200, 200, 200, 200},{ 340, 130, 170,  30, 200},{ 340,  60,   0,  40, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 230, 210, 170, 200},{ 340, 160,  90, 140, 200},{ 340, 190, 130, 180, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 280, 200, 270},{ 340, 170, 200, 200, 180},{ 340,  70, 200, 200, 180},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 180, 210, 200, 190},{ 340, 160, 190, 200, 180},{ 340, 200, 200, 200, 200},{ 340, 160, 190, 200, 180}},
-{{ 340, 340, 340, 340, 340},{ 340,  70, 200, 200, 180},{ 340, 200, 200, 200, 200},{ 340, 120, 210, 200, 200},{ 340, -50,  80, 200,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 160, 190, 200, 180},{ 340,  50, 180, 200, 160},{ 340,  80, 110, 200, 100}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 200, 180, 180},{ 340,  80, 200, 150,  60},{ 340, -20, 200,  50, 140},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  90, 200, 160,  70},{ 340, 170, 200, 210, 150},{ 340, 200, 200, 200, 200},{ 340, 170, 200, 210, 150}},
-{{ 340, 340, 340, 340, 340},{ 340, -20, 200,  50, 140},{ 340, 200, 200, 200, 200},{ 340,  30, 200, 110, 110},{ 340,  40, 200,  40, -160}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 170, 200, 210, 150},{ 340, 140, 200, 130, -60},{ 340, 180, 200, 170, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 270,  30, 220},{ 340, 200, 180, -90,  90},{ 340, 200, 180, -10, 180},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 190, -80, 100},{ 340, 200, 180,   0,  90},{ 340, 200, 200, 200, 200},{ 340, 200, 180,   0,  90}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 180, -10, 180},{ 340, 200, 200, 200, 200},{ 340, 200, 200, -40, 150},{ 340, 200,  70, -310,  60}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 180,   0,  90},{ 340, 200, 160, -210, 160},{ 340, 200, 100,   0,  10}}
-}
-},
-/* CG....UA */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, 100, 200},{ 340, 160, 190,  60, 200},{ 340, 100, 130,   0, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, 100, 200},{ 340, 260, 240, 200, 200},{ 340, 200, 200, 200, 200},{ 340, 260, 240, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 130,   0, 200},{ 340, 200, 200, 200, 200},{ 340, 140, 170,  40, 200},{ 340,  20, -40,   0, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 230, 210, 170, 200},{ 340, 150,  80, 130, 200},{ 340, 220, 150, 200, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 280, 200, 270},{ 340, 150, 180, 200, 160},{ 340,  90, 220, 200, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 220, 200, 210},{ 340, 190, 220, 200, 210},{ 340, 200, 200, 200, 200},{ 340, 190, 220, 200, 210}},
-{{ 340, 340, 340, 340, 340},{ 340,  90, 220, 200, 200},{ 340, 200, 200, 200, 200},{ 340, 130, 220, 200, 200},{ 340, -90,  40, 200,  30}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 160, 190, 200, 180},{ 340,  40, 170, 200, 150},{ 340, 110, 140, 200, 120}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 200, 180, 180},{ 340,  60, 200, 130,  40},{ 340,   0, 200,  70, 160},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 200, 180,  80},{ 340, 200, 200, 240, 180},{ 340, 200, 200, 200, 200},{ 340, 200, 200, 240, 180}},
-{{ 340, 340, 340, 340, 340},{ 340,   0, 200,  70, 160},{ 340, 200, 200, 200, 200},{ 340,  40, 200, 110, 120},{ 340,   0, 200,   0, -200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 170, 200, 210, 150},{ 340, 130, 200, 120, -70},{ 340, 200, 200, 190, 180}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 270,  30, 220},{ 340, 200, 160, -110,  70},{ 340, 200, 200,  10, 190},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 210, -70, 120},{ 340, 200, 210,  30, 120},{ 340, 200, 200, 200, 200},{ 340, 200, 210,  30, 120}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200,  10, 190},{ 340, 200, 200, 200, 200},{ 340, 200, 200, -30, 150},{ 340, 200,  30, -350,  20}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 180,   0,  90},{ 340, 200, 150, -220, 150},{ 340, 200, 120,  30,  30}}
-}
-},
-/* CG....?? */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-}
-},
-{ /* noPair */ {{{{0}}}},
-/* GC....CG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340,  50, 110,  40, 200},{ 340, 130, 100,  70, 200},{ 340, -20,  70, -50, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  60, 110,  50, 200},{ 340, 220, 190,  70, 200},{ 340, 200, 200, 200, 200},{ 340, 200, 110,  50, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,   0, -100, -70, 200},{ 340, 200, 200, 200, 200},{ 340, 110,  80, -20, 200},{ 340, -10, -160, -60, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 110, 100, 200},{ 340,  90, -10,  60, 200},{ 340, 140,  30, 140, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 110, 170, 200, 180},{ 340, 100, 100, 200, 110},{ 340, -40, 110, 200, 120},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 150, 200, 150},{ 340, 130, 130, 200, 140},{ 340, 200, 200, 200, 200},{ 340, 120, 120, 200, 120}},
-{{ 340, 340, 340, 340, 340},{ 340, -70, -60, 200, 120},{ 340, 200, 200, 200, 200},{ 340,  90, 150, 200, 150},{ 340, -160, -60, 200, -50}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 120, 120, 200, 120},{ 340,   0, 100, 200, 100},{ 340,  30,  30, 200,  30}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, -30, 200, 100, -50},{ 340, -70, 200,  90, -150},{ 340, -170, 200,   0, -130},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  10, 200, 140, -60},{ 340,  70, 200, 180, -20},{ 340, 200, 200, 200, 200},{ 340,  40, 200, 170, -10}},
-{{ 340, 340, 340, 340, 340},{ 340, -160, 200,   0, -60},{ 340, 200, 200, 200, 200},{ 340, -90, 200,  80, -60},{ 340, -160, 200, -70, -410}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340,  40, 200, 170, -30},{ 340,  30, 200,  90, -240},{ 340,  50, 200, 120,  10}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  70,  10, 150},{ 340, 200,   0, -190, -20},{ 340, 200,  20, -90,  90},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  50, -70,   0},{ 340, 200,  30, -30, -10},{ 340, 200, 200, 200, 200},{ 340, 200,  20, -70,  40}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  20, -80,  90},{ 340, 200, 200, 200, 200},{ 340, 200,  50, -100, 110},{ 340, 200, -160, -440, -100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 170, -70,  20},{ 340, 200,   0, -300,  60},{ 340, 200,  10, -100,  60}}
-}
-},
-/* GC....GC */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 120,  10, 200},{ 340, 120,  90, -10, 200},{ 340, -50, -80, -190, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 120,  90, -20, 200},{ 340, 180,  90,  90, 200},{ 340, 200, 200, 200, 200},{ 340,  80,   0, -10, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  10, -20, -130, 200},{ 340, 200, 200, 200, 200},{ 340, 110,  80, -20, 200},{ 340, -70, -200, -130, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 190, 100,  90, 200},{ 340, -30, -160, -90, 200},{ 340, 150,  20,  90, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 120, 180, 200, 190},{ 340, 100, 100, 200, 100},{ 340, -80,  20, 200,  30},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  90,  90, 200, 100},{ 340, 100, 100, 200, 100},{ 340, 200, 200, 200, 200},{ 340,   0,   0, 200,   0}},
-{{ 340, 340, 340, 340, 340},{ 340, -10,  90, 200,  90},{ 340, 200, 200, 200, 200},{ 340,  90, 150, 200, 150},{ 340, -190, -90, 200, -90}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 100, 100, 200, 110},{ 340, -150, -50, 200, -50},{ 340,  20,  20, 200,  30}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, -50, 200, 110, -30},{ 340, -80, 200,  90, -150},{ 340, -260, 200, -90, -150},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, -80, 200,  80, -160},{ 340,  20, 200, 150, -50},{ 340, 200, 200, 200, 200},{ 340, -80, 200,  50, -150}},
-{{ 340, 340, 340, 340, 340},{ 340, -190, 200, -20, -90},{ 340, 200, 200, 200, 200},{ 340, -90, 200,  80, -60},{ 340, -190, 200, -100, -450}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340,  30, 200, 150, -50},{ 340, -150, 200, -60, -410},{ 340,  30, 200, 110, -50}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  80, -70, 150},{ 340, 200,   0, -190,  20},{ 340, 200, -80, -190,  30},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,   0, -200,  20},{ 340, 200,   0, -90,  20},{ 340, 200, 200, 200, 200},{ 340, 200, -100, -190, -70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, -10, -130,  90},{ 340, 200, 200, 200, 200},{ 340, 200,  50, -100, 110},{ 340, 200, -190, -490, -90}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200,   0, -90,  30},{ 340, 200, -150, -450, -50},{ 340, 200, -70, -90, -50}}
-}
-},
-/* GC....GU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 180,  70, 200},{ 340, 190, 160,  50, 200},{ 340,  90,  60, -50, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 170,  60, 200},{ 340, 240, 150, 140, 200},{ 340, 200, 200, 200, 200},{ 340, 240, 150, 140, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  90,  60, -50, 200},{ 340, 200, 200, 200, 200},{ 340, 140, 110,   0, 200},{ 340,  70, -60,  10, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 150, 140, 200},{ 340, 170,  40, 110, 200},{ 340, 200,  70, 150, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 250, 200, 250},{ 340, 160, 160, 200, 170},{ 340,  60, 160, 200, 170},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 170, 200, 180},{ 340, 160, 160, 200, 160},{ 340, 200, 200, 200, 200},{ 340, 160, 160, 200, 160}},
-{{ 340, 340, 340, 340, 340},{ 340,  60, 160, 200, 170},{ 340, 200, 200, 200, 200},{ 340, 120, 180, 200, 180},{ 340, -50,  50, 200,  50}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 160, 160, 200, 160},{ 340,  40, 140, 200, 150},{ 340,  80,  80, 200,  80}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340,  10, 200, 180,  40},{ 340, -10, 200, 150, -90},{ 340, -110, 200,  50, -10},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,   0, 200, 160, -80},{ 340,  80, 200, 210,  10},{ 340, 200, 200, 200, 200},{ 340,  80, 200, 210,  10}},
-{{ 340, 340, 340, 340, 340},{ 340, -110, 200,  50, -10},{ 340, 200, 200, 200, 200},{ 340, -60, 200, 110, -30},{ 340, -50, 200,  40, -310}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340,  80, 200, 210,  10},{ 340,  50, 200, 130, -210},{ 340,  80, 200, 170,  10}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 150,   0, 210},{ 340, 200,  60, -130,  90},{ 340, 200,  70, -50, 170},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  70, -120, 100},{ 340, 200,  60, -30,  80},{ 340, 200, 200, 200, 200},{ 340, 200,  60, -30,  80}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  70, -50, 170},{ 340, 200, 200, 200, 200},{ 340, 200,  80, -70, 140},{ 340, 200, -50, -350,  50}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200,  60, -30,  80},{ 340, 200,  50, -250, 150},{ 340, 200, -20, -30,   0}}
-}
-},
-/* GC....UG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 180,  70, 200},{ 340, 170, 140,  30, 200},{ 340, 110,  80, -30, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 180,  70, 200},{ 340, 270, 180, 170, 200},{ 340, 200, 200, 200, 200},{ 340, 270, 180, 170, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 110,  80, -30, 200},{ 340, 200, 200, 200, 200},{ 340, 150, 120,  10, 200},{ 340,  30, -100, -30, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 150, 140, 200},{ 340, 160,  30, 100, 200},{ 340, 230, 100, 170, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 250, 200, 250},{ 340, 140, 140, 200, 150},{ 340,  80, 180, 200, 190},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 190, 200, 190},{ 340, 190, 190, 200, 190},{ 340, 200, 200, 200, 200},{ 340, 190, 190, 200, 190}},
-{{ 340, 340, 340, 340, 340},{ 340,  80, 180, 200, 190},{ 340, 200, 200, 200, 200},{ 340, 120, 180, 200, 190},{ 340, -90,  10, 200,  10}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 160, 160, 200, 160},{ 340,  30, 130, 200, 140},{ 340, 100, 100, 200, 110}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340,  10, 200, 180,  40},{ 340, -30, 200, 130, -110},{ 340, -90, 200,  70,  10},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  10, 200, 180, -60},{ 340, 110, 200, 240,  40},{ 340, 200, 200, 200, 200},{ 340, 110, 200, 240,  40}},
-{{ 340, 340, 340, 340, 340},{ 340, -90, 200,  70,  10},{ 340, 200, 200, 200, 200},{ 340, -50, 200, 110, -30},{ 340, -90, 200,   0, -350}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340,  80, 200, 210,  10},{ 340,  40, 200, 120, -220},{ 340, 110, 200, 190,  30}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 150,   0, 210},{ 340, 200,  40, -150,  70},{ 340, 200,  90, -30, 190},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  90, -100, 110},{ 340, 200,  90,   0, 110},{ 340, 200, 200, 200, 200},{ 340, 200,  90,   0, 110}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  90, -30, 190},{ 340, 200, 200, 200, 200},{ 340, 200,  80, -70, 150},{ 340, 200, -90, -390,  10}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200,  60, -30,  80},{ 340, 200,  40, -260, 140},{ 340, 200,   0, -10,  30}}
-}
-},
-/* GC....AU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 180,  70, 200},{ 340, 190, 160,  50, 200},{ 340,  90,  60, -50, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 170,  60, 200},{ 340, 240, 150, 140, 200},{ 340, 200, 200, 200, 200},{ 340, 240, 150, 140, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  90,  60, -50, 200},{ 340, 200, 200, 200, 200},{ 340, 140, 110,   0, 200},{ 340,  70, -60,  10, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 150, 140, 200},{ 340, 170,  40, 110, 200},{ 340, 200,  70, 150, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 250, 200, 250},{ 340, 160, 160, 200, 170},{ 340,  60, 160, 200, 170},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 170, 200, 180},{ 340, 160, 160, 200, 160},{ 340, 200, 200, 200, 200},{ 340, 160, 160, 200, 160}},
-{{ 340, 340, 340, 340, 340},{ 340,  60, 160, 200, 170},{ 340, 200, 200, 200, 200},{ 340, 120, 180, 200, 180},{ 340, -50,  50, 200,  50}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 160, 160, 200, 160},{ 340,  40, 140, 200, 150},{ 340,  80,  80, 200,  80}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340,  10, 200, 180,  40},{ 340, -10, 200, 150, -90},{ 340, -110, 200,  50, -10},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,   0, 200, 160, -80},{ 340,  80, 200, 210,  10},{ 340, 200, 200, 200, 200},{ 340,  80, 200, 210,  10}},
-{{ 340, 340, 340, 340, 340},{ 340, -110, 200,  50, -10},{ 340, 200, 200, 200, 200},{ 340, -60, 200, 110, -30},{ 340, -50, 200,  40, -310}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340,  80, 200, 210,  10},{ 340,  50, 200, 130, -210},{ 340,  80, 200, 170,  10}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 150,   0, 210},{ 340, 200,  60, -130,  90},{ 340, 200,  70, -50, 170},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  70, -120, 100},{ 340, 200,  60, -30,  80},{ 340, 200, 200, 200, 200},{ 340, 200,  60, -30,  80}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  70, -50, 170},{ 340, 200, 200, 200, 200},{ 340, 200,  80, -70, 140},{ 340, 200, -50, -350,  50}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200,  60, -30,  80},{ 340, 200,  50, -250, 150},{ 340, 200, -20, -30,   0}}
-}
-},
-/* GC....UA */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 180,  70, 200},{ 340, 170, 140,  30, 200},{ 340, 110,  80, -30, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 180,  70, 200},{ 340, 270, 180, 170, 200},{ 340, 200, 200, 200, 200},{ 340, 270, 180, 170, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 110,  80, -30, 200},{ 340, 200, 200, 200, 200},{ 340, 150, 120,  10, 200},{ 340,  30, -100, -30, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 150, 140, 200},{ 340, 160,  30, 100, 200},{ 340, 230, 100, 170, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 250, 200, 250},{ 340, 140, 140, 200, 150},{ 340,  80, 180, 200, 190},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 190, 200, 190},{ 340, 190, 190, 200, 190},{ 340, 200, 200, 200, 200},{ 340, 190, 190, 200, 190}},
-{{ 340, 340, 340, 340, 340},{ 340,  80, 180, 200, 190},{ 340, 200, 200, 200, 200},{ 340, 120, 180, 200, 190},{ 340, -90,  10, 200,  10}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 160, 160, 200, 160},{ 340,  30, 130, 200, 140},{ 340, 100, 100, 200, 110}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340,  10, 200, 180,  40},{ 340, -30, 200, 130, -110},{ 340, -90, 200,  70,  10},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  10, 200, 180, -60},{ 340, 110, 200, 240,  40},{ 340, 200, 200, 200, 200},{ 340, 110, 200, 240,  40}},
-{{ 340, 340, 340, 340, 340},{ 340, -90, 200,  70,  10},{ 340, 200, 200, 200, 200},{ 340, -50, 200, 110, -30},{ 340, -90, 200,   0, -350}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340,  80, 200, 210,  10},{ 340,  40, 200, 120, -220},{ 340, 110, 200, 190,  30}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 150,   0, 210},{ 340, 200,  40, -150,  70},{ 340, 200,  90, -30, 190},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  90, -100, 110},{ 340, 200,  90,   0, 110},{ 340, 200, 200, 200, 200},{ 340, 200,  90,   0, 110}},
-{{ 340, 340, 340, 340, 340},{ 340, 200,  90, -30, 190},{ 340, 200, 200, 200, 200},{ 340, 200,  80, -70, 150},{ 340, 200, -90, -390,  10}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200,  60, -30,  80},{ 340, 200,  40, -260, 140},{ 340, 200,   0, -10,  30}}
-}
-},
-/* GC....?? */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-}
-},
-{ /* noPair */ {{{{0}}}},
-/* GU....CG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 190,  80, 200},{ 340, 190, 180,  70, 200},{ 340, 100,  90, -20, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 240, 220, 110, 200},{ 340, 280, 210, 200, 200},{ 340, 200, 200, 200, 200},{ 340, 270, 190, 180, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 100,  90, -20, 200},{ 340, 200, 200, 200, 200},{ 340, 180, 160,  50, 200},{ 340,  30, -80, -10, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 270, 190, 180, 200},{ 340, 180,  70, 140, 200},{ 340, 220, 100, 180, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 180, 230, 200, 230},{ 340, 170, 160, 200, 160},{ 340,  80, 170, 200, 170},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 210, 200, 210},{ 340, 200, 190, 200, 190},{ 340, 200, 200, 200, 200},{ 340, 180, 180, 200, 180}},
-{{ 340, 340, 340, 340, 340},{ 340,  80, 170, 200, 170},{ 340, 200, 200, 200, 200},{ 340, 150, 210, 200, 210},{ 340, -90,   0, 200,   0}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 180, 180, 200, 180},{ 340,  60, 150, 200, 150},{ 340,  90,  90, 200,  90}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340,  80, 200, 130, 160},{ 340,  70, 200, 120,  50},{ 340, -20, 200,  30, 140},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 110, 200, 170,  90},{ 340, 200, 200, 210, 180},{ 340, 200, 200, 200, 200},{ 340, 180, 200, 200, 160}},
-{{ 340, 340, 340, 340, 340},{ 340, -20, 200,  30, 140},{ 340, 200, 200, 200, 200},{ 340,  50, 200, 110, 130},{ 340, -10, 200, -40, -210}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 180, 200, 200, 160},{ 340, 140, 200, 110, -60},{ 340, 180, 200, 150, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 230,  60, 190},{ 340, 200, 160, -50,  80},{ 340, 200, 170,  40, 180},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 210,   0, 130},{ 340, 200, 190,  80, 110},{ 340, 200, 200, 200, 200},{ 340, 200, 180,  70, 100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 170,  40, 180},{ 340, 200, 200, 200, 200},{ 340, 200, 210,  40, 170},{ 340, 200,   0, -310,   0}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 180,  70, 100},{ 340, 200, 150, -160, 160},{ 340, 200,  90,  60,  10}}
-}
-},
-/* GU....GC */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 200,  90, 200},{ 340, 190, 170,  60, 200},{ 340,  10,   0, -110, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 180, 170,  60, 200},{ 340, 250, 170, 160, 200},{ 340, 200, 200, 200, 200},{ 340, 150,  70,  70, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  70,  60, -50, 200},{ 340, 200, 200, 200, 200},{ 340, 180, 160,  50, 200},{ 340,   0, -120, -50, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 250, 180, 170, 200},{ 340,  40, -80, -10, 200},{ 340, 210, 100, 170, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 240, 200, 240},{ 340, 160, 160, 200, 160},{ 340, -10,  80, 200,  80},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 160, 150, 200, 150},{ 340, 160, 160, 200, 160},{ 340, 200, 200, 200, 200},{ 340,  60,  60, 200,  60}},
-{{ 340, 340, 340, 340, 340},{ 340,  50, 140, 200, 140},{ 340, 200, 200, 200, 200},{ 340, 150, 210, 200, 210},{ 340, -130, -30, 200, -30}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 170, 160, 200, 160},{ 340, -90,  10, 200,  10},{ 340,  90,  80, 200,  80}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340,  90, 200, 140, 170},{ 340,  60, 200, 120,  40},{ 340, -110, 200, -60,  50},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  60, 200, 110,  40},{ 340, 160, 200, 180, 140},{ 340, 200, 200, 200, 200},{ 340,  70, 200,  80,  50}},
-{{ 340, 340, 340, 340, 340},{ 340, -50, 200,   0, 110},{ 340, 200, 200, 200, 200},{ 340,  50, 200, 110, 130},{ 340, -50, 200, -70, -250}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 170, 200, 180, 150},{ 340, -10, 200, -30, -210},{ 340, 170, 200, 140, 150}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240,  70, 200},{ 340, 200, 160, -50,  80},{ 340, 200,  80, -50,  80},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 150, -60,  70},{ 340, 200, 160,  50,  80},{ 340, 200, 200, 200, 200},{ 340, 200,  60, -50, -20}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 140,  10, 150},{ 340, 200, 200, 200, 200},{ 340, 200, 210,  40, 170},{ 340, 200, -30, -350, -30}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 160,  50,  80},{ 340, 200,  10, -310,  10},{ 340, 200,  80,  50,   0}}
-}
-},
-/* GU....GU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 250, 240, 130, 200},{ 340, 150, 140,  30, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 260, 250, 140, 200},{ 340, 310, 230, 220, 200},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 140,  30, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 190,  80, 200},{ 340, 130,  20,  90, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200},{ 340, 230, 120, 190, 200},{ 340, 270, 150, 220, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 310, 200, 310},{ 340, 230, 220, 200, 220},{ 340, 130, 220, 200, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 240, 230, 200, 230},{ 340, 220, 220, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 220, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 180, 240, 200, 240},{ 340,  10, 100, 200, 100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220},{ 340, 110, 200, 200, 200},{ 340, 140, 140, 200, 140}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 230},{ 340, 130, 200, 180, 110},{ 340,  30, 200,  80, 190},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 140, 200, 190, 120},{ 340, 220, 200, 240, 200},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  30, 200,  80, 190},{ 340, 200, 200, 200, 200},{ 340,  80, 200, 140, 160},{ 340,  90, 200,  70, -110}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200},{ 340, 190, 200, 160, -10},{ 340, 220, 200, 200, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 310, 130, 270},{ 340, 200, 220,  10, 140},{ 340, 200, 220,  90, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 230,  20, 150},{ 340, 200, 220, 100, 140},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 220,  90, 220},{ 340, 200, 200, 200, 200},{ 340, 200, 240,  70, 200},{ 340, 200, 100, -210, 110}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140},{ 340, 200, 200, -110, 200},{ 340, 200, 140, 110,  60}}
-}
-},
-/* GU....UG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 230, 220, 110, 200},{ 340, 170, 160,  50, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 340, 260, 250, 200},{ 340, 200, 200, 200, 200},{ 340, 340, 260, 250, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 160,  50, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 200,  90, 200},{ 340, 100, -20,  50, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200},{ 340, 220, 110, 180, 200},{ 340, 290, 180, 250, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 310, 200, 310},{ 340, 210, 200, 200, 200},{ 340, 150, 240, 200, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 250, 200, 250},{ 340, 250, 250, 200, 250},{ 340, 200, 200, 200, 200},{ 340, 250, 250, 200, 250}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 240, 200, 240},{ 340, 200, 200, 200, 200},{ 340, 190, 240, 200, 240},{ 340, -30,  70, 200,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220},{ 340, 100, 190, 200, 190},{ 340, 170, 160, 200, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 230},{ 340, 110, 200, 160,  90},{ 340,  50, 200, 100, 210},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 130},{ 340, 250, 200, 270, 230},{ 340, 200, 200, 200, 200},{ 340, 250, 200, 270, 230}},
-{{ 340, 340, 340, 340, 340},{ 340,  50, 200, 100, 210},{ 340, 200, 200, 200, 200},{ 340,  90, 200, 140, 170},{ 340,  50, 200,  30, -150}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200},{ 340, 180, 200, 150, -20},{ 340, 250, 200, 220, 230}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 310, 130, 270},{ 340, 200, 200, -10, 120},{ 340, 200, 240, 110, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 250,  30, 170},{ 340, 200, 250, 130, 170},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 130, 170}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, 110, 240},{ 340, 200, 200, 200, 200},{ 340, 200, 240,  70, 200},{ 340, 200,  70, -250,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140},{ 340, 200, 190, -120, 190},{ 340, 200, 160, 130,  80}}
-}
-},
-/* GU....AU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 250, 240, 130, 200},{ 340, 150, 140,  30, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 260, 250, 140, 200},{ 340, 310, 230, 220, 200},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 140,  30, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 190,  80, 200},{ 340, 130,  20,  90, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200},{ 340, 230, 120, 190, 200},{ 340, 270, 150, 220, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 310, 200, 310},{ 340, 230, 220, 200, 220},{ 340, 130, 220, 200, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 240, 230, 200, 230},{ 340, 220, 220, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 220, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 180, 240, 200, 240},{ 340,  10, 100, 200, 100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220},{ 340, 110, 200, 200, 200},{ 340, 140, 140, 200, 140}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 230},{ 340, 130, 200, 180, 110},{ 340,  30, 200,  80, 190},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 140, 200, 190, 120},{ 340, 220, 200, 240, 200},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  30, 200,  80, 190},{ 340, 200, 200, 200, 200},{ 340,  80, 200, 140, 160},{ 340,  90, 200,  70, -110}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200},{ 340, 190, 200, 160, -10},{ 340, 220, 200, 200, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 310, 130, 270},{ 340, 200, 220,  10, 140},{ 340, 200, 220,  90, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 230,  20, 150},{ 340, 200, 220, 100, 140},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 220,  90, 220},{ 340, 200, 200, 200, 200},{ 340, 200, 240,  70, 200},{ 340, 200, 100, -210, 110}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140},{ 340, 200, 200, -110, 200},{ 340, 200, 140, 110,  60}}
-}
-},
-/* GU....UA */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 230, 220, 110, 200},{ 340, 170, 160,  50, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 340, 260, 250, 200},{ 340, 200, 200, 200, 200},{ 340, 340, 260, 250, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 160,  50, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 200,  90, 200},{ 340, 100, -20,  50, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200},{ 340, 220, 110, 180, 200},{ 340, 290, 180, 250, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 310, 200, 310},{ 340, 210, 200, 200, 200},{ 340, 150, 240, 200, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 250, 200, 250},{ 340, 250, 250, 200, 250},{ 340, 200, 200, 200, 200},{ 340, 250, 250, 200, 250}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 240, 200, 240},{ 340, 200, 200, 200, 200},{ 340, 190, 240, 200, 240},{ 340, -30,  70, 200,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220},{ 340, 100, 190, 200, 190},{ 340, 170, 160, 200, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 230},{ 340, 110, 200, 160,  90},{ 340,  50, 200, 100, 210},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 130},{ 340, 250, 200, 270, 230},{ 340, 200, 200, 200, 200},{ 340, 250, 200, 270, 230}},
-{{ 340, 340, 340, 340, 340},{ 340,  50, 200, 100, 210},{ 340, 200, 200, 200, 200},{ 340,  90, 200, 140, 170},{ 340,  50, 200,  30, -150}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200},{ 340, 180, 200, 150, -20},{ 340, 250, 200, 220, 230}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 310, 130, 270},{ 340, 200, 200, -10, 120},{ 340, 200, 240, 110, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 250,  30, 170},{ 340, 200, 250, 130, 170},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 130, 170}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, 110, 240},{ 340, 200, 200, 200, 200},{ 340, 200, 240,  70, 200},{ 340, 200,  70, -250,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140},{ 340, 200, 190, -120, 190},{ 340, 200, 160, 130,  80}}
-}
-},
-/* GU....?? */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-}
-},
-{ /* noPair */ {{{{0}}}},
-/* UG....CG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 100, 200},{ 340, 190, 190,  90, 200},{ 340, 100, 100,   0, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 240, 240, 130, 200},{ 340, 280, 220, 220, 200},{ 340, 200, 200, 200, 200},{ 340, 270, 210, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 100,   0, 200},{ 340, 200, 200, 200, 200},{ 340, 180, 180,  70, 200},{ 340,  30, -70,  10, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 270, 210, 200, 200},{ 340, 180,  80, 160, 200},{ 340, 220, 120, 190, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 160, 260, 200, 230},{ 340, 150, 190, 200, 160},{ 340,  60, 200, 200, 170},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 240, 200, 210},{ 340, 180, 220, 200, 190},{ 340, 200, 200, 200, 200},{ 340, 160, 210, 200, 180}},
-{{ 340, 340, 340, 340, 340},{ 340,  60, 200, 200, 170},{ 340, 200, 200, 200, 200},{ 340, 130, 240, 200, 210},{ 340, -110,  30, 200,   0}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 160, 210, 200, 180},{ 340,  40, 180, 200, 150},{ 340,  70, 120, 200,  90}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 200, 140, 150},{ 340,  90, 200, 130,  40},{ 340,   0, 200,  40, 130},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 200, 170,  80},{ 340, 220, 200, 220, 170},{ 340, 200, 200, 200, 200},{ 340, 200, 200, 200, 150}},
-{{ 340, 340, 340, 340, 340},{ 340,   0, 200,  40, 130},{ 340, 200, 200, 200, 200},{ 340,  70, 200, 110, 120},{ 340,  10, 200, -30, -220}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 200, 200, 150},{ 340, 160, 200, 120, -70},{ 340, 190, 200, 150, 150}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 260,  20, 220},{ 340, 200, 190, -90, 110},{ 340, 200, 200,   0, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, -40, 150},{ 340, 200, 220,  40, 140},{ 340, 200, 200, 200, 200},{ 340, 200, 210,  30, 120}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200,   0, 200},{ 340, 200, 200, 200, 200},{ 340, 200, 240,   0, 190},{ 340, 200,  30, -350,  30}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 210,  30, 120},{ 340, 200, 180, -200, 180},{ 340, 200, 120,  20,  30}}
-}
-},
-/* UG....GC */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 210, 110, 200},{ 340, 190, 190,  80, 200},{ 340,  10,  10, -90, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 180, 180,  80, 200},{ 340, 250, 190, 180, 200},{ 340, 200, 200, 200, 200},{ 340, 150,  90,  90, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  70,  70, -30, 200},{ 340, 200, 200, 200, 200},{ 340, 180, 180,  70, 200},{ 340,   0, -100, -30, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 250, 190, 190, 200},{ 340,  40, -60,  10, 200},{ 340, 210, 110, 190, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 270, 200, 240},{ 340, 140, 190, 200, 160},{ 340, -30, 110, 200,  80},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 140, 180, 200, 150},{ 340, 140, 190, 200, 160},{ 340, 200, 200, 200, 200},{ 340,  40,  90, 200,  60}},
-{{ 340, 340, 340, 340, 340},{ 340,  30, 170, 200, 140},{ 340, 200, 200, 200, 200},{ 340, 130, 240, 200, 210},{ 340, -150,   0, 200, -30}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 150, 190, 200, 160},{ 340, -110,  40, 200,  10},{ 340,  70, 110, 200,  80}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 110, 200, 150, 160},{ 340,  80, 200, 120,  30},{ 340, -90, 200, -50,  40},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  80, 200, 120,  30},{ 340, 180, 200, 180, 130},{ 340, 200, 200, 200, 200},{ 340,  90, 200,  80,  40}},
-{{ 340, 340, 340, 340, 340},{ 340, -30, 200,  10, 100},{ 340, 200, 200, 200, 200},{ 340,  70, 200, 110, 120},{ 340, -30, 200, -70, -260}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 190, 200, 190, 140},{ 340,  10, 200, -30, -220},{ 340, 190, 200, 150, 140}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 270,  30, 230},{ 340, 200, 190, -90, 100},{ 340, 200, 110, -90, 110},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 180, -100, 100},{ 340, 200, 190,  10, 100},{ 340, 200, 200, 200, 200},{ 340, 200,  90, -90,   0}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 170, -30, 170},{ 340, 200, 200, 200, 200},{ 340, 200, 240,   0, 190},{ 340, 200,   0, -390, -10}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 190,  10, 110},{ 340, 200,  40, -350,  30},{ 340, 200, 110,  10,  30}}
-}
-},
-/* UG....GU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 250, 250, 150, 200},{ 340, 150, 150,  50, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 260, 260, 160, 200},{ 340, 310, 250, 240, 200},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 150,  50, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 210, 100, 200},{ 340, 130,  30, 110, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200},{ 340, 230, 130, 210, 200},{ 340, 270, 170, 240, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 340, 200, 310},{ 340, 210, 250, 200, 220},{ 340, 110, 250, 200, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 220, 260, 200, 230},{ 340, 200, 250, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220}},
-{{ 340, 340, 340, 340, 340},{ 340, 110, 250, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 160, 270, 200, 240},{ 340, -10, 130, 200, 100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220},{ 340,  90, 230, 200, 200},{ 340, 120, 170, 200, 140}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 220},{ 340, 150, 200, 190, 100},{ 340,  50, 200,  90, 180},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 160, 200, 200, 110},{ 340, 240, 200, 240, 190},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190}},
-{{ 340, 340, 340, 340, 340},{ 340,  50, 200,  90, 180},{ 340, 200, 200, 200, 200},{ 340, 100, 200, 140, 150},{ 340, 110, 200,  70, -120}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190},{ 340, 210, 200, 170, -20},{ 340, 240, 200, 200, 190}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 340, 100, 290},{ 340, 200, 250, -30, 170},{ 340, 200, 250,  50, 250},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 260, -20, 180},{ 340, 200, 250,  70, 160},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 250,  50, 250},{ 340, 200, 200, 200, 200},{ 340, 200, 270,  30, 220},{ 340, 200, 130, -250, 130}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160},{ 340, 200, 230, -150, 230},{ 340, 200, 170,  70,  80}}
-}
-},
-/* UG....UG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 230, 230, 130, 200},{ 340, 170, 170,  70, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 340, 280, 270, 200},{ 340, 200, 200, 200, 200},{ 340, 340, 280, 270, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 170,  70, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 210, 110, 200},{ 340, 100,   0,  70, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200},{ 340, 220, 120, 200, 200},{ 340, 290, 190, 270, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 340, 200, 310},{ 340, 190, 230, 200, 200},{ 340, 130, 270, 200, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 280, 200, 250},{ 340, 230, 280, 200, 250},{ 340, 200, 200, 200, 200},{ 340, 230, 280, 200, 250}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 270, 200, 240},{ 340, 200, 200, 200, 200},{ 340, 170, 270, 200, 240},{ 340, -50, 100, 200,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220},{ 340,  80, 220, 200, 190},{ 340, 150, 190, 200, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 220},{ 340, 130, 200, 170,  80},{ 340,  70, 200, 110, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 120},{ 340, 270, 200, 270, 220},{ 340, 200, 200, 200, 200},{ 340, 270, 200, 270, 220}},
-{{ 340, 340, 340, 340, 340},{ 340,  70, 200, 110, 200},{ 340, 200, 200, 200, 200},{ 340, 110, 200, 150, 160},{ 340,  70, 200,  30, -160}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190},{ 340, 200, 200, 160, -30},{ 340, 270, 200, 230, 220}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 340, 100, 290},{ 340, 200, 230, -50, 150},{ 340, 200, 270,  70, 270},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 280,   0, 190},{ 340, 200, 280, 100, 190},{ 340, 200, 200, 200, 200},{ 340, 200, 280, 100, 190}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 270,  70, 270},{ 340, 200, 200, 200, 200},{ 340, 200, 270,  30, 230},{ 340, 200, 100, -290,  90}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160},{ 340, 200, 220, -160, 220},{ 340, 200, 190,  90, 110}}
-}
-},
-/* UG....AU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 250, 250, 150, 200},{ 340, 150, 150,  50, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 260, 260, 160, 200},{ 340, 310, 250, 240, 200},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 150,  50, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 210, 100, 200},{ 340, 130,  30, 110, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200},{ 340, 230, 130, 210, 200},{ 340, 270, 170, 240, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 340, 200, 310},{ 340, 210, 250, 200, 220},{ 340, 110, 250, 200, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 220, 260, 200, 230},{ 340, 200, 250, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220}},
-{{ 340, 340, 340, 340, 340},{ 340, 110, 250, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 160, 270, 200, 240},{ 340, -10, 130, 200, 100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220},{ 340,  90, 230, 200, 200},{ 340, 120, 170, 200, 140}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 220},{ 340, 150, 200, 190, 100},{ 340,  50, 200,  90, 180},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 160, 200, 200, 110},{ 340, 240, 200, 240, 190},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190}},
-{{ 340, 340, 340, 340, 340},{ 340,  50, 200,  90, 180},{ 340, 200, 200, 200, 200},{ 340, 100, 200, 140, 150},{ 340, 110, 200,  70, -120}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190},{ 340, 210, 200, 170, -20},{ 340, 240, 200, 200, 190}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 340, 100, 290},{ 340, 200, 250, -30, 170},{ 340, 200, 250,  50, 250},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 260, -20, 180},{ 340, 200, 250,  70, 160},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 250,  50, 250},{ 340, 200, 200, 200, 200},{ 340, 200, 270,  30, 220},{ 340, 200, 130, -250, 130}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160},{ 340, 200, 230, -150, 230},{ 340, 200, 170,  70,  80}}
-}
-},
-/* UG....UA */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 230, 230, 130, 200},{ 340, 170, 170,  70, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 340, 280, 270, 200},{ 340, 200, 200, 200, 200},{ 340, 340, 280, 270, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 170,  70, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 210, 110, 200},{ 340, 100,   0,  70, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200},{ 340, 220, 120, 200, 200},{ 340, 290, 190, 270, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 340, 200, 310},{ 340, 190, 230, 200, 200},{ 340, 130, 270, 200, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 280, 200, 250},{ 340, 230, 280, 200, 250},{ 340, 200, 200, 200, 200},{ 340, 230, 280, 200, 250}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 270, 200, 240},{ 340, 200, 200, 200, 200},{ 340, 170, 270, 200, 240},{ 340, -50, 100, 200,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220},{ 340,  80, 220, 200, 190},{ 340, 150, 190, 200, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 220},{ 340, 130, 200, 170,  80},{ 340,  70, 200, 110, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 120},{ 340, 270, 200, 270, 220},{ 340, 200, 200, 200, 200},{ 340, 270, 200, 270, 220}},
-{{ 340, 340, 340, 340, 340},{ 340,  70, 200, 110, 200},{ 340, 200, 200, 200, 200},{ 340, 110, 200, 150, 160},{ 340,  70, 200,  30, -160}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190},{ 340, 200, 200, 160, -30},{ 340, 270, 200, 230, 220}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 340, 100, 290},{ 340, 200, 230, -50, 150},{ 340, 200, 270,  70, 270},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 280,   0, 190},{ 340, 200, 280, 100, 190},{ 340, 200, 200, 200, 200},{ 340, 200, 280, 100, 190}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 270,  70, 270},{ 340, 200, 200, 200, 200},{ 340, 200, 270,  30, 230},{ 340, 200, 100, -290,  90}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160},{ 340, 200, 220, -160, 220},{ 340, 200, 190,  90, 110}}
-}
-},
-/* UG....?? */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-}
-},
-{ /* noPair */ {{{{0}}}},
-/* AU....CG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 190,  80, 200},{ 340, 190, 180,  70, 200},{ 340, 100,  90, -20, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 240, 220, 110, 200},{ 340, 280, 210, 200, 200},{ 340, 200, 200, 200, 200},{ 340, 270, 190, 180, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 100,  90, -20, 200},{ 340, 200, 200, 200, 200},{ 340, 180, 160,  50, 200},{ 340,  30, -80, -10, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 270, 190, 180, 200},{ 340, 180,  70, 140, 200},{ 340, 220, 100, 180, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 180, 230, 200, 230},{ 340, 170, 160, 200, 160},{ 340,  80, 170, 200, 170},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 210, 200, 210},{ 340, 200, 190, 200, 190},{ 340, 200, 200, 200, 200},{ 340, 180, 180, 200, 180}},
-{{ 340, 340, 340, 340, 340},{ 340,  80, 170, 200, 170},{ 340, 200, 200, 200, 200},{ 340, 150, 210, 200, 210},{ 340, -90,   0, 200,   0}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 180, 180, 200, 180},{ 340,  60, 150, 200, 150},{ 340,  90,  90, 200,  90}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340,  80, 200, 130, 160},{ 340,  70, 200, 120,  50},{ 340, -20, 200,  30, 140},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 110, 200, 170,  90},{ 340, 200, 200, 210, 180},{ 340, 200, 200, 200, 200},{ 340, 180, 200, 200, 160}},
-{{ 340, 340, 340, 340, 340},{ 340, -20, 200,  30, 140},{ 340, 200, 200, 200, 200},{ 340,  50, 200, 110, 130},{ 340, -10, 200, -40, -210}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 180, 200, 200, 160},{ 340, 140, 200, 110, -60},{ 340, 180, 200, 150, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 230,  60, 190},{ 340, 200, 160, -50,  80},{ 340, 200, 170,  40, 180},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 210,   0, 130},{ 340, 200, 190,  80, 110},{ 340, 200, 200, 200, 200},{ 340, 200, 180,  70, 100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 170,  40, 180},{ 340, 200, 200, 200, 200},{ 340, 200, 210,  40, 170},{ 340, 200,   0, -310,   0}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 180,  70, 100},{ 340, 200, 150, -160, 160},{ 340, 200,  90,  60,  10}}
-}
-},
-/* AU....GC */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 200,  90, 200},{ 340, 190, 170,  60, 200},{ 340,  10,   0, -110, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 180, 170,  60, 200},{ 340, 250, 170, 160, 200},{ 340, 200, 200, 200, 200},{ 340, 150,  70,  70, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  70,  60, -50, 200},{ 340, 200, 200, 200, 200},{ 340, 180, 160,  50, 200},{ 340,   0, -120, -50, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 250, 180, 170, 200},{ 340,  40, -80, -10, 200},{ 340, 210, 100, 170, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 240, 200, 240},{ 340, 160, 160, 200, 160},{ 340, -10,  80, 200,  80},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 160, 150, 200, 150},{ 340, 160, 160, 200, 160},{ 340, 200, 200, 200, 200},{ 340,  60,  60, 200,  60}},
-{{ 340, 340, 340, 340, 340},{ 340,  50, 140, 200, 140},{ 340, 200, 200, 200, 200},{ 340, 150, 210, 200, 210},{ 340, -130, -30, 200, -30}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 170, 160, 200, 160},{ 340, -90,  10, 200,  10},{ 340,  90,  80, 200,  80}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340,  90, 200, 140, 170},{ 340,  60, 200, 120,  40},{ 340, -110, 200, -60,  50},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  60, 200, 110,  40},{ 340, 160, 200, 180, 140},{ 340, 200, 200, 200, 200},{ 340,  70, 200,  80,  50}},
-{{ 340, 340, 340, 340, 340},{ 340, -50, 200,   0, 110},{ 340, 200, 200, 200, 200},{ 340,  50, 200, 110, 130},{ 340, -50, 200, -70, -250}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 170, 200, 180, 150},{ 340, -10, 200, -30, -210},{ 340, 170, 200, 140, 150}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240,  70, 200},{ 340, 200, 160, -50,  80},{ 340, 200,  80, -50,  80},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 150, -60,  70},{ 340, 200, 160,  50,  80},{ 340, 200, 200, 200, 200},{ 340, 200,  60, -50, -20}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 140,  10, 150},{ 340, 200, 200, 200, 200},{ 340, 200, 210,  40, 170},{ 340, 200, -30, -350, -30}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 160,  50,  80},{ 340, 200,  10, -310,  10},{ 340, 200,  80,  50,   0}}
-}
-},
-/* AU....GU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 250, 240, 130, 200},{ 340, 150, 140,  30, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 260, 250, 140, 200},{ 340, 310, 230, 220, 200},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 140,  30, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 190,  80, 200},{ 340, 130,  20,  90, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200},{ 340, 230, 120, 190, 200},{ 340, 270, 150, 220, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 310, 200, 310},{ 340, 230, 220, 200, 220},{ 340, 130, 220, 200, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 240, 230, 200, 230},{ 340, 220, 220, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 220, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 180, 240, 200, 240},{ 340,  10, 100, 200, 100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220},{ 340, 110, 200, 200, 200},{ 340, 140, 140, 200, 140}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 230},{ 340, 130, 200, 180, 110},{ 340,  30, 200,  80, 190},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 140, 200, 190, 120},{ 340, 220, 200, 240, 200},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  30, 200,  80, 190},{ 340, 200, 200, 200, 200},{ 340,  80, 200, 140, 160},{ 340,  90, 200,  70, -110}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200},{ 340, 190, 200, 160, -10},{ 340, 220, 200, 200, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 310, 130, 270},{ 340, 200, 220,  10, 140},{ 340, 200, 220,  90, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 230,  20, 150},{ 340, 200, 220, 100, 140},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 220,  90, 220},{ 340, 200, 200, 200, 200},{ 340, 200, 240,  70, 200},{ 340, 200, 100, -210, 110}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140},{ 340, 200, 200, -110, 200},{ 340, 200, 140, 110,  60}}
-}
-},
-/* AU....UG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 230, 220, 110, 200},{ 340, 170, 160,  50, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 340, 260, 250, 200},{ 340, 200, 200, 200, 200},{ 340, 340, 260, 250, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 160,  50, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 200,  90, 200},{ 340, 100, -20,  50, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200},{ 340, 220, 110, 180, 200},{ 340, 290, 180, 250, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 310, 200, 310},{ 340, 210, 200, 200, 200},{ 340, 150, 240, 200, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 250, 200, 250},{ 340, 250, 250, 200, 250},{ 340, 200, 200, 200, 200},{ 340, 250, 250, 200, 250}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 240, 200, 240},{ 340, 200, 200, 200, 200},{ 340, 190, 240, 200, 240},{ 340, -30,  70, 200,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220},{ 340, 100, 190, 200, 190},{ 340, 170, 160, 200, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 230},{ 340, 110, 200, 160,  90},{ 340,  50, 200, 100, 210},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 130},{ 340, 250, 200, 270, 230},{ 340, 200, 200, 200, 200},{ 340, 250, 200, 270, 230}},
-{{ 340, 340, 340, 340, 340},{ 340,  50, 200, 100, 210},{ 340, 200, 200, 200, 200},{ 340,  90, 200, 140, 170},{ 340,  50, 200,  30, -150}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200},{ 340, 180, 200, 150, -20},{ 340, 250, 200, 220, 230}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 310, 130, 270},{ 340, 200, 200, -10, 120},{ 340, 200, 240, 110, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 250,  30, 170},{ 340, 200, 250, 130, 170},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 130, 170}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, 110, 240},{ 340, 200, 200, 200, 200},{ 340, 200, 240,  70, 200},{ 340, 200,  70, -250,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140},{ 340, 200, 190, -120, 190},{ 340, 200, 160, 130,  80}}
-}
-},
-/* AU....AU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 250, 240, 130, 200},{ 340, 150, 140,  30, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 260, 250, 140, 200},{ 340, 310, 230, 220, 200},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 140,  30, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 190,  80, 200},{ 340, 130,  20,  90, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200},{ 340, 230, 120, 190, 200},{ 340, 270, 150, 220, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 310, 200, 310},{ 340, 230, 220, 200, 220},{ 340, 130, 220, 200, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 240, 230, 200, 230},{ 340, 220, 220, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 220, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 180, 240, 200, 240},{ 340,  10, 100, 200, 100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220},{ 340, 110, 200, 200, 200},{ 340, 140, 140, 200, 140}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 230},{ 340, 130, 200, 180, 110},{ 340,  30, 200,  80, 190},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 140, 200, 190, 120},{ 340, 220, 200, 240, 200},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  30, 200,  80, 190},{ 340, 200, 200, 200, 200},{ 340,  80, 200, 140, 160},{ 340,  90, 200,  70, -110}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200},{ 340, 190, 200, 160, -10},{ 340, 220, 200, 200, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 310, 130, 270},{ 340, 200, 220,  10, 140},{ 340, 200, 220,  90, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 230,  20, 150},{ 340, 200, 220, 100, 140},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 220,  90, 220},{ 340, 200, 200, 200, 200},{ 340, 200, 240,  70, 200},{ 340, 200, 100, -210, 110}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140},{ 340, 200, 200, -110, 200},{ 340, 200, 140, 110,  60}}
-}
-},
-/* AU....UA */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 230, 220, 110, 200},{ 340, 170, 160,  50, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 260, 150, 200},{ 340, 340, 260, 250, 200},{ 340, 200, 200, 200, 200},{ 340, 340, 260, 250, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 160,  50, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 200,  90, 200},{ 340, 100, -20,  50, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 230, 220, 200},{ 340, 220, 110, 180, 200},{ 340, 290, 180, 250, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 310, 200, 310},{ 340, 210, 200, 200, 200},{ 340, 150, 240, 200, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 250, 250, 200, 250},{ 340, 250, 250, 200, 250},{ 340, 200, 200, 200, 200},{ 340, 250, 250, 200, 250}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 240, 200, 240},{ 340, 200, 200, 200, 200},{ 340, 190, 240, 200, 240},{ 340, -30,  70, 200,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 220, 200, 220},{ 340, 100, 190, 200, 190},{ 340, 170, 160, 200, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 230},{ 340, 110, 200, 160,  90},{ 340,  50, 200, 100, 210},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 200, 210, 130},{ 340, 250, 200, 270, 230},{ 340, 200, 200, 200, 200},{ 340, 250, 200, 270, 230}},
-{{ 340, 340, 340, 340, 340},{ 340,  50, 200, 100, 210},{ 340, 200, 200, 200, 200},{ 340,  90, 200, 140, 170},{ 340,  50, 200,  30, -150}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 220, 200, 240, 200},{ 340, 180, 200, 150, -20},{ 340, 250, 200, 220, 230}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 310, 130, 270},{ 340, 200, 200, -10, 120},{ 340, 200, 240, 110, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 250,  30, 170},{ 340, 200, 250, 130, 170},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 130, 170}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, 110, 240},{ 340, 200, 200, 200, 200},{ 340, 200, 240,  70, 200},{ 340, 200,  70, -250,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 220, 100, 140},{ 340, 200, 190, -120, 190},{ 340, 200, 160, 130,  80}}
-}
-},
-/* AU....?? */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-}
-},
-{ /* noPair */ {{{{0}}}},
-/* UA....CG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 100, 200},{ 340, 190, 190,  90, 200},{ 340, 100, 100,   0, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 240, 240, 130, 200},{ 340, 280, 220, 220, 200},{ 340, 200, 200, 200, 200},{ 340, 270, 210, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 100,   0, 200},{ 340, 200, 200, 200, 200},{ 340, 180, 180,  70, 200},{ 340,  30, -70,  10, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 270, 210, 200, 200},{ 340, 180,  80, 160, 200},{ 340, 220, 120, 190, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 160, 260, 200, 230},{ 340, 150, 190, 200, 160},{ 340,  60, 200, 200, 170},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 190, 240, 200, 210},{ 340, 180, 220, 200, 190},{ 340, 200, 200, 200, 200},{ 340, 160, 210, 200, 180}},
-{{ 340, 340, 340, 340, 340},{ 340,  60, 200, 200, 170},{ 340, 200, 200, 200, 200},{ 340, 130, 240, 200, 210},{ 340, -110,  30, 200,   0}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 160, 210, 200, 180},{ 340,  40, 180, 200, 150},{ 340,  70, 120, 200,  90}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 100, 200, 140, 150},{ 340,  90, 200, 130,  40},{ 340,   0, 200,  40, 130},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 200, 170,  80},{ 340, 220, 200, 220, 170},{ 340, 200, 200, 200, 200},{ 340, 200, 200, 200, 150}},
-{{ 340, 340, 340, 340, 340},{ 340,   0, 200,  40, 130},{ 340, 200, 200, 200, 200},{ 340,  70, 200, 110, 120},{ 340,  10, 200, -30, -220}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 200, 200, 150},{ 340, 160, 200, 120, -70},{ 340, 190, 200, 150, 150}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 260,  20, 220},{ 340, 200, 190, -90, 110},{ 340, 200, 200,   0, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 240, -40, 150},{ 340, 200, 220,  40, 140},{ 340, 200, 200, 200, 200},{ 340, 200, 210,  30, 120}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200,   0, 200},{ 340, 200, 200, 200, 200},{ 340, 200, 240,   0, 190},{ 340, 200,  30, -350,  30}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 210,  30, 120},{ 340, 200, 180, -200, 180},{ 340, 200, 120,  20,  30}}
-}
-},
-/* UA....GC */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 210, 210, 110, 200},{ 340, 190, 190,  80, 200},{ 340,  10,  10, -90, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 180, 180,  80, 200},{ 340, 250, 190, 180, 200},{ 340, 200, 200, 200, 200},{ 340, 150,  90,  90, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  70,  70, -30, 200},{ 340, 200, 200, 200, 200},{ 340, 180, 180,  70, 200},{ 340,   0, -100, -30, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 250, 190, 190, 200},{ 340,  40, -60,  10, 200},{ 340, 210, 110, 190, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 270, 200, 240},{ 340, 140, 190, 200, 160},{ 340, -30, 110, 200,  80},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 140, 180, 200, 150},{ 340, 140, 190, 200, 160},{ 340, 200, 200, 200, 200},{ 340,  40,  90, 200,  60}},
-{{ 340, 340, 340, 340, 340},{ 340,  30, 170, 200, 140},{ 340, 200, 200, 200, 200},{ 340, 130, 240, 200, 210},{ 340, -150,   0, 200, -30}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 150, 190, 200, 160},{ 340, -110,  40, 200,  10},{ 340,  70, 110, 200,  80}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 110, 200, 150, 160},{ 340,  80, 200, 120,  30},{ 340, -90, 200, -50,  40},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340,  80, 200, 120,  30},{ 340, 180, 200, 180, 130},{ 340, 200, 200, 200, 200},{ 340,  90, 200,  80,  40}},
-{{ 340, 340, 340, 340, 340},{ 340, -30, 200,  10, 100},{ 340, 200, 200, 200, 200},{ 340,  70, 200, 110, 120},{ 340, -30, 200, -70, -260}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 190, 200, 190, 140},{ 340,  10, 200, -30, -220},{ 340, 190, 200, 150, 140}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 270,  30, 230},{ 340, 200, 190, -90, 100},{ 340, 200, 110, -90, 110},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 180, -100, 100},{ 340, 200, 190,  10, 100},{ 340, 200, 200, 200, 200},{ 340, 200,  90, -90,   0}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 170, -30, 170},{ 340, 200, 200, 200, 200},{ 340, 200, 240,   0, 190},{ 340, 200,   0, -390, -10}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 190,  10, 110},{ 340, 200,  40, -350,  30},{ 340, 200, 110,  10,  30}}
-}
-},
-/* UA....GU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 250, 250, 150, 200},{ 340, 150, 150,  50, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 260, 260, 160, 200},{ 340, 310, 250, 240, 200},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 150,  50, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 210, 100, 200},{ 340, 130,  30, 110, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200},{ 340, 230, 130, 210, 200},{ 340, 270, 170, 240, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 340, 200, 310},{ 340, 210, 250, 200, 220},{ 340, 110, 250, 200, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 220, 260, 200, 230},{ 340, 200, 250, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220}},
-{{ 340, 340, 340, 340, 340},{ 340, 110, 250, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 160, 270, 200, 240},{ 340, -10, 130, 200, 100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220},{ 340,  90, 230, 200, 200},{ 340, 120, 170, 200, 140}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 220},{ 340, 150, 200, 190, 100},{ 340,  50, 200,  90, 180},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 160, 200, 200, 110},{ 340, 240, 200, 240, 190},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190}},
-{{ 340, 340, 340, 340, 340},{ 340,  50, 200,  90, 180},{ 340, 200, 200, 200, 200},{ 340, 100, 200, 140, 150},{ 340, 110, 200,  70, -120}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190},{ 340, 210, 200, 170, -20},{ 340, 240, 200, 200, 190}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 340, 100, 290},{ 340, 200, 250, -30, 170},{ 340, 200, 250,  50, 250},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 260, -20, 180},{ 340, 200, 250,  70, 160},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 250,  50, 250},{ 340, 200, 200, 200, 200},{ 340, 200, 270,  30, 220},{ 340, 200, 130, -250, 130}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160},{ 340, 200, 230, -150, 230},{ 340, 200, 170,  70,  80}}
-}
-},
-/* UA....UG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 230, 230, 130, 200},{ 340, 170, 170,  70, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 340, 280, 270, 200},{ 340, 200, 200, 200, 200},{ 340, 340, 280, 270, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 170,  70, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 210, 110, 200},{ 340, 100,   0,  70, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200},{ 340, 220, 120, 200, 200},{ 340, 290, 190, 270, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 340, 200, 310},{ 340, 190, 230, 200, 200},{ 340, 130, 270, 200, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 280, 200, 250},{ 340, 230, 280, 200, 250},{ 340, 200, 200, 200, 200},{ 340, 230, 280, 200, 250}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 270, 200, 240},{ 340, 200, 200, 200, 200},{ 340, 170, 270, 200, 240},{ 340, -50, 100, 200,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220},{ 340,  80, 220, 200, 190},{ 340, 150, 190, 200, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 220},{ 340, 130, 200, 170,  80},{ 340,  70, 200, 110, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 120},{ 340, 270, 200, 270, 220},{ 340, 200, 200, 200, 200},{ 340, 270, 200, 270, 220}},
-{{ 340, 340, 340, 340, 340},{ 340,  70, 200, 110, 200},{ 340, 200, 200, 200, 200},{ 340, 110, 200, 150, 160},{ 340,  70, 200,  30, -160}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190},{ 340, 200, 200, 160, -30},{ 340, 270, 200, 230, 220}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 340, 100, 290},{ 340, 200, 230, -50, 150},{ 340, 200, 270,  70, 270},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 280,   0, 190},{ 340, 200, 280, 100, 190},{ 340, 200, 200, 200, 200},{ 340, 200, 280, 100, 190}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 270,  70, 270},{ 340, 200, 200, 200, 200},{ 340, 200, 270,  30, 230},{ 340, 200, 100, -290,  90}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160},{ 340, 200, 220, -160, 220},{ 340, 200, 190,  90, 110}}
-}
-},
-/* UA....AU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 250, 250, 150, 200},{ 340, 150, 150,  50, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 260, 260, 160, 200},{ 340, 310, 250, 240, 200},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 150, 150,  50, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 210, 100, 200},{ 340, 130,  30, 110, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200},{ 340, 230, 130, 210, 200},{ 340, 270, 170, 240, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 340, 200, 310},{ 340, 210, 250, 200, 220},{ 340, 110, 250, 200, 220},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 220, 260, 200, 230},{ 340, 200, 250, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220}},
-{{ 340, 340, 340, 340, 340},{ 340, 110, 250, 200, 220},{ 340, 200, 200, 200, 200},{ 340, 160, 270, 200, 240},{ 340, -10, 130, 200, 100}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220},{ 340,  90, 230, 200, 200},{ 340, 120, 170, 200, 140}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 220},{ 340, 150, 200, 190, 100},{ 340,  50, 200,  90, 180},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 160, 200, 200, 110},{ 340, 240, 200, 240, 190},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190}},
-{{ 340, 340, 340, 340, 340},{ 340,  50, 200,  90, 180},{ 340, 200, 200, 200, 200},{ 340, 100, 200, 140, 150},{ 340, 110, 200,  70, -120}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190},{ 340, 210, 200, 170, -20},{ 340, 240, 200, 200, 190}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 340, 100, 290},{ 340, 200, 250, -30, 170},{ 340, 200, 250,  50, 250},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 260, -20, 180},{ 340, 200, 250,  70, 160},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 250,  50, 250},{ 340, 200, 200, 200, 200},{ 340, 200, 270,  30, 220},{ 340, 200, 130, -250, 130}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160},{ 340, 200, 230, -150, 230},{ 340, 200, 170,  70,  80}}
-}
-},
-/* UA....UA */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 230, 230, 130, 200},{ 340, 170, 170,  70, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 280, 280, 170, 200},{ 340, 340, 280, 270, 200},{ 340, 200, 200, 200, 200},{ 340, 340, 280, 270, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 170,  70, 200},{ 340, 200, 200, 200, 200},{ 340, 210, 210, 110, 200},{ 340, 100,   0,  70, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 310, 250, 240, 200},{ 340, 220, 120, 200, 200},{ 340, 290, 190, 270, 200}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 340, 200, 310},{ 340, 190, 230, 200, 200},{ 340, 130, 270, 200, 240},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 230, 280, 200, 250},{ 340, 230, 280, 200, 250},{ 340, 200, 200, 200, 200},{ 340, 230, 280, 200, 250}},
-{{ 340, 340, 340, 340, 340},{ 340, 130, 270, 200, 240},{ 340, 200, 200, 200, 200},{ 340, 170, 270, 200, 240},{ 340, -50, 100, 200,  70}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250, 200, 220},{ 340,  80, 220, 200, 190},{ 340, 150, 190, 200, 160}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 220},{ 340, 130, 200, 170,  80},{ 340,  70, 200, 110, 200},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 170, 200, 210, 120},{ 340, 270, 200, 270, 220},{ 340, 200, 200, 200, 200},{ 340, 270, 200, 270, 220}},
-{{ 340, 340, 340, 340, 340},{ 340,  70, 200, 110, 200},{ 340, 200, 200, 200, 200},{ 340, 110, 200, 150, 160},{ 340,  70, 200,  30, -160}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 240, 200, 240, 190},{ 340, 200, 200, 160, -30},{ 340, 270, 200, 230, 220}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 340, 100, 290},{ 340, 200, 230, -50, 150},{ 340, 200, 270,  70, 270},{ 340, 200, 200, 200, 200}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 280,   0, 190},{ 340, 200, 280, 100, 190},{ 340, 200, 200, 200, 200},{ 340, 200, 280, 100, 190}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 270,  70, 270},{ 340, 200, 200, 200, 200},{ 340, 200, 270,  30, 230},{ 340, 200, 100, -290,  90}},
-{{ 340, 340, 340, 340, 340},{ 340, 200, 200, 200, 200},{ 340, 200, 250,  70, 160},{ 340, 200, 220, -160, 220},{ 340, 200, 190,  90, 110}}
-}
-},
-/* UA....?? */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-}
-},
-{ /* noPair */ {{{{0}}}},
-/* ??....CG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-},
-/* ??....GC */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-},
-/* ??....GU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-},
-/* ??....UG */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-},
-/* ??....AU */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-},
-/* ??....UA */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-},
-/* ??....?? */
-{{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-},
-{
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}},
-{{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340},{ 340, 340, 340, 340, 340}}
-}
-}
-}
-};
-
-PRIVATE int int22_H_184[NBPAIRS+1][NBPAIRS+1][5][5][5][5] =
-{ /* noPair */ {{{{{0}}}}},
-{ /* noPair */ {{{{0}}}},
-/* CG.@@..CG */
-{ { { {  0, 0, 0, 0, 0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.@A..CG */
-{ {  0, 0, 0, 0, 0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* CG.@C..CG */
-{ {  0, 0, 0, 0, 0},
-{ -949, -949, -949, -949, -949},
-{ -449, -449, -449, -449, -449},
-{ -939, -939, -939, -939, -939},
-{ -739, -739, -739, -739, -739}},
-/* CG.@G..CG */
-{ {  0, 0, 0, 0, 0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* CG.@U..CG */
-{ {  0, 0, 0, 0, 0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -669, -669, -669, -669, -669},
-{ -939, -939, -939, -939, -939},
-{ -859, -859, -859, -859, -859}}},
-/* CG.A@..CG */
-{{{  DEF,-1029, -949,-1029,-1029},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079}},
-/* CG.AA..CG */
-{{  DEF,-1029, -949,-1029,-1029},
-{-1079,-2058,-1978,-2058,-2058},
-{ -569,-1548,-1468,-1548,-1548},
-{ -989,-1968,-1888,-1968,-1968},
-{ -859,-1838,-1758,-1838,-1838}},
-/* CG.AC..CG */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -999,-1978,-1898,-1978,-1978},
-{ -499,-1478,-1398,-1478,-1478},
-{ -989,-1968,-1888,-1968,-1968},
-{ -789,-1768,-1688,-1768,-1768}},
-/* CG.AG..CG */
-{{  DEF,-1029, -949,-1029,-1029},
-{-1079,-2058,-1978,-2058,-2058},
-{ -569,-1548,-1468,-1548,-1548},
-{ -989,-1968,-1888,-1968,-1968},
-{ -859,-1838,-1758,-1838,-1838}},
-/* CG.AU..CG */
-{{  DEF,-1029, -949,-1029,-1029},
-{-1079,-2058,-1978,-2058,-2058},
-{ -719,-1698,-1618,-1698,-1698},
-{ -989,-1968,-1888,-1968,-1968},
-{ -909,-1888,-1808,-1888,-1888}}},
-/* CG.C@..CG */
-{{{  DEF, -519, -449, -519, -669},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719}},
-/* CG.CA..CG */
-{{  DEF, -519, -449, -519, -669},
-{-1079,-1548,-1478,-1548,-1698},
-{ -569,-1038, -968,-1038,-1188},
-{ -989,-1458,-1388,-1458,-1608},
-{ -859,-1328,-1258,-1328,-1478}},
-/* CG.CC..CG */
-{{  DEF, -519, -449, -519, -669},
-{ -999,-1468,-1398,-1468,-1618},
-{ -499, -968, -898, -968,-1118},
-{ -989,-1458,-1388,-1458,-1608},
-{ -789,-1258,-1188,-1258,-1408}},
-/* CG.CG..CG */
-{{  DEF, -519, -449, -519, -669},
-{-1079,-1548,-1478,-1548,-1698},
-{ -569,-1038, -968,-1038,-1188},
-{ -989,-1458,-1388,-1458,-1608},
-{ -859,-1328,-1258,-1328,-1478}},
-/* CG.CU..CG */
-{{  DEF, -519, -449, -519, -669},
-{-1079,-1548,-1478,-1548,-1698},
-{ -719,-1188,-1118,-1188,-1338},
-{ -989,-1458,-1388,-1458,-1608},
-{ -909,-1378,-1308,-1378,-1528}}},
-/* CG.G@..CG */
-{{{  DEF, -939, -939, -939, -939},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989}},
-/* CG.GA..CG */
-{{  DEF, -939, -939, -939, -939},
-{-1079,-1968,-1968,-1968,-1968},
-{ -569,-1458,-1458,-1458,-1458},
-{ -989,-1878,-1878,-1878,-1878},
-{ -859,-1748,-1748,-1748,-1748}},
-/* CG.GC..CG */
-{{  DEF, -939, -939, -939, -939},
-{ -999,-1888,-1888,-1888,-1888},
-{ -499,-1388,-1388,-1388,-1388},
-{ -989,-1878,-1878,-1878,-1878},
-{ -789,-1678,-1678,-1678,-1678}},
-/* CG.GG..CG */
-{{  DEF, -939, -939, -939, -939},
-{-1079,-1968,-1968,-1968,-1968},
-{ -569,-1458,-1458,-1458,-1458},
-{ -989,-1878,-1878,-1878,-1878},
-{ -859,-1748,-1748,-1748,-1748}},
-/* CG.GU..CG */
-{{  DEF, -939, -939, -939, -939},
-{-1079,-1968,-1968,-1968,-1968},
-{ -719,-1608,-1608,-1608,-1608},
-{ -989,-1878,-1878,-1878,-1878},
-{ -909,-1798,-1798,-1798,-1798}}},
-/* CG.U@..CG */
-{{{  DEF, -809, -739, -809, -859},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909}},
-/* CG.UA..CG */
-{{  DEF, -809, -739, -809, -859},
-{-1079,-1838,-1768,-1838,-1888},
-{ -569,-1328,-1258,-1328,-1378},
-{ -989,-1748,-1678,-1748,-1798},
-{ -859,-1618,-1548,-1618,-1668}},
-/* CG.UC..CG */
-{{  DEF, -809, -739, -809, -859},
-{ -999,-1758,-1688,-1758,-1808},
-{ -499,-1258,-1188,-1258,-1308},
-{ -989,-1748,-1678,-1748,-1798},
-{ -789,-1548,-1478,-1548,-1598}},
-/* CG.UG..CG */
-{{  DEF, -809, -739, -809, -859},
-{-1079,-1838,-1768,-1838,-1888},
-{ -569,-1328,-1258,-1328,-1378},
-{ -989,-1748,-1678,-1748,-1798},
-{ -859,-1618,-1548,-1618,-1668}},
-/* CG.UU..CG */
-{{  DEF, -809, -739, -809, -859},
-{-1079,-1838,-1768,-1838,-1888},
-{ -719,-1478,-1408,-1478,-1528},
-{ -989,-1748,-1678,-1748,-1798},
-{ -909,-1668,-1598,-1668,-1718}}}},
-/* CG.@@..GC */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.@A..GC */
-{{    0,    0,    0,    0,    0},
-{ -519, -519, -519, -519, -519},
-{ -719, -719, -719, -719, -719},
-{ -709, -709, -709, -709, -709},
-{ -499, -499, -499, -499, -499}},
-/* CG.@C..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -309, -309, -309, -309, -309},
-{ -739, -739, -739, -739, -739},
-{ -499, -499, -499, -499, -499}},
-/* CG.@G..GC */
-{{    0,    0,    0,    0,    0},
-{ -559, -559, -559, -559, -559},
-{ -309, -309, -309, -309, -309},
-{ -619, -619, -619, -619, -619},
-{ -499, -499, -499, -499, -499}},
-/* CG.@U..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -389, -389, -389, -389, -389},
-{ -739, -739, -739, -739, -739},
-{ -569, -569, -569, -569, -569}}},
-/* CG.A@..GC */
-{{{  DEF,-1029, -949,-1029,-1029},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079}},
-/* CG.AA..GC */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -569,-1548,-1468,-1548,-1548},
-{ -769,-1748,-1668,-1748,-1748},
-{ -759,-1738,-1658,-1738,-1738},
-{ -549,-1528,-1448,-1528,-1528}},
-/* CG.AC..GC */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -929,-1908,-1828,-1908,-1908},
-{ -359,-1338,-1258,-1338,-1338},
-{ -789,-1768,-1688,-1768,-1768},
-{ -549,-1528,-1448,-1528,-1528}},
-/* CG.AG..GC */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -609,-1588,-1508,-1588,-1588},
-{ -359,-1338,-1258,-1338,-1338},
-{ -669,-1648,-1568,-1648,-1648},
-{ -549,-1528,-1448,-1528,-1528}},
-/* CG.AU..GC */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -929,-1908,-1828,-1908,-1908},
-{ -439,-1418,-1338,-1418,-1418},
-{ -789,-1768,-1688,-1768,-1768},
-{ -619,-1598,-1518,-1598,-1598}}},
-/* CG.C@..GC */
-{{{  DEF, -519, -449, -519, -669},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719}},
-/* CG.CA..GC */
-{{  DEF, -519, -449, -519, -669},
-{ -569,-1038, -968,-1038,-1188},
-{ -769,-1238,-1168,-1238,-1388},
-{ -759,-1228,-1158,-1228,-1378},
-{ -549,-1018, -948,-1018,-1168}},
-/* CG.CC..GC */
-{{  DEF, -519, -449, -519, -669},
-{ -929,-1398,-1328,-1398,-1548},
-{ -359, -828, -758, -828, -978},
-{ -789,-1258,-1188,-1258,-1408},
-{ -549,-1018, -948,-1018,-1168}},
-/* CG.CG..GC */
-{{  DEF, -519, -449, -519, -669},
-{ -609,-1078,-1008,-1078,-1228},
-{ -359, -828, -758, -828, -978},
-{ -669,-1138,-1068,-1138,-1288},
-{ -549,-1018, -948,-1018,-1168}},
-/* CG.CU..GC */
-{{  DEF, -519, -449, -519, -669},
-{ -929,-1398,-1328,-1398,-1548},
-{ -439, -908, -838, -908,-1058},
-{ -789,-1258,-1188,-1258,-1408},
-{ -619,-1088,-1018,-1088,-1238}}},
-/* CG.G@..GC */
-{{{  DEF, -939, -939, -939, -939},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989}},
-/* CG.GA..GC */
-{{  DEF, -939, -939, -939, -939},
-{ -569,-1458,-1458,-1458,-1458},
-{ -769,-1658,-1658,-1658,-1658},
-{ -759,-1648,-1648,-1648,-1648},
-{ -549,-1438,-1438,-1438,-1438}},
-/* CG.GC..GC */
-{{  DEF, -939, -939, -939, -939},
-{ -929,-1818,-1818,-1818,-1818},
-{ -359,-1248,-1248,-1248,-1248},
-{ -789,-1678,-1678,-1678,-1678},
-{ -549,-1438,-1438,-1438,-1438}},
-/* CG.GG..GC */
-{{  DEF, -939, -939, -939, -939},
-{ -609,-1498,-1498,-1498,-1498},
-{ -359,-1248,-1248,-1248,-1248},
-{ -669,-1558,-1558,-1558,-1558},
-{ -549,-1438,-1438,-1438,-1438}},
-/* CG.GU..GC */
-{{  DEF, -939, -939, -939, -939},
-{ -929,-1818,-1818,-1818,-1818},
-{ -439,-1328,-1328,-1328,-1328},
-{ -789,-1678,-1678,-1678,-3080},
-{ -619,-1508,-1508,-1508,-1508}}},
-/* CG.U@..GC */
-{{{  DEF, -809, -739, -809, -859},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909}},
-/* CG.UA..GC */
-{{  DEF, -809, -739, -809, -859},
-{ -569,-1328,-1258,-1328,-1378},
-{ -769,-1528,-1458,-1528,-1578},
-{ -759,-1518,-1448,-1518,-1568},
-{ -549,-1308,-1238,-1308,-1358}},
-/* CG.UC..GC */
-{{  DEF, -809, -739, -809, -859},
-{ -929,-1688,-1618,-1688,-1738},
-{ -359,-1118,-1048,-1118,-1168},
-{ -789,-1548,-1478,-1548,-1598},
-{ -549,-1308,-1238,-1308,-1358}},
-/* CG.UG..GC */
-{{  DEF, -809, -739, -809, -859},
-{ -609,-1368,-1298,-1368,-1418},
-{ -359,-1118,-1048,-1118,-1168},
-{ -669,-1428,-1358,-1428,-1478},
-{ -549,-1308,-1238,-1308,-1358}},
-/* CG.UU..GC */
-{{  DEF, -809, -739, -809, -859},
-{ -929,-1688,-1618,-1688,-1738},
-{ -439,-1198,-1128,-1198,-1248},
-{ -789,-1548,-1478,-1548,-1598},
-{ -619,-1378,-1308,-1378,-1428}}}},
-/* CG.@@..GU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.@A..GU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* CG.@C..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* CG.@G..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* CG.@U..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* CG.A@..GU */
-{{{  DEF,-1029, -949,-1029,-1029},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079}},
-/* CG.AA..GU */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -479,-1458,-1378,-1458,-1458},
-{ -309,-1288,-1208,-1288,-1288},
-{ -389,-1368,-1288,-1368,-1368},
-{ -379,-1358,-1278,-1358,-1358}},
-/* CG.AC..GU */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -649,-1628,-1548,-1628,-1628},
-{ -289,-1268,-1188,-1268,-1268},
-{ -739,-1718,-1638,-1718,-1718},
-{ -379,-1358,-1278,-1358,-1358}},
-/* CG.AG..GU */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -649,-1628,-1548,-1628,-1628},
-{ -289,-1268,-1188,-1268,-1268},
-{ -739,-1718,-1638,-1718,-1718},
-{ -379,-1358,-1278,-1358,-1358}},
-/* CG.AU..GU */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -649,-1628,-1548,-1628,-1628},
-{ -289,-1268,-1188,-1268,-1268},
-{ -739,-1718,-1638,-1718,-1718},
-{ -379,-1358,-1278,-1358,-1358}}},
-/* CG.C@..GU */
-{{{  DEF, -519, -449, -519, -669},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719}},
-/* CG.CA..GU */
-{{  DEF, -519, -449, -519, -669},
-{ -479, -948, -878, -948,-1098},
-{ -309, -778, -708, -778, -928},
-{ -389, -858, -788, -858,-1008},
-{ -379, -848, -778, -848, -998}},
-/* CG.CC..GU */
-{{  DEF, -519, -449, -519, -669},
-{ -649,-1118,-1048,-1118,-1268},
-{ -289, -758, -688, -758, -908},
-{ -739,-1208,-1138,-1208,-1358},
-{ -379, -848, -778, -848, -998}},
-/* CG.CG..GU */
-{{  DEF, -519, -449, -519, -669},
-{ -649,-1118,-1048,-1118,-1268},
-{ -289, -758, -688, -758, -908},
-{ -739,-1208,-1138,-1208,-1358},
-{ -379, -848, -778, -848, -998}},
-/* CG.CU..GU */
-{{  DEF, -519, -449, -519, -669},
-{ -649,-1118,-1048,-1118,-1268},
-{ -289, -758, -688, -758, -908},
-{ -739,-1208,-1138,-1208,-1358},
-{ -379, -848, -778, -848, -998}}},
-/* CG.G@..GU */
-{{{  DEF, -939, -939, -939, -939},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989}},
-/* CG.GA..GU */
-{{  DEF, -939, -939, -939, -939},
-{ -479,-1368,-1368,-1368,-1368},
-{ -309,-1198,-1198,-1198,-1198},
-{ -389,-1278,-1278,-1278,-1278},
-{ -379,-1268,-1268,-1268,-1268}},
-/* CG.GC..GU */
-{{  DEF, -939, -939, -939, -939},
-{ -649,-1538,-1538,-1538,-1538},
-{ -289,-1178,-1178,-1178,-1178},
-{ -739,-1628,-1628,-1628,-1628},
-{ -379,-1268,-1268,-1268,-1268}},
-/* CG.GG..GU */
-{{  DEF, -939, -939, -939, -939},
-{ -649,-1538,-1538,-1538,-1538},
-{ -289,-1178,-1178,-1178,-1178},
-{ -739,-1628,-1628,-1628,-1628},
-{ -379,-1268,-1268,-1268,-1268}},
-/* CG.GU..GU */
-{{  DEF, -939, -939, -939, -939},
-{ -649,-1538,-1538,-1538,-1538},
-{ -289,-1178,-1178,-1178,-1178},
-{ -739,-1628,-1628,-1628,-1628},
-{ -379,-1268,-1268,-1268,-1268}}},
-/* CG.U@..GU */
-{{{  DEF, -809, -739, -809, -859},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909}},
-/* CG.UA..GU */
-{{  DEF, -809, -739, -809, -859},
-{ -479,-1238,-1168,-1238,-1288},
-{ -309,-1068, -998,-1068,-1118},
-{ -389,-1148,-1078,-1148,-1198},
-{ -379,-1138,-1068,-1138,-1188}},
-/* CG.UC..GU */
-{{  DEF, -809, -739, -809, -859},
-{ -649,-1408,-1338,-1408,-1458},
-{ -289,-1048, -978,-1048,-1098},
-{ -739,-1498,-1428,-1498,-1548},
-{ -379,-1138,-1068,-1138,-1188}},
-/* CG.UG..GU */
-{{  DEF, -809, -739, -809, -859},
-{ -649,-1408,-1338,-1408,-1458},
-{ -289,-1048, -978,-1048,-1098},
-{ -739,-1498,-1428,-1498,-1548},
-{ -379,-1138,-1068,-1138,-1188}},
-/* CG.UU..GU */
-{{  DEF, -809, -739, -809, -859},
-{ -649,-1408,-1338,-1408,-1458},
-{ -289,-1048, -978,-1048,-1098},
-{ -739,-1498,-1428,-1498,-1548},
-{ -379,-1138,-1068,-1138,-1188}}}},
-/* CG.@@..UG */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.@A..UG */
-{{    0,    0,    0,    0,    0},
-{ -719, -719, -719, -719, -719},
-{ -479, -479, -479, -479, -479},
-{ -659, -659, -659, -659, -659},
-{ -549, -549, -549, -549, -549}},
-/* CG.@C..UG */
-{{    0,    0,    0,    0,    0},
-{ -789, -789, -789, -789, -789},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -439, -439, -439, -439, -439}},
-/* CG.@G..UG */
-{{    0,    0,    0,    0,    0},
-{ -959, -959, -959, -959, -959},
-{ -359, -359, -359, -359, -359},
-{ -919, -919, -919, -919, -919},
-{ -549, -549, -549, -549, -549}},
-/* CG.@U..UG */
-{{    0,    0,    0,    0,    0},
-{ -809, -809, -809, -809, -809},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -359, -359, -359, -359, -359}}},
-/* CG.A@..UG */
-{{{  DEF,-1029, -949,-1029,-1029},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079}},
-/* CG.AA..UG */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -769,-1748,-1668,-1748,-1748},
-{ -529,-1508,-1428,-1508,-1508},
-{ -709,-1688,-1608,-1688,-1688},
-{ -599,-1578,-1498,-1578,-1578}},
-/* CG.AC..UG */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -839,-1818,-1738,-1818,-1818},
-{ -529,-1508,-1428,-1508,-1508},
-{ -859,-1838,-1758,-1838,-1838},
-{ -489,-1468,-1388,-1468,-1468}},
-/* CG.AG..UG */
-{{  DEF,-1029, -949,-1029,-1029},
-{-1009,-1988,-1908,-1988,-1988},
-{ -409,-1388,-1308,-1388,-1388},
-{ -969,-1948,-1868,-1948,-1948},
-{ -599,-1578,-1498,-1578,-1578}},
-/* CG.AU..UG */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -859,-1838,-1758,-1838,-1838},
-{ -529,-1508,-1428,-1508,-1508},
-{ -859,-1838,-1758,-1838,-1838},
-{ -409,-1388,-1308,-1388,-1388}}},
-/* CG.C@..UG */
-{{{  DEF, -519, -449, -519, -669},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719}},
-/* CG.CA..UG */
-{{  DEF, -519, -449, -519, -669},
-{ -769,-1238,-1168,-1238,-1388},
-{ -529, -998, -928, -998,-1148},
-{ -709,-1178,-1108,-1178,-1328},
-{ -599,-1068, -998,-1068,-1218}},
-/* CG.CC..UG */
-{{  DEF, -519, -449, -519, -669},
-{ -839,-1308,-1238,-1308,-1458},
-{ -529, -998, -928, -998,-1148},
-{ -859,-1328,-1258,-1328,-1478},
-{ -489, -958, -888, -958,-1108}},
-/* CG.CG..UG */
-{{  DEF, -519, -449, -519, -669},
-{-1009,-1478,-1408,-1478,-1628},
-{ -409, -878, -808, -878,-1028},
-{ -969,-1438,-1368,-1438,-1588},
-{ -599,-1068, -998,-1068,-1218}},
-/* CG.CU..UG */
-{{  DEF, -519, -449, -519, -669},
-{ -859,-1328,-1258,-1328,-1478},
-{ -529, -998, -928, -998,-1148},
-{ -859,-1328,-1258,-1328,-1478},
-{ -409, -878, -808, -878,-1028}}},
-/* CG.G@..UG */
-{{{  DEF, -939, -939, -939, -939},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989}},
-/* CG.GA..UG */
-{{  DEF, -939, -939, -939, -939},
-{ -769,-1658,-1658,-1658,-1658},
-{ -529,-1418,-1418,-1418,-1418},
-{ -709,-1598,-1598,-1598,-1598},
-{ -599,-1488,-1488,-1488,-1488}},
-/* CG.GC..UG */
-{{  DEF, -939, -939, -939, -939},
-{ -839,-1728,-1728,-1728,-1728},
-{ -529,-1418,-1418,-1418,-1418},
-{ -859,-1748,-1748,-1748,-1748},
-{ -489,-1378,-1378,-1378,-1378}},
-/* CG.GG..UG */
-{{  DEF, -939, -939, -939, -939},
-{-1009,-1898,-1898,-1898,-1898},
-{ -409,-1298,-1298,-1298,-1298},
-{ -969,-1858,-1858,-1858,-1858},
-{ -599,-1488,-1488,-1488,-1488}},
-/* CG.GU..UG */
-{{  DEF, -939, -939, -939, -939},
-{ -859,-1748,-1748,-1748,-1748},
-{ -529,-1418,-1418,-1418,-1418},
-{ -859,-1748,-1748,-1748,-1748},
-{ -409,-1298,-1298,-1298,-1298}}},
-/* CG.U@..UG */
-{{{  DEF, -809, -739, -809, -859},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909}},
-/* CG.UA..UG */
-{{  DEF, -809, -739, -809, -859},
-{ -769,-1528,-1458,-1528,-1578},
-{ -529,-1288,-1218,-1288,-1338},
-{ -709,-1468,-1398,-1468,-1518},
-{ -599,-1358,-1288,-1358,-1408}},
-/* CG.UC..UG */
-{{  DEF, -809, -739, -809, -859},
-{ -839,-1598,-1528,-1598,-1648},
-{ -529,-1288,-1218,-1288,-1338},
-{ -859,-1618,-1548,-1618,-1668},
-{ -489,-1248,-1178,-1248,-1298}},
-/* CG.UG..UG */
-{{  DEF, -809, -739, -809, -859},
-{-1009,-1768,-1698,-1768,-1818},
-{ -409,-1168,-1098,-1168,-1218},
-{ -969,-1728,-1658,-1728,-1778},
-{ -599,-1358,-1288,-1358,-1408}},
-/* CG.UU..UG */
-{{  DEF, -809, -739, -809, -859},
-{ -859,-1618,-1548,-1618,-1668},
-{ -529,-1288,-1218,-1288,-1338},
-{ -859,-1618,-1548,-1618,-1668},
-{ -409,-1168,-1098,-1168,-1218}}}},
-/* CG.@@..AU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.@A..AU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* CG.@C..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* CG.@G..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* CG.@U..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* CG.A@..AU */
-{{{  DEF,-1029, -949,-1029,-1029},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079}},
-/* CG.AA..AU */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -479,-1458,-1378,-1458,-1458},
-{ -309,-1288,-1208,-1288,-1288},
-{ -389,-1368,-1288,-1368,-1368},
-{ -379,-1358,-1278,-1358,-1358}},
-/* CG.AC..AU */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -649,-1628,-1548,-1628,-1628},
-{ -289,-1268,-1188,-1268,-1268},
-{ -739,-1718,-1638,-1718,-1718},
-{ -379,-1358,-1278,-1358,-1358}},
-/* CG.AG..AU */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -649,-1628,-1548,-1628,-1628},
-{ -289,-1268,-1188,-1268,-1268},
-{ -739,-1718,-1638,-1718,-1718},
-{ -379,-1358,-1278,-1358,-1358}},
-/* CG.AU..AU */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -649,-1628,-1548,-1628,-1628},
-{ -289,-1268,-1188,-1268,-1268},
-{ -739,-1718,-1638,-1718,-1718},
-{ -379,-1358,-1278,-1358,-1358}}},
-/* CG.C@..AU */
-{{{  DEF, -519, -449, -519, -669},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719}},
-/* CG.CA..AU */
-{{  DEF, -519, -449, -519, -669},
-{ -479, -948, -878, -948,-1098},
-{ -309, -778, -708, -778, -928},
-{ -389, -858, -788, -858,-1008},
-{ -379, -848, -778, -848, -998}},
-/* CG.CC..AU */
-{{  DEF, -519, -449, -519, -669},
-{ -649,-1118,-1048,-1118,-1268},
-{ -289, -758, -688, -758, -908},
-{ -739,-1208,-1138,-1208,-1358},
-{ -379, -848, -778, -848, -998}},
-/* CG.CG..AU */
-{{  DEF, -519, -449, -519, -669},
-{ -649,-1118,-1048,-1118,-1268},
-{ -289, -758, -688, -758, -908},
-{ -739,-1208,-1138,-1208,-1358},
-{ -379, -848, -778, -848, -998}},
-/* CG.CU..AU */
-{{  DEF, -519, -449, -519, -669},
-{ -649,-1118,-1048,-1118,-1268},
-{ -289, -758, -688, -758, -908},
-{ -739,-1208,-1138,-1208,-1358},
-{ -379, -848, -778, -848, -998}}},
-/* CG.G@..AU */
-{{{  DEF, -939, -939, -939, -939},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989}},
-/* CG.GA..AU */
-{{  DEF, -939, -939, -939, -939},
-{ -479,-1368,-1368,-1368,-1368},
-{ -309,-1198,-1198,-1198,-1198},
-{ -389,-1278,-1278,-1278,-1278},
-{ -379,-1268,-1268,-1268,-1268}},
-/* CG.GC..AU */
-{{  DEF, -939, -939, -939, -939},
-{ -649,-1538,-1538,-1538,-1538},
-{ -289,-1178,-1178,-1178,-1178},
-{ -739,-1628,-1628,-1628,-1628},
-{ -379,-1268,-1268,-1268,-1268}},
-/* CG.GG..AU */
-{{  DEF, -939, -939, -939, -939},
-{ -649,-1538,-1538,-1538,-1538},
-{ -289,-1178,-1178,-1178,-1178},
-{ -739,-1628,-1628,-1628,-1628},
-{ -379,-1268,-1268,-1268,-1268}},
-/* CG.GU..AU */
-{{  DEF, -939, -939, -939, -939},
-{ -649,-1538,-1538,-1538,-1538},
-{ -289,-1178,-1178,-1178,-1178},
-{ -739,-1628,-1628,-1628,-1628},
-{ -379,-1268,-1268,-1268,-1268}}},
-/* CG.U@..AU */
-{{{  DEF, -809, -739, -809, -859},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909}},
-/* CG.UA..AU */
-{{  DEF, -809, -739, -809, -859},
-{ -479,-1238,-1168,-1238,-1288},
-{ -309,-1068, -998,-1068,-1118},
-{ -389,-1148,-1078,-1148,-1198},
-{ -379,-1138,-1068,-1138,-1188}},
-/* CG.UC..AU */
-{{  DEF, -809, -739, -809, -859},
-{ -649,-1408,-1338,-1408,-1458},
-{ -289,-1048, -978,-1048,-1098},
-{ -739,-1498,-1428,-1498,-1548},
-{ -379,-1138,-1068,-1138,-1188}},
-/* CG.UG..AU */
-{{  DEF, -809, -739, -809, -859},
-{ -649,-1408,-1338,-1408,-1458},
-{ -289,-1048, -978,-1048,-1098},
-{ -739,-1498,-1428,-1498,-1548},
-{ -379,-1138,-1068,-1138,-1188}},
-/* CG.UU..AU */
-{{  DEF, -809, -739, -809, -859},
-{ -649,-1408,-1338,-1408,-1458},
-{ -289,-1048, -978,-1048,-1098},
-{ -739,-1498,-1428,-1498,-1548},
-{ -379,-1138,-1068,-1138,-1188}}}},
-/* CG.@@..UA */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.@A..UA */
-{{    0,    0,    0,    0,    0},
-{ -399, -399, -399, -399, -399},
-{ -429, -429, -429, -429, -429},
-{ -379, -379, -379, -379, -379},
-{ -279, -279, -279, -279, -279}},
-/* CG.@C..UA */
-{{    0,    0,    0,    0,    0},
-{ -629, -629, -629, -629, -629},
-{ -509, -509, -509, -509, -509},
-{ -679, -679, -679, -679, -679},
-{ -139, -139, -139, -139, -139}},
-/* CG.@G..UA */
-{{    0,    0,    0,    0,    0},
-{ -889, -889, -889, -889, -889},
-{ -199, -199, -199, -199, -199},
-{ -889, -889, -889, -889, -889},
-{ -279, -279, -279, -279, -279}},
-/* CG.@U..UA */
-{{    0,    0,    0,    0,    0},
-{ -589, -589, -589, -589, -589},
-{ -179, -179, -179, -179, -179},
-{ -679, -679, -679, -679, -679},
-{ -140, -140, -140, -140, -140}}},
-/* CG.A@..UA */
-{{{  DEF,-1029, -949,-1029,-1029},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079}},
-/* CG.AA..UA */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -449,-1428,-1348,-1428,-1428},
-{ -479,-1458,-1378,-1458,-1458},
-{ -429,-1408,-1328,-1408,-1408},
-{ -329,-1308,-1228,-1308,-1308}},
-/* CG.AC..UA */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -679,-1658,-1578,-1658,-1658},
-{ -559,-1538,-1458,-1538,-1538},
-{ -729,-1708,-1628,-1708,-1708},
-{ -189,-1168,-1088,-1168,-1168}},
-/* CG.AG..UA */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -939,-1918,-1838,-1918,-1918},
-{ -249,-1228,-1148,-1228,-1228},
-{ -939,-1918,-1838,-1918,-1918},
-{ -329,-1308,-1228,-1308,-1308}},
-/* CG.AU..UA */
-{{  DEF,-1029, -949,-1029,-1029},
-{ -639,-1618,-1538,-1618,-1618},
-{ -229,-1208,-1128,-1208,-1208},
-{ -729,-1708,-1628,-1708,-1708},
-{ -190,-1169,-1089,-1169,-1169}}},
-/* CG.C@..UA */
-{{{  DEF, -519, -449, -519, -669},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719}},
-/* CG.CA..UA */
-{{  DEF, -519, -449, -519, -669},
-{ -449, -918, -848, -918,-1068},
-{ -479, -948, -878, -948,-1098},
-{ -429, -898, -828, -898,-1048},
-{ -329, -798, -728, -798, -948}},
-/* CG.CC..UA */
-{{  DEF, -519, -449, -519, -669},
-{ -679,-1148,-1078,-1148,-1298},
-{ -559,-1028, -958,-1028,-1178},
-{ -729,-1198,-1128,-1198,-1348},
-{ -189, -658, -588, -658, -808}},
-/* CG.CG..UA */
-{{  DEF, -519, -449, -519, -669},
-{ -939,-1408,-1338,-1408,-1558},
-{ -249, -718, -648, -718, -868},
-{ -939,-1408,-1338,-1408,-1558},
-{ -329, -798, -728, -798, -948}},
-/* CG.CU..UA */
-{{  DEF, -519, -449, -519, -669},
-{ -639,-1108,-1038,-1108,-1258},
-{ -229, -698, -628, -698, -848},
-{ -729,-1198,-1128,-1198,-1348},
-{ -190, -659, -589, -659, -809}}},
-/* CG.G@..UA */
-{{{  DEF, -939, -939, -939, -939},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989}},
-/* CG.GA..UA */
-{{  DEF, -939, -939, -939, -939},
-{ -449,-1338,-1338,-1338,-1338},
-{ -479,-1368,-1368,-1368,-1368},
-{ -429,-1318,-1318,-1318,-1318},
-{ -329,-1218,-1218,-1218,-1218}},
-/* CG.GC..UA */
-{{  DEF, -939, -939, -939, -939},
-{ -679,-1568,-1568,-1568,-1568},
-{ -559,-1448,-1448,-1448,-1448},
-{ -729,-1618,-1618,-1618,-1618},
-{ -189,-1078,-1078,-1078,-1078}},
-/* CG.GG..UA */
-{{  DEF, -939, -939, -939, -939},
-{ -939,-1828,-1828,-1828,-1828},
-{ -249,-1138,-1138,-1138,-1138},
-{ -939,-1828,-1828,-1828,-1828},
-{ -329,-1218,-1218,-1218,-1218}},
-/* CG.GU..UA */
-{{  DEF, -939, -939, -939, -939},
-{ -639,-1528,-1528,-1528,-1528},
-{ -229,-1118,-1118,-1118,-1118},
-{ -729,-1618,-1618,-1618,-1618},
-{ -190,-1079,-1079,-1079,-1079}}},
-/* CG.U@..UA */
-{{{  DEF, -809, -739, -809, -859},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909}},
-/* CG.UA..UA */
-{{  DEF, -809, -739, -809, -859},
-{ -449,-1208,-1138,-1208,-1258},
-{ -479,-1238,-1168,-1238,-1288},
-{ -429,-1188,-1118,-1188,-1238},
-{ -329,-1088,-1018,-1088,-1138}},
-/* CG.UC..UA */
-{{  DEF, -809, -739, -809, -859},
-{ -679,-1438,-1368,-1438,-1488},
-{ -559,-1318,-1248,-1318,-1368},
-{ -729,-1488,-1418,-1488,-1538},
-{ -189, -948, -878, -948, -998}},
-/* CG.UG..UA */
-{{  DEF, -809, -739, -809, -859},
-{ -939,-1698,-1628,-1698,-1748},
-{ -249,-1008, -938,-1008,-1058},
-{ -939,-1698,-1628,-1698,-1748},
-{ -329,-1088,-1018,-1088,-1138}},
-/* CG.UU..UA */
-{{  DEF, -809, -739, -809, -859},
-{ -639,-1398,-1328,-1398,-1448},
-{ -229, -988, -918, -988,-1038},
-{ -729,-1488,-1418,-1488,-1538},
-{ -190, -949, -879, -949, -999}}}},
-/* CG.@@.. @ */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.@A.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.@C.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.@G.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* CG.@U.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}}},
-/* CG.A@.. @ */
-{{{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079}},
-/* CG.AA.. @ */
-{{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079}},
-/* CG.AC.. @ */
-{{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079}},
-/* CG.AG.. @ */
-{{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079}},
-/* CG.AU.. @ */
-{{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079},
-{ -100,-1079, -999,-1079,-1079}}},
-/* CG.C@.. @ */
-{{{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719}},
-/* CG.CA.. @ */
-{{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719}},
-/* CG.CC.. @ */
-{{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719}},
-/* CG.CG.. @ */
-{{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719}},
-/* CG.CU.. @ */
-{{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719},
-{ -100, -569, -499, -569, -719}}},
-/* CG.G@.. @ */
-{{{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989}},
-/* CG.GA.. @ */
-{{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989}},
-/* CG.GC.. @ */
-{{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989}},
-/* CG.GG.. @ */
-{{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989}},
-/* CG.GU.. @ */
-{{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989},
-{ -100, -989, -989, -989, -989}}},
-/* CG.U@.. @ */
-{{{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909}},
-/* CG.UA.. @ */
-{{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909}},
-/* CG.UC.. @ */
-{{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909}},
-/* CG.UG.. @ */
-{{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909}},
-/* CG.UU.. @ */
-{{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909},
-{ -100, -859, -789, -859, -909}}}}},
-{ /* noPair */ {{{{0}}}},
-/* GC.@@..CG */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.@A..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* GC.@C..CG */
-{{    0,    0,    0,    0,    0},
-{ -949, -949, -949, -949, -949},
-{ -449, -449, -449, -449, -449},
-{ -939, -939, -939, -939, -939},
-{ -739, -739, -739, -739, -739}},
-/* GC.@G..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* GC.@U..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -669, -669, -669, -669, -669},
-{ -939, -939, -939, -939, -939},
-{ -859, -859, -859, -859, -859}}},
-/* GC.A@..CG */
-{{{  DEF, -519, -879, -559, -879},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929}},
-/* GC.AA..CG */
-{{  DEF, -519, -879, -559, -879},
-{-1079,-1548,-1908,-1588,-1908},
-{ -569,-1038,-1398,-1078,-1398},
-{ -989,-1458,-1818,-1498,-1818},
-{ -859,-1328,-1688,-1368,-1688}},
-/* GC.AC..CG */
-{{  DEF, -519, -879, -559, -879},
-{ -999,-1468,-1828,-1508,-1828},
-{ -499, -968,-1328,-1008,-1328},
-{ -989,-1458,-1818,-1498,-1818},
-{ -789,-1258,-1618,-1298,-1618}},
-/* GC.AG..CG */
-{{  DEF, -519, -879, -559, -879},
-{-1079,-1548,-1908,-1588,-1908},
-{ -569,-1038,-1398,-1078,-1398},
-{ -989,-1458,-1818,-1498,-1818},
-{ -859,-1328,-1688,-1368,-1688}},
-/* GC.AU..CG */
-{{  DEF, -519, -879, -559, -879},
-{-1079,-1548,-1908,-1588,-1908},
-{ -719,-1188,-1548,-1228,-1548},
-{ -989,-1458,-1818,-1498,-1818},
-{ -909,-1378,-1738,-1418,-1738}}},
-/* GC.C@..CG */
-{{{  DEF, -719, -309, -309, -389},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439}},
-/* GC.CA..CG */
-{{  DEF, -719, -309, -309, -389},
-{-1079,-1748,-1338,-1338,-1418},
-{ -569,-1238, -828, -828, -908},
-{ -989,-1658,-1248,-1248,-1328},
-{ -859,-1528,-1118,-1118,-1198}},
-/* GC.CC..CG */
-{{  DEF, -719, -309, -309, -389},
-{ -999,-1668,-1258,-1258,-1338},
-{ -499,-1168, -758, -758, -838},
-{ -989,-1658,-1248,-1248,-1328},
-{ -789,-1458,-1048,-1048,-1128}},
-/* GC.CG..CG */
-{{  DEF, -719, -309, -309, -389},
-{-1079,-1748,-1338,-1338,-1418},
-{ -569,-1238, -828, -828, -908},
-{ -989,-1658,-1248,-1248,-1328},
-{ -859,-1528,-1118,-1118,-1198}},
-/* GC.CU..CG */
-{{  DEF, -719, -309, -309, -389},
-{-1079,-1748,-1338,-1338,-1418},
-{ -719,-1388, -978, -978,-1058},
-{ -989,-1658,-1248,-1248,-1328},
-{ -909,-1578,-1168,-1168,-1248}}},
-/* GC.G@..CG */
-{{{  DEF, -709, -739, -619, -739},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789}},
-/* GC.GA..CG */
-{{  DEF, -709, -739, -619, -739},
-{-1079,-1738,-1768,-1648,-1768},
-{ -569,-1228,-1258,-1138,-1258},
-{ -989,-1648,-1678,-1558,-1678},
-{ -859,-1518,-1548,-1428,-1548}},
-/* GC.GC..CG */
-{{  DEF, -709, -739, -619, -739},
-{ -999,-1658,-1688,-1568,-1688},
-{ -499,-1158,-1188,-1068,-1188},
-{ -989,-1648,-1678,-1558,-1678},
-{ -789,-1448,-1478,-1358,-1478}},
-/* GC.GG..CG */
-{{  DEF, -709, -739, -619, -739},
-{-1079,-1738,-1768,-1648,-1768},
-{ -569,-1228,-1258,-1138,-1258},
-{ -989,-1648,-1678,-1558,-1678},
-{ -859,-1518,-1548,-1428,-1548}},
-/* GC.GU..CG */
-{{  DEF, -709, -739, -619, -739},
-{-1079,-1738,-1768,-1648,-1768},
-{ -719,-1378,-1408,-1288,-1408},
-{ -989,-1648,-1678,-1558,-3080},
-{ -909,-1568,-1598,-1478,-1598}}},
-/* GC.U@..CG */
-{{{  DEF, -499, -499, -499, -569},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619}},
-/* GC.UA..CG */
-{{  DEF, -499, -499, -499, -569},
-{-1079,-1528,-1528,-1528,-1598},
-{ -569,-1018,-1018,-1018,-1088},
-{ -989,-1438,-1438,-1438,-1508},
-{ -859,-1308,-1308,-1308,-1378}},
-/* GC.UC..CG */
-{{  DEF, -499, -499, -499, -569},
-{ -999,-1448,-1448,-1448,-1518},
-{ -499, -948, -948, -948,-1018},
-{ -989,-1438,-1438,-1438,-1508},
-{ -789,-1238,-1238,-1238,-1308}},
-/* GC.UG..CG */
-{{  DEF, -499, -499, -499, -569},
-{-1079,-1528,-1528,-1528,-1598},
-{ -569,-1018,-1018,-1018,-1088},
-{ -989,-1438,-1438,-1438,-1508},
-{ -859,-1308,-1308,-1308,-1378}},
-/* GC.UU..CG */
-{{  DEF, -499, -499, -499, -569},
-{-1079,-1528,-1528,-1528,-1598},
-{ -719,-1168,-1168,-1168,-1238},
-{ -989,-1438,-1438,-1438,-1508},
-{ -909,-1358,-1358,-1358,-1428}}}},
-/* GC.@@..GC */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.@A..GC */
-{{    0,    0,    0,    0,    0},
-{ -519, -519, -519, -519, -519},
-{ -719, -719, -719, -719, -719},
-{ -709, -709, -709, -709, -709},
-{ -499, -499, -499, -499, -499}},
-/* GC.@C..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -309, -309, -309, -309, -309},
-{ -739, -739, -739, -739, -739},
-{ -499, -499, -499, -499, -499}},
-/* GC.@G..GC */
-{{    0,    0,    0,    0,    0},
-{ -559, -559, -559, -559, -559},
-{ -309, -309, -309, -309, -309},
-{ -619, -619, -619, -619, -619},
-{ -499, -499, -499, -499, -499}},
-/* GC.@U..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -389, -389, -389, -389, -389},
-{ -739, -739, -739, -739, -739},
-{ -569, -569, -569, -569, -569}}},
-/* GC.A@..GC */
-{{{  DEF, -519, -879, -559, -879},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929}},
-/* GC.AA..GC */
-{{  DEF, -519, -879, -559, -879},
-{ -569,-1038,-1398,-1078,-1398},
-{ -769,-1238,-1598,-1278,-1598},
-{ -759,-1228,-1588,-1268,-1588},
-{ -549,-1018,-1378,-1058,-1378}},
-/* GC.AC..GC */
-{{  DEF, -519, -879, -559, -879},
-{ -929,-1398,-1758,-1438,-1758},
-{ -359, -828,-1188, -868,-1188},
-{ -789,-1258,-1618,-1298,-1618},
-{ -549,-1018,-1378,-1058,-1378}},
-/* GC.AG..GC */
-{{  DEF, -519, -879, -559, -879},
-{ -609,-1078,-1438,-1118,-1438},
-{ -359, -828,-1188, -868,-1188},
-{ -669,-1138,-1498,-1178,-1498},
-{ -549,-1018,-1378,-1058,-1378}},
-/* GC.AU..GC */
-{{  DEF, -519, -879, -559, -879},
-{ -929,-1398,-1758,-1438,-1758},
-{ -439, -908,-1268, -948,-1268},
-{ -789,-1258,-1618,-1298,-1618},
-{ -619,-1088,-1448,-1128,-1448}}},
-/* GC.C@..GC */
-{{{  DEF, -719, -309, -309, -389},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439}},
-/* GC.CA..GC */
-{{  DEF, -719, -309, -309, -389},
-{ -569,-1238, -828, -828, -908},
-{ -769,-1438,-1028,-1028,-1108},
-{ -759,-1428,-1018,-1018,-1098},
-{ -549,-1218, -808, -808, -888}},
-/* GC.CC..GC */
-{{  DEF, -719, -309, -309, -389},
-{ -929,-1598,-1188,-1188,-1268},
-{ -359,-1028, -618, -618, -698},
-{ -789,-1458,-1048,-1048,-1128},
-{ -549,-1218, -808, -808, -888}},
-/* GC.CG..GC */
-{{  DEF, -719, -309, -309, -389},
-{ -609,-1278, -868, -868, -948},
-{ -359,-1028, -618, -618, -698},
-{ -669,-1338, -928, -928,-1008},
-{ -549,-1218, -808, -808, -888}},
-/* GC.CU..GC */
-{{  DEF, -719, -309, -309, -389},
-{ -929,-1598,-1188,-1188,-1268},
-{ -439,-1108, -698, -698, -778},
-{ -789,-1458,-1048,-1048,-1128},
-{ -619,-1288, -878, -878, -958}}},
-/* GC.G@..GC */
-{{{  DEF, -709, -739, -619, -739},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789}},
-/* GC.GA..GC */
-{{  DEF, -709, -739, -619, -739},
-{ -569,-1228,-1258,-1138,-1258},
-{ -769,-1428,-1458,-1338,-1458},
-{ -759,-1418,-1448,-1328,-1448},
-{ -549,-1208,-1238,-1118,-1238}},
-/* GC.GC..GC */
-{{  DEF, -709, -739, -619, -739},
-{ -929,-1588,-1618,-1498,-1618},
-{ -359,-1018,-1048, -928,-1048},
-{ -789,-1448,-1478,-1358,-1478},
-{ -549,-1208,-1238,-1118,-1238}},
-/* GC.GG..GC */
-{{  DEF, -709, -739, -619, -739},
-{ -609,-1268,-1298,-1178,-1298},
-{ -359,-1018,-1048, -928,-1048},
-{ -669,-1328,-1358,-1238,-1358},
-{ -549,-1208,-1238,-1118,-1238}},
-/* GC.GU..GC */
-{{  DEF, -709, -739, -619, -739},
-{ -929,-1588,-1618,-1498,-1618},
-{ -439,-1098,-1128,-1008,-1128},
-{ -789,-1448,-1478,-1358,-3080},
-{ -619,-1278,-1308,-1188,-1308}}},
-/* GC.U@..GC */
-{{{  DEF, -499, -499, -499, -569},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619}},
-/* GC.UA..GC */
-{{  DEF, -499, -499, -499, -569},
-{ -569,-1018,-1018,-1018,-1088},
-{ -769,-1218,-1218,-1218,-1288},
-{ -759,-1208,-1208,-1208,-1278},
-{ -549, -998, -998, -998,-1068}},
-/* GC.UC..GC */
-{{  DEF, -499, -499, -499, -569},
-{ -929,-1378,-1378,-1378,-1448},
-{ -359, -808, -808, -808, -878},
-{ -789,-1238,-1238,-1238,-1308},
-{ -549, -998, -998, -998,-1068}},
-/* GC.UG..GC */
-{{  DEF, -499, -499, -499, -569},
-{ -609,-1058,-1058,-1058,-1128},
-{ -359, -808, -808, -808, -878},
-{ -669,-1118,-1118,-1118,-1188},
-{ -549, -998, -998, -998,-1068}},
-/* GC.UU..GC */
-{{  DEF, -499, -499, -499, -569},
-{ -929,-1378,-1378,-1378,-1448},
-{ -439, -888, -888, -888, -958},
-{ -789,-1238,-1238,-1238,-1308},
-{ -619,-1068,-1068,-1068,-1138}}}},
-/* GC.@@..GU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.@A..GU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* GC.@C..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* GC.@G..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* GC.@U..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* GC.A@..GU */
-{{{  DEF, -519, -879, -559, -879},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929}},
-/* GC.AA..GU */
-{{  DEF, -519, -879, -559, -879},
-{ -479, -948,-1308, -988,-1308},
-{ -309, -778,-1138, -818,-1138},
-{ -389, -858,-1218, -898,-1218},
-{ -379, -848,-1208, -888,-1208}},
-/* GC.AC..GU */
-{{  DEF, -519, -879, -559, -879},
-{ -649,-1118,-1478,-1158,-1478},
-{ -289, -758,-1118, -798,-1118},
-{ -739,-1208,-1568,-1248,-1568},
-{ -379, -848,-1208, -888,-1208}},
-/* GC.AG..GU */
-{{  DEF, -519, -879, -559, -879},
-{ -649,-1118,-1478,-1158,-1478},
-{ -289, -758,-1118, -798,-1118},
-{ -739,-1208,-1568,-1248,-1568},
-{ -379, -848,-1208, -888,-1208}},
-/* GC.AU..GU */
-{{  DEF, -519, -879, -559, -879},
-{ -649,-1118,-1478,-1158,-1478},
-{ -289, -758,-1118, -798,-1118},
-{ -739,-1208,-1568,-1248,-1568},
-{ -379, -848,-1208, -888,-1208}}},
-/* GC.C@..GU */
-{{{  DEF, -719, -309, -309, -389},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439}},
-/* GC.CA..GU */
-{{  DEF, -719, -309, -309, -389},
-{ -479,-1148, -738, -738, -818},
-{ -309, -978, -568, -568, -648},
-{ -389,-1058, -648, -648, -728},
-{ -379,-1048, -638, -638, -718}},
-/* GC.CC..GU */
-{{  DEF, -719, -309, -309, -389},
-{ -649,-1318, -908, -908, -988},
-{ -289, -958, -548, -548, -628},
-{ -739,-1408, -998, -998,-1078},
-{ -379,-1048, -638, -638, -718}},
-/* GC.CG..GU */
-{{  DEF, -719, -309, -309, -389},
-{ -649,-1318, -908, -908, -988},
-{ -289, -958, -548, -548, -628},
-{ -739,-1408, -998, -998,-1078},
-{ -379,-1048, -638, -638, -718}},
-/* GC.CU..GU */
-{{  DEF, -719, -309, -309, -389},
-{ -649,-1318, -908, -908, -988},
-{ -289, -958, -548, -548, -628},
-{ -739,-1408, -998, -998,-1078},
-{ -379,-1048, -638, -638, -718}}},
-/* GC.G@..GU */
-{{{  DEF, -709, -739, -619, -739},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789}},
-/* GC.GA..GU */
-{{  DEF, -709, -739, -619, -739},
-{ -479,-1138,-1168,-1048,-1168},
-{ -309, -968, -998, -878, -998},
-{ -389,-1048,-1078, -958,-1078},
-{ -379,-1038,-1068, -948,-1068}},
-/* GC.GC..GU */
-{{  DEF, -709, -739, -619, -739},
-{ -649,-1308,-1338,-1218,-1338},
-{ -289, -948, -978, -858, -978},
-{ -739,-1398,-1428,-1308,-1428},
-{ -379,-1038,-1068, -948,-1068}},
-/* GC.GG..GU */
-{{  DEF, -709, -739, -619, -739},
-{ -649,-1308,-1338,-1218,-1338},
-{ -289, -948, -978, -858, -978},
-{ -739,-1398,-1428,-1308,-1428},
-{ -379,-1038,-1068, -948,-1068}},
-/* GC.GU..GU */
-{{  DEF, -709, -739, -619, -739},
-{ -649,-1308,-1338,-1218,-1338},
-{ -289, -948, -978, -858, -978},
-{ -739,-1398,-1428,-1308,-1428},
-{ -379,-1038,-1068, -948,-1068}}},
-/* GC.U@..GU */
-{{{  DEF, -499, -499, -499, -569},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619}},
-/* GC.UA..GU */
-{{  DEF, -499, -499, -499, -569},
-{ -479, -928, -928, -928, -998},
-{ -309, -758, -758, -758, -828},
-{ -389, -838, -838, -838, -908},
-{ -379, -828, -828, -828, -898}},
-/* GC.UC..GU */
-{{  DEF, -499, -499, -499, -569},
-{ -649,-1098,-1098,-1098,-1168},
-{ -289, -738, -738, -738, -808},
-{ -739,-1188,-1188,-1188,-1258},
-{ -379, -828, -828, -828, -898}},
-/* GC.UG..GU */
-{{  DEF, -499, -499, -499, -569},
-{ -649,-1098,-1098,-1098,-1168},
-{ -289, -738, -738, -738, -808},
-{ -739,-1188,-1188,-1188,-1258},
-{ -379, -828, -828, -828, -898}},
-/* GC.UU..GU */
-{{  DEF, -499, -499, -499, -569},
-{ -649,-1098,-1098,-1098,-1168},
-{ -289, -738, -738, -738, -808},
-{ -739,-1188,-1188,-1188,-1258},
-{ -379, -828, -828, -828, -898}}}},
-/* GC.@@..UG */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.@A..UG */
-{{    0,    0,    0,    0,    0},
-{ -719, -719, -719, -719, -719},
-{ -479, -479, -479, -479, -479},
-{ -659, -659, -659, -659, -659},
-{ -549, -549, -549, -549, -549}},
-/* GC.@C..UG */
-{{    0,    0,    0,    0,    0},
-{ -789, -789, -789, -789, -789},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -439, -439, -439, -439, -439}},
-/* GC.@G..UG */
-{{    0,    0,    0,    0,    0},
-{ -959, -959, -959, -959, -959},
-{ -359, -359, -359, -359, -359},
-{ -919, -919, -919, -919, -919},
-{ -549, -549, -549, -549, -549}},
-/* GC.@U..UG */
-{{    0,    0,    0,    0,    0},
-{ -809, -809, -809, -809, -809},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -359, -359, -359, -359, -359}}},
-/* GC.A@..UG */
-{{{  DEF, -519, -879, -559, -879},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929}},
-/* GC.AA..UG */
-{{  DEF, -519, -879, -559, -879},
-{ -769,-1238,-1598,-1278,-1598},
-{ -529, -998,-1358,-1038,-1358},
-{ -709,-1178,-1538,-1218,-1538},
-{ -599,-1068,-1428,-1108,-1428}},
-/* GC.AC..UG */
-{{  DEF, -519, -879, -559, -879},
-{ -839,-1308,-1668,-1348,-1668},
-{ -529, -998,-1358,-1038,-1358},
-{ -859,-1328,-1688,-1368,-1688},
-{ -489, -958,-1318, -998,-1318}},
-/* GC.AG..UG */
-{{  DEF, -519, -879, -559, -879},
-{-1009,-1478,-1838,-1518,-1838},
-{ -409, -878,-1238, -918,-1238},
-{ -969,-1438,-1798,-1478,-1798},
-{ -599,-1068,-1428,-1108,-1428}},
-/* GC.AU..UG */
-{{  DEF, -519, -879, -559, -879},
-{ -859,-1328,-1688,-1368,-1688},
-{ -529, -998,-1358,-1038,-1358},
-{ -859,-1328,-1688,-1368,-1688},
-{ -409, -878,-1238, -918,-1238}}},
-/* GC.C@..UG */
-{{{  DEF, -719, -309, -309, -389},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439}},
-/* GC.CA..UG */
-{{  DEF, -719, -309, -309, -389},
-{ -769,-1438,-1028,-1028,-1108},
-{ -529,-1198, -788, -788, -868},
-{ -709,-1378, -968, -968,-1048},
-{ -599,-1268, -858, -858, -938}},
-/* GC.CC..UG */
-{{  DEF, -719, -309, -309, -389},
-{ -839,-1508,-1098,-1098,-1178},
-{ -529,-1198, -788, -788, -868},
-{ -859,-1528,-1118,-1118,-1198},
-{ -489,-1158, -748, -748, -828}},
-/* GC.CG..UG */
-{{  DEF, -719, -309, -309, -389},
-{-1009,-1678,-1268,-1268,-1348},
-{ -409,-1078, -668, -668, -748},
-{ -969,-1638,-1228,-1228,-1308},
-{ -599,-1268, -858, -858, -938}},
-/* GC.CU..UG */
-{{  DEF, -719, -309, -309, -389},
-{ -859,-1528,-1118,-1118,-1198},
-{ -529,-1198, -788, -788, -868},
-{ -859,-1528,-1118,-1118,-1198},
-{ -409,-1078, -668, -668, -748}}},
-/* GC.G@..UG */
-{{{  DEF, -709, -739, -619, -739},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789}},
-/* GC.GA..UG */
-{{  DEF, -709, -739, -619, -739},
-{ -769,-1428,-1458,-1338,-1458},
-{ -529,-1188,-1218,-1098,-1218},
-{ -709,-1368,-1398,-1278,-1398},
-{ -599,-1258,-1288,-1168,-1288}},
-/* GC.GC..UG */
-{{  DEF, -709, -739, -619, -739},
-{ -839,-1498,-1528,-1408,-1528},
-{ -529,-1188,-1218,-1098,-1218},
-{ -859,-1518,-1548,-1428,-1548},
-{ -489,-1148,-1178,-1058,-1178}},
-/* GC.GG..UG */
-{{  DEF, -709, -739, -619, -739},
-{-1009,-1668,-1698,-1578,-1698},
-{ -409,-1068,-1098, -978,-1098},
-{ -969,-1628,-1658,-1538,-1658},
-{ -599,-1258,-1288,-1168,-1288}},
-/* GC.GU..UG */
-{{  DEF, -709, -739, -619, -739},
-{ -859,-1518,-1548,-1428,-1548},
-{ -529,-1188,-1218,-1098,-1218},
-{ -859,-1518,-1548,-1428,-1548},
-{ -409,-1068,-1098, -978,-1098}}},
-/* GC.U@..UG */
-{{{  DEF, -499, -499, -499, -569},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619}},
-/* GC.UA..UG */
-{{  DEF, -499, -499, -499, -569},
-{ -769,-1218,-1218,-1218,-1288},
-{ -529, -978, -978, -978,-1048},
-{ -709,-1158,-1158,-1158,-1228},
-{ -599,-1048,-1048,-1048,-1118}},
-/* GC.UC..UG */
-{{  DEF, -499, -499, -499, -569},
-{ -839,-1288,-1288,-1288,-1358},
-{ -529, -978, -978, -978,-1048},
-{ -859,-1308,-1308,-1308,-1378},
-{ -489, -938, -938, -938,-1008}},
-/* GC.UG..UG */
-{{  DEF, -499, -499, -499, -569},
-{-1009,-1458,-1458,-1458,-1528},
-{ -409, -858, -858, -858, -928},
-{ -969,-1418,-1418,-1418,-1488},
-{ -599,-1048,-1048,-1048,-1118}},
-/* GC.UU..UG */
-{{  DEF, -499, -499, -499, -569},
-{ -859,-1308,-1308,-1308,-1378},
-{ -529, -978, -978, -978,-1048},
-{ -859,-1308,-1308,-1308,-1378},
-{ -409, -858, -858, -858, -928}}}},
-/* GC.@@..AU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.@A..AU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* GC.@C..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* GC.@G..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* GC.@U..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* GC.A@..AU */
-{{{  DEF, -519, -879, -559, -879},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929}},
-/* GC.AA..AU */
-{{  DEF, -519, -879, -559, -879},
-{ -479, -948,-1308, -988,-1308},
-{ -309, -778,-1138, -818,-1138},
-{ -389, -858,-1218, -898,-1218},
-{ -379, -848,-1208, -888,-1208}},
-/* GC.AC..AU */
-{{  DEF, -519, -879, -559, -879},
-{ -649,-1118,-1478,-1158,-1478},
-{ -289, -758,-1118, -798,-1118},
-{ -739,-1208,-1568,-1248,-1568},
-{ -379, -848,-1208, -888,-1208}},
-/* GC.AG..AU */
-{{  DEF, -519, -879, -559, -879},
-{ -649,-1118,-1478,-1158,-1478},
-{ -289, -758,-1118, -798,-1118},
-{ -739,-1208,-1568,-1248,-1568},
-{ -379, -848,-1208, -888,-1208}},
-/* GC.AU..AU */
-{{  DEF, -519, -879, -559, -879},
-{ -649,-1118,-1478,-1158,-1478},
-{ -289, -758,-1118, -798,-1118},
-{ -739,-1208,-1568,-1248,-1568},
-{ -379, -848,-1208, -888,-1208}}},
-/* GC.C@..AU */
-{{{  DEF, -719, -309, -309, -389},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439}},
-/* GC.CA..AU */
-{{  DEF, -719, -309, -309, -389},
-{ -479,-1148, -738, -738, -818},
-{ -309, -978, -568, -568, -648},
-{ -389,-1058, -648, -648, -728},
-{ -379,-1048, -638, -638, -718}},
-/* GC.CC..AU */
-{{  DEF, -719, -309, -309, -389},
-{ -649,-1318, -908, -908, -988},
-{ -289, -958, -548, -548, -628},
-{ -739,-1408, -998, -998,-1078},
-{ -379,-1048, -638, -638, -718}},
-/* GC.CG..AU */
-{{  DEF, -719, -309, -309, -389},
-{ -649,-1318, -908, -908, -988},
-{ -289, -958, -548, -548, -628},
-{ -739,-1408, -998, -998,-1078},
-{ -379,-1048, -638, -638, -718}},
-/* GC.CU..AU */
-{{  DEF, -719, -309, -309, -389},
-{ -649,-1318, -908, -908, -988},
-{ -289, -958, -548, -548, -628},
-{ -739,-1408, -998, -998,-1078},
-{ -379,-1048, -638, -638, -718}}},
-/* GC.G@..AU */
-{{{  DEF, -709, -739, -619, -739},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789}},
-/* GC.GA..AU */
-{{  DEF, -709, -739, -619, -739},
-{ -479,-1138,-1168,-1048,-1168},
-{ -309, -968, -998, -878, -998},
-{ -389,-1048,-1078, -958,-1078},
-{ -379,-1038,-1068, -948,-1068}},
-/* GC.GC..AU */
-{{  DEF, -709, -739, -619, -739},
-{ -649,-1308,-1338,-1218,-1338},
-{ -289, -948, -978, -858, -978},
-{ -739,-1398,-1428,-1308,-1428},
-{ -379,-1038,-1068, -948,-1068}},
-/* GC.GG..AU */
-{{  DEF, -709, -739, -619, -739},
-{ -649,-1308,-1338,-1218,-1338},
-{ -289, -948, -978, -858, -978},
-{ -739,-1398,-1428,-1308,-1428},
-{ -379,-1038,-1068, -948,-1068}},
-/* GC.GU..AU */
-{{  DEF, -709, -739, -619, -739},
-{ -649,-1308,-1338,-1218,-1338},
-{ -289, -948, -978, -858, -978},
-{ -739,-1398,-1428,-1308,-1428},
-{ -379,-1038,-1068, -948,-1068}}},
-/* GC.U@..AU */
-{{{  DEF, -499, -499, -499, -569},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619}},
-/* GC.UA..AU */
-{{  DEF, -499, -499, -499, -569},
-{ -479, -928, -928, -928, -998},
-{ -309, -758, -758, -758, -828},
-{ -389, -838, -838, -838, -908},
-{ -379, -828, -828, -828, -898}},
-/* GC.UC..AU */
-{{  DEF, -499, -499, -499, -569},
-{ -649,-1098,-1098,-1098,-1168},
-{ -289, -738, -738, -738, -808},
-{ -739,-1188,-1188,-1188,-1258},
-{ -379, -828, -828, -828, -898}},
-/* GC.UG..AU */
-{{  DEF, -499, -499, -499, -569},
-{ -649,-1098,-1098,-1098,-1168},
-{ -289, -738, -738, -738, -808},
-{ -739,-1188,-1188,-1188,-1258},
-{ -379, -828, -828, -828, -898}},
-/* GC.UU..AU */
-{{  DEF, -499, -499, -499, -569},
-{ -649,-1098,-1098,-1098,-1168},
-{ -289, -738, -738, -738, -808},
-{ -739,-1188,-1188,-1188,-1258},
-{ -379, -828, -828, -828, -898}}}},
-/* GC.@@..UA */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.@A..UA */
-{{    0,    0,    0,    0,    0},
-{ -399, -399, -399, -399, -399},
-{ -429, -429, -429, -429, -429},
-{ -379, -379, -379, -379, -379},
-{ -279, -279, -279, -279, -279}},
-/* GC.@C..UA */
-{{    0,    0,    0,    0,    0},
-{ -629, -629, -629, -629, -629},
-{ -509, -509, -509, -509, -509},
-{ -679, -679, -679, -679, -679},
-{ -139, -139, -139, -139, -139}},
-/* GC.@G..UA */
-{{    0,    0,    0,    0,    0},
-{ -889, -889, -889, -889, -889},
-{ -199, -199, -199, -199, -199},
-{ -889, -889, -889, -889, -889},
-{ -279, -279, -279, -279, -279}},
-/* GC.@U..UA */
-{{    0,    0,    0,    0,    0},
-{ -589, -589, -589, -589, -589},
-{ -179, -179, -179, -179, -179},
-{ -679, -679, -679, -679, -679},
-{ -140, -140, -140, -140, -140}}},
-/* GC.A@..UA */
-{{{  DEF, -519, -879, -559, -879},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929}},
-/* GC.AA..UA */
-{{  DEF, -519, -879, -559, -879},
-{ -449, -918,-1278, -958,-1278},
-{ -479, -948,-1308, -988,-1308},
-{ -429, -898,-1258, -938,-1258},
-{ -329, -798,-1158, -838,-1158}},
-/* GC.AC..UA */
-{{  DEF, -519, -879, -559, -879},
-{ -679,-1148,-1508,-1188,-1508},
-{ -559,-1028,-1388,-1068,-1388},
-{ -729,-1198,-1558,-1238,-1558},
-{ -189, -658,-1018, -698,-1018}},
-/* GC.AG..UA */
-{{  DEF, -519, -879, -559, -879},
-{ -939,-1408,-1768,-1448,-1768},
-{ -249, -718,-1078, -758,-1078},
-{ -939,-1408,-1768,-1448,-1768},
-{ -329, -798,-1158, -838,-1158}},
-/* GC.AU..UA */
-{{  DEF, -519, -879, -559, -879},
-{ -639,-1108,-1468,-1148,-1468},
-{ -229, -698,-1058, -738,-1058},
-{ -729,-1198,-1558,-1238,-1558},
-{ -190, -659,-1019, -699,-1019}}},
-/* GC.C@..UA */
-{{{  DEF, -719, -309, -309, -389},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439}},
-/* GC.CA..UA */
-{{  DEF, -719, -309, -309, -389},
-{ -449,-1118, -708, -708, -788},
-{ -479,-1148, -738, -738, -818},
-{ -429,-1098, -688, -688, -768},
-{ -329, -998, -588, -588, -668}},
-/* GC.CC..UA */
-{{  DEF, -719, -309, -309, -389},
-{ -679,-1348, -938, -938,-1018},
-{ -559,-1228, -818, -818, -898},
-{ -729,-1398, -988, -988,-1068},
-{ -189, -858, -448, -448, -528}},
-/* GC.CG..UA */
-{{  DEF, -719, -309, -309, -389},
-{ -939,-1608,-1198,-1198,-1278},
-{ -249, -918, -508, -508, -588},
-{ -939,-1608,-1198,-1198,-1278},
-{ -329, -998, -588, -588, -668}},
-/* GC.CU..UA */
-{{  DEF, -719, -309, -309, -389},
-{ -639,-1308, -898, -898, -978},
-{ -229, -898, -488, -488, -568},
-{ -729,-1398, -988, -988,-1068},
-{ -190, -859, -449, -449, -529}}},
-/* GC.G@..UA */
-{{{  DEF, -709, -739, -619, -739},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789}},
-/* GC.GA..UA */
-{{  DEF, -709, -739, -619, -739},
-{ -449,-1108,-1138,-1018,-1138},
-{ -479,-1138,-1168,-1048,-1168},
-{ -429,-1088,-1118, -998,-1118},
-{ -329, -988,-1018, -898,-1018}},
-/* GC.GC..UA */
-{{  DEF, -709, -739, -619, -739},
-{ -679,-1338,-1368,-1248,-1368},
-{ -559,-1218,-1248,-1128,-1248},
-{ -729,-1388,-1418,-1298,-1418},
-{ -189, -848, -878, -758, -878}},
-/* GC.GG..UA */
-{{  DEF, -709, -739, -619, -739},
-{ -939,-1598,-1628,-1508,-1628},
-{ -249, -908, -938, -818, -938},
-{ -939,-1598,-1628,-1508,-1628},
-{ -329, -988,-1018, -898,-1018}},
-/* GC.GU..UA */
-{{  DEF, -709, -739, -619, -739},
-{ -639,-1298,-1328,-1208,-1328},
-{ -229, -888, -918, -798, -918},
-{ -729,-1388,-1418,-1298,-1418},
-{ -190, -849, -879, -759, -879}}},
-/* GC.U@..UA */
-{{{  DEF, -499, -499, -499, -569},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619}},
-/* GC.UA..UA */
-{{  DEF, -499, -499, -499, -569},
-{ -449, -898, -898, -898, -968},
-{ -479, -928, -928, -928, -998},
-{ -429, -878, -878, -878, -948},
-{ -329, -778, -778, -778, -848}},
-/* GC.UC..UA */
-{{  DEF, -499, -499, -499, -569},
-{ -679,-1128,-1128,-1128,-1198},
-{ -559,-1008,-1008,-1008,-1078},
-{ -729,-1178,-1178,-1178,-1248},
-{ -189, -638, -638, -638, -708}},
-/* GC.UG..UA */
-{{  DEF, -499, -499, -499, -569},
-{ -939,-1388,-1388,-1388,-1458},
-{ -249, -698, -698, -698, -768},
-{ -939,-1388,-1388,-1388,-1458},
-{ -329, -778, -778, -778, -848}},
-/* GC.UU..UA */
-{{  DEF, -499, -499, -499, -569},
-{ -639,-1088,-1088,-1088,-1158},
-{ -229, -678, -678, -678, -748},
-{ -729,-1178,-1178,-1178,-1248},
-{ -190, -639, -639, -639, -709}}}},
-/* GC.@@.. @ */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.@A.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.@C.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.@G.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GC.@U.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}}},
-/* GC.A@.. @ */
-{{{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929}},
-/* GC.AA.. @ */
-{{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929}},
-/* GC.AC.. @ */
-{{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929}},
-/* GC.AG.. @ */
-{{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929}},
-/* GC.AU.. @ */
-{{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929},
-{ -100, -569, -929, -609, -929}}},
-/* GC.C@.. @ */
-{{{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439}},
-/* GC.CA.. @ */
-{{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439}},
-/* GC.CC.. @ */
-{{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439}},
-/* GC.CG.. @ */
-{{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439}},
-/* GC.CU.. @ */
-{{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439},
-{ -100, -769, -359, -359, -439}}},
-/* GC.G@.. @ */
-{{{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789}},
-/* GC.GA.. @ */
-{{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789}},
-/* GC.GC.. @ */
-{{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789}},
-/* GC.GG.. @ */
-{{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789}},
-/* GC.GU.. @ */
-{{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789},
-{ -100, -759, -789, -669, -789}}},
-/* GC.U@.. @ */
-{{{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619}},
-/* GC.UA.. @ */
-{{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619}},
-/* GC.UC.. @ */
-{{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619}},
-/* GC.UG.. @ */
-{{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619}},
-/* GC.UU.. @ */
-{{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619},
-{ -100, -549, -549, -549, -619}}}}},
-{ /* noPair */ {{{{0}}}},
-/* GU.@@..CG */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.@A..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* GU.@C..CG */
-{{    0,    0,    0,    0,    0},
-{ -949, -949, -949, -949, -949},
-{ -449, -449, -449, -449, -449},
-{ -939, -939, -939, -939, -939},
-{ -739, -739, -739, -739, -739}},
-/* GU.@G..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* GU.@U..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -669, -669, -669, -669, -669},
-{ -939, -939, -939, -939, -939},
-{ -859, -859, -859, -859, -859}}},
-/* GU.A@..CG */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* GU.AA..CG */
-{{  DEF, -429, -599, -599, -599},
-{-1079,-1458,-1628,-1628,-1628},
-{ -569, -948,-1118,-1118,-1118},
-{ -989,-1368,-1538,-1538,-1538},
-{ -859,-1238,-1408,-1408,-1408}},
-/* GU.AC..CG */
-{{  DEF, -429, -599, -599, -599},
-{ -999,-1378,-1548,-1548,-1548},
-{ -499, -878,-1048,-1048,-1048},
-{ -989,-1368,-1538,-1538,-1538},
-{ -789,-1168,-1338,-1338,-1338}},
-/* GU.AG..CG */
-{{  DEF, -429, -599, -599, -599},
-{-1079,-1458,-1628,-1628,-1628},
-{ -569, -948,-1118,-1118,-1118},
-{ -989,-1368,-1538,-1538,-1538},
-{ -859,-1238,-1408,-1408,-1408}},
-/* GU.AU..CG */
-{{  DEF, -429, -599, -599, -599},
-{-1079,-1458,-1628,-1628,-1628},
-{ -719,-1098,-1268,-1268,-1268},
-{ -989,-1368,-1538,-1538,-1538},
-{ -909,-1288,-1458,-1458,-1458}}},
-/* GU.C@..CG */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* GU.CA..CG */
-{{  DEF, -259, -239, -239, -239},
-{-1079,-1288,-1268,-1268,-1268},
-{ -569, -778, -758, -758, -758},
-{ -989,-1198,-1178,-1178,-1178},
-{ -859,-1068,-1048,-1048,-1048}},
-/* GU.CC..CG */
-{{  DEF, -259, -239, -239, -239},
-{ -999,-1208,-1188,-1188,-1188},
-{ -499, -708, -688, -688, -688},
-{ -989,-1198,-1178,-1178,-1178},
-{ -789, -998, -978, -978, -978}},
-/* GU.CG..CG */
-{{  DEF, -259, -239, -239, -239},
-{-1079,-1288,-1268,-1268,-1268},
-{ -569, -778, -758, -758, -758},
-{ -989,-1198,-1178,-1178,-1178},
-{ -859,-1068,-1048,-1048,-1048}},
-/* GU.CU..CG */
-{{  DEF, -259, -239, -239, -239},
-{-1079,-1288,-1268,-1268,-1268},
-{ -719, -928, -908, -908, -908},
-{ -989,-1198,-1178,-1178,-1178},
-{ -909,-1118,-1098,-1098,-1098}}},
-/* GU.G@..CG */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* GU.GA..CG */
-{{  DEF, -339, -689, -689, -689},
-{-1079,-1368,-1718,-1718,-1718},
-{ -569, -858,-1208,-1208,-1208},
-{ -989,-1278,-1628,-1628,-1628},
-{ -859,-1148,-1498,-1498,-1498}},
-/* GU.GC..CG */
-{{  DEF, -339, -689, -689, -689},
-{ -999,-1288,-1638,-1638,-1638},
-{ -499, -788,-1138,-1138,-1138},
-{ -989,-1278,-1628,-1628,-1628},
-{ -789,-1078,-1428,-1428,-1428}},
-/* GU.GG..CG */
-{{  DEF, -339, -689, -689, -689},
-{-1079,-1368,-1718,-1718,-1718},
-{ -569, -858,-1208,-1208,-1208},
-{ -989,-1278,-1628,-1628,-1628},
-{ -859,-1148,-1498,-1498,-1498}},
-/* GU.GU..CG */
-{{  DEF, -339, -689, -689, -689},
-{-1079,-1368,-1718,-1718,-1718},
-{ -719,-1008,-1358,-1358,-1358},
-{ -989,-1278,-1628,-1628,-1628},
-{ -909,-1198,-1548,-1548,-1548}}},
-/* GU.U@..CG */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* GU.UA..CG */
-{{  DEF, -329, -329, -329, -329},
-{-1079,-1358,-1358,-1358,-1358},
-{ -569, -848, -848, -848, -848},
-{ -989,-1268,-1268,-1268,-1268},
-{ -859,-1138,-1138,-1138,-1138}},
-/* GU.UC..CG */
-{{  DEF, -329, -329, -329, -329},
-{ -999,-1278,-1278,-1278,-1278},
-{ -499, -778, -778, -778, -778},
-{ -989,-1268,-1268,-1268,-1268},
-{ -789,-1068,-1068,-1068,-1068}},
-/* GU.UG..CG */
-{{  DEF, -329, -329, -329, -329},
-{-1079,-1358,-1358,-1358,-1358},
-{ -569, -848, -848, -848, -848},
-{ -989,-1268,-1268,-1268,-1268},
-{ -859,-1138,-1138,-1138,-1138}},
-/* GU.UU..CG */
-{{  DEF, -329, -329, -329, -329},
-{-1079,-1358,-1358,-1358,-1358},
-{ -719, -998, -998, -998, -998},
-{ -989,-1268,-1268,-1268,-1268},
-{ -909,-1188,-1188,-1188,-1188}}}},
-/* GU.@@..GC */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.@A..GC */
-{{    0,    0,    0,    0,    0},
-{ -519, -519, -519, -519, -519},
-{ -719, -719, -719, -719, -719},
-{ -709, -709, -709, -709, -709},
-{ -499, -499, -499, -499, -499}},
-/* GU.@C..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -309, -309, -309, -309, -309},
-{ -739, -739, -739, -739, -739},
-{ -499, -499, -499, -499, -499}},
-/* GU.@G..GC */
-{{    0,    0,    0,    0,    0},
-{ -559, -559, -559, -559, -559},
-{ -309, -309, -309, -309, -309},
-{ -619, -619, -619, -619, -619},
-{ -499, -499, -499, -499, -499}},
-/* GU.@U..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -389, -389, -389, -389, -389},
-{ -739, -739, -739, -739, -739},
-{ -569, -569, -569, -569, -569}}},
-/* GU.A@..GC */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* GU.AA..GC */
-{{  DEF, -429, -599, -599, -599},
-{ -569, -948,-1118,-1118,-1118},
-{ -769,-1148,-1318,-1318,-1318},
-{ -759,-1138,-1308,-1308,-1308},
-{ -549, -928,-1098,-1098,-1098}},
-/* GU.AC..GC */
-{{  DEF, -429, -599, -599, -599},
-{ -929,-1308,-1478,-1478,-1478},
-{ -359, -738, -908, -908, -908},
-{ -789,-1168,-1338,-1338,-1338},
-{ -549, -928,-1098,-1098,-1098}},
-/* GU.AG..GC */
-{{  DEF, -429, -599, -599, -599},
-{ -609, -988,-1158,-1158,-1158},
-{ -359, -738, -908, -908, -908},
-{ -669,-1048,-1218,-1218,-1218},
-{ -549, -928,-1098,-1098,-1098}},
-/* GU.AU..GC */
-{{  DEF, -429, -599, -599, -599},
-{ -929,-1308,-1478,-1478,-1478},
-{ -439, -818, -988, -988, -988},
-{ -789,-1168,-1338,-1338,-1338},
-{ -619, -998,-1168,-1168,-1168}}},
-/* GU.C@..GC */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* GU.CA..GC */
-{{  DEF, -259, -239, -239, -239},
-{ -569, -778, -758, -758, -758},
-{ -769, -978, -958, -958, -958},
-{ -759, -968, -948, -948, -948},
-{ -549, -758, -738, -738, -738}},
-/* GU.CC..GC */
-{{  DEF, -259, -239, -239, -239},
-{ -929,-1138,-1118,-1118,-1118},
-{ -359, -568, -548, -548, -548},
-{ -789, -998, -978, -978, -978},
-{ -549, -758, -738, -738, -738}},
-/* GU.CG..GC */
-{{  DEF, -259, -239, -239, -239},
-{ -609, -818, -798, -798, -798},
-{ -359, -568, -548, -548, -548},
-{ -669, -878, -858, -858, -858},
-{ -549, -758, -738, -738, -738}},
-/* GU.CU..GC */
-{{  DEF, -259, -239, -239, -239},
-{ -929,-1138,-1118,-1118,-1118},
-{ -439, -648, -628, -628, -628},
-{ -789, -998, -978, -978, -978},
-{ -619, -828, -808, -808, -808}}},
-/* GU.G@..GC */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* GU.GA..GC */
-{{  DEF, -339, -689, -689, -689},
-{ -569, -858,-1208,-1208,-1208},
-{ -769,-1058,-1408,-1408,-1408},
-{ -759,-1048,-1398,-1398,-1398},
-{ -549, -838,-1188,-1188,-1188}},
-/* GU.GC..GC */
-{{  DEF, -339, -689, -689, -689},
-{ -929,-1218,-1568,-1568,-1568},
-{ -359, -648, -998, -998, -998},
-{ -789,-1078,-1428,-1428,-1428},
-{ -549, -838,-1188,-1188,-1188}},
-/* GU.GG..GC */
-{{  DEF, -339, -689, -689, -689},
-{ -609, -898,-1248,-1248,-1248},
-{ -359, -648, -998, -998, -998},
-{ -669, -958,-1308,-1308,-1308},
-{ -549, -838,-1188,-1188,-1188}},
-/* GU.GU..GC */
-{{  DEF, -339, -689, -689, -689},
-{ -929,-1218,-1568,-1568,-1568},
-{ -439, -728,-1078,-1078,-1078},
-{ -789,-1078,-1428,-1428,-1428},
-{ -619, -908,-1258,-1258,-1258}}},
-/* GU.U@..GC */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* GU.UA..GC */
-{{  DEF, -329, -329, -329, -329},
-{ -569, -848, -848, -848, -848},
-{ -769,-1048,-1048,-1048,-1048},
-{ -759,-1038,-1038,-1038,-1038},
-{ -549, -828, -828, -828, -828}},
-/* GU.UC..GC */
-{{  DEF, -329, -329, -329, -329},
-{ -929,-1208,-1208,-1208,-1208},
-{ -359, -638, -638, -638, -638},
-{ -789,-1068,-1068,-1068,-1068},
-{ -549, -828, -828, -828, -828}},
-/* GU.UG..GC */
-{{  DEF, -329, -329, -329, -329},
-{ -609, -888, -888, -888, -888},
-{ -359, -638, -638, -638, -638},
-{ -669, -948, -948, -948, -948},
-{ -549, -828, -828, -828, -828}},
-/* GU.UU..GC */
-{{  DEF, -329, -329, -329, -329},
-{ -929,-1208,-1208,-1208,-1208},
-{ -439, -718, -718, -718, -718},
-{ -789,-1068,-1068,-1068,-1068},
-{ -619, -898, -898, -898, -898}}}},
-/* GU.@@..GU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.@A..GU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* GU.@C..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* GU.@G..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* GU.@U..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* GU.A@..GU */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* GU.AA..GU */
-{{  DEF, -429, -599, -599, -599},
-{ -479, -858,-1028,-1028,-1028},
-{ -309, -688, -858, -858, -858},
-{ -389, -768, -938, -938, -938},
-{ -379, -758, -928, -928, -928}},
-/* GU.AC..GU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}},
-/* GU.AG..GU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}},
-/* GU.AU..GU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}}},
-/* GU.C@..GU */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* GU.CA..GU */
-{{  DEF, -259, -239, -239, -239},
-{ -479, -688, -668, -668, -668},
-{ -309, -518, -498, -498, -498},
-{ -389, -598, -578, -578, -578},
-{ -379, -588, -568, -568, -568}},
-/* GU.CC..GU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}},
-/* GU.CG..GU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}},
-/* GU.CU..GU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}}},
-/* GU.G@..GU */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* GU.GA..GU */
-{{  DEF, -339, -689, -689, -689},
-{ -479, -768,-1118,-1118,-1118},
-{ -309, -598, -948, -948, -948},
-{ -389, -678,-1028,-1028,-1028},
-{ -379, -668,-1018,-1018,-1018}},
-/* GU.GC..GU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}},
-/* GU.GG..GU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}},
-/* GU.GU..GU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}}},
-/* GU.U@..GU */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* GU.UA..GU */
-{{  DEF, -329, -329, -329, -329},
-{ -479, -758, -758, -758, -758},
-{ -309, -588, -588, -588, -588},
-{ -389, -668, -668, -668, -668},
-{ -379, -658, -658, -658, -658}},
-/* GU.UC..GU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}},
-/* GU.UG..GU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}},
-/* GU.UU..GU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}}}},
-/* GU.@@..UG */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.@A..UG */
-{{    0,    0,    0,    0,    0},
-{ -719, -719, -719, -719, -719},
-{ -479, -479, -479, -479, -479},
-{ -659, -659, -659, -659, -659},
-{ -549, -549, -549, -549, -549}},
-/* GU.@C..UG */
-{{    0,    0,    0,    0,    0},
-{ -789, -789, -789, -789, -789},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -439, -439, -439, -439, -439}},
-/* GU.@G..UG */
-{{    0,    0,    0,    0,    0},
-{ -959, -959, -959, -959, -959},
-{ -359, -359, -359, -359, -359},
-{ -919, -919, -919, -919, -919},
-{ -549, -549, -549, -549, -549}},
-/* GU.@U..UG */
-{{    0,    0,    0,    0,    0},
-{ -809, -809, -809, -809, -809},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -359, -359, -359, -359, -359}}},
-/* GU.A@..UG */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* GU.AA..UG */
-{{  DEF, -429, -599, -599, -599},
-{ -769,-1148,-1318,-1318,-1318},
-{ -529, -908,-1078,-1078,-1078},
-{ -709,-1088,-1258,-1258,-1258},
-{ -599, -978,-1148,-1148,-1148}},
-/* GU.AC..UG */
-{{  DEF, -429, -599, -599, -599},
-{ -839,-1218,-1388,-1388,-1388},
-{ -529, -908,-1078,-1078,-1078},
-{ -859,-1238,-1408,-1408,-1408},
-{ -489, -868,-1038,-1038,-1038}},
-/* GU.AG..UG */
-{{  DEF, -429, -599, -599, -599},
-{-1009,-1388,-1558,-1558,-1558},
-{ -409, -788, -958, -958, -958},
-{ -969,-1348,-1518,-1518,-1518},
-{ -599, -978,-1148,-1148,-1148}},
-/* GU.AU..UG */
-{{  DEF, -429, -599, -599, -599},
-{ -859,-1238,-1408,-1408,-1408},
-{ -529, -908,-1078,-1078,-1078},
-{ -859,-1238,-1408,-1408,-1408},
-{ -409, -788, -958, -958, -958}}},
-/* GU.C@..UG */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* GU.CA..UG */
-{{  DEF, -259, -239, -239, -239},
-{ -769, -978, -958, -958, -958},
-{ -529, -738, -718, -718, -718},
-{ -709, -918, -898, -898, -898},
-{ -599, -808, -788, -788, -788}},
-/* GU.CC..UG */
-{{  DEF, -259, -239, -239, -239},
-{ -839,-1048,-1028,-1028,-1028},
-{ -529, -738, -718, -718, -718},
-{ -859,-1068,-1048,-1048,-1048},
-{ -489, -698, -678, -678, -678}},
-/* GU.CG..UG */
-{{  DEF, -259, -239, -239, -239},
-{-1009,-1218,-1198,-1198,-1198},
-{ -409, -618, -598, -598, -598},
-{ -969,-1178,-1158,-1158,-1158},
-{ -599, -808, -788, -788, -788}},
-/* GU.CU..UG */
-{{  DEF, -259, -239, -239, -239},
-{ -859,-1068,-1048,-1048,-1048},
-{ -529, -738, -718, -718, -718},
-{ -859,-1068,-1048,-1048,-1048},
-{ -409, -618, -598, -598, -598}}},
-/* GU.G@..UG */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* GU.GA..UG */
-{{  DEF, -339, -689, -689, -689},
-{ -769,-1058,-1408,-1408,-1408},
-{ -529, -818,-1168,-1168,-1168},
-{ -709, -998,-1348,-1348,-1348},
-{ -599, -888,-1238,-1238,-1238}},
-/* GU.GC..UG */
-{{  DEF, -339, -689, -689, -689},
-{ -839,-1128,-1478,-1478,-1478},
-{ -529, -818,-1168,-1168,-1168},
-{ -859,-1148,-1498,-1498,-1498},
-{ -489, -778,-1128,-1128,-1128}},
-/* GU.GG..UG */
-{{  DEF, -339, -689, -689, -689},
-{-1009,-1298,-1648,-1648,-1648},
-{ -409, -698,-1048,-1048,-1048},
-{ -969,-1258,-1608,-1608,-1608},
-{ -599, -888,-1238,-1238,-1238}},
-/* GU.GU..UG */
-{{  DEF, -339, -689, -689, -689},
-{ -859,-1148,-1498,-1498,-1498},
-{ -529, -818,-1168,-1168,-1168},
-{ -859,-1148,-1498,-1498,-1498},
-{ -409, -698,-1048,-1048,-1048}}},
-/* GU.U@..UG */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* GU.UA..UG */
-{{  DEF, -329, -329, -329, -329},
-{ -769,-1048,-1048,-1048,-1048},
-{ -529, -808, -808, -808, -808},
-{ -709, -988, -988, -988, -988},
-{ -599, -878, -878, -878, -878}},
-/* GU.UC..UG */
-{{  DEF, -329, -329, -329, -329},
-{ -839,-1118,-1118,-1118,-1118},
-{ -529, -808, -808, -808, -808},
-{ -859,-1138,-1138,-1138,-1138},
-{ -489, -768, -768, -768, -768}},
-/* GU.UG..UG */
-{{  DEF, -329, -329, -329, -329},
-{-1009,-1288,-1288,-1288,-1288},
-{ -409, -688, -688, -688, -688},
-{ -969,-1248,-1248,-1248,-1248},
-{ -599, -878, -878, -878, -878}},
-/* GU.UU..UG */
-{{  DEF, -329, -329, -329, -329},
-{ -859,-1138,-1138,-1138,-1138},
-{ -529, -808, -808, -808, -808},
-{ -859,-1138,-1138,-1138,-1138},
-{ -409, -688, -688, -688, -688}}}},
-/* GU.@@..AU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.@A..AU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* GU.@C..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* GU.@G..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* GU.@U..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* GU.A@..AU */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* GU.AA..AU */
-{{  DEF, -429, -599, -599, -599},
-{ -479, -858,-1028,-1028,-1028},
-{ -309, -688, -858, -858, -858},
-{ -389, -768, -938, -938, -938},
-{ -379, -758, -928, -928, -928}},
-/* GU.AC..AU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}},
-/* GU.AG..AU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}},
-/* GU.AU..AU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}}},
-/* GU.C@..AU */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* GU.CA..AU */
-{{  DEF, -259, -239, -239, -239},
-{ -479, -688, -668, -668, -668},
-{ -309, -518, -498, -498, -498},
-{ -389, -598, -578, -578, -578},
-{ -379, -588, -568, -568, -568}},
-/* GU.CC..AU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}},
-/* GU.CG..AU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}},
-/* GU.CU..AU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}}},
-/* GU.G@..AU */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* GU.GA..AU */
-{{  DEF, -339, -689, -689, -689},
-{ -479, -768,-1118,-1118,-1118},
-{ -309, -598, -948, -948, -948},
-{ -389, -678,-1028,-1028,-1028},
-{ -379, -668,-1018,-1018,-1018}},
-/* GU.GC..AU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}},
-/* GU.GG..AU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}},
-/* GU.GU..AU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}}},
-/* GU.U@..AU */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* GU.UA..AU */
-{{  DEF, -329, -329, -329, -329},
-{ -479, -758, -758, -758, -758},
-{ -309, -588, -588, -588, -588},
-{ -389, -668, -668, -668, -668},
-{ -379, -658, -658, -658, -658}},
-/* GU.UC..AU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}},
-/* GU.UG..AU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}},
-/* GU.UU..AU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}}}},
-/* GU.@@..UA */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.@A..UA */
-{{    0,    0,    0,    0,    0},
-{ -399, -399, -399, -399, -399},
-{ -429, -429, -429, -429, -429},
-{ -379, -379, -379, -379, -379},
-{ -279, -279, -279, -279, -279}},
-/* GU.@C..UA */
-{{    0,    0,    0,    0,    0},
-{ -629, -629, -629, -629, -629},
-{ -509, -509, -509, -509, -509},
-{ -679, -679, -679, -679, -679},
-{ -139, -139, -139, -139, -139}},
-/* GU.@G..UA */
-{{    0,    0,    0,    0,    0},
-{ -889, -889, -889, -889, -889},
-{ -199, -199, -199, -199, -199},
-{ -889, -889, -889, -889, -889},
-{ -279, -279, -279, -279, -279}},
-/* GU.@U..UA */
-{{    0,    0,    0,    0,    0},
-{ -589, -589, -589, -589, -589},
-{ -179, -179, -179, -179, -179},
-{ -679, -679, -679, -679, -679},
-{ -140, -140, -140, -140, -140}}},
-/* GU.A@..UA */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* GU.AA..UA */
-{{  DEF, -429, -599, -599, -599},
-{ -449, -828, -998, -998, -998},
-{ -479, -858,-1028,-1028,-1028},
-{ -429, -808, -978, -978, -978},
-{ -329, -708, -878, -878, -878}},
-/* GU.AC..UA */
-{{  DEF, -429, -599, -599, -599},
-{ -679,-1058,-1228,-1228,-1228},
-{ -559, -938,-1108,-1108,-1108},
-{ -729,-1108,-1278,-1278,-1278},
-{ -189, -568, -738, -738, -738}},
-/* GU.AG..UA */
-{{  DEF, -429, -599, -599, -599},
-{ -939,-1318,-1488,-1488,-1488},
-{ -249, -628, -798, -798, -798},
-{ -939,-1318,-1488,-1488,-1488},
-{ -329, -708, -878, -878, -878}},
-/* GU.AU..UA */
-{{  DEF, -429, -599, -599, -599},
-{ -639,-1018,-1188,-1188,-1188},
-{ -229, -608, -778, -778, -778},
-{ -729,-1108,-1278,-1278,-1278},
-{ -190, -569, -739, -739, -739}}},
-/* GU.C@..UA */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* GU.CA..UA */
-{{  DEF, -259, -239, -239, -239},
-{ -449, -658, -638, -638, -638},
-{ -479, -688, -668, -668, -668},
-{ -429, -638, -618, -618, -618},
-{ -329, -538, -518, -518, -518}},
-/* GU.CC..UA */
-{{  DEF, -259, -239, -239, -239},
-{ -679, -888, -868, -868, -868},
-{ -559, -768, -748, -748, -748},
-{ -729, -938, -918, -918, -918},
-{ -189, -398, -378, -378, -378}},
-/* GU.CG..UA */
-{{  DEF, -259, -239, -239, -239},
-{ -939,-1148,-1128,-1128,-1128},
-{ -249, -458, -438, -438, -438},
-{ -939,-1148,-1128,-1128,-1128},
-{ -329, -538, -518, -518, -518}},
-/* GU.CU..UA */
-{{  DEF, -259, -239, -239, -239},
-{ -639, -848, -828, -828, -828},
-{ -229, -438, -418, -418, -418},
-{ -729, -938, -918, -918, -918},
-{ -190, -399, -379, -379, -379}}},
-/* GU.G@..UA */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* GU.GA..UA */
-{{  DEF, -339, -689, -689, -689},
-{ -449, -738,-1088,-1088,-1088},
-{ -479, -768,-1118,-1118,-1118},
-{ -429, -718,-1068,-1068,-1068},
-{ -329, -618, -968, -968, -968}},
-/* GU.GC..UA */
-{{  DEF, -339, -689, -689, -689},
-{ -679, -968,-1318,-1318,-1318},
-{ -559, -848,-1198,-1198,-1198},
-{ -729,-1018,-1368,-1368,-1368},
-{ -189, -478, -828, -828, -828}},
-/* GU.GG..UA */
-{{  DEF, -339, -689, -689, -689},
-{ -939,-1228,-1578,-1578,-1578},
-{ -249, -538, -888, -888, -888},
-{ -939,-1228,-1578,-1578,-1578},
-{ -329, -618, -968, -968, -968}},
-/* GU.GU..UA */
-{{  DEF, -339, -689, -689, -689},
-{ -639, -928,-1278,-1278,-1278},
-{ -229, -518, -868, -868, -868},
-{ -729,-1018,-1368,-1368,-1368},
-{ -190, -479, -829, -829, -829}}},
-/* GU.U@..UA */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* GU.UA..UA */
-{{  DEF, -329, -329, -329, -329},
-{ -449, -728, -728, -728, -728},
-{ -479, -758, -758, -758, -758},
-{ -429, -708, -708, -708, -708},
-{ -329, -608, -608, -608, -608}},
-/* GU.UC..UA */
-{{  DEF, -329, -329, -329, -329},
-{ -679, -958, -958, -958, -958},
-{ -559, -838, -838, -838, -838},
-{ -729,-1008,-1008,-1008,-1008},
-{ -189, -468, -468, -468, -468}},
-/* GU.UG..UA */
-{{  DEF, -329, -329, -329, -329},
-{ -939,-1218,-1218,-1218,-1218},
-{ -249, -528, -528, -528, -528},
-{ -939,-1218,-1218,-1218,-1218},
-{ -329, -608, -608, -608, -608}},
-/* GU.UU..UA */
-{{  DEF, -329, -329, -329, -329},
-{ -639, -918, -918, -918, -918},
-{ -229, -508, -508, -508, -508},
-{ -729,-1008,-1008,-1008,-1008},
-{ -190, -469, -469, -469, -469}}}},
-/* GU.@@.. @ */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.@A.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.@C.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.@G.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* GU.@U.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}}},
-/* GU.A@.. @ */
-{{{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* GU.AA.. @ */
-{{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* GU.AC.. @ */
-{{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* GU.AG.. @ */
-{{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* GU.AU.. @ */
-{{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}}},
-/* GU.C@.. @ */
-{{{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* GU.CA.. @ */
-{{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* GU.CC.. @ */
-{{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* GU.CG.. @ */
-{{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* GU.CU.. @ */
-{{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}}},
-/* GU.G@.. @ */
-{{{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* GU.GA.. @ */
-{{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* GU.GC.. @ */
-{{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* GU.GG.. @ */
-{{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* GU.GU.. @ */
-{{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}}},
-/* GU.U@.. @ */
-{{{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* GU.UA.. @ */
-{{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* GU.UC.. @ */
-{{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* GU.UG.. @ */
-{{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* GU.UU.. @ */
-{{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}}}}},
-{ /* noPair */ {{{{0}}}},
-/* UG.@@..CG */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.@A..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* UG.@C..CG */
-{{    0,    0,    0,    0,    0},
-{ -949, -949, -949, -949, -949},
-{ -449, -449, -449, -449, -449},
-{ -939, -939, -939, -939, -939},
-{ -739, -739, -739, -739, -739}},
-/* UG.@G..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* UG.@U..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -669, -669, -669, -669, -669},
-{ -939, -939, -939, -939, -939},
-{ -859, -859, -859, -859, -859}}},
-/* UG.A@..CG */
-{{{  DEF, -719, -789, -959, -809},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859}},
-/* UG.AA..CG */
-{{  DEF, -719, -789, -959, -809},
-{-1079,-1748,-1818,-1988,-1838},
-{ -569,-1238,-1308,-1478,-1328},
-{ -989,-1658,-1728,-1898,-1748},
-{ -859,-1528,-1598,-1768,-1618}},
-/* UG.AC..CG */
-{{  DEF, -719, -789, -959, -809},
-{ -999,-1668,-1738,-1908,-1758},
-{ -499,-1168,-1238,-1408,-1258},
-{ -989,-1658,-1728,-1898,-1748},
-{ -789,-1458,-1528,-1698,-1548}},
-/* UG.AG..CG */
-{{  DEF, -719, -789, -959, -809},
-{-1079,-1748,-1818,-1988,-1838},
-{ -569,-1238,-1308,-1478,-1328},
-{ -989,-1658,-1728,-1898,-1748},
-{ -859,-1528,-1598,-1768,-1618}},
-/* UG.AU..CG */
-{{  DEF, -719, -789, -959, -809},
-{-1079,-1748,-1818,-1988,-1838},
-{ -719,-1388,-1458,-1628,-1478},
-{ -989,-1658,-1728,-1898,-1748},
-{ -909,-1578,-1648,-1818,-1668}}},
-/* UG.C@..CG */
-{{{  DEF, -479, -479, -359, -479},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529}},
-/* UG.CA..CG */
-{{  DEF, -479, -479, -359, -479},
-{-1079,-1508,-1508,-1388,-1508},
-{ -569, -998, -998, -878, -998},
-{ -989,-1418,-1418,-1298,-1418},
-{ -859,-1288,-1288,-1168,-1288}},
-/* UG.CC..CG */
-{{  DEF, -479, -479, -359, -479},
-{ -999,-1428,-1428,-1308,-1428},
-{ -499, -928, -928, -808, -928},
-{ -989,-1418,-1418,-1298,-1418},
-{ -789,-1218,-1218,-1098,-1218}},
-/* UG.CG..CG */
-{{  DEF, -479, -479, -359, -479},
-{-1079,-1508,-1508,-1388,-1508},
-{ -569, -998, -998, -878, -998},
-{ -989,-1418,-1418,-1298,-1418},
-{ -859,-1288,-1288,-1168,-1288}},
-/* UG.CU..CG */
-{{  DEF, -479, -479, -359, -479},
-{-1079,-1508,-1508,-1388,-1508},
-{ -719,-1148,-1148,-1028,-1148},
-{ -989,-1418,-1418,-1298,-1418},
-{ -909,-1338,-1338,-1218,-1338}}},
-/* UG.G@..CG */
-{{{  DEF, -659, -809, -919, -809},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859}},
-/* UG.GA..CG */
-{{  DEF, -659, -809, -919, -809},
-{-1079,-1688,-1838,-1948,-1838},
-{ -569,-1178,-1328,-1438,-1328},
-{ -989,-1598,-1748,-1858,-1748},
-{ -859,-1468,-1618,-1728,-1618}},
-/* UG.GC..CG */
-{{  DEF, -659, -809, -919, -809},
-{ -999,-1608,-1758,-1868,-1758},
-{ -499,-1108,-1258,-1368,-1258},
-{ -989,-1598,-1748,-1858,-1748},
-{ -789,-1398,-1548,-1658,-1548}},
-/* UG.GG..CG */
-{{  DEF, -659, -809, -919, -809},
-{-1079,-1688,-1838,-1948,-1838},
-{ -569,-1178,-1328,-1438,-1328},
-{ -989,-1598,-1748,-1858,-1748},
-{ -859,-1468,-1618,-1728,-1618}},
-/* UG.GU..CG */
-{{  DEF, -659, -809, -919, -809},
-{-1079,-1688,-1838,-1948,-1838},
-{ -719,-1328,-1478,-1588,-1478},
-{ -989,-1598,-1748,-1858,-1748},
-{ -909,-1518,-1668,-1778,-1668}}},
-/* UG.U@..CG */
-{{{  DEF, -549, -439, -549, -359},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409}},
-/* UG.UA..CG */
-{{  DEF, -549, -439, -549, -359},
-{-1079,-1578,-1468,-1578,-1388},
-{ -569,-1068, -958,-1068, -878},
-{ -989,-1488,-1378,-1488,-1298},
-{ -859,-1358,-1248,-1358,-1168}},
-/* UG.UC..CG */
-{{  DEF, -549, -439, -549, -359},
-{ -999,-1498,-1388,-1498,-1308},
-{ -499, -998, -888, -998, -808},
-{ -989,-1488,-1378,-1488,-1298},
-{ -789,-1288,-1178,-1288,-1098}},
-/* UG.UG..CG */
-{{  DEF, -549, -439, -549, -359},
-{-1079,-1578,-1468,-1578,-1388},
-{ -569,-1068, -958,-1068, -878},
-{ -989,-1488,-1378,-1488,-1298},
-{ -859,-1358,-1248,-1358,-1168}},
-/* UG.UU..CG */
-{{  DEF, -549, -439, -549, -359},
-{-1079,-1578,-1468,-1578,-1388},
-{ -719,-1218,-1108,-1218,-1028},
-{ -989,-1488,-1378,-1488,-1298},
-{ -909,-1408,-1298,-1408,-1218}}}},
-/* UG.@@..GC */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.@A..GC */
-{{    0,    0,    0,    0,    0},
-{ -519, -519, -519, -519, -519},
-{ -719, -719, -719, -719, -719},
-{ -709, -709, -709, -709, -709},
-{ -499, -499, -499, -499, -499}},
-/* UG.@C..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -309, -309, -309, -309, -309},
-{ -739, -739, -739, -739, -739},
-{ -499, -499, -499, -499, -499}},
-/* UG.@G..GC */
-{{    0,    0,    0,    0,    0},
-{ -559, -559, -559, -559, -559},
-{ -309, -309, -309, -309, -309},
-{ -619, -619, -619, -619, -619},
-{ -499, -499, -499, -499, -499}},
-/* UG.@U..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -389, -389, -389, -389, -389},
-{ -739, -739, -739, -739, -739},
-{ -569, -569, -569, -569, -569}}},
-/* UG.A@..GC */
-{{{  DEF, -719, -789, -959, -809},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859}},
-/* UG.AA..GC */
-{{  DEF, -719, -789, -959, -809},
-{ -569,-1238,-1308,-1478,-1328},
-{ -769,-1438,-1508,-1678,-1528},
-{ -759,-1428,-1498,-1668,-1518},
-{ -549,-1218,-1288,-1458,-1308}},
-/* UG.AC..GC */
-{{  DEF, -719, -789, -959, -809},
-{ -929,-1598,-1668,-1838,-1688},
-{ -359,-1028,-1098,-1268,-1118},
-{ -789,-1458,-1528,-1698,-1548},
-{ -549,-1218,-1288,-1458,-1308}},
-/* UG.AG..GC */
-{{  DEF, -719, -789, -959, -809},
-{ -609,-1278,-1348,-1518,-1368},
-{ -359,-1028,-1098,-1268,-1118},
-{ -669,-1338,-1408,-1578,-1428},
-{ -549,-1218,-1288,-1458,-1308}},
-/* UG.AU..GC */
-{{  DEF, -719, -789, -959, -809},
-{ -929,-1598,-1668,-1838,-1688},
-{ -439,-1108,-1178,-1348,-1198},
-{ -789,-1458,-1528,-1698,-1548},
-{ -619,-1288,-1358,-1528,-1378}}},
-/* UG.C@..GC */
-{{{  DEF, -479, -479, -359, -479},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529}},
-/* UG.CA..GC */
-{{  DEF, -479, -479, -359, -479},
-{ -569, -998, -998, -878, -998},
-{ -769,-1198,-1198,-1078,-1198},
-{ -759,-1188,-1188,-1068,-1188},
-{ -549, -978, -978, -858, -978}},
-/* UG.CC..GC */
-{{  DEF, -479, -479, -359, -479},
-{ -929,-1358,-1358,-1238,-1358},
-{ -359, -788, -788, -668, -788},
-{ -789,-1218,-1218,-1098,-1218},
-{ -549, -978, -978, -858, -978}},
-/* UG.CG..GC */
-{{  DEF, -479, -479, -359, -479},
-{ -609,-1038,-1038, -918,-1038},
-{ -359, -788, -788, -668, -788},
-{ -669,-1098,-1098, -978,-1098},
-{ -549, -978, -978, -858, -978}},
-/* UG.CU..GC */
-{{  DEF, -479, -479, -359, -479},
-{ -929,-1358,-1358,-1238,-1358},
-{ -439, -868, -868, -748, -868},
-{ -789,-1218,-1218,-1098,-1218},
-{ -619,-1048,-1048, -928,-1048}}},
-/* UG.G@..GC */
-{{{  DEF, -659, -809, -919, -809},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859}},
-/* UG.GA..GC */
-{{  DEF, -659, -809, -919, -809},
-{ -569,-1178,-1328,-1438,-1328},
-{ -769,-1378,-1528,-1638,-1528},
-{ -759,-1368,-1518,-1628,-1518},
-{ -549,-1158,-1308,-1418,-1308}},
-/* UG.GC..GC */
-{{  DEF, -659, -809, -919, -809},
-{ -929,-1538,-1688,-1798,-1688},
-{ -359, -968,-1118,-1228,-1118},
-{ -789,-1398,-1548,-1658,-1548},
-{ -549,-1158,-1308,-1418,-1308}},
-/* UG.GG..GC */
-{{  DEF, -659, -809, -919, -809},
-{ -609,-1218,-1368,-1478,-1368},
-{ -359, -968,-1118,-1228,-1118},
-{ -669,-1278,-1428,-1538,-1428},
-{ -549,-1158,-1308,-1418,-1308}},
-/* UG.GU..GC */
-{{  DEF, -659, -809, -919, -809},
-{ -929,-1538,-1688,-1798,-1688},
-{ -439,-1048,-1198,-1308,-1198},
-{ -789,-1398,-1548,-1658,-1548},
-{ -619,-1228,-1378,-1488,-1378}}},
-/* UG.U@..GC */
-{{{  DEF, -549, -439, -549, -359},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409}},
-/* UG.UA..GC */
-{{  DEF, -549, -439, -549, -359},
-{ -569,-1068, -958,-1068, -878},
-{ -769,-1268,-1158,-1268,-1078},
-{ -759,-1258,-1148,-1258,-1068},
-{ -549,-1048, -938,-1048, -858}},
-/* UG.UC..GC */
-{{  DEF, -549, -439, -549, -359},
-{ -929,-1428,-1318,-1428,-1238},
-{ -359, -858, -748, -858, -668},
-{ -789,-1288,-1178,-1288,-1098},
-{ -549,-1048, -938,-1048, -858}},
-/* UG.UG..GC */
-{{  DEF, -549, -439, -549, -359},
-{ -609,-1108, -998,-1108, -918},
-{ -359, -858, -748, -858, -668},
-{ -669,-1168,-1058,-1168, -978},
-{ -549,-1048, -938,-1048, -858}},
-/* UG.UU..GC */
-{{  DEF, -549, -439, -549, -359},
-{ -929,-1428,-1318,-1428,-1238},
-{ -439, -938, -828, -938, -748},
-{ -789,-1288,-1178,-1288,-1098},
-{ -619,-1118,-1008,-1118, -928}}}},
-/* UG.@@..GU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.@A..GU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* UG.@C..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* UG.@G..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* UG.@U..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* UG.A@..GU */
-{{{  DEF, -719, -789, -959, -809},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859}},
-/* UG.AA..GU */
-{{  DEF, -719, -789, -959, -809},
-{ -479,-1148,-1218,-1388,-1238},
-{ -309, -978,-1048,-1218,-1068},
-{ -389,-1058,-1128,-1298,-1148},
-{ -379,-1048,-1118,-1288,-1138}},
-/* UG.AC..GU */
-{{  DEF, -719, -789, -959, -809},
-{ -649,-1318,-1388,-1558,-1408},
-{ -289, -958,-1028,-1198,-1048},
-{ -739,-1408,-1478,-1648,-1498},
-{ -379,-1048,-1118,-1288,-1138}},
-/* UG.AG..GU */
-{{  DEF, -719, -789, -959, -809},
-{ -649,-1318,-1388,-1558,-1408},
-{ -289, -958,-1028,-1198,-1048},
-{ -739,-1408,-1478,-1648,-1498},
-{ -379,-1048,-1118,-1288,-1138}},
-/* UG.AU..GU */
-{{  DEF, -719, -789, -959, -809},
-{ -649,-1318,-1388,-1558,-1408},
-{ -289, -958,-1028,-1198,-1048},
-{ -739,-1408,-1478,-1648,-1498},
-{ -379,-1048,-1118,-1288,-1138}}},
-/* UG.C@..GU */
-{{{  DEF, -479, -479, -359, -479},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529}},
-/* UG.CA..GU */
-{{  DEF, -479, -479, -359, -479},
-{ -479, -908, -908, -788, -908},
-{ -309, -738, -738, -618, -738},
-{ -389, -818, -818, -698, -818},
-{ -379, -808, -808, -688, -808}},
-/* UG.CC..GU */
-{{  DEF, -479, -479, -359, -479},
-{ -649,-1078,-1078, -958,-1078},
-{ -289, -718, -718, -598, -718},
-{ -739,-1168,-1168,-1048,-1168},
-{ -379, -808, -808, -688, -808}},
-/* UG.CG..GU */
-{{  DEF, -479, -479, -359, -479},
-{ -649,-1078,-1078, -958,-1078},
-{ -289, -718, -718, -598, -718},
-{ -739,-1168,-1168,-1048,-1168},
-{ -379, -808, -808, -688, -808}},
-/* UG.CU..GU */
-{{  DEF, -479, -479, -359, -479},
-{ -649,-1078,-1078, -958,-1078},
-{ -289, -718, -718, -598, -718},
-{ -739,-1168,-1168,-1048,-1168},
-{ -379, -808, -808, -688, -808}}},
-/* UG.G@..GU */
-{{{  DEF, -659, -809, -919, -809},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859}},
-/* UG.GA..GU */
-{{  DEF, -659, -809, -919, -809},
-{ -479,-1088,-1238,-1348,-1238},
-{ -309, -918,-1068,-1178,-1068},
-{ -389, -998,-1148,-1258,-1148},
-{ -379, -988,-1138,-1248,-1138}},
-/* UG.GC..GU */
-{{  DEF, -659, -809, -919, -809},
-{ -649,-1258,-1408,-1518,-1408},
-{ -289, -898,-1048,-1158,-1048},
-{ -739,-1348,-1498,-1608,-1498},
-{ -379, -988,-1138,-1248,-1138}},
-/* UG.GG..GU */
-{{  DEF, -659, -809, -919, -809},
-{ -649,-1258,-1408,-1518,-1408},
-{ -289, -898,-1048,-1158,-1048},
-{ -739,-1348,-1498,-1608,-1498},
-{ -379, -988,-1138,-1248,-1138}},
-/* UG.GU..GU */
-{{  DEF, -659, -809, -919, -809},
-{ -649,-1258,-1408,-1518,-1408},
-{ -289, -898,-1048,-1158,-1048},
-{ -739,-1348,-1498,-1608,-1498},
-{ -379, -988,-1138,-1248,-1138}}},
-/* UG.U@..GU */
-{{{  DEF, -549, -439, -549, -359},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409}},
-/* UG.UA..GU */
-{{  DEF, -549, -439, -549, -359},
-{ -479, -978, -868, -978, -788},
-{ -309, -808, -698, -808, -618},
-{ -389, -888, -778, -888, -698},
-{ -379, -878, -768, -878, -688}},
-/* UG.UC..GU */
-{{  DEF, -549, -439, -549, -359},
-{ -649,-1148,-1038,-1148, -958},
-{ -289, -788, -678, -788, -598},
-{ -739,-1238,-1128,-1238,-1048},
-{ -379, -878, -768, -878, -688}},
-/* UG.UG..GU */
-{{  DEF, -549, -439, -549, -359},
-{ -649,-1148,-1038,-1148, -958},
-{ -289, -788, -678, -788, -598},
-{ -739,-1238,-1128,-1238,-1048},
-{ -379, -878, -768, -878, -688}},
-/* UG.UU..GU */
-{{  DEF, -549, -439, -549, -359},
-{ -649,-1148,-1038,-1148, -958},
-{ -289, -788, -678, -788, -598},
-{ -739,-1238,-1128,-1238,-1048},
-{ -379, -878, -768, -878, -688}}}},
-/* UG.@@..UG */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.@A..UG */
-{{    0,    0,    0,    0,    0},
-{ -719, -719, -719, -719, -719},
-{ -479, -479, -479, -479, -479},
-{ -659, -659, -659, -659, -659},
-{ -549, -549, -549, -549, -549}},
-/* UG.@C..UG */
-{{    0,    0,    0,    0,    0},
-{ -789, -789, -789, -789, -789},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -439, -439, -439, -439, -439}},
-/* UG.@G..UG */
-{{    0,    0,    0,    0,    0},
-{ -959, -959, -959, -959, -959},
-{ -359, -359, -359, -359, -359},
-{ -919, -919, -919, -919, -919},
-{ -549, -549, -549, -549, -549}},
-/* UG.@U..UG */
-{{    0,    0,    0,    0,    0},
-{ -809, -809, -809, -809, -809},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -359, -359, -359, -359, -359}}},
-/* UG.A@..UG */
-{{{  DEF, -719, -789, -959, -809},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859}},
-/* UG.AA..UG */
-{{  DEF, -719, -789, -959, -809},
-{ -769,-1438,-1508,-1678,-1528},
-{ -529,-1198,-1268,-1438,-1288},
-{ -709,-1378,-1448,-1618,-1468},
-{ -599,-1268,-1338,-1508,-1358}},
-/* UG.AC..UG */
-{{  DEF, -719, -789, -959, -809},
-{ -839,-1508,-1578,-1748,-1598},
-{ -529,-1198,-1268,-1438,-1288},
-{ -859,-1528,-1598,-1768,-1618},
-{ -489,-1158,-1228,-1398,-1248}},
-/* UG.AG..UG */
-{{  DEF, -719, -789, -959, -809},
-{-1009,-1678,-1748,-1918,-1768},
-{ -409,-1078,-1148,-1318,-1168},
-{ -969,-1638,-1708,-1878,-1728},
-{ -599,-1268,-1338,-1508,-1358}},
-/* UG.AU..UG */
-{{  DEF, -719, -789, -959, -809},
-{ -859,-1528,-1598,-1768,-1618},
-{ -529,-1198,-1268,-1438,-1288},
-{ -859,-1528,-1598,-1768,-1618},
-{ -409,-1078,-1148,-1318,-1168}}},
-/* UG.C@..UG */
-{{{  DEF, -479, -479, -359, -479},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529}},
-/* UG.CA..UG */
-{{  DEF, -479, -479, -359, -479},
-{ -769,-1198,-1198,-1078,-1198},
-{ -529, -958, -958, -838, -958},
-{ -709,-1138,-1138,-1018,-1138},
-{ -599,-1028,-1028, -908,-1028}},
-/* UG.CC..UG */
-{{  DEF, -479, -479, -359, -479},
-{ -839,-1268,-1268,-1148,-1268},
-{ -529, -958, -958, -838, -958},
-{ -859,-1288,-1288,-1168,-1288},
-{ -489, -918, -918, -798, -918}},
-/* UG.CG..UG */
-{{  DEF, -479, -479, -359, -479},
-{-1009,-1438,-1438,-1318,-1438},
-{ -409, -838, -838, -718, -838},
-{ -969,-1398,-1398,-1278,-1398},
-{ -599,-1028,-1028, -908,-1028}},
-/* UG.CU..UG */
-{{  DEF, -479, -479, -359, -479},
-{ -859,-1288,-1288,-1168,-1288},
-{ -529, -958, -958, -838, -958},
-{ -859,-1288,-1288,-1168,-1288},
-{ -409, -838, -838, -718, -838}}},
-/* UG.G@..UG */
-{{{  DEF, -659, -809, -919, -809},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859}},
-/* UG.GA..UG */
-{{  DEF, -659, -809, -919, -809},
-{ -769,-1378,-1528,-1638,-1528},
-{ -529,-1138,-1288,-1398,-1288},
-{ -709,-1318,-1468,-1578,-1468},
-{ -599,-1208,-1358,-1468,-1358}},
-/* UG.GC..UG */
-{{  DEF, -659, -809, -919, -809},
-{ -839,-1448,-1598,-1708,-1598},
-{ -529,-1138,-1288,-1398,-1288},
-{ -859,-1468,-1618,-1728,-1618},
-{ -489,-1098,-1248,-1358,-1248}},
-/* UG.GG..UG */
-{{  DEF, -659, -809, -919, -809},
-{-1009,-1618,-1768,-1878,-1768},
-{ -409,-1018,-1168,-1278,-1168},
-{ -969,-1578,-1728,-1838,-1728},
-{ -599,-1208,-1358,-1468,-1358}},
-/* UG.GU..UG */
-{{  DEF, -659, -809, -919, -809},
-{ -859,-1468,-1618,-1728,-1618},
-{ -529,-1138,-1288,-1398,-1288},
-{ -859,-1468,-1618,-1728,-1618},
-{ -409,-1018,-1168,-1278,-1168}}},
-/* UG.U@..UG */
-{{{  DEF, -549, -439, -549, -359},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409}},
-/* UG.UA..UG */
-{{  DEF, -549, -439, -549, -359},
-{ -769,-1268,-1158,-1268,-1078},
-{ -529,-1028, -918,-1028, -838},
-{ -709,-1208,-1098,-1208,-1018},
-{ -599,-1098, -988,-1098, -908}},
-/* UG.UC..UG */
-{{  DEF, -549, -439, -549, -359},
-{ -839,-1338,-1228,-1338,-1148},
-{ -529,-1028, -918,-1028, -838},
-{ -859,-1358,-1248,-1358,-1168},
-{ -489, -988, -878, -988, -798}},
-/* UG.UG..UG */
-{{  DEF, -549, -439, -549, -359},
-{-1009,-1508,-1398,-1508,-1318},
-{ -409, -908, -798, -908, -718},
-{ -969,-1468,-1358,-1468,-1278},
-{ -599,-1098, -988,-1098, -908}},
-/* UG.UU..UG */
-{{  DEF, -549, -439, -549, -359},
-{ -859,-1358,-1248,-1358,-1168},
-{ -529,-1028, -918,-1028, -838},
-{ -859,-1358,-1248,-1358,-1168},
-{ -409, -908, -798, -908, -718}}}},
-/* UG.@@..AU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.@A..AU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* UG.@C..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* UG.@G..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* UG.@U..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* UG.A@..AU */
-{{{  DEF, -719, -789, -959, -809},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859}},
-/* UG.AA..AU */
-{{  DEF, -719, -789, -959, -809},
-{ -479,-1148,-1218,-1388,-1238},
-{ -309, -978,-1048,-1218,-1068},
-{ -389,-1058,-1128,-1298,-1148},
-{ -379,-1048,-1118,-1288,-1138}},
-/* UG.AC..AU */
-{{  DEF, -719, -789, -959, -809},
-{ -649,-1318,-1388,-1558,-1408},
-{ -289, -958,-1028,-1198,-1048},
-{ -739,-1408,-1478,-1648,-1498},
-{ -379,-1048,-1118,-1288,-1138}},
-/* UG.AG..AU */
-{{  DEF, -719, -789, -959, -809},
-{ -649,-1318,-1388,-1558,-1408},
-{ -289, -958,-1028,-1198,-1048},
-{ -739,-1408,-1478,-1648,-1498},
-{ -379,-1048,-1118,-1288,-1138}},
-/* UG.AU..AU */
-{{  DEF, -719, -789, -959, -809},
-{ -649,-1318,-1388,-1558,-1408},
-{ -289, -958,-1028,-1198,-1048},
-{ -739,-1408,-1478,-1648,-1498},
-{ -379,-1048,-1118,-1288,-1138}}},
-/* UG.C@..AU */
-{{{  DEF, -479, -479, -359, -479},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529}},
-/* UG.CA..AU */
-{{  DEF, -479, -479, -359, -479},
-{ -479, -908, -908, -788, -908},
-{ -309, -738, -738, -618, -738},
-{ -389, -818, -818, -698, -818},
-{ -379, -808, -808, -688, -808}},
-/* UG.CC..AU */
-{{  DEF, -479, -479, -359, -479},
-{ -649,-1078,-1078, -958,-1078},
-{ -289, -718, -718, -598, -718},
-{ -739,-1168,-1168,-1048,-1168},
-{ -379, -808, -808, -688, -808}},
-/* UG.CG..AU */
-{{  DEF, -479, -479, -359, -479},
-{ -649,-1078,-1078, -958,-1078},
-{ -289, -718, -718, -598, -718},
-{ -739,-1168,-1168,-1048,-1168},
-{ -379, -808, -808, -688, -808}},
-/* UG.CU..AU */
-{{  DEF, -479, -479, -359, -479},
-{ -649,-1078,-1078, -958,-1078},
-{ -289, -718, -718, -598, -718},
-{ -739,-1168,-1168,-1048,-1168},
-{ -379, -808, -808, -688, -808}}},
-/* UG.G@..AU */
-{{{  DEF, -659, -809, -919, -809},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859}},
-/* UG.GA..AU */
-{{  DEF, -659, -809, -919, -809},
-{ -479,-1088,-1238,-1348,-1238},
-{ -309, -918,-1068,-1178,-1068},
-{ -389, -998,-1148,-1258,-1148},
-{ -379, -988,-1138,-1248,-1138}},
-/* UG.GC..AU */
-{{  DEF, -659, -809, -919, -809},
-{ -649,-1258,-1408,-1518,-1408},
-{ -289, -898,-1048,-1158,-1048},
-{ -739,-1348,-1498,-1608,-1498},
-{ -379, -988,-1138,-1248,-1138}},
-/* UG.GG..AU */
-{{  DEF, -659, -809, -919, -809},
-{ -649,-1258,-1408,-1518,-1408},
-{ -289, -898,-1048,-1158,-1048},
-{ -739,-1348,-1498,-1608,-1498},
-{ -379, -988,-1138,-1248,-1138}},
-/* UG.GU..AU */
-{{  DEF, -659, -809, -919, -809},
-{ -649,-1258,-1408,-1518,-1408},
-{ -289, -898,-1048,-1158,-1048},
-{ -739,-1348,-1498,-1608,-1498},
-{ -379, -988,-1138,-1248,-1138}}},
-/* UG.U@..AU */
-{{{  DEF, -549, -439, -549, -359},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409}},
-/* UG.UA..AU */
-{{  DEF, -549, -439, -549, -359},
-{ -479, -978, -868, -978, -788},
-{ -309, -808, -698, -808, -618},
-{ -389, -888, -778, -888, -698},
-{ -379, -878, -768, -878, -688}},
-/* UG.UC..AU */
-{{  DEF, -549, -439, -549, -359},
-{ -649,-1148,-1038,-1148, -958},
-{ -289, -788, -678, -788, -598},
-{ -739,-1238,-1128,-1238,-1048},
-{ -379, -878, -768, -878, -688}},
-/* UG.UG..AU */
-{{  DEF, -549, -439, -549, -359},
-{ -649,-1148,-1038,-1148, -958},
-{ -289, -788, -678, -788, -598},
-{ -739,-1238,-1128,-1238,-1048},
-{ -379, -878, -768, -878, -688}},
-/* UG.UU..AU */
-{{  DEF, -549, -439, -549, -359},
-{ -649,-1148,-1038,-1148, -958},
-{ -289, -788, -678, -788, -598},
-{ -739,-1238,-1128,-1238,-1048},
-{ -379, -878, -768, -878, -688}}}},
-/* UG.@@..UA */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.@A..UA */
-{{    0,    0,    0,    0,    0},
-{ -399, -399, -399, -399, -399},
-{ -429, -429, -429, -429, -429},
-{ -379, -379, -379, -379, -379},
-{ -279, -279, -279, -279, -279}},
-/* UG.@C..UA */
-{{    0,    0,    0,    0,    0},
-{ -629, -629, -629, -629, -629},
-{ -509, -509, -509, -509, -509},
-{ -679, -679, -679, -679, -679},
-{ -139, -139, -139, -139, -139}},
-/* UG.@G..UA */
-{{    0,    0,    0,    0,    0},
-{ -889, -889, -889, -889, -889},
-{ -199, -199, -199, -199, -199},
-{ -889, -889, -889, -889, -889},
-{ -279, -279, -279, -279, -279}},
-/* UG.@U..UA */
-{{    0,    0,    0,    0,    0},
-{ -589, -589, -589, -589, -589},
-{ -179, -179, -179, -179, -179},
-{ -679, -679, -679, -679, -679},
-{ -140, -140, -140, -140, -140}}},
-/* UG.A@..UA */
-{{{  DEF, -719, -789, -959, -809},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859}},
-/* UG.AA..UA */
-{{  DEF, -719, -789, -959, -809},
-{ -449,-1118,-1188,-1358,-1208},
-{ -479,-1148,-1218,-1388,-1238},
-{ -429,-1098,-1168,-1338,-1188},
-{ -329, -998,-1068,-1238,-1088}},
-/* UG.AC..UA */
-{{  DEF, -719, -789, -959, -809},
-{ -679,-1348,-1418,-1588,-1438},
-{ -559,-1228,-1298,-1468,-1318},
-{ -729,-1398,-1468,-1638,-1488},
-{ -189, -858, -928,-1098, -948}},
-/* UG.AG..UA */
-{{  DEF, -719, -789, -959, -809},
-{ -939,-1608,-1678,-1848,-1698},
-{ -249, -918, -988,-1158,-1008},
-{ -939,-1608,-1678,-1848,-1698},
-{ -329, -998,-1068,-1238,-1088}},
-/* UG.AU..UA */
-{{  DEF, -719, -789, -959, -809},
-{ -639,-1308,-1378,-1548,-1398},
-{ -229, -898, -968,-1138, -988},
-{ -729,-1398,-1468,-1638,-1488},
-{ -190, -859, -929,-1099, -949}}},
-/* UG.C@..UA */
-{{{  DEF, -479, -479, -359, -479},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529}},
-/* UG.CA..UA */
-{{  DEF, -479, -479, -359, -479},
-{ -449, -878, -878, -758, -878},
-{ -479, -908, -908, -788, -908},
-{ -429, -858, -858, -738, -858},
-{ -329, -758, -758, -638, -758}},
-/* UG.CC..UA */
-{{  DEF, -479, -479, -359, -479},
-{ -679,-1108,-1108, -988,-1108},
-{ -559, -988, -988, -868, -988},
-{ -729,-1158,-1158,-1038,-1158},
-{ -189, -618, -618, -498, -618}},
-/* UG.CG..UA */
-{{  DEF, -479, -479, -359, -479},
-{ -939,-1368,-1368,-1248,-1368},
-{ -249, -678, -678, -558, -678},
-{ -939,-1368,-1368,-1248,-1368},
-{ -329, -758, -758, -638, -758}},
-/* UG.CU..UA */
-{{  DEF, -479, -479, -359, -479},
-{ -639,-1068,-1068, -948,-1068},
-{ -229, -658, -658, -538, -658},
-{ -729,-1158,-1158,-1038,-1158},
-{ -190, -619, -619, -499, -619}}},
-/* UG.G@..UA */
-{{{  DEF, -659, -809, -919, -809},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859}},
-/* UG.GA..UA */
-{{  DEF, -659, -809, -919, -809},
-{ -449,-1058,-1208,-1318,-1208},
-{ -479,-1088,-1238,-1348,-1238},
-{ -429,-1038,-1188,-1298,-1188},
-{ -329, -938,-1088,-1198,-1088}},
-/* UG.GC..UA */
-{{  DEF, -659, -809, -919, -809},
-{ -679,-1288,-1438,-1548,-1438},
-{ -559,-1168,-1318,-1428,-1318},
-{ -729,-1338,-1488,-1598,-1488},
-{ -189, -798, -948,-1058, -948}},
-/* UG.GG..UA */
-{{  DEF, -659, -809, -919, -809},
-{ -939,-1548,-1698,-1808,-1698},
-{ -249, -858,-1008,-1118,-1008},
-{ -939,-1548,-1698,-1808,-1698},
-{ -329, -938,-1088,-1198,-1088}},
-/* UG.GU..UA */
-{{  DEF, -659, -809, -919, -809},
-{ -639,-1248,-1398,-1508,-1398},
-{ -229, -838, -988,-1098, -988},
-{ -729,-1338,-1488,-1598,-1488},
-{ -190, -799, -949,-1059, -949}}},
-/* UG.U@..UA */
-{{{  DEF, -549, -439, -549, -359},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409}},
-/* UG.UA..UA */
-{{  DEF, -549, -439, -549, -359},
-{ -449, -948, -838, -948, -758},
-{ -479, -978, -868, -978, -788},
-{ -429, -928, -818, -928, -738},
-{ -329, -828, -718, -828, -638}},
-/* UG.UC..UA */
-{{  DEF, -549, -439, -549, -359},
-{ -679,-1178,-1068,-1178, -988},
-{ -559,-1058, -948,-1058, -868},
-{ -729,-1228,-1118,-1228,-1038},
-{ -189, -688, -578, -688, -498}},
-/* UG.UG..UA */
-{{  DEF, -549, -439, -549, -359},
-{ -939,-1438,-1328,-1438,-1248},
-{ -249, -748, -638, -748, -558},
-{ -939,-1438,-1328,-1438,-1248},
-{ -329, -828, -718, -828, -638}},
-/* UG.UU..UA */
-{{  DEF, -549, -439, -549, -359},
-{ -639,-1138,-1028,-1138, -948},
-{ -229, -728, -618, -728, -538},
-{ -729,-1228,-1118,-1228,-1038},
-{ -190, -689, -579, -689, -499}}}},
-/* UG.@@.. @ */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.@A.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.@C.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.@G.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UG.@U.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}}},
-/* UG.A@.. @ */
-{{{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859}},
-/* UG.AA.. @ */
-{{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859}},
-/* UG.AC.. @ */
-{{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859}},
-/* UG.AG.. @ */
-{{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859}},
-/* UG.AU.. @ */
-{{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859},
-{ -100, -769, -839,-1009, -859}}},
-/* UG.C@.. @ */
-{{{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529}},
-/* UG.CA.. @ */
-{{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529}},
-/* UG.CC.. @ */
-{{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529}},
-/* UG.CG.. @ */
-{{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529}},
-/* UG.CU.. @ */
-{{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529},
-{ -100, -529, -529, -409, -529}}},
-/* UG.G@.. @ */
-{{{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859}},
-/* UG.GA.. @ */
-{{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859}},
-/* UG.GC.. @ */
-{{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859}},
-/* UG.GG.. @ */
-{{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859}},
-/* UG.GU.. @ */
-{{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859},
-{ -100, -709, -859, -969, -859}}},
-/* UG.U@.. @ */
-{{{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409}},
-/* UG.UA.. @ */
-{{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409}},
-/* UG.UC.. @ */
-{{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409}},
-/* UG.UG.. @ */
-{{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409}},
-/* UG.UU.. @ */
-{{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409},
-{ -100, -599, -489, -599, -409}}}}},
-{ /* noPair */ {{{{0}}}},
-/* AU.@@..CG */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.@A..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* AU.@C..CG */
-{{    0,    0,    0,    0,    0},
-{ -949, -949, -949, -949, -949},
-{ -449, -449, -449, -449, -449},
-{ -939, -939, -939, -939, -939},
-{ -739, -739, -739, -739, -739}},
-/* AU.@G..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* AU.@U..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -669, -669, -669, -669, -669},
-{ -939, -939, -939, -939, -939},
-{ -859, -859, -859, -859, -859}}},
-/* AU.A@..CG */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* AU.AA..CG */
-{{  DEF, -429, -599, -599, -599},
-{-1079,-1458,-1628,-1628,-1628},
-{ -569, -948,-1118,-1118,-1118},
-{ -989,-1368,-1538,-1538,-1538},
-{ -859,-1238,-1408,-1408,-1408}},
-/* AU.AC..CG */
-{{  DEF, -429, -599, -599, -599},
-{ -999,-1378,-1548,-1548,-1548},
-{ -499, -878,-1048,-1048,-1048},
-{ -989,-1368,-1538,-1538,-1538},
-{ -789,-1168,-1338,-1338,-1338}},
-/* AU.AG..CG */
-{{  DEF, -429, -599, -599, -599},
-{-1079,-1458,-1628,-1628,-1628},
-{ -569, -948,-1118,-1118,-1118},
-{ -989,-1368,-1538,-1538,-1538},
-{ -859,-1238,-1408,-1408,-1408}},
-/* AU.AU..CG */
-{{  DEF, -429, -599, -599, -599},
-{-1079,-1458,-1628,-1628,-1628},
-{ -719,-1098,-1268,-1268,-1268},
-{ -989,-1368,-1538,-1538,-1538},
-{ -909,-1288,-1458,-1458,-1458}}},
-/* AU.C@..CG */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* AU.CA..CG */
-{{  DEF, -259, -239, -239, -239},
-{-1079,-1288,-1268,-1268,-1268},
-{ -569, -778, -758, -758, -758},
-{ -989,-1198,-1178,-1178,-1178},
-{ -859,-1068,-1048,-1048,-1048}},
-/* AU.CC..CG */
-{{  DEF, -259, -239, -239, -239},
-{ -999,-1208,-1188,-1188,-1188},
-{ -499, -708, -688, -688, -688},
-{ -989,-1198,-1178,-1178,-1178},
-{ -789, -998, -978, -978, -978}},
-/* AU.CG..CG */
-{{  DEF, -259, -239, -239, -239},
-{-1079,-1288,-1268,-1268,-1268},
-{ -569, -778, -758, -758, -758},
-{ -989,-1198,-1178,-1178,-1178},
-{ -859,-1068,-1048,-1048,-1048}},
-/* AU.CU..CG */
-{{  DEF, -259, -239, -239, -239},
-{-1079,-1288,-1268,-1268,-1268},
-{ -719, -928, -908, -908, -908},
-{ -989,-1198,-1178,-1178,-1178},
-{ -909,-1118,-1098,-1098,-1098}}},
-/* AU.G@..CG */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* AU.GA..CG */
-{{  DEF, -339, -689, -689, -689},
-{-1079,-1368,-1718,-1718,-1718},
-{ -569, -858,-1208,-1208,-1208},
-{ -989,-1278,-1628,-1628,-1628},
-{ -859,-1148,-1498,-1498,-1498}},
-/* AU.GC..CG */
-{{  DEF, -339, -689, -689, -689},
-{ -999,-1288,-1638,-1638,-1638},
-{ -499, -788,-1138,-1138,-1138},
-{ -989,-1278,-1628,-1628,-1628},
-{ -789,-1078,-1428,-1428,-1428}},
-/* AU.GG..CG */
-{{  DEF, -339, -689, -689, -689},
-{-1079,-1368,-1718,-1718,-1718},
-{ -569, -858,-1208,-1208,-1208},
-{ -989,-1278,-1628,-1628,-1628},
-{ -859,-1148,-1498,-1498,-1498}},
-/* AU.GU..CG */
-{{  DEF, -339, -689, -689, -689},
-{-1079,-1368,-1718,-1718,-1718},
-{ -719,-1008,-1358,-1358,-1358},
-{ -989,-1278,-1628,-1628,-1628},
-{ -909,-1198,-1548,-1548,-1548}}},
-/* AU.U@..CG */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* AU.UA..CG */
-{{  DEF, -329, -329, -329, -329},
-{-1079,-1358,-1358,-1358,-1358},
-{ -569, -848, -848, -848, -848},
-{ -989,-1268,-1268,-1268,-1268},
-{ -859,-1138,-1138,-1138,-1138}},
-/* AU.UC..CG */
-{{  DEF, -329, -329, -329, -329},
-{ -999,-1278,-1278,-1278,-1278},
-{ -499, -778, -778, -778, -778},
-{ -989,-1268,-1268,-1268,-1268},
-{ -789,-1068,-1068,-1068,-1068}},
-/* AU.UG..CG */
-{{  DEF, -329, -329, -329, -329},
-{-1079,-1358,-1358,-1358,-1358},
-{ -569, -848, -848, -848, -848},
-{ -989,-1268,-1268,-1268,-1268},
-{ -859,-1138,-1138,-1138,-1138}},
-/* AU.UU..CG */
-{{  DEF, -329, -329, -329, -329},
-{-1079,-1358,-1358,-1358,-1358},
-{ -719, -998, -998, -998, -998},
-{ -989,-1268,-1268,-1268,-1268},
-{ -909,-1188,-1188,-1188,-1188}}}},
-/* AU.@@..GC */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.@A..GC */
-{{    0,    0,    0,    0,    0},
-{ -519, -519, -519, -519, -519},
-{ -719, -719, -719, -719, -719},
-{ -709, -709, -709, -709, -709},
-{ -499, -499, -499, -499, -499}},
-/* AU.@C..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -309, -309, -309, -309, -309},
-{ -739, -739, -739, -739, -739},
-{ -499, -499, -499, -499, -499}},
-/* AU.@G..GC */
-{{    0,    0,    0,    0,    0},
-{ -559, -559, -559, -559, -559},
-{ -309, -309, -309, -309, -309},
-{ -619, -619, -619, -619, -619},
-{ -499, -499, -499, -499, -499}},
-/* AU.@U..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -389, -389, -389, -389, -389},
-{ -739, -739, -739, -739, -739},
-{ -569, -569, -569, -569, -569}}},
-/* AU.A@..GC */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* AU.AA..GC */
-{{  DEF, -429, -599, -599, -599},
-{ -569, -948,-1118,-1118,-1118},
-{ -769,-1148,-1318,-1318,-1318},
-{ -759,-1138,-1308,-1308,-1308},
-{ -549, -928,-1098,-1098,-1098}},
-/* AU.AC..GC */
-{{  DEF, -429, -599, -599, -599},
-{ -929,-1308,-1478,-1478,-1478},
-{ -359, -738, -908, -908, -908},
-{ -789,-1168,-1338,-1338,-1338},
-{ -549, -928,-1098,-1098,-1098}},
-/* AU.AG..GC */
-{{  DEF, -429, -599, -599, -599},
-{ -609, -988,-1158,-1158,-1158},
-{ -359, -738, -908, -908, -908},
-{ -669,-1048,-1218,-1218,-1218},
-{ -549, -928,-1098,-1098,-1098}},
-/* AU.AU..GC */
-{{  DEF, -429, -599, -599, -599},
-{ -929,-1308,-1478,-1478,-1478},
-{ -439, -818, -988, -988, -988},
-{ -789,-1168,-1338,-1338,-1338},
-{ -619, -998,-1168,-1168,-1168}}},
-/* AU.C@..GC */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* AU.CA..GC */
-{{  DEF, -259, -239, -239, -239},
-{ -569, -778, -758, -758, -758},
-{ -769, -978, -958, -958, -958},
-{ -759, -968, -948, -948, -948},
-{ -549, -758, -738, -738, -738}},
-/* AU.CC..GC */
-{{  DEF, -259, -239, -239, -239},
-{ -929,-1138,-1118,-1118,-1118},
-{ -359, -568, -548, -548, -548},
-{ -789, -998, -978, -978, -978},
-{ -549, -758, -738, -738, -738}},
-/* AU.CG..GC */
-{{  DEF, -259, -239, -239, -239},
-{ -609, -818, -798, -798, -798},
-{ -359, -568, -548, -548, -548},
-{ -669, -878, -858, -858, -858},
-{ -549, -758, -738, -738, -738}},
-/* AU.CU..GC */
-{{  DEF, -259, -239, -239, -239},
-{ -929,-1138,-1118,-1118,-1118},
-{ -439, -648, -628, -628, -628},
-{ -789, -998, -978, -978, -978},
-{ -619, -828, -808, -808, -808}}},
-/* AU.G@..GC */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* AU.GA..GC */
-{{  DEF, -339, -689, -689, -689},
-{ -569, -858,-1208,-1208,-1208},
-{ -769,-1058,-1408,-1408,-1408},
-{ -759,-1048,-1398,-1398,-1398},
-{ -549, -838,-1188,-1188,-1188}},
-/* AU.GC..GC */
-{{  DEF, -339, -689, -689, -689},
-{ -929,-1218,-1568,-1568,-1568},
-{ -359, -648, -998, -998, -998},
-{ -789,-1078,-1428,-1428,-1428},
-{ -549, -838,-1188,-1188,-1188}},
-/* AU.GG..GC */
-{{  DEF, -339, -689, -689, -689},
-{ -609, -898,-1248,-1248,-1248},
-{ -359, -648, -998, -998, -998},
-{ -669, -958,-1308,-1308,-1308},
-{ -549, -838,-1188,-1188,-1188}},
-/* AU.GU..GC */
-{{  DEF, -339, -689, -689, -689},
-{ -929,-1218,-1568,-1568,-1568},
-{ -439, -728,-1078,-1078,-1078},
-{ -789,-1078,-1428,-1428,-1428},
-{ -619, -908,-1258,-1258,-1258}}},
-/* AU.U@..GC */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* AU.UA..GC */
-{{  DEF, -329, -329, -329, -329},
-{ -569, -848, -848, -848, -848},
-{ -769,-1048,-1048,-1048,-1048},
-{ -759,-1038,-1038,-1038,-1038},
-{ -549, -828, -828, -828, -828}},
-/* AU.UC..GC */
-{{  DEF, -329, -329, -329, -329},
-{ -929,-1208,-1208,-1208,-1208},
-{ -359, -638, -638, -638, -638},
-{ -789,-1068,-1068,-1068,-1068},
-{ -549, -828, -828, -828, -828}},
-/* AU.UG..GC */
-{{  DEF, -329, -329, -329, -329},
-{ -609, -888, -888, -888, -888},
-{ -359, -638, -638, -638, -638},
-{ -669, -948, -948, -948, -948},
-{ -549, -828, -828, -828, -828}},
-/* AU.UU..GC */
-{{  DEF, -329, -329, -329, -329},
-{ -929,-1208,-1208,-1208,-1208},
-{ -439, -718, -718, -718, -718},
-{ -789,-1068,-1068,-1068,-1068},
-{ -619, -898, -898, -898, -898}}}},
-/* AU.@@..GU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.@A..GU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* AU.@C..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* AU.@G..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* AU.@U..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* AU.A@..GU */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* AU.AA..GU */
-{{  DEF, -429, -599, -599, -599},
-{ -479, -858,-1028,-1028,-1028},
-{ -309, -688, -858, -858, -858},
-{ -389, -768, -938, -938, -938},
-{ -379, -758, -928, -928, -928}},
-/* AU.AC..GU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}},
-/* AU.AG..GU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}},
-/* AU.AU..GU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}}},
-/* AU.C@..GU */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* AU.CA..GU */
-{{  DEF, -259, -239, -239, -239},
-{ -479, -688, -668, -668, -668},
-{ -309, -518, -498, -498, -498},
-{ -389, -598, -578, -578, -578},
-{ -379, -588, -568, -568, -568}},
-/* AU.CC..GU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}},
-/* AU.CG..GU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}},
-/* AU.CU..GU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}}},
-/* AU.G@..GU */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* AU.GA..GU */
-{{  DEF, -339, -689, -689, -689},
-{ -479, -768,-1118,-1118,-1118},
-{ -309, -598, -948, -948, -948},
-{ -389, -678,-1028,-1028,-1028},
-{ -379, -668,-1018,-1018,-1018}},
-/* AU.GC..GU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}},
-/* AU.GG..GU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}},
-/* AU.GU..GU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}}},
-/* AU.U@..GU */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* AU.UA..GU */
-{{  DEF, -329, -329, -329, -329},
-{ -479, -758, -758, -758, -758},
-{ -309, -588, -588, -588, -588},
-{ -389, -668, -668, -668, -668},
-{ -379, -658, -658, -658, -658}},
-/* AU.UC..GU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}},
-/* AU.UG..GU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}},
-/* AU.UU..GU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}}}},
-/* AU.@@..UG */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.@A..UG */
-{{    0,    0,    0,    0,    0},
-{ -719, -719, -719, -719, -719},
-{ -479, -479, -479, -479, -479},
-{ -659, -659, -659, -659, -659},
-{ -549, -549, -549, -549, -549}},
-/* AU.@C..UG */
-{{    0,    0,    0,    0,    0},
-{ -789, -789, -789, -789, -789},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -439, -439, -439, -439, -439}},
-/* AU.@G..UG */
-{{    0,    0,    0,    0,    0},
-{ -959, -959, -959, -959, -959},
-{ -359, -359, -359, -359, -359},
-{ -919, -919, -919, -919, -919},
-{ -549, -549, -549, -549, -549}},
-/* AU.@U..UG */
-{{    0,    0,    0,    0,    0},
-{ -809, -809, -809, -809, -809},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -359, -359, -359, -359, -359}}},
-/* AU.A@..UG */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* AU.AA..UG */
-{{  DEF, -429, -599, -599, -599},
-{ -769,-1148,-1318,-1318,-1318},
-{ -529, -908,-1078,-1078,-1078},
-{ -709,-1088,-1258,-1258,-1258},
-{ -599, -978,-1148,-1148,-1148}},
-/* AU.AC..UG */
-{{  DEF, -429, -599, -599, -599},
-{ -839,-1218,-1388,-1388,-1388},
-{ -529, -908,-1078,-1078,-1078},
-{ -859,-1238,-1408,-1408,-1408},
-{ -489, -868,-1038,-1038,-1038}},
-/* AU.AG..UG */
-{{  DEF, -429, -599, -599, -599},
-{-1009,-1388,-1558,-1558,-1558},
-{ -409, -788, -958, -958, -958},
-{ -969,-1348,-1518,-1518,-1518},
-{ -599, -978,-1148,-1148,-1148}},
-/* AU.AU..UG */
-{{  DEF, -429, -599, -599, -599},
-{ -859,-1238,-1408,-1408,-1408},
-{ -529, -908,-1078,-1078,-1078},
-{ -859,-1238,-1408,-1408,-1408},
-{ -409, -788, -958, -958, -958}}},
-/* AU.C@..UG */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* AU.CA..UG */
-{{  DEF, -259, -239, -239, -239},
-{ -769, -978, -958, -958, -958},
-{ -529, -738, -718, -718, -718},
-{ -709, -918, -898, -898, -898},
-{ -599, -808, -788, -788, -788}},
-/* AU.CC..UG */
-{{  DEF, -259, -239, -239, -239},
-{ -839,-1048,-1028,-1028,-1028},
-{ -529, -738, -718, -718, -718},
-{ -859,-1068,-1048,-1048,-1048},
-{ -489, -698, -678, -678, -678}},
-/* AU.CG..UG */
-{{  DEF, -259, -239, -239, -239},
-{-1009,-1218,-1198,-1198,-1198},
-{ -409, -618, -598, -598, -598},
-{ -969,-1178,-1158,-1158,-1158},
-{ -599, -808, -788, -788, -788}},
-/* AU.CU..UG */
-{{  DEF, -259, -239, -239, -239},
-{ -859,-1068,-1048,-1048,-1048},
-{ -529, -738, -718, -718, -718},
-{ -859,-1068,-1048,-1048,-1048},
-{ -409, -618, -598, -598, -598}}},
-/* AU.G@..UG */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* AU.GA..UG */
-{{  DEF, -339, -689, -689, -689},
-{ -769,-1058,-1408,-1408,-1408},
-{ -529, -818,-1168,-1168,-1168},
-{ -709, -998,-1348,-1348,-1348},
-{ -599, -888,-1238,-1238,-1238}},
-/* AU.GC..UG */
-{{  DEF, -339, -689, -689, -689},
-{ -839,-1128,-1478,-1478,-1478},
-{ -529, -818,-1168,-1168,-1168},
-{ -859,-1148,-1498,-1498,-1498},
-{ -489, -778,-1128,-1128,-1128}},
-/* AU.GG..UG */
-{{  DEF, -339, -689, -689, -689},
-{-1009,-1298,-1648,-1648,-1648},
-{ -409, -698,-1048,-1048,-1048},
-{ -969,-1258,-1608,-1608,-1608},
-{ -599, -888,-1238,-1238,-1238}},
-/* AU.GU..UG */
-{{  DEF, -339, -689, -689, -689},
-{ -859,-1148,-1498,-1498,-1498},
-{ -529, -818,-1168,-1168,-1168},
-{ -859,-1148,-1498,-1498,-1498},
-{ -409, -698,-1048,-1048,-1048}}},
-/* AU.U@..UG */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* AU.UA..UG */
-{{  DEF, -329, -329, -329, -329},
-{ -769,-1048,-1048,-1048,-1048},
-{ -529, -808, -808, -808, -808},
-{ -709, -988, -988, -988, -988},
-{ -599, -878, -878, -878, -878}},
-/* AU.UC..UG */
-{{  DEF, -329, -329, -329, -329},
-{ -839,-1118,-1118,-1118,-1118},
-{ -529, -808, -808, -808, -808},
-{ -859,-1138,-1138,-1138,-1138},
-{ -489, -768, -768, -768, -768}},
-/* AU.UG..UG */
-{{  DEF, -329, -329, -329, -329},
-{-1009,-1288,-1288,-1288,-1288},
-{ -409, -688, -688, -688, -688},
-{ -969,-1248,-1248,-1248,-1248},
-{ -599, -878, -878, -878, -878}},
-/* AU.UU..UG */
-{{  DEF, -329, -329, -329, -329},
-{ -859,-1138,-1138,-1138,-1138},
-{ -529, -808, -808, -808, -808},
-{ -859,-1138,-1138,-1138,-1138},
-{ -409, -688, -688, -688, -688}}}},
-/* AU.@@..AU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.@A..AU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* AU.@C..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* AU.@G..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* AU.@U..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* AU.A@..AU */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* AU.AA..AU */
-{{  DEF, -429, -599, -599, -599},
-{ -479, -858,-1028,-1028,-1028},
-{ -309, -688, -858, -858, -858},
-{ -389, -768, -938, -938, -938},
-{ -379, -758, -928, -928, -928}},
-/* AU.AC..AU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}},
-/* AU.AG..AU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}},
-/* AU.AU..AU */
-{{  DEF, -429, -599, -599, -599},
-{ -649,-1028,-1198,-1198,-1198},
-{ -289, -668, -838, -838, -838},
-{ -739,-1118,-1288,-1288,-1288},
-{ -379, -758, -928, -928, -928}}},
-/* AU.C@..AU */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* AU.CA..AU */
-{{  DEF, -259, -239, -239, -239},
-{ -479, -688, -668, -668, -668},
-{ -309, -518, -498, -498, -498},
-{ -389, -598, -578, -578, -578},
-{ -379, -588, -568, -568, -568}},
-/* AU.CC..AU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}},
-/* AU.CG..AU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}},
-/* AU.CU..AU */
-{{  DEF, -259, -239, -239, -239},
-{ -649, -858, -838, -838, -838},
-{ -289, -498, -478, -478, -478},
-{ -739, -948, -928, -928, -928},
-{ -379, -588, -568, -568, -568}}},
-/* AU.G@..AU */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* AU.GA..AU */
-{{  DEF, -339, -689, -689, -689},
-{ -479, -768,-1118,-1118,-1118},
-{ -309, -598, -948, -948, -948},
-{ -389, -678,-1028,-1028,-1028},
-{ -379, -668,-1018,-1018,-1018}},
-/* AU.GC..AU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}},
-/* AU.GG..AU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}},
-/* AU.GU..AU */
-{{  DEF, -339, -689, -689, -689},
-{ -649, -938,-1288,-1288,-1288},
-{ -289, -578, -928, -928, -928},
-{ -739,-1028,-1378,-1378,-1378},
-{ -379, -668,-1018,-1018,-1018}}},
-/* AU.U@..AU */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* AU.UA..AU */
-{{  DEF, -329, -329, -329, -329},
-{ -479, -758, -758, -758, -758},
-{ -309, -588, -588, -588, -588},
-{ -389, -668, -668, -668, -668},
-{ -379, -658, -658, -658, -658}},
-/* AU.UC..AU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}},
-/* AU.UG..AU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}},
-/* AU.UU..AU */
-{{  DEF, -329, -329, -329, -329},
-{ -649, -928, -928, -928, -928},
-{ -289, -568, -568, -568, -568},
-{ -739,-1018,-1018,-1018,-1018},
-{ -379, -658, -658, -658, -658}}}},
-/* AU.@@..UA */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.@A..UA */
-{{    0,    0,    0,    0,    0},
-{ -399, -399, -399, -399, -399},
-{ -429, -429, -429, -429, -429},
-{ -379, -379, -379, -379, -379},
-{ -279, -279, -279, -279, -279}},
-/* AU.@C..UA */
-{{    0,    0,    0,    0,    0},
-{ -629, -629, -629, -629, -629},
-{ -509, -509, -509, -509, -509},
-{ -679, -679, -679, -679, -679},
-{ -139, -139, -139, -139, -139}},
-/* AU.@G..UA */
-{{    0,    0,    0,    0,    0},
-{ -889, -889, -889, -889, -889},
-{ -199, -199, -199, -199, -199},
-{ -889, -889, -889, -889, -889},
-{ -279, -279, -279, -279, -279}},
-/* AU.@U..UA */
-{{    0,    0,    0,    0,    0},
-{ -589, -589, -589, -589, -589},
-{ -179, -179, -179, -179, -179},
-{ -679, -679, -679, -679, -679},
-{ -140, -140, -140, -140, -140}}},
-/* AU.A@..UA */
-{{{  DEF, -429, -599, -599, -599},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* AU.AA..UA */
-{{  DEF, -429, -599, -599, -599},
-{ -449, -828, -998, -998, -998},
-{ -479, -858,-1028,-1028,-1028},
-{ -429, -808, -978, -978, -978},
-{ -329, -708, -878, -878, -878}},
-/* AU.AC..UA */
-{{  DEF, -429, -599, -599, -599},
-{ -679,-1058,-1228,-1228,-1228},
-{ -559, -938,-1108,-1108,-1108},
-{ -729,-1108,-1278,-1278,-1278},
-{ -189, -568, -738, -738, -738}},
-/* AU.AG..UA */
-{{  DEF, -429, -599, -599, -599},
-{ -939,-1318,-1488,-1488,-1488},
-{ -249, -628, -798, -798, -798},
-{ -939,-1318,-1488,-1488,-1488},
-{ -329, -708, -878, -878, -878}},
-/* AU.AU..UA */
-{{  DEF, -429, -599, -599, -599},
-{ -639,-1018,-1188,-1188,-1188},
-{ -229, -608, -778, -778, -778},
-{ -729,-1108,-1278,-1278,-1278},
-{ -190, -569, -739, -739, -739}}},
-/* AU.C@..UA */
-{{{  DEF, -259, -239, -239, -239},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* AU.CA..UA */
-{{  DEF, -259, -239, -239, -239},
-{ -449, -658, -638, -638, -638},
-{ -479, -688, -668, -668, -668},
-{ -429, -638, -618, -618, -618},
-{ -329, -538, -518, -518, -518}},
-/* AU.CC..UA */
-{{  DEF, -259, -239, -239, -239},
-{ -679, -888, -868, -868, -868},
-{ -559, -768, -748, -748, -748},
-{ -729, -938, -918, -918, -918},
-{ -189, -398, -378, -378, -378}},
-/* AU.CG..UA */
-{{  DEF, -259, -239, -239, -239},
-{ -939,-1148,-1128,-1128,-1128},
-{ -249, -458, -438, -438, -438},
-{ -939,-1148,-1128,-1128,-1128},
-{ -329, -538, -518, -518, -518}},
-/* AU.CU..UA */
-{{  DEF, -259, -239, -239, -239},
-{ -639, -848, -828, -828, -828},
-{ -229, -438, -418, -418, -418},
-{ -729, -938, -918, -918, -918},
-{ -190, -399, -379, -379, -379}}},
-/* AU.G@..UA */
-{{{  DEF, -339, -689, -689, -689},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* AU.GA..UA */
-{{  DEF, -339, -689, -689, -689},
-{ -449, -738,-1088,-1088,-1088},
-{ -479, -768,-1118,-1118,-1118},
-{ -429, -718,-1068,-1068,-1068},
-{ -329, -618, -968, -968, -968}},
-/* AU.GC..UA */
-{{  DEF, -339, -689, -689, -689},
-{ -679, -968,-1318,-1318,-1318},
-{ -559, -848,-1198,-1198,-1198},
-{ -729,-1018,-1368,-1368,-1368},
-{ -189, -478, -828, -828, -828}},
-/* AU.GG..UA */
-{{  DEF, -339, -689, -689, -689},
-{ -939,-1228,-1578,-1578,-1578},
-{ -249, -538, -888, -888, -888},
-{ -939,-1228,-1578,-1578,-1578},
-{ -329, -618, -968, -968, -968}},
-/* AU.GU..UA */
-{{  DEF, -339, -689, -689, -689},
-{ -639, -928,-1278,-1278,-1278},
-{ -229, -518, -868, -868, -868},
-{ -729,-1018,-1368,-1368,-1368},
-{ -190, -479, -829, -829, -829}}},
-/* AU.U@..UA */
-{{{  DEF, -329, -329, -329, -329},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* AU.UA..UA */
-{{  DEF, -329, -329, -329, -329},
-{ -449, -728, -728, -728, -728},
-{ -479, -758, -758, -758, -758},
-{ -429, -708, -708, -708, -708},
-{ -329, -608, -608, -608, -608}},
-/* AU.UC..UA */
-{{  DEF, -329, -329, -329, -329},
-{ -679, -958, -958, -958, -958},
-{ -559, -838, -838, -838, -838},
-{ -729,-1008,-1008,-1008,-1008},
-{ -189, -468, -468, -468, -468}},
-/* AU.UG..UA */
-{{  DEF, -329, -329, -329, -329},
-{ -939,-1218,-1218,-1218,-1218},
-{ -249, -528, -528, -528, -528},
-{ -939,-1218,-1218,-1218,-1218},
-{ -329, -608, -608, -608, -608}},
-/* AU.UU..UA */
-{{  DEF, -329, -329, -329, -329},
-{ -639, -918, -918, -918, -918},
-{ -229, -508, -508, -508, -508},
-{ -729,-1008,-1008,-1008,-1008},
-{ -190, -469, -469, -469, -469}}}},
-/* AU.@@.. @ */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.@A.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.@C.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.@G.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* AU.@U.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}}},
-/* AU.A@.. @ */
-{{{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* AU.AA.. @ */
-{{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* AU.AC.. @ */
-{{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* AU.AG.. @ */
-{{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}},
-/* AU.AU.. @ */
-{{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649},
-{ -100, -479, -649, -649, -649}}},
-/* AU.C@.. @ */
-{{{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* AU.CA.. @ */
-{{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* AU.CC.. @ */
-{{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* AU.CG.. @ */
-{{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}},
-/* AU.CU.. @ */
-{{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289},
-{ -100, -309, -289, -289, -289}}},
-/* AU.G@.. @ */
-{{{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* AU.GA.. @ */
-{{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* AU.GC.. @ */
-{{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* AU.GG.. @ */
-{{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}},
-/* AU.GU.. @ */
-{{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739},
-{ -100, -389, -739, -739, -739}}},
-/* AU.U@.. @ */
-{{{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* AU.UA.. @ */
-{{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* AU.UC.. @ */
-{{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* AU.UG.. @ */
-{{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}},
-/* AU.UU.. @ */
-{{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379},
-{ -100, -379, -379, -379, -379}}}}},
-{ /* noPair */ {{{{0}}}},
-/* UA.@@..CG */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.@A..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* UA.@C..CG */
-{{    0,    0,    0,    0,    0},
-{ -949, -949, -949, -949, -949},
-{ -449, -449, -449, -449, -449},
-{ -939, -939, -939, -939, -939},
-{ -739, -739, -739, -739, -739}},
-/* UA.@G..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -519, -519, -519, -519, -519},
-{ -939, -939, -939, -939, -939},
-{ -809, -809, -809, -809, -809}},
-/* UA.@U..CG */
-{{    0,    0,    0,    0,    0},
-{-1029,-1029,-1029,-1029,-1029},
-{ -669, -669, -669, -669, -669},
-{ -939, -939, -939, -939, -939},
-{ -859, -859, -859, -859, -859}}},
-/* UA.A@..CG */
-{{{  DEF, -399, -629, -889, -589},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639}},
-/* UA.AA..CG */
-{{  DEF, -399, -629, -889, -589},
-{-1079,-1428,-1658,-1918,-1618},
-{ -569, -918,-1148,-1408,-1108},
-{ -989,-1338,-1568,-1828,-1528},
-{ -859,-1208,-1438,-1698,-1398}},
-/* UA.AC..CG */
-{{  DEF, -399, -629, -889, -589},
-{ -999,-1348,-1578,-1838,-1538},
-{ -499, -848,-1078,-1338,-1038},
-{ -989,-1338,-1568,-1828,-1528},
-{ -789,-1138,-1368,-1628,-1328}},
-/* UA.AG..CG */
-{{  DEF, -399, -629, -889, -589},
-{-1079,-1428,-1658,-1918,-1618},
-{ -569, -918,-1148,-1408,-1108},
-{ -989,-1338,-1568,-1828,-1528},
-{ -859,-1208,-1438,-1698,-1398}},
-/* UA.AU..CG */
-{{  DEF, -399, -629, -889, -589},
-{-1079,-1428,-1658,-1918,-1618},
-{ -719,-1068,-1298,-1558,-1258},
-{ -989,-1338,-1568,-1828,-1528},
-{ -909,-1258,-1488,-1748,-1448}}},
-/* UA.C@..CG */
-{{{  DEF, -429, -509, -199, -179},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229}},
-/* UA.CA..CG */
-{{  DEF, -429, -509, -199, -179},
-{-1079,-1458,-1538,-1228,-1208},
-{ -569, -948,-1028, -718, -698},
-{ -989,-1368,-1448,-1138,-1118},
-{ -859,-1238,-1318,-1008, -988}},
-/* UA.CC..CG */
-{{  DEF, -429, -509, -199, -179},
-{ -999,-1378,-1458,-1148,-1128},
-{ -499, -878, -958, -648, -628},
-{ -989,-1368,-1448,-1138,-1118},
-{ -789,-1168,-1248, -938, -918}},
-/* UA.CG..CG */
-{{  DEF, -429, -509, -199, -179},
-{-1079,-1458,-1538,-1228,-1208},
-{ -569, -948,-1028, -718, -698},
-{ -989,-1368,-1448,-1138,-1118},
-{ -859,-1238,-1318,-1008, -988}},
-/* UA.CU..CG */
-{{  DEF, -429, -509, -199, -179},
-{-1079,-1458,-1538,-1228,-1208},
-{ -719,-1098,-1178, -868, -848},
-{ -989,-1368,-1448,-1138,-1118},
-{ -909,-1288,-1368,-1058,-1038}}},
-/* UA.G@..CG */
-{{{  DEF, -379, -679, -889, -679},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729}},
-/* UA.GA..CG */
-{{  DEF, -379, -679, -889, -679},
-{-1079,-1408,-1708,-1918,-1708},
-{ -569, -898,-1198,-1408,-1198},
-{ -989,-1318,-1618,-1828,-1618},
-{ -859,-1188,-1488,-1698,-1488}},
-/* UA.GC..CG */
-{{  DEF, -379, -679, -889, -679},
-{ -999,-1328,-1628,-1838,-1628},
-{ -499, -828,-1128,-1338,-1128},
-{ -989,-1318,-1618,-1828,-1618},
-{ -789,-1118,-1418,-1628,-1418}},
-/* UA.GG..CG */
-{{  DEF, -379, -679, -889, -679},
-{-1079,-1408,-1708,-1918,-1708},
-{ -569, -898,-1198,-1408,-1198},
-{ -989,-1318,-1618,-1828,-1618},
-{ -859,-1188,-1488,-1698,-1488}},
-/* UA.GU..CG */
-{{  DEF, -379, -679, -889, -679},
-{-1079,-1408,-1708,-1918,-1708},
-{ -719,-1048,-1348,-1558,-1348},
-{ -989,-1318,-1618,-1828,-1618},
-{ -909,-1238,-1538,-1748,-1538}}},
-/* UA.U@..CG */
-{{{  DEF, -279, -139, -279, -140},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190}},
-/* UA.UA..CG */
-{{  DEF, -279, -139, -279, -140},
-{-1079,-1308,-1168,-1308,-1169},
-{ -569, -798, -658, -798, -659},
-{ -989,-1218,-1078,-1218,-1079},
-{ -859,-1088, -948,-1088, -949}},
-/* UA.UC..CG */
-{{  DEF, -279, -139, -279, -140},
-{ -999,-1228,-1088,-1228,-1089},
-{ -499, -728, -588, -728, -589},
-{ -989,-1218,-1078,-1218,-1079},
-{ -789,-1018, -878,-1018, -879}},
-/* UA.UG..CG */
-{{  DEF, -279, -139, -279, -140},
-{-1079,-1308,-1168,-1308,-1169},
-{ -569, -798, -658, -798, -659},
-{ -989,-1218,-1078,-1218,-1079},
-{ -859,-1088, -948,-1088, -949}},
-/* UA.UU..CG */
-{{  DEF, -279, -139, -279, -140},
-{-1079,-1308,-1168,-1308,-1169},
-{ -719, -948, -808, -948, -809},
-{ -989,-1218,-1078,-1218,-1079},
-{ -909,-1138, -998,-1138, -999}}}},
-/* UA.@@..GC */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.@A..GC */
-{{    0,    0,    0,    0,    0},
-{ -519, -519, -519, -519, -519},
-{ -719, -719, -719, -719, -719},
-{ -709, -709, -709, -709, -709},
-{ -499, -499, -499, -499, -499}},
-/* UA.@C..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -309, -309, -309, -309, -309},
-{ -739, -739, -739, -739, -739},
-{ -499, -499, -499, -499, -499}},
-/* UA.@G..GC */
-{{    0,    0,    0,    0,    0},
-{ -559, -559, -559, -559, -559},
-{ -309, -309, -309, -309, -309},
-{ -619, -619, -619, -619, -619},
-{ -499, -499, -499, -499, -499}},
-/* UA.@U..GC */
-{{    0,    0,    0,    0,    0},
-{ -879, -879, -879, -879, -879},
-{ -389, -389, -389, -389, -389},
-{ -739, -739, -739, -739, -739},
-{ -569, -569, -569, -569, -569}}},
-/* UA.A@..GC */
-{{{  DEF, -399, -629, -889, -589},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639}},
-/* UA.AA..GC */
-{{  DEF, -399, -629, -889, -589},
-{ -569, -918,-1148,-1408,-1108},
-{ -769,-1118,-1348,-1608,-1308},
-{ -759,-1108,-1338,-1598,-1298},
-{ -549, -898,-1128,-1388,-1088}},
-/* UA.AC..GC */
-{{  DEF, -399, -629, -889, -589},
-{ -929,-1278,-1508,-1768,-1468},
-{ -359, -708, -938,-1198, -898},
-{ -789,-1138,-1368,-1628,-1328},
-{ -549, -898,-1128,-1388,-1088}},
-/* UA.AG..GC */
-{{  DEF, -399, -629, -889, -589},
-{ -609, -958,-1188,-1448,-1148},
-{ -359, -708, -938,-1198, -898},
-{ -669,-1018,-1248,-1508,-1208},
-{ -549, -898,-1128,-1388,-1088}},
-/* UA.AU..GC */
-{{  DEF, -399, -629, -889, -589},
-{ -929,-1278,-1508,-1768,-1468},
-{ -439, -788,-1018,-1278, -978},
-{ -789,-1138,-1368,-1628,-1328},
-{ -619, -968,-1198,-1458,-1158}}},
-/* UA.C@..GC */
-{{{  DEF, -429, -509, -199, -179},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229}},
-/* UA.CA..GC */
-{{  DEF, -429, -509, -199, -179},
-{ -569, -948,-1028, -718, -698},
-{ -769,-1148,-1228, -918, -898},
-{ -759,-1138,-1218, -908, -888},
-{ -549, -928,-1008, -698, -678}},
-/* UA.CC..GC */
-{{  DEF, -429, -509, -199, -179},
-{ -929,-1308,-1388,-1078,-1058},
-{ -359, -738, -818, -508, -488},
-{ -789,-1168,-1248, -938, -918},
-{ -549, -928,-1008, -698, -678}},
-/* UA.CG..GC */
-{{  DEF, -429, -509, -199, -179},
-{ -609, -988,-1068, -758, -738},
-{ -359, -738, -818, -508, -488},
-{ -669,-1048,-1128, -818, -798},
-{ -549, -928,-1008, -698, -678}},
-/* UA.CU..GC */
-{{  DEF, -429, -509, -199, -179},
-{ -929,-1308,-1388,-1078,-1058},
-{ -439, -818, -898, -588, -568},
-{ -789,-1168,-1248, -938, -918},
-{ -619, -998,-1078, -768, -748}}},
-/* UA.G@..GC */
-{{{  DEF, -379, -679, -889, -679},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729}},
-/* UA.GA..GC */
-{{  DEF, -379, -679, -889, -679},
-{ -569, -898,-1198,-1408,-1198},
-{ -769,-1098,-1398,-1608,-1398},
-{ -759,-1088,-1388,-1598,-1388},
-{ -549, -878,-1178,-1388,-1178}},
-/* UA.GC..GC */
-{{  DEF, -379, -679, -889, -679},
-{ -929,-1258,-1558,-1768,-1558},
-{ -359, -688, -988,-1198, -988},
-{ -789,-1118,-1418,-1628,-1418},
-{ -549, -878,-1178,-1388,-1178}},
-/* UA.GG..GC */
-{{  DEF, -379, -679, -889, -679},
-{ -609, -938,-1238,-1448,-1238},
-{ -359, -688, -988,-1198, -988},
-{ -669, -998,-1298,-1508,-1298},
-{ -549, -878,-1178,-1388,-1178}},
-/* UA.GU..GC */
-{{  DEF, -379, -679, -889, -679},
-{ -929,-1258,-1558,-1768,-1558},
-{ -439, -768,-1068,-1278,-1068},
-{ -789,-1118,-1418,-1628,-1418},
-{ -619, -948,-1248,-1458,-1248}}},
-/* UA.U@..GC */
-{{{  DEF, -279, -139, -279, -140},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190}},
-/* UA.UA..GC */
-{{  DEF, -279, -139, -279, -140},
-{ -569, -798, -658, -798, -659},
-{ -769, -998, -858, -998, -859},
-{ -759, -988, -848, -988, -849},
-{ -549, -778, -638, -778, -639}},
-/* UA.UC..GC */
-{{  DEF, -279, -139, -279, -140},
-{ -929,-1158,-1018,-1158,-1019},
-{ -359, -588, -448, -588, -449},
-{ -789,-1018, -878,-1018, -879},
-{ -549, -778, -638, -778, -639}},
-/* UA.UG..GC */
-{{  DEF, -279, -139, -279, -140},
-{ -609, -838, -698, -838, -699},
-{ -359, -588, -448, -588, -449},
-{ -669, -898, -758, -898, -759},
-{ -549, -778, -638, -778, -639}},
-/* UA.UU..GC */
-{{  DEF, -279, -139, -279, -140},
-{ -929,-1158,-1018,-1158,-1019},
-{ -439, -668, -528, -668, -529},
-{ -789,-1018, -878,-1018, -879},
-{ -619, -848, -708, -848, -709}}}},
-/* UA.@@..GU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.@A..GU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* UA.@C..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* UA.@G..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* UA.@U..GU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* UA.A@..GU */
-{{{  DEF, -399, -629, -889, -589},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639}},
-/* UA.AA..GU */
-{{  DEF, -399, -629, -889, -589},
-{ -479, -828,-1058,-1318,-1018},
-{ -309, -658, -888,-1148, -848},
-{ -389, -738, -968,-1228, -928},
-{ -379, -728, -958,-1218, -918}},
-/* UA.AC..GU */
-{{  DEF, -399, -629, -889, -589},
-{ -649, -998,-1228,-1488,-1188},
-{ -289, -638, -868,-1128, -828},
-{ -739,-1088,-1318,-1578,-1278},
-{ -379, -728, -958,-1218, -918}},
-/* UA.AG..GU */
-{{  DEF, -399, -629, -889, -589},
-{ -649, -998,-1228,-1488,-1188},
-{ -289, -638, -868,-1128, -828},
-{ -739,-1088,-1318,-1578,-1278},
-{ -379, -728, -958,-1218, -918}},
-/* UA.AU..GU */
-{{  DEF, -399, -629, -889, -589},
-{ -649, -998,-1228,-1488,-1188},
-{ -289, -638, -868,-1128, -828},
-{ -739,-1088,-1318,-1578,-1278},
-{ -379, -728, -958,-1218, -918}}},
-/* UA.C@..GU */
-{{{  DEF, -429, -509, -199, -179},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229}},
-/* UA.CA..GU */
-{{  DEF, -429, -509, -199, -179},
-{ -479, -858, -938, -628, -608},
-{ -309, -688, -768, -458, -438},
-{ -389, -768, -848, -538, -518},
-{ -379, -758, -838, -528, -508}},
-/* UA.CC..GU */
-{{  DEF, -429, -509, -199, -179},
-{ -649,-1028,-1108, -798, -778},
-{ -289, -668, -748, -438, -418},
-{ -739,-1118,-1198, -888, -868},
-{ -379, -758, -838, -528, -508}},
-/* UA.CG..GU */
-{{  DEF, -429, -509, -199, -179},
-{ -649,-1028,-1108, -798, -778},
-{ -289, -668, -748, -438, -418},
-{ -739,-1118,-1198, -888, -868},
-{ -379, -758, -838, -528, -508}},
-/* UA.CU..GU */
-{{  DEF, -429, -509, -199, -179},
-{ -649,-1028,-1108, -798, -778},
-{ -289, -668, -748, -438, -418},
-{ -739,-1118,-1198, -888, -868},
-{ -379, -758, -838, -528, -508}}},
-/* UA.G@..GU */
-{{{  DEF, -379, -679, -889, -679},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729}},
-/* UA.GA..GU */
-{{  DEF, -379, -679, -889, -679},
-{ -479, -808,-1108,-1318,-1108},
-{ -309, -638, -938,-1148, -938},
-{ -389, -718,-1018,-1228,-1018},
-{ -379, -708,-1008,-1218,-1008}},
-/* UA.GC..GU */
-{{  DEF, -379, -679, -889, -679},
-{ -649, -978,-1278,-1488,-1278},
-{ -289, -618, -918,-1128, -918},
-{ -739,-1068,-1368,-1578,-1368},
-{ -379, -708,-1008,-1218,-1008}},
-/* UA.GG..GU */
-{{  DEF, -379, -679, -889, -679},
-{ -649, -978,-1278,-1488,-1278},
-{ -289, -618, -918,-1128, -918},
-{ -739,-1068,-1368,-1578,-1368},
-{ -379, -708,-1008,-1218,-1008}},
-/* UA.GU..GU */
-{{  DEF, -379, -679, -889, -679},
-{ -649, -978,-1278,-1488,-1278},
-{ -289, -618, -918,-1128, -918},
-{ -739,-1068,-1368,-1578,-1368},
-{ -379, -708,-1008,-1218,-1008}}},
-/* UA.U@..GU */
-{{{  DEF, -279, -139, -279, -140},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190}},
-/* UA.UA..GU */
-{{  DEF, -279, -139, -279, -140},
-{ -479, -708, -568, -708, -569},
-{ -309, -538, -398, -538, -399},
-{ -389, -618, -478, -618, -479},
-{ -379, -608, -468, -608, -469}},
-/* UA.UC..GU */
-{{  DEF, -279, -139, -279, -140},
-{ -649, -878, -738, -878, -739},
-{ -289, -518, -378, -518, -379},
-{ -739, -968, -828, -968, -829},
-{ -379, -608, -468, -608, -469}},
-/* UA.UG..GU */
-{{  DEF, -279, -139, -279, -140},
-{ -649, -878, -738, -878, -739},
-{ -289, -518, -378, -518, -379},
-{ -739, -968, -828, -968, -829},
-{ -379, -608, -468, -608, -469}},
-/* UA.UU..GU */
-{{  DEF, -279, -139, -279, -140},
-{ -649, -878, -738, -878, -739},
-{ -289, -518, -378, -518, -379},
-{ -739, -968, -828, -968, -829},
-{ -379, -608, -468, -608, -469}}}},
-/* UA.@@..UG */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.@A..UG */
-{{    0,    0,    0,    0,    0},
-{ -719, -719, -719, -719, -719},
-{ -479, -479, -479, -479, -479},
-{ -659, -659, -659, -659, -659},
-{ -549, -549, -549, -549, -549}},
-/* UA.@C..UG */
-{{    0,    0,    0,    0,    0},
-{ -789, -789, -789, -789, -789},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -439, -439, -439, -439, -439}},
-/* UA.@G..UG */
-{{    0,    0,    0,    0,    0},
-{ -959, -959, -959, -959, -959},
-{ -359, -359, -359, -359, -359},
-{ -919, -919, -919, -919, -919},
-{ -549, -549, -549, -549, -549}},
-/* UA.@U..UG */
-{{    0,    0,    0,    0,    0},
-{ -809, -809, -809, -809, -809},
-{ -479, -479, -479, -479, -479},
-{ -809, -809, -809, -809, -809},
-{ -359, -359, -359, -359, -359}}},
-/* UA.A@..UG */
-{{{  DEF, -399, -629, -889, -589},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639}},
-/* UA.AA..UG */
-{{  DEF, -399, -629, -889, -589},
-{ -769,-1118,-1348,-1608,-1308},
-{ -529, -878,-1108,-1368,-1068},
-{ -709,-1058,-1288,-1548,-1248},
-{ -599, -948,-1178,-1438,-1138}},
-/* UA.AC..UG */
-{{  DEF, -399, -629, -889, -589},
-{ -839,-1188,-1418,-1678,-1378},
-{ -529, -878,-1108,-1368,-1068},
-{ -859,-1208,-1438,-1698,-1398},
-{ -489, -838,-1068,-1328,-1028}},
-/* UA.AG..UG */
-{{  DEF, -399, -629, -889, -589},
-{-1009,-1358,-1588,-1848,-1548},
-{ -409, -758, -988,-1248, -948},
-{ -969,-1318,-1548,-1808,-1508},
-{ -599, -948,-1178,-1438,-1138}},
-/* UA.AU..UG */
-{{  DEF, -399, -629, -889, -589},
-{ -859,-1208,-1438,-1698,-1398},
-{ -529, -878,-1108,-1368,-1068},
-{ -859,-1208,-1438,-1698,-1398},
-{ -409, -758, -988,-1248, -948}}},
-/* UA.C@..UG */
-{{{  DEF, -429, -509, -199, -179},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229}},
-/* UA.CA..UG */
-{{  DEF, -429, -509, -199, -179},
-{ -769,-1148,-1228, -918, -898},
-{ -529, -908, -988, -678, -658},
-{ -709,-1088,-1168, -858, -838},
-{ -599, -978,-1058, -748, -728}},
-/* UA.CC..UG */
-{{  DEF, -429, -509, -199, -179},
-{ -839,-1218,-1298, -988, -968},
-{ -529, -908, -988, -678, -658},
-{ -859,-1238,-1318,-1008, -988},
-{ -489, -868, -948, -638, -618}},
-/* UA.CG..UG */
-{{  DEF, -429, -509, -199, -179},
-{-1009,-1388,-1468,-1158,-1138},
-{ -409, -788, -868, -558, -538},
-{ -969,-1348,-1428,-1118,-1098},
-{ -599, -978,-1058, -748, -728}},
-/* UA.CU..UG */
-{{  DEF, -429, -509, -199, -179},
-{ -859,-1238,-1318,-1008, -988},
-{ -529, -908, -988, -678, -658},
-{ -859,-1238,-1318,-1008, -988},
-{ -409, -788, -868, -558, -538}}},
-/* UA.G@..UG */
-{{{  DEF, -379, -679, -889, -679},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729}},
-/* UA.GA..UG */
-{{  DEF, -379, -679, -889, -679},
-{ -769,-1098,-1398,-1608,-1398},
-{ -529, -858,-1158,-1368,-1158},
-{ -709,-1038,-1338,-1548,-1338},
-{ -599, -928,-1228,-1438,-1228}},
-/* UA.GC..UG */
-{{  DEF, -379, -679, -889, -679},
-{ -839,-1168,-1468,-1678,-1468},
-{ -529, -858,-1158,-1368,-1158},
-{ -859,-1188,-1488,-1698,-1488},
-{ -489, -818,-1118,-1328,-1118}},
-/* UA.GG..UG */
-{{  DEF, -379, -679, -889, -679},
-{-1009,-1338,-1638,-1848,-1638},
-{ -409, -738,-1038,-1248,-1038},
-{ -969,-1298,-1598,-1808,-1598},
-{ -599, -928,-1228,-1438,-1228}},
-/* UA.GU..UG */
-{{  DEF, -379, -679, -889, -679},
-{ -859,-1188,-1488,-1698,-1488},
-{ -529, -858,-1158,-1368,-1158},
-{ -859,-1188,-1488,-1698,-1488},
-{ -409, -738,-1038,-1248,-1038}}},
-/* UA.U@..UG */
-{{{  DEF, -279, -139, -279, -140},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190}},
-/* UA.UA..UG */
-{{  DEF, -279, -139, -279, -140},
-{ -769, -998, -858, -998, -859},
-{ -529, -758, -618, -758, -619},
-{ -709, -938, -798, -938, -799},
-{ -599, -828, -688, -828, -689}},
-/* UA.UC..UG */
-{{  DEF, -279, -139, -279, -140},
-{ -839,-1068, -928,-1068, -929},
-{ -529, -758, -618, -758, -619},
-{ -859,-1088, -948,-1088, -949},
-{ -489, -718, -578, -718, -579}},
-/* UA.UG..UG */
-{{  DEF, -279, -139, -279, -140},
-{-1009,-1238,-1098,-1238,-1099},
-{ -409, -638, -498, -638, -499},
-{ -969,-1198,-1058,-1198,-1059},
-{ -599, -828, -688, -828, -689}},
-/* UA.UU..UG */
-{{  DEF, -279, -139, -279, -140},
-{ -859,-1088, -948,-1088, -949},
-{ -529, -758, -618, -758, -619},
-{ -859,-1088, -948,-1088, -949},
-{ -409, -638, -498, -638, -499}}}},
-/* UA.@@..AU */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.@A..AU */
-{{    0,    0,    0,    0,    0},
-{ -429, -429, -429, -429, -429},
-{ -259, -259, -259, -259, -259},
-{ -339, -339, -339, -339, -339},
-{ -329, -329, -329, -329, -329}},
-/* UA.@C..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* UA.@G..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}},
-/* UA.@U..AU */
-{{    0,    0,    0,    0,    0},
-{ -599, -599, -599, -599, -599},
-{ -239, -239, -239, -239, -239},
-{ -689, -689, -689, -689, -689},
-{ -329, -329, -329, -329, -329}}},
-/* UA.A@..AU */
-{{{  DEF, -399, -629, -889, -589},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639}},
-/* UA.AA..AU */
-{{  DEF, -399, -629, -889, -589},
-{ -479, -828,-1058,-1318,-1018},
-{ -309, -658, -888,-1148, -848},
-{ -389, -738, -968,-1228, -928},
-{ -379, -728, -958,-1218, -918}},
-/* UA.AC..AU */
-{{  DEF, -399, -629, -889, -589},
-{ -649, -998,-1228,-1488,-1188},
-{ -289, -638, -868,-1128, -828},
-{ -739,-1088,-1318,-1578,-1278},
-{ -379, -728, -958,-1218, -918}},
-/* UA.AG..AU */
-{{  DEF, -399, -629, -889, -589},
-{ -649, -998,-1228,-1488,-1188},
-{ -289, -638, -868,-1128, -828},
-{ -739,-1088,-1318,-1578,-1278},
-{ -379, -728, -958,-1218, -918}},
-/* UA.AU..AU */
-{{  DEF, -399, -629, -889, -589},
-{ -649, -998,-1228,-1488,-1188},
-{ -289, -638, -868,-1128, -828},
-{ -739,-1088,-1318,-1578,-1278},
-{ -379, -728, -958,-1218, -918}}},
-/* UA.C@..AU */
-{{{  DEF, -429, -509, -199, -179},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229}},
-/* UA.CA..AU */
-{{  DEF, -429, -509, -199, -179},
-{ -479, -858, -938, -628, -608},
-{ -309, -688, -768, -458, -438},
-{ -389, -768, -848, -538, -518},
-{ -379, -758, -838, -528, -508}},
-/* UA.CC..AU */
-{{  DEF, -429, -509, -199, -179},
-{ -649,-1028,-1108, -798, -778},
-{ -289, -668, -748, -438, -418},
-{ -739,-1118,-1198, -888, -868},
-{ -379, -758, -838, -528, -508}},
-/* UA.CG..AU */
-{{  DEF, -429, -509, -199, -179},
-{ -649,-1028,-1108, -798, -778},
-{ -289, -668, -748, -438, -418},
-{ -739,-1118,-1198, -888, -868},
-{ -379, -758, -838, -528, -508}},
-/* UA.CU..AU */
-{{  DEF, -429, -509, -199, -179},
-{ -649,-1028,-1108, -798, -778},
-{ -289, -668, -748, -438, -418},
-{ -739,-1118,-1198, -888, -868},
-{ -379, -758, -838, -528, -508}}},
-/* UA.G@..AU */
-{{{  DEF, -379, -679, -889, -679},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729}},
-/* UA.GA..AU */
-{{  DEF, -379, -679, -889, -679},
-{ -479, -808,-1108,-1318,-1108},
-{ -309, -638, -938,-1148, -938},
-{ -389, -718,-1018,-1228,-1018},
-{ -379, -708,-1008,-1218,-1008}},
-/* UA.GC..AU */
-{{  DEF, -379, -679, -889, -679},
-{ -649, -978,-1278,-1488,-1278},
-{ -289, -618, -918,-1128, -918},
-{ -739,-1068,-1368,-1578,-1368},
-{ -379, -708,-1008,-1218,-1008}},
-/* UA.GG..AU */
-{{  DEF, -379, -679, -889, -679},
-{ -649, -978,-1278,-1488,-1278},
-{ -289, -618, -918,-1128, -918},
-{ -739,-1068,-1368,-1578,-1368},
-{ -379, -708,-1008,-1218,-1008}},
-/* UA.GU..AU */
-{{  DEF, -379, -679, -889, -679},
-{ -649, -978,-1278,-1488,-1278},
-{ -289, -618, -918,-1128, -918},
-{ -739,-1068,-1368,-1578,-1368},
-{ -379, -708,-1008,-1218,-1008}}},
-/* UA.U@..AU */
-{{{  DEF, -279, -139, -279, -140},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190}},
-/* UA.UA..AU */
-{{  DEF, -279, -139, -279, -140},
-{ -479, -708, -568, -708, -569},
-{ -309, -538, -398, -538, -399},
-{ -389, -618, -478, -618, -479},
-{ -379, -608, -468, -608, -469}},
-/* UA.UC..AU */
-{{  DEF, -279, -139, -279, -140},
-{ -649, -878, -738, -878, -739},
-{ -289, -518, -378, -518, -379},
-{ -739, -968, -828, -968, -829},
-{ -379, -608, -468, -608, -469}},
-/* UA.UG..AU */
-{{  DEF, -279, -139, -279, -140},
-{ -649, -878, -738, -878, -739},
-{ -289, -518, -378, -518, -379},
-{ -739, -968, -828, -968, -829},
-{ -379, -608, -468, -608, -469}},
-/* UA.UU..AU */
-{{  DEF, -279, -139, -279, -140},
-{ -649, -878, -738, -878, -739},
-{ -289, -518, -378, -518, -379},
-{ -739, -968, -828, -968, -829},
-{ -379, -608, -468, -608, -469}}}},
-/* UA.@@..UA */
-{{{{    0,    0,    0,    0,    0},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.@A..UA */
-{{    0,    0,    0,    0,    0},
-{ -399, -399, -399, -399, -399},
-{ -429, -429, -429, -429, -429},
-{ -379, -379, -379, -379, -379},
-{ -279, -279, -279, -279, -279}},
-/* UA.@C..UA */
-{{    0,    0,    0,    0,    0},
-{ -629, -629, -629, -629, -629},
-{ -509, -509, -509, -509, -509},
-{ -679, -679, -679, -679, -679},
-{ -139, -139, -139, -139, -139}},
-/* UA.@G..UA */
-{{    0,    0,    0,    0,    0},
-{ -889, -889, -889, -889, -889},
-{ -199, -199, -199, -199, -199},
-{ -889, -889, -889, -889, -889},
-{ -279, -279, -279, -279, -279}},
-/* UA.@U..UA */
-{{    0,    0,    0,    0,    0},
-{ -589, -589, -589, -589, -589},
-{ -179, -179, -179, -179, -179},
-{ -679, -679, -679, -679, -679},
-{ -140, -140, -140, -140, -140}}},
-/* UA.A@..UA */
-{{{  DEF, -399, -629, -889, -589},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639}},
-/* UA.AA..UA */
-{{  DEF, -399, -629, -889, -589},
-{ -449, -798,-1028,-1288, -988},
-{ -479, -828,-1058,-1318,-1018},
-{ -429, -778,-1008,-1268, -968},
-{ -329, -678, -908,-1168, -868}},
-/* UA.AC..UA */
-{{  DEF, -399, -629, -889, -589},
-{ -679,-1028,-1258,-1518,-1218},
-{ -559, -908,-1138,-1398,-1098},
-{ -729,-1078,-1308,-1568,-1268},
-{ -189, -538, -768,-1028, -728}},
-/* UA.AG..UA */
-{{  DEF, -399, -629, -889, -589},
-{ -939,-1288,-1518,-1778,-1478},
-{ -249, -598, -828,-1088, -788},
-{ -939,-1288,-1518,-1778,-1478},
-{ -329, -678, -908,-1168, -868}},
-/* UA.AU..UA */
-{{  DEF, -399, -629, -889, -589},
-{ -639, -988,-1218,-1478,-1178},
-{ -229, -578, -808,-1068, -768},
-{ -729,-1078,-1308,-1568,-1268},
-{ -190, -539, -769,-1029, -729}}},
-/* UA.C@..UA */
-{{{  DEF, -429, -509, -199, -179},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229}},
-/* UA.CA..UA */
-{{  DEF, -429, -509, -199, -179},
-{ -449, -828, -908, -598, -578},
-{ -479, -858, -938, -628, -608},
-{ -429, -808, -888, -578, -558},
-{ -329, -708, -788, -478, -458}},
-/* UA.CC..UA */
-{{  DEF, -429, -509, -199, -179},
-{ -679,-1058,-1138, -828, -808},
-{ -559, -938,-1018, -708, -688},
-{ -729,-1108,-1188, -878, -858},
-{ -189, -568, -648, -338, -318}},
-/* UA.CG..UA */
-{{  DEF, -429, -509, -199, -179},
-{ -939,-1318,-1398,-1088,-1068},
-{ -249, -628, -708, -398, -378},
-{ -939,-1318,-1398,-1088,-1068},
-{ -329, -708, -788, -478, -458}},
-/* UA.CU..UA */
-{{  DEF, -429, -509, -199, -179},
-{ -639,-1018,-1098, -788, -768},
-{ -229, -608, -688, -378, -358},
-{ -729,-1108,-1188, -878, -858},
-{ -190, -569, -649, -339, -319}}},
-/* UA.G@..UA */
-{{{  DEF, -379, -679, -889, -679},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729}},
-/* UA.GA..UA */
-{{  DEF, -379, -679, -889, -679},
-{ -449, -778,-1078,-1288,-1078},
-{ -479, -808,-1108,-1318,-1108},
-{ -429, -758,-1058,-1268,-1058},
-{ -329, -658, -958,-1168, -958}},
-/* UA.GC..UA */
-{{  DEF, -379, -679, -889, -679},
-{ -679,-1008,-1308,-1518,-1308},
-{ -559, -888,-1188,-1398,-1188},
-{ -729,-1058,-1358,-1568,-1358},
-{ -189, -518, -818,-1028, -818}},
-/* UA.GG..UA */
-{{  DEF, -379, -679, -889, -679},
-{ -939,-1268,-1568,-1778,-1568},
-{ -249, -578, -878,-1088, -878},
-{ -939,-1268,-1568,-1778,-1568},
-{ -329, -658, -958,-1168, -958}},
-/* UA.GU..UA */
-{{  DEF, -379, -679, -889, -679},
-{ -639, -968,-1268,-1478,-1268},
-{ -229, -558, -858,-1068, -858},
-{ -729,-1058,-1358,-1568,-1358},
-{ -190, -519, -819,-1029, -819}}},
-/* UA.U@..UA */
-{{{  DEF, -279, -139, -279, -140},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190}},
-/* UA.UA..UA */
-{{  DEF, -279, -139, -279, -140},
-{ -449, -678, -538, -678, -539},
-{ -479, -708, -568, -708, -569},
-{ -429, -658, -518, -658, -519},
-{ -329, -558, -418, -558, -419}},
-/* UA.UC..UA */
-{{  DEF, -279, -139, -279, -140},
-{ -679, -908, -768, -908, -769},
-{ -559, -788, -648, -788, -649},
-{ -729, -958, -818, -958, -819},
-{ -189, -418, -278, -418, -279}},
-/* UA.UG..UA */
-{{  DEF, -279, -139, -279, -140},
-{ -939,-1168,-1028,-1168,-1029},
-{ -249, -478, -338, -478, -339},
-{ -939,-1168,-1028,-1168,-1029},
-{ -329, -558, -418, -558, -419}},
-/* UA.UU..UA */
-{{  DEF, -279, -139, -279, -140},
-{ -639, -868, -728, -868, -729},
-{ -229, -458, -318, -458, -319},
-{ -729, -958, -818, -958, -819},
-{ -190, -419, -279, -419, -280}}}},
-/* UA.@@.. @ */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.@A.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.@C.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.@G.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}},
-/* UA.@U.. @ */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF},
-{  DEF,  DEF,  DEF,  DEF,  DEF}}},
-/* UA.A@.. @ */
-{{{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639}},
-/* UA.AA.. @ */
-{{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639}},
-/* UA.AC.. @ */
-{{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639}},
-/* UA.AG.. @ */
-{{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639}},
-/* UA.AU.. @ */
-{{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639},
-{ -100, -449, -679, -939, -639}}},
-/* UA.C@.. @ */
-{{{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229}},
-/* UA.CA.. @ */
-{{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229}},
-/* UA.CC.. @ */
-{{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229}},
-/* UA.CG.. @ */
-{{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229}},
-/* UA.CU.. @ */
-{{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229},
-{ -100, -479, -559, -249, -229}}},
-/* UA.G@.. @ */
-{{{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729}},
-/* UA.GA.. @ */
-{{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729}},
-/* UA.GC.. @ */
-{{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729}},
-/* UA.GG.. @ */
-{{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729}},
-/* UA.GU.. @ */
-{{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729},
-{ -100, -429, -729, -939, -729}}},
-/* UA.U@.. @ */
-{{{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190}},
-/* UA.UA.. @ */
-{{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190}},
-/* UA.UC.. @ */
-{{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190}},
-/* UA.UG.. @ */
-{{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190}},
-/* UA.UU.. @ */
-{{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190},
-{ -100, -329, -189, -329, -190}}}}},
-{ /* noPair */ {{{{0}}}},
-/*  @.@@..CG */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.@A..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -569, -569, -569, -569, -569},
-{ -989, -989, -989, -989, -989},
-{ -859, -859, -859, -859, -859}},
-/*  @.@C..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -999, -999, -999, -999, -999},
-{ -499, -499, -499, -499, -499},
-{ -989, -989, -989, -989, -989},
-{ -789, -789, -789, -789, -789}},
-/*  @.@G..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -569, -569, -569, -569, -569},
-{ -989, -989, -989, -989, -989},
-{ -859, -859, -859, -859, -859}},
-/*  @.@U..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -719, -719, -719, -719, -719},
-{ -989, -989, -989, -989, -989},
-{ -909, -909, -909, -909, -909}}},
-/*  @.A@..CG */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.AA..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -569, -569, -569, -569, -569},
-{ -989, -989, -989, -989, -989},
-{ -859, -859, -859, -859, -859}},
-/*  @.AC..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -999, -999, -999, -999, -999},
-{ -499, -499, -499, -499, -499},
-{ -989, -989, -989, -989, -989},
-{ -789, -789, -789, -789, -789}},
-/*  @.AG..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -569, -569, -569, -569, -569},
-{ -989, -989, -989, -989, -989},
-{ -859, -859, -859, -859, -859}},
-/*  @.AU..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -719, -719, -719, -719, -719},
-{ -989, -989, -989, -989, -989},
-{ -909, -909, -909, -909, -909}}},
-/*  @.C@..CG */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.CA..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -569, -569, -569, -569, -569},
-{ -989, -989, -989, -989, -989},
-{ -859, -859, -859, -859, -859}},
-/*  @.CC..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -999, -999, -999, -999, -999},
-{ -499, -499, -499, -499, -499},
-{ -989, -989, -989, -989, -989},
-{ -789, -789, -789, -789, -789}},
-/*  @.CG..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -569, -569, -569, -569, -569},
-{ -989, -989, -989, -989, -989},
-{ -859, -859, -859, -859, -859}},
-/*  @.CU..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -719, -719, -719, -719, -719},
-{ -989, -989, -989, -989, -989},
-{ -909, -909, -909, -909, -909}}},
-/*  @.G@..CG */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.GA..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -569, -569, -569, -569, -569},
-{ -989, -989, -989, -989, -989},
-{ -859, -859, -859, -859, -859}},
-/*  @.GC..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -999, -999, -999, -999, -999},
-{ -499, -499, -499, -499, -499},
-{ -989, -989, -989, -989, -989},
-{ -789, -789, -789, -789, -789}},
-/*  @.GG..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -569, -569, -569, -569, -569},
-{ -989, -989, -989, -989, -989},
-{ -859, -859, -859, -859, -859}},
-/*  @.GU..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -719, -719, -719, -719, -719},
-{ -989, -989, -989, -989, -989},
-{ -909, -909, -909, -909, -909}}},
-/*  @.U@..CG */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.UA..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -569, -569, -569, -569, -569},
-{ -989, -989, -989, -989, -989},
-{ -859, -859, -859, -859, -859}},
-/*  @.UC..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -999, -999, -999, -999, -999},
-{ -499, -499, -499, -499, -499},
-{ -989, -989, -989, -989, -989},
-{ -789, -789, -789, -789, -789}},
-/*  @.UG..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -569, -569, -569, -569, -569},
-{ -989, -989, -989, -989, -989},
-{ -859, -859, -859, -859, -859}},
-/*  @.UU..CG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1079,-1079,-1079,-1079,-1079},
-{ -719, -719, -719, -719, -719},
-{ -989, -989, -989, -989, -989},
-{ -909, -909, -909, -909, -909}}}},
-/*  @.@@..GC */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.@A..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -569, -569, -569, -569, -569},
-{ -769, -769, -769, -769, -769},
-{ -759, -759, -759, -759, -759},
-{ -549, -549, -549, -549, -549}},
-/*  @.@C..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -929, -929, -929, -929, -929},
-{ -359, -359, -359, -359, -359},
-{ -789, -789, -789, -789, -789},
-{ -549, -549, -549, -549, -549}},
-/*  @.@G..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -609, -609, -609, -609, -609},
-{ -359, -359, -359, -359, -359},
-{ -669, -669, -669, -669, -669},
-{ -549, -549, -549, -549, -549}},
-/*  @.@U..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -929, -929, -929, -929, -929},
-{ -439, -439, -439, -439, -439},
-{ -789, -789, -789, -789, -789},
-{ -619, -619, -619, -619, -619}}},
-/*  @.A@..GC */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.AA..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -569, -569, -569, -569, -569},
-{ -769, -769, -769, -769, -769},
-{ -759, -759, -759, -759, -759},
-{ -549, -549, -549, -549, -549}},
-/*  @.AC..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -929, -929, -929, -929, -929},
-{ -359, -359, -359, -359, -359},
-{ -789, -789, -789, -789, -789},
-{ -549, -549, -549, -549, -549}},
-/*  @.AG..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -609, -609, -609, -609, -609},
-{ -359, -359, -359, -359, -359},
-{ -669, -669, -669, -669, -669},
-{ -549, -549, -549, -549, -549}},
-/*  @.AU..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -929, -929, -929, -929, -929},
-{ -439, -439, -439, -439, -439},
-{ -789, -789, -789, -789, -789},
-{ -619, -619, -619, -619, -619}}},
-/*  @.C@..GC */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.CA..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -569, -569, -569, -569, -569},
-{ -769, -769, -769, -769, -769},
-{ -759, -759, -759, -759, -759},
-{ -549, -549, -549, -549, -549}},
-/*  @.CC..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -929, -929, -929, -929, -929},
-{ -359, -359, -359, -359, -359},
-{ -789, -789, -789, -789, -789},
-{ -549, -549, -549, -549, -549}},
-/*  @.CG..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -609, -609, -609, -609, -609},
-{ -359, -359, -359, -359, -359},
-{ -669, -669, -669, -669, -669},
-{ -549, -549, -549, -549, -549}},
-/*  @.CU..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -929, -929, -929, -929, -929},
-{ -439, -439, -439, -439, -439},
-{ -789, -789, -789, -789, -789},
-{ -619, -619, -619, -619, -619}}},
-/*  @.G@..GC */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.GA..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -569, -569, -569, -569, -569},
-{ -769, -769, -769, -769, -769},
-{ -759, -759, -759, -759, -759},
-{ -549, -549, -549, -549, -549}},
-/*  @.GC..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -929, -929, -929, -929, -929},
-{ -359, -359, -359, -359, -359},
-{ -789, -789, -789, -789, -789},
-{ -549, -549, -549, -549, -549}},
-/*  @.GG..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -609, -609, -609, -609, -609},
-{ -359, -359, -359, -359, -359},
-{ -669, -669, -669, -669, -669},
-{ -549, -549, -549, -549, -549}},
-/*  @.GU..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -929, -929, -929, -929, -929},
-{ -439, -439, -439, -439, -439},
-{ -789, -789, -789, -789, -789},
-{ -619, -619, -619, -619, -619}}},
-/*  @.U@..GC */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.UA..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -569, -569, -569, -569, -569},
-{ -769, -769, -769, -769, -769},
-{ -759, -759, -759, -759, -759},
-{ -549, -549, -549, -549, -549}},
-/*  @.UC..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -929, -929, -929, -929, -929},
-{ -359, -359, -359, -359, -359},
-{ -789, -789, -789, -789, -789},
-{ -549, -549, -549, -549, -549}},
-/*  @.UG..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -609, -609, -609, -609, -609},
-{ -359, -359, -359, -359, -359},
-{ -669, -669, -669, -669, -669},
-{ -549, -549, -549, -549, -549}},
-/*  @.UU..GC */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -929, -929, -929, -929, -929},
-{ -439, -439, -439, -439, -439},
-{ -789, -789, -789, -789, -789},
-{ -619, -619, -619, -619, -619}}}},
-/*  @.@@..GU */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.@A..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -479, -479, -479, -479, -479},
-{ -309, -309, -309, -309, -309},
-{ -389, -389, -389, -389, -389},
-{ -379, -379, -379, -379, -379}},
-/*  @.@C..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.@G..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.@U..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}}},
-/*  @.A@..GU */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.AA..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -479, -479, -479, -479, -479},
-{ -309, -309, -309, -309, -309},
-{ -389, -389, -389, -389, -389},
-{ -379, -379, -379, -379, -379}},
-/*  @.AC..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.AG..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.AU..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}}},
-/*  @.C@..GU */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.CA..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -479, -479, -479, -479, -479},
-{ -309, -309, -309, -309, -309},
-{ -389, -389, -389, -389, -389},
-{ -379, -379, -379, -379, -379}},
-/*  @.CC..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.CG..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.CU..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}}},
-/*  @.G@..GU */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.GA..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -479, -479, -479, -479, -479},
-{ -309, -309, -309, -309, -309},
-{ -389, -389, -389, -389, -389},
-{ -379, -379, -379, -379, -379}},
-/*  @.GC..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.GG..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.GU..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}}},
-/*  @.U@..GU */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.UA..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -479, -479, -479, -479, -479},
-{ -309, -309, -309, -309, -309},
-{ -389, -389, -389, -389, -389},
-{ -379, -379, -379, -379, -379}},
-/*  @.UC..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.UG..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.UU..GU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}}}},
-/*  @.@@..UG */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.@A..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -769, -769, -769, -769, -769},
-{ -529, -529, -529, -529, -529},
-{ -709, -709, -709, -709, -709},
-{ -599, -599, -599, -599, -599}},
-/*  @.@C..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -839, -839, -839, -839, -839},
-{ -529, -529, -529, -529, -529},
-{ -859, -859, -859, -859, -859},
-{ -489, -489, -489, -489, -489}},
-/*  @.@G..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1009,-1009,-1009,-1009,-1009},
-{ -409, -409, -409, -409, -409},
-{ -969, -969, -969, -969, -969},
-{ -599, -599, -599, -599, -599}},
-/*  @.@U..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -859, -859, -859, -859, -859},
-{ -529, -529, -529, -529, -529},
-{ -859, -859, -859, -859, -859},
-{ -409, -409, -409, -409, -409}}},
-/*  @.A@..UG */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.AA..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -769, -769, -769, -769, -769},
-{ -529, -529, -529, -529, -529},
-{ -709, -709, -709, -709, -709},
-{ -599, -599, -599, -599, -599}},
-/*  @.AC..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -839, -839, -839, -839, -839},
-{ -529, -529, -529, -529, -529},
-{ -859, -859, -859, -859, -859},
-{ -489, -489, -489, -489, -489}},
-/*  @.AG..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1009,-1009,-1009,-1009,-1009},
-{ -409, -409, -409, -409, -409},
-{ -969, -969, -969, -969, -969},
-{ -599, -599, -599, -599, -599}},
-/*  @.AU..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -859, -859, -859, -859, -859},
-{ -529, -529, -529, -529, -529},
-{ -859, -859, -859, -859, -859},
-{ -409, -409, -409, -409, -409}}},
-/*  @.C@..UG */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.CA..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -769, -769, -769, -769, -769},
-{ -529, -529, -529, -529, -529},
-{ -709, -709, -709, -709, -709},
-{ -599, -599, -599, -599, -599}},
-/*  @.CC..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -839, -839, -839, -839, -839},
-{ -529, -529, -529, -529, -529},
-{ -859, -859, -859, -859, -859},
-{ -489, -489, -489, -489, -489}},
-/*  @.CG..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1009,-1009,-1009,-1009,-1009},
-{ -409, -409, -409, -409, -409},
-{ -969, -969, -969, -969, -969},
-{ -599, -599, -599, -599, -599}},
-/*  @.CU..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -859, -859, -859, -859, -859},
-{ -529, -529, -529, -529, -529},
-{ -859, -859, -859, -859, -859},
-{ -409, -409, -409, -409, -409}}},
-/*  @.G@..UG */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.GA..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -769, -769, -769, -769, -769},
-{ -529, -529, -529, -529, -529},
-{ -709, -709, -709, -709, -709},
-{ -599, -599, -599, -599, -599}},
-/*  @.GC..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -839, -839, -839, -839, -839},
-{ -529, -529, -529, -529, -529},
-{ -859, -859, -859, -859, -859},
-{ -489, -489, -489, -489, -489}},
-/*  @.GG..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1009,-1009,-1009,-1009,-1009},
-{ -409, -409, -409, -409, -409},
-{ -969, -969, -969, -969, -969},
-{ -599, -599, -599, -599, -599}},
-/*  @.GU..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -859, -859, -859, -859, -859},
-{ -529, -529, -529, -529, -529},
-{ -859, -859, -859, -859, -859},
-{ -409, -409, -409, -409, -409}}},
-/*  @.U@..UG */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.UA..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -769, -769, -769, -769, -769},
-{ -529, -529, -529, -529, -529},
-{ -709, -709, -709, -709, -709},
-{ -599, -599, -599, -599, -599}},
-/*  @.UC..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -839, -839, -839, -839, -839},
-{ -529, -529, -529, -529, -529},
-{ -859, -859, -859, -859, -859},
-{ -489, -489, -489, -489, -489}},
-/*  @.UG..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{-1009,-1009,-1009,-1009,-1009},
-{ -409, -409, -409, -409, -409},
-{ -969, -969, -969, -969, -969},
-{ -599, -599, -599, -599, -599}},
-/*  @.UU..UG */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -859, -859, -859, -859, -859},
-{ -529, -529, -529, -529, -529},
-{ -859, -859, -859, -859, -859},
-{ -409, -409, -409, -409, -409}}}},
-/*  @.@@..AU */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.@A..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -479, -479, -479, -479, -479},
-{ -309, -309, -309, -309, -309},
-{ -389, -389, -389, -389, -389},
-{ -379, -379, -379, -379, -379}},
-/*  @.@C..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.@G..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.@U..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}}},
-/*  @.A@..AU */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.AA..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -479, -479, -479, -479, -479},
-{ -309, -309, -309, -309, -309},
-{ -389, -389, -389, -389, -389},
-{ -379, -379, -379, -379, -379}},
-/*  @.AC..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.AG..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.AU..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}}},
-/*  @.C@..AU */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.CA..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -479, -479, -479, -479, -479},
-{ -309, -309, -309, -309, -309},
-{ -389, -389, -389, -389, -389},
-{ -379, -379, -379, -379, -379}},
-/*  @.CC..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.CG..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.CU..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}}},
-/*  @.G@..AU */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.GA..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -479, -479, -479, -479, -479},
-{ -309, -309, -309, -309, -309},
-{ -389, -389, -389, -389, -389},
-{ -379, -379, -379, -379, -379}},
-/*  @.GC..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.GG..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.GU..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}}},
-/*  @.U@..AU */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.UA..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -479, -479, -479, -479, -479},
-{ -309, -309, -309, -309, -309},
-{ -389, -389, -389, -389, -389},
-{ -379, -379, -379, -379, -379}},
-/*  @.UC..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.UG..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}},
-/*  @.UU..AU */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -649, -649, -649, -649, -649},
-{ -289, -289, -289, -289, -289},
-{ -739, -739, -739, -739, -739},
-{ -379, -379, -379, -379, -379}}}},
-/*  @.@@..UA */
-{{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.@A..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -449, -449, -449, -449, -449},
-{ -479, -479, -479, -479, -479},
-{ -429, -429, -429, -429, -429},
-{ -329, -329, -329, -329, -329}},
-/*  @.@C..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -679, -679, -679, -679, -679},
-{ -559, -559, -559, -559, -559},
-{ -729, -729, -729, -729, -729},
-{ -189, -189, -189, -189, -189}},
-/*  @.@G..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -939, -939, -939, -939, -939},
-{ -249, -249, -249, -249, -249},
-{ -939, -939, -939, -939, -939},
-{ -329, -329, -329, -329, -329}},
-/*  @.@U..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -639, -639, -639, -639, -639},
-{ -229, -229, -229, -229, -229},
-{ -729, -729, -729, -729, -729},
-{ -190, -190, -190, -190, -190}}},
-/*  @.A@..UA */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.AA..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -449, -449, -449, -449, -449},
-{ -479, -479, -479, -479, -479},
-{ -429, -429, -429, -429, -429},
-{ -329, -329, -329, -329, -329}},
-/*  @.AC..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -679, -679, -679, -679, -679},
-{ -559, -559, -559, -559, -559},
-{ -729, -729, -729, -729, -729},
-{ -189, -189, -189, -189, -189}},
-/*  @.AG..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -939, -939, -939, -939, -939},
-{ -249, -249, -249, -249, -249},
-{ -939, -939, -939, -939, -939},
-{ -329, -329, -329, -329, -329}},
-/*  @.AU..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -639, -639, -639, -639, -639},
-{ -229, -229, -229, -229, -229},
-{ -729, -729, -729, -729, -729},
-{ -190, -190, -190, -190, -190}}},
-/*  @.C@..UA */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.CA..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -449, -449, -449, -449, -449},
-{ -479, -479, -479, -479, -479},
-{ -429, -429, -429, -429, -429},
-{ -329, -329, -329, -329, -329}},
-/*  @.CC..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -679, -679, -679, -679, -679},
-{ -559, -559, -559, -559, -559},
-{ -729, -729, -729, -729, -729},
-{ -189, -189, -189, -189, -189}},
-/*  @.CG..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -939, -939, -939, -939, -939},
-{ -249, -249, -249, -249, -249},
-{ -939, -939, -939, -939, -939},
-{ -329, -329, -329, -329, -329}},
-/*  @.CU..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -639, -639, -639, -639, -639},
-{ -229, -229, -229, -229, -229},
-{ -729, -729, -729, -729, -729},
-{ -190, -190, -190, -190, -190}}},
-/*  @.G@..UA */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.GA..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -449, -449, -449, -449, -449},
-{ -479, -479, -479, -479, -479},
-{ -429, -429, -429, -429, -429},
-{ -329, -329, -329, -329, -329}},
-/*  @.GC..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -679, -679, -679, -679, -679},
-{ -559, -559, -559, -559, -559},
-{ -729, -729, -729, -729, -729},
-{ -189, -189, -189, -189, -189}},
-/*  @.GG..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -939, -939, -939, -939, -939},
-{ -249, -249, -249, -249, -249},
-{ -939, -939, -939, -939, -939},
-{ -329, -329, -329, -329, -329}},
-/*  @.GU..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -639, -639, -639, -639, -639},
-{ -229, -229, -229, -229, -229},
-{ -729, -729, -729, -729, -729},
-{ -190, -190, -190, -190, -190}}},
-/*  @.U@..UA */
-{{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.UA..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -449, -449, -449, -449, -449},
-{ -479, -479, -479, -479, -479},
-{ -429, -429, -429, -429, -429},
-{ -329, -329, -329, -329, -329}},
-/*  @.UC..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -679, -679, -679, -679, -679},
-{ -559, -559, -559, -559, -559},
-{ -729, -729, -729, -729, -729},
-{ -189, -189, -189, -189, -189}},
-/*  @.UG..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -939, -939, -939, -939, -939},
-{ -249, -249, -249, -249, -249},
-{ -939, -939, -939, -939, -939},
-{ -329, -329, -329, -329, -329}},
-/*  @.UU..UA */
-{{  DEF,  DEF,  DEF,  DEF,  DEF},
-{ -639, -639, -639, -639, -639},
-{ -229, -229, -229, -229, -229},
-{ -729, -729, -729, -729, -729},
-{ -190, -190, -190, -190, -190}}}},
-/*  @.@@.. @ */
-{{{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.@A.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.@C.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.@G.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.@U.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}}},
-/*  @.A@.. @ */
-{{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.AA.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.AC.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.AG.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.AU.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}}},
-/*  @.C@.. @ */
-{{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.CA.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.CC.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.CG.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.CU.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}}},
-/*  @.G@.. @ */
-{{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.GA.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.GC.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.GG.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.GU.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}}},
-/*  @.U@.. @ */
-{{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.UA.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.UC.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.UG.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}},
-/*  @.UU.. @ */
-{{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100},
-{ -100, -100, -100, -100, -100}}}}}};
-
-
diff --git a/include/PS_dot.h b/include/PS_dot.h
deleted file mode 100644
--- a/include/PS_dot.h
+++ /dev/null
@@ -1,197 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_PS_DOT_H__
-#define __VIENNA_RNA_PACKAGE_PS_DOT_H__
-
-#include "data_structures.h"
-#include "plot_layouts.h"
-
-#ifdef __GNUC__
-#define DEPRECATED(func) func __attribute__ ((deprecated))
-#else
-#define DEPRECATED(func) func
-#endif
-
-/**
- *  \file PS_dot.h
- *  \brief Various functions for plotting RNA secondary structures, dot-plots and other
- *  visualizations
- */
-
-/* write PostScript drawing of structure to file with annotation */
-int PS_rna_plot_snoop_a(char *string,
-                        char *structure,
-                        char *ssfile,
-                        int *relative_access,
-                        const char *seqs[]);
-
-/**
- *  \brief Produce a secondary structure graph in PostScript and write it to 'filename'.
- *
- *  Note that this function has changed from previous versions
- *  and now expects the structure to be plotted in dot-bracket notation as an
- *  argument. It does not make use of the global #base_pair array anymore.
- *
- *  \param string     The RNA sequence
- *  \param structure  The secondary structure in dot-bracket notation
- *  \param file       The filename of the postscript output
- *  \return           1 on success, 0 otherwise
- */
-int PS_rna_plot(char *string,
-                char *structure,
-                char *file);
-
-/**
- *  \brief Produce a secondary structure graph in PostScript including additional
- *  annotation macros and write it to 'filename'
- *
- *  Same as PS_rna_plot() but adds extra PostScript macros for various
- *  annotations (see generated PS code). The 'pre' and 'post'
- *  variables contain PostScript code that is verbatim copied in the
- *  resulting PS file just before and after the structure plot.
- *  If both arguments ('pre' and 'post') are NULL, no additional macros will
- *  be printed into the PostScript.
- *
- *  \param string     The RNA sequence
- *  \param structure  The secondary structure in dot-bracket notation
- *  \param file       The filename of the postscript output
- *  \param pre        PostScript code to appear before the secondary structure plot
- *  \param post       PostScript code to appear after the secondary structure plot
- *  \return           1 on success, 0 otherwise
- */
-int PS_rna_plot_a(char *string,
-                  char *structure,
-                  char *file,
-                  char *pre,
-                  char *post);
-
-int PS_rna_plot_a_gquad(char *string,
-                        char *structure,
-                        char *ssfile,
-                        char *pre,
-                        char *post);
-
-/**
- *  \brief Produce a secondary structure graph in Graph Meta Language (gml) and write it to a file
- *
- *  If 'option' is an uppercase letter the RNA sequence is used to label nodes, if 'option' equals
- *  \a 'X' or \a 'x' the resulting file will coordinates for an initial layout of the graph.
- *
- *  \param  string    The RNA sequence
- *  \param  structure The secondary structure in dot-bracket notation
- *  \param  ssfile    The filename of the gml output
- *  \param  option    The option flag
- *  \return           1 on success, 0 otherwise
- */
-int gmlRNA( char *string,
-            char *structure,
-            char *ssfile,
-            char option);
-
-/**
- *  \brief  Produce a secondary structure graph in SStructView format
- *
- *  Write coord file for SStructView
- *
- *  \param  string    The RNA sequence
- *  \param  structure The secondary structure in dot-bracket notation
- *  \param  ssfile    The filename of the ssv output
- *  \return           1 on success, 0 otherwise
- */
-int ssv_rna_plot( char *string,
-                  char *structure,
-                  char *ssfile);
-
-/**
- *  \brief Produce a secondary structure plot in SVG format and write it to a file
- *
- *  \param string     The RNA sequence
- *  \param structure  The secondary structure in dot-bracket notation
- *  \param ssfile     The filename of the svg output
- *  \return           1 on success, 0 otherwise
- */
-int svg_rna_plot( char *string,
-                  char *structure,
-                  char *ssfile);
-
-/**
- *  \brief Produce a secondary structure plot for further editing in XRNA
- *
- *  \param string     The RNA sequence
- *  \param structure  The secondary structure in dot-bracket notation
- *  \param ssfile     The filename of the xrna output
- *  \return           1 on success, 0 otherwise
- */
-int xrna_plot(char *string,
-              char *structure,
-              char *ssfile);
-
-int PS_color_dot_plot(char *string,
-                      cpair *pi,
-                      char *filename);
-
-int PS_color_dot_plot_turn( char *seq,
-                            cpair *pi,
-                            char *filename,
-                            int winSize);
-
-/**
- *  \brief Produce a postscript dot-plot from two pair lists
- *
- *  This function reads two plist structures (e.g. base pair probabilities and a secondary structure)
- *  as produced by assign_plist_from_pr() and assign_plist_from_db() and produces a postscript
- *  "dot plot" that is written to 'filename'.\n
- *  Using base pair probabilities in the first and mfe structure in the second plist, the resulting
- *  "dot plot" represents each base pairing probability by a square of corresponding area in a upper
- *  triangle matrix. The lower part of the matrix contains the minimum free energy structure.
- *
- *  \see assign_plist_from_pr(), assign_plist_from_db()
- *
- *  \param seq      The RNA sequence
- *  \param filename A filename for the postscript output
- *  \param pl       The base pair probability pairlist
- *  \param mf       The mfe secondary structure pairlist
- *  \param comment  A comment
- *  \return         1 if postscript was successfully written, 0 otherwise
- */
-int PS_dot_plot_list( char *seq,
-                      char *filename,
-                      plist *pl,
-                      plist *mf,
-                      char *comment);
-
-int PS_dot_plot_turn( char *seq,
-                      struct plist *pl,
-                      char *filename,
-                      int winSize);
-
-int PS_color_aln( const char *structure,
-                  const char *filename,
-                  const char *seqs[],
-                  const char *names[]);
-
-/**
- * 	PS_color_aln for duplexes
-*/
-int aliPS_color_aln(const char *structure,
-                    const char *filename, 
-                    const char *seqs[],
-                    const char *names[]); 
-
-
-/**
- *  Wrapper to PS_dot_plot_list
- *
- *  \brief Produce postscript dot-plot
- *
- *  Reads base pair probabilities produced by pf_fold() from the
- *  global array #pr and the pair list #base_pair produced by
- *  fold() and produces a postscript "dot plot" that is written to
- *  'filename'. The "dot plot" represents each base pairing
- *  probability by a square of corresponding area in a upper triangle
- *  matrix. The lower part of the matrix contains the minimum free energy
- *  \note DO NOT USE THIS FUNCTION ANYMORE SINCE IT IS NOT THREADSAFE
- *
- *  \deprecated This function is deprecated and will be removed soon! Use \ref PS_dot_plot_list() instead!
- */
-DEPRECATED(int PS_dot_plot( char *string,
-                            char *file));
-#endif
diff --git a/include/aln_util.h b/include/aln_util.h
deleted file mode 100644
--- a/include/aln_util.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_ALN_UTIL_H__
-#define __VIENNA_RNA_PACKAGE_ALN_UTIL_H__
-
-int read_clustal( FILE *clust,
-                  char *AlignedSeqs[],
-                  char *names[]);
-/*@only@*/ /*@notnull@*/ char *consensus(const char *AS[]);
-/*@only@*/ /*@notnull@*/ char *consens_mis(const char *AS[]);
-
-#endif
diff --git a/include/cofold.h b/include/cofold.h
deleted file mode 100644
--- a/include/cofold.h
+++ /dev/null
@@ -1,182 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_COFOLD_H__
-#define __VIENNA_RNA_PACKAGE_COFOLD_H__
-
-#include "data_structures.h"
-
-#ifdef __GNUC__
-#define DEPRECATED(func) func __attribute__ ((deprecated))
-#else
-#define DEPRECATED(func) func
-#endif
-
-/**
- *  \addtogroup cofold
- *  \brief Predict structures formed by two molecules upon hybridization.
- *
- *  The function of an RNA molecule often depends on its interaction with
- *  other RNAs. The following routines therefore allow to predict structures
- *  formed by two RNA molecules upon hybridization.\n
- *  One approach to co-folding two RNAs consists of concatenating the two
- *  sequences and keeping track of the concatenation point in all energy
- *  evaluations. Correspondingly, many of the cofold() and
- *  co_pf_fold() routines below take one sequence string as argument
- *  and use the the global variable #cut_point to mark the concatenation
- *  point. Note that while the <i>RNAcofold</i> program uses the '&' character
- *  to mark the chain break in its input, you should not use an '&' when using
- *  the library routines (set #cut_point instead).\n
- *  In a second approach to co-folding two RNAs, cofolding is seen as a
- *  stepwise process. In the first step the probability of an unpaired region
- *  is calculated and in a second step this probability of an unpaired region
- *  is  multiplied with the probability of an interaction between the two RNAs.
- *  This approach is implemented for the interaction between a long
- *  target sequence and a short ligand RNA. Function pf_unstru() calculates
- *  the partition function over all unpaired regions in the input
- *  sequence. Function pf_interact(), which calculates the
- *  partition function over all possible interactions between two
- *  sequences, needs both sequence as separate strings as input.
- *
- */
-
-/**
- *  \addtogroup mfe_cofold
- *  @{
- *  \file cofold.h
- * 
- *  \brief MFE version of cofolding routines
- * 
- *  This file includes (almost) all function declarations within the <b>RNAlib</b> that are related to
- *  MFE Cofolding...
- *  This also includes the Zuker suboptimals calculations, since they are implemented using the cofold
- *  routines.
- */
-
-/**
- *  \brief Compute the minimum free energy of two interacting RNA molecules
- * 
- *  The code is analog to the fold() function. If #cut_point ==-1 results
- *  should be the same as with fold().
- * 
- *  \ingroup mfe_cofold
- *
- *  \param    sequence  The two sequences concatenated
- *  \param    structure Will hold the barcket dot structure of the dimer molecule
- *  \return   minimum free energy of the structure
- */
-float cofold( const char *sequence,
-              char *structure);
-
-/**
- *  \brief Compute the minimum free energy of two interacting RNA molecules
- * 
- */
-float cofold_par( const char *string,
-                  char *structure,
-                  paramT *parameters,
-                  int is_constrained);
-
-/**
- *  \brief Free memory occupied by cofold()
- */
-void      free_co_arrays(void);
-
-/**
- *  \brief Recalculate parameters
- */
-void      update_cofold_params(void);
-
-void      update_cofold_params_par(paramT *parameters);
-
-
-/**
- *  \brief Export the arrays of partition function cofold (with gquadruplex support)
- * 
- *  Export the cofold arrays for use e.g. in the concentration
- *  Computations or suboptimal secondary structure backtracking
- *
- *  \param  f5_p    A pointer to the 'f5' array, i.e. array conatining best free energy in interval [1,j]
- *  \param  c_p     A pointer to the 'c' array, i.e. array containing best free energy in interval [i,j] given that i pairs with j
- *  \param  fML_p   A pointer to the 'M' array, i.e. array containing best free energy in interval [i,j] for any multiloop segment with at least one stem
- *  \param  fM1_p   A pointer to the 'M1' array, i.e. array containing best free energy in interval [i,j] for multiloop segment with exactly one stem
- *  \param  fc_p    A pointer to the 'fc' array, i.e. array ...
- *  \param  ggg_p   A pointer to the 'ggg' array, i.e. array containing best free energy of a gquadruplex delimited by [i,j]
- *  \param  indx_p  A pointer to the indexing array used for accessing the energy matrices
- *  \param  ptype_p A pointer to the ptype array containing the base pair types for each possibility (i,j)
- */
-void export_cofold_arrays_gq( int **f5_p,
-                              int **c_p,
-                              int **fML_p,
-                              int **fM1_p,
-                              int **fc_p,
-                              int **ggg_p,
-                              int **indx_p,
-                              char **ptype_p);
-
-/**
- *  \brief Export the arrays of partition function cofold
- * 
- *  Export the cofold arrays for use e.g. in the concentration
- *  Computations or suboptimal secondary structure backtracking
- *
- *  \param  f5_p    A pointer to the 'f5' array, i.e. array conatining best free energy in interval [1,j]
- *  \param  c_p     A pointer to the 'c' array, i.e. array containing best free energy in interval [i,j] given that i pairs with j
- *  \param  fML_p   A pointer to the 'M' array, i.e. array containing best free energy in interval [i,j] for any multiloop segment with at least one stem
- *  \param  fM1_p   A pointer to the 'M1' array, i.e. array containing best free energy in interval [i,j] for multiloop segment with exactly one stem
- *  \param  fc_p    A pointer to the 'fc' array, i.e. array ...
- *  \param  indx_p  A pointer to the indexing array used for accessing the energy matrices
- *  \param  ptype_p A pointer to the ptype array containing the base pair types for each possibility (i,j)
- */
-void export_cofold_arrays(int **f5_p,
-                          int **c_p,
-                          int **fML_p,
-                          int **fM1_p,
-                          int **fc_p,
-                          int **indx_p,
-                          char **ptype_p);
-
-
-/**
- *  @}
- */
-
-/**
- *  \brief Compute Zuker type suboptimal structures
- *
- *  Compute Suboptimal structures according to M. Zuker, i.e. for every 
- *  possible base pair the minimum energy structure containing the resp. base pair. 
- *  Returns a list of these structures and their energies.
- *
- *  \ingroup subopt_zuker
- *
- *  \param  string  RNA sequence
- *  \return         List of zuker suboptimal structures
- */
-SOLUTION  *zukersubopt(const char *string);
-
-/**
- *  \brief Compute Zuker type suboptimal structures
- *
- *  \ingroup subopt_zuker
- *
- */
-SOLUTION  *zukersubopt_par( const char *string,
-                            paramT *parameters);
-
-/**
- *  \brief get_monomer_free_energies
- *
- *  Export monomer free energies out of cofold arrays
- * 
- *  \param e1 A pointer to a variable where the energy of molecule A will be written to
- *  \param e2 A pointer to a variable where the energy of molecule B will be written to
- */
-void get_monomere_mfes( float *e1,
-                        float *e2);
-
-
-/**
- *  allocate arrays for folding
- *  \deprecated{This function is obsolete and will be removed soon!}
- */
-DEPRECATED(void initialize_cofold(int length));
-
-#endif
diff --git a/include/config.h b/include/config.h
deleted file mode 100644
--- a/include/config.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* config.h.  Generated from config.h.in by configure.  */
-/* config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define to 1 if you have the `erand48' function. */
-#define HAVE_ERAND48 1
-
-/* Define to 1 if you have the <float.h> header file. */
-#define HAVE_FLOAT_H 1
-
-/* Define to 1 if you have the `floor' function. */
-#define HAVE_FLOOR 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the `m' library (-lm). */
-#define HAVE_LIBM 1
-
-/* Define to 1 if you have the <limits.h> header file. */
-#define HAVE_LIMITS_H 1
-
-/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
-   to 0 otherwise. */
-#define HAVE_MALLOC 1
-
-/* Define to 1 if you have the <malloc.h> header file. */
-#define HAVE_MALLOC_H 1
-
-/* Define to 1 if you have the <math.h> header file. */
-#define HAVE_MATH_H 1
-
-/* Define to 1 if you have the `memmove' function. */
-#define HAVE_MEMMOVE 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have the `memset' function. */
-#define HAVE_MEMSET 1
-
-/* Define to 1 if you have the `pow' function. */
-#define HAVE_POW 1
-
-/* Define to 1 if your system has a GNU libc compatible `realloc' function,
-   and to 0 otherwise. */
-#define HAVE_REALLOC 1
-
-/* Define to 1 if you have the `rint' function. */
-#define HAVE_RINT 1
-
-/* Define to 1 if you have the `sqrt' function. */
-#define HAVE_SQRT 1
-
-/* Define to 1 if stdbool.h conforms to C99. */
-#define HAVE_STDBOOL_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the `strchr' function. */
-#define HAVE_STRCHR 1
-
-/* Define to 1 if you have the `strdup' function. */
-#define HAVE_STRDUP 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the `strrchr' function. */
-#define HAVE_STRRCHR 1
-
-/* Define to 1 if you have the `strstr' function. */
-#define HAVE_STRSTR 1
-
-/* Define to 1 if you have the `strtol' function. */
-#define HAVE_STRTOL 1
-
-/* Define to 1 if you have the `strtoul' function. */
-#define HAVE_STRTOUL 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if the system has the type `_Bool'. */
-#define HAVE__BOOL 1
-
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-/* #undef NO_MINUS_C_MINUS_O */
-
-/* Name of package */
-#define PACKAGE "ViennaRNA"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "rna@tbi.univie.ac.at"
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "ViennaRNA"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "ViennaRNA 2.1.5"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "ViennaRNA"
-
-/* Define to the home page for this package. */
-#define PACKAGE_URL "http://www.tbi.univie.ac.a/~ivo/RNA"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "2.1.5"
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* only for gcc */
-#define UNUSED __attribute__ ((unused))
-
-/* Compute z-scores for RNALfold */
-#define USE_SVM 1
-
-/* Version number of package */
-#define VERSION "2.1.5"
-
-/* Analyse{Dists,Seqs} */
-#define WITH_CLUSTER 1
-
-/* Define if using the dmalloc debugging malloc package */
-/* #undef WITH_DMALLOC */
-
-/* Create the perl interface to RNAlib */
-#define WITH_PERL_INTERFACE 1
-
-/* Create the python interface to RNAlib */
-/* #undef WITH_PYTHON_INTERFACE */
-
-/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
-   calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-
-/* Define to rpl_malloc if the replacement function should be used. */
-/* #undef malloc */
-
-/* Define to rpl_realloc if the replacement function should be used. */
-/* #undef realloc */
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-/* #undef size_t */
diff --git a/include/data_structures.h b/include/data_structures.h
deleted file mode 100644
--- a/include/data_structures.h
+++ /dev/null
@@ -1,774 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_DATA_STRUCTURES_H__
-#define __VIENNA_RNA_PACKAGE_DATA_STRUCTURES_H__
-
-#include "energy_const.h"
-/**
- *  \file data_structures.h
- *  \brief All datastructures and typedefs shared among the Vienna RNA Package can be found here
- */
-
-/* to use floats instead of doubles in pf_fold() comment next line */
-#define LARGE_PF
-#ifdef  LARGE_PF
-#define FLT_OR_DBL double
-#else
-#define FLT_OR_DBL float
-#endif
-
-#ifndef NBASES
-#define NBASES 8
-#endif
-
-#ifndef MAXALPHA
-/**
- *  \brief Maximal length of alphabet
- */
-#define MAXALPHA              20
-#endif
-
-/**
- *  \brief Maximum density of states discretization for subopt
- */
-#define MAXDOS                1000
-
-#define   VRNA_GQUAD_MAX_STACK_SIZE     7
-#define   VRNA_GQUAD_MIN_STACK_SIZE     2
-#define   VRNA_GQUAD_MAX_LINKER_LENGTH  15
-#define   VRNA_GQUAD_MIN_LINKER_LENGTH  1
-#define   VRNA_GQUAD_MIN_BOX_SIZE       ((4*VRNA_GQUAD_MIN_STACK_SIZE)+(3*VRNA_GQUAD_MIN_LINKER_LENGTH))
-#define   VRNA_GQUAD_MAX_BOX_SIZE       ((4*VRNA_GQUAD_MAX_STACK_SIZE)+(3*VRNA_GQUAD_MAX_LINKER_LENGTH))
-
-
-/*
-* ############################################################
-* Here are the type definitions of various datastructures
-* shared among the Vienna RNA Package
-* ############################################################
-*/
-
-/**
- *  \brief this datastructure is used as input parameter in functions of PS_dot.h and others
- */
-typedef struct plist {
-  int i;
-  int j;
-  float p;
-  int type;
-} plist;
-
-/**
- *  \brief this datastructure is used as input parameter in functions of PS_dot.c
- */
-typedef struct cpair {
-  int i,j,mfe;
-  float p, hue, sat;
-} cpair;
-
-/**
- *  \brief this is a workarround for the SWIG Perl Wrapper RNA plot function
- *  that returns an array of type COORDINATE
- */
-typedef struct {
-  float X; /* X coords */
-  float Y; /* Y coords */
-} COORDINATE;
-
-/**
- *  \brief  Stack of partial structures for backtracking
- */
-typedef struct sect {
-  int  i;
-  int  j;
-  int ml;
-} sect;
-
-/**
- *  \brief  Base pair
- */
-typedef struct bondT {
-   unsigned int i;
-   unsigned int j;
-} bondT;
-
-/**
- *  \brief  Base pair with associated energy
- */
-typedef struct bondTEn {
-   int i;
-   int j;
-   int energy;
-} bondTEn;
-
-/**
- *  \brief The data structure that contains the complete model details used throughout the calculations
- *
- */
-typedef struct{
-  int     dangles;      /**<  \brief  Specifies the dangle model used in any energy evaluation (0,1,2 or 3)
-                              \note   Some function do not implement all dangle model but only a subset of
-                                      (0,1,2,3). Read the documentaion of the particular recurrences or
-                                      energy evaluation function for information about the provided dangle
-                                      model.
-                        */
-  int     special_hp;   /**<  \brief  Include special hairpin contributions for tri, tetra and hexaloops */
-  int     noLP;         /**<  \brief  Only consider canonical structures, i.e. no 'lonely' base pairs */
-  int     noGU;         /**<  \brief  Do not allow GU pairs */
-  int     noGUclosure;  /**<  \brief  Do not allow loops to be closed by GU pair */
-  int     logML;        /**<  \brief  Use logarithmic scaling for multi loops */
-  int     circ;         /**<  \brief  Assume molecule to be circular */
-  int     gquad;        /**<  \brief  Include G-quadruplexes in structure prediction */
-} model_detailsT;
-
-/**
- *  \brief The datastructure that contains temperature scaled energy parameters.
- */
-typedef struct{
-  int id;
-  int stack[NBPAIRS+1][NBPAIRS+1];
-  int hairpin[31];
-  int bulge[MAXLOOP+1];
-  int internal_loop[MAXLOOP+1];
-  int mismatchExt[NBPAIRS+1][5][5];
-  int mismatchI[NBPAIRS+1][5][5];
-  int mismatch1nI[NBPAIRS+1][5][5];
-  int mismatch23I[NBPAIRS+1][5][5];
-  int mismatchH[NBPAIRS+1][5][5];
-  int mismatchM[NBPAIRS+1][5][5];
-  int dangle5[NBPAIRS+1][5];
-  int dangle3[NBPAIRS+1][5];
-  int int11[NBPAIRS+1][NBPAIRS+1][5][5];
-  int int21[NBPAIRS+1][NBPAIRS+1][5][5][5];
-  int int22[NBPAIRS+1][NBPAIRS+1][5][5][5][5];
-  int ninio[5];
-  double  lxc;
-  int     MLbase;
-  int     MLintern[NBPAIRS+1];
-  int     MLclosing;
-  int     TerminalAU;
-  int     DuplexInit;
-  int     Tetraloop_E[200];
-  char    Tetraloops[1401];
-  int     Triloop_E[40];
-  char    Triloops[241];
-  int     Hexaloop_E[40];
-  char    Hexaloops[1801];
-  int     TripleC;
-  int     MultipleCA;
-  int     MultipleCB;
-  int     gquad [VRNA_GQUAD_MAX_STACK_SIZE + 1]
-                [3*VRNA_GQUAD_MAX_LINKER_LENGTH + 1];
-
-  double  temperature;            /**<  \brief  Temperature used for loop contribution scaling */
-
-  model_detailsT model_details;   /**<  \brief  Model details to be used in the recursions */
-
-}  paramT;
-
-/**
- *  \brief  The datastructure that contains temperature scaled Boltzmann weights of the energy parameters.
- */
-typedef struct{
-  int     id;
-  double  expstack[NBPAIRS+1][NBPAIRS+1];
-  double  exphairpin[31];
-  double  expbulge[MAXLOOP+1];
-  double  expinternal[MAXLOOP+1];
-  double  expmismatchExt[NBPAIRS+1][5][5];
-  double  expmismatchI[NBPAIRS+1][5][5];
-  double  expmismatch23I[NBPAIRS+1][5][5];
-  double  expmismatch1nI[NBPAIRS+1][5][5];
-  double  expmismatchH[NBPAIRS+1][5][5];
-  double  expmismatchM[NBPAIRS+1][5][5];
-  double  expdangle5[NBPAIRS+1][5];
-  double  expdangle3[NBPAIRS+1][5];
-  double  expint11[NBPAIRS+1][NBPAIRS+1][5][5];
-  double  expint21[NBPAIRS+1][NBPAIRS+1][5][5][5];
-  double  expint22[NBPAIRS+1][NBPAIRS+1][5][5][5][5];
-  double  expninio[5][MAXLOOP+1];
-  double  lxc;
-  double  expMLbase;
-  double  expMLintern[NBPAIRS+1];
-  double  expMLclosing;
-  double  expTermAU;
-  double  expDuplexInit;
-  double  exptetra[40];
-  double  exptri[40];
-  double  exphex[40];
-  char    Tetraloops[1401];
-  double  expTriloop[40];
-  char    Triloops[241];
-  char    Hexaloops[1801];
-  double  expTripleC;
-  double  expMultipleCA;
-  double  expMultipleCB;
-  double  expgquad[VRNA_GQUAD_MAX_STACK_SIZE + 1]
-                  [3*VRNA_GQUAD_MAX_LINKER_LENGTH + 1];
-
-  double  kT;
-  double  pf_scale;     /**<  \brief    Scaling factor to avoid over-/underflows */
-
-  double  temperature;  /**<  \brief    Temperature used for loop contribution scaling */
-  double  alpha;        /**<  \brief    Scaling factor for the thermodynamic temperature
-                              \details  This allows for temperature scaling in Boltzmann
-                                        factors independently from the energy contributions.
-                                        The resulting Boltzmann factors are then computed by
-                                        \f$ e^{-E/(\alpha \cdot K \cdot T)} \f$
-                        */
-
-  model_detailsT model_details; /**<  \brief  Model details to be used in the recursions */
-
-}  pf_paramT;
-
-
-
-/*
-* ############################################################
-* SUBOPT data structures
-* ############################################################
-*/
-
-
-/**
- *  \brief  Base pair data structure used in subopt.c
- */
-typedef struct {
-  int i;
-  int j;
-} PAIR;
-
-/**
- *  \brief  Sequence interval stack element used in subopt.c
- */
-typedef struct {
-    int i;
-    int j;
-    int array_flag;
-} INTERVAL;
-
-/**
- *  \brief  Solution element from subopt.c
- */
-typedef struct {
-  float energy;       /**< \brief Free Energy of structure in kcal/mol */
-  char *structure;    /**< \brief Structure in dot-bracket notation */
-} SOLUTION;
-
-/*
-* ############################################################
-* COFOLD data structures
-* ############################################################
-*/
-
-/**
- *  \brief  
- */
-typedef struct cofoldF {
-  /* free energies for: */
-  double F0AB;  /**< \brief Null model without DuplexInit */
-  double FAB;   /**< \brief all states with DuplexInit correction */
-  double FcAB;  /**< \brief true hybrid states only */
-  double FA;    /**< \brief monomer A */
-  double FB;    /**< \brief monomer B */
-} cofoldF;
-
-/**
- *  \brief  
- */
-typedef struct ConcEnt {
-  double A0;    /**< \brief start concentration A */
-  double B0;    /**< \brief start concentration B */
-  double ABc;   /**< \brief End concentration AB */
-  double AAc;
-  double BBc;
-  double Ac;
-  double Bc;
-} ConcEnt;
-
-/**
- *  \brief  
- */
-typedef struct pairpro{
-  struct plist *AB;
-  struct plist *AA;
-  struct plist *A;
-  struct plist *B;
-  struct plist *BB;
-}pairpro;
-
-/**
- *  \brief A base pair info structure
- *
- *  For each base pair (i,j) with i,j in [0, n-1] the structure lists:
- *  - its probability 'p'
- *  - an entropy-like measure for its well-definedness 'ent'
- *  - the frequency of each type of pair in 'bp[]'
- *    + 'bp[0]' contains the number of non-compatible sequences
- *    + 'bp[1]' the number of CG pairs, etc.
- */
-typedef struct {
-   unsigned i;    /**<  \brief  nucleotide position i */ 
-   unsigned j;    /**<  \brief  nucleotide position j */
-   float p;       /**< \brief  Probability */
-   float ent;     /**< \brief  Pseudo entropy for \f$ p(i,j) = S_i + S_j - p_ij*ln(p_ij) \f$ */
-   short bp[8];   /**< \brief  Frequencies of pair_types */
-   char comp;     /**< \brief  1 iff pair is in mfe structure */
-} pair_info;
-
-
-/*
-* ############################################################
-* FINDPATH data structures
-* ############################################################
-*/
-
-/**
- *  \brief  
- */
-typedef struct move {
-  int i;  /* i,j>0 insert; i,j<0 delete */
-  int j;
-  int when;  /* 0 if still available, else resulting distance from start */
-  int E;
-} move_t;
-
-/**
- *  \brief  
- */
-typedef struct intermediate {
-  short *pt;      /**<  \brief  pair table */
-  int Sen;        /**<  \brief  saddle energy so far */
-  int curr_en;    /**<  \brief  current energy */
-  move_t *moves;  /**<  \brief  remaining moves to target */
-} intermediate_t;
-
-/**
- *  \brief  
- */
-typedef struct path {
-  double en;
-  char *s;
-} path_t;
-
-/*
-* ############################################################
-* RNAup data structures
-* ############################################################
-*/
-
-/**
- *  \brief contributions to p_u
- */
-typedef struct pu_contrib {
-  double **H; /**<  \brief  hairpin loops */
-  double **I; /**<  \brief  interior loops */
-  double **M; /**<  \brief  multi loops */
-  double **E; /**<  \brief  exterior loop */
-  int length; /**<  \brief  length of the input sequence */
-  int w;      /**<  \brief  longest unpaired region */
-} pu_contrib;
-
-/**
- *  \brief  
- */
-typedef struct interact {
-  double *Pi;       /**<  \brief  probabilities of interaction */
-  double *Gi;       /**<  \brief  free energies of interaction */
-  double Gikjl;     /**<  \brief  full free energy for interaction between [k,i] k<i
-                                  in longer seq and [j,l] j<l in shorter seq */
-  double Gikjl_wo;  /**<  \brief  Gikjl without contributions for prob_unpaired */
-  int i;            /**<  \brief  k<i in longer seq */
-  int k;            /**<  \brief  k<i in longer seq */
-  int j;            /**<  \brief  j<l in shorter seq */
-  int l;            /**<  \brief  j<l in shorter seq */
-  int length;       /**<  \brief  length of longer sequence */
-} interact;
-
-/**
- *  \brief  Collection of all free_energy of beeing unpaired values for output
- */
-typedef struct pu_out {
-  int len;            /**<  \brief  sequence length */
-  int u_vals;         /**<  \brief  number of different -u values */
-  int contribs;       /**<  \brief  [-c "SHIME"] */
-  char **header;      /**<  \brief  header line */
-  double **u_values;  /**<  \brief  (the -u values * [-c "SHIME"]) * seq len */
-} pu_out;
-
-/**
- *  \brief  constraints for cofolding 
- */
-typedef struct constrain{
-  int *indx;
-  char *ptype;
-} constrain;
-
-/*
-* ############################################################
-* RNAduplex data structures
-* ############################################################
-*/
-
-/**
- *  \brief  
- */
-typedef struct {
-  int i;
-  int j;
-  int end;
-  char *structure;
-  double energy;
-  double energy_backtrack;
-  double opening_backtrack_x;
-  double opening_backtrack_y;
-  int offset;
-  double dG1;
-  double dG2;
-  double ddG;
-  int tb;
-  int te;
-  int qb;
-  int qe;
-} duplexT;
-
-/*
-* ############################################################
-* RNAsnoop data structures
-* ############################################################
-*/
-
-/**
- *  \brief  
- */
-typedef struct node {
-  int k;
-  int energy;
-  struct node *next;
-} folden;
-
-/**
- *  \brief  
- */
-typedef struct {
-  int i;
-  int j;
-  int u;
-  char *structure;
-  float energy;
-  float Duplex_El;
-  float Duplex_Er;
-  float Loop_E;
-  float Loop_D;
-  float pscd;
-  float psct;
-  float pscg;
-  float Duplex_Ol;
-  float Duplex_Or;
-  float Duplex_Ot;
-  float fullStemEnergy;
-} snoopT;
-
-
-
-
-
-
-
-/*
-* ############################################################
-* PKplex data structures
-* ############################################################
-*/
-
-/**
- *  \brief  
- */
-typedef struct dupVar{
-  int i;
-  int j;
-  int end;
-  char *pk_helix;
-  char *structure;
-  double energy;
-  int offset;
-  double dG1;
-  double dG2;
-  double ddG;
-  int tb;
-  int te;
-  int qb;
-  int qe;
-  int inactive;
-  int processed;
-} dupVar;
-
-
-
-/*
-* ############################################################
-* 2Dfold data structures
-* ############################################################
-*/
-
-/**
- *  \brief Solution element returned from TwoDfoldList
- *
- *  This element contains free energy and structure for the appropriate
- *  kappa (k), lambda (l) neighborhood
- *  The datastructure contains two integer attributes 'k' and 'l'
- *  as well as an attribute 'en' of type float representing the free energy
- *  in kcal/mol and an attribute 's' of type char* containg the secondary
- *  structure representative,
- *
- *  A value of #INF in k denotes the end of a list
- *
- *  \see  TwoDfoldList()
- */
-typedef struct{
-  int k;          /**<  \brief  Distance to first reference */
-  int l;          /**<  \brief  Distance to second reference */
-  float en;       /**<  \brief  Free energy in kcal/mol */
-  char *s;        /**<  \brief  MFE representative structure in dot-bracket notation */
-} TwoDfold_solution;
-
-/**
- *  \brief Variables compound for 2Dfold MFE folding
- *
- *  \see get_TwoDfold_variables(), destroy_TwoDfold_variables(), TwoDfoldList()
- */
-typedef struct{
-  paramT          *P;             /**<  \brief  Precomputed energy parameters and model details */
-  int             do_backtrack;   /**<  \brief  Flag whether to do backtracing of the structure(s) or not */
-  char            *ptype;         /**<  \brief  Precomputed array of pair types */
-  char            *sequence;      /**<  \brief  The input sequence  */
-  short           *S, *S1;        /**<  \brief  The input sequences in numeric form */
-  unsigned int    maxD1;          /**<  \brief  Maximum allowed base pair distance to first reference */
-  unsigned int    maxD2;          /**<  \brief  Maximum allowed base pair distance to second reference */
-
-
-  unsigned int    *mm1;           /**<  \brief  Maximum matching matrix, reference struct 1 disallowed */
-  unsigned int    *mm2;           /**<  \brief  Maximum matching matrix, reference struct 2 disallowed */
-
-  int             *my_iindx;      /**<  \brief  Index for moving in quadratic distancy dimensions */
-
-  double          temperature;
-
-  unsigned int    *referenceBPs1; /**<  \brief  Matrix containing number of basepairs of reference structure1 in interval [i,j] */
-  unsigned int    *referenceBPs2; /**<  \brief  Matrix containing number of basepairs of reference structure2 in interval [i,j] */
-  unsigned int    *bpdist;        /**<  \brief  Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j] */
-
-  short           *reference_pt1;
-  short           *reference_pt2;
-  int             circ;
-  int             dangles;
-  unsigned int    seq_length;
-
-  int             ***E_F5;
-  int             ***E_F3;
-  int             ***E_C;
-  int             ***E_M;
-  int             ***E_M1;
-  int             ***E_M2;
-
-  int             **E_Fc;
-  int             **E_FcH;
-  int             **E_FcI;
-  int             **E_FcM;
-
-  int             **l_min_values;
-  int             **l_max_values;
-  int             *k_min_values;
-  int             *k_max_values;
-
-  int             **l_min_values_m;
-  int             **l_max_values_m;
-  int             *k_min_values_m;
-  int             *k_max_values_m;
-
-  int             **l_min_values_m1;
-  int             **l_max_values_m1;
-  int             *k_min_values_m1;
-  int             *k_max_values_m1;
-
-  int             **l_min_values_f;
-  int             **l_max_values_f;
-  int             *k_min_values_f;
-  int             *k_max_values_f;
-
-  int             **l_min_values_f3;
-  int             **l_max_values_f3;
-  int             *k_min_values_f3;
-  int             *k_max_values_f3;
-
-  int             **l_min_values_m2;
-  int             **l_max_values_m2;
-  int             *k_min_values_m2;
-  int             *k_max_values_m2;
-
-  int             *l_min_values_fc;
-  int             *l_max_values_fc;
-  int             k_min_values_fc;
-  int             k_max_values_fc;
-
-  int             *l_min_values_fcH;
-  int             *l_max_values_fcH;
-  int             k_min_values_fcH;
-  int             k_max_values_fcH;
-
-  int             *l_min_values_fcI;
-  int             *l_max_values_fcI;
-  int             k_min_values_fcI;
-  int             k_max_values_fcI;
-
-  int             *l_min_values_fcM;
-  int             *l_max_values_fcM;
-  int             k_min_values_fcM;
-  int             k_max_values_fcM;
-
-  /* auxilary arrays for remaining set of coarse graining (k,l) > (k_max, l_max) */
-  int             *E_F5_rem;
-  int             *E_F3_rem;
-  int             *E_C_rem;
-  int             *E_M_rem;
-  int             *E_M1_rem;
-  int             *E_M2_rem;
-
-  int             E_Fc_rem;
-  int             E_FcH_rem;
-  int             E_FcI_rem;
-  int             E_FcM_rem;
-
-#ifdef COUNT_STATES
-  unsigned long             ***N_F5;
-  unsigned long             ***N_C;
-  unsigned long             ***N_M;
-  unsigned long             ***N_M1;
-#endif
-} TwoDfold_vars;
-
-/**
- *  \brief Solution element returned from TwoDpfoldList
- *
- *  This element contains the partition function for the appropriate
- *  kappa (k), lambda (l) neighborhood
- *  The datastructure contains two integer attributes 'k' and 'l'
- *  as well as an attribute 'q' of type #FLT_OR_DBL
- *
- *  A value of #INF in k denotes the end of a list
- *
- *  \see  TwoDpfoldList()
- */
-typedef struct{
-  int k;          /**<  \brief  Distance to first reference */
-  int l;          /**<  \brief  Distance to second reference */
-  FLT_OR_DBL  q;  /**<  \brief  partition function */
-} TwoDpfold_solution;
-
-/**
- *  \brief  Variables compound for 2Dfold partition function folding
- *
- *  \see    get_TwoDpfold_variables(), get_TwoDpfold_variables_from_MFE(),
- *          destroy_TwoDpfold_variables(), TwoDpfoldList()
- */
-typedef struct{
-
-  unsigned int    alloc;
-  char            *ptype;         /**<  \brief  Precomputed array of pair types */
-  char            *sequence;      /**<  \brief  The input sequence  */
-  short           *S, *S1;        /**<  \brief  The input sequences in numeric form */
-  unsigned int    maxD1;          /**<  \brief  Maximum allowed base pair distance to first reference */
-  unsigned int    maxD2;          /**<  \brief  Maximum allowed base pair distance to second reference */
-
-  double          temperature;    /* temperature in last call to scale_pf_params */
-  double          init_temp;      /* temperature in last call to scale_pf_params */
-  FLT_OR_DBL      *scale;
-  FLT_OR_DBL      pf_scale;
-  pf_paramT       *pf_params;     /* holds all [unscaled] pf parameters */
-
-  int             *my_iindx;      /**<  \brief  Index for moving in quadratic distancy dimensions */
-  int             *jindx;         /**<  \brief  Index for moving in the triangular matrix qm1 */
-
-  short           *reference_pt1;
-  short           *reference_pt2;
-
-  unsigned int    *referenceBPs1; /**<  \brief  Matrix containing number of basepairs of reference structure1 in interval [i,j] */
-  unsigned int    *referenceBPs2; /**<  \brief  Matrix containing number of basepairs of reference structure2 in interval [i,j] */
-  unsigned int    *bpdist;        /**<  \brief  Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j] */
-
-  unsigned int    *mm1;           /**<  \brief  Maximum matching matrix, reference struct 1 disallowed */
-  unsigned int    *mm2;           /**<  \brief  Maximum matching matrix, reference struct 2 disallowed */
-
-  int             circ;
-  int             dangles;
-  unsigned int    seq_length;
-
-  FLT_OR_DBL      ***Q;
-  FLT_OR_DBL      ***Q_B;
-  FLT_OR_DBL      ***Q_M;
-  FLT_OR_DBL      ***Q_M1;
-  FLT_OR_DBL      ***Q_M2;
-
-  FLT_OR_DBL      **Q_c;
-  FLT_OR_DBL      **Q_cH;
-  FLT_OR_DBL      **Q_cI;
-  FLT_OR_DBL      **Q_cM;
-
-  int             **l_min_values;
-  int             **l_max_values;
-  int             *k_min_values;
-  int             *k_max_values;
-
-  int             **l_min_values_b;
-  int             **l_max_values_b;
-  int             *k_min_values_b;
-  int             *k_max_values_b;
-
-  int             **l_min_values_m;
-  int             **l_max_values_m;
-  int             *k_min_values_m;
-  int             *k_max_values_m;
-
-  int             **l_min_values_m1;
-  int             **l_max_values_m1;
-  int             *k_min_values_m1;
-  int             *k_max_values_m1;
-
-  int             **l_min_values_m2;
-  int             **l_max_values_m2;
-  int             *k_min_values_m2;
-  int             *k_max_values_m2;
-
-  int             *l_min_values_qc;
-  int             *l_max_values_qc;
-  int             k_min_values_qc;
-  int             k_max_values_qc;
-
-  int             *l_min_values_qcH;
-  int             *l_max_values_qcH;
-  int             k_min_values_qcH;
-  int             k_max_values_qcH;
-
-  int             *l_min_values_qcI;
-  int             *l_max_values_qcI;
-  int             k_min_values_qcI;
-  int             k_max_values_qcI;
-
-  int             *l_min_values_qcM;
-  int             *l_max_values_qcM;
-  int             k_min_values_qcM;
-  int             k_max_values_qcM;
-
-  /* auxilary arrays for remaining set of coarse graining (k,l) > (k_max, l_max) */
-  FLT_OR_DBL      *Q_rem;
-  FLT_OR_DBL      *Q_B_rem;
-  FLT_OR_DBL      *Q_M_rem;
-  FLT_OR_DBL      *Q_M1_rem;
-  FLT_OR_DBL      *Q_M2_rem;
-
-  FLT_OR_DBL      Q_c_rem;
-  FLT_OR_DBL      Q_cH_rem;
-  FLT_OR_DBL      Q_cI_rem;
-  FLT_OR_DBL      Q_cM_rem;
-
-} TwoDpfold_vars;
-
-#endif
diff --git a/include/energy_const.h b/include/energy_const.h
deleted file mode 100644
--- a/include/energy_const.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_ENERGY_CONST_H__
-#define __VIENNA_RNA_PACKAGE_ENERGY_CONST_H__
-
-#include <limits.h>
-
-/**
- *  \file energy_const.h
- *  energy constants
- */
-
-/** The gas constant */
-#define GASCONST 1.98717  /* in [cal/K] */
-/** 0 deg Celsius in Kelvin */
-#define K0  273.15
-/** Infinity as used in minimization routines */
-#define INF 10000000 /* (INT_MAX/10) */
-
-#define EMAX (INF/10)
-/** forbidden */
-#define FORBIDDEN 9999
-/** bonus contribution */
-#define BONUS 10000
-/** The number of distinguishable base pairs */
-#define NBPAIRS 7
-/** The minimum loop length */
-#define TURN 3
-/** The maximum loop length */
-#define MAXLOOP 30
-
-#define   VRNA_GQUAD_MISMATCH_PENALTY   300   /* penalty for incompatible nucleotides in an alignment that destruct a gquad layer */
-#define   VRNA_GQUAD_MISMATCH_NUM_ALI   1   /* maximum number of mismatching sequences in the alignment when gquad should be formed */
-
-#endif
diff --git a/include/energy_par.h b/include/energy_par.h
deleted file mode 100644
--- a/include/energy_par.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-   prototypes for energy_par.c
-*/
-
-#ifndef __VIENNA_RNA_PACKAGE_ENERGY_PAR_H__
-#define __VIENNA_RNA_PACKAGE_ENERGY_PAR_H__
-
-#include "energy_const.h"
-
-#define PUBLIC
-
-
-extern double lxc37;   /* parameter for logarithmic loop
-			  energy extrapolation            */
-
-extern int stack37[NBPAIRS+1][NBPAIRS+1];
-extern int stackdH[NBPAIRS+1][NBPAIRS+1]; /* stack enthalpies */
-extern int entropies[NBPAIRS+1][NBPAIRS+1];  /* not used anymore */
-
-extern int hairpin37[31];
-extern int hairpindH[31];
-extern int bulge37[31];
-extern int bulgedH[31];
-extern int internal_loop37[31];
-extern int internal_loopdH[31];
-extern int internal2_energy;
-extern int old_mismatch_37[NBPAIRS+1][5][5];
-extern int mismatchI37[NBPAIRS+1][5][5];  /* interior loop mismatches */
-extern int mismatchIdH[NBPAIRS+1][5][5];  /* interior loop mismatches */
-extern int mismatch1nI37[NBPAIRS+1][5][5];  /* interior loop mismatches */
-extern int mismatch23I37[NBPAIRS+1][5][5];  /* interior loop mismatches */
-extern int mismatch1nIdH[NBPAIRS+1][5][5];  /* interior loop mismatches */
-extern int mismatch23IdH[NBPAIRS+1][5][5];  /* interior loop mismatches */
-extern int mismatchH37[NBPAIRS+1][5][5];  /* same for hairpins */
-extern int mismatchM37[NBPAIRS+1][5][5];  /* same for multiloops */
-extern int mismatchHdH[NBPAIRS+1][5][5];  /* same for hairpins */
-extern int mismatchMdH[NBPAIRS+1][5][5];  /* same for multiloops */
-extern int mismatchExt37[NBPAIRS+1][5][5];
-extern int mismatchExtdH[NBPAIRS+1][5][5];
-
-extern int dangle5_37[NBPAIRS+1][5];      /* 5' dangle exterior of pair */
-extern int dangle3_37[NBPAIRS+1][5];      /* 3' dangle */
-extern int dangle3_dH[NBPAIRS+1][5];       /* corresponding enthalpies */
-extern int dangle5_dH[NBPAIRS+1][5];
-
-extern int int11_37[NBPAIRS+1][NBPAIRS+1][5][5]; /* 1x1 interior loops */
-extern int int11_dH[NBPAIRS+1][NBPAIRS+1][5][5];
-
-extern int int21_37[NBPAIRS+1][NBPAIRS+1][5][5][5]; /* 2x1 interior loops */
-extern int int21_dH[NBPAIRS+1][NBPAIRS+1][5][5][5];
-
-extern int int22_37[NBPAIRS+1][NBPAIRS+1][5][5][5][5]; /* 2x2 interior loops */
-extern int int22_dH[NBPAIRS+1][NBPAIRS+1][5][5][5][5];
-
-/* constants for linearly destabilizing contributions for multi-loops
-   F = ML_closing + ML_intern*(k-1) + ML_BASE*u  */
-extern int ML_BASE37;
-extern int ML_BASEdH;
-extern int ML_closing37;
-extern int ML_closingdH;
-extern int ML_intern37;
-extern int ML_interndH;
-
-extern int TripleC37;
-extern int TripleCdH;
-extern int MultipleCA37;
-extern int MultipleCAdH;
-extern int MultipleCB37;
-extern int MultipleCBdH;
-
-/* Ninio-correction for asymmetric internal loops with branches n1 and n2 */
-/*    ninio_energy = min{max_ninio, |n1-n2|*F_ninio[min{4.0, n1, n2}] } */
-extern int  MAX_NINIO;                   /* maximum correction */
-extern int ninio37;
-extern int niniodH;
-/* penalty for helices terminated by AU (actually not GC) */
-extern int TerminalAU37;
-extern int TerminalAUdH;
-/* penalty for forming bi-molecular duplex */
-extern int DuplexInit37;
-extern int DuplexInitdH;
-/* stabilizing contribution due to special hairpins of size 4 (tetraloops) */
-extern char Tetraloops[];  /* string containing the special tetraloops */
-extern int  Tetraloop37[];  /* Bonus energy for special tetraloops */
-extern int  TetraloopdH[];
-extern char Triloops[];    /* string containing the special triloops */
-extern int  Triloop37[]; /* Bonus energy for special Triloops */
-extern int  TriloopdH[]; /* Bonus energy for special Triloops */
-extern char Hexaloops[];    /* string containing the special triloops */
-extern int  Hexaloop37[]; /* Bonus energy for special Triloops */
-extern int  HexaloopdH[]; /* Bonus energy for special Triloops */
-
-extern int GQuadAlpha37;
-extern int GQuadAlphadH;
-extern int GQuadBeta37;
-extern int GQuadBetadH;
-
-extern double Tmeasure;       /* temperature of param measurements */
-
-#endif
diff --git a/include/fold.h b/include/fold.h
deleted file mode 100644
--- a/include/fold.h
+++ /dev/null
@@ -1,604 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_FOLD_H__
-#define __VIENNA_RNA_PACKAGE_FOLD_H__
-
-#include "data_structures.h"
-
-#ifdef __GNUC__
-#define DEPRECATED(func) func __attribute__ ((deprecated))
-#else
-#define DEPRECATED(func) func
-#endif
-
-/**
- *  \addtogroup mfe_fold
- *  \ingroup folding_routines
- *  \brief This section covers all functions and variables related to the calculation
- *  of minimum free energy (MFE) structures.
- *
- *  The library provides a fast dynamic programming minimum free energy
- *  folding algorithm as described in \cite zuker:1981.
- *  All relevant parts that directly implement the "Zuker & Stiegler" algorithm for single
- *  sequences are described in this section.
- *
- *  Folding of circular RNA sequences is handled as a post-processing step of the forward
- *  recursions. See \cite hofacker:2006 for further details.
- *
- *  Nevertheless, the RNAlib also
- *  provides interfaces for the prediction of consensus MFE structures of sequence alignments,
- *  MFE structure for two hybridized sequences, local optimal structures and many more. For
- *  those more specialized variants of MFE folding routines, please consult the appropriate
- *  subsections (Modules) as listed above.
- *  
- *  \file fold.h
- *  \brief MFE calculations and energy evaluations for single RNA sequences
- * 
- *  This file includes (almost) all function declarations within the RNAlib that are related to
- *  MFE folding...
- */
-
-/**
- *  \defgroup eval Energy evaluation
- *  @{
- *    \brief This module contains all functions and variables related to energy evaluation
- *    of sequence/structure pairs.
- *
- *
- *  @}
- */
-
-/**
- *  \defgroup mfe_fold Calculating Minimum Free Energy Structures
- *  @{
- *    \brief This module contains all functions and variables related to the calculation
- *    of global minimum free energy structures for single sequences.
- *
- *    The library provides a fast dynamic programming minimum free energy
- *    folding algorithm as described by \ref zuker_81 "Zuker & Stiegler (1981)".
- *  @}
- */
-
-/** \brief if nonzero use logarithmic ML energy in energy_of_struct  */
-extern  int logML;
-
-/** \brief do ML decomposition uniquely (for subopt)  */
-extern  int uniq_ML;
-
-/** \brief set to first pos of second seq for cofolding  */
-extern  int cut_point;
-
-/**
- *  \brief verbose info from energy_of_struct
- *  \ingroup eval
- */
-extern  int eos_debug;
-
-
-/**
- *  \brief Compute minimum free energy and an appropriate secondary
- *  structure of an RNA sequence
- * 
- *  The first parameter given, the RNA sequence, must be \a uppercase and should only contain
- *  an alphabet \f$\Sigma\f$ that is understood by the RNAlib\n
- *  (e.g. \f$ \Sigma = \{A,U,C,G\} \f$)\n
- *
- *  The second parameter, \a structure, must always point to an allocated
- *  block of memory with a size of at least \f$\mathrm{strlen}(\mathrm{sequence})+1\f$
- *
- *  If the third parameter is NULL, global model detail settings are assumed for the folding
- *  recursions. Otherwise, the provided parameters are used.
- *
- *  The fourth parameter indicates whether a secondary structure constraint in enhanced dot-bracket
- *  notation is passed through the structure parameter or not. If so, the characters " | x < > " are
- *  recognized to mark bases that are paired, unpaired, paired upstream, or downstream, respectively.
- *  Matching brackets " ( ) " denote base pairs, dots "." are used for unconstrained bases.
- *
- *  To indicate that the RNA sequence is circular and thus has to be post-processed, set the last
- *  parameter to non-zero
- *
- *  After a successful call of fold_par(), a backtracked secondary structure (in dot-bracket notation)
- *  that exhibits the minimum of free energy will be written to the memory \a structure is pointing to.
- *  The function returns the minimum of free energy for any fold of the sequence given.
- *
- *  \note OpenMP: Passing NULL to the 'parameters' argument involves access to several global model
- *        detail variables and thus is not to be considered threadsafe
- *
- *  \ingroup mfe_fold
- *
- *  \see fold(), circfold(), #model_detailsT, set_energy_model(), get_scaled_parameters()
- *
- *  \param sequence       RNA sequence
- *  \param structure      A pointer to the character array where the
- *                        secondary structure in dot-bracket notation will be written to
- *  \param parameters     A data structure containing the prescaled energy contributions
- *                        and the model details. (NULL may be passed, see OpenMP notes above)
- *  \param is_constrained Switch to indicate that a structure contraint is passed via the structure argument (0==off)
- *  \param is_circular    Switch to (de-)activate postprocessing steps in case RNA sequence is circular (0==off)
- *
- *  \return the minimum free energy (MFE) in kcal/mol
- */
-float fold_par( const char *sequence,
-                char *structure,
-                paramT *parameters,
-                int is_constrained,
-                int is_circular);
-
-/**
- *  \brief Compute minimum free energy and an appropriate secondary structure of an RNA sequence
- *
- *  This function essentially does the same thing as fold_par(). However, it takes its model details,
- *  i.e. #temperature, #dangles, #tetra_loop, #noGU, #no_closingGU, #fold_constrained, #noLonelyPairs
- *  from the current global settings within the library
- *
- *  Use fold_par() for a completely threadsafe variant
- *
- *  \ingroup mfe_fold
- *
- *  \see fold_par(), circfold()
- *
- *  \param sequence RNA sequence
- *  \param structure A pointer to the character array where the
- *         secondary structure in dot-bracket notation will be written to
- *  \return the minimum free energy (MFE) in kcal/mol
- */
-float fold( const char *sequence,
-            char *structure);
-
-/**
- *  \brief Compute minimum free energy and an appropriate secondary structure of a circular RNA sequence
- *
- *  This function essentially does the same thing as fold_par(). However, it takes its model details,
- *  i.e. #temperature, #dangles, #tetra_loop, #noGU, #no_closingGU, #fold_constrained, #noLonelyPairs
- *  from the current global settings within the library
- *
- *  Use fold_par() for a completely threadsafe variant
- *
- *  \ingroup mfe_fold
- *
- *  \see fold_par(), circfold()
- *
- *  \param sequence RNA sequence
- *  \param structure A pointer to the character array where the
- *         secondary structure in dot-bracket notation will be written to
- *  \return the minimum free energy (MFE) in kcal/mol
- */
-float circfold( const char *sequence,
-                char *structure);
-
-
-/**
- *  \addtogroup eval Energy evaluation
- *  \ingroup folding_routines
- *  @{
- *    \brief This module contains all functions and variables related to energy evaluation
- *    of sequence/structure pairs.
- *  @}
- */
-
-/**
- *  \brief Calculate the free energy of an already folded RNA using global model detail settings
- *
- *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
- *
- *  \note OpenMP: This function relies on several global model settings variables and thus is
- *        not to be considered threadsafe. See energy_of_struct_par() for a completely threadsafe
- *        implementation.
- *
- *  \ingroup eval
- *
- *  \see energy_of_struct_par(), energy_of_circ_structure()
- *
- *  \param string     RNA sequence
- *  \param structure  secondary structure in dot-bracket notation
- *  \param verbosity_level a flag to turn verbose output on/off
- *  \return          the free energy of the input structure given the input sequence in kcal/mol
- */
-float energy_of_structure(const char *string,
-                          const char *structure,
-                          int verbosity_level);
-
-/**
- *  \brief Calculate the free energy of an already folded RNA
- *
- *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
- *
- *  \ingroup eval
- *
- *  \see energy_of_circ_structure(), energy_of_structure_pt(), get_scaled_parameters()
- *
- *  \param string           RNA sequence in uppercase letters
- *  \param structure        Secondary structure in dot-bracket notation
- *  \param parameters       A data structure containing the prescaled energy contributions and the model details.
- *  \param verbosity_level  A flag to turn verbose output on/off
- *  \return                The free energy of the input structure given the input sequence in kcal/mol
- */
-float energy_of_struct_par( const char *string,
-                            const char *structure,
-                            paramT *parameters,
-                            int verbosity_level);
-
-/**
- *  \brief Calculate the free energy of an already folded  circular RNA
- *
- *  \note OpenMP: This function relies on several global model settings variables and thus is
- *        not to be considered threadsafe. See energy_of_circ_struct_par() for a completely threadsafe
- *        implementation.
- *
- *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
- *
- *  \ingroup eval
- *
- *  \see energy_of_circ_struct_par(), energy_of_struct_par()
- *
- *  \param string           RNA sequence
- *  \param structure        Secondary structure in dot-bracket notation
- *  \param verbosity_level  A flag to turn verbose output on/off
- *  \return                The free energy of the input structure given the input sequence in kcal/mol
- */
-float energy_of_circ_structure( const char *string,
-                                const char *structure,
-                                int verbosity_level);
-
-/**
- *  \brief Calculate the free energy of an already folded circular RNA
- *
- *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
- *
- *  \ingroup eval
- *
- *  \see energy_of_struct_par(), get_scaled_parameters()
- *
- *  \param string           RNA sequence
- *  \param structure        Secondary structure in dot-bracket notation
- *  \param parameters       A data structure containing the prescaled energy contributions and the model details.
- *  \param verbosity_level  A flag to turn verbose output on/off
- *  \return                The free energy of the input structure given the input sequence in kcal/mol
- */
-float energy_of_circ_struct_par(const char *string,
-                                const char *structure,
-                                paramT *parameters,
-                                int verbosity_level);
-
-
-float energy_of_gquad_structure(const char *string,
-                                const char *structure,
-                                int verbosity_level);
-
-float energy_of_gquad_struct_par( const char *string,
-                                  const char *structure,
-                                  paramT *parameters,
-                                  int verbosity_level);
-
-/**
- *  \brief Calculate the free energy of an already folded RNA
- *
- *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
- *
- *  \note OpenMP: This function relies on several global model settings variables and thus is
- *        not to be considered threadsafe. See energy_of_struct_pt_par() for a completely threadsafe
- *        implementation.
- *
- *  \ingroup eval
- *
- *  \see make_pair_table(), energy_of_struct_pt_par()
- *
- *  \param string     RNA sequence
- *  \param ptable     the pair table of the secondary structure
- *  \param s          encoded RNA sequence
- *  \param s1         encoded RNA sequence
- *  \param verbosity_level a flag to turn verbose output on/off
- *  \return          the free energy of the input structure given the input sequence in 10kcal/mol
- */
-int energy_of_structure_pt( const char *string,
-                            short *ptable,
-                            short *s,
-                            short *s1,
-                            int verbosity_level);
-
-/**
- *  \brief Calculate the free energy of an already folded RNA
- *
- *  If verbosity level is set to a value >0, energies of structure elements are printed to stdout
- *
- *  \ingroup eval
- *
- *  \see make_pair_table(), energy_of_struct_par(), get_scaled_parameters()
- *
- *  \param string           RNA sequence in uppercase letters
- *  \param ptable           The pair table of the secondary structure
- *  \param s                Encoded RNA sequence
- *  \param s1               Encoded RNA sequence
- *  \param parameters       A data structure containing the prescaled energy contributions and the model details.
- *  \param verbosity_level  A flag to turn verbose output on/off
- *  \return                The free energy of the input structure given the input sequence in 10kcal/mol
- */
-int energy_of_struct_pt_par(const char *string,
-                            short *ptable,
-                            short *s,
-                            short *s1,
-                            paramT *parameters,
-                            int verbosity_level);
-
-/**
- *  \brief Free arrays for mfe folding
- *
- *  \ingroup mfe_fold
- *
- */
-void  free_arrays(void);
-
-
-/**
- *  \brief Create a dot-backet/parenthesis structure from backtracking stack
- * 
- *  \note This function is threadsafe
- */
-void  parenthesis_structure(char *structure,
-                            bondT *bp,
-                            int length);
-
-/**
- *  \brief Create a dot-backet/parenthesis structure from backtracking stack
- *  obtained by zuker suboptimal calculation in cofold.c
- * 
- *  \note This function is threadsafe
- */
-void parenthesis_zuker( char *structure,
-                        bondT *bp,
-                        int length);
-
-void letter_structure(char *structure,
-                      bondT *bp,
-                      int length);
-
-
-/**
- *  \brief Recalculate energy parameters
- *
- *  \ingroup mfe_fold
- */
-void  update_fold_params(void);
-
-/**
- *
- *  \ingroup mfe_fold
- * 
- */
-void update_fold_params_par(paramT *parameters);
-
-/**
- *
- *  \ingroup mfe_fold
- * 
- */
-char  *backtrack_fold_from_pair(char *sequence,
-                                int i,
-                                int j);
-
-/** 
- * \brief Calculate energy of a move (closing or opening of a base pair)
- *
- *  If the parameters m1 and m2 are negative, it is deletion (opening)
- *  of a base pair, otherwise it is insertion (opening).
- *
- *  \see              make_pair_table(), energy_of_move()
- *  \param string     RNA sequence
- *  \param structure  secondary structure in dot-bracket notation
- *  \param m1         first coordinate of base pair
- *  \param m2         second coordinate of base pair
- *  \returns          energy change of the move in kcal/mol
- */
-float energy_of_move( const char *string,
-                      const char *structure,
-                      int m1,
-                      int m2);
-
-
-/**
- * 
- * \brief Calculate energy of a move (closing or opening of a base pair)
- *
- *  If the parameters m1 and m2 are negative, it is deletion (opening)
- *  of a base pair, otherwise it is insertion (opening).
- *
- *  \see              make_pair_table(), energy_of_move()
- *  \param pt         the pair table of the secondary structure
- *  \param s          encoded RNA sequence
- *  \param s1         encoded RNA sequence
- *  \param m1         first coordinate of base pair
- *  \param m2         second coordinate of base pair
- *  \returns          energy change of the move in 10cal/mol
- */
-int energy_of_move_pt(short *pt,
-                   short *s,
-                   short *s1,
-                   int m1,
-                   int m2);
-
-/**
- * \brief Calculate energy of a loop
- *
- *  \param ptable     the pair table of the secondary structure
- *  \param s          encoded RNA sequence
- *  \param s1         encoded RNA sequence
- *  \param i          position of covering base pair
- *  \returns          free energy of the loop in 10cal/mol
- */
-int   loop_energy(short *ptable,
-                  short *s,
-                  short *s1,
-                  int i);
-
-/**
- *
- *  \ingroup mfe_fold
- * 
- */
-void export_fold_arrays(int **f5_p,
-                        int **c_p,
-                        int **fML_p,
-                        int **fM1_p,
-                        int **indx_p,
-                        char **ptype_p);
-
-/**
- *
- *  \ingroup mfe_fold
- * 
- */
-void export_fold_arrays_par(int **f5_p,
-                            int **c_p,
-                            int **fML_p,
-                            int **fM1_p,
-                            int **indx_p,
-                            char **ptype_p,
-                            paramT **P_p);
-
-/**
- *
- *  \ingroup mfe_fold
- * 
- */
-void export_circfold_arrays(int *Fc_p,
-                            int *FcH_p,
-                            int *FcI_p,
-                            int *FcM_p,
-                            int **fM2_p,
-                            int **f5_p,
-                            int **c_p,
-                            int **fML_p,
-                            int **fM1_p,
-                            int **indx_p,
-                            char **ptype_p);
-
-/**
- *
- *  \ingroup mfe_fold
- * 
- */
-void export_circfold_arrays_par(int *Fc_p,
-                                int *FcH_p,
-                                int *FcI_p,
-                                int *FcM_p,
-                                int **fM2_p,
-                                int **f5_p,
-                                int **c_p,
-                                int **fML_p,
-                                int **fM1_p,
-                                int **indx_p,
-                                char **ptype_p,
-                                paramT **P_p);
-
-
-/**
- *  \brief Create a plist from a dot-bracket string
- * 
- *  The dot-bracket string is parsed and for each base pair an
- *  entry in the plist is created. The probability of each pair in
- *  the list is set by a function parameter.
- * 
- *  The end of the plist is marked by sequence positions i as well as j
- *  equal to 0. This condition should be used to stop looping over its
- *  entries
- * 
- *  This function is threadsafe
- * 
- *  \param pl     A pointer to the plist that is to be created
- *  \param struc  The secondary structure in dot-bracket notation
- *  \param pr     The probability for each base pair
- */
-void assign_plist_from_db(plist **pl,
-                          const char *struc,
-                          float pr);
-
-/* finally moved the loop energy function declarations to this header...  */
-/* BUT: The functions only exist for backward compatibility reasons!      */
-/* You better include "loop_energies.h" and call the functions:           */
-/* E_Hairpin() and E_IntLoop() which are (almost) threadsafe as they get  */
-/* a pointer to the energy parameter datastructure as additional argument */
-
-/**
- *  \deprecated {This function is deprecated and will be removed soon.
- *  Use \ref E_IntLoop() instead!}
- */
-DEPRECATED(int LoopEnergy(int n1,
-                          int n2,
-                          int type,
-                          int type_2,
-                          int si1,
-                          int sj1,
-                          int sp1,
-                          int sq1));
-
-/**
- *  \deprecated {This function is deprecated and will be removed soon.
- *  Use \ref E_Hairpin() instead!}
- */
-DEPRECATED(int HairpinE(int size,
-                        int type,
-                        int si1,
-                        int sj1,
-                        const char *string));
-
-/**
- *  Allocate arrays for folding\n
- *  \deprecated {This function is deprecated and will be removed soon!}
- * 
- */
-DEPRECATED(void initialize_fold(int length));
-
-/**
- *  Calculate the free energy of an already folded RNA
- * 
- *  \note This function is not entirely threadsafe! Depending on the state of the global
- *  variable \ref eos_debug it prints energy information to stdout or not...\n
- * 
- *  \deprecated This function is deprecated and should not be used in future programs!
- *  Use \ref energy_of_structure() instead!
- * 
- *  \see              energy_of_structure, energy_of_circ_struct(), energy_of_struct_pt()
- *  \param string     RNA sequence
- *  \param structure  secondary structure in dot-bracket notation
- *  \return          the free energy of the input structure given the input sequence in kcal/mol
- */
-DEPRECATED(float energy_of_struct(const char *string,
-                                  const char *structure));
-
-/**
- *  Calculate the free energy of an already folded RNA
- * 
- *  \note This function is not entirely threadsafe! Depending on the state of the global
- *  variable \ref eos_debug it prints energy information to stdout or not...\n
- * 
- *  \deprecated This function is deprecated and should not be used in future programs!
- *  Use \ref energy_of_structure_pt() instead!
- * 
- *  \see              make_pair_table(), energy_of_structure()
- *  \param string     RNA sequence
- *  \param ptable     the pair table of the secondary structure
- *  \param s          encoded RNA sequence
- *  \param s1         encoded RNA sequence
- *  \return          the free energy of the input structure given the input sequence in 10kcal/mol
- */
-DEPRECATED(int energy_of_struct_pt( const char *string,
-                                    short *ptable,
-                                    short *s,
-                                    short *s1));
-
-/**
- *  Calculate the free energy of an already folded  circular RNA
- * 
- *  \note This function is not entirely threadsafe! Depending on the state of the global
- *  variable \ref eos_debug it prints energy information to stdout or not...\n
- * 
- *  \deprecated This function is deprecated and should not be used in future programs
- *  Use \ref energy_of_circ_structure() instead!
- * 
- *  \see              energy_of_circ_structure(), energy_of_struct(), energy_of_struct_pt()
- *  \param string     RNA sequence
- *  \param structure  secondary structure in dot-bracket notation
- *  \return          the free energy of the input structure given the input sequence in kcal/mol
- */
-DEPRECATED(float energy_of_circ_struct( const char *string,
-                                        const char *structure));
-
-#endif
diff --git a/include/fold_vars.h b/include/fold_vars.h
deleted file mode 100644
--- a/include/fold_vars.h
+++ /dev/null
@@ -1,217 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_FOLD_VARS_H__
-#define __VIENNA_RNA_PACKAGE_FOLD_VARS_H__
-
-#include "data_structures.h"
-
-/**
- *  \file fold_vars.h
- *  \brief Here all all declarations of the global variables used throughout RNAlib
- */
-
-
-#define PUBLIC
-#define PRIVATE static
-
-/**
- *  \brief Global switch to activate/deactivate folding with structure constraints
- */
-extern int    fold_constrained;
-
-/**
- *  \brief Global switch to avoid/allow helices of length 1
- * 
- *  Disallow all pairs which can only occur as lonely pairs (i.e. as helix
- *  of length 1). This avoids lonely base pairs in the predicted structures in
- *  most cases.
- */
-extern int    noLonelyPairs;
-
-/**
- *  \brief Switch the energy model for dangling end contributions (0, 1, 2, 3)
- * 
- *  If set to 0 no stabilizing energies are assigned to bases adjacent to
- *  helices in free ends and multiloops (so called dangling ends). Normally
- *  (dangles = 1) dangling end energies are assigned only to unpaired
- *  bases and a base cannot participate simultaneously in two dangling ends. In
- *  the partition function algorithm pf_fold() these checks are neglected.
- *  If #dangles is set to 2, all folding routines will follow this convention.
- *  This treatment of dangling ends gives more favorable energies to helices
- *  directly adjacent to one another, which can be beneficial since such
- *  helices often do engage in stabilizing interactions through co-axial
- *  stacking.\n
- *  If dangles = 3 co-axial stacking is explicitly included for
- *  adjacent helices in mutli-loops. The option affects only mfe folding
- *  and energy evaluation (fold() and energy_of_structure()), as
- *  well as suboptimal folding (subopt()) via re-evaluation of energies.
- *  Co-axial stacking with one intervening mismatch is not considered so far.
- * 
- *  Default is 2 in most algorithms, partition function algorithms can only handle 0 and 2
- */
-extern int  dangles;
-
-/**
- *  \brief Global switch to forbid/allow GU base pairs at all
- */
-extern int  noGU;
-
-/**
- *  \brief GU allowed only inside stacks if set to 1
- */
-extern int  no_closingGU;
-
-/**
- *  \brief Include special stabilizing energies for some tri-, tetra- and hexa-loops;
- * 
- *  default is 1.
- */
-extern int  tetra_loop;
-
-/**
- *  \brief 0 = BP; 1=any mit GC; 2=any mit AU-parameter
- * 
- *  If set to 1 or 2: fold sequences from an artificial alphabet ABCD..., where A
- *  pairs B, C pairs D, etc. using either GC (1) or AU parameters (2);
- *  default is 0, you probably don't want to change it.
- */
-extern int  energy_set;
-
-/**
- *  \brief backward compatibility variable.. this does not effect anything
- */
-extern int  circ;
-
-/**
- *  \brief generate comma seperated output
- */
-extern int  csv;
-
-/**
- *  use old alifold energies (with gaps)
- */
-extern int oldAliEn;
-/**
- *  use ribosum matrices
- */
-extern int ribo;            
-
-/**
- *  warning this variable will vanish in the future
- *  ribosums will be compiled in instead
- */
-extern char *RibosumFile;   
-
-/**
- *  \brief contains allowed non standard base pairs
- * 
- *  Lists additional base pairs that will be allowed to form in addition to
- *  GC, CG, AU, UA, GU and UG. Nonstandard base pairs are given a stacking
- *  energy of 0.
- */
-extern char *nonstandards;
-
-/**
- *  \brief Rescale energy parameters to a temperature in degC.
- * 
- *  Default is 37C. You have to call the update_..._params() functions after
- *  changing this parameter.
- */
-extern double temperature;
-
-/**
- *  interior loops of size 2 get energy 0.8Kcal and
- *  no mismatches, default 1
- */
-extern int  james_rule;
-
-/**
- *  use logarithmic multiloop energy function
- */
-extern int  logML;
-
-/**
- *  \brief Marks the position (starting from 1) of the first
- *  nucleotide of the second molecule within the concatenated sequence.
- * 
- *  To evaluate the energy of a duplex structure (a structure formed by two
- *  strands), concatenate the to sequences and set it to the
- *  first base of the second strand in the concatenated sequence.
- *  The default value of -1 stands for single molecule folding. The
- *  cut_point variable is also used by PS_rna_plot() and
- *  PS_dot_plot() to mark the chain break in postscript plots.
- */
-extern int  cut_point;
-
-/**
- *  \brief Contains a list of base pairs after a call to fold().
- * 
- *  base_pair[0].i contains the total number of pairs.
- *  \deprecated Do not use this variable anymore!
- */
-extern bondT  *base_pair;
-
-/**
- *  \brief A pointer to the base pair probability matrix
- * 
- *  \deprecated Do not use this variable anymore!
- */
-extern FLT_OR_DBL *pr;
-
-/**
- *  \brief index array to move through pr.
- * 
- *  The probability for base i and j to form a pair is in pr[iindx[i]-j].
- *  \deprecated Do not use this variable anymore!
- */
-extern int   *iindx;
-
-/**
- *  \brief A scaling factor used by pf_fold() to avoid overflows.
- * 
- *  Should be set to approximately \f$exp{((-F/kT)/length)}\f$, where \f$F\f$ is an estimate
- *  for the ensemble free energy, for example the minimum free energy. You must
- *  call update_pf_params() after changing this parameter.\n
- *  If pf_scale is -1 (the default) , an estimate will be provided
- *  automatically when computing partition functions, e.g. pf_fold()
- *  The automatic estimate is usually insufficient for sequences more
- *  than a few hundred bases long.
- */
-extern double pf_scale;
-
-/**
- *  \brief do backtracking, i.e. compute secondary structures or base pair probabilities
- * 
- *  If 0, do not calculate pair probabilities in pf_fold(); this is about
- *  twice as fast. Default is 1.
- */
-extern int    do_backtrack;
-
-/**
- *  \brief A backtrack array marker for inverse_fold()
- * 
- *  If set to 'C': force (1,N) to be paired,
- *  'M' fold as if the sequence were inside a multi-loop. Otherwise ('F') the
- *  usual mfe structure is computed.
- */
-extern char backtrack_type;
-
-/**
- *  \brief Allow G-quadruplex formation
- */
-extern int gquad;
-
-
-char * option_string(void);
-
-/**
- * \brief Set default model details
- *
- *  Use this function if you wish to initialize a #model_detailsT data structure with
- *  its default values, i.e. the global model settings
- *
- *  \see
- *
- *  \param md A pointer to the data structure that shall be initialized
- */
-void set_model_details(model_detailsT *md);
-
-#endif
diff --git a/include/gquad.h b/include/gquad.h
deleted file mode 100644
--- a/include/gquad.h
+++ /dev/null
@@ -1,725 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_GQUAD_H__
-#define __VIENNA_RNA_PACKAGE_GQUAD_H__
-
-#include "data_structures.h"
-
-#ifndef INLINE
-#ifdef __GNUC__
-# define INLINE inline
-#else
-# define INLINE
-#endif
-#endif
-
-/**
- *  \file gquad.h
- *  \brief Various functions related to G-quadruplex computations
- */
-
-
-int         E_gquad(int L,
-                    int l[3],
-                    paramT *P);
-
-FLT_OR_DBL exp_E_gquad( int L,
-                        int l[3],
-                        pf_paramT *pf);
-
-int         E_gquad_ali(int i,
-                        int L,
-                        int l[3],
-                        const short **S,
-                        int n_seq,
-                        paramT *P);
-
-
-void        E_gquad_ali_en( int i,
-                            int L,
-                            int l[3],
-                            const short **S,
-                            int n_seq,
-                            int en[2],
-                            paramT *P);
-
-/**
- *  \brief Get a triangular matrix prefilled with minimum free energy
- *  contributions of G-quadruplexes.
- *
- *  At each position ij in the matrix, the minimum free energy of any
- *  G-quadruplex delimited by i and j is stored. If no G-quadruplex formation
- *  is possible, the matrix element is set to INF.
- *  Access the elements in the matrix via matrix[indx[j]+i]. To get
- *  the integer array indx see get_jindx().
- *
- *  \see get_jindx(), encode_sequence()
- *
- *  \param S  The encoded sequence
- *  \param P  A pointer to the data structure containing the precomputed energy contributions
- *  \return   A pointer to the G-quadruplex contribution matrix
-*/
-int         *get_gquad_matrix(short *S, paramT *P);
-
-int         *get_gquad_ali_matrix(short *S_cons,
-                                  short **S,
-                                  int n_seq,
-                                  paramT *P);
-
-FLT_OR_DBL  *get_gquad_pf_matrix( short *S,
-                                  FLT_OR_DBL *scale,
-                                  pf_paramT *pf);
-
-int         **get_gquad_L_matrix( short *S,
-                                  int start,
-                                  int maxdist,
-                                  int **g,
-                                  paramT *P);
-
-void        get_gquad_pattern_mfe(short *S,
-                                  int i,
-                                  int j,
-                                  paramT *P,
-                                  int *L,
-                                  int l[3]);
-
-void
-get_gquad_pattern_exhaustive( short *S,
-                              int i,
-                              int j,
-                              paramT *P,
-                              int *L,
-                              int *l,
-                              int threshold);
-
-void        get_gquad_pattern_pf( short *S,
-                                  int i,
-                                  int j,
-                                  pf_paramT *pf,
-                                  int *L,
-                                  int l[3]);
-
-plist       *get_plist_gquad_from_pr( short *S,
-                                      int gi,
-                                      int gj,
-                                      FLT_OR_DBL *G,
-                                      FLT_OR_DBL *probs,
-                                      FLT_OR_DBL *scale,
-                                      pf_paramT *pf);
-plist       *get_plist_gquad_from_pr_max(short *S,
-                                      int gi,
-                                      int gj,
-                                      FLT_OR_DBL *G,
-                                      FLT_OR_DBL *probs,
-                                      FLT_OR_DBL *scale,
-                                      int *L,
-                                      int l[3],
-                                      pf_paramT *pf);
-
-plist       *get_plist_gquad_from_db( const char *structure,
-                                      float pr);
-
-int         get_gquad_count(short *S,
-                            int i,
-                            int j);
-
-int         get_gquad_layer_count(short *S,
-                            int i,
-                            int j);
-
-
-/**
- *  given a dot-bracket structure (possibly) containing gquads encoded
- *  by '+' signs, find first gquad, return end position or 0 if none found
- *  Upon return L and l[] contain the number of stacked layers, as well as
- *  the lengths of the linker regions.  
- *  To parse a string with many gquads, call parse_gquad repeatedly e.g.
- *  end1 = parse_gquad(struc, &L, l); ... ;
- *  end2 = parse_gquad(struc+end1, &L, l); end2+=end1; ... ;
- *  end3 = parse_gquad(struc+end2, &L, l); end3+=end2; ... ; 
- */
-int         parse_gquad(const char *struc, int *L, int l[3]);
-
-
-
-/**
- *  backtrack an interior loop like enclosed g-quadruplex
- *  with closing pair (i,j)
- *
- *  \param c      The total contribution the loop should resemble
- *  \param i      position i of enclosing pair
- *  \param j      position j of enclosing pair
- *  \param type   base pair type of enclosing pair (must be reverse type)
- *  \param S      integer encoded sequence
- *  \param ggg    triangular matrix containing g-quadruplex contributions
- *  \param index  the index for accessing the triangular matrix
- *  \param p      here the 5' position of the gquad is stored
- *  \param q      here the 3' position of the gquad is stored
- *  \param P      the datastructure containing the precalculated contibutions
- *
- *  \return       1 on success, 0 if no gquad found
- */
-INLINE  PRIVATE int backtrack_GQuad_IntLoop(int c,
-                                            int i,
-                                            int j,
-                                            int type,
-                                            short *S,
-                                            int *ggg,
-                                            int *index,
-                                            int *p,
-                                            int *q,
-                                            paramT *P){
-
-  int energy, dangles, k, l, maxl, minl, c0, l1;
-  short si, sj;
-
-  dangles = P->model_details.dangles;
-  si      = S[i + 1];
-  sj      = S[j - 1];
-  energy  = 0;
-
-  if(dangles == 2)
-    energy += P->mismatchI[type][si][sj];
-
-  if(type > 2)
-    energy += P->TerminalAU;
-
-  k = i + 1;
-  if(S[k] == 3){
-    if(k < j - VRNA_GQUAD_MIN_BOX_SIZE){
-      minl  = j - i + k - MAXLOOP - 2;
-      c0    = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-      minl  = MAX2(c0, minl);
-      c0    = j - 3;
-      maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-      maxl  = MIN2(c0, maxl);
-      for(l = minl; l < maxl; l++){
-        if(S[l] != 3) continue;
-        if(c == energy + ggg[index[l] + k] + P->internal_loop[j - l - 1]){
-          *p = k; *q = l;
-          return 1;
-        }
-      }
-    }
-  }
-
-  for(k = i + 2;
-      k < j - VRNA_GQUAD_MIN_BOX_SIZE;
-      k++){
-    l1    = k - i - 1;
-    if(l1>MAXLOOP) break;
-    if(S[k] != 3) continue;
-    minl  = j - i + k - MAXLOOP - 2;
-    c0    = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-    minl  = MAX2(c0, minl);
-    c0    = j - 1;
-    maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-    maxl  = MIN2(c0, maxl);
-    for(l = minl; l < maxl; l++){
-      if(S[l] != 3) continue;
-      if(c == energy + ggg[index[l] + k] + P->internal_loop[l1 + j - l - 1]){
-        *p = k; *q = l;
-        return 1;
-      }
-    }
-  }
-
-  l = j - 1;
-  if(S[l] == 3)
-    for(k = i + 4;
-        k < j - VRNA_GQUAD_MIN_BOX_SIZE;
-        k++){
-      l1    = k - i - 1;
-      if(l1>MAXLOOP) break;
-      if(S[k] != 3) continue;
-      if(c == energy + ggg[index[l] + k] + P->internal_loop[l1]){
-        *p = k; *q = l;
-        return 1;
-      }
-    }
-
-  return 0;
-}
-
-/**
- *  backtrack an interior loop like enclosed g-quadruplex
- *  with closing pair (i,j) with underlying Lfold matrix
- *
- *  \param c      The total contribution the loop should resemble
- *  \param i      position i of enclosing pair
- *  \param j      position j of enclosing pair
- *  \param type   base pair type of enclosing pair (must be reverse type)
- *  \param S      integer encoded sequence
- *  \param ggg    triangular matrix containing g-quadruplex contributions
- *  \param p      here the 5' position of the gquad is stored
- *  \param q      here the 3' position of the gquad is stored
- *  \param P      the datastructure containing the precalculated contibutions
- *
- *  \return       1 on success, 0 if no gquad found
- */
-INLINE  PRIVATE int backtrack_GQuad_IntLoop_L(int c,
-                                              int i,
-                                              int j,
-                                              int type,
-                                              short *S,
-                                              int **ggg,
-                                              int maxdist,
-                                              int *p,
-                                              int *q,
-                                              paramT *P){
-
-  int energy, dangles, k, l, maxl, minl, c0, l1;
-  short si, sj;
-
-  dangles = P->model_details.dangles;
-  si      = S[i + 1];
-  sj      = S[j - 1];
-  energy  = 0;
-
-  if(dangles == 2)
-    energy += P->mismatchI[type][si][sj];
-
-  if(type > 2)
-    energy += P->TerminalAU;
-
-  k = i + 1;
-  if(S[k] == 3){
-    if(k < j - VRNA_GQUAD_MIN_BOX_SIZE){
-      minl  = j - i + k - MAXLOOP - 2;
-      c0    = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-      minl  = MAX2(c0, minl);
-      c0    = j - 3;
-      maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-      maxl  = MIN2(c0, maxl);
-      for(l = minl; l < maxl; l++){
-        if(S[l] != 3) continue;
-        if(c == energy + ggg[k][l - k] + P->internal_loop[j - l - 1]){
-          *p = k; *q = l;
-          return 1;
-        }
-      }
-    }
-  }
-
-  for(k = i + 2;
-      k < j - VRNA_GQUAD_MIN_BOX_SIZE;
-      k++){
-    l1    = k - i - 1;
-    if(l1>MAXLOOP) break;
-    if(S[k] != 3) continue;
-    minl  = j - i + k - MAXLOOP - 2;
-    c0    = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-    minl  = MAX2(c0, minl);
-    c0    = j - 1;
-    maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-    maxl  = MIN2(c0, maxl);
-    for(l = minl; l < maxl; l++){
-      if(S[l] != 3) continue;
-      if(c == energy + ggg[k][l - k] + P->internal_loop[l1 + j - l - 1]){
-        *p = k; *q = l;
-        return 1;
-      }
-    }
-  }
-
-  l = j - 1;
-  if(S[l] == 3)
-    for(k = i + 4;
-        k < j - VRNA_GQUAD_MIN_BOX_SIZE;
-        k++){
-      l1    = k - i - 1;
-      if(l1>MAXLOOP) break;
-      if(S[k] != 3) continue;
-      if(c == energy + ggg[k][l - k] + P->internal_loop[l1]){
-        *p = k; *q = l;
-        return 1;
-      }
-    }
-
-  return 0;
-}
-
-INLINE PRIVATE
-int
-E_GQuad_IntLoop(int i,
-                int j,
-                int type,
-                short *S,
-                int *ggg,
-                int *index,
-                paramT *P){
-
-  int energy, ge, en1, en2, dangles, p, q, l1, minq, maxq;
-  int c0, c1, c2, c3, up, d53, d5, d3;
-  short si, sj;
-
-  dangles = P->model_details.dangles;
-  si      = S[i + 1];
-  sj      = S[j - 1];
-  energy  = 0;
-
-  if(dangles == 2)
-    energy += P->mismatchI[type][si][sj];
-
-  if(type > 2)
-    energy += P->TerminalAU;
-
-  ge = INF;
-
-  p = i + 1;
-  if(S[p] == 3){
-    if(p < j - VRNA_GQUAD_MIN_BOX_SIZE){
-      minq  = j - i + p - MAXLOOP - 2;
-      c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-      minq  = MAX2(c0, minq);
-      c0    = j - 3;
-      maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-      maxq  = MIN2(c0, maxq);
-      for(q = minq; q < maxq; q++){
-        if(S[q] != 3) continue;
-        c0  = energy + ggg[index[q] + p] + P->internal_loop[j - q - 1];
-        ge  = MIN2(ge, c0);
-      }
-    }
-  }
-
-  for(p = i + 2;
-      p < j - VRNA_GQUAD_MIN_BOX_SIZE;
-      p++){
-    l1    = p - i - 1;
-    if(l1>MAXLOOP) break;
-    if(S[p] != 3) continue;
-    minq  = j - i + p - MAXLOOP - 2;
-    c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-    minq  = MAX2(c0, minq);
-    c0    = j - 1;
-    maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-    maxq  = MIN2(c0, maxq);
-    for(q = minq; q < maxq; q++){
-      if(S[q] != 3) continue;
-      c0  = energy + ggg[index[q] + p] + P->internal_loop[l1 + j - q - 1];
-      ge   = MIN2(ge, c0);
-    }
-  }
-
-  q = j - 1;
-  if(S[q] == 3)
-    for(p = i + 4;
-        p < j - VRNA_GQUAD_MIN_BOX_SIZE;
-        p++){
-      l1    = p - i - 1;
-      if(l1>MAXLOOP) break;
-      if(S[p] != 3) continue;
-      c0  = energy + ggg[index[q] + p] + P->internal_loop[l1];
-      ge  = MIN2(ge, c0);
-    }
-
-#if 0
-  /* here comes the additional stuff for the odd dangle models */
-  if(dangles % 1){
-    en1 = energy + P->dangle5[type][si];
-    en2 = energy + P->dangle5[type][sj];
-    en3 = energy + P->mismatchI[type][si][sj];
-
-    /* first case with 5' dangle (i.e. j-1) onto enclosing pair */
-    p = i + 1;
-    if(S[p] == 3){
-      if(p < j - VRNA_GQUAD_MIN_BOX_SIZE){
-        minq  = j - i + p - MAXLOOP - 2;
-        c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-        minq  = MAX2(c0, minq);
-        c0    = j - 4;
-        maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-        maxq  = MIN2(c0, maxq);
-        for(q = minq; q < maxq; q++){
-          if(S[q] != 3) continue;
-          c0  = en1 + ggg[index[q] + p] + P->internal_loop[j - q - 1];
-          ge  = MIN2(ge, c0);
-        }
-      }
-    }
-
-    for(p = i + 2; p < j - VRNA_GQUAD_MIN_BOX_SIZE; p++){
-      l1    = p - i - 1;
-      if(l1>MAXLOOP) break;
-      if(S[p] != 3) continue;
-      minq  = j - i + p - MAXLOOP - 2;
-      c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-      minq  = MAX2(c0, minq);
-      c0    = j - 2;
-      maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-      maxq  = MIN2(c0, maxq);
-      for(q = minq; q < maxq; q++){
-        if(S[q] != 3) continue;
-        c0  = en1 + ggg[index[q] + p] + P->internal_loop[l1 + j - q - 1];
-        ge   = MIN2(ge, c0);
-      }
-    }
-
-    q = j - 2;
-    if(S[q] == 3)
-      for(p = i + 4; p < j - VRNA_GQUAD_MIN_BOX_SIZE; p++){
-        l1    = p - i - 1;
-        if(l1>MAXLOOP) break;
-        if(S[p] != 3) continue;
-        c0  = en1 + ggg[index[q] + p] + P->internal_loop[l1 + 1];
-        ge  = MIN2(ge, c0);
-      }
-
-    /* second case with 3' dangle (i.e. i+1) onto enclosing pair */
-
-  }
-#endif
-  return ge;
-}
-
-INLINE PRIVATE
-int *
-E_GQuad_IntLoop_exhaustive( int i,
-                            int j,
-                            int **p_p,
-                            int **q_p,
-                            int type,
-                            short *S,
-                            int *ggg,
-                            int threshold,
-                            int *index,
-                            paramT *P){
-
-  int energy, *ge, en1, en2, dangles, p, q, l1, minq, maxq;
-  int c0, c1, c2, c3, up, d53, d5, d3;
-  short si, sj;
-  int cnt = 0;
-
-  dangles = P->model_details.dangles;
-  si      = S[i + 1];
-  sj      = S[j - 1];
-  energy  = 0;
-
-  if(dangles == 2)
-    energy += P->mismatchI[type][si][sj];
-
-  if(type > 2)
-    energy += P->TerminalAU;
-
-  /* guess how many gquads are possible in interval [i+1,j-1] */
-  *p_p  = (int *)space(sizeof(int) * 256);
-  *q_p  = (int *)space(sizeof(int) * 256);
-  ge    = (int *)space(sizeof(int) * 256);
-
-  p = i + 1;
-  if(S[p] == 3){
-    if(p < j - VRNA_GQUAD_MIN_BOX_SIZE){
-      minq  = j - i + p - MAXLOOP - 2;
-      c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-      minq  = MAX2(c0, minq);
-      c0    = j - 3;
-      maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-      maxq  = MIN2(c0, maxq);
-      for(q = minq; q < maxq; q++){
-        if(S[q] != 3) continue;
-        c0  = energy + ggg[index[q] + p] + P->internal_loop[j - q - 1];
-        if(c0 <= threshold){
-          ge[cnt]       = energy + P->internal_loop[j - q - 1];
-          (*p_p)[cnt]   = p;
-          (*q_p)[cnt++] = q;
-        }
-      }
-    }
-  }
-
-  for(p = i + 2;
-      p < j - VRNA_GQUAD_MIN_BOX_SIZE;
-      p++){
-    l1    = p - i - 1;
-    if(l1>MAXLOOP) break;
-    if(S[p] != 3) continue;
-    minq  = j - i + p - MAXLOOP - 2;
-    c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-    minq  = MAX2(c0, minq);
-    c0    = j - 1;
-    maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-    maxq  = MIN2(c0, maxq);
-    for(q = minq; q < maxq; q++){
-      if(S[q] != 3) continue;
-      c0  = energy + ggg[index[q] + p] + P->internal_loop[l1 + j - q - 1];
-        if(c0 <= threshold){
-          ge[cnt]       = energy + P->internal_loop[l1 + j - q - 1];
-          (*p_p)[cnt]   = p;
-          (*q_p)[cnt++] = q;
-        }
-    }
-  }
-
-  q = j - 1;
-  if(S[q] == 3)
-    for(p = i + 4;
-        p < j - VRNA_GQUAD_MIN_BOX_SIZE;
-        p++){
-      l1    = p - i - 1;
-      if(l1>MAXLOOP) break;
-      if(S[p] != 3) continue;
-      c0  = energy + ggg[index[q] + p] + P->internal_loop[l1];
-        if(c0 <= threshold){
-          ge[cnt]       = energy + P->internal_loop[l1];
-          (*p_p)[cnt]   = p;
-          (*q_p)[cnt++] = q;
-        }
-    }
-
-
-  (*p_p)[cnt] = -1;
-
-  return ge;
-}
-
-INLINE PRIVATE
-int
-E_GQuad_IntLoop_L(int i,
-                  int j,
-                  int type,
-                  short *S,
-                  int **ggg,
-                  int maxdist,
-                  paramT *P){
-
-  int energy, ge, en1, en2, dangles, p, q, l1, minq, maxq;
-  int c0, c1, c2, c3, up, d53, d5, d3;
-  short si, sj;
-
-  dangles = P->model_details.dangles;
-  si      = S[i + 1];
-  sj      = S[j - 1];
-  energy  = 0;
-
-  if(dangles == 2)
-    energy += P->mismatchI[type][si][sj];
-
-  if(type > 2)
-    energy += P->TerminalAU;
-
-  ge = INF;
-
-  p = i + 1;
-  if(S[p] == 3){
-    if(p < j - VRNA_GQUAD_MIN_BOX_SIZE){
-      minq  = j - i + p - MAXLOOP - 2;
-      c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-      minq  = MAX2(c0, minq);
-      c0    = j - 3;
-      maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-      maxq  = MIN2(c0, maxq);
-      for(q = minq; q < maxq; q++){
-        if(S[q] != 3) continue;
-        c0  = energy + ggg[p][q-p] + P->internal_loop[j - q - 1];
-        ge  = MIN2(ge, c0);
-      }
-    }
-  }
-
-  for(p = i + 2;
-      p < j - VRNA_GQUAD_MIN_BOX_SIZE;
-      p++){
-    l1    = p - i - 1;
-    if(l1>MAXLOOP) break;
-    if(S[p] != 3) continue;
-    minq  = j - i + p - MAXLOOP - 2;
-    c0    = p + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-    minq  = MAX2(c0, minq);
-    c0    = j - 1;
-    maxq  = p + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-    maxq  = MIN2(c0, maxq);
-    for(q = minq; q < maxq; q++){
-      if(S[q] != 3) continue;
-      c0  = energy + ggg[p][q - p] + P->internal_loop[l1 + j - q - 1];
-      ge   = MIN2(ge, c0);
-    }
-  }
-
-  q = j - 1;
-  if(S[q] == 3)
-    for(p = i + 4;
-        p < j - VRNA_GQUAD_MIN_BOX_SIZE;
-        p++){
-      l1    = p - i - 1;
-      if(l1>MAXLOOP) break;
-      if(S[p] != 3) continue;
-      c0  = energy + ggg[p][q - p] + P->internal_loop[l1];
-      ge  = MIN2(ge, c0);
-    }
-
-  return ge;
-}
-
-INLINE PRIVATE
-FLT_OR_DBL
-exp_E_GQuad_IntLoop(int i,
-                    int j,
-                    int type,
-                    short *S,
-                    FLT_OR_DBL *G,
-                    int *index,
-                    pf_paramT *pf){
-
-  int k, l, minl, maxl, u, r;
-  FLT_OR_DBL q, qe, *expintern;
-  short si, sj;
-
-  q         = 0;
-  si        = S[i + 1];
-  sj        = S[j - 1];
-  qe        = pf->expmismatchI[type][si][sj];
-  expintern = pf->expinternal;
-
-  if(type > 2)
-    qe *= pf->expTermAU;
-
-  k = i + 1;
-  if(S[k] == 3){
-    if(k < j - VRNA_GQUAD_MIN_BOX_SIZE){
-      minl  = j - i + k - MAXLOOP - 2;
-      u     = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-      minl  = MAX2(u, minl);
-      u     = j - 3;
-      maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-      maxl  = MIN2(u, maxl);
-      for(l = minl; l < maxl; l++){
-        if(S[l] != 3) continue;
-        if(G[index[k]-l] == 0.) continue;
-        q += qe * G[index[k]-l] * expintern[j - l - 1];
-      }
-    }
-  }
-
-
-  for(k = i + 2;
-      k <= j - VRNA_GQUAD_MIN_BOX_SIZE;
-      k++){
-    u = k - i - 1;
-    if(u > MAXLOOP) break;
-    if(S[k] != 3) continue;
-    minl  = j - i + k - MAXLOOP - 2;
-    r     = k + VRNA_GQUAD_MIN_BOX_SIZE - 1;
-    minl  = MAX2(r, minl);
-    maxl  = k + VRNA_GQUAD_MAX_BOX_SIZE + 1;
-    r     = j - 1;
-    maxl  = MIN2(r, maxl);
-    for(l = minl; l < maxl; l++){
-      if(S[l] != 3) continue;
-      if(G[index[k]-l] == 0.) continue;
-      q += qe * G[index[k]-l] * expintern[u + j - l - 1];
-    }
-  }
-
-  l = j - 1;
-  if(S[l] == 3)
-    for(k = i + 4; k < j - VRNA_GQUAD_MIN_BOX_SIZE; k++){
-      u    = k - i - 1;
-      if(u>MAXLOOP) break;
-      if(S[k] != 3) continue;
-      if(G[index[k]-l] == 0.) continue;
-      q += qe * G[index[k]-l] * expintern[u];
-    }
-
-  return q;
-}
-
-#endif
diff --git a/include/intl11.h b/include/intl11.h
deleted file mode 100644
--- a/include/intl11.h
+++ /dev/null
@@ -1,393 +0,0 @@
-PUBLIC int int11_37[NBPAIRS+1][NBPAIRS+1][5][5] =
-{{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{    90,    90,    50,    50,    50}
-  ,{    90,    90,    50,    50,    50}
-  ,{    50,    50,    50,    50,    50}
-  ,{    50,    50,    50,  -140,    50}
-  ,{    50,    50,    50,    50,    40}
-  }
- ,{{    90,    90,    50,    50,    60}
-  ,{    90,    90,   -40,    50,    50}
-  ,{    60,    30,    50,    50,    60}
-  ,{    50,   -10,    50,  -220,    50}
-  ,{    50,    50,     0,    50,   -10}
-  }
- ,{{   120,   120,   120,   120,   120}
-  ,{   120,    60,    50,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   -20,   120,  -140,   120}
-  ,{   120,   120,   100,   120,   110}
-  }
- ,{{   220,   220,   170,   120,   120}
-  ,{   220,   220,   130,   120,   120}
-  ,{   170,   120,   170,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,   110}
-  }
- ,{{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,    80}
-  }
- ,{{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,   120}
-  }
- ,{{   220,   220,   170,   120,   120}
-  ,{   220,   220,   130,   120,   120}
-  ,{   170,   120,   170,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,   120}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{    90,    90,    60,    50,    50}
-  ,{    90,    90,    30,   -10,    50}
-  ,{    50,   -40,    50,    50,     0}
-  ,{    50,    50,    50,  -220,    50}
-  ,{    60,    50,    60,    50,   -10}
-  }
- ,{{    80,    80,    50,    50,    50}
-  ,{    80,    80,    50,    50,    50}
-  ,{    50,    50,    50,    50,    50}
-  ,{    50,    50,    50,  -230,    50}
-  ,{    50,    50,    50,    50,   -60}
-  }
- ,{{   190,   190,   120,   150,   150}
-  ,{   190,   190,   120,   150,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   150,   120,   120,   120,   150}
-  }
- ,{{   160,   160,   120,   120,   120}
-  ,{   160,   160,   120,   100,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,    70}
-  }
- ,{{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,    80}
-  }
- ,{{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,   120}
-  }
- ,{{   190,   190,   120,   150,   150}
-  ,{   190,   190,   120,   150,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   150,   120,   120,   120,   150}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   120,   120,   120,   120,   120}
-  ,{   120,    60,   120,   -20,   120}
-  ,{   120,    50,   120,   120,   100}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,   110}
-  }
- ,{{   190,   190,   120,   120,   150}
-  ,{   190,   190,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   150,   150,   120,  -140,   120}
-  ,{   150,   120,   120,   120,   150}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   120}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   160}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   120}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   160}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   160}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   220,   220,   170,   120,   120}
-  ,{   220,   220,   120,   120,   120}
-  ,{   170,   130,   170,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,   110}
-  }
- ,{{   160,   160,   120,   120,   120}
-  ,{   160,   160,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   100,   120,  -140,   120}
-  ,{   120,   120,   120,   120,    70}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   160}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   190}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   160}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   190}
-  }
- ,{{   220,   220,   190,   190,   190}
-  ,{   220,   220,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   190}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,    80}
-  }
- ,{{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,    80}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   120}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   160}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   120}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   150}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   160}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,   120}
-  }
- ,{{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,   120}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   160}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   190}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   150}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   170}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   190}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   220,   220,   170,   120,   120}
-  ,{   220,   220,   120,   120,   120}
-  ,{   170,   130,   170,   120,   120}
-  ,{   120,   120,   120,  -140,   120}
-  ,{   120,   120,   120,   120,   120}
-  }
- ,{{   190,   190,   120,   120,   150}
-  ,{   190,   190,   120,   120,   120}
-  ,{   120,   120,   120,   120,   120}
-  ,{   150,   150,   120,  -140,   120}
-  ,{   150,   120,   120,   120,   150}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   160}
-  }
- ,{{   220,   220,   190,   190,   190}
-  ,{   220,   220,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   190}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   160}
-  }
- ,{{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   190}
-  }
- ,{{   220,   220,   190,   190,   190}
-  ,{   220,   220,   190,   190,   190}
-  ,{   190,   190,   190,   190,   190}
-  ,{   190,   190,   190,   -70,   190}
-  ,{   190,   190,   190,   190,   190}
-  }
- }};
diff --git a/include/intl11dH.h b/include/intl11dH.h
deleted file mode 100644
--- a/include/intl11dH.h
+++ /dev/null
@@ -1,393 +0,0 @@
-PUBLIC int int11_dH[NBPAIRS+1][NBPAIRS+1][5][5] =
-{{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1840, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1050}
-  }
- ,{{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1840, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1390}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -890}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -890}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1840, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1390}
-  }
- ,{{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1050}
-  ,{ -1050, -1050, -1050, -1840, -1050}
-  ,{ -1050, -1050, -1050, -1050, -1730}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550, -1230}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -890}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550, -1230}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -890}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -890}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -890}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550, -1230}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -730}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -730}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -890}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -890}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550, -1230}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -730}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -730}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -890}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  }
- }
-,{{{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  ,{   INF,   INF,   INF,   INF,   INF}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  }
- ,{{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550,  -550,  -550}
-  ,{  -550,  -550,  -550, -1340,  -550}
-  ,{  -550,  -550,  -550,  -550,  -890}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,  -390}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  }
- ,{{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  ,{   -50,   -50,   -50,  -830,   -50}
-  ,{   -50,   -50,   -50,   -50,   -50}
-  }
- }};
diff --git a/include/intl21.h b/include/intl21.h
deleted file mode 100644
--- a/include/intl21.h
+++ /dev/null
@@ -1,1993 +0,0 @@
-PUBLIC int int21_37[NBPAIRS+1][NBPAIRS+1][5][5][5] =
-{{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   }
-  ,{{   230,   230,   230,   110,   230}
-   ,{   230,   230,   230,   110,   230}
-   ,{   230,   230,   230,   110,   230}
-   ,{   110,   110,   110,   110,   110}
-   ,{   230,   230,   230,   110,   230}
-   }
-  ,{{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   }
-  ,{{   230,   110,   230,   110,   230}
-   ,{   110,   110,   110,   110,   110}
-   ,{   230,   110,   230,   110,   230}
-   ,{   110,   110,   110,   110,   110}
-   ,{   230,   110,   230,   110,   230}
-   }
-  ,{{   230,   230,   230,   230,   150}
-   ,{   230,   230,   230,   230,   150}
-   ,{   230,   230,   230,   230,   150}
-   ,{   230,   230,   230,   230,   150}
-   ,{   150,   150,   150,   150,   150}
-   }
-  }
- ,{{{   250,   250,   250,   230,   230}
-   ,{   250,   250,   230,   230,   230}
-   ,{   250,   230,   250,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   250,   250,   230,   230,   230}
-   }
-  ,{{   250,   250,   230,   110,   230}
-   ,{   250,   250,   230,   110,   230}
-   ,{   230,   230,   170,   110,   230}
-   ,{   110,    80,   110,   110,   110}
-   ,{   230,   230,   230,   110,   230}
-   }
-  ,{{   250,   250,   250,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   250,   230,   250,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   250,   250,   230,   230,   230}
-   }
-  ,{{   230,   170,   230,   110,   230}
-   ,{   230,   170,   230,    80,   230}
-   ,{   230,   110,   230,   110,   230}
-   ,{   120,   120,   110,   110,   110}
-   ,{   230,   110,   230,   110,   230}
-   }
-  ,{{   230,   230,   230,   230,   150}
-   ,{   230,   230,   230,   230,   150}
-   ,{   230,   230,   220,   230,   150}
-   ,{   230,   230,   230,   230,   150}
-   ,{   170,   150,   170,   150,   140}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   250,   250,   230,   230,   230}
-   ,{   250,   250,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   }
-  ,{{   250,   250,   230,   230,   230}
-   ,{   250,   250,   230,   210,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   120,   120,   110,   110,   110}
-   ,{   230,   230,   230,   230,   230}
-   }
-  ,{{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   190,   230,   230}
-   }
-  ,{{   230,   110,   230,   110,   230}
-   ,{   110,   110,   110,   110,   110}
-   ,{   230,   110,   230,   110,   230}
-   ,{   110,   110,   110,   110,   110}
-   ,{   230,   110,   230,   110,   230}
-   }
-  ,{{   230,   230,   230,   230,   150}
-   ,{   230,   230,   230,   230,   150}
-   ,{   230,   230,   230,   230,   150}
-   ,{   230,   230,   230,   230,   150}
-   ,{   150,   150,   150,   150,   150}
-   }
-  }
- ,{{{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   }
-  ,{{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   110,   110,   110,   110,   110}
-   ,{   230,   230,   230,   230,   230}
-   }
-  ,{{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   ,{   230,   230,   230,   230,   230}
-   }
-  ,{{   230,   110,   230,   110,   230}
-   ,{   230,   110,   230,   110,   230}
-   ,{   230,   110,   230,   110,   230}
-   ,{   110,   110,   110,   110,   110}
-   ,{   230,   110,   230,   110,   230}
-   }
-  ,{{   230,   230,   230,   230,   150}
-   ,{   230,   230,   230,   230,   150}
-   ,{   230,   230,   230,   230,   150}
-   ,{   230,   230,   230,   230,   150}
-   ,{   150,   150,   150,   150,   150}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   250,   300,   210,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   190,   120,   190,   190,   190}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   190,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   250,   300,   210,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   190,   120,   190,   190,   190}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   190,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   250,   370,   210,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   120,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   190,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   300,   300,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   370,   370,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  ,{{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   300,   190,   300,   190,   300}
-   ,{   190,   190,   190,   190,   190}
-   ,{   300,   190,   300,   190,   300}
-   }
-  ,{{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   300,   300,   300,   300,   220}
-   ,{   220,   220,   220,   220,   220}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- ,{{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   ,{   370,   370,   370,   370,   370}
-   }
-  ,{{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   370,   260,   370,   260,   370}
-   ,{   260,   260,   260,   260,   260}
-   ,{   370,   260,   370,   260,   370}
-   }
-  ,{{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   370,   370,   370,   370,   300}
-   ,{   300,   300,   300,   300,   300}
-   }
-  }
- }};
diff --git a/include/intl21dH.h b/include/intl21dH.h
deleted file mode 100644
--- a/include/intl21dH.h
+++ /dev/null
@@ -1,1993 +0,0 @@
-PUBLIC int int21_dH[NBPAIRS+1][NBPAIRS+1][5][5][5] =
-{{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   }
-  ,{{   350,   350,   350,  -230,   350}
-   ,{   350,   350,   350,  -230,   350}
-   ,{   350,   350,   350,  -230,   350}
-   ,{  -230,  -230,  -230,  -230,  -230}
-   ,{   350,   350,   350,  -230,   350}
-   }
-  ,{{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   }
-  ,{{   350,  -230,   350,  -230,   350}
-   ,{  -230,  -230,  -230,  -230,  -230}
-   ,{   350,  -230,   350,  -230,   350}
-   ,{  -230,  -230,  -230,  -230,  -230}
-   ,{   350,  -230,   350,  -230,   350}
-   }
-  ,{{   350,   350,   350,   350,  -670}
-   ,{   350,   350,   350,   350,  -670}
-   ,{   350,   350,   350,   350,  -670}
-   ,{   350,   350,   350,   350,  -670}
-   ,{  -670,  -670,  -670,  -670,  -670}
-   }
-  }
- ,{{{   780,   640,   780,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   780,   350,   780,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   640,   640,   350,   350,   350}
-   }
-  ,{{   350,   350,   350,   250,   350}
-   ,{   350,   260,   350,   250,   350}
-   ,{   350,   350,  -250,  -230,   350}
-   ,{  -230,  -230,  -230,  -230,  -230}
-   ,{   350,   350,   350,  -230,   350}
-   }
-  ,{{   780,   640,   780,   350,   350}
-   ,{   350,   160,   350,   350,   350}
-   ,{   780,   350,   780,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   640,   640,   350,   350,   350}
-   }
-  ,{{   350,  -160,   350,  -230,   350}
-   ,{   350,  -160,   350,  -410,   350}
-   ,{   350,  -230,   350,  -230,   350}
-   ,{  -230,  -310,  -230,  -230,  -230}
-   ,{   350,  -230,   350,  -230,   350}
-   }
-  ,{{   580,   350,   580,   350,  -580}
-   ,{   350,   350,   350,   350,  -670}
-   ,{   580,   350,   580,   350,  -580}
-   ,{   350,   350,   350,   350,  -670}
-   ,{  -670,  -670,  -690,  -670,  -700}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   690,   690,   350,   350,   350}
-   ,{   690,   690,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   }
-  ,{{   690,   690,   350,   350,   350}
-   ,{   690,   690,   350,   240,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{  -230,  -500,  -230,  -230,  -230}
-   ,{   350,   350,   350,   350,   350}
-   }
-  ,{{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   130,   350,   350}
-   }
-  ,{{   350,  -230,   350,  -230,   350}
-   ,{  -230,  -230,  -230,  -230,  -230}
-   ,{   350,  -230,   350,  -230,   350}
-   ,{  -230,  -230,  -230,  -230,  -230}
-   ,{   350,  -230,   350,  -230,   350}
-   }
-  ,{{   350,   350,   350,   350,  -670}
-   ,{   350,   350,   350,   350,  -670}
-   ,{   350,   350,   350,   350,  -670}
-   ,{   350,   350,   350,   350,  -670}
-   ,{  -670,  -670,  -670,  -670,  -670}
-   }
-  }
- ,{{{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   }
-  ,{{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{  -230,  -230,  -230,  -230,  -230}
-   ,{   350,   350,   350,   350,   350}
-   }
-  ,{{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   ,{   350,   350,   350,   350,   350}
-   }
-  ,{{   350,  -230,   350,  -230,   350}
-   ,{   350,  -230,   350,  -230,   350}
-   ,{   350,  -230,   350,  -230,   350}
-   ,{  -230,  -230,  -230,  -230,  -230}
-   ,{   350,  -230,   350,  -230,   350}
-   }
-  ,{{   350,   350,   350,   350,  -670}
-   ,{   350,   350,   350,   350,  -670}
-   ,{   350,   350,   350,   350,  -670}
-   ,{   350,   350,   350,   350,  -670}
-   ,{  -670,  -670,  -670,  -670,  -670}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   690,   850,   240,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   280,  -500,   280,   280,   280}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   130,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   690,   850,   240,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   280,  -500,   280,   280,   280}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   130,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,   690,  1350,   240,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,  -500,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,   130,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   850,   850,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{  1350,  1350,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- }
-,{{{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  ,{{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   ,{   INF,   INF,   INF,   INF,   INF}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   ,{   850,   850,   850,   850,   850}
-   }
-  ,{{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   850,   280,   850,   280,   850}
-   ,{   280,   280,   280,   280,   280}
-   ,{   850,   280,   850,   280,   850}
-   }
-  ,{{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{   850,   850,   850,   850,  -160}
-   ,{  -160,  -160,  -160,  -160,  -160}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- ,{{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   ,{  1350,  1350,  1350,  1350,  1350}
-   }
-  ,{{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{  1350,   780,  1350,   780,  1350}
-   ,{   780,   780,   780,   780,   780}
-   ,{  1350,   780,  1350,   780,  1350}
-   }
-  ,{{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{  1350,  1350,  1350,  1350,   340}
-   ,{   340,   340,   340,   340,   340}
-   }
-  }
- }};
diff --git a/include/intl22.h b/include/intl22.h
deleted file mode 100644
--- a/include/intl22.h
+++ /dev/null
@@ -1,9993 +0,0 @@
-PUBLIC int int22_37[NBPAIRS+1][NBPAIRS+1][5][5][5][5] =
-{{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   200,   160,   200,   150,   200}
-    ,{   200,   160,   200,   150,   200}
-    ,{   180,   140,   180,   140,   180}
-    ,{   200,   160,   200,   150,   200}
-    ,{   170,   130,   170,   120,   170}
-    }
-   ,{{   160,   120,   160,   110,   160}
-    ,{   160,   120,   160,   110,   160}
-    ,{   150,   110,   150,   110,   150}
-    ,{   110,    20,   110,    20,    90}
-    ,{   150,   110,   150,   110,   150}
-    }
-   ,{{   200,   160,   200,   150,   200}
-    ,{   200,   160,   200,   150,   200}
-    ,{   180,   140,   180,   140,   180}
-    ,{   200,   160,   200,   150,   200}
-    ,{   170,   130,   170,   120,   170}
-    }
-   ,{{   150,   110,   150,   110,   150}
-    ,{   110,    20,   110,    20,    90}
-    ,{   150,   110,   150,   110,   150}
-    ,{    80,     0,    10,    80,    20}
-    ,{   150,   110,   150,   110,   150}
-    }
-   ,{{   200,   160,   200,   150,   200}
-    ,{   200,   160,   200,   150,   200}
-    ,{   170,   130,   170,   120,   170}
-    ,{   200,   160,   200,   150,   200}
-    ,{   100,   100,    80,    30,    80}
-    }
-   }
-  ,{{{   200,   160,   200,   110,   200}
-    ,{   200,   160,   200,    60,   200}
-    ,{   180,   140,   180,   110,   180}
-    ,{   200,   160,   200,    60,   200}
-    ,{   170,   130,   170,    90,   170}
-    }
-   ,{{   160,   120,   160,    20,   160}
-    ,{   160,   120,   160,    20,   160}
-    ,{   150,   110,   150,    20,   150}
-    ,{    60,    20,    60,   -70,    60}
-    ,{   150,   110,   150,    20,   150}
-    }
-   ,{{   200,   160,   200,   110,   200}
-    ,{   200,   160,   200,    60,   200}
-    ,{   180,   140,   180,   110,   180}
-    ,{   200,   160,   200,    60,   200}
-    ,{   170,   130,   170,    90,   170}
-    }
-   ,{{   150,   110,   150,    20,   150}
-    ,{    60,    20,    60,   -70,    60}
-    ,{   150,   110,   150,    20,   150}
-    ,{    10,   -30,    10,     0,    10}
-    ,{   150,   110,   150,    20,   150}
-    }
-   ,{{   200,   160,   200,    90,   200}
-    ,{   200,   160,   200,    60,   200}
-    ,{   170,   130,   170,    90,   170}
-    ,{   200,   160,   200,    60,   200}
-    ,{   100,   100,    80,   -50,    80}
-    }
-   }
-  ,{{{   180,   150,   180,   150,   170}
-    ,{   180,   150,   180,   150,   170}
-    ,{   170,   140,   170,   140,   150}
-    ,{   180,   150,   180,   150,   170}
-    ,{   150,   120,   150,   120,   140}
-    }
-   ,{{   140,   110,   140,   110,   130}
-    ,{   140,   110,   140,   110,   130}
-    ,{   140,   110,   140,   110,   120}
-    ,{   110,    20,   110,    20,    90}
-    ,{   140,   110,   140,   110,   120}
-    }
-   ,{{   180,   150,   180,   150,   170}
-    ,{   180,   150,   180,   150,   170}
-    ,{   170,   140,   170,   140,   150}
-    ,{   180,   150,   180,   150,   170}
-    ,{   150,   120,   150,   120,   140}
-    }
-   ,{{   140,   110,   140,   110,   120}
-    ,{   110,    20,   110,    20,    90}
-    ,{   140,   110,   140,   110,   120}
-    ,{   -10,   -40,   -10,   -40,   -20}
-    ,{   140,   110,   140,   110,   120}
-    }
-   ,{{   180,   150,   180,   150,   170}
-    ,{   180,   150,   180,   150,   170}
-    ,{   150,   120,   150,   120,   140}
-    ,{   180,   150,   180,   150,   170}
-    ,{    60,    30,    60,    30,    50}
-    }
-   }
-  ,{{{   200,   110,   200,    80,   200}
-    ,{   200,    60,   200,    10,   200}
-    ,{   180,   110,   180,   -10,   180}
-    ,{   200,    60,   200,    80,   200}
-    ,{   170,    90,   170,    20,   170}
-    }
-   ,{{   160,    20,   160,     0,   160}
-    ,{   160,    20,   160,   -30,   160}
-    ,{   150,    20,   150,   -40,   150}
-    ,{    60,   -70,    60,     0,    60}
-    ,{   150,    20,   150,   -40,   150}
-    }
-   ,{{   200,   110,   200,    10,   200}
-    ,{   200,    60,   200,    10,   200}
-    ,{   180,   110,   180,   -10,   180}
-    ,{   200,    60,   200,    10,   200}
-    ,{   170,    90,   170,   -20,   170}
-    }
-   ,{{   150,    20,   150,    80,   150}
-    ,{    60,   -70,    60,     0,    60}
-    ,{   150,    20,   150,   -40,   150}
-    ,{    80,     0,    10,    80,    10}
-    ,{   150,    20,   150,   -40,   150}
-    }
-   ,{{   200,    90,   200,    20,   200}
-    ,{   200,    60,   200,    10,   200}
-    ,{   170,    90,   170,   -20,   170}
-    ,{   200,    60,   200,    10,   200}
-    ,{    80,   -50,    80,    20,    80}
-    }
-   }
-  ,{{{   170,   150,   170,   150,   100}
-    ,{   170,   150,   170,   150,   100}
-    ,{   150,   140,   150,   140,    60}
-    ,{   170,   150,   170,   150,    80}
-    ,{   140,   120,   140,   120,    50}
-    }
-   ,{{   130,   110,   130,   110,   100}
-    ,{   130,   110,   130,   110,   100}
-    ,{   120,   110,   120,   110,    30}
-    ,{    90,    20,    90,    20,   -50}
-    ,{   120,   110,   120,   110,    30}
-    }
-   ,{{   170,   150,   170,   150,    80}
-    ,{   170,   150,   170,   150,    80}
-    ,{   150,   140,   150,   140,    60}
-    ,{   170,   150,   170,   150,    80}
-    ,{   140,   120,   140,   120,    50}
-    }
-   ,{{   120,   110,   120,   110,    30}
-    ,{    90,    20,    90,    20,   -50}
-    ,{   120,   110,   120,   110,    30}
-    ,{    20,   -40,   -20,   -40,    20}
-    ,{   120,   110,   120,   110,    30}
-    }
-   ,{{   170,   150,   170,   150,    80}
-    ,{   170,   150,   170,   150,    80}
-    ,{   140,   120,   140,   120,    50}
-    ,{   170,   150,   170,   150,    80}
-    ,{    50,    30,    50,    30,   -40}
-    }
-   }
-  }
- ,{{{{   220,   150,   220,   140,   170}
-    ,{   220,   130,   220,   130,   170}
-    ,{   150,   110,   150,   110,   150}
-    ,{   140,   100,   140,   100,   140}
-    ,{   170,   150,   150,   140,   170}
-    }
-   ,{{   220,   130,   220,   130,   170}
-    ,{   220,   130,   220,   130,   170}
-    ,{   150,   110,   150,   100,   150}
-    ,{    70,   -30,    70,   -70,    50}
-    ,{   150,   110,   150,   100,   150}
-    }
-   ,{{   190,   110,   190,   100,   170}
-    ,{   190,   110,   190,   100,   140}
-    ,{   150,   110,   150,   100,   150}
-    ,{   140,   100,   140,   100,   140}
-    ,{   170,   110,   150,   100,   170}
-    }
-   ,{{   150,   110,   150,   100,   150}
-    ,{   140,    70,    70,   -10,   140}
-    ,{   150,   110,   150,   100,   150}
-    ,{    80,   -30,    10,    80,    70}
-    ,{   150,   110,   150,   100,   150}
-    }
-   ,{{   150,   150,   150,   140,   150}
-    ,{   140,   100,   140,   100,   140}
-    ,{   150,   110,   150,   110,   150}
-    ,{   140,   100,   140,   100,   140}
-    ,{   150,   150,    70,   140,    70}
-    }
-   }
-  ,{{{   170,   150,   150,    90,   170}
-    ,{   170,   130,   140,    10,   170}
-    ,{   150,   110,   150,    80,   150}
-    ,{   140,   100,   140,    10,   140}
-    ,{   150,   150,   150,    90,   150}
-    }
-   ,{{   170,   130,   150,    10,   170}
-    ,{   170,   130,    60,     0,   170}
-    ,{   150,   110,   150,   -70,   150}
-    ,{    10,   -30,    10,  -160,   -30}
-    ,{   150,   110,   150,    10,   150}
-    }
-   ,{{   150,   110,   150,    70,   150}
-    ,{   140,   100,    50,  -100,   140}
-    ,{   150,   110,   150,   -60,   150}
-    ,{   140,   100,   140,    10,   140}
-    ,{   150,   110,   150,    70,   150}
-    }
-   ,{{   150,   110,   150,    10,   150}
-    ,{    40,    40,    30,   -70,    30}
-    ,{   150,   110,   150,    10,   150}
-    ,{    10,   -30,   -30,     0,    10}
-    ,{   150,   110,   150,    10,   150}
-    }
-   ,{{   150,   150,   150,    90,   150}
-    ,{   140,   100,   140,    10,   140}
-    ,{   150,   110,   150,    80,   150}
-    ,{   140,   100,   140,    10,   140}
-    ,{   150,   150,     0,    90,    70}
-    }
-   }
-  ,{{{   220,   130,   220,   130,   170}
-    ,{   220,   130,   220,   130,   140}
-    ,{   140,   110,   140,   110,   120}
-    ,{   130,   100,   130,   100,   110}
-    ,{   170,   100,   130,   100,   170}
-    }
-   ,{{   220,   130,   220,   130,   140}
-    ,{   220,   130,   220,   130,   140}
-    ,{   130,   100,   130,   100,   120}
-    ,{    70,   -70,    70,   -70,     0}
-    ,{   130,   100,   130,   100,   120}
-    }
-   ,{{   190,   110,   190,   100,   170}
-    ,{   190,   110,   190,   100,   110}
-    ,{   130,   100,   130,   100,   120}
-    ,{   130,   100,   130,   100,   110}
-    ,{   170,   100,   130,   100,   170}
-    }
-   ,{{   130,   100,   130,   100,   120}
-    ,{    70,    70,    70,   -10,    60}
-    ,{   130,   100,   130,   100,   120}
-    ,{    20,   -40,   -10,   -40,    20}
-    ,{   130,   100,   130,   100,   120}
-    }
-   ,{{   140,   110,   140,   110,   120}
-    ,{   130,   100,   130,   100,   110}
-    ,{   140,   110,   140,   110,   120}
-    ,{   130,   100,   130,   100,   110}
-    ,{    30,   -20,   -10,    30,    20}
-    }
-   }
-  ,{{{   170,    90,   170,   140,   170}
-    ,{   170,    70,   170,   -10,   170}
-    ,{   150,    80,   150,   -40,   150}
-    ,{   140,    10,   140,    80,   140}
-    ,{   150,    90,   150,   140,   150}
-    }
-   ,{{   170,    10,   170,   -10,   170}
-    ,{   170,   -20,   170,   -10,   170}
-    ,{   150,   -40,   150,   -40,   150}
-    ,{   -30,  -170,   -30,   -90,   -30}
-    ,{   150,    10,   150,   -40,   150}
-    }
-   ,{{   150,    70,   150,    20,   150}
-    ,{   140,    70,   140,   -50,   140}
-    ,{   150,    70,   150,   -40,   150}
-    ,{   140,    10,   140,   -50,   140}
-    ,{   150,    70,   150,    20,   150}
-    }
-   ,{{   150,    10,   150,    80,   150}
-    ,{    30,   -50,    30,   -30,    30}
-    ,{   150,    10,   150,   -40,   150}
-    ,{    80,   -30,    10,    80,    10}
-    ,{   150,    10,   150,   -40,   150}
-    }
-   ,{{   150,    90,   150,   140,   150}
-    ,{   140,    10,   140,   -50,   140}
-    ,{   150,    80,   150,   -50,   150}
-    ,{   140,    10,   140,   -50,   140}
-    ,{   140,    90,    70,   140,    70}
-    }
-   }
-  ,{{{   140,   130,   140,   130,   140}
-    ,{   140,   130,   140,   130,   140}
-    ,{   120,   110,   120,   110,    30}
-    ,{   110,   100,   110,   100,    70}
-    ,{   120,   100,   120,   100,    30}
-    }
-   ,{{   140,   130,   140,   130,   140}
-    ,{   140,   130,   140,   130,   140}
-    ,{   120,   100,   120,   100,    30}
-    ,{    50,   -70,     0,   -70,    50}
-    ,{   120,   100,   120,   100,    30}
-    }
-   ,{{   120,   100,   120,   100,    30}
-    ,{   110,   100,   110,   100,    30}
-    ,{   120,   100,   120,   100,    30}
-    ,{   110,   100,   110,   100,    20}
-    ,{   120,   100,   120,   100,    30}
-    }
-   ,{{   140,   100,   120,   100,   140}
-    ,{   140,   -10,    50,   -10,   140}
-    ,{   120,   100,   120,   100,    30}
-    ,{    70,   -40,   -60,   -40,    70}
-    ,{   120,   100,   120,   100,    30}
-    }
-   ,{{   120,   110,   120,   110,    30}
-    ,{   110,   100,   110,   100,    20}
-    ,{   120,   110,   120,   110,    30}
-    ,{   110,   100,   110,   100,    20}
-    ,{    40,    30,    40,    30,   -60}
-    }
-   }
-  }
- ,{{{{   300,   290,   300,   260,   300}
-    ,{   300,   270,   300,   260,   300}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   290,   290,   270,   220,   270}
-    }
-   ,{{   300,   270,   300,   260,   300}
-    ,{   300,   270,   300,   260,   300}
-    ,{   270,   230,   270,   220,   270}
-    ,{   230,   150,   230,   140,   220}
-    ,{   270,   230,   270,   220,   270}
-    }
-   ,{{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    }
-   ,{{   270,   230,   270,   220,   270}
-    ,{   270,   190,   270,   180,   260}
-    ,{   270,   230,   270,   220,   270}
-    ,{   210,   130,   140,   210,   150}
-    ,{   270,   230,   270,   220,   270}
-    }
-   ,{{   290,   290,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   290,   290,   270,   220,   270}
-    }
-   }
-  ,{{{   300,   290,   300,   190,   300}
-    ,{   300,   270,   300,   170,   300}
-    ,{   270,   230,   270,   190,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   290,   290,   270,   190,   270}
-    }
-   ,{{   300,   270,   300,   170,   300}
-    ,{   300,   270,   300,   170,   300}
-    ,{   270,   230,   270,   130,   270}
-    ,{   190,   150,   190,    50,   190}
-    ,{   270,   230,   270,   130,   270}
-    }
-   ,{{   270,   230,   270,   190,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   270,   230,   270,   190,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   270,   230,   270,   190,   270}
-    }
-   ,{{   270,   230,   270,   130,   270}
-    ,{   230,   190,   230,    90,   230}
-    ,{   270,   230,   270,   130,   270}
-    ,{   140,   100,   140,   130,   140}
-    ,{   270,   230,   270,   130,   270}
-    }
-   ,{{   290,   290,   270,   190,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   270,   230,   270,   190,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   290,   290,   270,   130,   270}
-    }
-   }
-  ,{{{   290,   260,   290,   260,   270}
-    ,{   290,   260,   290,   260,   270}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    }
-   ,{{   290,   260,   290,   260,   270}
-    ,{   290,   260,   290,   260,   270}
-    ,{   250,   220,   250,   220,   240}
-    ,{   230,   140,   230,   140,   220}
-    ,{   250,   220,   250,   220,   240}
-    }
-   ,{{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    }
-   ,{{   270,   220,   270,   220,   260}
-    ,{   270,   180,   270,   180,   260}
-    ,{   250,   220,   250,   220,   240}
-    ,{   120,    90,   120,    90,   110}
-    ,{   250,   220,   250,   220,   240}
-    }
-   ,{{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    }
-   }
-  ,{{{   300,   190,   300,   210,   300}
-    ,{   300,   170,   300,   170,   300}
-    ,{   270,   190,   270,    80,   270}
-    ,{   270,   130,   270,   210,   270}
-    ,{   270,   190,   270,   210,   270}
-    }
-   ,{{   300,   170,   300,   130,   300}
-    ,{   300,   170,   300,   110,   300}
-    ,{   270,   130,   270,    80,   270}
-    ,{   190,    50,   190,   130,   190}
-    ,{   270,   130,   270,    80,   270}
-    }
-   ,{{   270,   190,   270,    80,   270}
-    ,{   270,   130,   270,    80,   270}
-    ,{   270,   190,   270,    80,   270}
-    ,{   270,   130,   270,    80,   270}
-    ,{   270,   190,   270,    80,   270}
-    }
-   ,{{   270,   130,   270,   210,   270}
-    ,{   230,    90,   230,   170,   230}
-    ,{   270,   130,   270,    80,   270}
-    ,{   210,   130,   140,   210,   140}
-    ,{   270,   130,   270,    80,   270}
-    }
-   ,{{   270,   190,   270,   210,   270}
-    ,{   270,   130,   270,    80,   270}
-    ,{   270,   190,   270,    80,   270}
-    ,{   270,   130,   270,    80,   270}
-    ,{   270,   130,   270,   210,   270}
-    }
-   }
-  ,{{{   270,   260,   270,   260,   240}
-    ,{   270,   260,   270,   260,   240}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    }
-   ,{{   270,   260,   270,   260,   240}
-    ,{   270,   260,   270,   260,   240}
-    ,{   240,   220,   240,   220,   150}
-    ,{   220,   140,   220,   140,    70}
-    ,{   240,   220,   240,   220,   150}
-    }
-   ,{{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    }
-   ,{{   260,   220,   260,   220,   150}
-    ,{   260,   180,   260,   180,   110}
-    ,{   240,   220,   240,   220,   150}
-    ,{   150,    90,   110,    90,   150}
-    ,{   240,   220,   240,   220,   150}
-    }
-   ,{{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    }
-   }
-  }
- ,{{{{   310,   260,   310,   220,   300}
-    ,{   310,   230,   310,   220,   300}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   260,   260,   240,   190,   240}
-    }
-   ,{{   240,   200,   240,   190,   240}
-    ,{   200,   160,   200,   160,   200}
-    ,{   240,   200,   240,   190,   240}
-    ,{   150,    60,   150,    60,   130}
-    ,{   240,   200,   240,   190,   240}
-    }
-   ,{{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    }
-   ,{{   310,   230,   310,   220,   300}
-    ,{   310,   230,   310,   220,   300}
-    ,{   240,   200,   240,   190,   240}
-    ,{   180,   100,   110,   180,   120}
-    ,{   240,   200,   240,   190,   240}
-    }
-   ,{{   260,   260,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   260,   260,   240,   190,   240}
-    }
-   }
-  ,{{{   270,   260,   270,   160,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   240,   200,   240,   160,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   260,   260,   240,   160,   240}
-    }
-   ,{{   240,   200,   240,   100,   240}
-    ,{   200,   160,   200,    70,   200}
-    ,{   240,   200,   240,   100,   240}
-    ,{   100,    60,   100,   -30,   100}
-    ,{   240,   200,   240,   100,   240}
-    }
-   ,{{   240,   200,   240,   160,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   240,   200,   240,   160,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   240,   200,   240,   160,   240}
-    }
-   ,{{   270,   230,   270,   130,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   240,   200,   240,   100,   240}
-    ,{   110,    70,   110,   100,   110}
-    ,{   240,   200,   240,   100,   240}
-    }
-   ,{{   260,   260,   240,   160,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   240,   200,   240,   160,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   260,   260,   240,   100,   240}
-    }
-   }
-  ,{{{   310,   220,   310,   220,   300}
-    ,{   310,   220,   310,   220,   300}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    }
-   ,{{   220,   190,   220,   190,   210}
-    ,{   190,   160,   190,   160,   170}
-    ,{   220,   190,   220,   190,   210}
-    ,{   150,    60,   150,    60,   130}
-    ,{   220,   190,   220,   190,   210}
-    }
-   ,{{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    }
-   ,{{   310,   220,   310,   220,   300}
-    ,{   310,   220,   310,   220,   300}
-    ,{   220,   190,   220,   190,   210}
-    ,{    90,    60,    90,    60,    80}
-    ,{   220,   190,   220,   190,   210}
-    }
-   ,{{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    }
-   }
-  ,{{{   270,   160,   270,   210,   270}
-    ,{   270,   130,   270,   210,   270}
-    ,{   240,   160,   240,    50,   240}
-    ,{   240,   100,   240,   180,   240}
-    ,{   240,   160,   240,   180,   240}
-    }
-   ,{{   240,   100,   240,    50,   240}
-    ,{   200,    70,   200,    10,   200}
-    ,{   240,   100,   240,    50,   240}
-    ,{   100,   -30,   100,    40,   100}
-    ,{   240,   100,   240,    50,   240}
-    }
-   ,{{   240,   160,   240,    50,   240}
-    ,{   240,   100,   240,    50,   240}
-    ,{   240,   160,   240,    50,   240}
-    ,{   240,   100,   240,    50,   240}
-    ,{   240,   160,   240,    50,   240}
-    }
-   ,{{   270,   130,   270,   210,   270}
-    ,{   270,   130,   270,   210,   270}
-    ,{   240,   100,   240,    50,   240}
-    ,{   180,   100,   110,   180,   110}
-    ,{   240,   100,   240,    50,   240}
-    }
-   ,{{   240,   160,   240,   180,   240}
-    ,{   240,   100,   240,    50,   240}
-    ,{   240,   160,   240,    50,   240}
-    ,{   240,   100,   240,    50,   240}
-    ,{   240,   100,   240,   180,   240}
-    }
-   }
-  ,{{{   300,   220,   300,   220,   150}
-    ,{   300,   220,   300,   220,   150}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    }
-   ,{{   210,   190,   210,   190,   140}
-    ,{   170,   160,   170,   160,   140}
-    ,{   210,   190,   210,   190,   120}
-    ,{   130,    60,   130,    60,   -10}
-    ,{   210,   190,   210,   190,   120}
-    }
-   ,{{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    }
-   ,{{   300,   220,   300,   220,   150}
-    ,{   300,   220,   300,   220,   150}
-    ,{   210,   190,   210,   190,   120}
-    ,{   120,    60,    80,    60,   120}
-    ,{   210,   190,   210,   190,   120}
-    }
-   ,{{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    }
-   }
-  }
- ,{{{{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   220,   180,   220,   170,   220}
-    ,{   220,   180,   220,   180,   220}
-    ,{   220,   180,   220,   170,   220}
-    }
-   ,{{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   210,   170,   210,   170,   210}
-    ,{   160,    70,   160,    70,   140}
-    ,{   210,   170,   210,   170,   210}
-    }
-   ,{{   220,   180,   220,   180,   220}
-    ,{   220,   180,   220,   180,   220}
-    ,{   220,   180,   220,   170,   220}
-    ,{   220,   180,   220,   180,   220}
-    ,{   220,   180,   220,   170,   220}
-    }
-   ,{{   230,   170,   230,   170,   210}
-    ,{   230,   140,   230,   140,   210}
-    ,{   210,   170,   210,   170,   210}
-    ,{   130,    60,    60,   130,    70}
-    ,{   210,   170,   210,   170,   210}
-    }
-   ,{{   220,   180,   220,   180,   220}
-    ,{   220,   180,   220,   180,   220}
-    ,{   220,   180,   220,   170,   220}
-    ,{   220,   180,   220,   180,   220}
-    ,{   150,   150,   130,    80,   130}
-    }
-   }
-  ,{{{   240,   200,   240,   140,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   220,   180,   220,   140,   220}
-    ,{   220,   180,   220,    90,   220}
-    ,{   220,   180,   220,   140,   220}
-    }
-   ,{{   240,   200,   240,   100,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   210,   170,   210,    80,   210}
-    ,{   110,    70,   110,   -20,   110}
-    ,{   210,   170,   210,    80,   210}
-    }
-   ,{{   220,   180,   220,   140,   220}
-    ,{   220,   180,   220,    90,   220}
-    ,{   220,   180,   220,   140,   220}
-    ,{   220,   180,   220,    90,   220}
-    ,{   220,   180,   220,   140,   220}
-    }
-   ,{{   210,   170,   210,    80,   210}
-    ,{   180,   140,   180,    50,   180}
-    ,{   210,   170,   210,    80,   210}
-    ,{    60,    20,    60,    60,    60}
-    ,{   210,   170,   210,    80,   210}
-    }
-   ,{{   220,   180,   220,   140,   220}
-    ,{   220,   180,   220,    90,   220}
-    ,{   220,   180,   220,   140,   220}
-    ,{   220,   180,   220,    90,   220}
-    ,{   150,   150,   130,     0,   130}
-    }
-   }
-  ,{{{   230,   190,   230,   190,   210}
-    ,{   230,   190,   230,   190,   210}
-    ,{   200,   170,   200,   170,   190}
-    ,{   210,   180,   210,   180,   190}
-    ,{   200,   170,   200,   170,   190}
-    }
-   ,{{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   200,   170,   200,   170,   180}
-    ,{   160,    70,   160,    70,   140}
-    ,{   200,   170,   200,   170,   180}
-    }
-   ,{{   210,   180,   210,   180,   190}
-    ,{   210,   180,   210,   180,   190}
-    ,{   200,   170,   200,   170,   190}
-    ,{   210,   180,   210,   180,   190}
-    ,{   200,   170,   200,   170,   190}
-    }
-   ,{{   230,   170,   230,   170,   210}
-    ,{   230,   140,   230,   140,   210}
-    ,{   200,   170,   200,   170,   180}
-    ,{    50,    20,    50,    20,    30}
-    ,{   200,   170,   200,   170,   180}
-    }
-   ,{{   210,   180,   210,   180,   190}
-    ,{   210,   180,   210,   180,   190}
-    ,{   200,   170,   200,   170,   190}
-    ,{   210,   180,   210,   180,   190}
-    ,{   110,    80,   110,    80,   100}
-    }
-   }
-  ,{{{   240,   140,   240,   130,   240}
-    ,{   240,   100,   240,   120,   240}
-    ,{   220,   140,   220,    30,   220}
-    ,{   220,    90,   220,   130,   220}
-    ,{   220,   140,   220,    70,   220}
-    }
-   ,{{   240,   100,   240,    50,   240}
-    ,{   240,   100,   240,    50,   240}
-    ,{   210,    80,   210,    20,   210}
-    ,{   110,   -20,   110,    50,   110}
-    ,{   210,    80,   210,    20,   210}
-    }
-   ,{{   220,   140,   220,    30,   220}
-    ,{   220,    90,   220,    30,   220}
-    ,{   220,   140,   220,    30,   220}
-    ,{   220,    90,   220,    30,   220}
-    ,{   220,   140,   220,    30,   220}
-    }
-   ,{{   210,    80,   210,   130,   210}
-    ,{   180,    50,   180,   120,   180}
-    ,{   210,    80,   210,    20,   210}
-    ,{   130,    60,    60,   130,    60}
-    ,{   210,    80,   210,    20,   210}
-    }
-   ,{{   220,   140,   220,    70,   220}
-    ,{   220,    90,   220,    30,   220}
-    ,{   220,   140,   220,    30,   220}
-    ,{   220,    90,   220,    30,   220}
-    ,{   130,     0,   130,    70,   130}
-    }
-   }
-  ,{{{   210,   190,   210,   190,   180}
-    ,{   210,   190,   210,   190,   180}
-    ,{   190,   170,   190,   170,   100}
-    ,{   190,   180,   190,   180,   100}
-    ,{   190,   170,   190,   170,   100}
-    }
-   ,{{   210,   190,   210,   190,   180}
-    ,{   210,   190,   210,   190,   180}
-    ,{   180,   170,   180,   170,    90}
-    ,{   140,    70,   140,    70,     0}
-    ,{   180,   170,   180,   170,    90}
-    }
-   ,{{   190,   180,   190,   180,   100}
-    ,{   190,   180,   190,   180,   100}
-    ,{   190,   170,   190,   170,   100}
-    ,{   190,   180,   190,   180,   100}
-    ,{   190,   170,   190,   170,   100}
-    }
-   ,{{   210,   170,   210,   170,    90}
-    ,{   210,   140,   210,   140,    60}
-    ,{   180,   170,   180,   170,    90}
-    ,{    70,    20,    30,    20,    70}
-    ,{   180,   170,   180,   170,    90}
-    }
-   ,{{   190,   180,   190,   180,   100}
-    ,{   190,   180,   190,   180,   100}
-    ,{   190,   170,   190,   170,   100}
-    ,{   190,   180,   190,   180,   100}
-    ,{   100,    80,   100,    80,    10}
-    }
-   }
-  }
- ,{{{{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    }
-   ,{{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   190,   150,   190,   150,   190}
-    ,{   180,    90,   180,    90,   160}
-    ,{   190,   150,   190,   150,   190}
-    }
-   ,{{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    }
-   ,{{   190,   150,   190,   150,   190}
-    ,{   190,   100,   190,   100,   170}
-    ,{   190,   150,   190,   150,   190}
-    ,{   150,    80,    80,   150,    90}
-    ,{   190,   150,   190,   150,   190}
-    }
-   ,{{   240,   200,   240,   190,   240}
-    ,{   240,   200,   240,   190,   240}
-    ,{   210,   170,   210,   160,   210}
-    ,{   240,   200,   240,   190,   240}
-    ,{   170,   170,   150,   110,   150}
-    }
-   }
-  ,{{{   240,   200,   240,   160,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   240,   200,   240,   160,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   240,   200,   240,   160,   240}
-    }
-   ,{{   240,   200,   240,   100,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   190,   150,   190,    60,   190}
-    ,{   130,    90,   130,     0,   130}
-    ,{   190,   150,   190,    60,   190}
-    }
-   ,{{   240,   200,   240,   160,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   240,   200,   240,   160,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   240,   200,   240,   160,   240}
-    }
-   ,{{   190,   150,   190,    80,   190}
-    ,{   140,   100,   140,    10,   140}
-    ,{   190,   150,   190,    60,   190}
-    ,{    80,    40,    80,    80,    80}
-    ,{   190,   150,   190,    60,   190}
-    }
-   ,{{   240,   200,   240,   130,   240}
-    ,{   240,   200,   240,   100,   240}
-    ,{   210,   170,   210,   130,   210}
-    ,{   240,   200,   240,   100,   240}
-    ,{   170,   170,   150,    20,   150}
-    }
-   }
-  ,{{{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    }
-   ,{{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   180,   150,   180,   150,   160}
-    ,{   180,    90,   180,    90,   160}
-    ,{   180,   150,   180,   150,   160}
-    }
-   ,{{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    }
-   ,{{   190,   150,   190,   150,   170}
-    ,{   190,   100,   190,   100,   170}
-    ,{   180,   150,   180,   150,   160}
-    ,{    70,    40,    70,    40,    50}
-    ,{   180,   150,   180,   150,   160}
-    }
-   ,{{   220,   190,   220,   190,   210}
-    ,{   220,   190,   220,   190,   210}
-    ,{   190,   160,   190,   160,   180}
-    ,{   220,   190,   220,   190,   210}
-    ,{   140,   110,   140,   110,   120}
-    }
-   }
-  ,{{{   240,   160,   240,   150,   240}
-    ,{   240,   100,   240,    80,   240}
-    ,{   240,   160,   240,    50,   240}
-    ,{   240,   100,   240,   150,   240}
-    ,{   240,   160,   240,    90,   240}
-    }
-   ,{{   240,   100,   240,    70,   240}
-    ,{   240,   100,   240,    50,   240}
-    ,{   190,    60,   190,     0,   190}
-    ,{   130,     0,   130,    70,   130}
-    ,{   190,    60,   190,     0,   190}
-    }
-   ,{{   240,   160,   240,    50,   240}
-    ,{   240,   100,   240,    50,   240}
-    ,{   240,   160,   240,    50,   240}
-    ,{   240,   100,   240,    50,   240}
-    ,{   240,   160,   240,    50,   240}
-    }
-   ,{{   190,    80,   190,   150,   190}
-    ,{   140,    10,   140,    80,   140}
-    ,{   190,    60,   190,     0,   190}
-    ,{   150,    80,    80,   150,    80}
-    ,{   190,    60,   190,     0,   190}
-    }
-   ,{{   240,   130,   240,    90,   240}
-    ,{   240,   100,   240,    50,   240}
-    ,{   210,   130,   210,    20,   210}
-    ,{   240,   100,   240,    50,   240}
-    ,{   150,    20,   150,    90,   150}
-    }
-   }
-  ,{{{   210,   190,   210,   190,   180}
-    ,{   210,   190,   210,   190,   180}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    }
-   ,{{   210,   190,   210,   190,   180}
-    ,{   210,   190,   210,   190,   180}
-    ,{   160,   150,   160,   150,    70}
-    ,{   160,    90,   160,    90,    10}
-    ,{   160,   150,   160,   150,    70}
-    }
-   ,{{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    }
-   ,{{   170,   150,   170,   150,    90}
-    ,{   170,   100,   170,   100,    20}
-    ,{   160,   150,   160,   150,    70}
-    ,{    90,    40,    50,    40,    90}
-    ,{   160,   150,   160,   150,    70}
-    }
-   ,{{   210,   190,   210,   190,   120}
-    ,{   210,   190,   210,   190,   120}
-    ,{   180,   160,   180,   160,    90}
-    ,{   210,   190,   210,   190,   120}
-    ,{   120,   110,   120,   110,    30}
-    }
-   }
-  }
- ,{{{{   310,   290,   310,   260,   300}
-    ,{   310,   270,   310,   260,   300}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   290,   290,   270,   220,   270}
-    }
-   ,{{   300,   270,   300,   260,   300}
-    ,{   300,   270,   300,   260,   300}
-    ,{   270,   230,   270,   220,   270}
-    ,{   230,   150,   230,   140,   220}
-    ,{   270,   230,   270,   220,   270}
-    }
-   ,{{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    }
-   ,{{   310,   230,   310,   220,   300}
-    ,{   310,   230,   310,   220,   300}
-    ,{   270,   230,   270,   220,   270}
-    ,{   210,   130,   140,   210,   150}
-    ,{   270,   230,   270,   220,   270}
-    }
-   ,{{   290,   290,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   270,   230,   270,   220,   270}
-    ,{   290,   290,   270,   220,   270}
-    }
-   }
-  ,{{{   300,   290,   300,   190,   300}
-    ,{   300,   270,   300,   170,   300}
-    ,{   270,   230,   270,   190,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   290,   290,   270,   190,   270}
-    }
-   ,{{   300,   270,   300,   170,   300}
-    ,{   300,   270,   300,   170,   300}
-    ,{   270,   230,   270,   130,   270}
-    ,{   190,   150,   190,    50,   190}
-    ,{   270,   230,   270,   130,   270}
-    }
-   ,{{   270,   230,   270,   190,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   270,   230,   270,   190,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   270,   230,   270,   190,   270}
-    }
-   ,{{   270,   230,   270,   130,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   140,   100,   140,   130,   140}
-    ,{   270,   230,   270,   130,   270}
-    }
-   ,{{   290,   290,   270,   190,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   270,   230,   270,   190,   270}
-    ,{   270,   230,   270,   130,   270}
-    ,{   290,   290,   270,   130,   270}
-    }
-   }
-  ,{{{   310,   260,   310,   260,   300}
-    ,{   310,   260,   310,   260,   300}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    }
-   ,{{   290,   260,   290,   260,   270}
-    ,{   290,   260,   290,   260,   270}
-    ,{   250,   220,   250,   220,   240}
-    ,{   230,   140,   230,   140,   220}
-    ,{   250,   220,   250,   220,   240}
-    }
-   ,{{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    }
-   ,{{   310,   220,   310,   220,   300}
-    ,{   310,   220,   310,   220,   300}
-    ,{   250,   220,   250,   220,   240}
-    ,{   120,    90,   120,    90,   110}
-    ,{   250,   220,   250,   220,   240}
-    }
-   ,{{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    ,{   250,   220,   250,   220,   240}
-    }
-   }
-  ,{{{   300,   190,   300,   210,   300}
-    ,{   300,   170,   300,   210,   300}
-    ,{   270,   190,   270,    80,   270}
-    ,{   270,   130,   270,   210,   270}
-    ,{   270,   190,   270,   210,   270}
-    }
-   ,{{   300,   170,   300,   130,   300}
-    ,{   300,   170,   300,   110,   300}
-    ,{   270,   130,   270,    80,   270}
-    ,{   190,    50,   190,   130,   190}
-    ,{   270,   130,   270,    80,   270}
-    }
-   ,{{   270,   190,   270,    80,   270}
-    ,{   270,   130,   270,    80,   270}
-    ,{   270,   190,   270,    80,   270}
-    ,{   270,   130,   270,    80,   270}
-    ,{   270,   190,   270,    80,   270}
-    }
-   ,{{   270,   130,   270,   210,   270}
-    ,{   270,   130,   270,   210,   270}
-    ,{   270,   130,   270,    80,   270}
-    ,{   210,   130,   140,   210,   140}
-    ,{   270,   130,   270,    80,   270}
-    }
-   ,{{   270,   190,   270,   210,   270}
-    ,{   270,   130,   270,    80,   270}
-    ,{   270,   190,   270,    80,   270}
-    ,{   270,   130,   270,    80,   270}
-    ,{   270,   130,   270,   210,   270}
-    }
-   }
-  ,{{{   300,   260,   300,   260,   240}
-    ,{   300,   260,   300,   260,   240}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    }
-   ,{{   270,   260,   270,   260,   240}
-    ,{   270,   260,   270,   260,   240}
-    ,{   240,   220,   240,   220,   150}
-    ,{   220,   140,   220,   140,    70}
-    ,{   240,   220,   240,   220,   150}
-    }
-   ,{{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    }
-   ,{{   300,   220,   300,   220,   150}
-    ,{   300,   220,   300,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   150,    90,   110,    90,   150}
-    ,{   240,   220,   240,   220,   150}
-    }
-   ,{{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    ,{   240,   220,   240,   220,   150}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   220,   220,   190,   150,   150}
-    ,{   170,   170,   150,   150,   150}
-    ,{   220,   220,   190,   130,   140}
-    ,{   170,   170,   150,   150,   150}
-    ,{   140,   140,   120,   140,   120}
-    }
-   ,{{   150,   130,   110,   110,   150}
-    ,{   150,   130,   110,   110,   150}
-    ,{   130,   130,   110,   100,   110}
-    ,{    90,    10,    70,    10,    90}
-    ,{   130,   130,   100,   100,   110}
-    }
-   ,{{   220,   220,   190,   150,   150}
-    ,{   150,   150,   150,   150,   150}
-    ,{   220,   220,   190,   130,   140}
-    ,{   170,   170,   150,   150,   150}
-    ,{   140,   140,   120,   120,   120}
-    }
-   ,{{   140,   130,   100,   100,   140}
-    ,{    90,    10,    70,    10,    90}
-    ,{   130,   130,   100,   100,   110}
-    ,{   140,   -10,    20,    80,   140}
-    ,{   130,   130,   100,   100,   110}
-    }
-   ,{{   170,   170,   170,   150,   150}
-    ,{   170,   170,   150,   150,   150}
-    ,{   170,   140,   170,   120,   120}
-    ,{   170,   170,   150,   150,   150}
-    ,{   140,   140,    30,   140,    30}
-    }
-   }
-  ,{{{   220,   220,   190,   140,   140}
-    ,{   170,   170,   140,    40,   140}
-    ,{   220,   220,   190,    70,   130}
-    ,{   170,   170,   140,    30,   140}
-    ,{   140,   140,   110,   140,   110}
-    }
-   ,{{   130,   130,   110,    70,   100}
-    ,{   130,   130,   100,    40,   100}
-    ,{   130,   130,   110,    70,   100}
-    ,{    70,   -20,    70,   -50,    10}
-    ,{   130,   130,   100,   -10,   100}
-    }
-   ,{{   220,   220,   190,    70,   140}
-    ,{   140,    60,    50,    30,   140}
-    ,{   220,   220,   190,    70,   130}
-    ,{   170,   170,   140,    30,   140}
-    ,{   140,   140,   110,    50,   110}
-    }
-   ,{{   130,   130,   100,   -10,   100}
-    ,{    10,     0,  -100,   -70,    10}
-    ,{   130,   130,   100,   -10,   100}
-    ,{   -10,   -10,   -50,   -30,   -50}
-    ,{   130,   130,   100,   -10,   100}
-    }
-   ,{{   170,   170,   140,   140,   140}
-    ,{   170,   170,   140,    30,   140}
-    ,{   140,   140,   110,    60,   110}
-    ,{   170,   170,   140,    30,   140}
-    ,{   140,   140,    30,   140,    20}
-    }
-   }
-  ,{{{   150,   150,   150,   150,   150}
-    ,{   150,   150,   150,   150,   150}
-    ,{   140,   130,   130,   130,   140}
-    ,{   150,   150,   150,   150,   150}
-    ,{   120,   120,   120,   120,   120}
-    }
-   ,{{   110,   110,   110,   110,   110}
-    ,{   110,   110,   110,   110,   110}
-    ,{   110,   100,   100,   100,   110}
-    ,{    80,   -40,    70,    10,    80}
-    ,{   110,   100,   100,   100,   110}
-    }
-   ,{{   150,   150,   150,   150,   150}
-    ,{   150,   150,   150,   150,   150}
-    ,{   140,   130,   130,   130,   140}
-    ,{   150,   150,   150,   150,   150}
-    ,{   120,   120,   120,   120,   120}
-    }
-   ,{{   110,   100,   100,   100,   110}
-    ,{    80,   -70,   -60,    10,    80}
-    ,{   110,   100,   100,   100,   110}
-    ,{   -40,   -40,   -40,   -40,   -50}
-    ,{   110,   100,   100,   100,   110}
-    }
-   ,{{   150,   150,   150,   150,   150}
-    ,{   150,   150,   150,   150,   150}
-    ,{   120,   120,   120,   120,   120}
-    ,{   150,   150,   150,   150,   150}
-    ,{    30,    30,    30,    30,    30}
-    }
-   }
-  ,{{{   140,    70,   140,    80,   140}
-    ,{   140,    10,   140,    10,   140}
-    ,{   130,    70,   130,    20,   130}
-    ,{   140,   -30,   140,    80,   140}
-    ,{   110,    50,   110,    70,   110}
-    }
-   ,{{   100,   -30,   100,   -30,   100}
-    ,{   100,   -30,   100,   -30,   100}
-    ,{   100,   -70,   100,   -40,   100}
-    ,{    10,  -170,    10,   -30,    10}
-    ,{   100,   -70,   100,   -40,   100}
-    }
-   ,{{   140,    70,   140,    10,   140}
-    ,{   140,    10,   140,   -30,   140}
-    ,{   130,    70,   130,   -10,   130}
-    ,{   140,   -30,   140,    10,   140}
-    ,{   110,     0,   110,   -60,   110}
-    }
-   ,{{   100,   -70,   100,    80,   100}
-    ,{    10,  -160,    10,     0,    10}
-    ,{   100,   -70,   100,   -40,   100}
-    ,{    80,   -90,   -50,    80,   -50}
-    ,{   100,   -70,   100,   -40,   100}
-    }
-   ,{{   140,    50,   140,    70,   140}
-    ,{   140,   -30,   140,    10,   140}
-    ,{   110,     0,   110,    20,   110}
-    ,{   140,   -30,   140,    10,   140}
-    ,{    70,    50,    20,    70,    20}
-    }
-   }
-  ,{{{   170,   150,   170,   150,   150}
-    ,{   150,   150,   150,   150,   150}
-    ,{   170,   130,   170,   130,    30}
-    ,{   150,   150,   150,   150,   140}
-    ,{   120,   120,   120,   120,    40}
-    }
-   ,{{   150,   110,   110,   110,   150}
-    ,{   150,   110,   110,   110,   150}
-    ,{   100,   100,   100,   100,   -20}
-    ,{    90,    10,    70,    10,    90}
-    ,{   100,   100,   100,   100,    30}
-    }
-   ,{{   150,   150,   150,   150,    70}
-    ,{   150,   150,   150,   150,     0}
-    ,{   130,   130,   130,   130,   -10}
-    ,{   150,   150,   150,   150,    70}
-    ,{   120,   120,   120,   120,    40}
-    }
-   ,{{   140,   100,   100,   100,   140}
-    ,{    90,    10,    70,    10,    90}
-    ,{   100,   100,   100,   100,    30}
-    ,{   140,   -40,    20,   -40,   140}
-    ,{   100,   100,   100,   100,    30}
-    }
-   ,{{   170,   150,   170,   150,    70}
-    ,{   150,   150,   150,   150,    70}
-    ,{   170,   120,   170,   120,    20}
-    ,{   150,   150,   150,   150,    70}
-    ,{    30,    30,    30,    30,   -60}
-    }
-   }
-  }
- ,{{{{   150,   150,   120,   120,   130}
-    ,{   150,   150,   120,   120,   130}
-    ,{   130,   130,   100,   100,   110}
-    ,{   120,   120,    90,    90,   100}
-    ,{   120,   120,   100,   100,   100}
-    }
-   ,{{   150,   150,   120,   120,   130}
-    ,{   150,   150,   120,   120,   130}
-    ,{   120,   120,   100,   100,   100}
-    ,{   -10,   -50,   -20,   -80,   -10}
-    ,{   120,   120,   100,   100,   100}
-    }
-   ,{{   120,   120,   100,   100,   100}
-    ,{   120,   120,    90,    90,   100}
-    ,{   120,   120,   100,   100,   100}
-    ,{   120,   120,    90,    90,   100}
-    ,{   120,   120,   100,   100,   100}
-    }
-   ,{{   120,   120,   100,   100,   100}
-    ,{    50,    10,    50,   -10,    50}
-    ,{   120,   120,   100,   100,   100}
-    ,{    80,   -20,   -40,    80,    10}
-    ,{   120,   120,   100,   100,   100}
-    }
-   ,{{   130,   130,   100,   100,   110}
-    ,{   120,   120,    90,    90,   100}
-    ,{   130,   130,   100,   100,   110}
-    ,{   120,   120,    90,    90,   100}
-    ,{   110,   110,    20,    20,    30}
-    }
-   }
-  ,{{{   150,   150,   120,    50,   120}
-    ,{   150,   150,   120,    10,   120}
-    ,{   130,   130,   100,    50,   100}
-    ,{   120,   120,    90,   -20,    90}
-    ,{   120,   120,    90,    50,    90}
-    }
-   ,{{   150,   150,   120,    10,   120}
-    ,{   150,   150,   120,    10,   120}
-    ,{   120,   120,    90,   -10,    90}
-    ,{   -50,   -50,   -80,  -190,   -80}
-    ,{   120,   120,    90,   -10,    90}
-    }
-   ,{{   120,   120,    90,    50,    90}
-    ,{   120,   120,    90,   -20,    90}
-    ,{   120,   120,    90,    50,    90}
-    ,{   120,   120,    90,   -20,    90}
-    ,{   120,   120,    90,    50,    90}
-    }
-   ,{{   120,   120,    90,   -10,    90}
-    ,{    10,    10,   -20,  -130,   -20}
-    ,{   120,   120,    90,   -10,    90}
-    ,{   -20,   -20,   -50,   -20,   -50}
-    ,{   120,   120,    90,   -10,    90}
-    }
-   ,{{   130,   130,   100,    50,   100}
-    ,{   120,   120,    90,   -20,    90}
-    ,{   130,   130,   100,    50,   100}
-    ,{   120,   120,    90,   -20,    90}
-    ,{   110,   110,    20,   -90,    20}
-    }
-   }
-  ,{{{   130,   120,   120,   120,   130}
-    ,{   130,   120,   120,   120,   130}
-    ,{   110,   100,   100,   100,   110}
-    ,{   100,    90,    90,    90,   100}
-    ,{   100,   100,   100,   100,   100}
-    }
-   ,{{   130,   120,   120,   120,   130}
-    ,{   130,   120,   120,   120,   130}
-    ,{   100,   100,   100,   100,   100}
-    ,{   -10,   -80,   -20,   -80,   -10}
-    ,{   100,   100,   100,   100,   100}
-    }
-   ,{{   100,   100,   100,   100,   100}
-    ,{   100,    90,    90,    90,   100}
-    ,{   100,   100,   100,   100,   100}
-    ,{   100,    90,    90,    90,   100}
-    ,{   100,   100,   100,   100,   100}
-    }
-   ,{{   100,   100,   100,   100,   100}
-    ,{    50,   -10,    50,   -10,    50}
-    ,{   100,   100,   100,   100,   100}
-    ,{   -40,   -40,   -40,   -40,   -40}
-    ,{   100,   100,   100,   100,   100}
-    }
-   ,{{   110,   100,   100,   100,   110}
-    ,{   100,    90,    90,    90,   100}
-    ,{   110,   100,   100,   100,   110}
-    ,{   100,    90,    90,    90,   100}
-    ,{    30,    20,    20,    20,    30}
-    }
-   }
-  ,{{{   120,   -10,   120,    80,   120}
-    ,{   120,   -50,   120,   -20,   120}
-    ,{   100,   -10,   100,   -40,   100}
-    ,{    90,   -80,    90,    80,    90}
-    ,{    90,   -20,    90,    10,    90}
-    }
-   ,{{   120,   -50,   120,   -20,   120}
-    ,{   120,   -50,   120,   -20,   120}
-    ,{    90,   -80,    90,   -40,    90}
-    ,{   -80,  -260,   -80,   -90,   -80}
-    ,{    90,   -80,    90,   -40,    90}
-    }
-   ,{{    90,   -20,    90,   -40,    90}
-    ,{    90,   -80,    90,   -50,    90}
-    ,{    90,   -20,    90,   -40,    90}
-    ,{    90,   -80,    90,   -50,    90}
-    ,{    90,   -20,    90,   -40,    90}
-    }
-   ,{{    90,   -80,    90,    80,    90}
-    ,{   -20,  -190,   -20,   -20,   -20}
-    ,{    90,   -80,    90,   -40,    90}
-    ,{    80,   -90,   -50,    80,   -50}
-    ,{    90,   -80,    90,   -40,    90}
-    }
-   ,{{   100,   -10,   100,    10,   100}
-    ,{    90,   -80,    90,   -50,    90}
-    ,{   100,   -10,   100,   -40,   100}
-    ,{    90,   -80,    90,   -50,    90}
-    ,{    20,  -150,    20,    10,    20}
-    }
-   }
-  ,{{{   120,   120,   120,   120,   110}
-    ,{   120,   120,   120,   120,   110}
-    ,{   100,   100,   100,   100,    30}
-    ,{    90,    90,    90,    90,    20}
-    ,{   100,   100,   100,   100,    20}
-    }
-   ,{{   120,   120,   120,   120,   110}
-    ,{   120,   120,   120,   120,   110}
-    ,{   100,   100,   100,   100,    20}
-    ,{   -20,   -80,   -20,   -80,  -150}
-    ,{   100,   100,   100,   100,    20}
-    }
-   ,{{   100,   100,   100,   100,    20}
-    ,{    90,    90,    90,    90,    20}
-    ,{   100,   100,   100,   100,    20}
-    ,{    90,    90,    90,    90,    20}
-    ,{   100,   100,   100,   100,    20}
-    }
-   ,{{   100,   100,   100,   100,    20}
-    ,{    50,   -10,    50,   -10,   -90}
-    ,{   100,   100,   100,   100,    20}
-    ,{    10,   -40,   -40,   -40,    10}
-    ,{   100,   100,   100,   100,    20}
-    }
-   ,{{   100,   100,   100,   100,    30}
-    ,{    90,    90,    90,    90,    20}
-    ,{   100,   100,   100,   100,    30}
-    ,{    90,    90,    90,    90,    20}
-    ,{    20,    20,    20,    20,   -50}
-    }
-   }
-  }
- ,{{{{   300,   300,   250,   250,   260}
-    ,{   280,   280,   250,   250,   260}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   300,   300,   220,   220,   220}
-    }
-   ,{{   280,   280,   250,   250,   260}
-    ,{   280,   280,   250,   250,   260}
-    ,{   240,   240,   220,   220,   220}
-    ,{   200,   160,   200,   140,   200}
-    ,{   240,   240,   220,   220,   220}
-    }
-   ,{{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    }
-   ,{{   240,   240,   240,   220,   240}
-    ,{   240,   200,   240,   180,   240}
-    ,{   240,   240,   220,   220,   220}
-    ,{   210,   110,    90,   210,   140}
-    ,{   240,   240,   220,   220,   220}
-    }
-   ,{{   300,   300,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   300,   300,   220,   220,   220}
-    }
-   }
-  ,{{{   300,   300,   250,   160,   250}
-    ,{   280,   280,   250,   140,   250}
-    ,{   240,   240,   210,   160,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   300,   300,   210,   160,   210}
-    }
-   ,{{   280,   280,   250,   140,   250}
-    ,{   280,   280,   250,   140,   250}
-    ,{   240,   240,   210,   100,   210}
-    ,{   160,   160,   130,    20,   130}
-    ,{   240,   240,   210,   100,   210}
-    }
-   ,{{   240,   240,   210,   160,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   240,   240,   210,   160,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   240,   240,   210,   160,   210}
-    }
-   ,{{   240,   240,   210,   100,   210}
-    ,{   200,   200,   170,    60,   170}
-    ,{   240,   240,   210,   100,   210}
-    ,{   110,   110,    80,   100,    80}
-    ,{   240,   240,   210,   100,   210}
-    }
-   ,{{   300,   300,   210,   160,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   240,   240,   210,   160,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   300,   300,   210,   100,   210}
-    }
-   }
-  ,{{{   260,   250,   250,   250,   260}
-    ,{   260,   250,   250,   250,   260}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   260,   250,   250,   250,   260}
-    ,{   260,   250,   250,   250,   260}
-    ,{   220,   220,   220,   220,   220}
-    ,{   200,   140,   200,   140,   200}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   240,   220,   240,   220,   240}
-    ,{   240,   180,   240,   180,   240}
-    ,{   220,   220,   220,   220,   220}
-    ,{    90,    90,    90,    90,    90}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    }
-   }
-  ,{{{   250,   100,   250,   210,   250}
-    ,{   250,    70,   250,   170,   250}
-    ,{   210,   100,   210,    80,   210}
-    ,{   210,    40,   210,   210,   210}
-    ,{   210,   100,   210,   210,   210}
-    }
-   ,{{   250,    70,   250,   130,   250}
-    ,{   250,    70,   250,   110,   250}
-    ,{   210,    40,   210,    80,   210}
-    ,{   130,   -40,   130,   130,   130}
-    ,{   210,    40,   210,    80,   210}
-    }
-   ,{{   210,   100,   210,    80,   210}
-    ,{   210,    40,   210,    80,   210}
-    ,{   210,   100,   210,    80,   210}
-    ,{   210,    40,   210,    80,   210}
-    ,{   210,   100,   210,    80,   210}
-    }
-   ,{{   210,    40,   210,   210,   210}
-    ,{   170,     0,   170,   170,   170}
-    ,{   210,    40,   210,    80,   210}
-    ,{   210,    40,    80,   210,    80}
-    ,{   210,    40,   210,    80,   210}
-    }
-   ,{{   210,   100,   210,   210,   210}
-    ,{   210,    40,   210,    80,   210}
-    ,{   210,   100,   210,    80,   210}
-    ,{   210,    40,   210,    80,   210}
-    ,{   210,    40,   210,   210,   210}
-    }
-   }
-  ,{{{   250,   250,   250,   250,   240}
-    ,{   250,   250,   250,   250,   240}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    }
-   ,{{   250,   250,   250,   250,   240}
-    ,{   250,   250,   250,   250,   240}
-    ,{   220,   220,   220,   220,   140}
-    ,{   200,   140,   200,   140,    60}
-    ,{   220,   220,   220,   220,   140}
-    }
-   ,{{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    }
-   ,{{   240,   220,   240,   220,   140}
-    ,{   240,   180,   240,   180,   100}
-    ,{   220,   220,   220,   220,   140}
-    ,{   140,    90,    90,    90,   140}
-    ,{   220,   220,   220,   220,   140}
-    }
-   ,{{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    }
-   }
-  }
- ,{{{{   280,   270,   280,   220,   280}
-    ,{   280,   240,   280,   220,   280}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   270,   270,   190,   190,   190}
-    }
-   ,{{   210,   210,   190,   190,   190}
-    ,{   190,   190,   150,   150,   160}
-    ,{   210,   210,   190,   190,   190}
-    ,{   120,    80,   110,    50,   120}
-    ,{   210,   210,   190,   190,   190}
-    }
-   ,{{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    }
-   ,{{   280,   240,   280,   220,   280}
-    ,{   280,   240,   280,   220,   280}
-    ,{   210,   210,   190,   190,   190}
-    ,{   180,    80,    60,   180,   110}
-    ,{   210,   210,   190,   190,   190}
-    }
-   ,{{   270,   270,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   270,   270,   190,   190,   190}
-    }
-   }
-  ,{{{   270,   270,   210,   130,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   210,   210,   180,   130,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   270,   270,   180,   130,   180}
-    }
-   ,{{   210,   210,   180,    70,   180}
-    ,{   190,   190,   150,    40,   150}
-    ,{   210,   210,   180,    70,   180}
-    ,{    80,    80,    50,   -60,    50}
-    ,{   210,   210,   180,    70,   180}
-    }
-   ,{{   210,   210,   180,   130,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   210,   210,   180,   130,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   210,   210,   180,   130,   180}
-    }
-   ,{{   240,   240,   210,   100,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   210,   210,   180,    70,   180}
-    ,{    80,    80,    50,    70,    50}
-    ,{   210,   210,   180,    70,   180}
-    }
-   ,{{   270,   270,   180,   130,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   210,   210,   180,   130,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   270,   270,   180,    70,   180}
-    }
-   }
-  ,{{{   280,   220,   280,   220,   280}
-    ,{   280,   220,   280,   220,   280}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   160,   150,   150,   150,   160}
-    ,{   190,   190,   190,   190,   190}
-    ,{   120,    50,   110,    50,   120}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   280,   220,   280,   220,   280}
-    ,{   280,   220,   280,   220,   280}
-    ,{   190,   190,   190,   190,   190}
-    ,{    60,    60,    60,    60,    60}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    }
-   }
-  ,{{{   210,    70,   210,   210,   210}
-    ,{   210,    40,   210,   210,   210}
-    ,{   180,    70,   180,    50,   180}
-    ,{   180,    10,   180,   180,   180}
-    ,{   180,    70,   180,   180,   180}
-    }
-   ,{{   180,    10,   180,    50,   180}
-    ,{   150,   -20,   150,    10,   150}
-    ,{   180,    10,   180,    50,   180}
-    ,{    50,  -120,    50,    40,    50}
-    ,{   180,    10,   180,    50,   180}
-    }
-   ,{{   180,    70,   180,    50,   180}
-    ,{   180,    10,   180,    50,   180}
-    ,{   180,    70,   180,    50,   180}
-    ,{   180,    10,   180,    50,   180}
-    ,{   180,    70,   180,    50,   180}
-    }
-   ,{{   210,    40,   210,   210,   210}
-    ,{   210,    40,   210,   210,   210}
-    ,{   180,    10,   180,    50,   180}
-    ,{   180,    10,    50,   180,    50}
-    ,{   180,    10,   180,    50,   180}
-    }
-   ,{{   180,    70,   180,   180,   180}
-    ,{   180,    10,   180,    50,   180}
-    ,{   180,    70,   180,    50,   180}
-    ,{   180,    10,   180,    50,   180}
-    ,{   180,    10,   180,   180,   180}
-    }
-   }
-  ,{{{   280,   220,   280,   220,   140}
-    ,{   280,   220,   280,   220,   140}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    }
-   ,{{   190,   190,   190,   190,   140}
-    ,{   150,   150,   150,   150,   140}
-    ,{   190,   190,   190,   190,   110}
-    ,{   110,    50,   110,    50,   -20}
-    ,{   190,   190,   190,   190,   110}
-    }
-   ,{{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    }
-   ,{{   280,   220,   280,   220,   140}
-    ,{   280,   220,   280,   220,   140}
-    ,{   190,   190,   190,   190,   110}
-    ,{   110,    60,    60,    60,   110}
-    ,{   190,   190,   190,   190,   110}
-    }
-   ,{{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    }
-   }
-  }
- ,{{{{   210,   210,   190,   190,   200}
-    ,{   210,   210,   190,   190,   200}
-    ,{   190,   190,   170,   170,   170}
-    ,{   200,   200,   170,   170,   180}
-    ,{   190,   190,   170,   170,   170}
-    }
-   ,{{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   190,   190,   160,   160,   170}
-    ,{   130,    90,   120,    60,   130}
-    ,{   190,   190,   160,   160,   170}
-    }
-   ,{{   200,   200,   170,   170,   180}
-    ,{   200,   200,   170,   170,   180}
-    ,{   190,   190,   170,   170,   170}
-    ,{   200,   200,   170,   170,   180}
-    ,{   190,   190,   170,   170,   170}
-    }
-   ,{{   200,   190,   190,   160,   200}
-    ,{   200,   160,   190,   130,   200}
-    ,{   190,   190,   160,   160,   170}
-    ,{   130,    40,    10,   130,    70}
-    ,{   190,   190,   160,   160,   170}
-    }
-   ,{{   200,   200,   170,   170,   180}
-    ,{   200,   200,   170,   170,   180}
-    ,{   190,   190,   170,   170,   170}
-    ,{   200,   200,   170,   170,   180}
-    ,{   160,   160,    80,    80,    80}
-    }
-   }
-  ,{{{   210,   210,   180,   110,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   190,   190,   160,   110,   160}
-    ,{   200,   200,   170,    60,   170}
-    ,{   190,   190,   160,   110,   160}
-    }
-   ,{{   210,   210,   180,    70,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   190,   190,   160,    50,   160}
-    ,{    90,    90,    60,   -50,    60}
-    ,{   190,   190,   160,    50,   160}
-    }
-   ,{{   200,   200,   170,   110,   170}
-    ,{   200,   200,   170,    60,   170}
-    ,{   190,   190,   160,   110,   160}
-    ,{   200,   200,   170,    60,   170}
-    ,{   190,   190,   160,   110,   160}
-    }
-   ,{{   190,   190,   160,    50,   160}
-    ,{   160,   160,   130,    20,   130}
-    ,{   190,   190,   160,    50,   160}
-    ,{    40,    40,    10,    30,    10}
-    ,{   190,   190,   160,    50,   160}
-    }
-   ,{{   200,   200,   170,   110,   170}
-    ,{   200,   200,   170,    60,   170}
-    ,{   190,   190,   160,   110,   160}
-    ,{   200,   200,   170,    60,   170}
-    ,{   160,   160,    70,   -30,    70}
-    }
-   }
-  ,{{{   200,   190,   190,   190,   200}
-    ,{   200,   190,   190,   190,   200}
-    ,{   170,   170,   170,   170,   170}
-    ,{   180,   170,   170,   170,   180}
-    ,{   170,   170,   170,   170,   170}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   170,   160,   160,   160,   170}
-    ,{   130,    60,   120,    60,   130}
-    ,{   170,   160,   160,   160,   170}
-    }
-   ,{{   180,   170,   170,   170,   180}
-    ,{   180,   170,   170,   170,   180}
-    ,{   170,   170,   170,   170,   170}
-    ,{   180,   170,   170,   170,   180}
-    ,{   170,   170,   170,   170,   170}
-    }
-   ,{{   200,   160,   190,   160,   200}
-    ,{   200,   130,   190,   130,   200}
-    ,{   170,   160,   160,   160,   170}
-    ,{    20,    10,    10,    10,    20}
-    ,{   170,   160,   160,   160,   170}
-    }
-   ,{{   180,   170,   170,   170,   180}
-    ,{   180,   170,   170,   170,   180}
-    ,{   170,   170,   170,   170,   170}
-    ,{   180,   170,   170,   170,   180}
-    ,{    80,    80,    80,    80,    80}
-    }
-   }
-  ,{{{   180,    50,   180,   130,   180}
-    ,{   180,    10,   180,   120,   180}
-    ,{   160,    50,   160,    30,   160}
-    ,{   170,     0,   170,   130,   170}
-    ,{   160,    50,   160,    70,   160}
-    }
-   ,{{   180,    10,   180,    50,   180}
-    ,{   180,    10,   180,    50,   180}
-    ,{   160,   -10,   160,    20,   160}
-    ,{    60,  -110,    60,    50,    60}
-    ,{   160,   -10,   160,    20,   160}
-    }
-   ,{{   170,    50,   170,    30,   170}
-    ,{   170,     0,   170,    30,   170}
-    ,{   160,    50,   160,    30,   160}
-    ,{   170,     0,   170,    30,   170}
-    ,{   160,    50,   160,    30,   160}
-    }
-   ,{{   160,   -10,   160,   130,   160}
-    ,{   130,   -40,   130,   120,   130}
-    ,{   160,   -10,   160,    20,   160}
-    ,{   130,   -30,    10,   130,    10}
-    ,{   160,   -10,   160,    20,   160}
-    }
-   ,{{   170,    50,   170,    70,   170}
-    ,{   170,     0,   170,    30,   170}
-    ,{   160,    50,   160,    30,   160}
-    ,{   170,     0,   170,    30,   170}
-    ,{    70,  -100,    70,    70,    70}
-    }
-   }
-  ,{{{   190,   190,   190,   190,   170}
-    ,{   190,   190,   190,   190,   170}
-    ,{   170,   170,   170,   170,    90}
-    ,{   170,   170,   170,   170,   100}
-    ,{   170,   170,   170,   170,    90}
-    }
-   ,{{   190,   190,   190,   190,   170}
-    ,{   190,   190,   190,   190,   170}
-    ,{   160,   160,   160,   160,    90}
-    ,{   120,    60,   120,    60,   -10}
-    ,{   160,   160,   160,   160,    90}
-    }
-   ,{{   170,   170,   170,   170,   100}
-    ,{   170,   170,   170,   170,   100}
-    ,{   170,   170,   170,   170,    90}
-    ,{   170,   170,   170,   170,   100}
-    ,{   170,   170,   170,   170,    90}
-    }
-   ,{{   190,   160,   190,   160,    90}
-    ,{   190,   130,   190,   130,    60}
-    ,{   160,   160,   160,   160,    90}
-    ,{    70,    10,    10,    10,    70}
-    ,{   160,   160,   160,   160,    90}
-    }
-   ,{{   170,   170,   170,   170,   100}
-    ,{   170,   170,   170,   170,   100}
-    ,{   170,   170,   170,   170,    90}
-    ,{   170,   170,   170,   170,   100}
-    ,{    80,    80,    80,    80,     0}
-    }
-   }
-  }
- ,{{{{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    }
-   ,{{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   170,   170,   140,   140,   150}
-    ,{   150,   110,   140,    80,   150}
-    ,{   170,   170,   140,   140,   150}
-    }
-   ,{{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    }
-   ,{{   170,   170,   150,   150,   160}
-    ,{   160,   120,   150,    90,   160}
-    ,{   170,   170,   140,   140,   150}
-    ,{   150,    60,    30,   150,    90}
-    ,{   170,   170,   140,   140,   150}
-    }
-   ,{{   210,   210,   190,   190,   190}
-    ,{   210,   210,   190,   190,   190}
-    ,{   180,   180,   160,   160,   160}
-    ,{   210,   210,   190,   190,   190}
-    ,{   190,   190,   100,   100,   110}
-    }
-   }
-  ,{{{   210,   210,   180,   130,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   210,   210,   180,   130,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   210,   210,   180,   130,   180}
-    }
-   ,{{   210,   210,   180,    70,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   170,   170,   140,    30,   140}
-    ,{   110,   110,    80,   -30,    80}
-    ,{   170,   170,   140,    30,   140}
-    }
-   ,{{   210,   210,   180,   130,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   210,   210,   180,   130,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   210,   210,   180,   130,   180}
-    }
-   ,{{   170,   170,   140,    50,   140}
-    ,{   120,   120,    90,   -20,    90}
-    ,{   170,   170,   140,    30,   140}
-    ,{    60,    60,    30,    50,    30}
-    ,{   170,   170,   140,    30,   140}
-    }
-   ,{{   210,   210,   180,   100,   180}
-    ,{   210,   210,   180,    70,   180}
-    ,{   180,   180,   150,   100,   150}
-    ,{   210,   210,   180,    70,   180}
-    ,{   190,   190,   100,   -10,   100}
-    }
-   }
-  ,{{{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   150,   140,   140,   140,   150}
-    ,{   150,    80,   140,    80,   150}
-    ,{   150,   140,   140,   140,   150}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   160,   140,   150,   140,   160}
-    ,{   160,    90,   150,    90,   160}
-    ,{   150,   140,   140,   140,   150}
-    ,{    40,    30,    30,    30,    40}
-    ,{   150,   140,   140,   140,   150}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   160,   160,   160,   160,   160}
-    ,{   190,   190,   190,   190,   190}
-    ,{   110,   100,   100,   100,   110}
-    }
-   }
-  ,{{{   180,    70,   180,   150,   180}
-    ,{   180,    10,   180,    80,   180}
-    ,{   180,    70,   180,    50,   180}
-    ,{   180,    10,   180,   150,   180}
-    ,{   180,    70,   180,    90,   180}
-    }
-   ,{{   180,    10,   180,    70,   180}
-    ,{   180,    10,   180,    50,   180}
-    ,{   140,   -30,   140,     0,   140}
-    ,{    80,   -90,    80,    70,    80}
-    ,{   140,   -30,   140,     0,   140}
-    }
-   ,{{   180,    70,   180,    50,   180}
-    ,{   180,    10,   180,    50,   180}
-    ,{   180,    70,   180,    50,   180}
-    ,{   180,    10,   180,    50,   180}
-    ,{   180,    70,   180,    50,   180}
-    }
-   ,{{   150,   -10,   140,   150,   140}
-    ,{    90,   -80,    90,    80,    90}
-    ,{   140,   -30,   140,     0,   140}
-    ,{   150,   -10,    30,   150,    30}
-    ,{   140,   -30,   140,     0,   140}
-    }
-   ,{{   180,    40,   180,    90,   180}
-    ,{   180,    10,   180,    50,   180}
-    ,{   150,    40,   150,    20,   150}
-    ,{   180,    10,   180,    50,   180}
-    ,{   100,   -70,   100,    90,   100}
-    }
-   }
-  ,{{{   190,   190,   190,   190,   170}
-    ,{   190,   190,   190,   190,   170}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    }
-   ,{{   190,   190,   190,   190,   170}
-    ,{   190,   190,   190,   190,   170}
-    ,{   140,   140,   140,   140,    70}
-    ,{   140,    80,   140,    80,    10}
-    ,{   140,   140,   140,   140,    70}
-    }
-   ,{{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    }
-   ,{{   150,   140,   150,   140,    90}
-    ,{   150,    90,   150,    90,    20}
-    ,{   140,   140,   140,   140,    70}
-    ,{    90,    30,    30,    30,    90}
-    ,{   140,   140,   140,   140,    70}
-    }
-   ,{{   190,   190,   190,   190,   110}
-    ,{   190,   190,   190,   190,   110}
-    ,{   160,   160,   160,   160,    80}
-    ,{   190,   190,   190,   190,   110}
-    ,{   100,   100,   100,   100,    30}
-    }
-   }
-  }
- ,{{{{   300,   300,   280,   250,   280}
-    ,{   280,   280,   280,   250,   280}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   300,   300,   220,   220,   220}
-    }
-   ,{{   280,   280,   250,   250,   260}
-    ,{   280,   280,   250,   250,   260}
-    ,{   240,   240,   220,   220,   220}
-    ,{   200,   160,   200,   140,   200}
-    ,{   240,   240,   220,   220,   220}
-    }
-   ,{{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    }
-   ,{{   280,   240,   280,   220,   280}
-    ,{   280,   240,   280,   220,   280}
-    ,{   240,   240,   220,   220,   220}
-    ,{   210,   110,    90,   210,   140}
-    ,{   240,   240,   220,   220,   220}
-    }
-   ,{{   300,   300,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   240,   240,   220,   220,   220}
-    ,{   300,   300,   220,   220,   220}
-    }
-   }
-  ,{{{   300,   300,   250,   160,   250}
-    ,{   280,   280,   250,   140,   250}
-    ,{   240,   240,   210,   160,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   300,   300,   210,   160,   210}
-    }
-   ,{{   280,   280,   250,   140,   250}
-    ,{   280,   280,   250,   140,   250}
-    ,{   240,   240,   210,   100,   210}
-    ,{   160,   160,   130,    20,   130}
-    ,{   240,   240,   210,   100,   210}
-    }
-   ,{{   240,   240,   210,   160,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   240,   240,   210,   160,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   240,   240,   210,   160,   210}
-    }
-   ,{{   240,   240,   210,   100,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   110,   110,    80,   100,    80}
-    ,{   240,   240,   210,   100,   210}
-    }
-   ,{{   300,   300,   210,   160,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   240,   240,   210,   160,   210}
-    ,{   240,   240,   210,   100,   210}
-    ,{   300,   300,   210,   140,   210}
-    }
-   }
-  ,{{{   280,   250,   280,   250,   280}
-    ,{   280,   250,   280,   250,   280}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   260,   250,   250,   250,   260}
-    ,{   260,   250,   250,   250,   260}
-    ,{   220,   220,   220,   220,   220}
-    ,{   200,   140,   200,   140,   200}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   280,   220,   280,   220,   280}
-    ,{   280,   220,   280,   220,   280}
-    ,{   220,   220,   220,   220,   220}
-    ,{    90,    90,    90,    90,    90}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    ,{   220,   220,   220,   220,   220}
-    }
-   }
-  ,{{{   250,   100,   250,   210,   250}
-    ,{   250,    70,   250,   210,   250}
-    ,{   210,   100,   210,    80,   210}
-    ,{   210,    40,   210,   210,   210}
-    ,{   210,   100,   210,   210,   210}
-    }
-   ,{{   250,    70,   250,   130,   250}
-    ,{   250,    70,   250,   110,   250}
-    ,{   210,    40,   210,    80,   210}
-    ,{   130,   -40,   130,   130,   130}
-    ,{   210,    40,   210,    80,   210}
-    }
-   ,{{   210,   100,   210,    80,   210}
-    ,{   210,    40,   210,    80,   210}
-    ,{   210,   100,   210,    80,   210}
-    ,{   210,    40,   210,    80,   210}
-    ,{   210,   100,   210,    80,   210}
-    }
-   ,{{   210,    40,   210,   210,   210}
-    ,{   210,    40,   210,   210,   210}
-    ,{   210,    40,   210,    80,   210}
-    ,{   210,    40,    80,   210,    80}
-    ,{   210,    40,   210,    80,   210}
-    }
-   ,{{   210,   100,   210,   210,   210}
-    ,{   210,    40,   210,    80,   210}
-    ,{   210,   100,   210,    80,   210}
-    ,{   210,    40,   210,    80,   210}
-    ,{   210,    50,   210,   210,   210}
-    }
-   }
-  ,{{{   280,   250,   280,   250,   240}
-    ,{   280,   250,   280,   250,   240}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    }
-   ,{{   250,   250,   250,   250,   240}
-    ,{   250,   250,   250,   250,   240}
-    ,{   220,   220,   220,   220,   140}
-    ,{   200,   140,   200,   140,    90}
-    ,{   220,   220,   220,   220,   140}
-    }
-   ,{{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    }
-   ,{{   280,   220,   280,   220,   140}
-    ,{   280,   220,   280,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   140,    90,    90,    90,   140}
-    ,{   220,   220,   220,   220,   140}
-    }
-   ,{{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    ,{   220,   220,   220,   220,   140}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   300,   300,   270,   270,   290}
-    ,{   300,   300,   270,   270,   290}
-    ,{   290,   290,   250,   270,   250}
-    ,{   300,   300,   270,   270,   270}
-    ,{   270,   270,   240,   260,   240}
-    }
-   ,{{   290,   270,   230,   230,   290}
-    ,{   290,   270,   230,   230,   290}
-    ,{   260,   260,   220,   220,   220}
-    ,{   190,   170,   190,   130,   190}
-    ,{   260,   260,   220,   220,   220}
-    }
-   ,{{   300,   300,   270,   270,   270}
-    ,{   300,   300,   270,   270,   270}
-    ,{   290,   290,   250,   270,   250}
-    ,{   300,   300,   270,   270,   270}
-    ,{   270,   270,   240,   260,   240}
-    }
-   ,{{   260,   260,   220,   220,   220}
-    ,{   190,   170,   190,   130,   190}
-    ,{   260,   260,   220,   220,   220}
-    ,{   210,   130,    80,   210,   210}
-    ,{   260,   260,   220,   220,   220}
-    }
-   ,{{   300,   300,   270,   270,   270}
-    ,{   300,   300,   270,   270,   270}
-    ,{   270,   270,   240,   260,   240}
-    ,{   300,   300,   270,   270,   270}
-    ,{   240,   240,   150,   150,   150}
-    }
-   }
-  ,{{{   300,   300,   270,   270,   270}
-    ,{   300,   300,   270,   230,   270}
-    ,{   290,   290,   250,   270,   250}
-    ,{   300,   300,   270,   230,   270}
-    ,{   270,   270,   240,   260,   240}
-    }
-   ,{{   270,   270,   230,   190,   230}
-    ,{   270,   270,   230,   190,   230}
-    ,{   260,   260,   220,   180,   220}
-    ,{   170,   170,   130,    90,   130}
-    ,{   260,   260,   220,   180,   220}
-    }
-   ,{{   300,   300,   270,   270,   270}
-    ,{   300,   300,   270,   230,   270}
-    ,{   290,   290,   250,   270,   250}
-    ,{   300,   300,   270,   230,   270}
-    ,{   270,   270,   240,   260,   240}
-    }
-   ,{{   260,   260,   220,   180,   220}
-    ,{   170,   170,   130,    90,   130}
-    ,{   260,   260,   220,   180,   220}
-    ,{   170,   110,    80,   170,    80}
-    ,{   260,   260,   220,   180,   220}
-    }
-   ,{{   300,   300,   270,   260,   270}
-    ,{   300,   300,   270,   230,   270}
-    ,{   270,   270,   240,   260,   240}
-    ,{   300,   300,   270,   230,   270}
-    ,{   240,   240,   150,   110,   150}
-    }
-   }
-  ,{{{   270,   270,   270,   270,   270}
-    ,{   270,   270,   270,   270,   270}
-    ,{   250,   250,   250,   250,   250}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    }
-   ,{{   230,   230,   230,   230,   230}
-    ,{   230,   230,   230,   230,   230}
-    ,{   220,   220,   220,   220,   220}
-    ,{   190,   130,   190,   130,   190}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   270,   270,   270,   270,   270}
-    ,{   270,   270,   270,   270,   270}
-    ,{   250,   250,   250,   250,   250}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   190,   130,   190,   130,   190}
-    ,{   220,   220,   220,   220,   220}
-    ,{    80,    80,    80,    80,    80}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   270,   270,   270,   270,   270}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    ,{   270,   270,   270,   270,   270}
-    ,{   150,   150,   150,   150,   150}
-    }
-   }
-  ,{{{   270,   230,   270,   210,   270}
-    ,{   270,   190,   270,   140,   270}
-    ,{   250,   230,   250,   120,   250}
-    ,{   270,   190,   270,   210,   270}
-    ,{   240,   220,   240,   150,   240}
-    }
-   ,{{   230,   150,   230,   130,   230}
-    ,{   230,   150,   230,   100,   230}
-    ,{   220,   140,   220,    90,   220}
-    ,{   130,    50,   130,   130,   130}
-    ,{   220,   140,   220,    90,   220}
-    }
-   ,{{   270,   230,   270,   140,   270}
-    ,{   270,   190,   270,   140,   270}
-    ,{   250,   230,   250,   120,   250}
-    ,{   270,   190,   270,   140,   270}
-    ,{   240,   220,   240,   110,   240}
-    }
-   ,{{   220,   140,   220,   210,   220}
-    ,{   130,    50,   130,   130,   130}
-    ,{   220,   140,   220,    90,   220}
-    ,{   210,   130,    80,   210,    80}
-    ,{   220,   140,   220,    90,   220}
-    }
-   ,{{   270,   220,   270,   150,   270}
-    ,{   270,   190,   270,   140,   270}
-    ,{   240,   220,   240,   110,   240}
-    ,{   270,   190,   270,   140,   270}
-    ,{   150,    70,   150,   150,   150}
-    }
-   }
-  ,{{{   290,   270,   270,   270,   290}
-    ,{   290,   270,   270,   270,   290}
-    ,{   250,   250,   250,   250,   250}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    }
-   ,{{   290,   230,   230,   230,   290}
-    ,{   290,   230,   230,   230,   290}
-    ,{   220,   220,   220,   220,   220}
-    ,{   190,   130,   190,   130,   130}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   270,   270,   270,   270,   270}
-    ,{   270,   270,   270,   270,   270}
-    ,{   250,   250,   250,   250,   250}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   190,   130,   190,   130,   130}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,    80,    80,    80,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   270,   270,   270,   270,   270}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    ,{   270,   270,   270,   270,   270}
-    ,{   150,   150,   150,   150,   150}
-    }
-   }
-  }
- ,{{{{   300,   280,   240,   240,   300}
-    ,{   300,   280,   240,   240,   300}
-    ,{   260,   260,   220,   240,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   250,   250,   220,   240,   220}
-    }
-   ,{{   300,   280,   240,   240,   300}
-    ,{   300,   280,   240,   240,   300}
-    ,{   250,   250,   220,   220,   220}
-    ,{   100,    70,   100,    40,   100}
-    ,{   250,   250,   220,   220,   220}
-    }
-   ,{{   250,   250,   220,   240,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   250,   250,   220,   240,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   250,   250,   220,   240,   220}
-    }
-   ,{{   250,   250,   220,   220,   220}
-    ,{   160,   140,   160,   100,   160}
-    ,{   250,   250,   220,   220,   220}
-    ,{   210,   130,    80,   210,   210}
-    ,{   250,   250,   220,   220,   220}
-    }
-   ,{{   260,   260,   220,   240,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   260,   260,   220,   240,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   240,   240,   140,   140,   140}
-    }
-   }
-  ,{{{   280,   280,   240,   240,   240}
-    ,{   280,   280,   240,   200,   240}
-    ,{   260,   260,   220,   240,   220}
-    ,{   250,   250,   210,   170,   210}
-    ,{   250,   250,   220,   240,   220}
-    }
-   ,{{   280,   280,   240,   200,   240}
-    ,{   280,   280,   240,   200,   240}
-    ,{   250,   250,   220,   180,   220}
-    ,{    70,    70,    40,     0,    40}
-    ,{   250,   250,   220,   180,   220}
-    }
-   ,{{   250,   250,   220,   240,   220}
-    ,{   250,   250,   210,   170,   210}
-    ,{   250,   250,   220,   240,   220}
-    ,{   250,   250,   210,   170,   210}
-    ,{   250,   250,   220,   240,   220}
-    }
-   ,{{   250,   250,   220,   180,   220}
-    ,{   140,   140,   100,    60,   100}
-    ,{   250,   250,   220,   180,   220}
-    ,{   170,   110,    80,   170,    80}
-    ,{   250,   250,   220,   180,   220}
-    }
-   ,{{   260,   260,   220,   240,   220}
-    ,{   250,   250,   210,   170,   210}
-    ,{   260,   260,   220,   240,   220}
-    ,{   250,   250,   210,   170,   210}
-    ,{   240,   240,   140,   100,   140}
-    }
-   }
-  ,{{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   220,   220,   220,   220,   220}
-    ,{   100,    40,   100,    40,   100}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   160,   100,   160,   100,   160}
-    ,{   220,   220,   220,   220,   220}
-    ,{    80,    80,    80,    80,    80}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   140,   140,   140,   140,   140}
-    }
-   }
-  ,{{{   240,   200,   240,   210,   240}
-    ,{   240,   160,   240,   110,   240}
-    ,{   220,   200,   220,    90,   220}
-    ,{   210,   130,   210,   210,   210}
-    ,{   220,   200,   220,   140,   220}
-    }
-   ,{{   240,   160,   240,   110,   240}
-    ,{   240,   160,   240,   110,   240}
-    ,{   220,   140,   220,    90,   220}
-    ,{    40,   -40,    40,    40,    40}
-    ,{   220,   140,   220,    90,   220}
-    }
-   ,{{   220,   200,   220,    90,   220}
-    ,{   210,   130,   210,    80,   210}
-    ,{   220,   200,   220,    90,   220}
-    ,{   210,   130,   210,    80,   210}
-    ,{   220,   200,   220,    90,   220}
-    }
-   ,{{   220,   140,   220,   210,   220}
-    ,{   100,    20,   100,   100,   100}
-    ,{   220,   140,   220,    90,   220}
-    ,{   210,   130,    80,   210,    80}
-    ,{   220,   140,   220,    90,   220}
-    }
-   ,{{   220,   200,   220,   140,   220}
-    ,{   210,   130,   210,    80,   210}
-    ,{   220,   200,   220,    90,   220}
-    ,{   210,   130,   210,    80,   210}
-    ,{   140,    60,   140,   140,   140}
-    }
-   }
-  ,{{{   300,   240,   240,   240,   300}
-    ,{   300,   240,   240,   240,   300}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   300,   240,   240,   240,   300}
-    ,{   300,   240,   240,   240,   300}
-    ,{   220,   220,   220,   220,   220}
-    ,{   100,    40,   100,    40,    40}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   160,   100,   160,   100,   100}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,    80,    80,    80,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   140,   140,   140,   140,   140}
-    }
-   }
-  }
- ,{{{{   430,   430,   370,   370,   430}
-    ,{   430,   410,   370,   370,   430}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   360,   340}
-    }
-   ,{{   430,   410,   370,   370,   430}
-    ,{   430,   410,   370,   370,   430}
-    ,{   370,   370,   340,   340,   340}
-    ,{   320,   290,   320,   260,   320}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   370,   370,   340,   360,   340}
-    }
-   ,{{   370,   370,   360,   340,   360}
-    ,{   360,   330,   360,   300,   360}
-    ,{   370,   370,   340,   340,   340}
-    ,{   340,   260,   210,   340,   340}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   430,   430,   340,   360,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   340,   340}
-    }
-   }
-  ,{{{   430,   430,   370,   360,   370}
-    ,{   410,   410,   370,   330,   370}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   430,   430,   340,   360,   340}
-    }
-   ,{{   410,   410,   370,   330,   370}
-    ,{   410,   410,   370,   330,   370}
-    ,{   370,   370,   340,   300,   340}
-    ,{   290,   290,   260,   220,   260}
-    ,{   370,   370,   340,   300,   340}
-    }
-   ,{{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   370,   370,   340,   360,   340}
-    }
-   ,{{   370,   370,   340,   300,   340}
-    ,{   330,   330,   300,   260,   300}
-    ,{   370,   370,   340,   300,   340}
-    ,{   300,   240,   210,   300,   210}
-    ,{   370,   370,   340,   300,   340}
-    }
-   ,{{   430,   430,   340,   360,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   430,   430,   340,   300,   340}
-    }
-   }
-  ,{{{   370,   370,   370,   370,   370}
-    ,{   370,   370,   370,   370,   370}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   370,   370,   370,   370,   370}
-    ,{   370,   370,   370,   370,   370}
-    ,{   340,   340,   340,   340,   340}
-    ,{   320,   260,   320,   260,   320}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   360,   340,   360,   340,   360}
-    ,{   360,   300,   360,   300,   360}
-    ,{   340,   340,   340,   340,   340}
-    ,{   210,   210,   210,   210,   210}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   }
-  ,{{{   370,   320,   370,   340,   370}
-    ,{   370,   290,   370,   300,   370}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   340,   340}
-    ,{   340,   320,   340,   340,   340}
-    }
-   ,{{   370,   290,   370,   260,   370}
-    ,{   370,   290,   370,   240,   370}
-    ,{   340,   260,   340,   210,   340}
-    ,{   260,   180,   260,   260,   260}
-    ,{   340,   260,   340,   210,   340}
-    }
-   ,{{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    }
-   ,{{   340,   260,   340,   340,   340}
-    ,{   300,   220,   300,   300,   300}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   260,   210,   340,   210}
-    ,{   340,   260,   340,   210,   340}
-    }
-   ,{{   340,   320,   340,   340,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   260,   340,   340,   340}
-    }
-   }
-  ,{{{   430,   370,   370,   370,   430}
-    ,{   430,   370,   370,   370,   430}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   430,   370,   370,   370,   430}
-    ,{   430,   370,   370,   370,   430}
-    ,{   340,   340,   340,   340,   340}
-    ,{   320,   260,   320,   260,   260}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   360,   340,   360,   340,   340}
-    ,{   360,   300,   360,   300,   300}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   210,   210,   210,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   }
-  }
- ,{{{{   400,   400,   400,   360,   400}
-    ,{   400,   370,   400,   360,   400}
-    ,{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   400,   400,   310,   330,   310}
-    }
-   ,{{   360,   360,   310,   360,   330}
-    ,{   360,   360,   270,   360,   330}
-    ,{   340,   340,   310,   310,   310}
-    ,{   230,   220,   230,   170,   230}
-    ,{   340,   340,   310,   310,   310}
-    }
-   ,{{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   340,   340,   310,   330,   310}
-    }
-   ,{{   400,   370,   400,   340,   400}
-    ,{   400,   370,   400,   340,   400}
-    ,{   340,   340,   310,   310,   310}
-    ,{   310,   230,   180,   310,   310}
-    ,{   340,   340,   310,   310,   310}
-    }
-   ,{{   400,   400,   310,   330,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   400,   400,   310,   310,   310}
-    }
-   }
-  ,{{{   400,   400,   340,   360,   340}
-    ,{   370,   370,   340,   360,   340}
-    ,{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   400,   400,   310,   330,   310}
-    }
-   ,{{   360,   360,   310,   360,   310}
-    ,{   360,   360,   270,   360,   270}
-    ,{   340,   340,   310,   270,   310}
-    ,{   220,   220,   170,   130,   170}
-    ,{   340,   340,   310,   270,   310}
-    }
-   ,{{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   340,   340,   310,   330,   310}
-    }
-   ,{{   370,   370,   340,   300,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   340,   340,   310,   270,   310}
-    ,{   270,   210,   180,   270,   180}
-    ,{   340,   340,   310,   270,   310}
-    }
-   ,{{   400,   400,   310,   330,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   400,   400,   310,   270,   310}
-    }
-   }
-  ,{{{   400,   340,   400,   340,   400}
-    ,{   400,   340,   400,   340,   400}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   270,   270,   270,   270,   270}
-    ,{   310,   310,   310,   310,   310}
-    ,{   230,   170,   230,   170,   230}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   400,   340,   400,   340,   400}
-    ,{   400,   340,   400,   340,   400}
-    ,{   310,   310,   310,   310,   310}
-    ,{   180,   180,   180,   180,   180}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   }
-  ,{{{   340,   290,   340,   340,   340}
-    ,{   340,   260,   340,   340,   340}
-    ,{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   310,   310}
-    ,{   310,   290,   310,   310,   310}
-    }
-   ,{{   310,   230,   310,   180,   310}
-    ,{   270,   190,   270,   140,   270}
-    ,{   310,   230,   310,   180,   310}
-    ,{   170,    20,   170,   170,   170}
-    ,{   310,   230,   310,   180,   310}
-    }
-   ,{{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   290,   310,   180,   310}
-    }
-   ,{{   340,   260,   340,   340,   340}
-    ,{   340,   260,   340,   340,   340}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   230,   180,   310,   180}
-    ,{   310,   230,   310,   180,   310}
-    }
-   ,{{   310,   290,   310,   310,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   230,   310,   310,   310}
-    }
-   }
-  ,{{{   400,   340,   400,   340,   340}
-    ,{   400,   340,   400,   340,   340}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   330,   310,   310,   310,   330}
-    ,{   330,   270,   270,   270,   330}
-    ,{   310,   310,   310,   310,   310}
-    ,{   230,   170,   230,   170,   170}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   400,   340,   400,   340,   340}
-    ,{   400,   340,   400,   340,   340}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   180,   180,   180,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   }
-  }
- ,{{{{   370,   340,   310,   310,   370}
-    ,{   370,   340,   310,   310,   370}
-    ,{   320,   320,   290,   310,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   320,   320,   290,   310,   290}
-    }
-   ,{{   370,   340,   310,   310,   370}
-    ,{   370,   340,   310,   310,   370}
-    ,{   320,   320,   280,   280,   280}
-    ,{   240,   220,   240,   180,   240}
-    ,{   320,   320,   280,   280,   280}
-    }
-   ,{{   330,   330,   290,   310,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   320,   320,   290,   310,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   320,   320,   290,   310,   290}
-    }
-   ,{{   320,   320,   310,   280,   310}
-    ,{   310,   290,   310,   250,   310}
-    ,{   320,   320,   280,   280,   280}
-    ,{   260,   180,   130,   260,   260}
-    ,{   320,   320,   280,   280,   280}
-    }
-   ,{{   330,   330,   290,   310,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   320,   320,   290,   310,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   290,   290,   200,   200,   200}
-    }
-   }
-  ,{{{   340,   340,   310,   310,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   320,   320,   290,   310,   290}
-    ,{   330,   330,   290,   250,   290}
-    ,{   320,   320,   290,   310,   290}
-    }
-   ,{{   340,   340,   310,   270,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   320,   320,   280,   240,   280}
-    ,{   220,   220,   180,   140,   180}
-    ,{   320,   320,   280,   240,   280}
-    }
-   ,{{   330,   330,   290,   310,   290}
-    ,{   330,   330,   290,   250,   290}
-    ,{   320,   320,   290,   310,   290}
-    ,{   330,   330,   290,   250,   290}
-    ,{   320,   320,   290,   310,   290}
-    }
-   ,{{   320,   320,   280,   240,   280}
-    ,{   290,   290,   250,   210,   250}
-    ,{   320,   320,   280,   240,   280}
-    ,{   220,   170,   130,   220,   130}
-    ,{   320,   320,   280,   240,   280}
-    }
-   ,{{   330,   330,   290,   310,   290}
-    ,{   330,   330,   290,   250,   290}
-    ,{   320,   320,   290,   310,   290}
-    ,{   330,   330,   290,   250,   290}
-    ,{   290,   290,   200,   160,   200}
-    }
-   }
-  ,{{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   280,   280,   280,   280,   280}
-    ,{   240,   180,   240,   180,   240}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    }
-   ,{{   310,   280,   310,   280,   310}
-    ,{   310,   250,   310,   250,   310}
-    ,{   280,   280,   280,   280,   280}
-    ,{   130,   130,   130,   130,   130}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   200,   200,   200,   200,   200}
-    }
-   }
-  ,{{{   310,   270,   310,   260,   310}
-    ,{   310,   230,   310,   250,   310}
-    ,{   290,   270,   290,   160,   290}
-    ,{   290,   210,   290,   260,   290}
-    ,{   290,   270,   290,   200,   290}
-    }
-   ,{{   310,   230,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   280,   200,   280,   150,   280}
-    ,{   180,   100,   180,   180,   180}
-    ,{   280,   200,   280,   150,   280}
-    }
-   ,{{   290,   270,   290,   160,   290}
-    ,{   290,   210,   290,   160,   290}
-    ,{   290,   270,   290,   160,   290}
-    ,{   290,   210,   290,   160,   290}
-    ,{   290,   270,   290,   160,   290}
-    }
-   ,{{   280,   200,   280,   260,   280}
-    ,{   250,   170,   250,   250,   250}
-    ,{   280,   200,   280,   150,   280}
-    ,{   260,   180,   130,   260,   130}
-    ,{   280,   200,   280,   150,   280}
-    }
-   ,{{   290,   270,   290,   200,   290}
-    ,{   290,   210,   290,   160,   290}
-    ,{   290,   270,   290,   160,   290}
-    ,{   290,   210,   290,   160,   290}
-    ,{   200,   120,   200,   200,   200}
-    }
-   }
-  ,{{{   370,   310,   310,   310,   370}
-    ,{   370,   310,   310,   310,   370}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    }
-   ,{{   370,   310,   310,   310,   370}
-    ,{   370,   310,   310,   310,   370}
-    ,{   280,   280,   280,   280,   280}
-    ,{   240,   180,   240,   180,   180}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    }
-   ,{{   310,   280,   310,   280,   280}
-    ,{   310,   250,   310,   250,   250}
-    ,{   280,   280,   280,   280,   280}
-    ,{   260,   130,   130,   130,   260}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   200,   200,   200,   200,   200}
-    }
-   }
-  }
- ,{{{{   370,   340,   310,   330,   370}
-    ,{   370,   340,   310,   310,   370}
-    ,{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   340,   340,   310,   330,   310}
-    }
-   ,{{   370,   340,   310,   310,   370}
-    ,{   370,   340,   310,   310,   370}
-    ,{   300,   300,   260,   260,   260}
-    ,{   260,   240,   260,   200,   260}
-    ,{   300,   300,   260,   260,   260}
-    }
-   ,{{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   340,   340,   310,   330,   310}
-    }
-   ,{{   300,   300,   270,   280,   280}
-    ,{   270,   250,   270,   210,   270}
-    ,{   300,   300,   260,   260,   260}
-    ,{   280,   200,   150,   280,   280}
-    ,{   300,   300,   260,   260,   260}
-    }
-   ,{{   340,   340,   310,   310,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   310,   310,   280,   300,   280}
-    ,{   340,   340,   310,   310,   310}
-    ,{   320,   320,   220,   220,   220}
-    }
-   }
-  ,{{{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   340,   340,   310,   330,   310}
-    }
-   ,{{   340,   340,   310,   270,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   300,   300,   260,   220,   260}
-    ,{   240,   240,   200,   160,   200}
-    ,{   300,   300,   260,   220,   260}
-    }
-   ,{{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   340,   340,   310,   330,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   340,   340,   310,   330,   310}
-    }
-   ,{{   300,   300,   260,   240,   260}
-    ,{   250,   250,   210,   170,   210}
-    ,{   300,   300,   260,   220,   260}
-    ,{   240,   190,   150,   240,   150}
-    ,{   300,   300,   260,   220,   260}
-    }
-   ,{{   340,   340,   310,   300,   310}
-    ,{   340,   340,   310,   270,   310}
-    ,{   310,   310,   280,   300,   280}
-    ,{   340,   340,   310,   270,   310}
-    ,{   320,   320,   220,   180,   220}
-    }
-   }
-  ,{{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   200,   260,   200,   260}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   270,   260,   270,   260,   270}
-    ,{   270,   210,   270,   210,   270}
-    ,{   260,   260,   260,   260,   260}
-    ,{   150,   150,   150,   150,   150}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   280,   280,   280,   280,   280}
-    ,{   310,   310,   310,   310,   310}
-    ,{   220,   220,   220,   220,   220}
-    }
-   }
-  ,{{{   310,   290,   310,   280,   310}
-    ,{   310,   230,   310,   210,   310}
-    ,{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   280,   310}
-    ,{   310,   290,   310,   220,   310}
-    }
-   ,{{   310,   230,   310,   200,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   260,   180,   260,   130,   260}
-    ,{   200,   120,   200,   200,   200}
-    ,{   260,   180,   260,   130,   260}
-    }
-   ,{{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   290,   310,   180,   310}
-    }
-   ,{{   280,   200,   260,   280,   260}
-    ,{   210,   130,   210,   210,   210}
-    ,{   260,   180,   260,   130,   260}
-    ,{   280,   200,   150,   280,   150}
-    ,{   260,   180,   260,   130,   260}
-    }
-   ,{{   310,   260,   310,   220,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   280,   260,   280,   150,   280}
-    ,{   310,   230,   310,   180,   310}
-    ,{   220,   140,   220,   220,   220}
-    }
-   }
-  ,{{{   370,   310,   310,   310,   370}
-    ,{   370,   310,   310,   310,   370}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   370,   310,   310,   310,   370}
-    ,{   370,   310,   310,   310,   370}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   200,   260,   200,   200}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   280,   260,   270,   260,   280}
-    ,{   270,   210,   270,   210,   210}
-    ,{   260,   260,   260,   260,   260}
-    ,{   280,   150,   150,   150,   280}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   280,   280,   280,   280,   280}
-    ,{   310,   310,   310,   310,   310}
-    ,{   220,   220,   220,   220,   220}
-    }
-   }
-  }
- ,{{{{   430,   430,   400,   370,   430}
-    ,{   430,   410,   400,   370,   430}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   360,   340}
-    }
-   ,{{   430,   410,   370,   370,   430}
-    ,{   430,   410,   370,   370,   430}
-    ,{   370,   370,   340,   340,   340}
-    ,{   320,   290,   320,   260,   320}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   370,   370,   340,   360,   340}
-    }
-   ,{{   400,   370,   400,   340,   400}
-    ,{   400,   370,   400,   340,   400}
-    ,{   370,   370,   340,   340,   340}
-    ,{   340,   260,   210,   340,   340}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   430,   430,   340,   360,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   340,   340}
-    }
-   }
-  ,{{{   430,   430,   370,   360,   370}
-    ,{   410,   410,   370,   360,   370}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   430,   430,   340,   360,   340}
-    }
-   ,{{   410,   410,   370,   360,   370}
-    ,{   410,   410,   370,   360,   370}
-    ,{   370,   370,   340,   300,   340}
-    ,{   290,   290,   260,   220,   260}
-    ,{   370,   370,   340,   300,   340}
-    }
-   ,{{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   370,   370,   340,   360,   340}
-    }
-   ,{{   370,   370,   340,   300,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   300,   240,   210,   300,   210}
-    ,{   370,   370,   340,   300,   340}
-    }
-   ,{{   430,   430,   340,   360,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   370,   340,   300,   340}
-    ,{   430,   430,   340,   300,   340}
-    }
-   }
-  ,{{{   400,   370,   400,   370,   400}
-    ,{   400,   370,   400,   370,   400}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   370,   370,   370,   370,   370}
-    ,{   370,   370,   370,   370,   370}
-    ,{   340,   340,   340,   340,   340}
-    ,{   320,   260,   320,   260,   320}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   400,   340,   400,   340,   400}
-    ,{   400,   340,   400,   340,   400}
-    ,{   340,   340,   340,   340,   340}
-    ,{   210,   210,   210,   210,   210}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   }
-  ,{{{   370,   320,   370,   340,   370}
-    ,{   370,   290,   370,   340,   370}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   340,   340}
-    ,{   340,   320,   340,   340,   340}
-    }
-   ,{{   370,   290,   370,   260,   370}
-    ,{   370,   290,   370,   240,   370}
-    ,{   340,   260,   340,   210,   340}
-    ,{   260,   180,   260,   260,   260}
-    ,{   340,   260,   340,   210,   340}
-    }
-   ,{{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    }
-   ,{{   340,   260,   340,   340,   340}
-    ,{   340,   260,   340,   340,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   260,   210,   340,   210}
-    ,{   340,   260,   340,   210,   340}
-    }
-   ,{{   340,   320,   340,   340,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   260,   340,   340,   340}
-    }
-   }
-  ,{{{   430,   370,   400,   370,   430}
-    ,{   430,   370,   400,   370,   430}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   430,   370,   370,   370,   430}
-    ,{   430,   370,   370,   370,   430}
-    ,{   340,   340,   340,   340,   340}
-    ,{   320,   260,   320,   260,   260}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   400,   340,   400,   340,   340}
-    ,{   400,   340,   400,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   210,   210,   210,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   310,   240,   240,   310,   260}
-    ,{   270,   240,   240,   270,   260}
-    ,{   310,   220,   220,   310,   220}
-    ,{   270,   240,   240,   270,   240}
-    ,{   300,   210,   210,   300,   210}
-    }
-   ,{{   260,   200,   200,   230,   260}
-    ,{   260,   200,   200,   230,   260}
-    ,{   220,   190,   190,   220,   190}
-    ,{   160,   100,   160,   130,   160}
-    ,{   220,   190,   190,   220,   190}
-    }
-   ,{{   310,   240,   240,   310,   240}
-    ,{   270,   240,   240,   270,   240}
-    ,{   310,   220,   220,   310,   220}
-    ,{   270,   240,   240,   270,   240}
-    ,{   300,   210,   210,   300,   210}
-    }
-   ,{{   220,   190,   190,   220,   190}
-    ,{   160,   100,   160,   130,   160}
-    ,{   220,   190,   190,   220,   190}
-    ,{   210,    50,    50,   210,   180}
-    ,{   220,   190,   190,   220,   190}
-    }
-   ,{{   300,   240,   240,   300,   240}
-    ,{   270,   240,   240,   270,   240}
-    ,{   300,   210,   210,   300,   210}
-    ,{   270,   240,   240,   270,   240}
-    ,{   150,   140,   120,   150,   120}
-    }
-   }
-  ,{{{   310,   200,   240,   310,   240}
-    ,{   270,   200,   240,   270,   240}
-    ,{   310,   190,   220,   310,   220}
-    ,{   270,   200,   240,   270,   240}
-    ,{   300,   170,   210,   300,   210}
-    }
-   ,{{   230,   160,   200,   230,   200}
-    ,{   230,   160,   200,   230,   200}
-    ,{   220,   160,   190,   220,   190}
-    ,{   130,    70,   100,   130,   100}
-    ,{   220,   160,   190,   220,   190}
-    }
-   ,{{   310,   200,   240,   310,   240}
-    ,{   270,   200,   240,   270,   240}
-    ,{   310,   190,   220,   310,   220}
-    ,{   270,   200,   240,   270,   240}
-    ,{   300,   170,   210,   300,   210}
-    }
-   ,{{   220,   160,   190,   220,   190}
-    ,{   130,    70,   100,   130,   100}
-    ,{   220,   160,   190,   220,   190}
-    ,{   210,    10,    50,   210,    50}
-    ,{   220,   160,   190,   220,   190}
-    }
-   ,{{   300,   200,   240,   300,   240}
-    ,{   270,   200,   240,   270,   240}
-    ,{   300,   170,   210,   300,   210}
-    ,{   270,   200,   240,   270,   240}
-    ,{   150,   140,   120,   150,   120}
-    }
-   }
-  ,{{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   220,   220,   220,   220,   220}
-    ,{   240,   240,   240,   240,   240}
-    ,{   210,   210,   210,   210,   210}
-    }
-   ,{{   200,   200,   200,   200,   200}
-    ,{   200,   200,   200,   200,   200}
-    ,{   190,   190,   190,   190,   190}
-    ,{   160,   100,   160,   100,   160}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   220,   220,   220,   220,   220}
-    ,{   240,   240,   240,   240,   240}
-    ,{   210,   210,   210,   210,   210}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   160,   100,   160,   100,   160}
-    ,{   190,   190,   190,   190,   190}
-    ,{    50,    50,    50,    50,    50}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   210,   210,   210,   210,   210}
-    ,{   240,   240,   240,   240,   240}
-    ,{   120,   120,   120,   120,   120}
-    }
-   }
-  ,{{{   240,   150,   240,   180,   240}
-    ,{   240,   100,   240,   110,   240}
-    ,{   220,   150,   220,    90,   220}
-    ,{   240,   100,   240,   180,   240}
-    ,{   210,   130,   210,   120,   210}
-    }
-   ,{{   200,    60,   200,   100,   200}
-    ,{   200,    60,   200,    70,   200}
-    ,{   190,    60,   190,    60,   190}
-    ,{   100,   -30,   100,   100,   100}
-    ,{   190,    60,   190,    60,   190}
-    }
-   ,{{   240,   150,   240,   110,   240}
-    ,{   240,   100,   240,   110,   240}
-    ,{   220,   150,   220,    90,   220}
-    ,{   240,   100,   240,   110,   240}
-    ,{   210,   130,   210,    80,   210}
-    }
-   ,{{   190,    60,   190,   180,   190}
-    ,{   100,   -30,   100,   100,   100}
-    ,{   190,    60,   190,    60,   190}
-    ,{   180,    40,    50,   180,    50}
-    ,{   190,    60,   190,    60,   190}
-    }
-   ,{{   240,   130,   240,   120,   240}
-    ,{   240,   100,   240,   110,   240}
-    ,{   210,   130,   210,    80,   210}
-    ,{   240,   100,   240,   110,   240}
-    ,{   120,   -10,   120,   120,   120}
-    }
-   }
-  ,{{{   260,   240,   240,   240,   260}
-    ,{   260,   240,   240,   240,   260}
-    ,{   220,   220,   220,   220,   220}
-    ,{   240,   240,   240,   240,   240}
-    ,{   210,   210,   210,   210,   210}
-    }
-   ,{{   260,   200,   200,   200,   260}
-    ,{   260,   200,   200,   200,   260}
-    ,{   190,   190,   190,   190,   190}
-    ,{   160,   100,   160,   100,   100}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   220,   220,   220,   220,   220}
-    ,{   240,   240,   240,   240,   240}
-    ,{   210,   210,   210,   210,   210}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   160,   100,   160,   100,   100}
-    ,{   190,   190,   190,   190,   190}
-    ,{   180,    50,    50,    50,   180}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   210,   210,   210,   210,   210}
-    ,{   240,   240,   240,   240,   240}
-    ,{   120,   120,   120,   120,   120}
-    }
-   }
-  }
- ,{{{{   280,   210,   210,   280,   270}
-    ,{   270,   210,   210,   240,   270}
-    ,{   280,   190,   190,   280,   190}
-    ,{   210,   180,   180,   210,   180}
-    ,{   280,   190,   190,   280,   190}
-    }
-   ,{{   270,   210,   210,   240,   270}
-    ,{   270,   210,   210,   240,   270}
-    ,{   220,   190,   190,   220,   190}
-    ,{    70,    10,    70,    40,    70}
-    ,{   220,   190,   190,   220,   190}
-    }
-   ,{{   280,   190,   190,   280,   190}
-    ,{   210,   180,   180,   210,   180}
-    ,{   280,   190,   190,   280,   190}
-    ,{   210,   180,   180,   210,   180}
-    ,{   280,   190,   190,   280,   190}
-    }
-   ,{{   220,   190,   190,   220,   190}
-    ,{   130,    70,   130,   100,   130}
-    ,{   220,   190,   190,   220,   190}
-    ,{   210,    50,    50,   210,   180}
-    ,{   220,   190,   190,   220,   190}
-    }
-   ,{{   280,   190,   190,   280,   190}
-    ,{   210,   180,   180,   210,   180}
-    ,{   280,   190,   190,   280,   190}
-    ,{   210,   180,   180,   210,   180}
-    ,{   140,   140,   110,   140,   110}
-    }
-   }
-  ,{{{   280,   190,   210,   280,   210}
-    ,{   240,   190,   210,   240,   210}
-    ,{   280,   160,   190,   280,   190}
-    ,{   210,   150,   180,   210,   180}
-    ,{   280,   150,   190,   280,   190}
-    }
-   ,{{   240,   190,   210,   240,   210}
-    ,{   240,   190,   210,   240,   210}
-    ,{   220,   150,   190,   220,   190}
-    ,{    40,   -20,    10,    40,    10}
-    ,{   220,   150,   190,   220,   190}
-    }
-   ,{{   280,   150,   190,   280,   190}
-    ,{   210,   150,   180,   210,   180}
-    ,{   280,   150,   190,   280,   190}
-    ,{   210,   150,   180,   210,   180}
-    ,{   280,   150,   190,   280,   190}
-    }
-   ,{{   220,   150,   190,   220,   190}
-    ,{   100,    40,    70,   100,    70}
-    ,{   220,   150,   190,   220,   190}
-    ,{   210,    10,    50,   210,    50}
-    ,{   220,   150,   190,   220,   190}
-    }
-   ,{{   280,   160,   190,   280,   190}
-    ,{   210,   150,   180,   210,   180}
-    ,{   280,   160,   190,   280,   190}
-    ,{   210,   150,   180,   210,   180}
-    ,{   140,   140,   110,   140,   110}
-    }
-   }
-  ,{{{   210,   210,   210,   210,   210}
-    ,{   210,   210,   210,   210,   210}
-    ,{   190,   190,   190,   190,   190}
-    ,{   180,   180,   180,   180,   180}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   210,   210,   210,   210,   210}
-    ,{   210,   210,   210,   210,   210}
-    ,{   190,   190,   190,   190,   190}
-    ,{    70,    10,    70,    10,    70}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   180,   180,   180,   180,   180}
-    ,{   190,   190,   190,   190,   190}
-    ,{   180,   180,   180,   180,   180}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   130,    70,   130,    70,   130}
-    ,{   190,   190,   190,   190,   190}
-    ,{    50,    50,    50,    50,    50}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   180,   180,   180,   180,   180}
-    ,{   190,   190,   190,   190,   190}
-    ,{   180,   180,   180,   180,   180}
-    ,{   110,   110,   110,   110,   110}
-    }
-   }
-  ,{{{   210,   120,   210,   180,   210}
-    ,{   210,    80,   210,    80,   210}
-    ,{   190,   120,   190,    60,   190}
-    ,{   180,    50,   180,   180,   180}
-    ,{   190,   110,   190,   110,   190}
-    }
-   ,{{   210,    80,   210,    80,   210}
-    ,{   210,    80,   210,    80,   210}
-    ,{   190,    50,   190,    60,   190}
-    ,{    10,  -120,    10,    10,    10}
-    ,{   190,    50,   190,    60,   190}
-    }
-   ,{{   190,   110,   190,    60,   190}
-    ,{   180,    50,   180,    50,   180}
-    ,{   190,   110,   190,    60,   190}
-    ,{   180,    50,   180,    50,   180}
-    ,{   190,   110,   190,    60,   190}
-    }
-   ,{{   190,    50,   190,   180,   190}
-    ,{    70,   -60,    70,    70,    70}
-    ,{   190,    50,   190,    60,   190}
-    ,{   180,    40,    50,   180,    50}
-    ,{   190,    50,   190,    60,   190}
-    }
-   ,{{   190,   120,   190,   110,   190}
-    ,{   180,    50,   180,    50,   180}
-    ,{   190,   120,   190,    60,   190}
-    ,{   180,    50,   180,    50,   180}
-    ,{   110,   -20,   110,   110,   110}
-    }
-   }
-  ,{{{   270,   210,   210,   210,   270}
-    ,{   270,   210,   210,   210,   270}
-    ,{   190,   190,   190,   190,   190}
-    ,{   180,   180,   180,   180,   180}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   270,   210,   210,   210,   270}
-    ,{   270,   210,   210,   210,   270}
-    ,{   190,   190,   190,   190,   190}
-    ,{    70,    10,    70,    10,    10}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   180,   180,   180,   180,   180}
-    ,{   190,   190,   190,   190,   190}
-    ,{   180,   180,   180,   180,   180}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   130,    70,   130,    70,    70}
-    ,{   190,   190,   190,   190,   190}
-    ,{   180,    50,    50,    50,   180}
-    ,{   190,   190,   190,   190,   190}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   180,   180,   180,   180,   180}
-    ,{   190,   190,   190,   190,   190}
-    ,{   180,   180,   180,   180,   180}
-    ,{   110,   110,   110,   110,   110}
-    }
-   }
-  }
- ,{{{{   400,   360,   340,   400,   400}
-    ,{   400,   360,   340,   370,   400}
-    ,{   400,   310,   310,   400,   310}
-    ,{   340,   310,   310,   340,   310}
-    ,{   400,   330,   310,   400,   310}
-    }
-   ,{{   400,   360,   340,   370,   400}
-    ,{   400,   360,   340,   370,   400}
-    ,{   340,   310,   310,   340,   310}
-    ,{   290,   230,   290,   260,   290}
-    ,{   340,   310,   310,   340,   310}
-    }
-   ,{{   400,   310,   310,   400,   310}
-    ,{   340,   310,   310,   340,   310}
-    ,{   400,   310,   310,   400,   310}
-    ,{   340,   310,   310,   340,   310}
-    ,{   400,   310,   310,   400,   310}
-    }
-   ,{{   360,   360,   330,   340,   330}
-    ,{   360,   360,   330,   300,   330}
-    ,{   340,   310,   310,   340,   310}
-    ,{   340,   180,   180,   340,   310}
-    ,{   340,   310,   310,   340,   310}
-    }
-   ,{{   400,   330,   310,   400,   310}
-    ,{   340,   310,   310,   340,   310}
-    ,{   400,   310,   310,   400,   310}
-    ,{   340,   310,   310,   340,   310}
-    ,{   340,   330,   310,   340,   310}
-    }
-   }
-  ,{{{   400,   360,   340,   400,   340}
-    ,{   370,   360,   340,   370,   340}
-    ,{   400,   270,   310,   400,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   400,   330,   310,   400,   310}
-    }
-   ,{{   370,   360,   340,   370,   340}
-    ,{   370,   360,   340,   370,   340}
-    ,{   340,   270,   310,   340,   310}
-    ,{   260,   190,   230,   260,   230}
-    ,{   340,   270,   310,   340,   310}
-    }
-   ,{{   400,   270,   310,   400,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   400,   270,   310,   400,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   400,   270,   310,   400,   310}
-    }
-   ,{{   360,   360,   310,   340,   310}
-    ,{   360,   360,   270,   300,   270}
-    ,{   340,   270,   310,   340,   310}
-    ,{   340,   140,   180,   340,   180}
-    ,{   340,   270,   310,   340,   310}
-    }
-   ,{{   400,   330,   310,   400,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   400,   270,   310,   400,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   340,   330,   310,   340,   310}
-    }
-   }
-  ,{{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   310,   310,   310,   310,   310}
-    ,{   290,   230,   290,   230,   290}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   330,   310,   330,   310,   330}
-    ,{   330,   270,   330,   270,   330}
-    ,{   310,   310,   310,   310,   310}
-    ,{   180,   180,   180,   180,   180}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   }
-  ,{{{   340,   230,   340,   310,   340}
-    ,{   340,   220,   340,   270,   340}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   170,   310,   310,   310}
-    ,{   310,   230,   310,   310,   310}
-    }
-   ,{{   340,   220,   340,   230,   340}
-    ,{   340,   220,   340,   210,   340}
-    ,{   310,   170,   310,   180,   310}
-    ,{   230,    20,   230,   230,   230}
-    ,{   310,   170,   310,   180,   310}
-    }
-   ,{{   310,   230,   310,   180,   310}
-    ,{   310,   170,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   170,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    }
-   ,{{   310,   170,   310,   310,   310}
-    ,{   270,   130,   270,   270,   270}
-    ,{   310,   170,   310,   180,   310}
-    ,{   310,   170,   180,   310,   180}
-    ,{   310,   170,   310,   180,   310}
-    }
-   ,{{   310,   230,   310,   310,   310}
-    ,{   310,   170,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   170,   310,   180,   310}
-    ,{   310,   170,   310,   310,   310}
-    }
-   }
-  ,{{{   400,   340,   340,   340,   400}
-    ,{   400,   340,   340,   340,   400}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   400,   340,   340,   340,   400}
-    ,{   400,   340,   340,   340,   400}
-    ,{   310,   310,   310,   310,   310}
-    ,{   290,   230,   290,   230,   230}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   330,   310,   330,   310,   310}
-    ,{   330,   270,   330,   270,   270}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   180,   180,   180,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   }
-  }
- ,{{{{   370,   310,   370,   370,   370}
-    ,{   370,   310,   370,   340,   370}
-    ,{   370,   280,   280,   370,   280}
-    ,{   310,   280,   280,   310,   280}
-    ,{   370,   300,   280,   370,   280}
-    }
-   ,{{   310,   280,   280,   310,   300}
-    ,{   300,   240,   240,   270,   300}
-    ,{   310,   280,   280,   310,   280}
-    ,{   200,   140,   200,   170,   200}
-    ,{   310,   280,   280,   310,   280}
-    }
-   ,{{   370,   280,   280,   370,   280}
-    ,{   310,   280,   280,   310,   280}
-    ,{   370,   280,   280,   370,   280}
-    ,{   310,   280,   280,   310,   280}
-    ,{   370,   280,   280,   370,   280}
-    }
-   ,{{   370,   310,   370,   340,   370}
-    ,{   370,   310,   370,   340,   370}
-    ,{   310,   280,   280,   310,   280}
-    ,{   310,   150,   150,   310,   280}
-    ,{   310,   280,   280,   310,   280}
-    }
-   ,{{   370,   300,   280,   370,   280}
-    ,{   310,   280,   280,   310,   280}
-    ,{   370,   280,   280,   370,   280}
-    ,{   310,   280,   280,   310,   280}
-    ,{   310,   300,   280,   310,   280}
-    }
-   }
-  ,{{{   370,   300,   310,   370,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   370,   240,   280,   370,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   370,   300,   280,   370,   280}
-    }
-   ,{{   310,   240,   280,   310,   280}
-    ,{   270,   210,   240,   270,   240}
-    ,{   310,   240,   280,   310,   280}
-    ,{   170,   110,   140,   170,   140}
-    ,{   310,   240,   280,   310,   280}
-    }
-   ,{{   370,   240,   280,   370,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   370,   240,   280,   370,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   370,   240,   280,   370,   280}
-    }
-   ,{{   340,   270,   310,   340,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   310,   240,   280,   310,   280}
-    ,{   310,   110,   150,   310,   150}
-    ,{   310,   240,   280,   310,   280}
-    }
-   ,{{   370,   300,   280,   370,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   370,   240,   280,   370,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   310,   300,   280,   310,   280}
-    }
-   }
-  ,{{{   370,   310,   370,   310,   370}
-    ,{   370,   310,   370,   310,   370}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   280,   280,   280,   280,   280}
-    ,{   240,   240,   240,   240,   240}
-    ,{   280,   280,   280,   280,   280}
-    ,{   200,   140,   200,   140,   200}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   370,   310,   370,   310,   370}
-    ,{   370,   310,   370,   310,   370}
-    ,{   280,   280,   280,   280,   280}
-    ,{   150,   150,   150,   150,   150}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    }
-   }
-  ,{{{   310,   200,   310,   310,   310}
-    ,{   310,   170,   310,   310,   310}
-    ,{   280,   200,   280,   150,   280}
-    ,{   280,   140,   280,   280,   280}
-    ,{   280,   200,   280,   280,   280}
-    }
-   ,{{   280,   140,   280,   150,   280}
-    ,{   240,   110,   240,   110,   240}
-    ,{   280,   140,   280,   150,   280}
-    ,{   140,    10,   140,   140,   140}
-    ,{   280,   140,   280,   150,   280}
-    }
-   ,{{   280,   200,   280,   150,   280}
-    ,{   280,   140,   280,   150,   280}
-    ,{   280,   200,   280,   150,   280}
-    ,{   280,   140,   280,   150,   280}
-    ,{   280,   200,   280,   150,   280}
-    }
-   ,{{   310,   170,   310,   310,   310}
-    ,{   310,   170,   310,   310,   310}
-    ,{   280,   140,   280,   150,   280}
-    ,{   280,   140,   150,   280,   150}
-    ,{   280,   140,   280,   150,   280}
-    }
-   ,{{   280,   200,   280,   280,   280}
-    ,{   280,   140,   280,   150,   280}
-    ,{   280,   200,   280,   150,   280}
-    ,{   280,   140,   280,   150,   280}
-    ,{   280,   140,   280,   280,   280}
-    }
-   }
-  ,{{{   370,   310,   370,   310,   310}
-    ,{   370,   310,   370,   310,   310}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   300,   280,   280,   280,   300}
-    ,{   300,   240,   240,   240,   300}
-    ,{   280,   280,   280,   280,   280}
-    ,{   200,   140,   200,   140,   140}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   370,   310,   370,   310,   310}
-    ,{   370,   310,   370,   310,   310}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   150,   150,   150,   280}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    }
-   }
-  }
- ,{{{{   350,   280,   280,   350,   340}
-    ,{   340,   280,   280,   310,   340}
-    ,{   350,   260,   260,   350,   260}
-    ,{   290,   260,   260,   290,   260}
-    ,{   350,   260,   260,   350,   260}
-    }
-   ,{{   340,   280,   280,   310,   340}
-    ,{   340,   280,   280,   310,   340}
-    ,{   280,   250,   250,   280,   250}
-    ,{   210,   150,   210,   180,   210}
-    ,{   280,   250,   250,   280,   250}
-    }
-   ,{{   350,   260,   260,   350,   260}
-    ,{   290,   260,   260,   290,   260}
-    ,{   350,   260,   260,   350,   260}
-    ,{   290,   260,   260,   290,   260}
-    ,{   350,   260,   260,   350,   260}
-    }
-   ,{{   280,   250,   280,   280,   280}
-    ,{   280,   220,   280,   250,   280}
-    ,{   280,   250,   250,   280,   250}
-    ,{   260,   100,   100,   260,   230}
-    ,{   280,   250,   250,   280,   250}
-    }
-   ,{{   350,   260,   260,   350,   260}
-    ,{   290,   260,   260,   290,   260}
-    ,{   350,   260,   260,   350,   260}
-    ,{   290,   260,   260,   290,   260}
-    ,{   200,   190,   170,   200,   170}
-    }
-   }
-  ,{{{   350,   240,   280,   350,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   350,   220,   260,   350,   260}
-    ,{   290,   230,   260,   290,   260}
-    ,{   350,   220,   260,   350,   260}
-    }
-   ,{{   310,   240,   280,   310,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   280,   220,   250,   280,   250}
-    ,{   180,   120,   150,   180,   150}
-    ,{   280,   220,   250,   280,   250}
-    }
-   ,{{   350,   230,   260,   350,   260}
-    ,{   290,   230,   260,   290,   260}
-    ,{   350,   220,   260,   350,   260}
-    ,{   290,   230,   260,   290,   260}
-    ,{   350,   220,   260,   350,   260}
-    }
-   ,{{   280,   220,   250,   280,   250}
-    ,{   250,   190,   220,   250,   220}
-    ,{   280,   220,   250,   280,   250}
-    ,{   260,    70,   100,   260,   100}
-    ,{   280,   220,   250,   280,   250}
-    }
-   ,{{   350,   230,   260,   350,   260}
-    ,{   290,   230,   260,   290,   260}
-    ,{   350,   220,   260,   350,   260}
-    ,{   290,   230,   260,   290,   260}
-    ,{   200,   190,   170,   200,   170}
-    }
-   }
-  ,{{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   250,   250,   250,   250,   250}
-    ,{   210,   150,   210,   150,   210}
-    ,{   250,   250,   250,   250,   250}
-    }
-   ,{{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   280,   250,   280,   250,   280}
-    ,{   280,   220,   280,   220,   280}
-    ,{   250,   250,   250,   250,   250}
-    ,{   100,   100,   100,   100,   100}
-    ,{   250,   250,   250,   250,   250}
-    }
-   ,{{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   170,   170,   170,   170,   170}
-    }
-   }
-  ,{{{   280,   180,   280,   230,   280}
-    ,{   280,   140,   280,   220,   280}
-    ,{   260,   180,   260,   130,   260}
-    ,{   260,   130,   260,   230,   260}
-    ,{   260,   180,   260,   170,   260}
-    }
-   ,{{   280,   140,   280,   150,   280}
-    ,{   280,   140,   280,   150,   280}
-    ,{   250,   120,   250,   120,   250}
-    ,{   150,    20,   150,   150,   150}
-    ,{   250,   120,   250,   120,   250}
-    }
-   ,{{   260,   180,   260,   130,   260}
-    ,{   260,   130,   260,   130,   260}
-    ,{   260,   180,   260,   130,   260}
-    ,{   260,   130,   260,   130,   260}
-    ,{   260,   180,   260,   130,   260}
-    }
-   ,{{   250,   120,   250,   230,   250}
-    ,{   220,    90,   220,   220,   220}
-    ,{   250,   120,   250,   120,   250}
-    ,{   230,   100,   100,   230,   100}
-    ,{   250,   120,   250,   120,   250}
-    }
-   ,{{   260,   180,   260,   170,   260}
-    ,{   260,   130,   260,   130,   260}
-    ,{   260,   180,   260,   130,   260}
-    ,{   260,   130,   260,   130,   260}
-    ,{   170,    30,   170,   170,   170}
-    }
-   }
-  ,{{{   340,   280,   280,   280,   340}
-    ,{   340,   280,   280,   280,   340}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   340,   280,   280,   280,   340}
-    ,{   340,   280,   280,   280,   340}
-    ,{   250,   250,   250,   250,   250}
-    ,{   210,   150,   210,   150,   150}
-    ,{   250,   250,   250,   250,   250}
-    }
-   ,{{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   280,   250,   280,   250,   250}
-    ,{   280,   220,   280,   220,   220}
-    ,{   250,   250,   250,   250,   250}
-    ,{   230,   100,   100,   100,   230}
-    ,{   250,   250,   250,   250,   250}
-    }
-   ,{{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   260,   260,   260,   260}
-    ,{   170,   170,   170,   170,   170}
-    }
-   }
-  }
- ,{{{{   370,   280,   280,   370,   340}
-    ,{   340,   280,   280,   310,   340}
-    ,{   370,   280,   280,   370,   280}
-    ,{   310,   280,   280,   310,   280}
-    ,{   370,   280,   280,   370,   280}
-    }
-   ,{{   340,   280,   280,   310,   340}
-    ,{   340,   280,   280,   310,   340}
-    ,{   260,   230,   230,   260,   230}
-    ,{   230,   170,   230,   200,   230}
-    ,{   260,   230,   230,   260,   230}
-    }
-   ,{{   370,   280,   280,   370,   280}
-    ,{   310,   280,   280,   310,   280}
-    ,{   370,   280,   280,   370,   280}
-    ,{   310,   280,   280,   310,   280}
-    ,{   370,   280,   280,   370,   280}
-    }
-   ,{{   280,   230,   240,   280,   250}
-    ,{   240,   180,   240,   210,   240}
-    ,{   260,   230,   230,   260,   230}
-    ,{   280,   120,   120,   280,   250}
-    ,{   260,   230,   230,   260,   230}
-    }
-   ,{{   340,   280,   280,   340,   280}
-    ,{   310,   280,   280,   310,   280}
-    ,{   340,   250,   250,   340,   250}
-    ,{   310,   280,   280,   310,   280}
-    ,{   220,   220,   190,   220,   190}
-    }
-   }
-  ,{{{   370,   240,   280,   370,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   370,   240,   280,   370,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   370,   240,   280,   370,   280}
-    }
-   ,{{   310,   240,   280,   310,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   260,   200,   230,   260,   230}
-    ,{   200,   140,   170,   200,   170}
-    ,{   260,   200,   230,   260,   230}
-    }
-   ,{{   370,   240,   280,   370,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   370,   240,   280,   370,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   370,   240,   280,   370,   280}
-    }
-   ,{{   280,   200,   230,   280,   230}
-    ,{   210,   150,   180,   210,   180}
-    ,{   260,   200,   230,   260,   230}
-    ,{   280,    90,   120,   280,   120}
-    ,{   260,   200,   230,   260,   230}
-    }
-   ,{{   340,   240,   280,   340,   280}
-    ,{   310,   240,   280,   310,   280}
-    ,{   340,   210,   250,   340,   250}
-    ,{   310,   240,   280,   310,   280}
-    ,{   220,   220,   190,   220,   190}
-    }
-   }
-  ,{{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   230,   230,   230,   230,   230}
-    ,{   230,   170,   230,   170,   230}
-    ,{   230,   230,   230,   230,   230}
-    }
-   ,{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   240,   230,   240,   230,   240}
-    ,{   240,   180,   240,   180,   240}
-    ,{   230,   230,   230,   230,   230}
-    ,{   120,   120,   120,   120,   120}
-    ,{   230,   230,   230,   230,   230}
-    }
-   ,{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   250,   250,   250,   250,   250}
-    ,{   280,   280,   280,   280,   280}
-    ,{   190,   190,   190,   190,   190}
-    }
-   }
-  ,{{{   280,   200,   280,   250,   280}
-    ,{   280,   140,   280,   180,   280}
-    ,{   280,   200,   280,   150,   280}
-    ,{   280,   140,   280,   250,   280}
-    ,{   280,   200,   280,   190,   280}
-    }
-   ,{{   280,   140,   280,   170,   280}
-    ,{   280,   140,   280,   150,   280}
-    ,{   230,   100,   230,   100,   230}
-    ,{   170,    40,   170,   170,   170}
-    ,{   230,   100,   230,   100,   230}
-    }
-   ,{{   280,   200,   280,   150,   280}
-    ,{   280,   140,   280,   150,   280}
-    ,{   280,   200,   280,   150,   280}
-    ,{   280,   140,   280,   150,   280}
-    ,{   280,   200,   280,   150,   280}
-    }
-   ,{{   250,   120,   230,   250,   230}
-    ,{   180,    50,   180,   180,   180}
-    ,{   230,   100,   230,   100,   230}
-    ,{   250,   120,   120,   250,   120}
-    ,{   230,   100,   230,   100,   230}
-    }
-   ,{{   280,   170,   280,   190,   280}
-    ,{   280,   140,   280,   150,   280}
-    ,{   250,   170,   250,   120,   250}
-    ,{   280,   140,   280,   150,   280}
-    ,{   190,    60,   190,   190,   190}
-    }
-   }
-  ,{{{   340,   280,   280,   280,   340}
-    ,{   340,   280,   280,   280,   340}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   340,   280,   280,   280,   340}
-    ,{   340,   280,   280,   280,   340}
-    ,{   230,   230,   230,   230,   230}
-    ,{   230,   170,   230,   170,   170}
-    ,{   230,   230,   230,   230,   230}
-    }
-   ,{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   250,   230,   240,   230,   250}
-    ,{   240,   180,   240,   180,   180}
-    ,{   230,   230,   230,   230,   230}
-    ,{   250,   120,   120,   120,   250}
-    ,{   230,   230,   230,   230,   230}
-    }
-   ,{{   280,   280,   280,   280,   280}
-    ,{   280,   280,   280,   280,   280}
-    ,{   250,   250,   250,   250,   250}
-    ,{   280,   280,   280,   280,   280}
-    ,{   190,   190,   190,   190,   190}
-    }
-   }
-  }
- ,{{{{   400,   360,   370,   400,   400}
-    ,{   400,   360,   370,   370,   400}
-    ,{   400,   310,   310,   400,   310}
-    ,{   340,   310,   310,   340,   310}
-    ,{   400,   330,   310,   400,   310}
-    }
-   ,{{   400,   360,   340,   370,   400}
-    ,{   400,   360,   340,   370,   400}
-    ,{   340,   310,   310,   340,   310}
-    ,{   290,   230,   290,   260,   290}
-    ,{   340,   310,   310,   340,   310}
-    }
-   ,{{   400,   310,   310,   400,   310}
-    ,{   340,   310,   310,   340,   310}
-    ,{   400,   310,   310,   400,   310}
-    ,{   340,   310,   310,   340,   310}
-    ,{   400,   310,   310,   400,   310}
-    }
-   ,{{   370,   360,   370,   340,   370}
-    ,{   370,   360,   370,   340,   370}
-    ,{   340,   310,   310,   340,   310}
-    ,{   340,   180,   180,   340,   310}
-    ,{   340,   310,   310,   340,   310}
-    }
-   ,{{   400,   330,   310,   400,   310}
-    ,{   340,   310,   310,   340,   310}
-    ,{   400,   310,   310,   400,   310}
-    ,{   340,   310,   310,   340,   310}
-    ,{   340,   330,   310,   340,   310}
-    }
-   }
-  ,{{{   400,   360,   340,   400,   340}
-    ,{   370,   360,   340,   370,   340}
-    ,{   400,   270,   310,   400,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   400,   330,   310,   400,   310}
-    }
-   ,{{   370,   360,   340,   370,   340}
-    ,{   370,   360,   340,   370,   340}
-    ,{   340,   270,   310,   340,   310}
-    ,{   260,   190,   230,   260,   230}
-    ,{   340,   270,   310,   340,   310}
-    }
-   ,{{   400,   270,   310,   400,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   400,   270,   310,   400,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   400,   270,   310,   400,   310}
-    }
-   ,{{   360,   360,   310,   340,   310}
-    ,{   360,   360,   310,   340,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   340,   140,   180,   340,   180}
-    ,{   340,   270,   310,   340,   310}
-    }
-   ,{{   400,   330,   310,   400,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   400,   270,   310,   400,   310}
-    ,{   340,   270,   310,   340,   310}
-    ,{   340,   330,   310,   340,   310}
-    }
-   }
-  ,{{{   370,   340,   370,   340,   370}
-    ,{   370,   340,   370,   340,   370}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   310,   310,   310,   310,   310}
-    ,{   290,   230,   290,   230,   290}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   370,   310,   370,   310,   370}
-    ,{   370,   310,   370,   310,   370}
-    ,{   310,   310,   310,   310,   310}
-    ,{   180,   180,   180,   180,   180}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   }
-  ,{{{   340,   230,   340,   310,   340}
-    ,{   340,   220,   340,   310,   340}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   170,   310,   310,   310}
-    ,{   310,   230,   310,   310,   310}
-    }
-   ,{{   340,   220,   340,   230,   340}
-    ,{   340,   220,   340,   210,   340}
-    ,{   310,   170,   310,   180,   310}
-    ,{   230,    40,   230,   230,   230}
-    ,{   310,   170,   310,   180,   310}
-    }
-   ,{{   310,   230,   310,   180,   310}
-    ,{   310,   170,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   170,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    }
-   ,{{   310,   170,   310,   310,   310}
-    ,{   310,   170,   310,   310,   310}
-    ,{   310,   170,   310,   180,   310}
-    ,{   310,   170,   180,   310,   180}
-    ,{   310,   170,   310,   180,   310}
-    }
-   ,{{   310,   230,   310,   310,   310}
-    ,{   310,   170,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   170,   310,   180,   310}
-    ,{   310,   170,   310,   310,   310}
-    }
-   }
-  ,{{{   400,   340,   370,   340,   400}
-    ,{   400,   340,   370,   340,   400}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   400,   340,   340,   340,   400}
-    ,{   400,   340,   340,   340,   400}
-    ,{   310,   310,   310,   310,   310}
-    ,{   290,   230,   290,   230,   230}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   370,   310,   370,   310,   310}
-    ,{   370,   310,   370,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   180,   180,   180,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   240,   240,   220,   230,   220}
-    ,{   240,   240,   220,   210,   220}
-    ,{   230,   220,   210,   230,   210}
-    ,{   240,   240,   220,   210,   220}
-    ,{   210,   210,   190,   210,   190}
-    }
-   ,{{   200,   200,   180,   170,   180}
-    ,{   200,   200,   180,   170,   180}
-    ,{   190,   190,   180,   170,   180}
-    ,{   140,   100,   140,    80,   140}
-    ,{   190,   190,   180,   170,   180}
-    }
-   ,{{   240,   240,   220,   230,   220}
-    ,{   240,   240,   220,   210,   220}
-    ,{   230,   220,   210,   230,   210}
-    ,{   240,   240,   220,   210,   220}
-    ,{   210,   210,   190,   210,   190}
-    }
-   ,{{   190,   190,   180,   170,   180}
-    ,{   140,   100,   140,    80,   140}
-    ,{   190,   190,   180,   170,   180}
-    ,{   130,    50,    30,   130,    70}
-    ,{   190,   190,   180,   170,   180}
-    }
-   ,{{   240,   240,   220,   210,   220}
-    ,{   240,   240,   220,   210,   220}
-    ,{   210,   210,   190,   210,   190}
-    ,{   240,   240,   220,   210,   220}
-    ,{   180,   180,   100,    90,   100}
-    }
-   }
-  ,{{{   240,   240,   220,   230,   220}
-    ,{   240,   240,   220,   180,   220}
-    ,{   230,   220,   210,   230,   210}
-    ,{   240,   240,   220,   180,   220}
-    ,{   210,   210,   190,   210,   190}
-    }
-   ,{{   200,   200,   180,   140,   180}
-    ,{   200,   200,   180,   140,   180}
-    ,{   190,   190,   180,   140,   180}
-    ,{   100,   100,    90,    50,    90}
-    ,{   190,   190,   180,   140,   180}
-    }
-   ,{{   240,   240,   220,   230,   220}
-    ,{   240,   240,   220,   180,   220}
-    ,{   230,   220,   210,   230,   210}
-    ,{   240,   240,   220,   180,   220}
-    ,{   210,   210,   190,   210,   190}
-    }
-   ,{{   190,   190,   180,   140,   180}
-    ,{   100,   100,    90,    50,    90}
-    ,{   190,   190,   180,   140,   180}
-    ,{   120,    50,    30,   120,    30}
-    ,{   190,   190,   180,   140,   180}
-    }
-   ,{{   240,   240,   220,   210,   220}
-    ,{   240,   240,   220,   180,   220}
-    ,{   210,   210,   190,   210,   190}
-    ,{   240,   240,   220,   180,   220}
-    ,{   180,   180,   100,    60,   100}
-    }
-   }
-  ,{{{   220,   210,   220,   210,   220}
-    ,{   220,   210,   220,   210,   220}
-    ,{   200,   200,   200,   200,   200}
-    ,{   220,   210,   220,   210,   220}
-    ,{   190,   180,   190,   180,   190}
-    }
-   ,{{   180,   170,   180,   170,   180}
-    ,{   180,   170,   180,   170,   180}
-    ,{   170,   170,   170,   170,   170}
-    ,{   140,    80,   140,    80,   140}
-    ,{   170,   170,   170,   170,   170}
-    }
-   ,{{   220,   210,   220,   210,   220}
-    ,{   220,   210,   220,   210,   220}
-    ,{   200,   200,   200,   200,   200}
-    ,{   220,   210,   220,   210,   220}
-    ,{   190,   180,   190,   180,   190}
-    }
-   ,{{   170,   170,   170,   170,   170}
-    ,{   140,    80,   140,    80,   140}
-    ,{   170,   170,   170,   170,   170}
-    ,{    30,    20,    30,    20,    30}
-    ,{   170,   170,   170,   170,   170}
-    }
-   ,{{   220,   210,   220,   210,   220}
-    ,{   220,   210,   220,   210,   220}
-    ,{   190,   180,   190,   180,   190}
-    ,{   220,   210,   220,   210,   220}
-    ,{   100,    90,   100,    90,   100}
-    }
-   }
-  ,{{{   220,   160,   220,   130,   220}
-    ,{   220,   110,   220,    60,   220}
-    ,{   210,   160,   210,    50,   210}
-    ,{   220,   110,   220,   130,   220}
-    ,{   190,   140,   190,    70,   190}
-    }
-   ,{{   180,    70,   180,    60,   180}
-    ,{   180,    70,   180,    20,   180}
-    ,{   180,    70,   180,    20,   180}
-    ,{    90,   -20,    90,    60,    90}
-    ,{   180,    70,   180,    20,   180}
-    }
-   ,{{   220,   160,   220,    60,   220}
-    ,{   220,   110,   220,    60,   220}
-    ,{   210,   160,   210,    50,   210}
-    ,{   220,   110,   220,    60,   220}
-    ,{   190,   140,   190,    30,   190}
-    }
-   ,{{   180,    70,   180,   130,   180}
-    ,{    90,   -20,    90,    60,    90}
-    ,{   180,    70,   180,    20,   180}
-    ,{   130,    50,    30,   130,    30}
-    ,{   180,    70,   180,    20,   180}
-    }
-   ,{{   220,   140,   220,    70,   220}
-    ,{   220,   110,   220,    60,   220}
-    ,{   190,   140,   190,    30,   190}
-    ,{   220,   110,   220,    60,   220}
-    ,{   100,     0,   100,    70,   100}
-    }
-   }
-  ,{{{   220,   210,   220,   210,   150}
-    ,{   220,   210,   220,   210,   150}
-    ,{   200,   200,   200,   200,   110}
-    ,{   220,   210,   220,   210,   130}
-    ,{   190,   180,   190,   180,   100}
-    }
-   ,{{   180,   170,   180,   170,   150}
-    ,{   180,   170,   180,   170,   150}
-    ,{   170,   170,   170,   170,    80}
-    ,{   140,    80,   140,    80,     0}
-    ,{   170,   170,   170,   170,    80}
-    }
-   ,{{   220,   210,   220,   210,   130}
-    ,{   220,   210,   220,   210,   130}
-    ,{   200,   200,   200,   200,   110}
-    ,{   220,   210,   220,   210,   130}
-    ,{   190,   180,   190,   180,   100}
-    }
-   ,{{   170,   170,   170,   170,    80}
-    ,{   140,    80,   140,    80,     0}
-    ,{   170,   170,   170,   170,    80}
-    ,{    70,    20,    30,    20,    70}
-    ,{   170,   170,   170,   170,    80}
-    }
-   ,{{   220,   210,   220,   210,   130}
-    ,{   220,   210,   220,   210,   130}
-    ,{   190,   180,   190,   180,   100}
-    ,{   220,   210,   220,   210,   130}
-    ,{   100,    90,   100,    90,    10}
-    }
-   }
-  }
- ,{{{{   210,   210,   200,   200,   200}
-    ,{   210,   210,   200,   190,   200}
-    ,{   200,   190,   180,   200,   180}
-    ,{   180,   180,   170,   160,   170}
-    ,{   190,   190,   170,   190,   170}
-    }
-   ,{{   210,   210,   200,   190,   200}
-    ,{   210,   210,   200,   190,   200}
-    ,{   190,   190,   170,   160,   170}
-    ,{    50,    10,    50,   -10,    50}
-    ,{   190,   190,   170,   160,   170}
-    }
-   ,{{   190,   190,   170,   190,   170}
-    ,{   180,   180,   170,   160,   170}
-    ,{   190,   190,   170,   190,   170}
-    ,{   180,   180,   170,   160,   170}
-    ,{   190,   190,   170,   190,   170}
-    }
-   ,{{   190,   190,   170,   160,   170}
-    ,{   110,    70,   110,    50,   110}
-    ,{   190,   190,   170,   160,   170}
-    ,{   130,    50,    30,   130,    70}
-    ,{   190,   190,   170,   160,   170}
-    }
-   ,{{   200,   190,   180,   200,   180}
-    ,{   180,   180,   170,   160,   170}
-    ,{   200,   190,   180,   200,   180}
-    ,{   180,   180,   170,   160,   170}
-    ,{   170,   170,   100,    90,   100}
-    }
-   }
-  ,{{{   210,   210,   200,   200,   200}
-    ,{   210,   210,   200,   160,   200}
-    ,{   200,   190,   180,   200,   180}
-    ,{   180,   180,   170,   130,   170}
-    ,{   190,   190,   170,   190,   170}
-    }
-   ,{{   210,   210,   200,   160,   200}
-    ,{   210,   210,   200,   160,   200}
-    ,{   190,   190,   170,   130,   170}
-    ,{    10,    10,     0,   -40,     0}
-    ,{   190,   190,   170,   130,   170}
-    }
-   ,{{   190,   190,   170,   190,   170}
-    ,{   180,   180,   170,   130,   170}
-    ,{   190,   190,   170,   190,   170}
-    ,{   180,   180,   170,   130,   170}
-    ,{   190,   190,   170,   190,   170}
-    }
-   ,{{   190,   190,   170,   130,   170}
-    ,{    70,    70,    60,    20,    60}
-    ,{   190,   190,   170,   130,   170}
-    ,{   120,    50,    30,   120,    30}
-    ,{   190,   190,   170,   130,   170}
-    }
-   ,{{   200,   190,   180,   200,   180}
-    ,{   180,   180,   170,   130,   170}
-    ,{   200,   190,   180,   200,   180}
-    ,{   180,   180,   170,   130,   170}
-    ,{   170,   170,   100,    60,   100}
-    }
-   }
-  ,{{{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   170,   170,   170,   170,   170}
-    ,{   160,   160,   160,   160,   160}
-    ,{   170,   160,   170,   160,   170}
-    }
-   ,{{   190,   190,   190,   190,   190}
-    ,{   190,   190,   190,   190,   190}
-    ,{   170,   160,   170,   160,   170}
-    ,{    50,   -10,    50,   -10,    50}
-    ,{   170,   160,   170,   160,   170}
-    }
-   ,{{   170,   160,   170,   160,   170}
-    ,{   160,   160,   160,   160,   160}
-    ,{   170,   160,   170,   160,   170}
-    ,{   160,   160,   160,   160,   160}
-    ,{   170,   160,   170,   160,   170}
-    }
-   ,{{   170,   160,   170,   160,   170}
-    ,{   110,    50,   110,    50,   110}
-    ,{   170,   160,   170,   160,   170}
-    ,{    30,    20,    30,    20,    30}
-    ,{   170,   160,   170,   160,   170}
-    }
-   ,{{   170,   170,   170,   170,   170}
-    ,{   160,   160,   160,   160,   160}
-    ,{   170,   170,   170,   170,   170}
-    ,{   160,   160,   160,   160,   160}
-    ,{    90,    90,    90,    90,    90}
-    }
-   }
-  ,{{{   200,   130,   200,   130,   200}
-    ,{   200,    90,   200,    40,   200}
-    ,{   180,   130,   180,    20,   180}
-    ,{   170,    60,   170,   130,   170}
-    ,{   170,   120,   170,    70,   170}
-    }
-   ,{{   200,    90,   200,    40,   200}
-    ,{   200,    90,   200,    40,   200}
-    ,{   170,    60,   170,    10,   170}
-    ,{     0,  -110,     0,   -30,     0}
-    ,{   170,    60,   170,    10,   170}
-    }
-   ,{{   170,   120,   170,    10,   170}
-    ,{   170,    60,   170,    10,   170}
-    ,{   170,   120,   170,    10,   170}
-    ,{   170,    60,   170,    10,   170}
-    ,{   170,   120,   170,    10,   170}
-    }
-   ,{{   170,    60,   170,   130,   170}
-    ,{    60,   -50,    60,    30,    60}
-    ,{   170,    60,   170,    10,   170}
-    ,{   130,    50,    30,   130,    30}
-    ,{   170,    60,   170,    10,   170}
-    }
-   ,{{   180,   130,   180,    70,   180}
-    ,{   170,    60,   170,    10,   170}
-    ,{   180,   130,   180,    20,   180}
-    ,{   170,    60,   170,    10,   170}
-    ,{   100,   -10,   100,    70,   100}
-    }
-   }
-  ,{{{   190,   190,   190,   190,   160}
-    ,{   190,   190,   190,   190,   160}
-    ,{   170,   170,   170,   170,    80}
-    ,{   160,   160,   160,   160,    70}
-    ,{   170,   160,   170,   160,    80}
-    }
-   ,{{   190,   190,   190,   190,   160}
-    ,{   190,   190,   190,   190,   160}
-    ,{   170,   160,   170,   160,    80}
-    ,{    50,   -10,    50,   -10,  -100}
-    ,{   170,   160,   170,   160,    80}
-    }
-   ,{{   170,   160,   170,   160,    80}
-    ,{   160,   160,   160,   160,    70}
-    ,{   170,   160,   170,   160,    80}
-    ,{   160,   160,   160,   160,    70}
-    ,{   170,   160,   170,   160,    80}
-    }
-   ,{{   170,   160,   170,   160,    80}
-    ,{   110,    50,   110,    50,   -30}
-    ,{   170,   160,   170,   160,    80}
-    ,{    70,    20,    30,    20,    70}
-    ,{   170,   160,   170,   160,    80}
-    }
-   ,{{   170,   170,   170,   170,    80}
-    ,{   160,   160,   160,   160,    70}
-    ,{   170,   170,   170,   170,    80}
-    ,{   160,   160,   160,   160,    70}
-    ,{    90,    90,    90,    90,     0}
-    }
-   }
-  }
- ,{{{{   370,   370,   330,   320,   330}
-    ,{   340,   340,   330,   320,   330}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   280,   290}
-    ,{   370,   370,   290,   310,   290}
-    }
-   ,{{   340,   340,   330,   320,   330}
-    ,{   340,   340,   330,   320,   330}
-    ,{   310,   310,   290,   280,   290}
-    ,{   270,   230,   270,   200,   270}
-    ,{   310,   310,   290,   280,   290}
-    }
-   ,{{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   280,   290}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   280,   290}
-    ,{   310,   310,   290,   310,   290}
-    }
-   ,{{   310,   310,   310,   280,   310}
-    ,{   310,   270,   310,   240,   310}
-    ,{   310,   310,   290,   280,   290}
-    ,{   260,   180,   160,   260,   200}
-    ,{   310,   310,   290,   280,   290}
-    }
-   ,{{   370,   370,   290,   310,   290}
-    ,{   310,   310,   290,   280,   290}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   280,   290}
-    ,{   370,   370,   290,   280,   290}
-    }
-   }
-  ,{{{   370,   370,   330,   310,   330}
-    ,{   340,   340,   330,   290,   330}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   370,   370,   290,   310,   290}
-    }
-   ,{{   340,   340,   330,   290,   330}
-    ,{   340,   340,   330,   290,   330}
-    ,{   310,   310,   290,   250,   290}
-    ,{   230,   230,   210,   170,   210}
-    ,{   310,   310,   290,   250,   290}
-    }
-   ,{{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   310,   310,   290,   310,   290}
-    }
-   ,{{   310,   310,   290,   250,   290}
-    ,{   270,   270,   250,   210,   250}
-    ,{   310,   310,   290,   250,   290}
-    ,{   250,   180,   160,   250,   160}
-    ,{   310,   310,   290,   250,   290}
-    }
-   ,{{   370,   370,   290,   310,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   370,   370,   290,   250,   290}
-    }
-   }
-  ,{{{   320,   320,   320,   320,   320}
-    ,{   320,   320,   320,   320,   320}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    }
-   ,{{   320,   320,   320,   320,   320}
-    ,{   320,   320,   320,   320,   320}
-    ,{   290,   280,   290,   280,   290}
-    ,{   270,   200,   270,   200,   270}
-    ,{   290,   280,   290,   280,   290}
-    }
-   ,{{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    }
-   ,{{   310,   280,   310,   280,   310}
-    ,{   310,   240,   310,   240,   310}
-    ,{   290,   280,   290,   280,   290}
-    ,{   160,   150,   160,   150,   160}
-    ,{   290,   280,   290,   280,   290}
-    }
-   ,{{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    }
-   }
-  ,{{{   330,   240,   330,   260,   330}
-    ,{   330,   220,   330,   220,   330}
-    ,{   290,   240,   290,   130,   290}
-    ,{   290,   180,   290,   260,   290}
-    ,{   290,   240,   290,   260,   290}
-    }
-   ,{{   330,   220,   330,   180,   330}
-    ,{   330,   220,   330,   170,   330}
-    ,{   290,   180,   290,   130,   290}
-    ,{   210,   100,   210,   180,   210}
-    ,{   290,   180,   290,   130,   290}
-    }
-   ,{{   290,   240,   290,   130,   290}
-    ,{   290,   180,   290,   130,   290}
-    ,{   290,   240,   290,   130,   290}
-    ,{   290,   180,   290,   130,   290}
-    ,{   290,   240,   290,   130,   290}
-    }
-   ,{{   290,   180,   290,   260,   290}
-    ,{   250,   140,   250,   220,   250}
-    ,{   290,   180,   290,   130,   290}
-    ,{   260,   180,   160,   260,   160}
-    ,{   290,   180,   290,   130,   290}
-    }
-   ,{{   290,   240,   290,   260,   290}
-    ,{   290,   180,   290,   130,   290}
-    ,{   290,   240,   290,   130,   290}
-    ,{   290,   180,   290,   130,   290}
-    ,{   290,   180,   290,   260,   290}
-    }
-   }
-  ,{{{   320,   320,   320,   320,   290}
-    ,{   320,   320,   320,   320,   290}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    }
-   ,{{   320,   320,   320,   320,   290}
-    ,{   320,   320,   320,   320,   290}
-    ,{   290,   280,   290,   280,   200}
-    ,{   270,   200,   270,   200,   120}
-    ,{   290,   280,   290,   280,   200}
-    }
-   ,{{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    }
-   ,{{   310,   280,   310,   280,   200}
-    ,{   310,   240,   310,   240,   160}
-    ,{   290,   280,   290,   280,   200}
-    ,{   200,   150,   160,   150,   200}
-    ,{   290,   280,   290,   280,   200}
-    }
-   ,{{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    }
-   }
-  }
- ,{{{{   350,   340,   350,   280,   350}
-    ,{   350,   310,   350,   280,   350}
-    ,{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   340,   340,   260,   280,   260}
-    }
-   ,{{   280,   280,   260,   250,   260}
-    ,{   240,   240,   230,   220,   230}
-    ,{   280,   280,   260,   250,   260}
-    ,{   180,   140,   180,   120,   180}
-    ,{   280,   280,   260,   250,   260}
-    }
-   ,{{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   280,   280,   260,   280,   260}
-    }
-   ,{{   350,   310,   350,   280,   350}
-    ,{   350,   310,   350,   280,   350}
-    ,{   280,   280,   260,   250,   260}
-    ,{   230,   150,   130,   230,   170}
-    ,{   280,   280,   260,   250,   260}
-    }
-   ,{{   340,   340,   260,   280,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   340,   340,   260,   250,   260}
-    }
-   }
-  ,{{{   340,   340,   290,   280,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   340,   340,   260,   280,   260}
-    }
-   ,{{   280,   280,   260,   220,   260}
-    ,{   240,   240,   230,   190,   230}
-    ,{   280,   280,   260,   220,   260}
-    ,{   140,   140,   130,    90,   130}
-    ,{   280,   280,   260,   220,   260}
-    }
-   ,{{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   280,   280,   260,   280,   260}
-    }
-   ,{{   310,   310,   290,   250,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   280,   280,   260,   220,   260}
-    ,{   220,   150,   130,   220,   130}
-    ,{   280,   280,   260,   220,   260}
-    }
-   ,{{   340,   340,   260,   280,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   340,   340,   260,   220,   260}
-    }
-   }
-  ,{{{   350,   280,   350,   280,   350}
-    ,{   350,   280,   350,   280,   350}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    }
-   ,{{   260,   250,   260,   250,   260}
-    ,{   220,   220,   220,   220,   220}
-    ,{   260,   250,   260,   250,   260}
-    ,{   180,   120,   180,   120,   180}
-    ,{   260,   250,   260,   250,   260}
-    }
-   ,{{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    }
-   ,{{   350,   280,   350,   280,   350}
-    ,{   350,   280,   350,   280,   350}
-    ,{   260,   250,   260,   250,   260}
-    ,{   130,   120,   130,   120,   130}
-    ,{   260,   250,   260,   250,   260}
-    }
-   ,{{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    }
-   }
-  ,{{{   290,   210,   290,   260,   290}
-    ,{   290,   180,   290,   260,   290}
-    ,{   260,   210,   260,   100,   260}
-    ,{   260,   150,   260,   230,   260}
-    ,{   260,   210,   260,   230,   260}
-    }
-   ,{{   260,   150,   260,   100,   260}
-    ,{   230,   120,   230,    70,   230}
-    ,{   260,   150,   260,   100,   260}
-    ,{   130,    20,   130,   100,   130}
-    ,{   260,   150,   260,   100,   260}
-    }
-   ,{{   260,   210,   260,   100,   260}
-    ,{   260,   150,   260,   100,   260}
-    ,{   260,   210,   260,   100,   260}
-    ,{   260,   150,   260,   100,   260}
-    ,{   260,   210,   260,   100,   260}
-    }
-   ,{{   290,   180,   290,   260,   290}
-    ,{   290,   180,   290,   260,   290}
-    ,{   260,   150,   260,   100,   260}
-    ,{   230,   150,   130,   230,   130}
-    ,{   260,   150,   260,   100,   260}
-    }
-   ,{{   260,   210,   260,   230,   260}
-    ,{   260,   150,   260,   100,   260}
-    ,{   260,   210,   260,   100,   260}
-    ,{   260,   150,   260,   100,   260}
-    ,{   260,   150,   260,   230,   260}
-    }
-   }
-  ,{{{   350,   280,   350,   280,   200}
-    ,{   350,   280,   350,   280,   200}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    }
-   ,{{   260,   250,   260,   250,   190}
-    ,{   220,   220,   220,   220,   190}
-    ,{   260,   250,   260,   250,   170}
-    ,{   180,   120,   180,   120,    30}
-    ,{   260,   250,   260,   250,   170}
-    }
-   ,{{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    }
-   ,{{   350,   280,   350,   280,   200}
-    ,{   350,   280,   350,   280,   200}
-    ,{   260,   250,   260,   250,   170}
-    ,{   170,   120,   130,   120,   170}
-    ,{   260,   250,   260,   250,   170}
-    }
-   ,{{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    }
-   }
-  }
- ,{{{{   280,   280,   260,   260,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   260,   260,   240,   260,   240}
-    ,{   260,   260,   250,   240,   250}
-    ,{   260,   260,   240,   260,   240}
-    }
-   ,{{   280,   280,   260,   250,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   250,   250,   240,   230,   240}
-    ,{   190,   150,   190,   130,   190}
-    ,{   250,   250,   240,   230,   240}
-    }
-   ,{{   260,   260,   250,   260,   250}
-    ,{   260,   260,   250,   240,   250}
-    ,{   260,   260,   240,   260,   240}
-    ,{   260,   260,   250,   240,   250}
-    ,{   260,   260,   240,   260,   240}
-    }
-   ,{{   260,   250,   260,   230,   260}
-    ,{   260,   220,   260,   200,   260}
-    ,{   250,   250,   240,   230,   240}
-    ,{   190,   110,    90,   190,   120}
-    ,{   250,   250,   240,   230,   240}
-    }
-   ,{{   260,   260,   250,   260,   250}
-    ,{   260,   260,   250,   240,   250}
-    ,{   260,   260,   240,   260,   240}
-    ,{   260,   260,   250,   240,   250}
-    ,{   230,   230,   150,   140,   150}
-    }
-   }
-  ,{{{   280,   280,   260,   260,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   260,   260,   240,   260,   240}
-    ,{   260,   260,   250,   210,   250}
-    ,{   260,   260,   240,   260,   240}
-    }
-   ,{{   280,   280,   260,   220,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   250,   250,   240,   200,   240}
-    ,{   150,   150,   140,   100,   140}
-    ,{   250,   250,   240,   200,   240}
-    }
-   ,{{   260,   260,   250,   260,   250}
-    ,{   260,   260,   250,   210,   250}
-    ,{   260,   260,   240,   260,   240}
-    ,{   260,   260,   250,   210,   250}
-    ,{   260,   260,   240,   260,   240}
-    }
-   ,{{   250,   250,   240,   200,   240}
-    ,{   220,   220,   210,   170,   210}
-    ,{   250,   250,   240,   200,   240}
-    ,{   180,   100,    90,   180,    90}
-    ,{   250,   250,   240,   200,   240}
-    }
-   ,{{   260,   260,   250,   260,   250}
-    ,{   260,   260,   250,   210,   250}
-    ,{   260,   260,   240,   260,   240}
-    ,{   260,   260,   250,   210,   250}
-    ,{   230,   230,   150,   110,   150}
-    }
-   }
-  ,{{{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   240,   230,   240,   230,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   240,   230,   240,   230,   240}
-    }
-   ,{{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   230,   230,   230,   230,   230}
-    ,{   190,   130,   190,   130,   190}
-    ,{   230,   230,   230,   230,   230}
-    }
-   ,{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   240,   230,   240,   230,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   240,   230,   240,   230,   240}
-    }
-   ,{{   260,   230,   260,   230,   260}
-    ,{   260,   200,   260,   200,   260}
-    ,{   230,   230,   230,   230,   230}
-    ,{    80,    80,    80,    80,    80}
-    ,{   230,   230,   230,   230,   230}
-    }
-   ,{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   240,   230,   240,   230,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   150,   140,   150,   140,   150}
-    }
-   }
-  ,{{{   260,   190,   260,   190,   260}
-    ,{   260,   150,   260,   180,   260}
-    ,{   240,   190,   240,    80,   240}
-    ,{   250,   140,   250,   190,   250}
-    ,{   240,   190,   240,   120,   240}
-    }
-   ,{{   260,   150,   260,   110,   260}
-    ,{   260,   150,   260,   100,   260}
-    ,{   240,   130,   240,    80,   240}
-    ,{   140,    30,   140,   110,   140}
-    ,{   240,   130,   240,    80,   240}
-    }
-   ,{{   250,   190,   250,    90,   250}
-    ,{   250,   140,   250,    90,   250}
-    ,{   240,   190,   240,    80,   240}
-    ,{   250,   140,   250,    90,   250}
-    ,{   240,   190,   240,    80,   240}
-    }
-   ,{{   240,   130,   240,   190,   240}
-    ,{   210,   100,   210,   180,   210}
-    ,{   240,   130,   240,    80,   240}
-    ,{   190,   110,    90,   190,    90}
-    ,{   240,   130,   240,    80,   240}
-    }
-   ,{{   250,   190,   250,   120,   250}
-    ,{   250,   140,   250,    90,   250}
-    ,{   240,   190,   240,    80,   240}
-    ,{   250,   140,   250,    90,   250}
-    ,{   150,    40,   150,   120,   150}
-    }
-   }
-  ,{{{   260,   250,   260,   250,   230}
-    ,{   260,   250,   260,   250,   230}
-    ,{   240,   230,   240,   230,   150}
-    ,{   240,   240,   240,   240,   150}
-    ,{   240,   230,   240,   230,   150}
-    }
-   ,{{   260,   250,   260,   250,   230}
-    ,{   260,   250,   260,   250,   230}
-    ,{   230,   230,   230,   230,   140}
-    ,{   190,   130,   190,   130,    40}
-    ,{   230,   230,   230,   230,   140}
-    }
-   ,{{   240,   240,   240,   240,   150}
-    ,{   240,   240,   240,   240,   150}
-    ,{   240,   230,   240,   230,   150}
-    ,{   240,   240,   240,   240,   150}
-    ,{   240,   230,   240,   230,   150}
-    }
-   ,{{   260,   230,   260,   230,   140}
-    ,{   260,   200,   260,   200,   110}
-    ,{   230,   230,   230,   230,   140}
-    ,{   120,    80,    80,    80,   120}
-    ,{   230,   230,   230,   230,   140}
-    }
-   ,{{   240,   240,   240,   240,   150}
-    ,{   240,   240,   240,   240,   150}
-    ,{   240,   230,   240,   230,   150}
-    ,{   240,   240,   240,   240,   150}
-    ,{   150,   140,   150,   140,    60}
-    }
-   }
-  }
- ,{{{{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   280,   280,   260,   280,   260}
-    }
-   ,{{   280,   280,   260,   250,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   230,   230,   220,   210,   220}
-    ,{   210,   170,   210,   150,   210}
-    ,{   230,   230,   220,   210,   220}
-    }
-   ,{{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   280,   280,   260,   280,   260}
-    }
-   ,{{   230,   230,   220,   210,   220}
-    ,{   220,   180,   220,   160,   220}
-    ,{   230,   230,   220,   210,   220}
-    ,{   210,   130,   110,   210,   140}
-    ,{   230,   230,   220,   210,   220}
-    }
-   ,{{   280,   280,   260,   250,   260}
-    ,{   280,   280,   260,   250,   260}
-    ,{   250,   250,   230,   250,   230}
-    ,{   280,   280,   260,   250,   260}
-    ,{   250,   250,   180,   170,   180}
-    }
-   }
-  ,{{{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   280,   280,   260,   280,   260}
-    }
-   ,{{   280,   280,   260,   220,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   230,   230,   220,   180,   220}
-    ,{   170,   170,   160,   120,   160}
-    ,{   230,   230,   220,   180,   220}
-    }
-   ,{{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   280,   280,   260,   280,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   280,   280,   260,   280,   260}
-    }
-   ,{{   230,   230,   220,   200,   220}
-    ,{   180,   180,   170,   130,   170}
-    ,{   230,   230,   220,   180,   220}
-    ,{   200,   120,   110,   200,   110}
-    ,{   230,   230,   220,   180,   220}
-    }
-   ,{{   280,   280,   260,   250,   260}
-    ,{   280,   280,   260,   220,   260}
-    ,{   250,   250,   230,   250,   230}
-    ,{   280,   280,   260,   220,   260}
-    ,{   250,   250,   180,   140,   180}
-    }
-   }
-  ,{{{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    }
-   ,{{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   210,   210,   210,   210,   210}
-    ,{   210,   150,   210,   150,   210}
-    ,{   210,   210,   210,   210,   210}
-    }
-   ,{{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    }
-   ,{{   220,   210,   220,   210,   220}
-    ,{   220,   160,   220,   160,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   100,   100,   100,   100,   100}
-    ,{   210,   210,   210,   210,   210}
-    }
-   ,{{   260,   250,   260,   250,   260}
-    ,{   260,   250,   260,   250,   260}
-    ,{   230,   220,   230,   220,   230}
-    ,{   260,   250,   260,   250,   260}
-    ,{   170,   170,   170,   170,   170}
-    }
-   }
-  ,{{{   260,   210,   260,   210,   260}
-    ,{   260,   150,   260,   140,   260}
-    ,{   260,   210,   260,   100,   260}
-    ,{   260,   150,   260,   210,   260}
-    ,{   260,   210,   260,   150,   260}
-    }
-   ,{{   260,   150,   260,   130,   260}
-    ,{   260,   150,   260,   100,   260}
-    ,{   220,   110,   220,    60,   220}
-    ,{   160,    50,   160,   130,   160}
-    ,{   220,   110,   220,    60,   220}
-    }
-   ,{{   260,   210,   260,   100,   260}
-    ,{   260,   150,   260,   100,   260}
-    ,{   260,   210,   260,   100,   260}
-    ,{   260,   150,   260,   100,   260}
-    ,{   260,   210,   260,   100,   260}
-    }
-   ,{{   220,   130,   220,   210,   220}
-    ,{   170,    60,   170,   140,   170}
-    ,{   220,   110,   220,    60,   220}
-    ,{   210,   130,   110,   210,   110}
-    ,{   220,   110,   220,    60,   220}
-    }
-   ,{{   260,   180,   260,   150,   260}
-    ,{   260,   150,   260,   100,   260}
-    ,{   230,   180,   230,    70,   230}
-    ,{   260,   150,   260,   100,   260}
-    ,{   180,    70,   180,   150,   180}
-    }
-   }
-  ,{{{   260,   250,   260,   250,   230}
-    ,{   260,   250,   260,   250,   230}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    }
-   ,{{   260,   250,   260,   250,   230}
-    ,{   260,   250,   260,   250,   230}
-    ,{   210,   210,   210,   210,   120}
-    ,{   210,   150,   210,   150,    60}
-    ,{   210,   210,   210,   210,   120}
-    }
-   ,{{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    }
-   ,{{   220,   210,   220,   210,   140}
-    ,{   220,   160,   220,   160,    70}
-    ,{   210,   210,   210,   210,   120}
-    ,{   140,   100,   100,   100,   140}
-    ,{   210,   210,   210,   210,   120}
-    }
-   ,{{   260,   250,   260,   250,   170}
-    ,{   260,   250,   260,   250,   170}
-    ,{   230,   220,   230,   220,   140}
-    ,{   260,   250,   260,   250,   170}
-    ,{   170,   170,   170,   170,    80}
-    }
-   }
-  }
- ,{{{{   370,   370,   350,   320,   350}
-    ,{   350,   340,   350,   320,   350}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   280,   290}
-    ,{   370,   370,   290,   310,   290}
-    }
-   ,{{   340,   340,   330,   320,   330}
-    ,{   340,   340,   330,   320,   330}
-    ,{   310,   310,   290,   280,   290}
-    ,{   270,   230,   270,   200,   270}
-    ,{   310,   310,   290,   280,   290}
-    }
-   ,{{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   280,   290}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   280,   290}
-    ,{   310,   310,   290,   310,   290}
-    }
-   ,{{   350,   310,   350,   280,   350}
-    ,{   350,   310,   350,   280,   350}
-    ,{   310,   310,   290,   280,   290}
-    ,{   260,   180,   160,   260,   200}
-    ,{   310,   310,   290,   280,   290}
-    }
-   ,{{   370,   370,   290,   310,   290}
-    ,{   310,   310,   290,   280,   290}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   280,   290}
-    ,{   370,   370,   290,   280,   290}
-    }
-   }
-  ,{{{   370,   370,   330,   310,   330}
-    ,{   340,   340,   330,   290,   330}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   370,   370,   290,   310,   290}
-    }
-   ,{{   340,   340,   330,   290,   330}
-    ,{   340,   340,   330,   290,   330}
-    ,{   310,   310,   290,   250,   290}
-    ,{   230,   230,   210,   170,   210}
-    ,{   310,   310,   290,   250,   290}
-    }
-   ,{{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   310,   310,   290,   310,   290}
-    }
-   ,{{   310,   310,   290,   250,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   250,   180,   160,   250,   160}
-    ,{   310,   310,   290,   250,   290}
-    }
-   ,{{   370,   370,   290,   310,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   310,   310,   290,   310,   290}
-    ,{   310,   310,   290,   250,   290}
-    ,{   370,   370,   290,   250,   290}
-    }
-   }
-  ,{{{   350,   320,   350,   320,   350}
-    ,{   350,   320,   350,   320,   350}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    }
-   ,{{   320,   320,   320,   320,   320}
-    ,{   320,   320,   320,   320,   320}
-    ,{   290,   280,   290,   280,   290}
-    ,{   270,   200,   270,   200,   270}
-    ,{   290,   280,   290,   280,   290}
-    }
-   ,{{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    }
-   ,{{   350,   280,   350,   280,   350}
-    ,{   350,   280,   350,   280,   350}
-    ,{   290,   280,   290,   280,   290}
-    ,{   160,   150,   160,   150,   160}
-    ,{   290,   280,   290,   280,   290}
-    }
-   ,{{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    ,{   290,   280,   290,   280,   290}
-    }
-   }
-  ,{{{   330,   240,   330,   260,   330}
-    ,{   330,   220,   330,   260,   330}
-    ,{   290,   240,   290,   130,   290}
-    ,{   290,   180,   290,   260,   290}
-    ,{   290,   240,   290,   260,   290}
-    }
-   ,{{   330,   220,   330,   180,   330}
-    ,{   330,   220,   330,   170,   330}
-    ,{   290,   180,   290,   130,   290}
-    ,{   210,   100,   210,   180,   210}
-    ,{   290,   180,   290,   130,   290}
-    }
-   ,{{   290,   240,   290,   130,   290}
-    ,{   290,   180,   290,   130,   290}
-    ,{   290,   240,   290,   130,   290}
-    ,{   290,   180,   290,   130,   290}
-    ,{   290,   240,   290,   130,   290}
-    }
-   ,{{   290,   180,   290,   260,   290}
-    ,{   290,   180,   290,   260,   290}
-    ,{   290,   180,   290,   130,   290}
-    ,{   260,   180,   160,   260,   160}
-    ,{   290,   180,   290,   130,   290}
-    }
-   ,{{   290,   240,   290,   260,   290}
-    ,{   290,   180,   290,   130,   290}
-    ,{   290,   240,   290,   130,   290}
-    ,{   290,   180,   290,   130,   290}
-    ,{   290,   180,   290,   260,   290}
-    }
-   }
-  ,{{{   350,   320,   350,   320,   290}
-    ,{   350,   320,   350,   320,   290}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    }
-   ,{{   320,   320,   320,   320,   290}
-    ,{   320,   320,   320,   320,   290}
-    ,{   290,   280,   290,   280,   200}
-    ,{   270,   200,   270,   200,   120}
-    ,{   290,   280,   290,   280,   200}
-    }
-   ,{{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    }
-   ,{{   350,   280,   350,   280,   200}
-    ,{   350,   280,   350,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   200,   150,   160,   150,   200}
-    ,{   290,   280,   290,   280,   200}
-    }
-   ,{{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    ,{   290,   280,   290,   280,   200}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   240,   240,   240,   190,   240}
-    ,{   240,   240,   240,   190,   240}
-    ,{   220,   220,   220,   190,   220}
-    ,{   240,   240,   240,   190,   240}
-    ,{   210,   210,   210,   170,   210}
-    }
-   ,{{   200,   200,   200,   150,   200}
-    ,{   200,   200,   200,   150,   200}
-    ,{   190,   190,   190,   150,   190}
-    ,{   160,   100,   160,    80,   130}
-    ,{   190,   190,   190,   150,   190}
-    }
-   ,{{   240,   240,   240,   190,   240}
-    ,{   240,   240,   240,   190,   240}
-    ,{   220,   220,   220,   190,   220}
-    ,{   240,   240,   240,   190,   240}
-    ,{   210,   210,   210,   170,   210}
-    }
-   ,{{   190,   190,   190,   150,   190}
-    ,{   160,   100,   160,    80,   130}
-    ,{   190,   190,   190,   150,   190}
-    ,{   150,    70,    50,   150,    90}
-    ,{   190,   190,   190,   150,   190}
-    }
-   ,{{   240,   240,   240,   190,   240}
-    ,{   240,   240,   240,   190,   240}
-    ,{   210,   210,   210,   170,   210}
-    ,{   240,   240,   240,   190,   240}
-    ,{   180,   180,   120,    90,   120}
-    }
-   }
-  ,{{{   240,   240,   240,   190,   240}
-    ,{   240,   240,   240,   140,   240}
-    ,{   220,   220,   220,   190,   220}
-    ,{   240,   240,   240,   140,   240}
-    ,{   210,   210,   210,   170,   210}
-    }
-   ,{{   200,   200,   200,   100,   200}
-    ,{   200,   200,   200,   100,   200}
-    ,{   190,   190,   190,   100,   190}
-    ,{   100,   100,   100,    10,   100}
-    ,{   190,   190,   190,   100,   190}
-    }
-   ,{{   240,   240,   240,   190,   240}
-    ,{   240,   240,   240,   140,   240}
-    ,{   220,   220,   220,   190,   220}
-    ,{   240,   240,   240,   140,   240}
-    ,{   210,   210,   210,   170,   210}
-    }
-   ,{{   190,   190,   190,   100,   190}
-    ,{   100,   100,   100,    10,   100}
-    ,{   190,   190,   190,   100,   190}
-    ,{    80,    50,    50,    80,    50}
-    ,{   190,   190,   190,   100,   190}
-    }
-   ,{{   240,   240,   240,   170,   240}
-    ,{   240,   240,   240,   140,   240}
-    ,{   210,   210,   210,   170,   210}
-    ,{   240,   240,   240,   140,   240}
-    ,{   180,   180,   120,    20,   120}
-    }
-   }
-  ,{{{   240,   190,   240,   190,   210}
-    ,{   240,   190,   240,   190,   210}
-    ,{   220,   180,   220,   180,   190}
-    ,{   240,   190,   240,   190,   210}
-    ,{   210,   160,   210,   160,   180}
-    }
-   ,{{   200,   150,   200,   150,   170}
-    ,{   200,   150,   200,   150,   170}
-    ,{   190,   150,   190,   150,   160}
-    ,{   160,    60,   160,    60,   130}
-    ,{   190,   150,   190,   150,   160}
-    }
-   ,{{   240,   190,   240,   190,   210}
-    ,{   240,   190,   240,   190,   210}
-    ,{   220,   180,   220,   180,   190}
-    ,{   240,   190,   240,   190,   210}
-    ,{   210,   160,   210,   160,   180}
-    }
-   ,{{   190,   150,   190,   150,   160}
-    ,{   160,    60,   160,    60,   130}
-    ,{   190,   150,   190,   150,   160}
-    ,{    50,     0,    50,     0,    20}
-    ,{   190,   150,   190,   150,   160}
-    }
-   ,{{   240,   190,   240,   190,   210}
-    ,{   240,   190,   240,   190,   210}
-    ,{   210,   160,   210,   160,   180}
-    ,{   240,   190,   240,   190,   210}
-    ,{   120,    70,   120,    70,    90}
-    }
-   }
-  ,{{{   240,   180,   240,   150,   240}
-    ,{   240,   130,   240,    80,   240}
-    ,{   220,   180,   220,    70,   220}
-    ,{   240,   130,   240,   150,   240}
-    ,{   210,   160,   210,    90,   210}
-    }
-   ,{{   200,    90,   200,    80,   200}
-    ,{   200,    90,   200,    40,   200}
-    ,{   190,    90,   190,    40,   190}
-    ,{   100,     0,   100,    80,   100}
-    ,{   190,    90,   190,    40,   190}
-    }
-   ,{{   240,   180,   240,    80,   240}
-    ,{   240,   130,   240,    80,   240}
-    ,{   220,   180,   220,    70,   220}
-    ,{   240,   130,   240,    80,   240}
-    ,{   210,   160,   210,    50,   210}
-    }
-   ,{{   190,    90,   190,   150,   190}
-    ,{   100,     0,   100,    80,   100}
-    ,{   190,    90,   190,    40,   190}
-    ,{   150,    70,    50,   150,    50}
-    ,{   190,    90,   190,    40,   190}
-    }
-   ,{{   240,   160,   240,    90,   240}
-    ,{   240,   130,   240,    80,   240}
-    ,{   210,   160,   210,    50,   210}
-    ,{   240,   130,   240,    80,   240}
-    ,{   120,    10,   120,    90,   120}
-    }
-   }
-  ,{{{   240,   190,   240,   190,   170}
-    ,{   240,   190,   240,   190,   170}
-    ,{   220,   180,   220,   180,   140}
-    ,{   240,   190,   240,   190,   150}
-    ,{   210,   160,   210,   160,   120}
-    }
-   ,{{   200,   150,   200,   150,   170}
-    ,{   200,   150,   200,   150,   170}
-    ,{   190,   150,   190,   150,   110}
-    ,{   160,    60,   160,    60,    20}
-    ,{   190,   150,   190,   150,   110}
-    }
-   ,{{   240,   190,   240,   190,   150}
-    ,{   240,   190,   240,   190,   150}
-    ,{   220,   180,   220,   180,   140}
-    ,{   240,   190,   240,   190,   150}
-    ,{   210,   160,   210,   160,   120}
-    }
-   ,{{   190,   150,   190,   150,   110}
-    ,{   160,    60,   160,    60,    20}
-    ,{   190,   150,   190,   150,   110}
-    ,{    90,     0,    50,     0,    90}
-    ,{   190,   150,   190,   150,   110}
-    }
-   ,{{   240,   190,   240,   190,   150}
-    ,{   240,   190,   240,   190,   150}
-    ,{   210,   160,   210,   160,   120}
-    ,{   240,   190,   240,   190,   150}
-    ,{   120,    70,   120,    70,    30}
-    }
-   }
-  }
- ,{{{{   210,   210,   210,   170,   210}
-    ,{   210,   210,   210,   170,   210}
-    ,{   190,   190,   190,   160,   190}
-    ,{   180,   180,   180,   150,   180}
-    ,{   190,   190,   190,   150,   190}
-    }
-   ,{{   210,   210,   210,   170,   210}
-    ,{   210,   210,   210,   170,   210}
-    ,{   190,   190,   190,   140,   190}
-    ,{    70,    10,    70,   -10,    40}
-    ,{   190,   190,   190,   140,   190}
-    }
-   ,{{   190,   190,   190,   150,   190}
-    ,{   180,   180,   180,   140,   180}
-    ,{   190,   190,   190,   150,   190}
-    ,{   180,   180,   180,   140,   180}
-    ,{   190,   190,   190,   150,   190}
-    }
-   ,{{   190,   190,   190,   150,   190}
-    ,{   130,    70,   130,    50,   100}
-    ,{   190,   190,   190,   140,   190}
-    ,{   150,    70,    50,   150,    90}
-    ,{   190,   190,   190,   140,   190}
-    }
-   ,{{   190,   190,   190,   160,   190}
-    ,{   180,   180,   180,   140,   180}
-    ,{   190,   190,   190,   160,   190}
-    ,{   180,   180,   180,   140,   180}
-    ,{   170,   170,   110,    90,   110}
-    }
-   }
-  ,{{{   210,   210,   210,   160,   210}
-    ,{   210,   210,   210,   120,   210}
-    ,{   190,   190,   190,   160,   190}
-    ,{   180,   180,   180,    90,   180}
-    ,{   190,   190,   190,   150,   190}
-    }
-   ,{{   210,   210,   210,   120,   210}
-    ,{   210,   210,   210,   120,   210}
-    ,{   190,   190,   190,    90,   190}
-    ,{    10,    10,    10,   -80,    10}
-    ,{   190,   190,   190,    90,   190}
-    }
-   ,{{   190,   190,   190,   150,   190}
-    ,{   180,   180,   180,    90,   180}
-    ,{   190,   190,   190,   150,   190}
-    ,{   180,   180,   180,    90,   180}
-    ,{   190,   190,   190,   150,   190}
-    }
-   ,{{   190,   190,   190,    90,   190}
-    ,{    70,    70,    70,   -20,    70}
-    ,{   190,   190,   190,    90,   190}
-    ,{    80,    50,    50,    80,    50}
-    ,{   190,   190,   190,    90,   190}
-    }
-   ,{{   190,   190,   190,   160,   190}
-    ,{   180,   180,   180,    90,   180}
-    ,{   190,   190,   190,   160,   190}
-    ,{   180,   180,   180,    90,   180}
-    ,{   170,   170,   110,    20,   110}
-    }
-   }
-  ,{{{   210,   170,   210,   170,   180}
-    ,{   210,   170,   210,   170,   180}
-    ,{   190,   150,   190,   150,   160}
-    ,{   180,   140,   180,   140,   150}
-    ,{   190,   140,   190,   140,   160}
-    }
-   ,{{   210,   170,   210,   170,   180}
-    ,{   210,   170,   210,   170,   180}
-    ,{   190,   140,   190,   140,   160}
-    ,{    70,   -30,    70,   -30,    40}
-    ,{   190,   140,   190,   140,   160}
-    }
-   ,{{   190,   140,   190,   140,   160}
-    ,{   180,   140,   180,   140,   150}
-    ,{   190,   140,   190,   140,   160}
-    ,{   180,   140,   180,   140,   150}
-    ,{   190,   140,   190,   140,   160}
-    }
-   ,{{   190,   140,   190,   140,   160}
-    ,{   130,    30,   130,    30,   100}
-    ,{   190,   140,   190,   140,   160}
-    ,{    50,     0,    50,     0,    20}
-    ,{   190,   140,   190,   140,   160}
-    }
-   ,{{   190,   150,   190,   150,   160}
-    ,{   180,   140,   180,   140,   150}
-    ,{   190,   150,   190,   150,   160}
-    ,{   180,   140,   180,   140,   150}
-    ,{   110,    70,   110,    70,    80}
-    }
-   }
-  ,{{{   210,   150,   210,   150,   210}
-    ,{   210,   110,   210,    60,   210}
-    ,{   190,   150,   190,    40,   190}
-    ,{   180,    80,   180,   150,   180}
-    ,{   190,   140,   190,    90,   190}
-    }
-   ,{{   210,   110,   210,    60,   210}
-    ,{   210,   110,   210,    60,   210}
-    ,{   190,    80,   190,    30,   190}
-    ,{    10,   -90,    10,   -10,    10}
-    ,{   190,    80,   190,    30,   190}
-    }
-   ,{{   190,   140,   190,    30,   190}
-    ,{   180,    80,   180,    30,   180}
-    ,{   190,   140,   190,    30,   190}
-    ,{   180,    80,   180,    30,   180}
-    ,{   190,   140,   190,    30,   190}
-    }
-   ,{{   190,    80,   190,   150,   190}
-    ,{    70,   -30,    70,    50,    70}
-    ,{   190,    80,   190,    30,   190}
-    ,{   150,    70,    50,   150,    50}
-    ,{   190,    80,   190,    30,   190}
-    }
-   ,{{   190,   150,   190,    90,   190}
-    ,{   180,    80,   180,    30,   180}
-    ,{   190,   150,   190,    40,   190}
-    ,{   180,    80,   180,    30,   180}
-    ,{   110,    10,   110,    90,   110}
-    }
-   }
-  ,{{{   210,   170,   210,   170,   190}
-    ,{   210,   170,   210,   170,   190}
-    ,{   190,   150,   190,   150,   110}
-    ,{   180,   140,   180,   140,   100}
-    ,{   190,   140,   190,   140,   100}
-    }
-   ,{{   210,   170,   210,   170,   190}
-    ,{   210,   170,   210,   170,   190}
-    ,{   190,   140,   190,   140,   100}
-    ,{    70,   -30,    70,   -30,   -70}
-    ,{   190,   140,   190,   140,   100}
-    }
-   ,{{   190,   140,   190,   140,   100}
-    ,{   180,   140,   180,   140,   100}
-    ,{   190,   140,   190,   140,   100}
-    ,{   180,   140,   180,   140,   100}
-    ,{   190,   140,   190,   140,   100}
-    }
-   ,{{   190,   140,   190,   140,   100}
-    ,{   130,    30,   130,    30,   -10}
-    ,{   190,   140,   190,   140,   100}
-    ,{    90,     0,    50,     0,    90}
-    ,{   190,   140,   190,   140,   100}
-    }
-   ,{{   190,   150,   190,   150,   110}
-    ,{   180,   140,   180,   140,   100}
-    ,{   190,   150,   190,   150,   110}
-    ,{   180,   140,   180,   140,   100}
-    ,{   110,    70,   110,    70,    30}
-    }
-   }
-  }
- ,{{{{   370,   370,   340,   300,   340}
-    ,{   340,   340,   340,   300,   340}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   280,   310}
-    ,{   370,   370,   310,   280,   310}
-    }
-   ,{{   340,   340,   340,   300,   340}
-    ,{   340,   340,   340,   300,   340}
-    ,{   310,   310,   310,   260,   310}
-    ,{   290,   230,   290,   200,   260}
-    ,{   310,   310,   310,   260,   310}
-    }
-   ,{{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   260,   310}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   260,   310}
-    ,{   310,   310,   310,   270,   310}
-    }
-   ,{{   330,   310,   330,   280,   310}
-    ,{   330,   270,   330,   240,   300}
-    ,{   310,   310,   310,   260,   310}
-    ,{   280,   200,   180,   280,   220}
-    ,{   310,   310,   310,   260,   310}
-    }
-   ,{{   370,   370,   310,   280,   310}
-    ,{   310,   310,   310,   260,   310}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   260,   310}
-    ,{   370,   370,   310,   280,   310}
-    }
-   }
-  ,{{{   370,   370,   340,   270,   340}
-    ,{   340,   340,   340,   250,   340}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   370,   370,   310,   270,   310}
-    }
-   ,{{   340,   340,   340,   250,   340}
-    ,{   340,   340,   340,   250,   340}
-    ,{   310,   310,   310,   210,   310}
-    ,{   230,   230,   230,   130,   230}
-    ,{   310,   310,   310,   210,   310}
-    }
-   ,{{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   310,   310,   310,   270,   310}
-    }
-   ,{{   310,   310,   310,   210,   310}
-    ,{   270,   270,   270,   170,   270}
-    ,{   310,   310,   310,   210,   310}
-    ,{   210,   180,   180,   210,   180}
-    ,{   310,   310,   310,   210,   310}
-    }
-   ,{{   370,   370,   310,   270,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   370,   370,   310,   210,   310}
-    }
-   }
-  ,{{{   340,   300,   340,   300,   310}
-    ,{   340,   300,   340,   300,   310}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    }
-   ,{{   340,   300,   340,   300,   310}
-    ,{   340,   300,   340,   300,   310}
-    ,{   310,   260,   310,   260,   280}
-    ,{   290,   180,   290,   180,   260}
-    ,{   310,   260,   310,   260,   280}
-    }
-   ,{{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    }
-   ,{{   330,   260,   330,   260,   300}
-    ,{   330,   220,   330,   220,   300}
-    ,{   310,   260,   310,   260,   280}
-    ,{   180,   130,   180,   130,   150}
-    ,{   310,   260,   310,   260,   280}
-    }
-   ,{{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    }
-   }
-  ,{{{   340,   260,   340,   280,   340}
-    ,{   340,   240,   340,   240,   340}
-    ,{   310,   260,   310,   150,   310}
-    ,{   310,   200,   310,   280,   310}
-    ,{   310,   260,   310,   280,   310}
-    }
-   ,{{   340,   240,   340,   200,   340}
-    ,{   340,   240,   340,   190,   340}
-    ,{   310,   200,   310,   150,   310}
-    ,{   230,   120,   230,   200,   230}
-    ,{   310,   200,   310,   150,   310}
-    }
-   ,{{   310,   260,   310,   150,   310}
-    ,{   310,   200,   310,   150,   310}
-    ,{   310,   260,   310,   150,   310}
-    ,{   310,   200,   310,   150,   310}
-    ,{   310,   260,   310,   150,   310}
-    }
-   ,{{   310,   200,   310,   280,   310}
-    ,{   270,   160,   270,   240,   270}
-    ,{   310,   200,   310,   150,   310}
-    ,{   280,   200,   180,   280,   180}
-    ,{   310,   200,   310,   150,   310}
-    }
-   ,{{   310,   260,   310,   280,   310}
-    ,{   310,   200,   310,   150,   310}
-    ,{   310,   260,   310,   150,   310}
-    ,{   310,   200,   310,   150,   310}
-    ,{   310,   200,   310,   280,   310}
-    }
-   }
-  ,{{{   340,   300,   340,   300,   320}
-    ,{   340,   300,   340,   300,   320}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    }
-   ,{{   340,   300,   340,   300,   320}
-    ,{   340,   300,   340,   300,   320}
-    ,{   310,   260,   310,   260,   220}
-    ,{   290,   180,   290,   180,   140}
-    ,{   310,   260,   310,   260,   220}
-    }
-   ,{{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    }
-   ,{{   330,   260,   330,   260,   220}
-    ,{   330,   220,   330,   220,   180}
-    ,{   310,   260,   310,   260,   220}
-    ,{   220,   130,   180,   130,   220}
-    ,{   310,   260,   310,   260,   220}
-    }
-   ,{{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    }
-   }
-  }
- ,{{{{   370,   340,   370,   280,   340}
-    ,{   370,   310,   370,   280,   340}
-    ,{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   250,   280}
-    ,{   340,   340,   280,   250,   280}
-    }
-   ,{{   280,   280,   280,   230,   280}
-    ,{   240,   240,   240,   200,   240}
-    ,{   280,   280,   280,   230,   280}
-    ,{   200,   140,   200,   120,   170}
-    ,{   280,   280,   280,   230,   280}
-    }
-   ,{{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   280,   280,   280,   240,   280}
-    }
-   ,{{   370,   310,   370,   280,   340}
-    ,{   370,   310,   370,   280,   340}
-    ,{   280,   280,   280,   230,   280}
-    ,{   250,   170,   150,   250,   190}
-    ,{   280,   280,   280,   230,   280}
-    }
-   ,{{   340,   340,   280,   250,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   340,   340,   280,   250,   280}
-    }
-   }
-  ,{{{   340,   340,   310,   240,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   340,   340,   280,   240,   280}
-    }
-   ,{{   280,   280,   280,   180,   280}
-    ,{   240,   240,   240,   150,   240}
-    ,{   280,   280,   280,   180,   280}
-    ,{   140,   140,   140,    50,   140}
-    ,{   280,   280,   280,   180,   280}
-    }
-   ,{{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   280,   280,   280,   240,   280}
-    }
-   ,{{   310,   310,   310,   210,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   280,   280,   280,   180,   280}
-    ,{   180,   150,   150,   180,   150}
-    ,{   280,   280,   280,   180,   280}
-    }
-   ,{{   340,   340,   280,   240,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   340,   340,   280,   180,   280}
-    }
-   }
-  ,{{{   370,   260,   370,   260,   340}
-    ,{   370,   260,   370,   260,   340}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    }
-   ,{{   280,   230,   280,   230,   250}
-    ,{   240,   200,   240,   200,   210}
-    ,{   280,   230,   280,   230,   250}
-    ,{   200,   100,   200,   100,   170}
-    ,{   280,   230,   280,   230,   250}
-    }
-   ,{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    }
-   ,{{   370,   260,   370,   260,   340}
-    ,{   370,   260,   370,   260,   340}
-    ,{   280,   230,   280,   230,   250}
-    ,{   150,   100,   150,   100,   120}
-    ,{   280,   230,   280,   230,   250}
-    }
-   ,{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    }
-   }
-  ,{{{   310,   230,   310,   280,   310}
-    ,{   310,   200,   310,   280,   310}
-    ,{   280,   230,   280,   120,   280}
-    ,{   280,   170,   280,   250,   280}
-    ,{   280,   230,   280,   250,   280}
-    }
-   ,{{   280,   170,   280,   120,   280}
-    ,{   240,   140,   240,    90,   240}
-    ,{   280,   170,   280,   120,   280}
-    ,{   140,    40,   140,   120,   140}
-    ,{   280,   170,   280,   120,   280}
-    }
-   ,{{   280,   230,   280,   120,   280}
-    ,{   280,   170,   280,   120,   280}
-    ,{   280,   230,   280,   120,   280}
-    ,{   280,   170,   280,   120,   280}
-    ,{   280,   230,   280,   120,   280}
-    }
-   ,{{   310,   200,   310,   280,   310}
-    ,{   310,   200,   310,   280,   310}
-    ,{   280,   170,   280,   120,   280}
-    ,{   250,   170,   150,   250,   150}
-    ,{   280,   170,   280,   120,   280}
-    }
-   ,{{   280,   230,   280,   250,   280}
-    ,{   280,   170,   280,   120,   280}
-    ,{   280,   230,   280,   120,   280}
-    ,{   280,   170,   280,   120,   280}
-    ,{   280,   170,   280,   250,   280}
-    }
-   }
-  ,{{{   370,   260,   370,   260,   220}
-    ,{   370,   260,   370,   260,   220}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    }
-   ,{{   280,   230,   280,   230,   220}
-    ,{   240,   200,   240,   200,   220}
-    ,{   280,   230,   280,   230,   190}
-    ,{   200,   100,   200,   100,    60}
-    ,{   280,   230,   280,   230,   190}
-    }
-   ,{{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    }
-   ,{{   370,   260,   370,   260,   220}
-    ,{   370,   260,   370,   260,   220}
-    ,{   280,   230,   280,   230,   190}
-    ,{   190,   100,   150,   100,   190}
-    ,{   280,   230,   280,   230,   190}
-    }
-   ,{{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    }
-   }
-  }
- ,{{{{   280,   280,   280,   230,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   220,   260}
-    }
-   ,{{   280,   280,   280,   230,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   250,   250,   250,   210,   250}
-    ,{   210,   150,   210,   130,   180}
-    ,{   250,   250,   250,   210,   250}
-    }
-   ,{{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   220,   260}
-    }
-   ,{{   280,   250,   280,   210,   250}
-    ,{   280,   220,   280,   200,   250}
-    ,{   250,   250,   250,   210,   250}
-    ,{   210,   130,   100,   210,   150}
-    ,{   250,   250,   250,   210,   250}
-    }
-   ,{{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   220,   260}
-    ,{   230,   230,   170,   140,   170}
-    }
-   }
-  ,{{{   280,   280,   280,   220,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   170,   260}
-    ,{   260,   260,   260,   220,   260}
-    }
-   ,{{   280,   280,   280,   180,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   250,   250,   250,   160,   250}
-    ,{   150,   150,   150,    60,   150}
-    ,{   250,   250,   250,   160,   250}
-    }
-   ,{{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   170,   260}
-    ,{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   170,   260}
-    ,{   260,   260,   260,   220,   260}
-    }
-   ,{{   250,   250,   250,   160,   250}
-    ,{   220,   220,   220,   130,   220}
-    ,{   250,   250,   250,   160,   250}
-    ,{   140,   100,   100,   140,   100}
-    ,{   250,   250,   250,   160,   250}
-    }
-   ,{{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   170,   260}
-    ,{   260,   260,   260,   220,   260}
-    ,{   260,   260,   260,   170,   260}
-    ,{   230,   230,   170,    70,   170}
-    }
-   }
-  ,{{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   260,   210,   260,   210,   230}
-    ,{   260,   220,   260,   220,   230}
-    ,{   260,   210,   260,   210,   230}
-    }
-   ,{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   250,   210,   250,   210,   220}
-    ,{   210,   110,   210,   110,   180}
-    ,{   250,   210,   250,   210,   220}
-    }
-   ,{{   260,   220,   260,   220,   230}
-    ,{   260,   220,   260,   220,   230}
-    ,{   260,   210,   260,   210,   230}
-    ,{   260,   220,   260,   220,   230}
-    ,{   260,   210,   260,   210,   230}
-    }
-   ,{{   280,   210,   280,   210,   250}
-    ,{   280,   180,   280,   180,   250}
-    ,{   250,   210,   250,   210,   220}
-    ,{   100,    60,   100,    60,    70}
-    ,{   250,   210,   250,   210,   220}
-    }
-   ,{{   260,   220,   260,   220,   230}
-    ,{   260,   220,   260,   220,   230}
-    ,{   260,   210,   260,   210,   230}
-    ,{   260,   220,   260,   220,   230}
-    ,{   170,   120,   170,   120,   140}
-    }
-   }
-  ,{{{   280,   210,   280,   210,   280}
-    ,{   280,   170,   280,   200,   280}
-    ,{   260,   210,   260,   100,   260}
-    ,{   260,   160,   260,   210,   260}
-    ,{   260,   210,   260,   140,   260}
-    }
-   ,{{   280,   170,   280,   130,   280}
-    ,{   280,   170,   280,   120,   280}
-    ,{   250,   150,   250,   100,   250}
-    ,{   150,    50,   150,   130,   150}
-    ,{   250,   150,   250,   100,   250}
-    }
-   ,{{   260,   210,   260,   110,   260}
-    ,{   260,   160,   260,   110,   260}
-    ,{   260,   210,   260,   100,   260}
-    ,{   260,   160,   260,   110,   260}
-    ,{   260,   210,   260,   100,   260}
-    }
-   ,{{   250,   150,   250,   210,   250}
-    ,{   220,   120,   220,   200,   220}
-    ,{   250,   150,   250,   100,   250}
-    ,{   210,   130,   100,   210,   100}
-    ,{   250,   150,   250,   100,   250}
-    }
-   ,{{   260,   210,   260,   140,   260}
-    ,{   260,   160,   260,   110,   260}
-    ,{   260,   210,   260,   100,   260}
-    ,{   260,   160,   260,   110,   260}
-    ,{   170,    60,   170,   140,   170}
-    }
-   }
-  ,{{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   260,   210,   260,   210,   170}
-    ,{   260,   220,   260,   220,   180}
-    ,{   260,   210,   260,   210,   170}
-    }
-   ,{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   250,   210,   250,   210,   170}
-    ,{   210,   110,   210,   110,    70}
-    ,{   250,   210,   250,   210,   170}
-    }
-   ,{{   260,   220,   260,   220,   180}
-    ,{   260,   220,   260,   220,   180}
-    ,{   260,   210,   260,   210,   170}
-    ,{   260,   220,   260,   220,   180}
-    ,{   260,   210,   260,   210,   170}
-    }
-   ,{{   280,   210,   280,   210,   170}
-    ,{   280,   180,   280,   180,   140}
-    ,{   250,   210,   250,   210,   170}
-    ,{   150,    60,   100,    60,   150}
-    ,{   250,   210,   250,   210,   170}
-    }
-   ,{{   260,   220,   260,   220,   180}
-    ,{   260,   220,   260,   220,   180}
-    ,{   260,   210,   260,   210,   170}
-    ,{   260,   220,   260,   220,   180}
-    ,{   170,   120,   170,   120,    80}
-    }
-   }
-  }
- ,{{{{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   280,   280,   280,   240,   280}
-    }
-   ,{{   280,   280,   280,   230,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   230,   230,   230,   190,   230}
-    ,{   230,   170,   230,   150,   200}
-    ,{   230,   230,   230,   190,   230}
-    }
-   ,{{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   280,   280,   280,   240,   280}
-    }
-   ,{{   240,   230,   240,   230,   230}
-    ,{   240,   180,   240,   160,   210}
-    ,{   230,   230,   230,   190,   230}
-    ,{   230,   150,   120,   230,   170}
-    ,{   230,   230,   230,   190,   230}
-    }
-   ,{{   280,   280,   280,   230,   280}
-    ,{   280,   280,   280,   230,   280}
-    ,{   250,   250,   250,   210,   250}
-    ,{   280,   280,   280,   230,   280}
-    ,{   250,   250,   190,   170,   190}
-    }
-   }
-  ,{{{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   280,   280,   280,   240,   280}
-    }
-   ,{{   280,   280,   280,   180,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   230,   230,   230,   140,   230}
-    ,{   170,   170,   170,    80,   170}
-    ,{   230,   230,   230,   140,   230}
-    }
-   ,{{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   280,   280,   280,   240,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   280,   280,   280,   240,   280}
-    }
-   ,{{   230,   230,   230,   160,   230}
-    ,{   180,   180,   180,    90,   180}
-    ,{   230,   230,   230,   140,   230}
-    ,{   160,   120,   120,   160,   120}
-    ,{   230,   230,   230,   140,   230}
-    }
-   ,{{   280,   280,   280,   210,   280}
-    ,{   280,   280,   280,   180,   280}
-    ,{   250,   250,   250,   210,   250}
-    ,{   280,   280,   280,   180,   280}
-    ,{   250,   250,   190,   100,   190}
-    }
-   }
-  ,{{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    }
-   ,{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   230,   190,   230,   190,   200}
-    ,{   230,   130,   230,   130,   200}
-    ,{   230,   190,   230,   190,   200}
-    }
-   ,{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    }
-   ,{{   240,   190,   240,   190,   210}
-    ,{   240,   140,   240,   140,   210}
-    ,{   230,   190,   230,   190,   200}
-    ,{   120,    80,   120,    80,    90}
-    ,{   230,   190,   230,   190,   200}
-    }
-   ,{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   250,   200,   250,   200,   220}
-    ,{   280,   230,   280,   230,   250}
-    ,{   190,   150,   190,   150,   160}
-    }
-   }
-  ,{{{   280,   230,   280,   230,   280}
-    ,{   280,   170,   280,   160,   280}
-    ,{   280,   230,   280,   120,   280}
-    ,{   280,   170,   280,   230,   280}
-    ,{   280,   230,   280,   170,   280}
-    }
-   ,{{   280,   170,   280,   150,   280}
-    ,{   280,   170,   280,   120,   280}
-    ,{   230,   130,   230,    80,   230}
-    ,{   170,    70,   170,   150,   170}
-    ,{   230,   130,   230,    80,   230}
-    }
-   ,{{   280,   230,   280,   120,   280}
-    ,{   280,   170,   280,   120,   280}
-    ,{   280,   230,   280,   120,   280}
-    ,{   280,   170,   280,   120,   280}
-    ,{   280,   230,   280,   120,   280}
-    }
-   ,{{   230,   150,   230,   230,   230}
-    ,{   180,    80,   180,   160,   180}
-    ,{   230,   130,   230,    80,   230}
-    ,{   230,   150,   120,   230,   120}
-    ,{   230,   130,   230,    80,   230}
-    }
-   ,{{   280,   200,   280,   170,   280}
-    ,{   280,   170,   280,   120,   280}
-    ,{   250,   200,   250,    90,   250}
-    ,{   280,   170,   280,   120,   280}
-    ,{   190,    90,   190,   170,   190}
-    }
-   }
-  ,{{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    }
-   ,{{   280,   230,   280,   230,   250}
-    ,{   280,   230,   280,   230,   250}
-    ,{   230,   190,   230,   190,   150}
-    ,{   230,   130,   230,   130,    90}
-    ,{   230,   190,   230,   190,   150}
-    }
-   ,{{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    }
-   ,{{   240,   190,   240,   190,   170}
-    ,{   240,   140,   240,   140,   100}
-    ,{   230,   190,   230,   190,   150}
-    ,{   170,    80,   120,    80,   170}
-    ,{   230,   190,   230,   190,   150}
-    }
-   ,{{   280,   230,   280,   230,   190}
-    ,{   280,   230,   280,   230,   190}
-    ,{   250,   200,   250,   200,   160}
-    ,{   280,   230,   280,   230,   190}
-    ,{   190,   150,   190,   150,   110}
-    }
-   }
-  }
- ,{{{{   370,   370,   370,   300,   340}
-    ,{   370,   340,   370,   300,   340}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   280,   310}
-    ,{   370,   370,   310,   280,   310}
-    }
-   ,{{   340,   340,   340,   300,   340}
-    ,{   340,   340,   340,   300,   340}
-    ,{   310,   310,   310,   260,   310}
-    ,{   290,   230,   290,   200,   260}
-    ,{   310,   310,   310,   260,   310}
-    }
-   ,{{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   260,   310}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   260,   310}
-    ,{   310,   310,   310,   270,   310}
-    }
-   ,{{   370,   310,   370,   280,   340}
-    ,{   370,   310,   370,   280,   340}
-    ,{   310,   310,   310,   260,   310}
-    ,{   280,   200,   180,   280,   220}
-    ,{   310,   310,   310,   260,   310}
-    }
-   ,{{   370,   370,   310,   280,   310}
-    ,{   310,   310,   310,   260,   310}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   260,   310}
-    ,{   370,   370,   310,   280,   310}
-    }
-   }
-  ,{{{   370,   370,   340,   270,   340}
-    ,{   340,   340,   340,   250,   340}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   370,   370,   310,   270,   310}
-    }
-   ,{{   340,   340,   340,   250,   340}
-    ,{   340,   340,   340,   250,   340}
-    ,{   310,   310,   310,   210,   310}
-    ,{   230,   230,   230,   130,   230}
-    ,{   310,   310,   310,   210,   310}
-    }
-   ,{{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   310,   310,   310,   270,   310}
-    }
-   ,{{   310,   310,   310,   210,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   210,   180,   180,   210,   180}
-    ,{   310,   310,   310,   210,   310}
-    }
-   ,{{   370,   370,   310,   270,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   310,   310,   310,   270,   310}
-    ,{   310,   310,   310,   210,   310}
-    ,{   370,   370,   310,   210,   310}
-    }
-   }
-  ,{{{   370,   300,   370,   300,   340}
-    ,{   370,   300,   370,   300,   340}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    }
-   ,{{   340,   300,   340,   300,   310}
-    ,{   340,   300,   340,   300,   310}
-    ,{   310,   260,   310,   260,   280}
-    ,{   290,   180,   290,   180,   260}
-    ,{   310,   260,   310,   260,   280}
-    }
-   ,{{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    }
-   ,{{   370,   260,   370,   260,   340}
-    ,{   370,   260,   370,   260,   340}
-    ,{   310,   260,   310,   260,   280}
-    ,{   180,   130,   180,   130,   150}
-    ,{   310,   260,   310,   260,   280}
-    }
-   ,{{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    ,{   310,   260,   310,   260,   280}
-    }
-   }
-  ,{{{   340,   260,   340,   280,   340}
-    ,{   340,   240,   340,   280,   340}
-    ,{   310,   260,   310,   150,   310}
-    ,{   310,   200,   310,   280,   310}
-    ,{   310,   260,   310,   280,   310}
-    }
-   ,{{   340,   240,   340,   200,   340}
-    ,{   340,   240,   340,   190,   340}
-    ,{   310,   200,   310,   150,   310}
-    ,{   230,   120,   230,   200,   230}
-    ,{   310,   200,   310,   150,   310}
-    }
-   ,{{   310,   260,   310,   150,   310}
-    ,{   310,   200,   310,   150,   310}
-    ,{   310,   260,   310,   150,   310}
-    ,{   310,   200,   310,   150,   310}
-    ,{   310,   260,   310,   150,   310}
-    }
-   ,{{   310,   200,   310,   280,   310}
-    ,{   310,   200,   310,   280,   310}
-    ,{   310,   200,   310,   150,   310}
-    ,{   280,   200,   180,   280,   180}
-    ,{   310,   200,   310,   150,   310}
-    }
-   ,{{   310,   260,   310,   280,   310}
-    ,{   310,   200,   310,   150,   310}
-    ,{   310,   260,   310,   150,   310}
-    ,{   310,   200,   310,   150,   310}
-    ,{   310,   200,   310,   280,   310}
-    }
-   }
-  ,{{{   370,   300,   370,   300,   320}
-    ,{   370,   300,   370,   300,   320}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    }
-   ,{{   340,   300,   340,   300,   320}
-    ,{   340,   300,   340,   300,   320}
-    ,{   310,   260,   310,   260,   220}
-    ,{   290,   180,   290,   180,   140}
-    ,{   310,   260,   310,   260,   220}
-    }
-   ,{{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    }
-   ,{{   370,   260,   370,   260,   220}
-    ,{   370,   260,   370,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   220,   130,   180,   130,   220}
-    ,{   310,   260,   310,   260,   220}
-    }
-   ,{{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    ,{   310,   260,   310,   260,   220}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   310,   300,   270,   310,   290}
-    ,{   300,   300,   270,   270,   290}
-    ,{   310,   290,   250,   310,   250}
-    ,{   300,   300,   270,   270,   270}
-    ,{   300,   270,   240,   300,   240}
-    }
-   ,{{   290,   270,   230,   230,   290}
-    ,{   290,   270,   230,   230,   290}
-    ,{   260,   260,   220,   220,   220}
-    ,{   190,   170,   190,   130,   190}
-    ,{   260,   260,   220,   220,   220}
-    }
-   ,{{   310,   300,   270,   310,   270}
-    ,{   300,   300,   270,   270,   270}
-    ,{   310,   290,   250,   310,   250}
-    ,{   300,   300,   270,   270,   270}
-    ,{   300,   270,   240,   300,   240}
-    }
-   ,{{   260,   260,   220,   220,   220}
-    ,{   190,   170,   190,   130,   190}
-    ,{   260,   260,   220,   220,   220}
-    ,{   210,   130,    80,   210,   210}
-    ,{   260,   260,   220,   220,   220}
-    }
-   ,{{   300,   300,   270,   300,   270}
-    ,{   300,   300,   270,   270,   270}
-    ,{   300,   270,   240,   300,   240}
-    ,{   300,   300,   270,   270,   270}
-    ,{   240,   240,   150,   150,   150}
-    }
-   }
-  ,{{{   310,   300,   270,   310,   270}
-    ,{   300,   300,   270,   270,   270}
-    ,{   310,   290,   250,   310,   250}
-    ,{   300,   300,   270,   270,   270}
-    ,{   300,   270,   240,   300,   240}
-    }
-   ,{{   270,   270,   230,   230,   230}
-    ,{   270,   270,   230,   230,   230}
-    ,{   260,   260,   220,   220,   220}
-    ,{   170,   170,   130,   130,   130}
-    ,{   260,   260,   220,   220,   220}
-    }
-   ,{{   310,   300,   270,   310,   270}
-    ,{   300,   300,   270,   270,   270}
-    ,{   310,   290,   250,   310,   250}
-    ,{   300,   300,   270,   270,   270}
-    ,{   300,   270,   240,   300,   240}
-    }
-   ,{{   260,   260,   220,   220,   220}
-    ,{   170,   170,   130,   130,   130}
-    ,{   260,   260,   220,   220,   220}
-    ,{   210,   110,    80,   210,    80}
-    ,{   260,   260,   220,   220,   220}
-    }
-   ,{{   300,   300,   270,   300,   270}
-    ,{   300,   300,   270,   270,   270}
-    ,{   300,   270,   240,   300,   240}
-    ,{   300,   300,   270,   270,   270}
-    ,{   240,   240,   150,   150,   150}
-    }
-   }
-  ,{{{   270,   270,   270,   270,   270}
-    ,{   270,   270,   270,   270,   270}
-    ,{   250,   250,   250,   250,   250}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    }
-   ,{{   230,   230,   230,   230,   230}
-    ,{   230,   230,   230,   230,   230}
-    ,{   220,   220,   220,   220,   220}
-    ,{   190,   130,   190,   130,   190}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   270,   270,   270,   270,   270}
-    ,{   270,   270,   270,   270,   270}
-    ,{   250,   250,   250,   250,   250}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   190,   130,   190,   130,   190}
-    ,{   220,   220,   220,   220,   220}
-    ,{    80,    80,    80,    80,    80}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   270,   270,   270,   270,   270}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    ,{   270,   270,   270,   270,   270}
-    ,{   150,   150,   150,   150,   150}
-    }
-   }
-  ,{{{   270,   230,   270,   210,   270}
-    ,{   270,   190,   270,   140,   270}
-    ,{   250,   230,   250,   120,   250}
-    ,{   270,   190,   270,   210,   270}
-    ,{   240,   220,   240,   150,   240}
-    }
-   ,{{   230,   150,   230,   130,   230}
-    ,{   230,   150,   230,   100,   230}
-    ,{   220,   140,   220,    90,   220}
-    ,{   130,    50,   130,   130,   130}
-    ,{   220,   140,   220,    90,   220}
-    }
-   ,{{   270,   230,   270,   140,   270}
-    ,{   270,   190,   270,   140,   270}
-    ,{   250,   230,   250,   120,   250}
-    ,{   270,   190,   270,   140,   270}
-    ,{   240,   220,   240,   110,   240}
-    }
-   ,{{   220,   140,   220,   210,   220}
-    ,{   130,    50,   130,   130,   130}
-    ,{   220,   140,   220,    90,   220}
-    ,{   210,   130,    80,   210,    80}
-    ,{   220,   140,   220,    90,   220}
-    }
-   ,{{   270,   220,   270,   150,   270}
-    ,{   270,   190,   270,   140,   270}
-    ,{   240,   220,   240,   110,   240}
-    ,{   270,   190,   270,   140,   270}
-    ,{   150,    70,   150,   150,   150}
-    }
-   }
-  ,{{{   290,   270,   270,   270,   290}
-    ,{   290,   270,   270,   270,   290}
-    ,{   250,   250,   250,   250,   250}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    }
-   ,{{   290,   230,   230,   230,   290}
-    ,{   290,   230,   230,   230,   290}
-    ,{   220,   220,   220,   220,   220}
-    ,{   190,   130,   190,   130,   130}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   270,   270,   270,   270,   270}
-    ,{   270,   270,   270,   270,   270}
-    ,{   250,   250,   250,   250,   250}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   190,   130,   190,   130,   130}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,    80,    80,    80,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   270,   270,   270,   270,   270}
-    ,{   270,   270,   270,   270,   270}
-    ,{   240,   240,   240,   240,   240}
-    ,{   270,   270,   270,   270,   270}
-    ,{   150,   150,   150,   150,   150}
-    }
-   }
-  }
- ,{{{{   300,   280,   240,   280,   300}
-    ,{   300,   280,   240,   240,   300}
-    ,{   280,   260,   220,   280,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   280,   250,   220,   280,   220}
-    }
-   ,{{   300,   280,   240,   240,   300}
-    ,{   300,   280,   240,   240,   300}
-    ,{   250,   250,   220,   220,   220}
-    ,{   100,    70,   100,    40,   100}
-    ,{   250,   250,   220,   220,   220}
-    }
-   ,{{   280,   250,   220,   280,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   280,   250,   220,   280,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   280,   250,   220,   280,   220}
-    }
-   ,{{   250,   250,   220,   220,   220}
-    ,{   160,   140,   160,   100,   160}
-    ,{   250,   250,   220,   220,   220}
-    ,{   210,   130,    80,   210,   210}
-    ,{   250,   250,   220,   220,   220}
-    }
-   ,{{   280,   260,   220,   280,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   280,   260,   220,   280,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   240,   240,   140,   140,   140}
-    }
-   }
-  ,{{{   280,   280,   240,   280,   240}
-    ,{   280,   280,   240,   240,   240}
-    ,{   280,   260,   220,   280,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   280,   250,   220,   280,   220}
-    }
-   ,{{   280,   280,   240,   240,   240}
-    ,{   280,   280,   240,   240,   240}
-    ,{   250,   250,   220,   220,   220}
-    ,{    70,    70,    40,    40,    40}
-    ,{   250,   250,   220,   220,   220}
-    }
-   ,{{   280,   250,   220,   280,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   280,   250,   220,   280,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   280,   250,   220,   280,   220}
-    }
-   ,{{   250,   250,   220,   220,   220}
-    ,{   140,   140,   100,   100,   100}
-    ,{   250,   250,   220,   220,   220}
-    ,{   210,   110,    80,   210,    80}
-    ,{   250,   250,   220,   220,   220}
-    }
-   ,{{   280,   260,   220,   280,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   280,   260,   220,   280,   220}
-    ,{   250,   250,   210,   210,   210}
-    ,{   240,   240,   140,   140,   140}
-    }
-   }
-  ,{{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   220,   220,   220,   220,   220}
-    ,{   100,    40,   100,    40,   100}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   160,   100,   160,   100,   160}
-    ,{   220,   220,   220,   220,   220}
-    ,{    80,    80,    80,    80,    80}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   140,   140,   140,   140,   140}
-    }
-   }
-  ,{{{   240,   200,   240,   210,   240}
-    ,{   240,   160,   240,   110,   240}
-    ,{   220,   200,   220,    90,   220}
-    ,{   210,   130,   210,   210,   210}
-    ,{   220,   200,   220,   140,   220}
-    }
-   ,{{   240,   160,   240,   110,   240}
-    ,{   240,   160,   240,   110,   240}
-    ,{   220,   140,   220,    90,   220}
-    ,{    40,   -40,    40,    40,    40}
-    ,{   220,   140,   220,    90,   220}
-    }
-   ,{{   220,   200,   220,    90,   220}
-    ,{   210,   130,   210,    80,   210}
-    ,{   220,   200,   220,    90,   220}
-    ,{   210,   130,   210,    80,   210}
-    ,{   220,   200,   220,    90,   220}
-    }
-   ,{{   220,   140,   220,   210,   220}
-    ,{   100,    20,   100,   100,   100}
-    ,{   220,   140,   220,    90,   220}
-    ,{   210,   130,    80,   210,    80}
-    ,{   220,   140,   220,    90,   220}
-    }
-   ,{{   220,   200,   220,   140,   220}
-    ,{   210,   130,   210,    80,   210}
-    ,{   220,   200,   220,    90,   220}
-    ,{   210,   130,   210,    80,   210}
-    ,{   140,    90,   140,   140,   140}
-    }
-   }
-  ,{{{   300,   240,   240,   240,   300}
-    ,{   300,   240,   240,   240,   300}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   300,   240,   240,   240,   300}
-    ,{   300,   240,   240,   240,   300}
-    ,{   220,   220,   220,   220,   220}
-    ,{   100,    40,   100,    40,    50}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   160,   100,   160,   100,   140}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,    80,    80,    80,   210}
-    ,{   220,   220,   220,   220,   220}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   220,   220,   220,   220,   220}
-    ,{   210,   210,   210,   210,   210}
-    ,{   140,   140,   140,   140,   140}
-    }
-   }
-  }
- ,{{{{   430,   430,   370,   400,   430}
-    ,{   430,   410,   370,   370,   430}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   400,   340}
-    }
-   ,{{   430,   410,   370,   370,   430}
-    ,{   430,   410,   370,   370,   430}
-    ,{   370,   370,   340,   340,   340}
-    ,{   320,   290,   320,   260,   320}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    }
-   ,{{   370,   370,   360,   340,   360}
-    ,{   360,   360,   360,   300,   360}
-    ,{   370,   370,   340,   340,   340}
-    ,{   340,   260,   210,   340,   340}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   430,   430,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   340,   340}
-    }
-   }
-  ,{{{   430,   430,   370,   400,   370}
-    ,{   410,   410,   370,   370,   370}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   400,   340}
-    }
-   ,{{   410,   410,   370,   370,   370}
-    ,{   410,   410,   370,   370,   370}
-    ,{   370,   370,   340,   340,   340}
-    ,{   290,   290,   260,   260,   260}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    }
-   ,{{   370,   370,   340,   340,   340}
-    ,{   360,   360,   300,   300,   300}
-    ,{   370,   370,   340,   340,   340}
-    ,{   340,   240,   210,   340,   210}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   430,   430,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   340,   340}
-    }
-   }
-  ,{{{   370,   370,   370,   370,   370}
-    ,{   370,   370,   370,   370,   370}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   370,   370,   370,   370,   370}
-    ,{   370,   370,   370,   370,   370}
-    ,{   340,   340,   340,   340,   340}
-    ,{   320,   260,   320,   260,   320}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   360,   340,   360,   340,   360}
-    ,{   360,   300,   360,   300,   360}
-    ,{   340,   340,   340,   340,   340}
-    ,{   210,   210,   210,   210,   210}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   }
-  ,{{{   370,   320,   370,   340,   370}
-    ,{   370,   290,   370,   300,   370}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   340,   340}
-    ,{   340,   320,   340,   340,   340}
-    }
-   ,{{   370,   290,   370,   260,   370}
-    ,{   370,   290,   370,   240,   370}
-    ,{   340,   260,   340,   210,   340}
-    ,{   260,   180,   260,   260,   260}
-    ,{   340,   260,   340,   210,   340}
-    }
-   ,{{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    }
-   ,{{   340,   260,   340,   340,   340}
-    ,{   300,   220,   300,   300,   300}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   260,   210,   340,   210}
-    ,{   340,   260,   340,   210,   340}
-    }
-   ,{{   340,   320,   340,   340,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   260,   340,   340,   340}
-    }
-   }
-  ,{{{   430,   370,   370,   370,   430}
-    ,{   430,   370,   370,   370,   430}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   430,   370,   370,   370,   430}
-    ,{   430,   370,   370,   370,   430}
-    ,{   340,   340,   340,   340,   340}
-    ,{   320,   260,   320,   260,   260}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   360,   340,   360,   340,   340}
-    ,{   360,   300,   360,   300,   300}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   210,   210,   210,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   }
-  }
- ,{{{{   400,   400,   400,   370,   400}
-    ,{   400,   370,   400,   360,   400}
-    ,{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   400,   400,   310,   370,   310}
-    }
-   ,{{   360,   360,   310,   360,   330}
-    ,{   360,   360,   270,   360,   330}
-    ,{   340,   340,   310,   310,   310}
-    ,{   230,   220,   230,   170,   230}
-    ,{   340,   340,   310,   310,   310}
-    }
-   ,{{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    }
-   ,{{   400,   370,   400,   340,   400}
-    ,{   400,   370,   400,   340,   400}
-    ,{   340,   340,   310,   310,   310}
-    ,{   310,   230,   180,   310,   310}
-    ,{   340,   340,   310,   310,   310}
-    }
-   ,{{   400,   400,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   400,   400,   310,   310,   310}
-    }
-   }
-  ,{{{   400,   400,   340,   370,   340}
-    ,{   370,   370,   340,   360,   340}
-    ,{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   400,   400,   310,   370,   310}
-    }
-   ,{{   360,   360,   310,   360,   310}
-    ,{   360,   360,   270,   360,   270}
-    ,{   340,   340,   310,   310,   310}
-    ,{   220,   220,   170,   170,   170}
-    ,{   340,   340,   310,   310,   310}
-    }
-   ,{{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    }
-   ,{{   370,   370,   340,   340,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   340,   340,   310,   310,   310}
-    ,{   310,   210,   180,   310,   180}
-    ,{   340,   340,   310,   310,   310}
-    }
-   ,{{   400,   400,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   400,   400,   310,   310,   310}
-    }
-   }
-  ,{{{   400,   340,   400,   340,   400}
-    ,{   400,   340,   400,   340,   400}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   270,   270,   270,   270,   270}
-    ,{   310,   310,   310,   310,   310}
-    ,{   230,   170,   230,   170,   230}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   400,   340,   400,   340,   400}
-    ,{   400,   340,   400,   340,   400}
-    ,{   310,   310,   310,   310,   310}
-    ,{   180,   180,   180,   180,   180}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   }
-  ,{{{   340,   290,   340,   340,   340}
-    ,{   340,   260,   340,   340,   340}
-    ,{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   310,   310}
-    ,{   310,   290,   310,   310,   310}
-    }
-   ,{{   310,   230,   310,   180,   310}
-    ,{   270,   190,   270,   140,   270}
-    ,{   310,   230,   310,   180,   310}
-    ,{   170,    40,   170,   170,   170}
-    ,{   310,   230,   310,   180,   310}
-    }
-   ,{{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   290,   310,   180,   310}
-    }
-   ,{{   340,   260,   340,   340,   340}
-    ,{   340,   260,   340,   340,   340}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   230,   180,   310,   180}
-    ,{   310,   230,   310,   180,   310}
-    }
-   ,{{   310,   290,   310,   310,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   230,   310,   310,   310}
-    }
-   }
-  ,{{{   400,   340,   400,   340,   340}
-    ,{   400,   340,   400,   340,   340}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   330,   310,   310,   310,   330}
-    ,{   330,   270,   270,   270,   330}
-    ,{   310,   310,   310,   310,   310}
-    ,{   230,   170,   230,   170,   170}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   400,   340,   400,   340,   340}
-    ,{   400,   340,   400,   340,   340}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   180,   180,   180,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   }
-  }
- ,{{{{   370,   340,   310,   350,   370}
-    ,{   370,   340,   310,   310,   370}
-    ,{   350,   320,   290,   350,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   350,   320,   290,   350,   290}
-    }
-   ,{{   370,   340,   310,   310,   370}
-    ,{   370,   340,   310,   310,   370}
-    ,{   320,   320,   280,   280,   280}
-    ,{   240,   220,   240,   180,   240}
-    ,{   320,   320,   280,   280,   280}
-    }
-   ,{{   350,   330,   290,   350,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   350,   320,   290,   350,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   350,   320,   290,   350,   290}
-    }
-   ,{{   320,   320,   310,   280,   310}
-    ,{   310,   290,   310,   250,   310}
-    ,{   320,   320,   280,   280,   280}
-    ,{   260,   180,   130,   260,   260}
-    ,{   320,   320,   280,   280,   280}
-    }
-   ,{{   350,   330,   290,   350,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   350,   320,   290,   350,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   290,   290,   200,   200,   200}
-    }
-   }
-  ,{{{   350,   340,   310,   350,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   350,   320,   290,   350,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   350,   320,   290,   350,   290}
-    }
-   ,{{   340,   340,   310,   310,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   320,   320,   280,   280,   280}
-    ,{   220,   220,   180,   180,   180}
-    ,{   320,   320,   280,   280,   280}
-    }
-   ,{{   350,   330,   290,   350,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   350,   320,   290,   350,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   350,   320,   290,   350,   290}
-    }
-   ,{{   320,   320,   280,   280,   280}
-    ,{   290,   290,   250,   250,   250}
-    ,{   320,   320,   280,   280,   280}
-    ,{   260,   170,   130,   260,   130}
-    ,{   320,   320,   280,   280,   280}
-    }
-   ,{{   350,   330,   290,   350,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   350,   320,   290,   350,   290}
-    ,{   330,   330,   290,   290,   290}
-    ,{   290,   290,   200,   200,   200}
-    }
-   }
-  ,{{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   280,   280,   280,   280,   280}
-    ,{   240,   180,   240,   180,   240}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    }
-   ,{{   310,   280,   310,   280,   310}
-    ,{   310,   250,   310,   250,   310}
-    ,{   280,   280,   280,   280,   280}
-    ,{   130,   130,   130,   130,   130}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   200,   200,   200,   200,   200}
-    }
-   }
-  ,{{{   310,   270,   310,   260,   310}
-    ,{   310,   230,   310,   250,   310}
-    ,{   290,   270,   290,   160,   290}
-    ,{   290,   210,   290,   260,   290}
-    ,{   290,   270,   290,   200,   290}
-    }
-   ,{{   310,   230,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   280,   200,   280,   150,   280}
-    ,{   180,   100,   180,   180,   180}
-    ,{   280,   200,   280,   150,   280}
-    }
-   ,{{   290,   270,   290,   160,   290}
-    ,{   290,   210,   290,   160,   290}
-    ,{   290,   270,   290,   160,   290}
-    ,{   290,   210,   290,   160,   290}
-    ,{   290,   270,   290,   160,   290}
-    }
-   ,{{   280,   200,   280,   260,   280}
-    ,{   250,   170,   250,   250,   250}
-    ,{   280,   200,   280,   150,   280}
-    ,{   260,   180,   130,   260,   130}
-    ,{   280,   200,   280,   150,   280}
-    }
-   ,{{   290,   270,   290,   200,   290}
-    ,{   290,   210,   290,   160,   290}
-    ,{   290,   270,   290,   160,   290}
-    ,{   290,   210,   290,   160,   290}
-    ,{   200,   120,   200,   200,   200}
-    }
-   }
-  ,{{{   370,   310,   310,   310,   370}
-    ,{   370,   310,   310,   310,   370}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    }
-   ,{{   370,   310,   310,   310,   370}
-    ,{   370,   310,   310,   310,   370}
-    ,{   280,   280,   280,   280,   280}
-    ,{   240,   180,   240,   180,   180}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    }
-   ,{{   310,   280,   310,   280,   280}
-    ,{   310,   250,   310,   250,   250}
-    ,{   280,   280,   280,   280,   280}
-    ,{   260,   130,   130,   130,   260}
-    ,{   280,   280,   280,   280,   280}
-    }
-   ,{{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   290,   290,   290,   290,   290}
-    ,{   200,   200,   200,   200,   200}
-    }
-   }
-  }
- ,{{{{   370,   340,   310,   370,   370}
-    ,{   370,   340,   310,   310,   370}
-    ,{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    }
-   ,{{   370,   340,   310,   310,   370}
-    ,{   370,   340,   310,   310,   370}
-    ,{   300,   300,   260,   260,   260}
-    ,{   260,   240,   260,   200,   260}
-    ,{   300,   300,   260,   260,   260}
-    }
-   ,{{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    }
-   ,{{   300,   300,   270,   280,   280}
-    ,{   270,   250,   270,   210,   270}
-    ,{   300,   300,   260,   260,   260}
-    ,{   280,   200,   150,   280,   280}
-    ,{   300,   300,   260,   260,   260}
-    }
-   ,{{   340,   340,   310,   340,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   340,   310,   280,   340,   280}
-    ,{   340,   340,   310,   310,   310}
-    ,{   320,   320,   220,   220,   220}
-    }
-   }
-  ,{{{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    }
-   ,{{   340,   340,   310,   310,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   300,   300,   260,   260,   260}
-    ,{   240,   240,   200,   200,   200}
-    ,{   300,   300,   260,   260,   260}
-    }
-   ,{{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   370,   340,   310,   370,   310}
-    }
-   ,{{   300,   300,   260,   280,   260}
-    ,{   250,   250,   210,   210,   210}
-    ,{   300,   300,   260,   260,   260}
-    ,{   280,   190,   150,   280,   150}
-    ,{   300,   300,   260,   260,   260}
-    }
-   ,{{   340,   340,   310,   340,   310}
-    ,{   340,   340,   310,   310,   310}
-    ,{   340,   310,   280,   340,   280}
-    ,{   340,   340,   310,   310,   310}
-    ,{   320,   320,   220,   220,   220}
-    }
-   }
-  ,{{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   200,   260,   200,   260}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   270,   260,   270,   260,   270}
-    ,{   270,   210,   270,   210,   270}
-    ,{   260,   260,   260,   260,   260}
-    ,{   150,   150,   150,   150,   150}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   280,   280,   280,   280,   280}
-    ,{   310,   310,   310,   310,   310}
-    ,{   220,   220,   220,   220,   220}
-    }
-   }
-  ,{{{   310,   290,   310,   280,   310}
-    ,{   310,   230,   310,   210,   310}
-    ,{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   280,   310}
-    ,{   310,   290,   310,   220,   310}
-    }
-   ,{{   310,   230,   310,   200,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   260,   180,   260,   130,   260}
-    ,{   200,   120,   200,   200,   200}
-    ,{   260,   180,   260,   130,   260}
-    }
-   ,{{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   290,   310,   180,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   310,   290,   310,   180,   310}
-    }
-   ,{{   280,   200,   260,   280,   260}
-    ,{   210,   130,   210,   210,   210}
-    ,{   260,   180,   260,   130,   260}
-    ,{   280,   200,   150,   280,   150}
-    ,{   260,   180,   260,   130,   260}
-    }
-   ,{{   310,   260,   310,   220,   310}
-    ,{   310,   230,   310,   180,   310}
-    ,{   280,   260,   280,   150,   280}
-    ,{   310,   230,   310,   180,   310}
-    ,{   220,   140,   220,   220,   220}
-    }
-   }
-  ,{{{   370,   310,   310,   310,   370}
-    ,{   370,   310,   310,   310,   370}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   370,   310,   310,   310,   370}
-    ,{   370,   310,   310,   310,   370}
-    ,{   260,   260,   260,   260,   260}
-    ,{   260,   200,   260,   200,   200}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    }
-   ,{{   280,   260,   270,   260,   280}
-    ,{   270,   210,   270,   210,   210}
-    ,{   260,   260,   260,   260,   260}
-    ,{   280,   150,   150,   150,   280}
-    ,{   260,   260,   260,   260,   260}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{   280,   280,   280,   280,   280}
-    ,{   310,   310,   310,   310,   310}
-    ,{   220,   220,   220,   220,   220}
-    }
-   }
-  }
- ,{{{{   430,   430,   400,   400,   430}
-    ,{   430,   410,   400,   370,   430}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   400,   340}
-    }
-   ,{{   430,   410,   370,   370,   430}
-    ,{   430,   410,   370,   370,   430}
-    ,{   370,   370,   340,   340,   340}
-    ,{   320,   290,   320,   260,   320}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    }
-   ,{{   400,   370,   400,   340,   400}
-    ,{   400,   370,   400,   340,   400}
-    ,{   370,   370,   340,   340,   340}
-    ,{   340,   260,   210,   340,   340}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   430,   430,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   340,   340}
-    }
-   }
-  ,{{{   430,   430,   370,   400,   370}
-    ,{   410,   410,   370,   370,   370}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   400,   340}
-    }
-   ,{{   410,   410,   370,   370,   370}
-    ,{   410,   410,   370,   370,   370}
-    ,{   370,   370,   340,   340,   340}
-    ,{   290,   290,   260,   260,   260}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    }
-   ,{{   370,   370,   340,   340,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   340,   240,   210,   340,   210}
-    ,{   370,   370,   340,   340,   340}
-    }
-   ,{{   430,   430,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   400,   370,   340,   400,   340}
-    ,{   370,   370,   340,   340,   340}
-    ,{   430,   430,   340,   340,   340}
-    }
-   }
-  ,{{{   400,   370,   400,   370,   400}
-    ,{   400,   370,   400,   370,   400}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   370,   370,   370,   370,   370}
-    ,{   370,   370,   370,   370,   370}
-    ,{   340,   340,   340,   340,   340}
-    ,{   320,   260,   320,   260,   320}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   400,   340,   400,   340,   400}
-    ,{   400,   340,   400,   340,   400}
-    ,{   340,   340,   340,   340,   340}
-    ,{   210,   210,   210,   210,   210}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   }
-  ,{{{   370,   320,   370,   340,   370}
-    ,{   370,   290,   370,   340,   370}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   340,   340}
-    ,{   340,   320,   340,   340,   340}
-    }
-   ,{{   370,   290,   370,   260,   370}
-    ,{   370,   290,   370,   240,   370}
-    ,{   340,   260,   340,   210,   340}
-    ,{   260,   180,   260,   260,   260}
-    ,{   340,   260,   340,   210,   340}
-    }
-   ,{{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    }
-   ,{{   340,   260,   340,   340,   340}
-    ,{   340,   260,   340,   340,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   260,   210,   340,   210}
-    ,{   340,   260,   340,   210,   340}
-    }
-   ,{{   340,   320,   340,   340,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   320,   340,   210,   340}
-    ,{   340,   260,   340,   210,   340}
-    ,{   340,   260,   340,   340,   340}
-    }
-   }
-  ,{{{   430,   370,   400,   370,   430}
-    ,{   430,   370,   400,   370,   430}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   430,   370,   370,   370,   430}
-    ,{   430,   370,   370,   370,   430}
-    ,{   340,   340,   340,   340,   340}
-    ,{   320,   260,   320,   260,   260}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   400,   340,   400,   340,   340}
-    ,{   400,   340,   400,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   210,   210,   210,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   ,{{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    ,{   340,   340,   340,   340,   340}
-    }
-   }
-  }
- }};
diff --git a/include/intl22dH.h b/include/intl22dH.h
deleted file mode 100644
--- a/include/intl22dH.h
+++ /dev/null
@@ -1,9993 +0,0 @@
-PUBLIC int int22_dH[NBPAIRS+1][NBPAIRS+1][5][5][5][5] =
-{{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{    80,  -120,    30,    80,    80}
-    ,{    30,  -310,  -170,    30,  -110}
-    ,{    80,  -230,  -110,    80,   -60}
-    ,{    80,  -120,    30,    30,    80}
-    ,{   -30,  -340,  -220,   -30,  -170}
-    }
-   ,{{  -120,  -460,  -290,  -120,  -230}
-    ,{  -120,  -460,  -310,  -120,  -260}
-    ,{  -430,  -770,  -620,  -430,  -570}
-    ,{  -230,  -670,  -290,  -980,  -230}
-    ,{  -430,  -770,  -620,  -430,  -570}
-    }
-   ,{{    30,  -290,  -170,    30,  -110}
-    ,{    30,  -310,  -170,    30,  -110}
-    ,{    20,  -290,  -170,    20,  -120}
-    ,{    30,  -310,  -170,    30,  -110}
-    ,{   -30,  -340,  -220,   -30,  -170}
-    }
-   ,{{    80,  -120,    30,  -430,    80}
-    ,{  -520,  -960,  -580, -1270,  -520}
-    ,{  -430,  -770,  -620,  -430,  -570}
-    ,{    80,  -120,    30,  -430,    80}
-    ,{  -430,  -770,  -620,  -430,  -570}
-    }
-   ,{{    80,  -230,  -110,    80,   -60}
-    ,{    30,  -310,  -170,    30,  -110}
-    ,{    80,  -230,  -110,    80,   -60}
-    ,{    30,  -310,  -170,    30,  -110}
-    ,{  -860,  -860,  -960, -1410,  -900}
-    }
-   }
-  ,{{{    30,  -120,    30,  -520,    30}
-    ,{  -170,  -310,  -170,  -810,  -170}
-    ,{  -110,  -260,  -110,  -520,  -110}
-    ,{    30,  -120,    30,  -810,    30}
-    ,{  -220,  -370,  -220,  -630,  -220}
-    }
-   ,{{  -310,  -460,  -310,  -960,  -310}
-    ,{  -310,  -460,  -310,  -960,  -310}
-    ,{  -620,  -770,  -620, -1270,  -620}
-    ,{  -530,  -670,  -530, -1170,  -530}
-    ,{  -620,  -770,  -620, -1270,  -620}
-    }
-   ,{{  -170,  -310,  -170,  -580,  -170}
-    ,{  -170,  -310,  -170,  -810,  -170}
-    ,{  -170,  -320,  -170,  -580,  -170}
-    ,{  -170,  -310,  -170,  -810,  -170}
-    ,{  -220,  -370,  -220,  -630,  -220}
-    }
-   ,{{    30,  -120,    30, -1270,    30}
-    ,{  -810,  -960,  -810, -1460,  -810}
-    ,{  -620,  -770,  -620, -1270,  -620}
-    ,{    30,  -120,    30, -1870,    30}
-    ,{  -620,  -770,  -620, -1270,  -620}
-    }
-   ,{{  -110,  -260,  -110,  -520,  -110}
-    ,{  -170,  -310,  -170,  -810,  -170}
-    ,{  -110,  -260,  -110,  -520,  -110}
-    ,{  -170,  -310,  -170,  -810,  -170}
-    ,{  -860,  -860,  -960, -1600,  -960}
-    }
-   }
-  ,{{{    80,  -430,    20,  -430,    80}
-    ,{  -110,  -620,  -170,  -620,  -110}
-    ,{   -60,  -570,  -120,  -570,   -60}
-    ,{    80,  -430,    20,  -430,    80}
-    ,{  -170,  -680,  -230,  -680,  -170}
-    }
-   ,{{  -230,  -770,  -290,  -770,  -230}
-    ,{  -260,  -770,  -320,  -770,  -260}
-    ,{  -570, -1080,  -630, -1080,  -570}
-    ,{  -230,  -980,  -290,  -980,  -230}
-    ,{  -570, -1080,  -630, -1080,  -570}
-    }
-   ,{{  -110,  -620,  -170,  -620,  -110}
-    ,{  -110,  -620,  -170,  -620,  -110}
-    ,{  -120,  -630,  -180,  -630,  -120}
-    ,{  -110,  -620,  -170,  -620,  -110}
-    ,{  -170,  -680,  -230,  -680,  -170}
-    }
-   ,{{    80,  -430,    20,  -430,    80}
-    ,{  -520, -1270,  -580, -1270,  -520}
-    ,{  -570, -1080,  -630, -1080,  -570}
-    ,{    80,  -430,    20,  -430,    80}
-    ,{  -570, -1080,  -630, -1080,  -570}
-    }
-   ,{{   -60,  -570,  -120,  -570,   -60}
-    ,{  -110,  -620,  -170,  -620,  -110}
-    ,{   -60,  -570,  -120,  -570,   -60}
-    ,{  -110,  -620,  -170,  -620,  -110}
-    ,{  -900, -1410,  -960, -1410,  -900}
-    }
-   }
-  ,{{{    80,  -230,    30,    80,    30}
-    ,{    30,  -530,  -170,    30,  -170}
-    ,{    80,  -230,  -110,    80,  -110}
-    ,{    30,  -530,    30,    30,    30}
-    ,{   -30,  -340,  -220,   -30,  -220}
-    }
-   ,{{  -120,  -670,  -310,  -120,  -310}
-    ,{  -120,  -670,  -310,  -120,  -310}
-    ,{  -430,  -980,  -620,  -430,  -620}
-    ,{  -530,  -890,  -530, -1580,  -530}
-    ,{  -430,  -980,  -620,  -430,  -620}
-    }
-   ,{{    30,  -290,  -170,    30,  -170}
-    ,{    30,  -530,  -170,    30,  -170}
-    ,{    20,  -290,  -170,    20,  -170}
-    ,{    30,  -530,  -170,    30,  -170}
-    ,{   -30,  -340,  -220,   -30,  -220}
-    }
-   ,{{    30,  -980,    30,  -430,    30}
-    ,{  -810, -1170,  -810, -1870,  -810}
-    ,{  -430,  -980,  -620,  -430,  -620}
-    ,{    30, -1580,    30, -2280,    30}
-    ,{  -430,  -980,  -620,  -430,  -620}
-    }
-   ,{{    80,  -230,  -110,    80,  -110}
-    ,{    30,  -530,  -170,    30,  -170}
-    ,{    80,  -230,  -110,    80,  -110}
-    ,{    30,  -530,  -170,    30,  -170}
-    ,{  -960, -1320,  -960, -2010,  -960}
-    }
-   }
-  ,{{{   -30,  -430,   -30,  -430,  -860}
-    ,{  -220,  -620,  -220,  -620,  -860}
-    ,{  -170,  -570,  -170,  -570,  -900}
-    ,{   -30,  -430,   -30,  -430,  -960}
-    ,{  -280,  -680,  -280,  -680, -1010}
-    }
-   ,{{  -340,  -770,  -340,  -770,  -860}
-    ,{  -370,  -770,  -370,  -770,  -860}
-    ,{  -680, -1080,  -680, -1080, -1410}
-    ,{  -340,  -980,  -340,  -980, -1320}
-    ,{  -680, -1080,  -680, -1080, -1410}
-    }
-   ,{{  -220,  -620,  -220,  -620,  -960}
-    ,{  -220,  -620,  -220,  -620,  -960}
-    ,{  -230,  -630,  -230,  -630,  -960}
-    ,{  -220,  -620,  -220,  -620,  -960}
-    ,{  -280,  -680,  -280,  -680, -1010}
-    }
-   ,{{   -30,  -430,   -30,  -430, -1410}
-    ,{  -630, -1270,  -630, -1270, -1600}
-    ,{  -680, -1080,  -680, -1080, -1410}
-    ,{   -30,  -430,   -30,  -430, -2010}
-    ,{  -680, -1080,  -680, -1080, -1410}
-    }
-   ,{{  -170,  -570,  -170,  -570,  -900}
-    ,{  -220,  -620,  -220,  -620,  -960}
-    ,{  -170,  -570,  -170,  -570,  -900}
-    ,{  -220,  -620,  -220,  -620,  -960}
-    ,{ -1010, -1410, -1010, -1410, -1750}
-    }
-   }
-  }
- ,{{{{   540,   180,    30,   540,   180}
-    ,{    10,  -580,  -150,    10,   -90}
-    ,{   540,  -350,  -600,   540,  -540}
-    ,{   180,   180,    30,  -320,   180}
-    ,{   -90,  -740,   -90,  -260,  -540}
-    }
-   ,{{   -90,  -350,  -150,  -100,   -90}
-    ,{   -90,  -580,  -150,  -200,   -90}
-    ,{  -100,  -350,  -600,  -100,  -540}
-    ,{  -630, -1790,  -630, -1790, -1040}
-    ,{  -400,  -740,  -600,  -400,  -540}
-    }
-   ,{{   540,  -660,  -510,   540,  -400}
-    ,{    10,  -660,  -510,    10,  -400}
-    ,{   540,  -940,  -820,   540,  -760}
-    ,{  -320,  -660,  -510,  -320,  -460}
-    ,{  -260,  -940,  -820,  -260,  -550}
-    }
-   ,{{   180,   180,    30,  -400,   180}
-    ,{  -500, -1070,  -500, -1080,  -570}
-    ,{  -400,  -740,  -600,  -400,  -540}
-    ,{   180,   180,    30,  -430,   180}
-    ,{  -400,  -740,  -600,  -400,  -540}
-    }
-   ,{{   -90,  -660,   -90,  -210,  -460}
-    ,{  -320,  -660,  -510,  -320,  -460}
-    ,{  -210, -1250, -1130,  -210, -1070}
-    ,{  -320,  -660,  -510,  -320,  -460}
-    ,{   -90,  -830,   -90,  -810,  -800}
-    }
-   }
-  ,{{{   540,   180,   -90,   540,    30}
-    ,{    10,  -580,  -220,    10,  -150}
-    ,{   540,  -740,  -600,   540,  -600}
-    ,{   180,   180,  -390, -1160,    30}
-    ,{   -90,  -740,   -90,  -810,  -600}
-    }
-   ,{{  -100,  -580,  -220,  -100,  -150}
-    ,{  -150,  -580,  -220,  -970,  -150}
-    ,{  -100,  -740,  -600,  -100,  -600}
-    ,{ -1340, -2010, -1650, -1980, -1340}
-    ,{  -600,  -740,  -600, -1240,  -600}
-    }
-   ,{{   540,  -660,  -510,   540,  -510}
-    ,{    10,  -660, -1150,    10,  -510}
-    ,{   540,  -960,  -820,   540,  -820}
-    ,{  -510,  -660,  -510, -1160,  -510}
-    ,{  -820,  -960,  -820, -1220,  -820}
-    }
-   ,{{   180,   180,  -390, -1240,    30}
-    ,{  -860, -1340,  -860, -2450,  -860}
-    ,{  -600,  -740,  -600, -1240,  -600}
-    ,{   180,   180,  -390, -1870,    30}
-    ,{  -600,  -740,  -600, -1240,  -600}
-    }
-   ,{{   -90,  -660,   -90,  -810,  -510}
-    ,{  -510,  -660,  -510, -1160,  -510}
-    ,{ -1130, -1270, -1130, -1530, -1130}
-    ,{  -510,  -660,  -510, -1160,  -510}
-    ,{   -90, -1240,   -90,  -810,  -800}
-    }
-   }
-  ,{{{   180,  -430,    20,  -430,   180}
-    ,{   -90,  -600,  -500,  -600,   -90}
-    ,{  -540, -1050,  -600, -1050,  -540}
-    ,{   180,  -430,    20,  -430,   180}
-    ,{  -540,  -830,  -600, -1050,  -540}
-    }
-   ,{{   -90,  -600,  -600,  -600,   -90}
-    ,{   -90,  -600, -1070,  -600,   -90}
-    ,{  -540, -1050,  -600, -1050,  -540}
-    ,{  -630, -1790,  -630, -1790, -1040}
-    ,{  -540, -1050,  -600, -1050,  -540}
-    }
-   ,{{  -460,  -970,  -520,  -970,  -460}
-    ,{  -460,  -970,  -750,  -970,  -460}
-    ,{  -760, -1270,  -820, -1270,  -760}
-    ,{  -460,  -970,  -520,  -970,  -460}
-    ,{  -550, -1270,  -820, -1270,  -550}
-    }
-   ,{{   180,  -430,    20,  -430,   180}
-    ,{  -500, -1070,  -500, -1320,  -570}
-    ,{  -540, -1050,  -600, -1050,  -540}
-    ,{   180,  -430,    20,  -430,   180}
-    ,{  -540, -1050,  -600, -1050,  -540}
-    }
-   ,{{  -460,  -830,  -520,  -970,  -460}
-    ,{  -460,  -970,  -520,  -970,  -460}
-    ,{ -1070, -1580, -1130, -1580, -1070}
-    ,{  -460,  -970,  -520,  -970,  -460}
-    ,{  -830,  -830, -1710, -1260, -1460}
-    }
-   }
-  ,{{{    30,  -350,    30,  -200,    30}
-    ,{  -150,  -870,  -150,  -200,  -150}
-    ,{  -210,  -350,  -600,  -210,  -600}
-    ,{    30,  -870,    30,  -320,    30}
-    ,{  -260,  -940,  -600,  -260,  -600}
-    }
-   ,{{  -150,  -350,  -150,  -200,  -150}
-    ,{  -150, -1600,  -150,  -200,  -150}
-    ,{  -350,  -350,  -600,  -440,  -600}
-    ,{ -1340, -3070, -1340, -2390, -1340}
-    ,{  -400,  -960,  -600,  -400,  -600}
-    }
-   ,{{  -260,  -870,  -510,  -260,  -510}
-    ,{  -320, -1110,  -510,  -320,  -510}
-    ,{  -620,  -940,  -820,  -620,  -820}
-    ,{  -320,  -870,  -510,  -320,  -510}
-    ,{  -260,  -940,  -820,  -260,  -820}
-    }
-   ,{{    30,  -960,    30,  -400,    30}
-    ,{  -860, -1880,  -860, -1080,  -860}
-    ,{  -400,  -960,  -600,  -400,  -600}
-    ,{    30, -1370,    30, -2280,    30}
-    ,{  -400,  -960,  -600,  -400,  -600}
-    }
-   ,{{  -210,  -870,  -510,  -210,  -510}
-    ,{  -320,  -870,  -510,  -320,  -510}
-    ,{  -210, -1250, -1130,  -210, -1130}
-    ,{  -320,  -870,  -510,  -320,  -510}
-    ,{  -800, -1360,  -800, -1550,  -800}
-    }
-   }
-  ,{{{  -200,  -430,  -200,  -430,  -230}
-    ,{  -200,  -600,  -200,  -600,  -400}
-    ,{  -650, -1050,  -650, -1050, -1390}
-    ,{  -230,  -430,  -570,  -430,  -230}
-    ,{  -650, -1050,  -650, -1050, -1390}
-    }
-   ,{{  -200,  -600,  -200,  -600, -1390}
-    ,{  -200,  -600,  -200,  -600, -1490}
-    ,{  -650, -1050,  -650, -1050, -1390}
-    ,{ -1150, -1790, -1150, -1790, -1520}
-    ,{  -650, -1050,  -650, -1050, -1390}
-    }
-   ,{{  -400,  -970,  -570,  -970,  -400}
-    ,{  -400,  -970,  -570,  -970,  -400}
-    ,{  -870, -1270,  -870, -1270, -1610}
-    ,{  -570,  -970,  -570,  -970, -1300}
-    ,{  -870, -1270,  -870, -1270, -1610}
-    }
-   ,{{  -230,  -430,  -650,  -430,  -230}
-    ,{ -1300, -1320, -1750, -1320, -1300}
-    ,{  -650, -1050,  -650, -1050, -1390}
-    ,{  -230,  -430,  -880,  -430,  -230}
-    ,{  -650, -1050,  -650, -1050, -1390}
-    }
-   ,{{  -570,  -970,  -570,  -970, -1300}
-    ,{  -570,  -970,  -570,  -970, -1300}
-    ,{ -1180, -1580, -1180, -1580, -1920}
-    ,{  -570,  -970,  -570,  -970, -1300}
-    ,{  -860, -1260,  -860, -1260, -2350}
-    }
-   }
-  }
- ,{{{{   240,    40,   190,  -270,   240}
-    ,{  -590, -1030,  -650,  -870,  -590}
-    ,{  -870, -1180, -1060,  -870, -1010}
-    ,{   240,    40,   190,  -270,   240}
-    ,{  -870,  -970, -1060,  -870, -1010}
-    }
-   ,{{  -780, -1210,  -840,  -870,  -780}
-    ,{ -1050, -1370, -1240, -1050, -1190}
-    ,{  -870, -1210, -1060,  -870, -1010}
-    ,{  -780, -1220,  -840, -1530,  -780}
-    ,{  -870, -1210, -1060,  -870, -1010}
-    }
-   ,{{  -870, -1180, -1060,  -870, -1010}
-    ,{  -870, -1210, -1060,  -870, -1010}
-    ,{  -870, -1180, -1060,  -870, -1010}
-    ,{  -870, -1210, -1060,  -870, -1010}
-    ,{  -870, -1180, -1060,  -870, -1010}
-    }
-   ,{{   240,    40,   190,  -270,   240}
-    ,{  -590, -1030,  -650, -1340,  -590}
-    ,{  -870, -1210, -1060,  -870, -1010}
-    ,{   240,    40,   190,  -270,   240}
-    ,{  -870, -1210, -1060,  -870, -1010}
-    }
-   ,{{  -870,  -970, -1060,  -870, -1010}
-    ,{  -870, -1210, -1060,  -870, -1010}
-    ,{  -870, -1180, -1060,  -870, -1010}
-    ,{  -870, -1210, -1060,  -870, -1010}
-    ,{  -970,  -970, -1060, -1520, -1010}
-    }
-   }
-  ,{{{   190,    40,   190, -1470,   190}
-    ,{  -890, -1030,  -890, -1530,  -890}
-    ,{ -1060, -1210, -1060, -1470, -1060}
-    ,{   190,    40,   190, -1710,   190}
-    ,{  -970,  -970, -1060, -1470, -1060}
-    }
-   ,{{ -1060, -1210, -1060, -1710, -1060}
-    ,{ -1240, -1370, -1240, -1890, -1240}
-    ,{ -1060, -1210, -1060, -1710, -1060}
-    ,{ -1080, -1220, -1080, -1720, -1080}
-    ,{ -1060, -1210, -1060, -1710, -1060}
-    }
-   ,{{ -1060, -1210, -1060, -1470, -1060}
-    ,{ -1060, -1210, -1060, -1710, -1060}
-    ,{ -1060, -1210, -1060, -1470, -1060}
-    ,{ -1060, -1210, -1060, -1710, -1060}
-    ,{ -1060, -1210, -1060, -1470, -1060}
-    }
-   ,{{   190,    40,   190, -1530,   190}
-    ,{  -890, -1030,  -890, -1530,  -890}
-    ,{ -1060, -1210, -1060, -1710, -1060}
-    ,{   190,    40,   190, -1710,   190}
-    ,{ -1060, -1210, -1060, -1710, -1060}
-    }
-   ,{{  -970,  -970, -1060, -1470, -1060}
-    ,{ -1060, -1210, -1060, -1710, -1060}
-    ,{ -1060, -1210, -1060, -1470, -1060}
-    ,{ -1060, -1210, -1060, -1710, -1060}
-    ,{  -970,  -970, -1060, -1710, -1060}
-    }
-   }
-  ,{{{   240,  -270,   180,  -270,   240}
-    ,{  -590, -1340,  -650, -1340,  -590}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    ,{   240,  -270,   180,  -270,   240}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    }
-   ,{{  -780, -1520,  -840, -1520,  -780}
-    ,{ -1190, -1700, -1250, -1700, -1190}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    ,{  -780, -1530,  -840, -1530,  -780}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    }
-   ,{{ -1010, -1520, -1070, -1520, -1010}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    }
-   ,{{   240,  -270,   180,  -270,   240}
-    ,{  -590, -1340,  -650, -1340,  -590}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    ,{   240,  -270,   180,  -270,   240}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    }
-   ,{{ -1010, -1520, -1070, -1520, -1010}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    ,{ -1010, -1520, -1070, -1520, -1010}
-    }
-   }
-  ,{{{   190, -1180,   190,  -870,   190}
-    ,{  -870, -1250,  -890,  -870,  -890}
-    ,{  -870, -1180, -1060,  -870, -1060}
-    ,{   190, -1420,   190,  -870,   190}
-    ,{  -870, -1180, -1060,  -870, -1060}
-    }
-   ,{{  -870, -1420, -1060,  -870, -1060}
-    ,{ -1050, -1600, -1240, -1050, -1240}
-    ,{  -870, -1420, -1060,  -870, -1060}
-    ,{ -1080, -1440, -1080, -2130, -1080}
-    ,{  -870, -1420, -1060,  -870, -1060}
-    }
-   ,{{  -870, -1180, -1060,  -870, -1060}
-    ,{  -870, -1420, -1060,  -870, -1060}
-    ,{  -870, -1180, -1060,  -870, -1060}
-    ,{  -870, -1420, -1060,  -870, -1060}
-    ,{  -870, -1180, -1060,  -870, -1060}
-    }
-   ,{{   190, -1250,   190,  -870,   190}
-    ,{  -890, -1250,  -890, -1940,  -890}
-    ,{  -870, -1420, -1060,  -870, -1060}
-    ,{   190, -1420,   190, -2120,   190}
-    ,{  -870, -1420, -1060,  -870, -1060}
-    }
-   ,{{  -870, -1180, -1060,  -870, -1060}
-    ,{  -870, -1420, -1060,  -870, -1060}
-    ,{  -870, -1180, -1060,  -870, -1060}
-    ,{  -870, -1420, -1060,  -870, -1060}
-    ,{ -1060, -1420, -1060, -2120, -1060}
-    }
-   }
-  ,{{{   130,  -270,   130,  -270, -1680}
-    ,{  -700, -1340,  -700, -1340, -1680}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    ,{   130,  -270,   130,  -270, -1850}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    }
-   ,{{  -890, -1520,  -890, -1520, -1790}
-    ,{ -1300, -1700, -1300, -1700, -1790}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    ,{  -890, -1530,  -890, -1530, -1870}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    }
-   ,{{ -1120, -1520, -1120, -1520, -1850}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    }
-   ,{{   130,  -270,   130,  -270, -1680}
-    ,{  -700, -1340,  -700, -1340, -1680}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    ,{   130,  -270,   130,  -270, -1850}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    }
-   ,{{ -1120, -1520, -1120, -1520, -1850}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    ,{ -1120, -1520, -1120, -1520, -1850}
-    }
-   }
-  }
- ,{{{{   800,   600,   740,   290,   800}
-    ,{   200,  -140,     0,   200,    50}
-    ,{  -310,  -630,  -510,  -310,  -450}
-    ,{   800,   600,   740,   290,   800}
-    ,{  -310,  -410,  -510,  -310,  -450}
-    }
-   ,{{   200,  -140,     0,   200,    50}
-    ,{   200,  -140,     0,   200,    50}
-    ,{  -310,  -650,  -510,  -310,  -450}
-    ,{  -550,  -990,  -610, -1300,  -550}
-    ,{  -310,  -650,  -510,  -310,  -450}
-    }
-   ,{{  -310,  -630,  -510,  -310,  -450}
-    ,{  -310,  -650,  -510,  -310,  -450}
-    ,{  -310,  -630,  -510,  -310,  -450}
-    ,{  -310,  -650,  -510,  -310,  -450}
-    ,{  -310,  -630,  -510,  -310,  -450}
-    }
-   ,{{   800,   600,   740,   290,   800}
-    ,{  -720, -1160,  -780, -1470,  -720}
-    ,{  -310,  -650,  -510,  -310,  -450}
-    ,{   800,   600,   740,   290,   800}
-    ,{  -310,  -650,  -510,  -310,  -450}
-    }
-   ,{{  -310,  -410,  -510,  -310,  -450}
-    ,{  -310,  -650,  -510,  -310,  -450}
-    ,{  -310,  -630,  -510,  -310,  -450}
-    ,{  -310,  -650,  -510,  -310,  -450}
-    ,{  -410,  -410,  -510,  -960,  -450}
-    }
-   }
-  ,{{{   740,   600,   740,  -640,   740}
-    ,{     0,  -140,     0,  -640,     0}
-    ,{  -510,  -650,  -510,  -910,  -510}
-    ,{   740,   600,   740, -1150,   740}
-    ,{  -410,  -410,  -510,  -910,  -510}
-    }
-   ,{{     0,  -140,     0,  -640,     0}
-    ,{     0,  -140,     0,  -640,     0}
-    ,{  -510,  -650,  -510, -1150,  -510}
-    ,{  -850,  -990,  -850, -1490,  -850}
-    ,{  -510,  -650,  -510, -1150,  -510}
-    }
-   ,{{  -510,  -650,  -510,  -910,  -510}
-    ,{  -510,  -650,  -510, -1150,  -510}
-    ,{  -510,  -650,  -510,  -910,  -510}
-    ,{  -510,  -650,  -510, -1150,  -510}
-    ,{  -510,  -650,  -510,  -910,  -510}
-    }
-   ,{{   740,   600,   740, -1150,   740}
-    ,{ -1020, -1160, -1020, -1660, -1020}
-    ,{  -510,  -650,  -510, -1150,  -510}
-    ,{   740,   600,   740, -1150,   740}
-    ,{  -510,  -650,  -510, -1150,  -510}
-    }
-   ,{{  -410,  -410,  -510,  -910,  -510}
-    ,{  -510,  -650,  -510, -1150,  -510}
-    ,{  -510,  -650,  -510,  -910,  -510}
-    ,{  -510,  -650,  -510, -1150,  -510}
-    ,{  -410,  -410,  -510, -1150,  -510}
-    }
-   }
-  ,{{{   800,   290,   740,   290,   800}
-    ,{    50,  -450,     0,  -450,    50}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    ,{   800,   290,   740,   290,   800}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    }
-   ,{{    50,  -450,     0,  -450,    50}
-    ,{    50,  -450,     0,  -450,    50}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    ,{  -550, -1300,  -610, -1300,  -550}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    }
-   ,{{  -450,  -960,  -510,  -960,  -450}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    }
-   ,{{   800,   290,   740,   290,   800}
-    ,{  -720, -1470,  -780, -1470,  -720}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    ,{   800,   290,   740,   290,   800}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    }
-   ,{{  -450,  -960,  -510,  -960,  -450}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    ,{  -450,  -960,  -510,  -960,  -450}
-    }
-   }
-  ,{{{   740,  -360,   740,   200,   740}
-    ,{   200,  -360,     0,   200,     0}
-    ,{  -310,  -630,  -510,  -310,  -510}
-    ,{   740,  -870,   740,  -310,   740}
-    ,{  -310,  -630,  -510,  -310,  -510}
-    }
-   ,{{   200,  -360,     0,   200,     0}
-    ,{   200,  -360,     0,   200,     0}
-    ,{  -310,  -870,  -510,  -310,  -510}
-    ,{  -850, -1210,  -850, -1900,  -850}
-    ,{  -310,  -870,  -510,  -310,  -510}
-    }
-   ,{{  -310,  -630,  -510,  -310,  -510}
-    ,{  -310,  -870,  -510,  -310,  -510}
-    ,{  -310,  -630,  -510,  -310,  -510}
-    ,{  -310,  -870,  -510,  -310,  -510}
-    ,{  -310,  -630,  -510,  -310,  -510}
-    }
-   ,{{   740,  -870,   740,  -310,   740}
-    ,{ -1020, -1380, -1020, -2070, -1020}
-    ,{  -310,  -870,  -510,  -310,  -510}
-    ,{   740,  -870,   740, -1560,   740}
-    ,{  -310,  -870,  -510,  -310,  -510}
-    }
-   ,{{  -310,  -630,  -510,  -310,  -510}
-    ,{  -310,  -870,  -510,  -310,  -510}
-    ,{  -310,  -630,  -510,  -310,  -510}
-    ,{  -310,  -870,  -510,  -310,  -510}
-    ,{  -510,  -870,  -510, -1560,  -510}
-    }
-   }
-  ,{{{   690,   290,   690,   290,  -550}
-    ,{   -50,  -450,   -50,  -450,  -550}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    ,{   690,   290,   690,   290, -1300}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    }
-   ,{{   -50,  -450,   -50,  -450,  -550}
-    ,{   -50,  -450,   -50,  -450,  -550}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    ,{  -660, -1300,  -660, -1300, -1640}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    }
-   ,{{  -560,  -960,  -560,  -960, -1300}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    }
-   ,{{   690,   290,   690,   290, -1300}
-    ,{  -830, -1470,  -830, -1470, -1810}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    ,{   690,   290,   690,   290, -1300}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    }
-   ,{{  -560,  -960,  -560,  -960, -1300}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    ,{  -560,  -960,  -560,  -960, -1300}
-    }
-   }
-  }
- ,{{{{  1170,   970,  1120,   780,  1170}
-    ,{   780,   440,   580,   780,   640}
-    ,{   480,   170,   280,   480,   340}
-    ,{  1170,   970,  1120,   660,  1170}
-    ,{   480,   170,   280,   480,   340}
-    }
-   ,{{   780,   440,   580,   780,   640}
-    ,{   780,   440,   580,   780,   640}
-    ,{   470,   130,   270,   470,   330}
-    ,{  -510,  -950,  -570, -1260,  -510}
-    ,{   470,   130,   270,   470,   330}
-    }
-   ,{{   490,   170,   290,   490,   340}
-    ,{   490,   140,   290,   490,   340}
-    ,{   480,   170,   280,   480,   340}
-    ,{   490,   140,   290,   490,   340}
-    ,{   480,   170,   280,   480,   340}
-    }
-   ,{{  1170,   970,  1120,   660,  1170}
-    ,{  -330,  -770,  -390, -1080,  -330}
-    ,{   470,   130,   270,   470,   330}
-    ,{  1170,   970,  1120,   660,  1170}
-    ,{   470,   130,   270,   470,   330}
-    }
-   ,{{   490,   170,   290,   490,   340}
-    ,{   490,   140,   290,   490,   340}
-    ,{   480,   170,   280,   480,   340}
-    ,{   490,   140,   290,   490,   340}
-    ,{  -600,  -600,  -690, -1150,  -640}
-    }
-   }
-  ,{{{  1120,   970,  1120,   -60,  1120}
-    ,{   580,   440,   580,   -60,   580}
-    ,{   280,   140,   280,  -120,   280}
-    ,{  1120,   970,  1120,  -350,  1120}
-    ,{   280,   140,   280,  -120,   280}
-    }
-   ,{{   580,   440,   580,   -60,   580}
-    ,{   580,   440,   580,   -60,   580}
-    ,{   270,   130,   270,  -370,   270}
-    ,{  -800,  -950,  -800, -1450,  -800}
-    ,{   270,   130,   270,  -370,   270}
-    }
-   ,{{   290,   140,   290,  -120,   290}
-    ,{   290,   140,   290,  -350,   290}
-    ,{   280,   140,   280,  -120,   280}
-    ,{   290,   140,   290,  -350,   290}
-    ,{   280,   140,   280,  -120,   280}
-    }
-   ,{{  1120,   970,  1120,  -370,  1120}
-    ,{  -620,  -770,  -620, -1270,  -620}
-    ,{   270,   130,   270,  -370,   270}
-    ,{  1120,   970,  1120,  -780,  1120}
-    ,{   270,   130,   270,  -370,   270}
-    }
-   ,{{   290,   140,   290,  -120,   290}
-    ,{   290,   140,   290,  -350,   290}
-    ,{   280,   140,   280,  -120,   280}
-    ,{   290,   140,   290,  -350,   290}
-    ,{  -600,  -600,  -690, -1340,  -690}
-    }
-   }
-  ,{{{  1170,   660,  1110,   660,  1170}
-    ,{   640,   130,   580,   130,   640}
-    ,{   340,  -170,   280,  -170,   340}
-    ,{  1170,   660,  1110,   660,  1170}
-    ,{   340,  -170,   280,  -170,   340}
-    }
-   ,{{   640,   130,   580,   130,   640}
-    ,{   640,   130,   580,   130,   640}
-    ,{   330,  -180,   270,  -180,   330}
-    ,{  -510, -1260,  -570, -1260,  -510}
-    ,{   330,  -180,   270,  -180,   330}
-    }
-   ,{{   340,  -160,   280,  -160,   340}
-    ,{   340,  -160,   280,  -160,   340}
-    ,{   340,  -170,   280,  -170,   340}
-    ,{   340,  -160,   280,  -160,   340}
-    ,{   340,  -170,   280,  -170,   340}
-    }
-   ,{{  1170,   660,  1110,   660,  1170}
-    ,{  -330, -1080,  -390, -1080,  -330}
-    ,{   330,  -180,   270,  -180,   330}
-    ,{  1170,   660,  1110,   660,  1170}
-    ,{   330,  -180,   270,  -180,   330}
-    }
-   ,{{   340,  -160,   280,  -160,   340}
-    ,{   340,  -160,   280,  -160,   340}
-    ,{   340,  -170,   280,  -170,   340}
-    ,{   340,  -160,   280,  -160,   340}
-    ,{  -640, -1150,  -700, -1150,  -640}
-    }
-   }
-  ,{{{  1120,   220,  1120,   780,  1120}
-    ,{   780,   220,   580,   780,   580}
-    ,{   480,   170,   280,   480,   280}
-    ,{  1120,   -70,  1120,   490,  1120}
-    ,{   480,   170,   280,   480,   280}
-    }
-   ,{{   780,   220,   580,   780,   580}
-    ,{   780,   220,   580,   780,   580}
-    ,{   470,   -80,   270,   470,   270}
-    ,{  -800, -1160,  -800, -1860,  -800}
-    ,{   470,   -80,   270,   470,   270}
-    }
-   ,{{   490,   170,   290,   490,   290}
-    ,{   490,   -70,   290,   490,   290}
-    ,{   480,   170,   280,   480,   280}
-    ,{   490,   -70,   290,   490,   290}
-    ,{   480,   170,   280,   480,   280}
-    }
-   ,{{  1120,   -80,  1120,   470,  1120}
-    ,{  -620,  -980,  -620, -1680,  -620}
-    ,{   470,   -80,   270,   470,   270}
-    ,{  1120,  -490,  1120, -1190,  1120}
-    ,{   470,   -80,   270,   470,   270}
-    }
-   ,{{   490,   170,   290,   490,   290}
-    ,{   490,   -70,   290,   490,   290}
-    ,{   480,   170,   280,   480,   280}
-    ,{   490,   -70,   290,   490,   290}
-    ,{  -690, -1050,  -690, -1750,  -690}
-    }
-   }
-  ,{{{  1060,   660,  1060,   660,    40}
-    ,{   530,   130,   530,   130,    40}
-    ,{   230,  -170,   230,  -170,  -500}
-    ,{  1060,   660,  1060,   660,  -500}
-    ,{   230,  -170,   230,  -170,  -500}
-    }
-   ,{{   530,   130,   530,   130,    40}
-    ,{   530,   130,   530,   130,    40}
-    ,{   220,  -180,   220,  -180,  -510}
-    ,{  -620, -1260,  -620, -1260, -1590}
-    ,{   220,  -180,   220,  -180,  -510}
-    }
-   ,{{   230,  -160,   230,  -160,  -500}
-    ,{   230,  -160,   230,  -160,  -500}
-    ,{   230,  -170,   230,  -170,  -500}
-    ,{   230,  -160,   230,  -160,  -500}
-    ,{   230,  -170,   230,  -170,  -500}
-    }
-   ,{{  1060,   660,  1060,   660,  -510}
-    ,{  -440, -1080,  -440, -1080, -1410}
-    ,{   220,  -180,   220,  -180,  -510}
-    ,{  1060,   660,  1060,   660,  -920}
-    ,{   220,  -180,   220,  -180,  -510}
-    }
-   ,{{   230,  -160,   230,  -160,  -500}
-    ,{   230,  -160,   230,  -160,  -500}
-    ,{   230,  -170,   230,  -170,  -500}
-    ,{   230,  -160,   230,  -160,  -500}
-    ,{  -750, -1150,  -750, -1150, -1480}
-    }
-   }
-  }
- ,{{{{  1350,  1160,  1300,   850,  1350}
-    ,{   850,   500,   650,   850,   700}
-    ,{   720,   400,   520,   720,   570}
-    ,{  1350,  1160,  1300,   850,  1350}
-    ,{   590,   270,   390,   590,   440}
-    }
-   ,{{   850,   500,   650,   850,   700}
-    ,{   850,   500,   650,   850,   700}
-    ,{   570,   220,   370,   570,   420}
-    ,{  -460,  -900,  -520, -1210,  -460}
-    ,{   570,   220,   370,   570,   420}
-    }
-   ,{{   720,   400,   520,   720,   570}
-    ,{   720,   370,   520,   720,   570}
-    ,{   720,   400,   520,   720,   570}
-    ,{   720,   370,   520,   720,   570}
-    ,{   590,   270,   390,   590,   440}
-    }
-   ,{{  1350,  1160,  1300,   850,  1350}
-    ,{  -760, -1200,  -820, -1510,  -760}
-    ,{   570,   220,   370,   570,   420}
-    ,{  1350,  1160,  1300,   850,  1350}
-    ,{   570,   220,   370,   570,   420}
-    }
-   ,{{   720,   370,   520,   720,   570}
-    ,{   720,   370,   520,   720,   570}
-    ,{   280,   -40,    80,   280,   130}
-    ,{   720,   370,   520,   720,   570}
-    ,{  -320,  -320,  -420,  -870,  -360}
-    }
-   }
-  ,{{{  1300,  1160,  1300,   120,  1300}
-    ,{   650,   500,   650,     0,   650}
-    ,{   520,   370,   520,   120,   520}
-    ,{  1300,  1160,  1300,  -120,  1300}
-    ,{   390,   240,   390,   -10,   390}
-    }
-   ,{{   650,   500,   650,     0,   650}
-    ,{   650,   500,   650,     0,   650}
-    ,{   370,   220,   370,  -270,   370}
-    ,{  -750,  -900,  -750, -1400,  -750}
-    ,{   370,   220,   370,  -270,   370}
-    }
-   ,{{   520,   370,   520,   120,   520}
-    ,{   520,   370,   520,  -120,   520}
-    ,{   520,   370,   520,   120,   520}
-    ,{   520,   370,   520,  -120,   520}
-    ,{   390,   240,   390,   -10,   390}
-    }
-   ,{{  1300,  1160,  1300,  -270,  1300}
-    ,{ -1050, -1200, -1050, -1700, -1050}
-    ,{   370,   220,   370,  -270,   370}
-    ,{  1300,  1160,  1300,  -590,  1300}
-    ,{   370,   220,   370,  -270,   370}
-    }
-   ,{{   520,   370,   520,  -120,   520}
-    ,{   520,   370,   520,  -120,   520}
-    ,{    80,   -60,    80,  -320,    80}
-    ,{   520,   370,   520,  -120,   520}
-    ,{  -320,  -320,  -420, -1060,  -420}
-    }
-   }
-  ,{{{  1350,   850,  1290,   850,  1350}
-    ,{   700,   190,   640,   190,   700}
-    ,{   570,    60,   510,    60,   570}
-    ,{  1350,   850,  1290,   850,  1350}
-    ,{   440,   -60,   380,   -60,   440}
-    }
-   ,{{   700,   190,   640,   190,   700}
-    ,{   700,   190,   640,   190,   700}
-    ,{   420,   -80,   360,   -80,   420}
-    ,{  -460, -1210,  -520, -1210,  -460}
-    ,{   420,   -80,   360,   -80,   420}
-    }
-   ,{{   570,    60,   510,    60,   570}
-    ,{   570,    60,   510,    60,   570}
-    ,{   570,    60,   510,    60,   570}
-    ,{   570,    60,   510,    60,   570}
-    ,{   440,   -60,   380,   -60,   440}
-    }
-   ,{{  1350,   850,  1290,   850,  1350}
-    ,{  -760, -1510,  -820, -1510,  -760}
-    ,{   420,   -80,   360,   -80,   420}
-    ,{  1350,   850,  1290,   850,  1350}
-    ,{   420,   -80,   360,   -80,   420}
-    }
-   ,{{   570,    60,   510,    60,   570}
-    ,{   570,    60,   510,    60,   570}
-    ,{   130,  -370,    70,  -370,   130}
-    ,{   570,    60,   510,    60,   570}
-    ,{  -360,  -870,  -420,  -870,  -360}
-    }
-   }
-  ,{{{  1300,   400,  1300,   850,  1300}
-    ,{   850,   290,   650,   850,   650}
-    ,{   720,   400,   520,   720,   520}
-    ,{  1300,   160,  1300,   720,  1300}
-    ,{   590,   270,   390,   590,   390}
-    }
-   ,{{   850,   290,   650,   850,   650}
-    ,{   850,   290,   650,   850,   650}
-    ,{   570,    10,   370,   570,   370}
-    ,{  -750, -1110,  -750, -1810,  -750}
-    ,{   570,    10,   370,   570,   370}
-    }
-   ,{{   720,   400,   520,   720,   520}
-    ,{   720,   160,   520,   720,   520}
-    ,{   720,   400,   520,   720,   520}
-    ,{   720,   160,   520,   720,   520}
-    ,{   590,   270,   390,   590,   390}
-    }
-   ,{{  1300,    10,  1300,   570,  1300}
-    ,{ -1050, -1410, -1050, -2110, -1050}
-    ,{   570,    10,   370,   570,   370}
-    ,{  1300,  -310,  1300, -1000,  1300}
-    ,{   570,    10,   370,   570,   370}
-    }
-   ,{{   720,   160,   520,   720,   520}
-    ,{   720,   160,   520,   720,   520}
-    ,{   280,   -40,    80,   280,    80}
-    ,{   720,   160,   520,   720,   520}
-    ,{  -420,  -780,  -420, -1470,  -420}
-    }
-   }
-  ,{{{  1250,   850,  1250,   850,   100}
-    ,{   590,   190,   590,   190,   100}
-    ,{   460,    60,   460,    60,  -270}
-    ,{  1250,   850,  1250,   850,  -270}
-    ,{   330,   -60,   330,   -60,  -400}
-    }
-   ,{{   590,   190,   590,   190,   100}
-    ,{   590,   190,   590,   190,   100}
-    ,{   310,   -80,   310,   -80,  -420}
-    ,{  -570, -1210,  -570, -1210, -1540}
-    ,{   310,   -80,   310,   -80,  -420}
-    }
-   ,{{   460,    60,   460,    60,  -270}
-    ,{   460,    60,   460,    60,  -270}
-    ,{   460,    60,   460,    60,  -270}
-    ,{   460,    60,   460,    60,  -270}
-    ,{   330,   -60,   330,   -60,  -400}
-    }
-   ,{{  1250,   850,  1250,   850,  -420}
-    ,{  -870, -1510,  -870, -1510, -1840}
-    ,{   310,   -80,   310,   -80,  -420}
-    ,{  1250,   850,  1250,   850,  -740}
-    ,{   310,   -80,   310,   -80,  -420}
-    }
-   ,{{   460,    60,   460,    60,  -270}
-    ,{   460,    60,   460,    60,  -270}
-    ,{    20,  -370,    20,  -370,  -710}
-    ,{   460,    60,   460,    60,  -270}
-    ,{  -470,  -870,  -470,  -870, -1210}
-    }
-   }
-  }
- ,{{{{  1350,  1160,  1300,   850,  1350}
-    ,{   850,   500,   650,   850,   700}
-    ,{   720,   400,   520,   720,   570}
-    ,{  1350,  1160,  1300,   850,  1350}
-    ,{   590,   270,   390,   590,   440}
-    }
-   ,{{   850,   500,   650,   850,   700}
-    ,{   850,   500,   650,   850,   700}
-    ,{   570,   220,   370,   570,   420}
-    ,{  -230,  -670,  -290,  -980,  -230}
-    ,{   570,   220,   370,   570,   420}
-    }
-   ,{{   720,   400,   520,   720,   570}
-    ,{   720,   370,   520,   720,   570}
-    ,{   720,   400,   520,   720,   570}
-    ,{   720,   370,   520,   720,   570}
-    ,{   590,   270,   390,   590,   440}
-    }
-   ,{{  1350,  1160,  1300,   850,  1350}
-    ,{  -330,  -770,  -390, -1080,  -330}
-    ,{   570,   220,   370,   570,   420}
-    ,{  1350,  1160,  1300,   850,  1350}
-    ,{   570,   220,   370,   570,   420}
-    }
-   ,{{   720,   370,   520,   720,   570}
-    ,{   720,   370,   520,   720,   570}
-    ,{   480,   170,   280,   480,   340}
-    ,{   720,   370,   520,   720,   570}
-    ,{   -90,  -320,   -90,  -810,  -360}
-    }
-   }
-  ,{{{  1300,  1160,  1300,   540,  1300}
-    ,{   650,   500,   650,    10,   650}
-    ,{   540,   370,   520,   540,   520}
-    ,{  1300,  1160,  1300,  -120,  1300}
-    ,{   390,   240,   390,   -10,   390}
-    }
-   ,{{   650,   500,   650,     0,   650}
-    ,{   650,   500,   650,     0,   650}
-    ,{   370,   220,   370,  -100,   370}
-    ,{  -530,  -670,  -530, -1170,  -530}
-    ,{   370,   220,   370,  -270,   370}
-    }
-   ,{{   540,   370,   520,   540,   520}
-    ,{   520,   370,   520,    10,   520}
-    ,{   540,   370,   520,   540,   520}
-    ,{   520,   370,   520,  -120,   520}
-    ,{   390,   240,   390,   -10,   390}
-    }
-   ,{{  1300,  1160,  1300,  -270,  1300}
-    ,{  -620,  -770,  -620, -1270,  -620}
-    ,{   370,   220,   370,  -270,   370}
-    ,{  1300,  1160,  1300,  -590,  1300}
-    ,{   370,   220,   370,  -270,   370}
-    }
-   ,{{   520,   370,   520,  -120,   520}
-    ,{   520,   370,   520,  -120,   520}
-    ,{   280,   140,   280,  -120,   280}
-    ,{   520,   370,   520,  -120,   520}
-    ,{   -90,  -320,   -90,  -810,  -420}
-    }
-   }
-  ,{{{  1350,   850,  1290,   850,  1350}
-    ,{   700,   190,   640,   190,   700}
-    ,{   570,    60,   510,    60,   570}
-    ,{  1350,   850,  1290,   850,  1350}
-    ,{   440,   -60,   380,   -60,   440}
-    }
-   ,{{   700,   190,   640,   190,   700}
-    ,{   700,   190,   640,   190,   700}
-    ,{   420,   -80,   360,   -80,   420}
-    ,{  -230,  -980,  -290,  -980,  -230}
-    ,{   420,   -80,   360,   -80,   420}
-    }
-   ,{{   570,    60,   510,    60,   570}
-    ,{   570,    60,   510,    60,   570}
-    ,{   570,    60,   510,    60,   570}
-    ,{   570,    60,   510,    60,   570}
-    ,{   440,   -60,   380,   -60,   440}
-    }
-   ,{{  1350,   850,  1290,   850,  1350}
-    ,{  -330, -1070,  -390, -1080,  -330}
-    ,{   420,   -80,   360,   -80,   420}
-    ,{  1350,   850,  1290,   850,  1350}
-    ,{   420,   -80,   360,   -80,   420}
-    }
-   ,{{   570,    60,   510,    60,   570}
-    ,{   570,    60,   510,    60,   570}
-    ,{   340,  -170,   280,  -170,   340}
-    ,{   570,    60,   510,    60,   570}
-    ,{  -360,  -830,  -420,  -870,  -360}
-    }
-   }
-  ,{{{  1300,   400,  1300,   850,  1300}
-    ,{   850,   290,   650,   850,   650}
-    ,{   720,   400,   520,   720,   520}
-    ,{  1300,   160,  1300,   720,  1300}
-    ,{   590,   270,   390,   590,   390}
-    }
-   ,{{   850,   290,   650,   850,   650}
-    ,{   850,   290,   650,   850,   650}
-    ,{   570,    10,   370,   570,   370}
-    ,{  -530,  -890,  -530, -1580,  -530}
-    ,{   570,    10,   370,   570,   370}
-    }
-   ,{{   720,   400,   520,   720,   520}
-    ,{   720,   160,   520,   720,   520}
-    ,{   720,   400,   520,   720,   520}
-    ,{   720,   160,   520,   720,   520}
-    ,{   590,   270,   390,   590,   390}
-    }
-   ,{{  1300,    10,  1300,   570,  1300}
-    ,{  -620,  -980,  -620, -1080,  -620}
-    ,{   570,    10,   370,   570,   370}
-    ,{  1300,  -310,  1300, -1000,  1300}
-    ,{   570,    10,   370,   570,   370}
-    }
-   ,{{   720,   170,   520,   720,   520}
-    ,{   720,   160,   520,   720,   520}
-    ,{   480,   170,   280,   480,   280}
-    ,{   720,   160,   520,   720,   520}
-    ,{  -420,  -780,  -420, -1470,  -420}
-    }
-   }
-  ,{{{  1250,   850,  1250,   850,   100}
-    ,{   590,   190,   590,   190,   100}
-    ,{   460,    60,   460,    60,  -270}
-    ,{  1250,   850,  1250,   850,  -230}
-    ,{   330,   -60,   330,   -60,  -400}
-    }
-   ,{{   590,   190,   590,   190,   100}
-    ,{   590,   190,   590,   190,   100}
-    ,{   310,   -80,   310,   -80,  -420}
-    ,{  -340,  -980,  -340,  -980, -1320}
-    ,{   310,   -80,   310,   -80,  -420}
-    }
-   ,{{   460,    60,   460,    60,  -270}
-    ,{   460,    60,   460,    60,  -270}
-    ,{   460,    60,   460,    60,  -270}
-    ,{   460,    60,   460,    60,  -270}
-    ,{   330,   -60,   330,   -60,  -400}
-    }
-   ,{{  1250,   850,  1250,   850,  -230}
-    ,{  -440, -1080,  -440, -1080, -1300}
-    ,{   310,   -80,   310,   -80,  -420}
-    ,{  1250,   850,  1250,   850,  -230}
-    ,{   310,   -80,   310,   -80,  -420}
-    }
-   ,{{   460,    60,   460,    60,  -270}
-    ,{   460,    60,   460,    60,  -270}
-    ,{   230,  -170,   230,  -170,  -500}
-    ,{   460,    60,   460,    60,  -270}
-    ,{  -470,  -870,  -470,  -870, -1210}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   540,   -90,   540,   180,   -90}
-    ,{   540,  -100,   540,   180,   -90}
-    ,{   180,   -90,  -460,   180,  -460}
-    ,{    30,  -150,  -260,    30,  -210}
-    ,{  -200,  -200,  -400,  -230,  -570}
-    }
-   ,{{   180,  -350,  -660,   180,  -660}
-    ,{   180,  -580,  -660,   180,  -660}
-    ,{  -430,  -600,  -970,  -430,  -830}
-    ,{  -350,  -350,  -870,  -960,  -870}
-    ,{  -430,  -600,  -970,  -430,  -970}
-    }
-   ,{{    30,  -150,  -510,    30,   -90}
-    ,{   -90,  -220,  -510,  -390,   -90}
-    ,{    20,  -600,  -520,    20,  -520}
-    ,{    30,  -150,  -510,    30,  -510}
-    ,{  -200,  -200,  -570,  -650,  -570}
-    }
-   ,{{   540,  -100,   540,  -400,  -210}
-    ,{   540,  -100,   540, -1240,  -810}
-    ,{  -430,  -600,  -970,  -430,  -970}
-    ,{  -200,  -200,  -260,  -400,  -210}
-    ,{  -430,  -600,  -970,  -430,  -970}
-    }
-   ,{{   180,   -90,  -400,   180,  -460}
-    ,{    30,  -150,  -510,    30,  -510}
-    ,{   180,   -90,  -460,   180,  -460}
-    ,{    30,  -150,  -510,    30,  -510}
-    ,{  -230, -1390,  -400,  -230, -1300}
-    }
-   }
-  ,{{{    10,   -90,    10,  -500,  -320}
-    ,{    10,  -150,    10,  -860,  -510}
-    ,{   -90,   -90,  -460,  -500,  -460}
-    ,{  -150,  -150,  -320,  -860,  -320}
-    ,{  -200,  -200,  -400, -1300,  -570}
-    }
-   ,{{  -580,  -580,  -660, -1070,  -660}
-    ,{  -580,  -580,  -660, -1340,  -660}
-    ,{  -600,  -600,  -970, -1070,  -970}
-    ,{  -870, -1600, -1110, -1880,  -870}
-    ,{  -600,  -600,  -970, -1320,  -970}
-    }
-   ,{{  -150,  -150,  -510,  -500,  -510}
-    ,{  -220,  -220, -1150,  -860,  -510}
-    ,{  -500, -1070,  -750,  -500,  -520}
-    ,{  -150,  -150,  -510,  -860,  -510}
-    ,{  -200,  -200,  -570, -1750,  -570}
-    }
-   ,{{    10,  -200,    10, -1080,  -320}
-    ,{    10,  -970,    10, -2450, -1160}
-    ,{  -600,  -600,  -970, -1320,  -970}
-    ,{  -200,  -200,  -320, -1080,  -320}
-    ,{  -600,  -600,  -970, -1320,  -970}
-    }
-   ,{{   -90,   -90,  -400,  -570,  -460}
-    ,{  -150,  -150,  -510,  -860,  -510}
-    ,{   -90,   -90,  -460,  -570,  -460}
-    ,{  -150,  -150,  -510,  -860,  -510}
-    ,{  -400, -1490,  -400, -1300, -1300}
-    }
-   }
-  ,{{{   540,  -100,   540,  -400,  -210}
-    ,{   540,  -100,   540,  -600, -1130}
-    ,{  -540,  -540,  -760,  -540, -1070}
-    ,{  -210,  -350,  -620,  -400,  -210}
-    ,{  -650,  -650,  -870,  -650, -1180}
-    }
-   ,{{  -350,  -350,  -940,  -740, -1250}
-    ,{  -740,  -740,  -960,  -740, -1270}
-    ,{ -1050, -1050, -1270, -1050, -1580}
-    ,{  -350,  -350,  -940,  -960, -1250}
-    ,{ -1050, -1050, -1270, -1050, -1580}
-    }
-   ,{{  -600,  -600,  -820,  -600, -1130}
-    ,{  -600,  -600,  -820,  -600, -1130}
-    ,{  -600,  -600,  -820,  -600, -1130}
-    ,{  -600,  -600,  -820,  -600, -1130}
-    ,{  -650,  -650,  -870,  -650, -1180}
-    }
-   ,{{   540,  -100,   540,  -400,  -210}
-    ,{   540,  -100,   540, -1240, -1530}
-    ,{ -1050, -1050, -1270, -1050, -1580}
-    ,{  -210,  -440,  -620,  -400,  -210}
-    ,{ -1050, -1050, -1270, -1050, -1580}
-    }
-   ,{{  -540,  -540,  -760,  -540, -1070}
-    ,{  -600,  -600,  -820,  -600, -1130}
-    ,{  -540,  -540,  -760,  -540, -1070}
-    ,{  -600,  -600,  -820,  -600, -1130}
-    ,{ -1390, -1390, -1610, -1390, -1920}
-    }
-   }
-  ,{{{   180,  -630,  -320,   180,  -320}
-    ,{   180, -1340,  -510,   180,  -510}
-    ,{   180,  -630,  -460,   180,  -460}
-    ,{    30, -1340,  -320,    30,  -320}
-    ,{  -230, -1150,  -570,  -230,  -570}
-    }
-   ,{{   180, -1790,  -660,   180,  -660}
-    ,{   180, -2010,  -660,   180,  -660}
-    ,{  -430, -1790,  -970,  -430,  -970}
-    ,{  -870, -3070,  -870, -1370,  -870}
-    ,{  -430, -1790,  -970,  -430,  -970}
-    }
-   ,{{    30,  -630,  -510,    30,  -510}
-    ,{  -390, -1650,  -510,  -390,  -510}
-    ,{    20,  -630,  -520,    20,  -520}
-    ,{    30, -1340,  -510,    30,  -510}
-    ,{  -570, -1150,  -570,  -880,  -570}
-    }
-   ,{{  -320, -1790,  -320,  -430,  -320}
-    ,{ -1160, -1980, -1160, -1870, -1160}
-    ,{  -430, -1790,  -970,  -430,  -970}
-    ,{  -320, -2390,  -320, -2280,  -320}
-    ,{  -430, -1790,  -970,  -430,  -970}
-    }
-   ,{{   180, -1040,  -460,   180,  -460}
-    ,{    30, -1340,  -510,    30,  -510}
-    ,{   180, -1040,  -460,   180,  -460}
-    ,{    30, -1340,  -510,    30,  -510}
-    ,{  -230, -1520, -1300,  -230, -1300}
-    }
-   }
-  ,{{{   -90,  -400,  -260,  -400,   -90}
-    ,{   -90,  -600,  -820,  -600,   -90}
-    ,{  -540,  -540,  -550,  -540,  -830}
-    ,{  -260,  -400,  -260,  -400,  -800}
-    ,{  -650,  -650,  -870,  -650,  -860}
-    }
-   ,{{  -740,  -740,  -940,  -740,  -830}
-    ,{  -740,  -740,  -960,  -740, -1240}
-    ,{  -830, -1050, -1270, -1050,  -830}
-    ,{  -940,  -960,  -940,  -960, -1360}
-    ,{ -1050, -1050, -1270, -1050, -1260}
-    }
-   ,{{   -90,  -600,  -820,  -600,   -90}
-    ,{   -90,  -600,  -820,  -600,   -90}
-    ,{  -600,  -600,  -820,  -600, -1710}
-    ,{  -600,  -600,  -820,  -600,  -800}
-    ,{  -650,  -650,  -870,  -650,  -860}
-    }
-   ,{{  -260,  -400,  -260,  -400,  -810}
-    ,{  -810, -1240, -1220, -1240,  -810}
-    ,{ -1050, -1050, -1270, -1050, -1260}
-    ,{  -260,  -400,  -260,  -400, -1550}
-    ,{ -1050, -1050, -1270, -1050, -1260}
-    }
-   ,{{  -540,  -540,  -550,  -540,  -800}
-    ,{  -600,  -600,  -820,  -600,  -800}
-    ,{  -540,  -540,  -550,  -540, -1460}
-    ,{  -600,  -600,  -820,  -600,  -800}
-    ,{ -1390, -1390, -1610, -1390, -2350}
-    }
-   }
-  }
- ,{{{{    50,    50,  -320,    50,  -320}
-    ,{    50,  -130,  -490,    50,  -490}
-    ,{  -400,  -580,  -940,  -400,  -940}
-    ,{    50,    50,  -320,  -320,  -320}
-    ,{  -400,  -540,  -940,  -400,  -940}
-    }
-   ,{{    50,  -130,  -490,    50,  -490}
-    ,{    50,  -130,  -490,    50,  -490}
-    ,{  -400,  -580,  -940,  -400,  -940}
-    ,{ -1320, -1320, -1680, -1770, -1680}
-    ,{  -400,  -580,  -940,  -400,  -940}
-    }
-   ,{{  -320,  -490,  -860,  -320,  -860}
-    ,{  -320,  -490,  -860,  -320,  -860}
-    ,{  -620,  -800, -1160,  -620, -1160}
-    ,{  -320,  -490,  -860,  -320,  -860}
-    ,{  -620,  -800, -1160,  -620, -1160}
-    }
-   ,{{    50,    50,  -320,  -400,  -320}
-    ,{  -840,  -840, -1210, -1290, -1210}
-    ,{  -400,  -580,  -940,  -400,  -940}
-    ,{    50,    50,  -320,  -400,  -320}
-    ,{  -400,  -580,  -940,  -400,  -940}
-    }
-   ,{{  -320,  -490,  -860,  -320,  -860}
-    ,{  -320,  -490,  -860,  -320,  -860}
-    ,{  -930, -1110, -1470,  -930, -1470}
-    ,{  -320,  -490,  -860,  -320,  -860}
-    ,{  -540,  -540, -1150, -1230, -1150}
-    }
-   }
-  ,{{{    50,    50,  -320,  -840,  -320}
-    ,{  -130,  -130,  -490,  -840,  -490}
-    ,{  -580,  -580,  -940, -1270,  -940}
-    ,{    50,    50,  -320, -1210,  -320}
-    ,{  -540,  -540,  -940, -1270,  -940}
-    }
-   ,{{  -130,  -130,  -490,  -840,  -490}
-    ,{  -130,  -130,  -490,  -840,  -490}
-    ,{  -580,  -580,  -940, -1290,  -940}
-    ,{ -1320, -1320, -1680, -2030, -1680}
-    ,{  -580,  -580,  -940, -1290,  -940}
-    }
-   ,{{  -490,  -490,  -860, -1210,  -860}
-    ,{  -490,  -490,  -860, -1210,  -860}
-    ,{  -800,  -800, -1160, -1270, -1160}
-    ,{  -490,  -490,  -860, -1210,  -860}
-    ,{  -800,  -800, -1160, -1270, -1160}
-    }
-   ,{{    50,    50,  -320, -1290,  -320}
-    ,{  -840,  -840, -1210, -1560, -1210}
-    ,{  -580,  -580,  -940, -1290,  -940}
-    ,{    50,    50,  -320, -1920,  -320}
-    ,{  -580,  -580,  -940, -1290,  -940}
-    }
-   ,{{  -490,  -490,  -860, -1210,  -860}
-    ,{  -490,  -490,  -860, -1210,  -860}
-    ,{ -1110, -1110, -1470, -1580, -1470}
-    ,{  -490,  -490,  -860, -1210,  -860}
-    ,{  -540,  -540, -1150, -1500, -1150}
-    }
-   }
-  ,{{{  -400,  -400,  -620,  -400,  -930}
-    ,{  -580,  -580,  -800,  -580, -1110}
-    ,{ -1030, -1030, -1250, -1030, -1560}
-    ,{  -400,  -400,  -620,  -400,  -930}
-    ,{ -1030, -1030, -1250, -1030, -1560}
-    }
-   ,{{  -580,  -580,  -800,  -580, -1110}
-    ,{  -580,  -580,  -800,  -580, -1110}
-    ,{ -1030, -1030, -1250, -1030, -1560}
-    ,{ -1750, -1770, -1750, -1770, -2060}
-    ,{ -1030, -1030, -1250, -1030, -1560}
-    }
-   ,{{  -940,  -940, -1160,  -940, -1470}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{ -1250, -1250, -1470, -1250, -1780}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{ -1250, -1250, -1470, -1250, -1780}
-    }
-   ,{{  -400,  -400,  -620,  -400,  -930}
-    ,{ -1270, -1290, -1270, -1290, -1580}
-    ,{ -1030, -1030, -1250, -1030, -1560}
-    ,{  -400,  -400,  -620,  -400,  -930}
-    ,{ -1030, -1030, -1250, -1030, -1560}
-    }
-   ,{{  -940,  -940, -1160,  -940, -1470}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{ -1560, -1560, -1780, -1560, -2090}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{ -1230, -1230, -1450, -1230, -1760}
-    }
-   }
-  ,{{{    50, -1320,  -320,    50,  -320}
-    ,{    50, -1320,  -490,    50,  -490}
-    ,{  -400, -1750,  -940,  -400,  -940}
-    ,{  -320, -1680,  -320,  -320,  -320}
-    ,{  -400, -1750,  -940,  -400,  -940}
-    }
-   ,{{    50, -1320,  -490,    50,  -490}
-    ,{    50, -1320,  -490,    50,  -490}
-    ,{  -400, -1770,  -940,  -400,  -940}
-    ,{ -1680, -2510, -1680, -2390, -1680}
-    ,{  -400, -1770,  -940,  -400,  -940}
-    }
-   ,{{  -320, -1680,  -860,  -320,  -860}
-    ,{  -320, -1680,  -860,  -320,  -860}
-    ,{  -620, -1750, -1160,  -620, -1160}
-    ,{  -320, -1680,  -860,  -320,  -860}
-    ,{  -620, -1750, -1160,  -620, -1160}
-    }
-   ,{{  -320, -1770,  -320,  -400,  -320}
-    ,{ -1210, -2030, -1210, -1920, -1210}
-    ,{  -400, -1770,  -940,  -400,  -940}
-    ,{  -320, -2390,  -320, -2280,  -320}
-    ,{  -400, -1770,  -940,  -400,  -940}
-    }
-   ,{{  -320, -1680,  -860,  -320,  -860}
-    ,{  -320, -1680,  -860,  -320,  -860}
-    ,{  -930, -2060, -1470,  -930, -1470}
-    ,{  -320, -1680,  -860,  -320,  -860}
-    ,{ -1150, -1970, -1150, -1860, -1150}
-    }
-   }
-  ,{{{  -400,  -400,  -620,  -400,  -540}
-    ,{  -540,  -580,  -800,  -580,  -540}
-    ,{ -1030, -1030, -1250, -1030, -1230}
-    ,{  -400,  -400,  -620,  -400, -1150}
-    ,{ -1030, -1030, -1250, -1030, -1230}
-    }
-   ,{{  -540,  -580,  -800,  -580,  -540}
-    ,{  -540,  -580,  -800,  -580,  -540}
-    ,{ -1030, -1030, -1250, -1030, -1230}
-    ,{ -1750, -1770, -1750, -1770, -1970}
-    ,{ -1030, -1030, -1250, -1030, -1230}
-    }
-   ,{{  -940,  -940, -1160,  -940, -1150}
-    ,{  -940,  -940, -1160,  -940, -1150}
-    ,{ -1250, -1250, -1470, -1250, -1450}
-    ,{  -940,  -940, -1160,  -940, -1150}
-    ,{ -1250, -1250, -1470, -1250, -1450}
-    }
-   ,{{  -400,  -400,  -620,  -400, -1230}
-    ,{ -1270, -1290, -1270, -1290, -1500}
-    ,{ -1030, -1030, -1250, -1030, -1230}
-    ,{  -400,  -400,  -620,  -400, -1860}
-    ,{ -1030, -1030, -1250, -1030, -1230}
-    }
-   ,{{  -940,  -940, -1160,  -940, -1150}
-    ,{  -940,  -940, -1160,  -940, -1150}
-    ,{ -1560, -1560, -1780, -1560, -1760}
-    ,{  -940,  -940, -1160,  -940, -1150}
-    ,{ -1230, -1230, -1450, -1230, -1440}
-    }
-   }
-  }
- ,{{{{   210,   210,  -160,  -240,  -160}
-    ,{  -870,  -870, -1230,  -870, -1230}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    ,{   210,   210,  -160,  -240,  -160}
-    ,{  -800,  -800, -1410,  -870, -1410}
-    }
-   ,{{  -870, -1040, -1410,  -870, -1410}
-    ,{ -1050, -1220, -1590, -1050, -1590}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    ,{ -1060, -1060, -1420, -1510, -1420}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    }
-   ,{{  -870, -1040, -1410,  -870, -1410}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    }
-   ,{{   210,   210,  -160,  -240,  -160}
-    ,{  -870,  -870, -1230, -1320, -1230}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    ,{   210,   210,  -160,  -240,  -160}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    }
-   ,{{  -800,  -800, -1410,  -870, -1410}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    ,{  -870, -1040, -1410,  -870, -1410}
-    ,{  -800,  -800, -1410, -1490, -1410}
-    }
-   }
-  ,{{{   210,   210,  -160, -1520,  -160}
-    ,{  -870,  -870, -1230, -1580, -1230}
-    ,{ -1040, -1040, -1410, -1520, -1410}
-    ,{   210,   210,  -160, -1760,  -160}
-    ,{  -800,  -800, -1410, -1520, -1410}
-    }
-   ,{{ -1040, -1040, -1410, -1760, -1410}
-    ,{ -1220, -1220, -1590, -1940, -1590}
-    ,{ -1040, -1040, -1410, -1760, -1410}
-    ,{ -1060, -1060, -1420, -1770, -1420}
-    ,{ -1040, -1040, -1410, -1760, -1410}
-    }
-   ,{{ -1040, -1040, -1410, -1520, -1410}
-    ,{ -1040, -1040, -1410, -1760, -1410}
-    ,{ -1040, -1040, -1410, -1520, -1410}
-    ,{ -1040, -1040, -1410, -1760, -1410}
-    ,{ -1040, -1040, -1410, -1520, -1410}
-    }
-   ,{{   210,   210,  -160, -1580,  -160}
-    ,{  -870,  -870, -1230, -1580, -1230}
-    ,{ -1040, -1040, -1410, -1760, -1410}
-    ,{   210,   210,  -160, -1760,  -160}
-    ,{ -1040, -1040, -1410, -1760, -1410}
-    }
-   ,{{  -800,  -800, -1410, -1520, -1410}
-    ,{ -1040, -1040, -1410, -1760, -1410}
-    ,{ -1040, -1040, -1410, -1520, -1410}
-    ,{ -1040, -1040, -1410, -1760, -1410}
-    ,{  -800,  -800, -1410, -1760, -1410}
-    }
-   }
-  ,{{{  -240,  -240,  -460,  -240,  -770}
-    ,{ -1300, -1320, -1300, -1320, -1610}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    ,{  -240,  -240,  -460,  -240,  -770}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    }
-   ,{{ -1490, -1490, -1490, -1490, -1800}
-    ,{ -1670, -1670, -1890, -1670, -2200}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    ,{ -1490, -1510, -1490, -1510, -1800}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    }
-   ,{{ -1490, -1490, -1710, -1490, -2020}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    }
-   ,{{  -240,  -240,  -460,  -240,  -770}
-    ,{ -1300, -1320, -1300, -1320, -1610}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    ,{  -240,  -240,  -460,  -240,  -770}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    }
-   ,{{ -1490, -1490, -1710, -1490, -2020}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    ,{ -1490, -1490, -1710, -1490, -2020}
-    }
-   }
-  ,{{{  -160, -1990,  -160,  -870,  -160}
-    ,{  -870, -2060, -1230,  -870, -1230}
-    ,{  -870, -1990, -1410,  -870, -1410}
-    ,{  -160, -2230,  -160,  -870,  -160}
-    ,{  -870, -1990, -1410,  -870, -1410}
-    }
-   ,{{  -870, -2230, -1410,  -870, -1410}
-    ,{ -1050, -2410, -1590, -1050, -1590}
-    ,{  -870, -2230, -1410,  -870, -1410}
-    ,{ -1420, -2250, -1420, -2130, -1420}
-    ,{  -870, -2230, -1410,  -870, -1410}
-    }
-   ,{{  -870, -1990, -1410,  -870, -1410}
-    ,{  -870, -2230, -1410,  -870, -1410}
-    ,{  -870, -1990, -1410,  -870, -1410}
-    ,{  -870, -2230, -1410,  -870, -1410}
-    ,{  -870, -1990, -1410,  -870, -1410}
-    }
-   ,{{  -160, -2060,  -160,  -870,  -160}
-    ,{ -1230, -2060, -1230, -1940, -1230}
-    ,{  -870, -2230, -1410,  -870, -1410}
-    ,{  -160, -2230,  -160, -2120,  -160}
-    ,{  -870, -2230, -1410,  -870, -1410}
-    }
-   ,{{  -870, -1990, -1410,  -870, -1410}
-    ,{  -870, -2230, -1410,  -870, -1410}
-    ,{  -870, -1990, -1410,  -870, -1410}
-    ,{  -870, -2230, -1410,  -870, -1410}
-    ,{ -1410, -2230, -1410, -2120, -1410}
-    }
-   }
-  ,{{{  -240,  -240,  -460,  -240, -1520}
-    ,{ -1300, -1320, -1300, -1320, -1520}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    ,{  -240,  -240,  -460,  -240, -1700}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    }
-   ,{{ -1490, -1490, -1490, -1490, -1640}
-    ,{ -1640, -1670, -1890, -1670, -1640}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    ,{ -1490, -1510, -1490, -1510, -1710}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    }
-   ,{{ -1490, -1490, -1710, -1490, -1700}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    }
-   ,{{  -240,  -240,  -460,  -240, -1520}
-    ,{ -1300, -1320, -1300, -1320, -1520}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    ,{  -240,  -240,  -460,  -240, -1700}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    }
-   ,{{ -1490, -1490, -1710, -1490, -1700}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    ,{ -1490, -1490, -1710, -1490, -1700}
-    }
-   }
-  }
- ,{{{{   760,   760,   400,   310,   400}
-    ,{   200,  -430,  -340,   200,  -340}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    ,{   760,   760,   400,   310,   400}
-    ,{  -250,  -250,  -850,  -310,  -850}
-    }
-   ,{{   200,  -430,  -340,   200,  -340}
-    ,{   200,  -430,  -340,   200,  -340}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    ,{  -830,  -830, -1190, -1280, -1190}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    }
-   ,{{  -310,  -490,  -850,  -310,  -850}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    }
-   ,{{   760,   760,   400,   310,   400}
-    ,{ -1000, -1000, -1360, -1450, -1360}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    ,{   760,   760,   400,   310,   400}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    }
-   ,{{  -250,  -250,  -850,  -310,  -850}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    ,{  -310,  -490,  -850,  -310,  -850}
-    ,{  -250,  -250,  -850,  -940,  -850}
-    }
-   }
-  ,{{{   760,   760,   400,  -690,   400}
-    ,{  -340,  -490,  -340,  -690,  -340}
-    ,{  -490,  -490,  -850,  -960,  -850}
-    ,{   760,   760,   400, -1200,   400}
-    ,{  -250,  -250,  -850,  -960,  -850}
-    }
-   ,{{  -340,  -490,  -340,  -690,  -340}
-    ,{  -340, -2040,  -340,  -690,  -340}
-    ,{  -490,  -490,  -850, -1200,  -850}
-    ,{  -830,  -830, -1190, -1540, -1190}
-    ,{  -490,  -490,  -850, -1200,  -850}
-    }
-   ,{{  -490,  -490,  -850,  -960,  -850}
-    ,{  -490,  -490,  -850, -1200,  -850}
-    ,{  -490,  -490,  -850,  -960,  -850}
-    ,{  -490,  -490,  -850, -1200,  -850}
-    ,{  -490,  -490,  -850,  -960,  -850}
-    }
-   ,{{   760,   760,   400, -1200,   400}
-    ,{ -1000, -1000, -1360, -1710, -1360}
-    ,{  -490,  -490,  -850, -1200,  -850}
-    ,{   760,   760,   400, -1200,   400}
-    ,{  -490,  -490,  -850, -1200,  -850}
-    }
-   ,{{  -250,  -250,  -850,  -960,  -850}
-    ,{  -490,  -490,  -850, -1200,  -850}
-    ,{  -490,  -490,  -850,  -960,  -850}
-    ,{  -490,  -490,  -850, -1200,  -850}
-    ,{  -250,  -250,  -850, -1200,  -850}
-    }
-   }
-  ,{{{   310,   310,    90,   310,  -220}
-    ,{  -430,  -430,  -650,  -430,  -960}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{   310,   310,    90,   310,  -220}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    }
-   ,{{  -430,  -430,  -650,  -430,  -960}
-    ,{  -430,  -430,  -650,  -430,  -960}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{ -1260, -1280, -1260, -1280, -1570}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    }
-   ,{{  -940,  -940, -1160,  -940, -1470}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    }
-   ,{{   310,   310,    90,   310,  -220}
-    ,{ -1430, -1450, -1430, -1450, -1740}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{   310,   310,    90,   310,  -220}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    }
-   ,{{  -940,  -940, -1160,  -940, -1470}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    ,{  -940,  -940, -1160,  -940, -1470}
-    }
-   }
-  ,{{{   400, -1170,   400,   200,   400}
-    ,{   200, -1170,  -340,   200,  -340}
-    ,{  -310, -1440,  -850,  -310,  -850}
-    ,{   400, -1680,   400,  -310,   400}
-    ,{  -310, -1440,  -850,  -310,  -850}
-    }
-   ,{{   200, -1170,  -340,   200,  -340}
-    ,{   200, -1170,  -340,   200,  -340}
-    ,{  -310, -1680,  -850,  -310,  -850}
-    ,{ -1190, -2020, -1190, -1900, -1190}
-    ,{  -310, -1680,  -850,  -310,  -850}
-    }
-   ,{{  -310, -1440,  -850,  -310,  -850}
-    ,{  -310, -1680,  -850,  -310,  -850}
-    ,{  -310, -1440,  -850,  -310,  -850}
-    ,{  -310, -1680,  -850,  -310,  -850}
-    ,{  -310, -1440,  -850,  -310,  -850}
-    }
-   ,{{   400, -1680,   400,  -310,   400}
-    ,{ -1360, -2190, -1360, -2070, -1360}
-    ,{  -310, -1680,  -850,  -310,  -850}
-    ,{   400, -1680,   400, -1560,   400}
-    ,{  -310, -1680,  -850,  -310,  -850}
-    }
-   ,{{  -310, -1440,  -850,  -310,  -850}
-    ,{  -310, -1680,  -850,  -310,  -850}
-    ,{  -310, -1440,  -850,  -310,  -850}
-    ,{  -310, -1680,  -850,  -310,  -850}
-    ,{  -850, -1680,  -850, -1560,  -850}
-    }
-   }
-  ,{{{   310,   310,    90,   310,  -390}
-    ,{  -390,  -430,  -650,  -430,  -390}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    ,{   310,   310,    90,   310, -1140}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    }
-   ,{{  -390,  -430,  -650,  -430,  -390}
-    ,{  -390,  -430,  -650,  -430,  -390}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    ,{ -1260, -1280, -1260, -1280, -1480}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    }
-   ,{{  -940,  -940, -1160,  -940, -1140}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    }
-   ,{{   310,   310,    90,   310, -1140}
-    ,{ -1430, -1450, -1430, -1450, -1650}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    ,{   310,   310,    90,   310, -1140}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    }
-   ,{{  -940,  -940, -1160,  -940, -1140}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    ,{  -940,  -940, -1160,  -940, -1140}
-    }
-   }
-  }
- ,{{{{  1140,  1140,   770,   780,   770}
-    ,{   780,   600,   240,   780,   240}
-    ,{   480,   300,   -60,   480,   -60}
-    ,{  1140,  1140,   770,   690,   770}
-    ,{   480,   300,   -60,   480,   -60}
-    }
-   ,{{   780,   600,   240,   780,   240}
-    ,{   780,   600,   240,   780,   240}
-    ,{   470,   290,   -70,   470,   -70}
-    ,{  -780,  -780, -1150, -1230, -1150}
-    ,{   470,   290,   -70,   470,   -70}
-    }
-   ,{{   490,   310,   -50,   490,   -50}
-    ,{   490,   310,   -50,   490,   -50}
-    ,{   480,   300,   -60,   480,   -60}
-    ,{   490,   310,   -50,   490,   -50}
-    ,{   480,   300,   -60,   480,   -60}
-    }
-   ,{{  1140,  1140,   770,   690,   770}
-    ,{  -600,  -600,  -970, -1050,  -970}
-    ,{   470,   290,   -70,   470,   -70}
-    ,{  1140,  1140,   770,   690,   770}
-    ,{   470,   290,   -70,   470,   -70}
-    }
-   ,{{   490,   310,   -50,   490,   -50}
-    ,{   490,   310,   -50,   490,   -50}
-    ,{   480,   300,   -60,   480,   -60}
-    ,{   490,   310,   -50,   490,   -50}
-    ,{  -430,  -430, -1040, -1120, -1040}
-    }
-   }
-  ,{{{  1140,  1140,   770,  -110,   770}
-    ,{   600,   600,   240,  -110,   240}
-    ,{   300,   300,   -60,  -170,   -60}
-    ,{  1140,  1140,   770,  -400,   770}
-    ,{   300,   300,   -60,  -170,   -60}
-    }
-   ,{{   600,   600,   240,  -110,   240}
-    ,{   600,   600,   240,  -110,   240}
-    ,{   290,   290,   -70,  -420,   -70}
-    ,{  -780,  -780, -1150, -1500, -1150}
-    ,{   290,   290,   -70,  -420,   -70}
-    }
-   ,{{   310,   310,   -50,  -170,   -50}
-    ,{   310,   310,   -50,  -400,   -50}
-    ,{   300,   300,   -60,  -170,   -60}
-    ,{   310,   310,   -50,  -400,   -50}
-    ,{   300,   300,   -60,  -170,   -60}
-    }
-   ,{{  1140,  1140,   770,  -420,   770}
-    ,{  -600,  -600,  -970, -1320,  -970}
-    ,{   290,   290,   -70,  -420,   -70}
-    ,{  1140,  1140,   770,  -830,   770}
-    ,{   290,   290,   -70,  -420,   -70}
-    }
-   ,{{   310,   310,   -50,  -170,   -50}
-    ,{   310,   310,   -50,  -400,   -50}
-    ,{   300,   300,   -60,  -170,   -60}
-    ,{   310,   310,   -50,  -400,   -50}
-    ,{  -430,  -430, -1040, -1390, -1040}
-    }
-   }
-  ,{{{   690,   690,   470,   690,   160}
-    ,{   150,   150,   -60,   150,  -370}
-    ,{  -140,  -140,  -360,  -140,  -670}
-    ,{   690,   690,   470,   690,   160}
-    ,{  -140,  -140,  -360,  -140,  -670}
-    }
-   ,{{   150,   150,   -60,   150,  -370}
-    ,{   150,   150,   -60,   150,  -370}
-    ,{  -150,  -150,  -370,  -150,  -680}
-    ,{ -1210, -1230, -1210, -1230, -1520}
-    ,{  -150,  -150,  -370,  -150,  -680}
-    }
-   ,{{  -140,  -140,  -360,  -140,  -670}
-    ,{  -140,  -140,  -360,  -140,  -670}
-    ,{  -140,  -140,  -360,  -140,  -670}
-    ,{  -140,  -140,  -360,  -140,  -670}
-    ,{  -140,  -140,  -360,  -140,  -670}
-    }
-   ,{{   690,   690,   470,   690,   160}
-    ,{ -1030, -1050, -1030, -1050, -1340}
-    ,{  -150,  -150,  -370,  -150,  -680}
-    ,{   690,   690,   470,   690,   160}
-    ,{  -150,  -150,  -370,  -150,  -680}
-    }
-   ,{{  -140,  -140,  -360,  -140,  -670}
-    ,{  -140,  -140,  -360,  -140,  -670}
-    ,{  -140,  -140,  -360,  -140,  -670}
-    ,{  -140,  -140,  -360,  -140,  -670}
-    ,{ -1120, -1120, -1340, -1120, -1650}
-    }
-   }
-  ,{{{   780,  -580,   770,   780,   770}
-    ,{   780,  -580,   240,   780,   240}
-    ,{   480,  -640,   -60,   480,   -60}
-    ,{   770,  -880,   770,   490,   770}
-    ,{   480,  -640,   -60,   480,   -60}
-    }
-   ,{{   780,  -580,   240,   780,   240}
-    ,{   780,  -580,   240,   780,   240}
-    ,{   470,  -890,   -70,   470,   -70}
-    ,{ -1150, -1970, -1150, -1860, -1150}
-    ,{   470,  -890,   -70,   470,   -70}
-    }
-   ,{{   490,  -640,   -50,   490,   -50}
-    ,{   490,  -880,   -50,   490,   -50}
-    ,{   480,  -640,   -60,   480,   -60}
-    ,{   490,  -880,   -50,   490,   -50}
-    ,{   480,  -640,   -60,   480,   -60}
-    }
-   ,{{   770,  -890,   770,   470,   770}
-    ,{  -970, -1790,  -970, -1680,  -970}
-    ,{   470,  -890,   -70,   470,   -70}
-    ,{   770, -1300,   770, -1190,   770}
-    ,{   470,  -890,   -70,   470,   -70}
-    }
-   ,{{   490,  -640,   -50,   490,   -50}
-    ,{   490,  -880,   -50,   490,   -50}
-    ,{   480,  -640,   -60,   480,   -60}
-    ,{   490,  -880,   -50,   490,   -50}
-    ,{ -1040, -1860, -1040, -1750, -1040}
-    }
-   }
-  ,{{{   690,   690,   470,   690,   190}
-    ,{   190,   150,   -60,   150,   190}
-    ,{  -140,  -140,  -360,  -140,  -350}
-    ,{   690,   690,   470,   690,  -340}
-    ,{  -140,  -140,  -360,  -140,  -350}
-    }
-   ,{{   190,   150,   -60,   150,   190}
-    ,{   190,   150,   -60,   150,   190}
-    ,{  -150,  -150,  -370,  -150,  -360}
-    ,{ -1210, -1230, -1210, -1230, -1440}
-    ,{  -150,  -150,  -370,  -150,  -360}
-    }
-   ,{{  -140,  -140,  -360,  -140,  -340}
-    ,{  -140,  -140,  -360,  -140,  -340}
-    ,{  -140,  -140,  -360,  -140,  -350}
-    ,{  -140,  -140,  -360,  -140,  -340}
-    ,{  -140,  -140,  -360,  -140,  -350}
-    }
-   ,{{   690,   690,   470,   690,  -360}
-    ,{ -1030, -1050, -1030, -1050, -1260}
-    ,{  -150,  -150,  -370,  -150,  -360}
-    ,{   690,   690,   470,   690,  -770}
-    ,{  -150,  -150,  -370,  -150,  -360}
-    }
-   ,{{  -140,  -140,  -360,  -140,  -340}
-    ,{  -140,  -140,  -360,  -140,  -340}
-    ,{  -140,  -140,  -360,  -140,  -350}
-    ,{  -140,  -140,  -360,  -140,  -340}
-    ,{ -1120, -1120, -1340, -1120, -1330}
-    }
-   }
-  }
- ,{{{{  1320,  1320,   960,   870,   960}
-    ,{   850,   670,   300,   850,   300}
-    ,{   720,   540,   170,   720,   170}
-    ,{  1320,  1320,   960,   870,   960}
-    ,{   590,   410,    40,   590,    40}
-    }
-   ,{{   850,   670,   300,   850,   300}
-    ,{   850,   670,   300,   850,   300}
-    ,{   570,   390,    20,   570,    20}
-    ,{  -730,  -730, -1100, -1180, -1100}
-    ,{   570,   390,    20,   570,    20}
-    }
-   ,{{   720,   540,   170,   720,   170}
-    ,{   720,   540,   170,   720,   170}
-    ,{   720,   540,   170,   720,   170}
-    ,{   720,   540,   170,   720,   170}
-    ,{   590,   410,    40,   590,    40}
-    }
-   ,{{  1320,  1320,   960,   870,   960}
-    ,{ -1030, -1030, -1400, -1480, -1400}
-    ,{   570,   390,    20,   570,    20}
-    ,{  1320,  1320,   960,   870,   960}
-    ,{   570,   390,    20,   570,    20}
-    }
-   ,{{   720,   540,   170,   720,   170}
-    ,{   720,   540,   170,   720,   170}
-    ,{   280,   100,  -260,   280,  -260}
-    ,{   720,   540,   170,   720,   170}
-    ,{  -160,  -160,  -760,  -850,  -760}
-    }
-   }
-  ,{{{  1320,  1320,   960,    70,   960}
-    ,{   670,   670,   300,   -40,   300}
-    ,{   540,   540,   170,    70,   170}
-    ,{  1320,  1320,   960,  -170,   960}
-    ,{   410,   410,    40,   -60,    40}
-    }
-   ,{{   670,   670,   300,   -40,   300}
-    ,{   670,   670,   300,   -40,   300}
-    ,{   390,   390,    20,  -320,    20}
-    ,{  -730,  -730, -1100, -1450, -1100}
-    ,{   390,   390,    20,  -320,    20}
-    }
-   ,{{   540,   540,   170,    70,   170}
-    ,{   540,   540,   170,  -170,   170}
-    ,{   540,   540,   170,    70,   170}
-    ,{   540,   540,   170,  -170,   170}
-    ,{   410,   410,    40,   -60,    40}
-    }
-   ,{{  1320,  1320,   960,  -320,   960}
-    ,{ -1030, -1030, -1400, -1750, -1400}
-    ,{   390,   390,    20,  -320,    20}
-    ,{  1320,  1320,   960,  -640,   960}
-    ,{   390,   390,    20,  -320,    20}
-    }
-   ,{{   540,   540,   170,  -170,   170}
-    ,{   540,   540,   170,  -170,   170}
-    ,{   100,   100,  -260,  -370,  -260}
-    ,{   540,   540,   170,  -170,   170}
-    ,{  -160,  -160,  -760, -1110,  -760}
-    }
-   }
-  ,{{{   870,   870,   650,   870,   340}
-    ,{   220,   220,     0,   220,  -310}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{   870,   870,   650,   870,   340}
-    ,{   -40,   -40,  -260,   -40,  -570}
-    }
-   ,{{   220,   220,     0,   220,  -310}
-    ,{   220,   220,     0,   220,  -310}
-    ,{   -60,   -60,  -280,   -60,  -590}
-    ,{ -1160, -1180, -1160, -1180, -1470}
-    ,{   -60,   -60,  -280,   -60,  -590}
-    }
-   ,{{    90,    90,  -130,    90,  -440}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{   -40,   -40,  -260,   -40,  -570}
-    }
-   ,{{   870,   870,   650,   870,   340}
-    ,{ -1460, -1480, -1460, -1480, -1770}
-    ,{   -60,   -60,  -280,   -60,  -590}
-    ,{   870,   870,   650,   870,   340}
-    ,{   -60,   -60,  -280,   -60,  -590}
-    }
-   ,{{    90,    90,  -130,    90,  -440}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{  -350,  -350,  -570,  -350,  -880}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{  -850,  -850, -1070,  -850, -1380}
-    }
-   }
-  ,{{{   960,  -410,   960,   850,   960}
-    ,{   850,  -520,   300,   850,   300}
-    ,{   720,  -410,   170,   720,   170}
-    ,{   960,  -650,   960,   720,   960}
-    ,{   590,  -540,    40,   590,    40}
-    }
-   ,{{   850,  -520,   300,   850,   300}
-    ,{   850,  -520,   300,   850,   300}
-    ,{   570,  -800,    20,   570,    20}
-    ,{ -1100, -1920, -1100, -1810, -1100}
-    ,{   570,  -800,    20,   570,    20}
-    }
-   ,{{   720,  -410,   170,   720,   170}
-    ,{   720,  -650,   170,   720,   170}
-    ,{   720,  -410,   170,   720,   170}
-    ,{   720,  -650,   170,   720,   170}
-    ,{   590,  -540,    40,   590,    40}
-    }
-   ,{{   960,  -800,   960,   570,   960}
-    ,{ -1400, -2220, -1400, -2110, -1400}
-    ,{   570,  -800,    20,   570,    20}
-    ,{   960, -1120,   960, -1000,   960}
-    ,{   570,  -800,    20,   570,    20}
-    }
-   ,{{   720,  -650,   170,   720,   170}
-    ,{   720,  -650,   170,   720,   170}
-    ,{   280,  -850,  -260,   280,  -260}
-    ,{   720,  -650,   170,   720,   170}
-    ,{  -760, -1590,  -760, -1470,  -760}
-    }
-   }
-  ,{{{   870,   870,   650,   870,   250}
-    ,{   250,   220,     0,   220,   250}
-    ,{    90,    90,  -130,    90,  -110}
-    ,{   870,   870,   650,   870,  -110}
-    ,{   -40,   -40,  -260,   -40,  -240}
-    }
-   ,{{   250,   220,     0,   220,   250}
-    ,{   250,   220,     0,   220,   250}
-    ,{   -60,   -60,  -280,   -60,  -260}
-    ,{ -1160, -1180, -1160, -1180, -1390}
-    ,{   -60,   -60,  -280,   -60,  -260}
-    }
-   ,{{    90,    90,  -130,    90,  -110}
-    ,{    90,    90,  -130,    90,  -110}
-    ,{    90,    90,  -130,    90,  -110}
-    ,{    90,    90,  -130,    90,  -110}
-    ,{   -40,   -40,  -260,   -40,  -240}
-    }
-   ,{{   870,   870,   650,   870,  -260}
-    ,{ -1460, -1480, -1460, -1480, -1690}
-    ,{   -60,   -60,  -280,   -60,  -260}
-    ,{   870,   870,   650,   870,  -580}
-    ,{   -60,   -60,  -280,   -60,  -260}
-    }
-   ,{{    90,    90,  -130,    90,  -110}
-    ,{    90,    90,  -130,    90,  -110}
-    ,{  -350,  -350,  -570,  -350,  -550}
-    ,{    90,    90,  -130,    90,  -110}
-    ,{  -850,  -850, -1070,  -850, -1050}
-    }
-   }
-  }
- ,{{{{  1320,  1320,   960,   870,   960}
-    ,{   850,   670,   540,   850,   300}
-    ,{   720,   540,   170,   720,   170}
-    ,{  1320,  1320,   960,   870,   960}
-    ,{   590,   410,    40,   590,    40}
-    }
-   ,{{   850,   670,   300,   850,   300}
-    ,{   850,   670,   300,   850,   300}
-    ,{   570,   390,    20,   570,    20}
-    ,{  -350,  -350,  -870,  -960,  -870}
-    ,{   570,   390,    20,   570,    20}
-    }
-   ,{{   720,   540,   170,   720,   170}
-    ,{   720,   540,   170,   720,   170}
-    ,{   720,   540,   170,   720,   170}
-    ,{   720,   540,   170,   720,   170}
-    ,{   590,   410,    40,   590,    40}
-    }
-   ,{{  1320,  1320,   960,   870,   960}
-    ,{   540,  -100,   540, -1050,  -810}
-    ,{   570,   390,    20,   570,    20}
-    ,{  1320,  1320,   960,   870,   960}
-    ,{   570,   390,    20,   570,    20}
-    }
-   ,{{   720,   540,   170,   720,   170}
-    ,{   720,   540,   170,   720,   170}
-    ,{   480,   300,   -60,   480,   -60}
-    ,{   720,   540,   170,   720,   170}
-    ,{  -160,  -160,  -400,  -230,  -760}
-    }
-   }
-  ,{{{  1320,  1320,   960,    70,   960}
-    ,{   670,   670,   300,   -40,   300}
-    ,{   540,   540,   170,    70,   170}
-    ,{  1320,  1320,   960,  -170,   960}
-    ,{   410,   410,    40,   -60,    40}
-    }
-   ,{{   670,   670,   300,   -40,   300}
-    ,{   670,   670,   300,   -40,   300}
-    ,{   390,   390,    20,  -320,    20}
-    ,{  -730,  -730, -1100, -1450,  -870}
-    ,{   390,   390,    20,  -320,    20}
-    }
-   ,{{   540,   540,   170,    70,   170}
-    ,{   540,   540,   170,  -170,   170}
-    ,{   540,   540,   170,    70,   170}
-    ,{   540,   540,   170,  -170,   170}
-    ,{   410,   410,    40,   -60,    40}
-    }
-   ,{{  1320,  1320,   960,  -320,   960}
-    ,{    10,  -600,    10, -1320,  -970}
-    ,{   390,   390,    20,  -320,    20}
-    ,{  1320,  1320,   960,  -640,   960}
-    ,{   390,   390,    20,  -320,    20}
-    }
-   ,{{   540,   540,   170,  -170,   170}
-    ,{   540,   540,   170,  -170,   170}
-    ,{   300,   300,   -60,  -170,   -60}
-    ,{   540,   540,   170,  -170,   170}
-    ,{  -160,  -160,  -400, -1110,  -760}
-    }
-   }
-  ,{{{   870,   870,   650,   870,   340}
-    ,{   540,   220,   540,   220,  -310}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{   870,   870,   650,   870,   340}
-    ,{   -40,   -40,  -260,   -40,  -570}
-    }
-   ,{{   220,   220,     0,   220,  -310}
-    ,{   220,   220,     0,   220,  -310}
-    ,{   -60,   -60,  -280,   -60,  -590}
-    ,{  -350,  -350,  -940,  -960, -1250}
-    ,{   -60,   -60,  -280,   -60,  -590}
-    }
-   ,{{    90,    90,  -130,    90,  -440}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{   -40,   -40,  -260,   -40,  -570}
-    }
-   ,{{   870,   870,   650,   870,   340}
-    ,{   540,  -100,   540, -1050, -1340}
-    ,{   -60,   -60,  -280,   -60,  -590}
-    ,{   870,   870,   650,   870,   340}
-    ,{   -60,   -60,  -280,   -60,  -590}
-    }
-   ,{{    90,    90,  -130,    90,  -440}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{  -140,  -140,  -360,  -140,  -670}
-    ,{    90,    90,  -130,    90,  -440}
-    ,{  -850,  -850, -1070,  -850, -1380}
-    }
-   }
-  ,{{{   960,  -410,   960,   850,   960}
-    ,{   850,  -520,   300,   850,   300}
-    ,{   720,  -410,   170,   720,   170}
-    ,{   960,  -650,   960,   720,   960}
-    ,{   590,  -540,    40,   590,    40}
-    }
-   ,{{   850,  -520,   300,   850,   300}
-    ,{   850,  -520,   300,   850,   300}
-    ,{   570,  -800,    20,   570,    20}
-    ,{  -870, -1920,  -870, -1370,  -870}
-    ,{   570,  -800,    20,   570,    20}
-    }
-   ,{{   720,  -410,   170,   720,   170}
-    ,{   720,  -650,   170,   720,   170}
-    ,{   720,  -410,   170,   720,   170}
-    ,{   720,  -650,   170,   720,   170}
-    ,{   590,  -540,    40,   590,    40}
-    }
-   ,{{   960,  -800,   960,   570,   960}
-    ,{  -970, -1790,  -970, -1680,  -970}
-    ,{   570,  -800,    20,   570,    20}
-    ,{   960, -1120,   960, -1000,   960}
-    ,{   570,  -800,    20,   570,    20}
-    }
-   ,{{   720,  -640,   170,   720,   170}
-    ,{   720,  -650,   170,   720,   170}
-    ,{   480,  -640,   -60,   480,   -60}
-    ,{   720,  -650,   170,   720,   170}
-    ,{  -230, -1520,  -760,  -230,  -760}
-    }
-   }
-  ,{{{   870,   870,   650,   870,   250}
-    ,{   250,   220,     0,   220,   250}
-    ,{    90,    90,  -130,    90,  -110}
-    ,{   870,   870,   650,   870,  -110}
-    ,{   -40,   -40,  -260,   -40,  -240}
-    }
-   ,{{   250,   220,     0,   220,   250}
-    ,{   250,   220,     0,   220,   250}
-    ,{   -60,   -60,  -280,   -60,  -260}
-    ,{  -940,  -960,  -940,  -960, -1360}
-    ,{   -60,   -60,  -280,   -60,  -260}
-    }
-   ,{{    90,    90,  -130,    90,   -90}
-    ,{    90,    90,  -130,    90,   -90}
-    ,{    90,    90,  -130,    90,  -110}
-    ,{    90,    90,  -130,    90,  -110}
-    ,{   -40,   -40,  -260,   -40,  -240}
-    }
-   ,{{   870,   870,   650,   870,  -260}
-    ,{  -810, -1050, -1030, -1050,  -810}
-    ,{   -60,   -60,  -280,   -60,  -260}
-    ,{   870,   870,   650,   870,  -580}
-    ,{   -60,   -60,  -280,   -60,  -260}
-    }
-   ,{{    90,    90,  -130,    90,  -110}
-    ,{    90,    90,  -130,    90,  -110}
-    ,{  -140,  -140,  -360,  -140,  -350}
-    ,{    90,    90,  -130,    90,  -110}
-    ,{  -850,  -850, -1070,  -850, -1050}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   240,  -780,  -870,   240,  -870}
-    ,{   190, -1060, -1060,   190,  -970}
-    ,{   240,  -780, -1010,   240, -1010}
-    ,{   190,  -870,  -870,   190,  -870}
-    ,{   130,  -890, -1120,   130, -1120}
-    }
-   ,{{    40, -1210, -1180,    40,  -970}
-    ,{    40, -1210, -1210,    40,  -970}
-    ,{  -270, -1520, -1520,  -270, -1520}
-    ,{ -1180, -1420, -1180, -1250, -1180}
-    ,{  -270, -1520, -1520,  -270, -1520}
-    }
-   ,{{   190,  -840, -1060,   190, -1060}
-    ,{   190, -1060, -1060,   190, -1060}
-    ,{   180,  -840, -1070,   180, -1070}
-    ,{   190, -1060, -1060,   190, -1060}
-    ,{   130,  -890, -1120,   130, -1120}
-    }
-   ,{{  -270,  -870,  -870,  -270,  -870}
-    ,{ -1470, -1710, -1470, -1530, -1470}
-    ,{  -270, -1520, -1520,  -270, -1520}
-    ,{  -870,  -870,  -870,  -870,  -870}
-    ,{  -270, -1520, -1520,  -270, -1520}
-    }
-   ,{{   240,  -780, -1010,   240, -1010}
-    ,{   190, -1060, -1060,   190, -1060}
-    ,{   240,  -780, -1010,   240, -1010}
-    ,{   190, -1060, -1060,   190, -1060}
-    ,{ -1680, -1790, -1850, -1680, -1850}
-    }
-   }
-  ,{{{  -590, -1050,  -870,  -590,  -870}
-    ,{  -890, -1240, -1060,  -890, -1060}
-    ,{  -590, -1190, -1010,  -590, -1010}
-    ,{  -870, -1050,  -870,  -890,  -870}
-    ,{  -700, -1300, -1120,  -700, -1120}
-    }
-   ,{{ -1030, -1370, -1210, -1030, -1210}
-    ,{ -1030, -1370, -1210, -1030, -1210}
-    ,{ -1340, -1700, -1520, -1340, -1520}
-    ,{ -1250, -1600, -1420, -1250, -1420}
-    ,{ -1340, -1700, -1520, -1340, -1520}
-    }
-   ,{{  -650, -1240, -1060,  -650, -1060}
-    ,{  -890, -1240, -1060,  -890, -1060}
-    ,{  -650, -1250, -1070,  -650, -1070}
-    ,{  -890, -1240, -1060,  -890, -1060}
-    ,{  -700, -1300, -1120,  -700, -1120}
-    }
-   ,{{  -870, -1050,  -870, -1340,  -870}
-    ,{ -1530, -1890, -1710, -1530, -1710}
-    ,{ -1340, -1700, -1520, -1340, -1520}
-    ,{  -870, -1050,  -870, -1940,  -870}
-    ,{ -1340, -1700, -1520, -1340, -1520}
-    }
-   ,{{  -590, -1190, -1010,  -590, -1010}
-    ,{  -890, -1240, -1060,  -890, -1060}
-    ,{  -590, -1190, -1010,  -590, -1010}
-    ,{  -890, -1240, -1060,  -890, -1060}
-    ,{ -1680, -1790, -1850, -1680, -1850}
-    }
-   }
-  ,{{{  -870,  -870,  -870,  -870,  -870}
-    ,{ -1060, -1060, -1060, -1060, -1060}
-    ,{ -1010, -1010, -1010, -1010, -1010}
-    ,{  -870,  -870,  -870,  -870,  -870}
-    ,{ -1120, -1120, -1120, -1120, -1120}
-    }
-   ,{{ -1180, -1210, -1180, -1210, -1180}
-    ,{ -1210, -1210, -1210, -1210, -1210}
-    ,{ -1520, -1520, -1520, -1520, -1520}
-    ,{ -1180, -1420, -1180, -1420, -1180}
-    ,{ -1520, -1520, -1520, -1520, -1520}
-    }
-   ,{{ -1060, -1060, -1060, -1060, -1060}
-    ,{ -1060, -1060, -1060, -1060, -1060}
-    ,{ -1070, -1070, -1070, -1070, -1070}
-    ,{ -1060, -1060, -1060, -1060, -1060}
-    ,{ -1120, -1120, -1120, -1120, -1120}
-    }
-   ,{{  -870,  -870,  -870,  -870,  -870}
-    ,{ -1470, -1710, -1470, -1710, -1470}
-    ,{ -1520, -1520, -1520, -1520, -1520}
-    ,{  -870,  -870,  -870,  -870,  -870}
-    ,{ -1520, -1520, -1520, -1520, -1520}
-    }
-   ,{{ -1010, -1010, -1010, -1010, -1010}
-    ,{ -1060, -1060, -1060, -1060, -1060}
-    ,{ -1010, -1010, -1010, -1010, -1010}
-    ,{ -1060, -1060, -1060, -1060, -1060}
-    ,{ -1850, -1850, -1850, -1850, -1850}
-    }
-   }
-  ,{{{   240,  -780,  -870,   240,  -870}
-    ,{   190, -1080, -1060,   190, -1060}
-    ,{   240,  -780, -1010,   240, -1010}
-    ,{   190, -1080,  -870,   190,  -870}
-    ,{   130,  -890, -1120,   130, -1120}
-    }
-   ,{{    40, -1220, -1210,    40, -1210}
-    ,{    40, -1220, -1210,    40, -1210}
-    ,{  -270, -1530, -1520,  -270, -1520}
-    ,{ -1420, -1440, -1420, -1420, -1420}
-    ,{  -270, -1530, -1520,  -270, -1520}
-    }
-   ,{{   190,  -840, -1060,   190, -1060}
-    ,{   190, -1080, -1060,   190, -1060}
-    ,{   180,  -840, -1070,   180, -1070}
-    ,{   190, -1080, -1060,   190, -1060}
-    ,{   130,  -890, -1120,   130, -1120}
-    }
-   ,{{  -270, -1530,  -870,  -270,  -870}
-    ,{ -1710, -1720, -1710, -1710, -1710}
-    ,{  -270, -1530, -1520,  -270, -1520}
-    ,{  -870, -2130,  -870, -2120,  -870}
-    ,{  -270, -1530, -1520,  -270, -1520}
-    }
-   ,{{   240,  -780, -1010,   240, -1010}
-    ,{   190, -1080, -1060,   190, -1060}
-    ,{   240,  -780, -1010,   240, -1010}
-    ,{   190, -1080, -1060,   190, -1060}
-    ,{ -1850, -1870, -1850, -1850, -1850}
-    }
-   }
-  ,{{{  -870,  -870,  -870,  -870,  -970}
-    ,{  -970, -1060, -1060, -1060,  -970}
-    ,{ -1010, -1010, -1010, -1010, -1010}
-    ,{  -870,  -870,  -870,  -870, -1060}
-    ,{ -1120, -1120, -1120, -1120, -1120}
-    }
-   ,{{  -970, -1210, -1180, -1210,  -970}
-    ,{  -970, -1210, -1210, -1210,  -970}
-    ,{ -1520, -1520, -1520, -1520, -1520}
-    ,{ -1180, -1420, -1180, -1420, -1420}
-    ,{ -1520, -1520, -1520, -1520, -1520}
-    }
-   ,{{ -1060, -1060, -1060, -1060, -1060}
-    ,{ -1060, -1060, -1060, -1060, -1060}
-    ,{ -1070, -1070, -1070, -1070, -1070}
-    ,{ -1060, -1060, -1060, -1060, -1060}
-    ,{ -1120, -1120, -1120, -1120, -1120}
-    }
-   ,{{  -870,  -870,  -870,  -870, -1520}
-    ,{ -1470, -1710, -1470, -1710, -1710}
-    ,{ -1520, -1520, -1520, -1520, -1520}
-    ,{  -870,  -870,  -870,  -870, -2120}
-    ,{ -1520, -1520, -1520, -1520, -1520}
-    }
-   ,{{ -1010, -1010, -1010, -1010, -1010}
-    ,{ -1060, -1060, -1060, -1060, -1060}
-    ,{ -1010, -1010, -1010, -1010, -1010}
-    ,{ -1060, -1060, -1060, -1060, -1060}
-    ,{ -1850, -1850, -1850, -1850, -1850}
-    }
-   }
-  }
- ,{{{{   210,  -870,  -870,   210,  -800}
-    ,{   210, -1040, -1040,   210,  -800}
-    ,{  -240, -1490, -1490,  -240, -1490}
-    ,{  -160,  -870,  -870,  -160,  -870}
-    ,{  -240, -1490, -1490,  -240, -1490}
-    }
-   ,{{   210, -1040, -1040,   210,  -800}
-    ,{   210, -1040, -1040,   210,  -800}
-    ,{  -240, -1490, -1490,  -240, -1490}
-    ,{ -1990, -2230, -1990, -2060, -1990}
-    ,{  -240, -1490, -1490,  -240, -1490}
-    }
-   ,{{  -160, -1410, -1410,  -160, -1410}
-    ,{  -160, -1410, -1410,  -160, -1410}
-    ,{  -460, -1490, -1710,  -460, -1710}
-    ,{  -160, -1410, -1410,  -160, -1410}
-    ,{  -460, -1490, -1710,  -460, -1710}
-    }
-   ,{{  -240,  -870,  -870,  -240,  -870}
-    ,{ -1520, -1760, -1520, -1580, -1520}
-    ,{  -240, -1490, -1490,  -240, -1490}
-    ,{  -870,  -870,  -870,  -870,  -870}
-    ,{  -240, -1490, -1490,  -240, -1490}
-    }
-   ,{{  -160, -1410, -1410,  -160, -1410}
-    ,{  -160, -1410, -1410,  -160, -1410}
-    ,{  -770, -1800, -2020,  -770, -2020}
-    ,{  -160, -1410, -1410,  -160, -1410}
-    ,{ -1520, -1640, -1700, -1520, -1700}
-    }
-   }
-  ,{{{  -870, -1050,  -870,  -870,  -870}
-    ,{  -870, -1220, -1040,  -870, -1040}
-    ,{ -1300, -1670, -1490, -1300, -1490}
-    ,{  -870, -1050,  -870, -1230,  -870}
-    ,{ -1300, -1640, -1490, -1300, -1490}
-    }
-   ,{{  -870, -1220, -1040,  -870, -1040}
-    ,{  -870, -1220, -1040,  -870, -1040}
-    ,{ -1320, -1670, -1490, -1320, -1490}
-    ,{ -2060, -2410, -2230, -2060, -2230}
-    ,{ -1320, -1670, -1490, -1320, -1490}
-    }
-   ,{{ -1230, -1590, -1410, -1230, -1410}
-    ,{ -1230, -1590, -1410, -1230, -1410}
-    ,{ -1300, -1890, -1710, -1300, -1710}
-    ,{ -1230, -1590, -1410, -1230, -1410}
-    ,{ -1300, -1890, -1710, -1300, -1710}
-    }
-   ,{{  -870, -1050,  -870, -1320,  -870}
-    ,{ -1580, -1940, -1760, -1580, -1760}
-    ,{ -1320, -1670, -1490, -1320, -1490}
-    ,{  -870, -1050,  -870, -1940,  -870}
-    ,{ -1320, -1670, -1490, -1320, -1490}
-    }
-   ,{{ -1230, -1590, -1410, -1230, -1410}
-    ,{ -1230, -1590, -1410, -1230, -1410}
-    ,{ -1610, -2200, -2020, -1610, -2020}
-    ,{ -1230, -1590, -1410, -1230, -1410}
-    ,{ -1520, -1640, -1700, -1520, -1700}
-    }
-   }
-  ,{{{  -870,  -870,  -870,  -870,  -870}
-    ,{ -1040, -1040, -1040, -1040, -1040}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    ,{  -870,  -870,  -870,  -870,  -870}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    }
-   ,{{ -1040, -1040, -1040, -1040, -1040}
-    ,{ -1040, -1040, -1040, -1040, -1040}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    ,{ -1990, -2230, -1990, -2230, -1990}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    }
-   ,{{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -1710, -1710, -1710, -1710, -1710}
-    ,{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -1710, -1710, -1710, -1710, -1710}
-    }
-   ,{{  -870,  -870,  -870,  -870,  -870}
-    ,{ -1520, -1760, -1520, -1760, -1520}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    ,{  -870,  -870,  -870,  -870,  -870}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    }
-   ,{{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -2020, -2020, -2020, -2020, -2020}
-    ,{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -1700, -1700, -1700, -1700, -1700}
-    }
-   }
-  ,{{{   210, -1060,  -870,   210,  -870}
-    ,{   210, -1060, -1040,   210, -1040}
-    ,{  -240, -1490, -1490,  -240, -1490}
-    ,{  -160, -1420,  -870,  -160,  -870}
-    ,{  -240, -1490, -1490,  -240, -1490}
-    }
-   ,{{   210, -1060, -1040,   210, -1040}
-    ,{   210, -1060, -1040,   210, -1040}
-    ,{  -240, -1510, -1490,  -240, -1490}
-    ,{ -2230, -2250, -2230, -2230, -2230}
-    ,{  -240, -1510, -1490,  -240, -1490}
-    }
-   ,{{  -160, -1420, -1410,  -160, -1410}
-    ,{  -160, -1420, -1410,  -160, -1410}
-    ,{  -460, -1490, -1710,  -460, -1710}
-    ,{  -160, -1420, -1410,  -160, -1410}
-    ,{  -460, -1490, -1710,  -460, -1710}
-    }
-   ,{{  -240, -1510,  -870,  -240,  -870}
-    ,{ -1760, -1770, -1760, -1760, -1760}
-    ,{  -240, -1510, -1490,  -240, -1490}
-    ,{  -870, -2130,  -870, -2120,  -870}
-    ,{  -240, -1510, -1490,  -240, -1490}
-    }
-   ,{{  -160, -1420, -1410,  -160, -1410}
-    ,{  -160, -1420, -1410,  -160, -1410}
-    ,{  -770, -1800, -2020,  -770, -2020}
-    ,{  -160, -1420, -1410,  -160, -1410}
-    ,{ -1700, -1710, -1700, -1700, -1700}
-    }
-   }
-  ,{{{  -800,  -870,  -870,  -870,  -800}
-    ,{  -800, -1040, -1040, -1040,  -800}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    ,{  -870,  -870,  -870,  -870, -1410}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    }
-   ,{{  -800, -1040, -1040, -1040,  -800}
-    ,{  -800, -1040, -1040, -1040,  -800}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    ,{ -1990, -2230, -1990, -2230, -2230}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    }
-   ,{{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -1710, -1710, -1710, -1710, -1710}
-    ,{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -1710, -1710, -1710, -1710, -1710}
-    }
-   ,{{  -870,  -870,  -870,  -870, -1490}
-    ,{ -1520, -1760, -1520, -1760, -1760}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    ,{  -870,  -870,  -870,  -870, -2120}
-    ,{ -1490, -1490, -1490, -1490, -1490}
-    }
-   ,{{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -2020, -2020, -2020, -2020, -2020}
-    ,{ -1410, -1410, -1410, -1410, -1410}
-    ,{ -1700, -1700, -1700, -1700, -1700}
-    }
-   }
-  }
- ,{{{{  -710,  -710,  -710,  -710,  -710}
-    ,{  -710, -1780, -1540,  -710, -1540}
-    ,{  -710, -1730, -1960,  -710, -1960}
-    ,{  -710,  -710,  -710,  -710,  -710}
-    ,{  -710, -1730, -1960,  -710, -1960}
-    }
-   ,{{  -710, -1960, -1730,  -710, -1730}
-    ,{  -890, -2140, -2140,  -890, -1900}
-    ,{  -710, -1960, -1960,  -710, -1960}
-    ,{ -1730, -1970, -1730, -1800, -1730}
-    ,{  -710, -1960, -1960,  -710, -1960}
-    }
-   ,{{  -710, -1730, -1960,  -710, -1960}
-    ,{  -710, -1960, -1960,  -710, -1960}
-    ,{  -710, -1730, -1960,  -710, -1960}
-    ,{  -710, -1960, -1960,  -710, -1960}
-    ,{  -710, -1730, -1960,  -710, -1960}
-    }
-   ,{{  -710,  -710,  -710,  -710,  -710}
-    ,{ -1540, -1780, -1540, -1610, -1540}
-    ,{  -710, -1960, -1960,  -710, -1960}
-    ,{  -710,  -710,  -710,  -710,  -710}
-    ,{  -710, -1960, -1960,  -710, -1960}
-    }
-   ,{{  -710, -1730, -1960,  -710, -1960}
-    ,{  -710, -1960, -1960,  -710, -1960}
-    ,{  -710, -1730, -1960,  -710, -1960}
-    ,{  -710, -1960, -1960,  -710, -1960}
-    ,{ -1780, -1900, -1960, -1780, -1960}
-    }
-   }
-  ,{{{  -710,  -890,  -710, -1540,  -710}
-    ,{ -1610, -1960, -1780, -1610, -1780}
-    ,{ -1540, -2140, -1960, -1540, -1960}
-    ,{  -710,  -890,  -710, -1780,  -710}
-    ,{ -1540, -1900, -1960, -1540, -1960}
-    }
-   ,{{ -1780, -2140, -1960, -1780, -1960}
-    ,{ -1960, -2320, -2140, -1960, -2140}
-    ,{ -1780, -2140, -1960, -1780, -1960}
-    ,{ -1800, -2150, -1970, -1800, -1970}
-    ,{ -1780, -2140, -1960, -1780, -1960}
-    }
-   ,{{ -1540, -2140, -1960, -1540, -1960}
-    ,{ -1780, -2140, -1960, -1780, -1960}
-    ,{ -1540, -2140, -1960, -1540, -1960}
-    ,{ -1780, -2140, -1960, -1780, -1960}
-    ,{ -1540, -2140, -1960, -1540, -1960}
-    }
-   ,{{  -710,  -890,  -710, -1610,  -710}
-    ,{ -1610, -1960, -1780, -1610, -1780}
-    ,{ -1780, -2140, -1960, -1780, -1960}
-    ,{  -710,  -890,  -710, -1780,  -710}
-    ,{ -1780, -2140, -1960, -1780, -1960}
-    }
-   ,{{ -1540, -1900, -1960, -1540, -1960}
-    ,{ -1780, -2140, -1960, -1780, -1960}
-    ,{ -1540, -2140, -1960, -1540, -1960}
-    ,{ -1780, -2140, -1960, -1780, -1960}
-    ,{ -1780, -1900, -1960, -1780, -1960}
-    }
-   }
-  ,{{{  -710,  -710,  -710,  -710,  -710}
-    ,{ -1540, -1780, -1540, -1780, -1540}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{  -710,  -710,  -710,  -710,  -710}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    }
-   ,{{ -1730, -1960, -1730, -1960, -1730}
-    ,{ -2140, -2140, -2140, -2140, -2140}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1730, -1970, -1730, -1970, -1730}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    }
-   ,{{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    }
-   ,{{  -710,  -710,  -710,  -710,  -710}
-    ,{ -1540, -1780, -1540, -1780, -1540}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{  -710,  -710,  -710,  -710,  -710}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    }
-   ,{{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    }
-   }
-  ,{{{  -710, -1730,  -710,  -710,  -710}
-    ,{  -710, -1800, -1780,  -710, -1780}
-    ,{  -710, -1730, -1960,  -710, -1960}
-    ,{  -710, -1970,  -710,  -710,  -710}
-    ,{  -710, -1730, -1960,  -710, -1960}
-    }
-   ,{{  -710, -1970, -1960,  -710, -1960}
-    ,{  -890, -2150, -2140,  -890, -2140}
-    ,{  -710, -1970, -1960,  -710, -1960}
-    ,{ -1970, -1990, -1970, -1970, -1970}
-    ,{  -710, -1970, -1960,  -710, -1960}
-    }
-   ,{{  -710, -1730, -1960,  -710, -1960}
-    ,{  -710, -1970, -1960,  -710, -1960}
-    ,{  -710, -1730, -1960,  -710, -1960}
-    ,{  -710, -1970, -1960,  -710, -1960}
-    ,{  -710, -1730, -1960,  -710, -1960}
-    }
-   ,{{  -710, -1800,  -710,  -710,  -710}
-    ,{ -1780, -1800, -1780, -1780, -1780}
-    ,{  -710, -1970, -1960,  -710, -1960}
-    ,{  -710, -1970,  -710, -1960,  -710}
-    ,{  -710, -1970, -1960,  -710, -1960}
-    }
-   ,{{  -710, -1730, -1960,  -710, -1960}
-    ,{  -710, -1970, -1960,  -710, -1960}
-    ,{  -710, -1730, -1960,  -710, -1960}
-    ,{  -710, -1970, -1960,  -710, -1960}
-    ,{ -1960, -1970, -1960, -1960, -1960}
-    }
-   }
-  ,{{{  -710,  -710,  -710,  -710, -1780}
-    ,{ -1540, -1780, -1540, -1780, -1780}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{  -710,  -710,  -710,  -710, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    }
-   ,{{ -1730, -1960, -1730, -1960, -1900}
-    ,{ -1900, -2140, -2140, -2140, -1900}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1730, -1970, -1730, -1970, -1970}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    }
-   ,{{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    }
-   ,{{  -710,  -710,  -710,  -710, -1780}
-    ,{ -1540, -1780, -1540, -1780, -1780}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{  -710,  -710,  -710,  -710, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    }
-   ,{{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    ,{ -1960, -1960, -1960, -1960, -1960}
-    }
-   }
-  }
- ,{{{{   360,   -70,  -150,   360,  -150}
-    ,{   360,   -70,  -890,   360,  -650}
-    ,{  -150, -1180, -1400,  -150, -1400}
-    ,{  -150,  -150,  -150,  -150,  -150}
-    ,{  -150, -1180, -1400,  -150, -1400}
-    }
-   ,{{   360,   -70,  -890,   360,  -650}
-    ,{   360,   -70,  -890,   360,  -650}
-    ,{  -150, -1400, -1400,  -150, -1400}
-    ,{ -1500, -1600, -1500, -1570, -1500}
-    ,{  -150, -1400, -1400,  -150, -1400}
-    }
-   ,{{  -150, -1180, -1400,  -150, -1400}
-    ,{  -150, -1400, -1400,  -150, -1400}
-    ,{  -150, -1180, -1400,  -150, -1400}
-    ,{  -150, -1400, -1400,  -150, -1400}
-    ,{  -150, -1180, -1400,  -150, -1400}
-    }
-   ,{{  -150,  -150,  -150,  -150,  -150}
-    ,{ -1670, -1910, -1670, -1740, -1670}
-    ,{  -150, -1400, -1400,  -150, -1400}
-    ,{  -150,  -150,  -150,  -150,  -150}
-    ,{  -150, -1400, -1400,  -150, -1400}
-    }
-   ,{{  -150, -1180, -1400,  -150, -1400}
-    ,{  -150, -1400, -1400,  -150, -1400}
-    ,{  -150, -1180, -1400,  -150, -1400}
-    ,{  -150, -1400, -1400,  -150, -1400}
-    ,{ -1230, -1340, -1400, -1230, -1400}
-    }
-   }
-  ,{{{   -30,   -70,  -150,   -30,  -150}
-    ,{   -30,   -70,  -890,   -30,  -890}
-    ,{  -990, -1580, -1400,  -990, -1400}
-    ,{  -150,  -330,  -150, -1230,  -150}
-    ,{  -990, -1340, -1400,  -990, -1400}
-    }
-   ,{{   -30,   -70,  -890,   -30,  -890}
-    ,{   -30,   -70,  -890,   -30,  -890}
-    ,{ -1230, -1580, -1400, -1230, -1400}
-    ,{ -1570, -1600, -1740, -1570, -1740}
-    ,{ -1230, -1580, -1400, -1230, -1400}
-    }
-   ,{{  -990, -1580, -1400,  -990, -1400}
-    ,{ -1230, -1580, -1400, -1230, -1400}
-    ,{  -990, -1580, -1400,  -990, -1400}
-    ,{ -1230, -1580, -1400, -1230, -1400}
-    ,{  -990, -1580, -1400,  -990, -1400}
-    }
-   ,{{  -150,  -330,  -150, -1230,  -150}
-    ,{ -1740, -2090, -1910, -1740, -1910}
-    ,{ -1230, -1580, -1400, -1230, -1400}
-    ,{  -150,  -330,  -150, -1230,  -150}
-    ,{ -1230, -1580, -1400, -1230, -1400}
-    }
-   ,{{  -990, -1340, -1400,  -990, -1400}
-    ,{ -1230, -1580, -1400, -1230, -1400}
-    ,{  -990, -1580, -1400,  -990, -1400}
-    ,{ -1230, -1580, -1400, -1230, -1400}
-    ,{ -1230, -1340, -1400, -1230, -1400}
-    }
-   }
-  ,{{{  -150,  -150,  -150,  -150,  -150}
-    ,{  -890,  -890,  -890,  -890,  -890}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{  -150,  -150,  -150,  -150,  -150}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{  -890,  -890,  -890,  -890,  -890}
-    ,{  -890,  -890,  -890,  -890,  -890}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1500, -1740, -1500, -1740, -1500}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{  -150,  -150,  -150,  -150,  -150}
-    ,{ -1670, -1910, -1670, -1910, -1670}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{  -150,  -150,  -150,  -150,  -150}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   }
-  ,{{{   360,  -910,  -150,   360,  -150}
-    ,{   360,  -910,  -890,   360,  -890}
-    ,{  -150, -1180, -1400,  -150, -1400}
-    ,{  -150, -1420,  -150,  -150,  -150}
-    ,{  -150, -1180, -1400,  -150, -1400}
-    }
-   ,{{   360,  -910,  -890,   360,  -890}
-    ,{   360,  -910,  -890,   360,  -890}
-    ,{  -150, -1420, -1400,  -150, -1400}
-    ,{ -1740, -3040, -1740, -1740, -1740}
-    ,{  -150, -1420, -1400,  -150, -1400}
-    }
-   ,{{  -150, -1180, -1400,  -150, -1400}
-    ,{  -150, -1420, -1400,  -150, -1400}
-    ,{  -150, -1180, -1400,  -150, -1400}
-    ,{  -150, -1420, -1400,  -150, -1400}
-    ,{  -150, -1180, -1400,  -150, -1400}
-    }
-   ,{{  -150, -1420,  -150,  -150,  -150}
-    ,{ -1910, -1930, -1910, -1910, -1910}
-    ,{  -150, -1420, -1400,  -150, -1400}
-    ,{  -150, -1420,  -150, -1400,  -150}
-    ,{  -150, -1420, -1400,  -150, -1400}
-    }
-   ,{{  -150, -1180, -1400,  -150, -1400}
-    ,{  -150, -1420, -1400,  -150, -1400}
-    ,{  -150, -1180, -1400,  -150, -1400}
-    ,{  -150, -1420, -1400,  -150, -1400}
-    ,{ -1400, -1420, -1400, -1400, -1400}
-    }
-   }
-  ,{{{  -150,  -150,  -150,  -150,  -650}
-    ,{  -650,  -890,  -890,  -890,  -650}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{  -150,  -150,  -150,  -150, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{  -650,  -890,  -890,  -890,  -650}
-    ,{  -650,  -890,  -890,  -890,  -650}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1500, -1740, -1500, -1740, -1740}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{  -150,  -150,  -150,  -150, -1400}
-    ,{ -1670, -1910, -1670, -1910, -1910}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{  -150,  -150,  -150,  -150, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   }
-  }
- ,{{{{   940,   220,   220,   940,   220}
-    ,{   940,  -310,  -310,   940,   -70}
-    ,{   640,  -380,  -610,   640,  -610}
-    ,{   650,   220,   220,   650,   220}
-    ,{   640,  -380,  -610,   640,  -610}
-    }
-   ,{{   940,  -310,  -310,   940,   -70}
-    ,{   940,  -310,  -310,   940,   -70}
-    ,{   630,  -620,  -620,   630,  -620}
-    ,{ -1460, -1700, -1460, -1520, -1460}
-    ,{   630,  -620,  -620,   630,  -620}
-    }
-   ,{{   650,  -380,  -600,   650,  -600}
-    ,{   650,  -600,  -600,   650,  -600}
-    ,{   640,  -380,  -610,   640,  -610}
-    ,{   650,  -600,  -600,   650,  -600}
-    ,{   640,  -380,  -610,   640,  -610}
-    }
-   ,{{   630,   220,   220,   630,   220}
-    ,{ -1280, -1520, -1280, -1340, -1280}
-    ,{   630,  -620,  -620,   630,  -620}
-    ,{   220,   220,   220,   220,   220}
-    ,{   630,  -620,  -620,   630,  -620}
-    }
-   ,{{   650,  -380,  -600,   650,  -600}
-    ,{   650,  -600,  -600,   650,  -600}
-    ,{   640,  -380,  -610,   640,  -610}
-    ,{   650,  -600,  -600,   650,  -600}
-    ,{ -1410, -1530, -1590, -1410, -1590}
-    }
-   }
-  ,{{{   220,    40,   220,  -130,   220}
-    ,{  -130,  -490,  -310,  -130,  -310}
-    ,{  -190,  -790,  -610,  -190,  -610}
-    ,{   220,    40,   220,  -430,   220}
-    ,{  -190,  -790,  -610,  -190,  -610}
-    }
-   ,{{  -130,  -490,  -310,  -130,  -310}
-    ,{  -130,  -490,  -310,  -130,  -310}
-    ,{  -440,  -800,  -620,  -440,  -620}
-    ,{ -1520, -1880, -1700, -1520, -1700}
-    ,{  -440,  -800,  -620,  -440,  -620}
-    }
-   ,{{  -190,  -780,  -600,  -190,  -600}
-    ,{  -430,  -780,  -600,  -430,  -600}
-    ,{  -190,  -790,  -610,  -190,  -610}
-    ,{  -430,  -780,  -600,  -430,  -600}
-    ,{  -190,  -790,  -610,  -190,  -610}
-    }
-   ,{{   220,    40,   220,  -440,   220}
-    ,{ -1340, -1700, -1520, -1340, -1520}
-    ,{  -440,  -800,  -620,  -440,  -620}
-    ,{   220,    40,   220,  -850,   220}
-    ,{  -440,  -800,  -620,  -440,  -620}
-    }
-   ,{{  -190,  -780,  -600,  -190,  -600}
-    ,{  -430,  -780,  -600,  -430,  -600}
-    ,{  -190,  -790,  -610,  -190,  -610}
-    ,{  -430,  -780,  -600,  -430,  -600}
-    ,{ -1410, -1530, -1590, -1410, -1590}
-    }
-   }
-  ,{{{   220,   220,   220,   220,   220}
-    ,{  -310,  -310,  -310,  -310,  -310}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    ,{   220,   220,   220,   220,   220}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    }
-   ,{{  -310,  -310,  -310,  -310,  -310}
-    ,{  -310,  -310,  -310,  -310,  -310}
-    ,{  -620,  -620,  -620,  -620,  -620}
-    ,{ -1460, -1700, -1460, -1700, -1460}
-    ,{  -620,  -620,  -620,  -620,  -620}
-    }
-   ,{{  -600,  -600,  -600,  -600,  -600}
-    ,{  -600,  -600,  -600,  -600,  -600}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    ,{  -600,  -600,  -600,  -600,  -600}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    }
-   ,{{   220,   220,   220,   220,   220}
-    ,{ -1280, -1520, -1280, -1520, -1280}
-    ,{  -620,  -620,  -620,  -620,  -620}
-    ,{   220,   220,   220,   220,   220}
-    ,{  -620,  -620,  -620,  -620,  -620}
-    }
-   ,{{  -600,  -600,  -600,  -600,  -600}
-    ,{  -600,  -600,  -600,  -600,  -600}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    ,{  -600,  -600,  -600,  -600,  -600}
-    ,{ -1590, -1590, -1590, -1590, -1590}
-    }
-   }
-  ,{{{   940,  -320,   220,   940,   220}
-    ,{   940,  -320,  -310,   940,  -310}
-    ,{   640,  -380,  -610,   640,  -610}
-    ,{   650,  -620,   220,   650,   220}
-    ,{   640,  -380,  -610,   640,  -610}
-    }
-   ,{{   940,  -320,  -310,   940,  -310}
-    ,{   940,  -320,  -310,   940,  -310}
-    ,{   630,  -630,  -620,   630,  -620}
-    ,{ -1700, -1710, -1700, -1700, -1700}
-    ,{   630,  -630,  -620,   630,  -620}
-    }
-   ,{{   650,  -380,  -600,   650,  -600}
-    ,{   650,  -620,  -600,   650,  -600}
-    ,{   640,  -380,  -610,   640,  -610}
-    ,{   650,  -620,  -600,   650,  -600}
-    ,{   640,  -380,  -610,   640,  -610}
-    }
-   ,{{   630,  -630,   220,   630,   220}
-    ,{ -1520, -1530, -1520, -1520, -1520}
-    ,{   630,  -630,  -620,   630,  -620}
-    ,{   220, -1040,   220, -1030,   220}
-    ,{   630,  -630,  -620,   630,  -620}
-    }
-   ,{{   650,  -380,  -600,   650,  -600}
-    ,{   650,  -620,  -600,   650,  -600}
-    ,{   640,  -380,  -610,   640,  -610}
-    ,{   650,  -620,  -600,   650,  -600}
-    ,{ -1590, -1600, -1590, -1590, -1590}
-    }
-   }
-  ,{{{   220,   220,   220,   220,   -70}
-    ,{   -70,  -310,  -310,  -310,   -70}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    ,{   220,   220,   220,   220,  -600}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    }
-   ,{{   -70,  -310,  -310,  -310,   -70}
-    ,{   -70,  -310,  -310,  -310,   -70}
-    ,{  -620,  -620,  -620,  -620,  -620}
-    ,{ -1460, -1700, -1460, -1700, -1700}
-    ,{  -620,  -620,  -620,  -620,  -620}
-    }
-   ,{{  -600,  -600,  -600,  -600,  -600}
-    ,{  -600,  -600,  -600,  -600,  -600}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    ,{  -600,  -600,  -600,  -600,  -600}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    }
-   ,{{   220,   220,   220,   220,  -620}
-    ,{ -1280, -1520, -1280, -1520, -1520}
-    ,{  -620,  -620,  -620,  -620,  -620}
-    ,{   220,   220,   220,   220, -1030}
-    ,{  -620,  -620,  -620,  -620,  -620}
-    }
-   ,{{  -600,  -600,  -600,  -600,  -600}
-    ,{  -600,  -600,  -600,  -600,  -600}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    ,{  -600,  -600,  -600,  -600,  -600}
-    ,{ -1590, -1590, -1590, -1590, -1590}
-    }
-   }
-  }
- ,{{{{  1010,   410,   410,  1010,   410}
-    ,{  1010,  -240,  -240,  1010,     0}
-    ,{   880,  -150,  -370,   880,  -370}
-    ,{   880,   410,   410,   880,   410}
-    ,{   750,  -280,  -500,   750,  -500}
-    }
-   ,{{  1010,  -240,  -240,  1010,     0}
-    ,{  1010,  -240,  -240,  1010,     0}
-    ,{   730,  -520,  -520,   730,  -520}
-    ,{ -1410, -1650, -1410, -1470, -1410}
-    ,{   730,  -520,  -520,   730,  -520}
-    }
-   ,{{   880,  -150,  -370,   880,  -370}
-    ,{   880,  -370,  -370,   880,  -370}
-    ,{   880,  -150,  -370,   880,  -370}
-    ,{   880,  -370,  -370,   880,  -370}
-    ,{   750,  -280,  -500,   750,  -500}
-    }
-   ,{{   730,   410,   410,   730,   410}
-    ,{ -1710, -1950, -1710, -1770, -1710}
-    ,{   730,  -520,  -520,   730,  -520}
-    ,{   410,   410,   410,   410,   410}
-    ,{   730,  -520,  -520,   730,  -520}
-    }
-   ,{{   880,  -370,  -370,   880,  -370}
-    ,{   880,  -370,  -370,   880,  -370}
-    ,{   440,  -590,  -810,   440,  -810}
-    ,{   880,  -370,  -370,   880,  -370}
-    ,{ -1140, -1250, -1310, -1140, -1310}
-    }
-   }
-  ,{{{   410,   230,   410,    40,   410}
-    ,{   -70,  -420,  -240,   -70,  -240}
-    ,{    40,  -550,  -370,    40,  -370}
-    ,{   410,   230,   410,  -200,   410}
-    ,{   -90,  -680,  -500,   -90,  -500}
-    }
-   ,{{   -70,  -420,  -240,   -70,  -240}
-    ,{   -70,  -420,  -240,   -70,  -240}
-    ,{  -350,  -700,  -520,  -350,  -520}
-    ,{ -1470, -1830, -1650, -1470, -1650}
-    ,{  -350,  -700,  -520,  -350,  -520}
-    }
-   ,{{    40,  -550,  -370,    40,  -370}
-    ,{  -200,  -550,  -370,  -200,  -370}
-    ,{    40,  -550,  -370,    40,  -370}
-    ,{  -200,  -550,  -370,  -200,  -370}
-    ,{   -90,  -680,  -500,   -90,  -500}
-    }
-   ,{{   410,   230,   410,  -350,   410}
-    ,{ -1770, -2130, -1950, -1770, -1950}
-    ,{  -350,  -700,  -520,  -350,  -520}
-    ,{   410,   230,   410,  -670,   410}
-    ,{  -350,  -700,  -520,  -350,  -520}
-    }
-   ,{{  -200,  -550,  -370,  -200,  -370}
-    ,{  -200,  -550,  -370,  -200,  -370}
-    ,{  -400,  -990,  -810,  -400,  -810}
-    ,{  -200,  -550,  -370,  -200,  -370}
-    ,{ -1140, -1250, -1310, -1140, -1310}
-    }
-   }
-  ,{{{   410,   410,   410,   410,   410}
-    ,{  -240,  -240,  -240,  -240,  -240}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{   410,   410,   410,   410,   410}
-    ,{  -500,  -500,  -500,  -500,  -500}
-    }
-   ,{{  -240,  -240,  -240,  -240,  -240}
-    ,{  -240,  -240,  -240,  -240,  -240}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    ,{ -1410, -1650, -1410, -1650, -1410}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    }
-   ,{{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -500,  -500,  -500,  -500,  -500}
-    }
-   ,{{   410,   410,   410,   410,   410}
-    ,{ -1710, -1950, -1710, -1950, -1710}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    ,{   410,   410,   410,   410,   410}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    }
-   ,{{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -810,  -810,  -810,  -810,  -810}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{ -1310, -1310, -1310, -1310, -1310}
-    }
-   }
-  ,{{{  1010,  -150,   410,  1010,   410}
-    ,{  1010,  -260,  -240,  1010,  -240}
-    ,{   880,  -150,  -370,   880,  -370}
-    ,{   880,  -390,   410,   880,   410}
-    ,{   750,  -280,  -500,   750,  -500}
-    }
-   ,{{  1010,  -260,  -240,  1010,  -240}
-    ,{  1010,  -260,  -240,  1010,  -240}
-    ,{   730,  -540,  -520,   730,  -520}
-    ,{ -1650, -1660, -1650, -1650, -1650}
-    ,{   730,  -540,  -520,   730,  -520}
-    }
-   ,{{   880,  -150,  -370,   880,  -370}
-    ,{   880,  -390,  -370,   880,  -370}
-    ,{   880,  -150,  -370,   880,  -370}
-    ,{   880,  -390,  -370,   880,  -370}
-    ,{   750,  -280,  -500,   750,  -500}
-    }
-   ,{{   730,  -540,   410,   730,   410}
-    ,{ -1950, -1960, -1950, -1950, -1950}
-    ,{   730,  -540,  -520,   730,  -520}
-    ,{   410,  -860,   410,  -840,   410}
-    ,{   730,  -540,  -520,   730,  -520}
-    }
-   ,{{   880,  -390,  -370,   880,  -370}
-    ,{   880,  -390,  -370,   880,  -370}
-    ,{   440,  -590,  -810,   440,  -810}
-    ,{   880,  -390,  -370,   880,  -370}
-    ,{ -1310, -1330, -1310, -1310, -1310}
-    }
-   }
-  ,{{{   410,   410,   410,   410,     0}
-    ,{     0,  -240,  -240,  -240,     0}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{   410,   410,   410,   410,  -370}
-    ,{  -500,  -500,  -500,  -500,  -500}
-    }
-   ,{{     0,  -240,  -240,  -240,     0}
-    ,{     0,  -240,  -240,  -240,     0}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    ,{ -1410, -1650, -1410, -1650, -1650}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    }
-   ,{{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -500,  -500,  -500,  -500,  -500}
-    }
-   ,{{   410,   410,   410,   410,  -520}
-    ,{ -1710, -1950, -1710, -1950, -1950}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    ,{   410,   410,   410,   410,  -840}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    }
-   ,{{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -810,  -810,  -810,  -810,  -810}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{ -1310, -1310, -1310, -1310, -1310}
-    }
-   }
-  }
- ,{{{{  1010,   410,   410,  1010,   410}
-    ,{  1010,   -70,  -240,  1010,     0}
-    ,{   880,  -150,  -370,   880,  -370}
-    ,{   880,   410,   410,   880,   410}
-    ,{   750,  -280,  -500,   750,  -500}
-    }
-   ,{{  1010,   -70,  -240,  1010,     0}
-    ,{  1010,   -70,  -240,  1010,     0}
-    ,{   730,  -520,  -520,   730,  -520}
-    ,{ -1180, -1420, -1180, -1250, -1180}
-    ,{   730,  -520,  -520,   730,  -520}
-    }
-   ,{{   880,  -150,  -370,   880,  -370}
-    ,{   880,  -370,  -370,   880,  -370}
-    ,{   880,  -150,  -370,   880,  -370}
-    ,{   880,  -370,  -370,   880,  -370}
-    ,{   750,  -280,  -500,   750,  -500}
-    }
-   ,{{   730,   410,   410,   730,   410}
-    ,{ -1280, -1520, -1280, -1340, -1280}
-    ,{   730,  -520,  -520,   730,  -520}
-    ,{   410,   410,   410,   410,   410}
-    ,{   730,  -520,  -520,   730,  -520}
-    }
-   ,{{   880,  -370,  -370,   880,  -370}
-    ,{   880,  -370,  -370,   880,  -370}
-    ,{   640,  -380,  -610,   640,  -610}
-    ,{   880,  -370,  -370,   880,  -370}
-    ,{ -1140, -1250, -1310, -1140, -1310}
-    }
-   }
-  ,{{{   410,   230,   410,    40,   410}
-    ,{   -30,   -70,  -240,   -30,  -240}
-    ,{    40,  -550,  -370,    40,  -370}
-    ,{   410,   230,   410,  -200,   410}
-    ,{   -90,  -680,  -500,   -90,  -500}
-    }
-   ,{{   -30,   -70,  -240,   -30,  -240}
-    ,{   -30,   -70,  -240,   -30,  -240}
-    ,{  -350,  -700,  -520,  -350,  -520}
-    ,{ -1250, -1600, -1420, -1250, -1420}
-    ,{  -350,  -700,  -520,  -350,  -520}
-    }
-   ,{{    40,  -550,  -370,    40,  -370}
-    ,{  -200,  -550,  -370,  -200,  -370}
-    ,{    40,  -550,  -370,    40,  -370}
-    ,{  -200,  -550,  -370,  -200,  -370}
-    ,{   -90,  -680,  -500,   -90,  -500}
-    }
-   ,{{   410,   230,   410,  -350,   410}
-    ,{ -1340, -1700, -1520, -1340, -1520}
-    ,{  -350,  -700,  -520,  -350,  -520}
-    ,{   410,   230,   410,  -670,   410}
-    ,{  -350,  -700,  -520,  -350,  -520}
-    }
-   ,{{  -190,  -550,  -370,  -190,  -370}
-    ,{  -200,  -550,  -370,  -200,  -370}
-    ,{  -190,  -790,  -610,  -190,  -610}
-    ,{  -200,  -550,  -370,  -200,  -370}
-    ,{ -1140, -1250, -1310, -1140, -1310}
-    }
-   }
-  ,{{{   410,   410,   410,   410,   410}
-    ,{  -240,  -240,  -240,  -240,  -240}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{   410,   410,   410,   410,   410}
-    ,{  -500,  -500,  -500,  -500,  -500}
-    }
-   ,{{  -240,  -240,  -240,  -240,  -240}
-    ,{  -240,  -240,  -240,  -240,  -240}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    ,{ -1180, -1420, -1180, -1420, -1180}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    }
-   ,{{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -500,  -500,  -500,  -500,  -500}
-    }
-   ,{{   410,   410,   410,   410,   410}
-    ,{ -1280, -1520, -1280, -1520, -1280}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    ,{   410,   410,   410,   410,   410}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    }
-   ,{{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{ -1310, -1310, -1310, -1310, -1310}
-    }
-   }
-  ,{{{  1010,  -150,   410,  1010,   410}
-    ,{  1010,  -260,  -240,  1010,  -240}
-    ,{   880,  -150,  -370,   880,  -370}
-    ,{   880,  -390,   410,   880,   410}
-    ,{   750,  -280,  -500,   750,  -500}
-    }
-   ,{{  1010,  -260,  -240,  1010,  -240}
-    ,{  1010,  -260,  -240,  1010,  -240}
-    ,{   730,  -540,  -520,   730,  -520}
-    ,{ -1420, -1440, -1420, -1420, -1420}
-    ,{   730,  -540,  -520,   730,  -520}
-    }
-   ,{{   880,  -150,  -370,   880,  -370}
-    ,{   880,  -390,  -370,   880,  -370}
-    ,{   880,  -150,  -370,   880,  -370}
-    ,{   880,  -390,  -370,   880,  -370}
-    ,{   750,  -280,  -500,   750,  -500}
-    }
-   ,{{   730,  -540,   410,   730,   410}
-    ,{ -1520, -1530, -1520, -1520, -1520}
-    ,{   730,  -540,  -520,   730,  -520}
-    ,{   410,  -860,   410,  -840,   410}
-    ,{   730,  -540,  -520,   730,  -520}
-    }
-   ,{{   880,  -380,  -370,   880,  -370}
-    ,{   880,  -390,  -370,   880,  -370}
-    ,{   640,  -380,  -610,   640,  -610}
-    ,{   880,  -390,  -370,   880,  -370}
-    ,{ -1310, -1330, -1310, -1310, -1310}
-    }
-   }
-  ,{{{   410,   410,   410,   410,     0}
-    ,{     0,  -240,  -240,  -240,     0}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{   410,   410,   410,   410,  -370}
-    ,{  -500,  -500,  -500,  -500,  -500}
-    }
-   ,{{     0,  -240,  -240,  -240,     0}
-    ,{     0,  -240,  -240,  -240,     0}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    ,{ -1180, -1420, -1180, -1420, -1420}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    }
-   ,{{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -500,  -500,  -500,  -500,  -500}
-    }
-   ,{{   410,   410,   410,   410,  -520}
-    ,{ -1280, -1520, -1280, -1520, -1520}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    ,{   410,   410,   410,   410,  -840}
-    ,{  -520,  -520,  -520,  -520,  -520}
-    }
-   ,{{  -370,  -370,  -370,  -370,  -370}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{  -610,  -610,  -610,  -610,  -610}
-    ,{  -370,  -370,  -370,  -370,  -370}
-    ,{ -1310, -1310, -1310, -1310, -1310}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{   800,   200,  -310,   800,  -310}
-    ,{   740,     0,  -510,   740,  -410}
-    ,{   800,    50,  -450,   800,  -450}
-    ,{   740,   200,  -310,   740,  -310}
-    ,{   690,   -50,  -560,   690,  -560}
-    }
-   ,{{   600,  -140,  -630,   600,  -410}
-    ,{   600,  -140,  -650,   600,  -410}
-    ,{   290,  -450,  -960,   290,  -960}
-    ,{  -360,  -360,  -630,  -870,  -630}
-    ,{   290,  -450,  -960,   290,  -960}
-    }
-   ,{{   740,     0,  -510,   740,  -510}
-    ,{   740,     0,  -510,   740,  -510}
-    ,{   740,     0,  -510,   740,  -510}
-    ,{   740,     0,  -510,   740,  -510}
-    ,{   690,   -50,  -560,   690,  -560}
-    }
-   ,{{   290,   200,  -310,   290,  -310}
-    ,{  -640,  -640,  -910, -1150,  -910}
-    ,{   290,  -450,  -960,   290,  -960}
-    ,{   200,   200,  -310,  -310,  -310}
-    ,{   290,  -450,  -960,   290,  -960}
-    }
-   ,{{   800,    50,  -450,   800,  -450}
-    ,{   740,     0,  -510,   740,  -510}
-    ,{   800,    50,  -450,   800,  -450}
-    ,{   740,     0,  -510,   740,  -510}
-    ,{  -550,  -550, -1300, -1300, -1300}
-    }
-   }
-  ,{{{   200,   200,  -310,  -720,  -310}
-    ,{     0,     0,  -510, -1020,  -510}
-    ,{    50,    50,  -450,  -720,  -450}
-    ,{   200,   200,  -310, -1020,  -310}
-    ,{   -50,   -50,  -560,  -830,  -560}
-    }
-   ,{{  -140,  -140,  -650, -1160,  -650}
-    ,{  -140,  -140,  -650, -1160,  -650}
-    ,{  -450,  -450,  -960, -1470,  -960}
-    ,{  -360,  -360,  -870, -1380,  -870}
-    ,{  -450,  -450,  -960, -1470,  -960}
-    }
-   ,{{     0,     0,  -510,  -780,  -510}
-    ,{     0,     0,  -510, -1020,  -510}
-    ,{     0,     0,  -510,  -780,  -510}
-    ,{     0,     0,  -510, -1020,  -510}
-    ,{   -50,   -50,  -560,  -830,  -560}
-    }
-   ,{{   200,   200,  -310, -1470,  -310}
-    ,{  -640,  -640, -1150, -1660, -1150}
-    ,{  -450,  -450,  -960, -1470,  -960}
-    ,{   200,   200,  -310, -2070,  -310}
-    ,{  -450,  -450,  -960, -1470,  -960}
-    }
-   ,{{    50,    50,  -450,  -720,  -450}
-    ,{     0,     0,  -510, -1020,  -510}
-    ,{    50,    50,  -450,  -720,  -450}
-    ,{     0,     0,  -510, -1020,  -510}
-    ,{  -550,  -550, -1300, -1810, -1300}
-    }
-   }
-  ,{{{  -310,  -310,  -310,  -310,  -310}
-    ,{  -510,  -510,  -510,  -510,  -510}
-    ,{  -450,  -450,  -450,  -450,  -450}
-    ,{  -310,  -310,  -310,  -310,  -310}
-    ,{  -560,  -560,  -560,  -560,  -560}
-    }
-   ,{{  -630,  -650,  -630,  -650,  -630}
-    ,{  -650,  -650,  -650,  -650,  -650}
-    ,{  -960,  -960,  -960,  -960,  -960}
-    ,{  -630,  -870,  -630,  -870,  -630}
-    ,{  -960,  -960,  -960,  -960,  -960}
-    }
-   ,{{  -510,  -510,  -510,  -510,  -510}
-    ,{  -510,  -510,  -510,  -510,  -510}
-    ,{  -510,  -510,  -510,  -510,  -510}
-    ,{  -510,  -510,  -510,  -510,  -510}
-    ,{  -560,  -560,  -560,  -560,  -560}
-    }
-   ,{{  -310,  -310,  -310,  -310,  -310}
-    ,{  -910, -1150,  -910, -1150,  -910}
-    ,{  -960,  -960,  -960,  -960,  -960}
-    ,{  -310,  -310,  -310,  -310,  -310}
-    ,{  -960,  -960,  -960,  -960,  -960}
-    }
-   ,{{  -450,  -450,  -450,  -450,  -450}
-    ,{  -510,  -510,  -510,  -510,  -510}
-    ,{  -450,  -450,  -450,  -450,  -450}
-    ,{  -510,  -510,  -510,  -510,  -510}
-    ,{ -1300, -1300, -1300, -1300, -1300}
-    }
-   }
-  ,{{{   800,  -550,  -310,   800,  -310}
-    ,{   740,  -850,  -510,   740,  -510}
-    ,{   800,  -550,  -450,   800,  -450}
-    ,{   740,  -850,  -310,   740,  -310}
-    ,{   690,  -660,  -560,   690,  -560}
-    }
-   ,{{   600,  -990,  -650,   600,  -650}
-    ,{   600,  -990,  -650,   600,  -650}
-    ,{   290, -1300,  -960,   290,  -960}
-    ,{  -870, -1210,  -870,  -870,  -870}
-    ,{   290, -1300,  -960,   290,  -960}
-    }
-   ,{{   740,  -610,  -510,   740,  -510}
-    ,{   740,  -850,  -510,   740,  -510}
-    ,{   740,  -610,  -510,   740,  -510}
-    ,{   740,  -850,  -510,   740,  -510}
-    ,{   690,  -660,  -560,   690,  -560}
-    }
-   ,{{   290, -1300,  -310,   290,  -310}
-    ,{ -1150, -1490, -1150, -1150, -1150}
-    ,{   290, -1300,  -960,   290,  -960}
-    ,{  -310, -1900,  -310, -1560,  -310}
-    ,{   290, -1300,  -960,   290,  -960}
-    }
-   ,{{   800,  -550,  -450,   800,  -450}
-    ,{   740,  -850,  -510,   740,  -510}
-    ,{   800,  -550,  -450,   800,  -450}
-    ,{   740,  -850,  -510,   740,  -510}
-    ,{ -1300, -1640, -1300, -1300, -1300}
-    }
-   }
-  ,{{{  -310,  -310,  -310,  -310,  -410}
-    ,{  -410,  -510,  -510,  -510,  -410}
-    ,{  -450,  -450,  -450,  -450,  -450}
-    ,{  -310,  -310,  -310,  -310,  -510}
-    ,{  -560,  -560,  -560,  -560,  -560}
-    }
-   ,{{  -410,  -650,  -630,  -650,  -410}
-    ,{  -410,  -650,  -650,  -650,  -410}
-    ,{  -960,  -960,  -960,  -960,  -960}
-    ,{  -630,  -870,  -630,  -870,  -870}
-    ,{  -960,  -960,  -960,  -960,  -960}
-    }
-   ,{{  -510,  -510,  -510,  -510,  -510}
-    ,{  -510,  -510,  -510,  -510,  -510}
-    ,{  -510,  -510,  -510,  -510,  -510}
-    ,{  -510,  -510,  -510,  -510,  -510}
-    ,{  -560,  -560,  -560,  -560,  -560}
-    }
-   ,{{  -310,  -310,  -310,  -310,  -960}
-    ,{  -910, -1150,  -910, -1150, -1150}
-    ,{  -960,  -960,  -960,  -960,  -960}
-    ,{  -310,  -310,  -310,  -310, -1560}
-    ,{  -960,  -960,  -960,  -960,  -960}
-    }
-   ,{{  -450,  -450,  -450,  -450,  -450}
-    ,{  -510,  -510,  -510,  -510,  -510}
-    ,{  -450,  -450,  -450,  -450,  -450}
-    ,{  -510,  -510,  -510,  -510,  -510}
-    ,{ -1300, -1300, -1300, -1300, -1300}
-    }
-   }
-  }
- ,{{{{   760,   200,  -310,   760,  -250}
-    ,{   760,  -340,  -490,   760,  -250}
-    ,{   310,  -430,  -940,   310,  -940}
-    ,{   400,   200,  -310,   400,  -310}
-    ,{   310,  -390,  -940,   310,  -940}
-    }
-   ,{{   760,  -430,  -490,   760,  -250}
-    ,{   760,  -490,  -490,   760,  -250}
-    ,{   310,  -430,  -940,   310,  -940}
-    ,{ -1170, -1170, -1440, -1680, -1440}
-    ,{   310,  -430,  -940,   310,  -940}
-    }
-   ,{{   400,  -340,  -850,   400,  -850}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{    90,  -650, -1160,    90, -1160}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{    90,  -650, -1160,    90, -1160}
-    }
-   ,{{   310,   200,  -310,   310,  -310}
-    ,{  -690,  -690,  -960, -1200,  -960}
-    ,{   310,  -430,  -940,   310,  -940}
-    ,{   200,   200,  -310,  -310,  -310}
-    ,{   310,  -430,  -940,   310,  -940}
-    }
-   ,{{   400,  -340,  -850,   400,  -850}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{  -220,  -960, -1470,  -220, -1470}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{  -390,  -390, -1140, -1140, -1140}
-    }
-   }
-  ,{{{   200,   200,  -310, -1000,  -310}
-    ,{  -340,  -340,  -490, -1000,  -490}
-    ,{  -430,  -430,  -940, -1430,  -940}
-    ,{   200,   200,  -310, -1360,  -310}
-    ,{  -390,  -390,  -940, -1430,  -940}
-    }
-   ,{{  -430,  -430,  -490, -1000,  -490}
-    ,{  -490, -2040,  -490, -1000,  -490}
-    ,{  -430,  -430,  -940, -1450,  -940}
-    ,{ -1170, -1170, -1680, -2190, -1680}
-    ,{  -430,  -430,  -940, -1450,  -940}
-    }
-   ,{{  -340,  -340,  -850, -1360,  -850}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    ,{  -650,  -650, -1160, -1430, -1160}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    ,{  -650,  -650, -1160, -1430, -1160}
-    }
-   ,{{   200,   200,  -310, -1450,  -310}
-    ,{  -690,  -690, -1200, -1710, -1200}
-    ,{  -430,  -430,  -940, -1450,  -940}
-    ,{   200,   200,  -310, -2070,  -310}
-    ,{  -430,  -430,  -940, -1450,  -940}
-    }
-   ,{{  -340,  -340,  -850, -1360,  -850}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    ,{  -960,  -960, -1470, -1740, -1470}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    ,{  -390,  -390, -1140, -1650, -1140}
-    }
-   }
-  ,{{{  -310,  -310,  -310,  -310,  -310}
-    ,{  -490,  -490,  -490,  -490,  -490}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    ,{  -310,  -310,  -310,  -310,  -310}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    }
-   ,{{  -490,  -490,  -490,  -490,  -490}
-    ,{  -490,  -490,  -490,  -490,  -490}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    ,{ -1440, -1680, -1440, -1680, -1440}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    }
-   ,{{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{ -1160, -1160, -1160, -1160, -1160}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{ -1160, -1160, -1160, -1160, -1160}
-    }
-   ,{{  -310,  -310,  -310,  -310,  -310}
-    ,{  -960, -1200,  -960, -1200,  -960}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    ,{  -310,  -310,  -310,  -310,  -310}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    }
-   ,{{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{ -1470, -1470, -1470, -1470, -1470}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{ -1140, -1140, -1140, -1140, -1140}
-    }
-   }
-  ,{{{   760,  -830,  -310,   760,  -310}
-    ,{   760,  -830,  -490,   760,  -490}
-    ,{   310, -1260,  -940,   310,  -940}
-    ,{   400, -1190,  -310,   400,  -310}
-    ,{   310, -1260,  -940,   310,  -940}
-    }
-   ,{{   760,  -830,  -490,   760,  -490}
-    ,{   760,  -830,  -490,   760,  -490}
-    ,{   310, -1280,  -940,   310,  -940}
-    ,{ -1680, -2020, -1680, -1680, -1680}
-    ,{   310, -1280,  -940,   310,  -940}
-    }
-   ,{{   400, -1190,  -850,   400,  -850}
-    ,{   400, -1190,  -850,   400,  -850}
-    ,{    90, -1260, -1160,    90, -1160}
-    ,{   400, -1190,  -850,   400,  -850}
-    ,{    90, -1260, -1160,    90, -1160}
-    }
-   ,{{   310, -1280,  -310,   310,  -310}
-    ,{ -1200, -1540, -1200, -1200, -1200}
-    ,{   310, -1280,  -940,   310,  -940}
-    ,{  -310, -1900,  -310, -1560,  -310}
-    ,{   310, -1280,  -940,   310,  -940}
-    }
-   ,{{   400, -1190,  -850,   400,  -850}
-    ,{   400, -1190,  -850,   400,  -850}
-    ,{  -220, -1570, -1470,  -220, -1470}
-    ,{   400, -1190,  -850,   400,  -850}
-    ,{ -1140, -1480, -1140, -1140, -1140}
-    }
-   }
-  ,{{{  -250,  -310,  -310,  -310,  -250}
-    ,{  -250,  -490,  -490,  -490,  -250}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    ,{  -310,  -310,  -310,  -310,  -850}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    }
-   ,{{  -250,  -490,  -490,  -490,  -250}
-    ,{  -250,  -490,  -490,  -490,  -250}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    ,{ -1440, -1680, -1440, -1680, -1680}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    }
-   ,{{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{ -1160, -1160, -1160, -1160, -1160}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{ -1160, -1160, -1160, -1160, -1160}
-    }
-   ,{{  -310,  -310,  -310,  -310,  -940}
-    ,{  -960, -1200,  -960, -1200, -1200}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    ,{  -310,  -310,  -310,  -310, -1560}
-    ,{  -940,  -940,  -940,  -940,  -940}
-    }
-   ,{{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{ -1470, -1470, -1470, -1470, -1470}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{ -1140, -1140, -1140, -1140, -1140}
-    }
-   }
-  }
- ,{{{{   360,   360,  -150,  -150,  -150}
-    ,{   -30,   -30,  -990,  -150,  -990}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    ,{   360,   360,  -150,  -150,  -150}
-    ,{  -150,  -650, -1400,  -150, -1400}
-    }
-   ,{{   -70,   -70, -1180,  -150, -1180}
-    ,{   -70,   -70, -1580,  -330, -1340}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    ,{  -910,  -910, -1180, -1420, -1180}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    }
-   ,{{  -150,  -890, -1400,  -150, -1400}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    }
-   ,{{   360,   360,  -150,  -150,  -150}
-    ,{   -30,   -30,  -990, -1230,  -990}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    ,{   360,   360,  -150,  -150,  -150}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    }
-   ,{{  -150,  -650, -1400,  -150, -1400}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    ,{  -150,  -890, -1400,  -150, -1400}
-    ,{  -650,  -650, -1400, -1400, -1400}
-    }
-   }
-  ,{{{   360,   360,  -150, -1670,  -150}
-    ,{   -30,   -30, -1230, -1740, -1230}
-    ,{  -890,  -890, -1400, -1670, -1400}
-    ,{   360,   360,  -150, -1910,  -150}
-    ,{  -650,  -650, -1400, -1670, -1400}
-    }
-   ,{{   -70,   -70, -1400, -1910, -1400}
-    ,{   -70,   -70, -1580, -2090, -1580}
-    ,{  -890,  -890, -1400, -1910, -1400}
-    ,{  -910,  -910, -1420, -1930, -1420}
-    ,{  -890,  -890, -1400, -1910, -1400}
-    }
-   ,{{  -890,  -890, -1400, -1670, -1400}
-    ,{  -890,  -890, -1400, -1910, -1400}
-    ,{  -890,  -890, -1400, -1670, -1400}
-    ,{  -890,  -890, -1400, -1910, -1400}
-    ,{  -890,  -890, -1400, -1670, -1400}
-    }
-   ,{{   360,   360,  -150, -1740,  -150}
-    ,{   -30,   -30, -1230, -1740, -1230}
-    ,{  -890,  -890, -1400, -1910, -1400}
-    ,{   360,   360,  -150, -1910,  -150}
-    ,{  -890,  -890, -1400, -1910, -1400}
-    }
-   ,{{  -650,  -650, -1400, -1670, -1400}
-    ,{  -890,  -890, -1400, -1910, -1400}
-    ,{  -890,  -890, -1400, -1670, -1400}
-    ,{  -890,  -890, -1400, -1910, -1400}
-    ,{  -650,  -650, -1400, -1910, -1400}
-    }
-   }
-  ,{{{  -150,  -150,  -150,  -150,  -150}
-    ,{  -990, -1230,  -990, -1230,  -990}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{  -150,  -150,  -150,  -150,  -150}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{ -1180, -1400, -1180, -1400, -1180}
-    ,{ -1580, -1580, -1580, -1580, -1580}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1180, -1420, -1180, -1420, -1180}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{  -150,  -150,  -150,  -150,  -150}
-    ,{  -990, -1230,  -990, -1230,  -990}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{  -150,  -150,  -150,  -150,  -150}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   }
-  ,{{{  -150, -1500,  -150,  -150,  -150}
-    ,{  -150, -1570, -1230,  -150, -1230}
-    ,{  -150, -1500, -1400,  -150, -1400}
-    ,{  -150, -1740,  -150,  -150,  -150}
-    ,{  -150, -1500, -1400,  -150, -1400}
-    }
-   ,{{  -150, -1600, -1400,  -150, -1400}
-    ,{  -330, -1600, -1580,  -330, -1580}
-    ,{  -150, -1740, -1400,  -150, -1400}
-    ,{ -1420, -3040, -1420, -1420, -1420}
-    ,{  -150, -1740, -1400,  -150, -1400}
-    }
-   ,{{  -150, -1500, -1400,  -150, -1400}
-    ,{  -150, -1740, -1400,  -150, -1400}
-    ,{  -150, -1500, -1400,  -150, -1400}
-    ,{  -150, -1740, -1400,  -150, -1400}
-    ,{  -150, -1500, -1400,  -150, -1400}
-    }
-   ,{{  -150, -1570,  -150,  -150,  -150}
-    ,{ -1230, -1570, -1230, -1230, -1230}
-    ,{  -150, -1740, -1400,  -150, -1400}
-    ,{  -150, -1740,  -150, -1400,  -150}
-    ,{  -150, -1740, -1400,  -150, -1400}
-    }
-   ,{{  -150, -1500, -1400,  -150, -1400}
-    ,{  -150, -1740, -1400,  -150, -1400}
-    ,{  -150, -1500, -1400,  -150, -1400}
-    ,{  -150, -1740, -1400,  -150, -1400}
-    ,{ -1400, -1740, -1400, -1400, -1400}
-    }
-   }
-  ,{{{  -150,  -150,  -150,  -150, -1230}
-    ,{  -990, -1230,  -990, -1230, -1230}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{  -150,  -150,  -150,  -150, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{ -1180, -1400, -1180, -1400, -1340}
-    ,{ -1340, -1580, -1580, -1580, -1340}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1180, -1420, -1180, -1420, -1420}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{  -150,  -150,  -150,  -150, -1230}
-    ,{  -990, -1230,  -990, -1230, -1230}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{  -150,  -150,  -150,  -150, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   ,{{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    ,{ -1400, -1400, -1400, -1400, -1400}
-    }
-   }
-  }
- ,{{{{   910,   910,   400,   910,   400}
-    ,{   910,   170,  -340,   910,  -100}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{   910,   910,   400,   400,   400}
-    ,{   400,  -100,  -850,   400,  -850}
-    }
-   ,{{   910,   170,  -340,   910,  -100}
-    ,{   910,   170,  -340,   910,  -100}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{  -680,  -680,  -950, -1190,  -950}
-    ,{   400,  -340,  -850,   400,  -850}
-    }
-   ,{{   400,  -340,  -850,   400,  -850}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{   400,  -340,  -850,   400,  -850}
-    }
-   ,{{   910,   910,   400,   400,   400}
-    ,{  -850,  -850, -1120, -1360, -1120}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{   910,   910,   400,   400,   400}
-    ,{   400,  -340,  -850,   400,  -850}
-    }
-   ,{{   400,  -100,  -850,   400,  -850}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{   400,  -340,  -850,   400,  -850}
-    ,{  -100,  -100,  -850,  -850,  -850}
-    }
-   }
-  ,{{{   910,   910,   400,  -850,   400}
-    ,{   170,   170,  -340,  -850,  -340}
-    ,{  -340,  -340,  -850, -1120,  -850}
-    ,{   910,   910,   400, -1360,   400}
-    ,{  -100,  -100,  -850, -1120,  -850}
-    }
-   ,{{   170,   170,  -340,  -850,  -340}
-    ,{   170,   170,  -340,  -850,  -340}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    ,{  -680,  -680, -1190, -1700, -1190}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    }
-   ,{{  -340,  -340,  -850, -1120,  -850}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    ,{  -340,  -340,  -850, -1120,  -850}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    ,{  -340,  -340,  -850, -1120,  -850}
-    }
-   ,{{   910,   910,   400, -1360,   400}
-    ,{  -850,  -850, -1360, -1870, -1360}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    ,{   910,   910,   400, -1360,   400}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    }
-   ,{{  -100,  -100,  -850, -1120,  -850}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    ,{  -340,  -340,  -850, -1120,  -850}
-    ,{  -340,  -340,  -850, -1360,  -850}
-    ,{  -100,  -100,  -850, -1360,  -850}
-    }
-   }
-  ,{{{   400,   400,   400,   400,   400}
-    ,{  -340,  -340,  -340,  -340,  -340}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{   400,   400,   400,   400,   400}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    }
-   ,{{  -340,  -340,  -340,  -340,  -340}
-    ,{  -340,  -340,  -340,  -340,  -340}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -950, -1190,  -950, -1190,  -950}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    }
-   ,{{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    }
-   ,{{   400,   400,   400,   400,   400}
-    ,{ -1120, -1360, -1120, -1360, -1120}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{   400,   400,   400,   400,   400}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    }
-   ,{{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    }
-   }
-  ,{{{   910,  -680,   400,   910,   400}
-    ,{   910,  -680,  -340,   910,  -340}
-    ,{   400,  -950,  -850,   400,  -850}
-    ,{   400, -1190,   400,   400,   400}
-    ,{   400,  -950,  -850,   400,  -850}
-    }
-   ,{{   910,  -680,  -340,   910,  -340}
-    ,{   910,  -680,  -340,   910,  -340}
-    ,{   400, -1190,  -850,   400,  -850}
-    ,{ -1190, -1530, -1190, -1190, -1190}
-    ,{   400, -1190,  -850,   400,  -850}
-    }
-   ,{{   400,  -950,  -850,   400,  -850}
-    ,{   400, -1190,  -850,   400,  -850}
-    ,{   400,  -950,  -850,   400,  -850}
-    ,{   400, -1190,  -850,   400,  -850}
-    ,{   400,  -950,  -850,   400,  -850}
-    }
-   ,{{   400, -1190,   400,   400,   400}
-    ,{ -1360, -1700, -1360, -1360, -1360}
-    ,{   400, -1190,  -850,   400,  -850}
-    ,{   400, -1190,   400,  -850,   400}
-    ,{   400, -1190,  -850,   400,  -850}
-    }
-   ,{{   400,  -950,  -850,   400,  -850}
-    ,{   400, -1190,  -850,   400,  -850}
-    ,{   400,  -950,  -850,   400,  -850}
-    ,{   400, -1190,  -850,   400,  -850}
-    ,{  -850, -1190,  -850,  -850,  -850}
-    }
-   }
-  ,{{{   400,   400,   400,   400,  -100}
-    ,{  -100,  -340,  -340,  -340,  -100}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{   400,   400,   400,   400,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    }
-   ,{{  -100,  -340,  -340,  -340,  -100}
-    ,{  -100,  -340,  -340,  -340,  -100}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -950, -1190,  -950, -1190, -1190}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    }
-   ,{{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    }
-   ,{{   400,   400,   400,   400,  -850}
-    ,{ -1120, -1360, -1120, -1360, -1360}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{   400,   400,   400,   400,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    }
-   ,{{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    ,{  -850,  -850,  -850,  -850,  -850}
-    }
-   }
-  }
- ,{{{{  1490,  1280,   780,  1490,   780}
-    ,{  1490,   750,   240,  1490,   480}
-    ,{  1200,   450,   -50,  1200,   -50}
-    ,{  1280,  1280,   780,  1200,   780}
-    ,{  1200,   450,   -50,  1200,   -50}
-    }
-   ,{{  1490,   750,   240,  1490,   480}
-    ,{  1490,   750,   240,  1490,   480}
-    ,{  1190,   440,   -60,  1190,   -60}
-    ,{  -630,  -630,  -900, -1140,  -900}
-    ,{  1190,   440,   -60,  1190,   -60}
-    }
-   ,{{  1200,   460,   -50,  1200,   -50}
-    ,{  1200,   460,   -50,  1200,   -50}
-    ,{  1200,   450,   -50,  1200,   -50}
-    ,{  1200,   460,   -50,  1200,   -50}
-    ,{  1200,   450,   -50,  1200,   -50}
-    }
-   ,{{  1280,  1280,   780,  1190,   780}
-    ,{  -450,  -450,  -720,  -960,  -720}
-    ,{  1190,   440,   -60,  1190,   -60}
-    ,{  1280,  1280,   780,   780,   780}
-    ,{  1190,   440,   -60,  1190,   -60}
-    }
-   ,{{  1200,   460,   -50,  1200,   -50}
-    ,{  1200,   460,   -50,  1200,   -50}
-    ,{  1200,   450,   -50,  1200,   -50}
-    ,{  1200,   460,   -50,  1200,   -50}
-    ,{  -280,  -280, -1030, -1030, -1030}
-    }
-   }
-  ,{{{  1280,  1280,   780,  -260,   780}
-    ,{   750,   750,   240,  -260,   240}
-    ,{   450,   450,   -50,  -320,   -50}
-    ,{  1280,  1280,   780,  -560,   780}
-    ,{   450,   450,   -50,  -320,   -50}
-    }
-   ,{{   750,   750,   240,  -260,   240}
-    ,{   750,   750,   240,  -260,   240}
-    ,{   440,   440,   -60,  -570,   -60}
-    ,{  -630,  -630, -1140, -1650, -1140}
-    ,{   440,   440,   -60,  -570,   -60}
-    }
-   ,{{   460,   460,   -50,  -320,   -50}
-    ,{   460,   460,   -50,  -560,   -50}
-    ,{   450,   450,   -50,  -320,   -50}
-    ,{   460,   460,   -50,  -560,   -50}
-    ,{   450,   450,   -50,  -320,   -50}
-    }
-   ,{{  1280,  1280,   780,  -570,   780}
-    ,{  -450,  -450,  -960, -1470,  -960}
-    ,{   440,   440,   -60,  -570,   -60}
-    ,{  1280,  1280,   780,  -980,   780}
-    ,{   440,   440,   -60,  -570,   -60}
-    }
-   ,{{   460,   460,   -50,  -320,   -50}
-    ,{   460,   460,   -50,  -560,   -50}
-    ,{   450,   450,   -50,  -320,   -50}
-    ,{   460,   460,   -50,  -560,   -50}
-    ,{  -280,  -280, -1030, -1540, -1030}
-    }
-   }
-  ,{{{   780,   780,   780,   780,   780}
-    ,{   240,   240,   240,   240,   240}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   780,   780,   780,   780,   780}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    }
-   ,{{   240,   240,   240,   240,   240}
-    ,{   240,   240,   240,   240,   240}
-    ,{   -60,   -60,   -60,   -60,   -60}
-    ,{  -900, -1140,  -900, -1140,  -900}
-    ,{   -60,   -60,   -60,   -60,   -60}
-    }
-   ,{{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    }
-   ,{{   780,   780,   780,   780,   780}
-    ,{  -720,  -960,  -720,  -960,  -720}
-    ,{   -60,   -60,   -60,   -60,   -60}
-    ,{   780,   780,   780,   780,   780}
-    ,{   -60,   -60,   -60,   -60,   -60}
-    }
-   ,{{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{ -1030, -1030, -1030, -1030, -1030}
-    }
-   }
-  ,{{{  1490,   -90,   780,  1490,   780}
-    ,{  1490,   -90,   240,  1490,   240}
-    ,{  1200,  -150,   -50,  1200,   -50}
-    ,{  1200,  -390,   780,  1200,   780}
-    ,{  1200,  -150,   -50,  1200,   -50}
-    }
-   ,{{  1490,   -90,   240,  1490,   240}
-    ,{  1490,   -90,   240,  1490,   240}
-    ,{  1190,  -400,   -60,  1190,   -60}
-    ,{ -1140, -1480, -1140, -1140, -1140}
-    ,{  1190,  -400,   -60,  1190,   -60}
-    }
-   ,{{  1200,  -150,   -50,  1200,   -50}
-    ,{  1200,  -390,   -50,  1200,   -50}
-    ,{  1200,  -150,   -50,  1200,   -50}
-    ,{  1200,  -390,   -50,  1200,   -50}
-    ,{  1200,  -150,   -50,  1200,   -50}
-    }
-   ,{{  1190,  -400,   780,  1190,   780}
-    ,{  -960, -1300,  -960,  -960,  -960}
-    ,{  1190,  -400,   -60,  1190,   -60}
-    ,{   780,  -810,   780,  -470,   780}
-    ,{  1190,  -400,   -60,  1190,   -60}
-    }
-   ,{{  1200,  -150,   -50,  1200,   -50}
-    ,{  1200,  -390,   -50,  1200,   -50}
-    ,{  1200,  -150,   -50,  1200,   -50}
-    ,{  1200,  -390,   -50,  1200,   -50}
-    ,{ -1030, -1370, -1030, -1030, -1030}
-    }
-   }
-  ,{{{   780,   780,   780,   780,   480}
-    ,{   480,   240,   240,   240,   480}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   780,   780,   780,   780,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    }
-   ,{{   480,   240,   240,   240,   480}
-    ,{   480,   240,   240,   240,   480}
-    ,{   -60,   -60,   -60,   -60,   -60}
-    ,{  -900, -1140,  -900, -1140, -1140}
-    ,{   -60,   -60,   -60,   -60,   -60}
-    }
-   ,{{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    }
-   ,{{   780,   780,   780,   780,   -60}
-    ,{  -720,  -960,  -720,  -960,  -960}
-    ,{   -60,   -60,   -60,   -60,   -60}
-    ,{   780,   780,   780,   780,  -470}
-    ,{   -60,   -60,   -60,   -60,   -60}
-    }
-   ,{{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{ -1030, -1030, -1030, -1030, -1030}
-    }
-   }
-  }
- ,{{{{  1560,  1470,   960,  1560,   960}
-    ,{  1560,   820,   310,  1560,   550}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{  1470,  1470,   960,  1430,   960}
-    ,{  1300,   560,    50,  1300,    50}
-    }
-   ,{{  1560,   820,   310,  1560,   550}
-    ,{  1560,   820,   310,  1560,   550}
-    ,{  1280,   540,    30,  1280,    30}
-    ,{  -580,  -580,  -850, -1090,  -850}
-    ,{  1280,   540,    30,  1280,    30}
-    }
-   ,{{  1430,   690,   180,  1430,   180}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{  1300,   560,    50,  1300,    50}
-    }
-   ,{{  1470,  1470,   960,  1280,   960}
-    ,{  -880,  -880, -1150, -1390, -1150}
-    ,{  1280,   540,    30,  1280,    30}
-    ,{  1470,  1470,   960,   960,   960}
-    ,{  1280,   540,    30,  1280,    30}
-    }
-   ,{{  1430,   690,   180,  1430,   180}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{   990,   250,  -260,   990,  -260}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{   -10,   -10,  -760,  -760,  -760}
-    }
-   }
-  ,{{{  1470,  1470,   960,   -90,   960}
-    ,{   820,   820,   310,  -200,   310}
-    ,{   690,   690,   180,   -90,   180}
-    ,{  1470,  1470,   960,  -330,   960}
-    ,{   560,   560,    50,  -220,    50}
-    }
-   ,{{   820,   820,   310,  -200,   310}
-    ,{   820,   820,   310,  -200,   310}
-    ,{   540,   540,    30,  -480,    30}
-    ,{  -580,  -580, -1090, -1600, -1090}
-    ,{   540,   540,    30,  -480,    30}
-    }
-   ,{{   690,   690,   180,   -90,   180}
-    ,{   690,   690,   180,  -330,   180}
-    ,{   690,   690,   180,   -90,   180}
-    ,{   690,   690,   180,  -330,   180}
-    ,{   560,   560,    50,  -220,    50}
-    }
-   ,{{  1470,  1470,   960,  -480,   960}
-    ,{  -880,  -880, -1390, -1900, -1390}
-    ,{   540,   540,    30,  -480,    30}
-    ,{  1470,  1470,   960,  -800,   960}
-    ,{   540,   540,    30,  -480,    30}
-    }
-   ,{{   690,   690,   180,  -330,   180}
-    ,{   690,   690,   180,  -330,   180}
-    ,{   250,   250,  -260,  -530,  -260}
-    ,{   690,   690,   180,  -330,   180}
-    ,{   -10,   -10,  -760, -1270,  -760}
-    }
-   }
-  ,{{{   960,   960,   960,   960,   960}
-    ,{   310,   310,   310,   310,   310}
-    ,{   180,   180,   180,   180,   180}
-    ,{   960,   960,   960,   960,   960}
-    ,{    50,    50,    50,    50,    50}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{    30,    30,    30,    30,    30}
-    ,{  -850, -1090,  -850, -1090,  -850}
-    ,{    30,    30,    30,    30,    30}
-    }
-   ,{{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{    50,    50,    50,    50,    50}
-    }
-   ,{{   960,   960,   960,   960,   960}
-    ,{ -1150, -1390, -1150, -1390, -1150}
-    ,{    30,    30,    30,    30,    30}
-    ,{   960,   960,   960,   960,   960}
-    ,{    30,    30,    30,    30,    30}
-    }
-   ,{{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{  -260,  -260,  -260,  -260,  -260}
-    ,{   180,   180,   180,   180,   180}
-    ,{  -760,  -760,  -760,  -760,  -760}
-    }
-   }
-  ,{{{  1560,    80,   960,  1560,   960}
-    ,{  1560,   -30,   310,  1560,   310}
-    ,{  1430,    80,   180,  1430,   180}
-    ,{  1430,  -160,   960,  1430,   960}
-    ,{  1300,   -50,    50,  1300,    50}
-    }
-   ,{{  1560,   -30,   310,  1560,   310}
-    ,{  1560,   -30,   310,  1560,   310}
-    ,{  1280,  -310,    30,  1280,    30}
-    ,{ -1090, -1430, -1090, -1090, -1090}
-    ,{  1280,  -310,    30,  1280,    30}
-    }
-   ,{{  1430,    80,   180,  1430,   180}
-    ,{  1430,  -160,   180,  1430,   180}
-    ,{  1430,    80,   180,  1430,   180}
-    ,{  1430,  -160,   180,  1430,   180}
-    ,{  1300,   -50,    50,  1300,    50}
-    }
-   ,{{  1280,  -310,   960,  1280,   960}
-    ,{ -1390, -1730, -1390, -1390, -1390}
-    ,{  1280,  -310,    30,  1280,    30}
-    ,{   960,  -630,   960,  -290,   960}
-    ,{  1280,  -310,    30,  1280,    30}
-    }
-   ,{{  1430,  -160,   180,  1430,   180}
-    ,{  1430,  -160,   180,  1430,   180}
-    ,{   990,  -360,  -260,   990,  -260}
-    ,{  1430,  -160,   180,  1430,   180}
-    ,{  -760, -1100,  -760,  -760,  -760}
-    }
-   }
-  ,{{{   960,   960,   960,   960,   550}
-    ,{   550,   310,   310,   310,   550}
-    ,{   180,   180,   180,   180,   180}
-    ,{   960,   960,   960,   960,   180}
-    ,{    50,    50,    50,    50,    50}
-    }
-   ,{{   550,   310,   310,   310,   550}
-    ,{   550,   310,   310,   310,   550}
-    ,{    30,    30,    30,    30,    30}
-    ,{  -850, -1090,  -850, -1090, -1090}
-    ,{    30,    30,    30,    30,    30}
-    }
-   ,{{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{    50,    50,    50,    50,    50}
-    }
-   ,{{   960,   960,   960,   960,    30}
-    ,{ -1150, -1390, -1150, -1390, -1390}
-    ,{    30,    30,    30,    30,    30}
-    ,{   960,   960,   960,   960,  -290}
-    ,{    30,    30,    30,    30,    30}
-    }
-   ,{{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{  -260,  -260,  -260,  -260,  -260}
-    ,{   180,   180,   180,   180,   180}
-    ,{  -760,  -760,  -760,  -760,  -760}
-    }
-   }
-  }
- ,{{{{  1560,  1470,   960,  1560,   960}
-    ,{  1560,   820,   310,  1560,   550}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{  1470,  1470,   960,  1430,   960}
-    ,{  1300,   560,    50,  1300,    50}
-    }
-   ,{{  1560,   820,   310,  1560,   550}
-    ,{  1560,   820,   310,  1560,   550}
-    ,{  1280,   540,    30,  1280,    30}
-    ,{  -360,  -360,  -630,  -870,  -630}
-    ,{  1280,   540,    30,  1280,    30}
-    }
-   ,{{  1430,   690,   180,  1430,   180}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{  1300,   560,    50,  1300,    50}
-    }
-   ,{{  1470,  1470,   960,  1280,   960}
-    ,{   -30,   -30,  -720,  -960,  -720}
-    ,{  1280,   540,    30,  1280,    30}
-    ,{  1470,  1470,   960,   960,   960}
-    ,{  1280,   540,    30,  1280,    30}
-    }
-   ,{{  1430,   690,   180,  1430,   180}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{  1200,   450,   -50,  1200,   -50}
-    ,{  1430,   690,   180,  1430,   180}
-    ,{   -10,   -10,  -760,  -760,  -760}
-    }
-   }
-  ,{{{  1470,  1470,   960,   -90,   960}
-    ,{   820,   820,   310,  -200,   310}
-    ,{   690,   690,   180,   -90,   180}
-    ,{  1470,  1470,   960,  -330,   960}
-    ,{   560,   560,    50,  -220,    50}
-    }
-   ,{{   820,   820,   310,  -200,   310}
-    ,{   820,   820,   310,  -200,   310}
-    ,{   540,   540,    30,  -480,    30}
-    ,{  -360,  -360,  -870, -1380,  -870}
-    ,{   540,   540,    30,  -480,    30}
-    }
-   ,{{   690,   690,   180,   -90,   180}
-    ,{   690,   690,   180,  -330,   180}
-    ,{   690,   690,   180,   -90,   180}
-    ,{   690,   690,   180,  -330,   180}
-    ,{   560,   560,    50,  -220,    50}
-    }
-   ,{{  1470,  1470,   960,  -480,   960}
-    ,{   -30,   -30,  -960, -1470,  -960}
-    ,{   540,   540,    30,  -480,    30}
-    ,{  1470,  1470,   960,  -800,   960}
-    ,{   540,   540,    30,  -480,    30}
-    }
-   ,{{   690,   690,   180,  -320,   180}
-    ,{   690,   690,   180,  -330,   180}
-    ,{   450,   450,   -50,  -320,   -50}
-    ,{   690,   690,   180,  -330,   180}
-    ,{   -10,   -10,  -760, -1270,  -760}
-    }
-   }
-  ,{{{   960,   960,   960,   960,   960}
-    ,{   310,   310,   310,   310,   310}
-    ,{   180,   180,   180,   180,   180}
-    ,{   960,   960,   960,   960,   960}
-    ,{    50,    50,    50,    50,    50}
-    }
-   ,{{   310,   310,   310,   310,   310}
-    ,{   310,   310,   310,   310,   310}
-    ,{    30,    30,    30,    30,    30}
-    ,{  -630,  -870,  -630,  -870,  -630}
-    ,{    30,    30,    30,    30,    30}
-    }
-   ,{{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{    50,    50,    50,    50,    50}
-    }
-   ,{{   960,   960,   960,   960,   960}
-    ,{  -720,  -960,  -720,  -960,  -720}
-    ,{    30,    30,    30,    30,    30}
-    ,{   960,   960,   960,   960,   960}
-    ,{    30,    30,    30,    30,    30}
-    }
-   ,{{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   180,   180,   180,   180,   180}
-    ,{  -760,  -760,  -760,  -760,  -760}
-    }
-   }
-  ,{{{  1560,    80,   960,  1560,   960}
-    ,{  1560,   -30,   310,  1560,   310}
-    ,{  1430,    80,   180,  1430,   180}
-    ,{  1430,  -160,   960,  1430,   960}
-    ,{  1300,   -50,    50,  1300,    50}
-    }
-   ,{{  1560,   -30,   310,  1560,   310}
-    ,{  1560,   -30,   310,  1560,   310}
-    ,{  1280,  -310,    30,  1280,    30}
-    ,{  -870, -1210,  -870,  -870,  -870}
-    ,{  1280,  -310,    30,  1280,    30}
-    }
-   ,{{  1430,    80,   180,  1430,   180}
-    ,{  1430,  -160,   180,  1430,   180}
-    ,{  1430,    80,   180,  1430,   180}
-    ,{  1430,  -160,   180,  1430,   180}
-    ,{  1300,   -50,    50,  1300,    50}
-    }
-   ,{{  1280,  -310,   960,  1280,   960}
-    ,{  -960, -1300,  -960,  -960,  -960}
-    ,{  1280,  -310,    30,  1280,    30}
-    ,{   960,  -630,   960,  -290,   960}
-    ,{  1280,  -310,    30,  1280,    30}
-    }
-   ,{{  1430,  -150,   180,  1430,   180}
-    ,{  1430,  -160,   180,  1430,   180}
-    ,{  1200,  -150,   -50,  1200,   -50}
-    ,{  1430,  -160,   180,  1430,   180}
-    ,{  -760, -1100,  -760,  -760,  -760}
-    }
-   }
-  ,{{{   960,   960,   960,   960,   550}
-    ,{   550,   310,   310,   310,   550}
-    ,{   180,   180,   180,   180,   180}
-    ,{   960,   960,   960,   960,   180}
-    ,{    50,    50,    50,    50,    50}
-    }
-   ,{{   550,   310,   310,   310,   550}
-    ,{   550,   310,   310,   310,   550}
-    ,{    30,    30,    30,    30,    30}
-    ,{  -630,  -870,  -630,  -870,  -870}
-    ,{    30,    30,    30,    30,    30}
-    }
-   ,{{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{    50,    50,    50,    50,    50}
-    }
-   ,{{   960,   960,   960,   960,    30}
-    ,{  -720,  -960,  -720,  -960,  -960}
-    ,{    30,    30,    30,    30,    30}
-    ,{   960,   960,   960,   960,  -290}
-    ,{    30,    30,    30,    30,    30}
-    }
-   ,{{   180,   180,   180,   180,   180}
-    ,{   180,   180,   180,   180,   180}
-    ,{   -50,   -50,   -50,   -50,   -50}
-    ,{   180,   180,   180,   180,   180}
-    ,{  -760,  -760,  -760,  -760,  -760}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{  1170,   780,   490,  1170,   490}
-    ,{  1120,   580,   290,  1120,   290}
-    ,{  1170,   640,   340,  1170,   340}
-    ,{  1120,   780,   490,  1120,   490}
-    ,{  1060,   530,   230,  1060,   230}
-    }
-   ,{{   970,   440,   170,   970,   170}
-    ,{   970,   440,   140,   970,   140}
-    ,{   660,   130,  -160,   660,  -160}
-    ,{   220,   220,   170,   -80,   170}
-    ,{   660,   130,  -160,   660,  -160}
-    }
-   ,{{  1120,   580,   290,  1120,   290}
-    ,{  1120,   580,   290,  1120,   290}
-    ,{  1110,   580,   280,  1110,   280}
-    ,{  1120,   580,   290,  1120,   290}
-    ,{  1060,   530,   230,  1060,   230}
-    }
-   ,{{   780,   780,   490,   660,   490}
-    ,{   -60,   -60,  -120,  -370,  -120}
-    ,{   660,   130,  -160,   660,  -160}
-    ,{   780,   780,   490,   470,   490}
-    ,{   660,   130,  -160,   660,  -160}
-    }
-   ,{{  1170,   640,   340,  1170,   340}
-    ,{  1120,   580,   290,  1120,   290}
-    ,{  1170,   640,   340,  1170,   340}
-    ,{  1120,   580,   290,  1120,   290}
-    ,{    40,    40,  -500,  -510,  -500}
-    }
-   }
-  ,{{{   780,   780,   490,  -330,   490}
-    ,{   580,   580,   290,  -620,   290}
-    ,{   640,   640,   340,  -330,   340}
-    ,{   780,   780,   490,  -620,   490}
-    ,{   530,   530,   230,  -440,   230}
-    }
-   ,{{   440,   440,   140,  -770,   140}
-    ,{   440,   440,   140,  -770,   140}
-    ,{   130,   130,  -160, -1080,  -160}
-    ,{   220,   220,   -70,  -980,   -70}
-    ,{   130,   130,  -160, -1080,  -160}
-    }
-   ,{{   580,   580,   290,  -390,   290}
-    ,{   580,   580,   290,  -620,   290}
-    ,{   580,   580,   280,  -390,   280}
-    ,{   580,   580,   290,  -620,   290}
-    ,{   530,   530,   230,  -440,   230}
-    }
-   ,{{   780,   780,   490, -1080,   490}
-    ,{   -60,   -60,  -350, -1270,  -350}
-    ,{   130,   130,  -160, -1080,  -160}
-    ,{   780,   780,   490, -1680,   490}
-    ,{   130,   130,  -160, -1080,  -160}
-    }
-   ,{{   640,   640,   340,  -330,   340}
-    ,{   580,   580,   290,  -620,   290}
-    ,{   640,   640,   340,  -330,   340}
-    ,{   580,   580,   290,  -620,   290}
-    ,{    40,    40,  -500, -1410,  -500}
-    }
-   }
-  ,{{{   480,   470,   480,   470,   480}
-    ,{   280,   270,   280,   270,   280}
-    ,{   340,   330,   340,   330,   340}
-    ,{   480,   470,   480,   470,   480}
-    ,{   230,   220,   230,   220,   230}
-    }
-   ,{{   170,   130,   170,   130,   170}
-    ,{   140,   130,   140,   130,   140}
-    ,{  -170,  -180,  -170,  -180,  -170}
-    ,{   170,   -80,   170,   -80,   170}
-    ,{  -170,  -180,  -170,  -180,  -170}
-    }
-   ,{{   280,   270,   280,   270,   280}
-    ,{   280,   270,   280,   270,   280}
-    ,{   280,   270,   280,   270,   280}
-    ,{   280,   270,   280,   270,   280}
-    ,{   230,   220,   230,   220,   230}
-    }
-   ,{{   480,   470,   480,   470,   480}
-    ,{  -120,  -370,  -120,  -370,  -120}
-    ,{  -170,  -180,  -170,  -180,  -170}
-    ,{   480,   470,   480,   470,   480}
-    ,{  -170,  -180,  -170,  -180,  -170}
-    }
-   ,{{   340,   330,   340,   330,   340}
-    ,{   280,   270,   280,   270,   280}
-    ,{   340,   330,   340,   330,   340}
-    ,{   280,   270,   280,   270,   280}
-    ,{  -500,  -510,  -500,  -510,  -500}
-    }
-   }
-  ,{{{  1170,  -510,   490,  1170,   490}
-    ,{  1120,  -800,   290,  1120,   290}
-    ,{  1170,  -510,   340,  1170,   340}
-    ,{  1120,  -800,   490,  1120,   490}
-    ,{  1060,  -620,   230,  1060,   230}
-    }
-   ,{{   970,  -950,   140,   970,   140}
-    ,{   970,  -950,   140,   970,   140}
-    ,{   660, -1260,  -160,   660,  -160}
-    ,{   -70, -1160,   -70,  -490,   -70}
-    ,{   660, -1260,  -160,   660,  -160}
-    }
-   ,{{  1120,  -570,   290,  1120,   290}
-    ,{  1120,  -800,   290,  1120,   290}
-    ,{  1110,  -570,   280,  1110,   280}
-    ,{  1120,  -800,   290,  1120,   290}
-    ,{  1060,  -620,   230,  1060,   230}
-    }
-   ,{{   660, -1260,   490,   660,   490}
-    ,{  -350, -1450,  -350,  -780,  -350}
-    ,{   660, -1260,  -160,   660,  -160}
-    ,{   490, -1860,   490, -1190,   490}
-    ,{   660, -1260,  -160,   660,  -160}
-    }
-   ,{{  1170,  -510,   340,  1170,   340}
-    ,{  1120,  -800,   290,  1120,   290}
-    ,{  1170,  -510,   340,  1170,   340}
-    ,{  1120,  -800,   290,  1120,   290}
-    ,{  -500, -1590,  -500,  -920,  -500}
-    }
-   }
-  ,{{{   480,   470,   480,   470,  -600}
-    ,{   280,   270,   280,   270,  -600}
-    ,{   340,   330,   340,   330,  -640}
-    ,{   480,   470,   480,   470,  -690}
-    ,{   230,   220,   230,   220,  -750}
-    }
-   ,{{   170,   130,   170,   130,  -600}
-    ,{   140,   130,   140,   130,  -600}
-    ,{  -170,  -180,  -170,  -180, -1150}
-    ,{   170,   -80,   170,   -80, -1050}
-    ,{  -170,  -180,  -170,  -180, -1150}
-    }
-   ,{{   280,   270,   280,   270,  -690}
-    ,{   280,   270,   280,   270,  -690}
-    ,{   280,   270,   280,   270,  -700}
-    ,{   280,   270,   280,   270,  -690}
-    ,{   230,   220,   230,   220,  -750}
-    }
-   ,{{   480,   470,   480,   470, -1150}
-    ,{  -120,  -370,  -120,  -370, -1340}
-    ,{  -170,  -180,  -170,  -180, -1150}
-    ,{   480,   470,   480,   470, -1750}
-    ,{  -170,  -180,  -170,  -180, -1150}
-    }
-   ,{{   340,   330,   340,   330,  -640}
-    ,{   280,   270,   280,   270,  -690}
-    ,{   340,   330,   340,   330,  -640}
-    ,{   280,   270,   280,   270,  -690}
-    ,{  -500,  -510,  -500,  -510, -1480}
-    }
-   }
-  }
- ,{{{{  1140,   780,   490,  1140,   490}
-    ,{  1140,   600,   310,  1140,   310}
-    ,{   690,   150,  -140,   690,  -140}
-    ,{   780,   780,   490,   770,   490}
-    ,{   690,   190,  -140,   690,  -140}
-    }
-   ,{{  1140,   600,   310,  1140,   310}
-    ,{  1140,   600,   310,  1140,   310}
-    ,{   690,   150,  -140,   690,  -140}
-    ,{  -580,  -580,  -640,  -890,  -640}
-    ,{   690,   150,  -140,   690,  -140}
-    }
-   ,{{   770,   240,   -50,   770,   -50}
-    ,{   770,   240,   -50,   770,   -50}
-    ,{   470,   -60,  -360,   470,  -360}
-    ,{   770,   240,   -50,   770,   -50}
-    ,{   470,   -60,  -360,   470,  -360}
-    }
-   ,{{   780,   780,   490,   690,   490}
-    ,{  -110,  -110,  -170,  -420,  -170}
-    ,{   690,   150,  -140,   690,  -140}
-    ,{   780,   780,   490,   470,   490}
-    ,{   690,   150,  -140,   690,  -140}
-    }
-   ,{{   770,   240,   -50,   770,   -50}
-    ,{   770,   240,   -50,   770,   -50}
-    ,{   160,  -370,  -670,   160,  -670}
-    ,{   770,   240,   -50,   770,   -50}
-    ,{   190,   190,  -340,  -360,  -340}
-    }
-   }
-  ,{{{   780,   780,   490,  -600,   490}
-    ,{   600,   600,   310,  -600,   310}
-    ,{   150,   150,  -140, -1030,  -140}
-    ,{   780,   780,   490,  -970,   490}
-    ,{   190,   190,  -140, -1030,  -140}
-    }
-   ,{{   600,   600,   310,  -600,   310}
-    ,{   600,   600,   310,  -600,   310}
-    ,{   150,   150,  -140, -1050,  -140}
-    ,{  -580,  -580,  -880, -1790,  -880}
-    ,{   150,   150,  -140, -1050,  -140}
-    }
-   ,{{   240,   240,   -50,  -970,   -50}
-    ,{   240,   240,   -50,  -970,   -50}
-    ,{   -60,   -60,  -360, -1030,  -360}
-    ,{   240,   240,   -50,  -970,   -50}
-    ,{   -60,   -60,  -360, -1030,  -360}
-    }
-   ,{{   780,   780,   490, -1050,   490}
-    ,{  -110,  -110,  -400, -1320,  -400}
-    ,{   150,   150,  -140, -1050,  -140}
-    ,{   780,   780,   490, -1680,   490}
-    ,{   150,   150,  -140, -1050,  -140}
-    }
-   ,{{   240,   240,   -50,  -970,   -50}
-    ,{   240,   240,   -50,  -970,   -50}
-    ,{  -370,  -370,  -670, -1340,  -670}
-    ,{   240,   240,   -50,  -970,   -50}
-    ,{   190,   190,  -340, -1260,  -340}
-    }
-   }
-  ,{{{   480,   470,   480,   470,   480}
-    ,{   300,   290,   300,   290,   300}
-    ,{  -140,  -150,  -140,  -150,  -140}
-    ,{   480,   470,   480,   470,   480}
-    ,{  -140,  -150,  -140,  -150,  -140}
-    }
-   ,{{   300,   290,   300,   290,   300}
-    ,{   300,   290,   300,   290,   300}
-    ,{  -140,  -150,  -140,  -150,  -140}
-    ,{  -640,  -890,  -640,  -890,  -640}
-    ,{  -140,  -150,  -140,  -150,  -140}
-    }
-   ,{{   -60,   -70,   -60,   -70,   -60}
-    ,{   -60,   -70,   -60,   -70,   -60}
-    ,{  -360,  -370,  -360,  -370,  -360}
-    ,{   -60,   -70,   -60,   -70,   -60}
-    ,{  -360,  -370,  -360,  -370,  -360}
-    }
-   ,{{   480,   470,   480,   470,   480}
-    ,{  -170,  -420,  -170,  -420,  -170}
-    ,{  -140,  -150,  -140,  -150,  -140}
-    ,{   480,   470,   480,   470,   480}
-    ,{  -140,  -150,  -140,  -150,  -140}
-    }
-   ,{{   -60,   -70,   -60,   -70,   -60}
-    ,{   -60,   -70,   -60,   -70,   -60}
-    ,{  -670,  -680,  -670,  -680,  -670}
-    ,{   -60,   -70,   -60,   -70,   -60}
-    ,{  -350,  -360,  -350,  -360,  -350}
-    }
-   }
-  ,{{{  1140,  -780,   490,  1140,   490}
-    ,{  1140,  -780,   310,  1140,   310}
-    ,{   690, -1210,  -140,   690,  -140}
-    ,{   770, -1150,   490,   770,   490}
-    ,{   690, -1210,  -140,   690,  -140}
-    }
-   ,{{  1140,  -780,   310,  1140,   310}
-    ,{  1140,  -780,   310,  1140,   310}
-    ,{   690, -1230,  -140,   690,  -140}
-    ,{  -880, -1970,  -880, -1300,  -880}
-    ,{   690, -1230,  -140,   690,  -140}
-    }
-   ,{{   770, -1150,   -50,   770,   -50}
-    ,{   770, -1150,   -50,   770,   -50}
-    ,{   470, -1210,  -360,   470,  -360}
-    ,{   770, -1150,   -50,   770,   -50}
-    ,{   470, -1210,  -360,   470,  -360}
-    }
-   ,{{   690, -1230,   490,   690,   490}
-    ,{  -400, -1500,  -400,  -830,  -400}
-    ,{   690, -1230,  -140,   690,  -140}
-    ,{   490, -1860,   490, -1190,   490}
-    ,{   690, -1230,  -140,   690,  -140}
-    }
-   ,{{   770, -1150,   -50,   770,   -50}
-    ,{   770, -1150,   -50,   770,   -50}
-    ,{   160, -1520,  -670,   160,  -670}
-    ,{   770, -1150,   -50,   770,   -50}
-    ,{  -340, -1440,  -340,  -770,  -340}
-    }
-   }
-  ,{{{   480,   470,   480,   470,  -430}
-    ,{   300,   290,   300,   290,  -430}
-    ,{  -140,  -150,  -140,  -150, -1120}
-    ,{   480,   470,   480,   470, -1040}
-    ,{  -140,  -150,  -140,  -150, -1120}
-    }
-   ,{{   300,   290,   300,   290,  -430}
-    ,{   300,   290,   300,   290,  -430}
-    ,{  -140,  -150,  -140,  -150, -1120}
-    ,{  -640,  -890,  -640,  -890, -1860}
-    ,{  -140,  -150,  -140,  -150, -1120}
-    }
-   ,{{   -60,   -70,   -60,   -70, -1040}
-    ,{   -60,   -70,   -60,   -70, -1040}
-    ,{  -360,  -370,  -360,  -370, -1340}
-    ,{   -60,   -70,   -60,   -70, -1040}
-    ,{  -360,  -370,  -360,  -370, -1340}
-    }
-   ,{{   480,   470,   480,   470, -1120}
-    ,{  -170,  -420,  -170,  -420, -1390}
-    ,{  -140,  -150,  -140,  -150, -1120}
-    ,{   480,   470,   480,   470, -1750}
-    ,{  -140,  -150,  -140,  -150, -1120}
-    }
-   ,{{   -60,   -70,   -60,   -70, -1040}
-    ,{   -60,   -70,   -60,   -70, -1040}
-    ,{  -670,  -680,  -670,  -680, -1650}
-    ,{   -60,   -70,   -60,   -70, -1040}
-    ,{  -350,  -360,  -350,  -360, -1330}
-    }
-   }
-  }
- ,{{{{   940,   940,   650,   630,   650}
-    ,{   220,  -130,  -190,   220,  -190}
-    ,{   220,  -310,  -600,   220,  -600}
-    ,{   940,   940,   650,   630,   650}
-    ,{   220,   -70,  -600,   220,  -600}
-    }
-   ,{{   220,  -310,  -380,   220,  -380}
-    ,{    40,  -490,  -780,    40,  -780}
-    ,{   220,  -310,  -600,   220,  -600}
-    ,{  -320,  -320,  -380,  -630,  -380}
-    ,{   220,  -310,  -600,   220,  -600}
-    }
-   ,{{   220,  -310,  -600,   220,  -600}
-    ,{   220,  -310,  -600,   220,  -600}
-    ,{   220,  -310,  -600,   220,  -600}
-    ,{   220,  -310,  -600,   220,  -600}
-    ,{   220,  -310,  -600,   220,  -600}
-    }
-   ,{{   940,   940,   650,   630,   650}
-    ,{  -130,  -130,  -190,  -440,  -190}
-    ,{   220,  -310,  -600,   220,  -600}
-    ,{   940,   940,   650,   630,   650}
-    ,{   220,  -310,  -600,   220,  -600}
-    }
-   ,{{   220,   -70,  -600,   220,  -600}
-    ,{   220,  -310,  -600,   220,  -600}
-    ,{   220,  -310,  -600,   220,  -600}
-    ,{   220,  -310,  -600,   220,  -600}
-    ,{   -70,   -70,  -600,  -620,  -600}
-    }
-   }
-  ,{{{   940,   940,   650, -1280,   650}
-    ,{  -130,  -130,  -430, -1340,  -430}
-    ,{  -310,  -310,  -600, -1280,  -600}
-    ,{   940,   940,   650, -1520,   650}
-    ,{   -70,   -70,  -600, -1280,  -600}
-    }
-   ,{{  -310,  -310,  -600, -1520,  -600}
-    ,{  -490,  -490,  -780, -1700,  -780}
-    ,{  -310,  -310,  -600, -1520,  -600}
-    ,{  -320,  -320,  -620, -1530,  -620}
-    ,{  -310,  -310,  -600, -1520,  -600}
-    }
-   ,{{  -310,  -310,  -600, -1280,  -600}
-    ,{  -310,  -310,  -600, -1520,  -600}
-    ,{  -310,  -310,  -600, -1280,  -600}
-    ,{  -310,  -310,  -600, -1520,  -600}
-    ,{  -310,  -310,  -600, -1280,  -600}
-    }
-   ,{{   940,   940,   650, -1340,   650}
-    ,{  -130,  -130,  -430, -1340,  -430}
-    ,{  -310,  -310,  -600, -1520,  -600}
-    ,{   940,   940,   650, -1520,   650}
-    ,{  -310,  -310,  -600, -1520,  -600}
-    }
-   ,{{   -70,   -70,  -600, -1280,  -600}
-    ,{  -310,  -310,  -600, -1520,  -600}
-    ,{  -310,  -310,  -600, -1280,  -600}
-    ,{  -310,  -310,  -600, -1520,  -600}
-    ,{   -70,   -70,  -600, -1520,  -600}
-    }
-   }
-  ,{{{   640,   630,   640,   630,   640}
-    ,{  -190,  -440,  -190,  -440,  -190}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    ,{   640,   630,   640,   630,   640}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    }
-   ,{{  -380,  -620,  -380,  -620,  -380}
-    ,{  -790,  -800,  -790,  -800,  -790}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    ,{  -380,  -630,  -380,  -630,  -380}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    }
-   ,{{  -610,  -620,  -610,  -620,  -610}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    }
-   ,{{   640,   630,   640,   630,   640}
-    ,{  -190,  -440,  -190,  -440,  -190}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    ,{   640,   630,   640,   630,   640}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    }
-   ,{{  -610,  -620,  -610,  -620,  -610}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    ,{  -610,  -620,  -610,  -620,  -610}
-    }
-   }
-  ,{{{   650, -1460,   650,   220,   650}
-    ,{   220, -1520,  -430,   220,  -430}
-    ,{   220, -1460,  -600,   220,  -600}
-    ,{   650, -1700,   650,   220,   650}
-    ,{   220, -1460,  -600,   220,  -600}
-    }
-   ,{{   220, -1700,  -600,   220,  -600}
-    ,{    40, -1880,  -780,    40,  -780}
-    ,{   220, -1700,  -600,   220,  -600}
-    ,{  -620, -1710,  -620, -1040,  -620}
-    ,{   220, -1700,  -600,   220,  -600}
-    }
-   ,{{   220, -1460,  -600,   220,  -600}
-    ,{   220, -1700,  -600,   220,  -600}
-    ,{   220, -1460,  -600,   220,  -600}
-    ,{   220, -1700,  -600,   220,  -600}
-    ,{   220, -1460,  -600,   220,  -600}
-    }
-   ,{{   650, -1520,   650,   220,   650}
-    ,{  -430, -1520,  -430,  -850,  -430}
-    ,{   220, -1700,  -600,   220,  -600}
-    ,{   650, -1700,   650, -1030,   650}
-    ,{   220, -1700,  -600,   220,  -600}
-    }
-   ,{{   220, -1460,  -600,   220,  -600}
-    ,{   220, -1700,  -600,   220,  -600}
-    ,{   220, -1460,  -600,   220,  -600}
-    ,{   220, -1700,  -600,   220,  -600}
-    ,{  -600, -1700,  -600, -1030,  -600}
-    }
-   }
-  ,{{{   640,   630,   640,   630, -1410}
-    ,{  -190,  -440,  -190,  -440, -1410}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    ,{   640,   630,   640,   630, -1590}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    }
-   ,{{  -380,  -620,  -380,  -620, -1530}
-    ,{  -790,  -800,  -790,  -800, -1530}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    ,{  -380,  -630,  -380,  -630, -1600}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    }
-   ,{{  -610,  -620,  -610,  -620, -1590}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    }
-   ,{{   640,   630,   640,   630, -1410}
-    ,{  -190,  -440,  -190,  -440, -1410}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    ,{   640,   630,   640,   630, -1590}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    }
-   ,{{  -610,  -620,  -610,  -620, -1590}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    ,{  -610,  -620,  -610,  -620, -1590}
-    }
-   }
-  }
- ,{{{{  1490,  1490,  1200,  1280,  1200}
-    ,{  1280,   750,   460,  1280,   460}
-    ,{   780,   240,   -50,   780,   -50}
-    ,{  1490,  1490,  1200,  1190,  1200}
-    ,{   780,   480,   -50,   780,   -50}
-    }
-   ,{{  1280,   750,   460,  1280,   460}
-    ,{  1280,   750,   460,  1280,   460}
-    ,{   780,   240,   -50,   780,   -50}
-    ,{   -90,   -90,  -150,  -400,  -150}
-    ,{   780,   240,   -50,   780,   -50}
-    }
-   ,{{   780,   240,   -50,   780,   -50}
-    ,{   780,   240,   -50,   780,   -50}
-    ,{   780,   240,   -50,   780,   -50}
-    ,{   780,   240,   -50,   780,   -50}
-    ,{   780,   240,   -50,   780,   -50}
-    }
-   ,{{  1490,  1490,  1200,  1190,  1200}
-    ,{  -260,  -260,  -320,  -570,  -320}
-    ,{   780,   240,   -50,   780,   -50}
-    ,{  1490,  1490,  1200,  1190,  1200}
-    ,{   780,   240,   -50,   780,   -50}
-    }
-   ,{{   780,   480,   -50,   780,   -50}
-    ,{   780,   240,   -50,   780,   -50}
-    ,{   780,   240,   -50,   780,   -50}
-    ,{   780,   240,   -50,   780,   -50}
-    ,{   480,   480,   -50,   -60,   -50}
-    }
-   }
-  ,{{{  1490,  1490,  1200,  -450,  1200}
-    ,{   750,   750,   460,  -450,   460}
-    ,{   240,   240,   -50,  -720,   -50}
-    ,{  1490,  1490,  1200,  -960,  1200}
-    ,{   480,   480,   -50,  -720,   -50}
-    }
-   ,{{   750,   750,   460,  -450,   460}
-    ,{   750,   750,   460,  -450,   460}
-    ,{   240,   240,   -50,  -960,   -50}
-    ,{   -90,   -90,  -390, -1300,  -390}
-    ,{   240,   240,   -50,  -960,   -50}
-    }
-   ,{{   240,   240,   -50,  -720,   -50}
-    ,{   240,   240,   -50,  -960,   -50}
-    ,{   240,   240,   -50,  -720,   -50}
-    ,{   240,   240,   -50,  -960,   -50}
-    ,{   240,   240,   -50,  -720,   -50}
-    }
-   ,{{  1490,  1490,  1200,  -960,  1200}
-    ,{  -260,  -260,  -560, -1470,  -560}
-    ,{   240,   240,   -50,  -960,   -50}
-    ,{  1490,  1490,  1200,  -960,  1200}
-    ,{   240,   240,   -50,  -960,   -50}
-    }
-   ,{{   480,   480,   -50,  -720,   -50}
-    ,{   240,   240,   -50,  -960,   -50}
-    ,{   240,   240,   -50,  -720,   -50}
-    ,{   240,   240,   -50,  -960,   -50}
-    ,{   480,   480,   -50,  -960,   -50}
-    }
-   }
-  ,{{{  1200,  1190,  1200,  1190,  1200}
-    ,{   450,   440,   450,   440,   450}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    ,{  1200,  1190,  1200,  1190,  1200}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    }
-   ,{{   450,   440,   450,   440,   450}
-    ,{   450,   440,   450,   440,   450}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    ,{  -150,  -400,  -150,  -400,  -150}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    }
-   ,{{   -50,   -60,   -50,   -60,   -50}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    }
-   ,{{  1200,  1190,  1200,  1190,  1200}
-    ,{  -320,  -570,  -320,  -570,  -320}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    ,{  1200,  1190,  1200,  1190,  1200}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    }
-   ,{{   -50,   -60,   -50,   -60,   -50}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    ,{   -50,   -60,   -50,   -60,   -50}
-    }
-   }
-  ,{{{  1280,  -630,  1200,  1280,  1200}
-    ,{  1280,  -630,   460,  1280,   460}
-    ,{   780,  -900,   -50,   780,   -50}
-    ,{  1200, -1140,  1200,   780,  1200}
-    ,{   780,  -900,   -50,   780,   -50}
-    }
-   ,{{  1280,  -630,   460,  1280,   460}
-    ,{  1280,  -630,   460,  1280,   460}
-    ,{   780, -1140,   -50,   780,   -50}
-    ,{  -390, -1480,  -390,  -810,  -390}
-    ,{   780, -1140,   -50,   780,   -50}
-    }
-   ,{{   780,  -900,   -50,   780,   -50}
-    ,{   780, -1140,   -50,   780,   -50}
-    ,{   780,  -900,   -50,   780,   -50}
-    ,{   780, -1140,   -50,   780,   -50}
-    ,{   780,  -900,   -50,   780,   -50}
-    }
-   ,{{  1200, -1140,  1200,   780,  1200}
-    ,{  -560, -1650,  -560,  -980,  -560}
-    ,{   780, -1140,   -50,   780,   -50}
-    ,{  1200, -1140,  1200,  -470,  1200}
-    ,{   780, -1140,   -50,   780,   -50}
-    }
-   ,{{   780,  -900,   -50,   780,   -50}
-    ,{   780, -1140,   -50,   780,   -50}
-    ,{   780,  -900,   -50,   780,   -50}
-    ,{   780, -1140,   -50,   780,   -50}
-    ,{   -50, -1140,   -50,  -470,   -50}
-    }
-   }
-  ,{{{  1200,  1190,  1200,  1190,  -280}
-    ,{   450,   440,   450,   440,  -280}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    ,{  1200,  1190,  1200,  1190, -1030}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    }
-   ,{{   450,   440,   450,   440,  -280}
-    ,{   450,   440,   450,   440,  -280}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    ,{  -150,  -400,  -150,  -400, -1370}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    }
-   ,{{   -50,   -60,   -50,   -60, -1030}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    }
-   ,{{  1200,  1190,  1200,  1190, -1030}
-    ,{  -320,  -570,  -320,  -570, -1540}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    ,{  1200,  1190,  1200,  1190, -1030}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    }
-   ,{{   -50,   -60,   -50,   -60, -1030}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    ,{   -50,   -60,   -50,   -60, -1030}
-    }
-   }
-  }
- ,{{{{  1870,  1870,  1570,  1870,  1570}
-    ,{  1870,  1340,  1040,  1870,  1040}
-    ,{  1570,  1040,   740,  1570,   740}
-    ,{  1870,  1870,  1570,  1570,  1570}
-    ,{  1570,  1040,   740,  1570,   740}
-    }
-   ,{{  1870,  1340,  1040,  1870,  1040}
-    ,{  1870,  1340,  1040,  1870,  1040}
-    ,{  1560,  1030,   730,  1560,   730}
-    ,{   -50,   -50,  -110,  -360,  -110}
-    ,{  1560,  1030,   730,  1560,   730}
-    }
-   ,{{  1570,  1040,   750,  1570,   750}
-    ,{  1570,  1040,   750,  1570,   750}
-    ,{  1570,  1040,   740,  1570,   740}
-    ,{  1570,  1040,   750,  1570,   750}
-    ,{  1570,  1040,   740,  1570,   740}
-    }
-   ,{{  1870,  1870,  1570,  1560,  1570}
-    ,{   130,   130,    70,  -180,    70}
-    ,{  1560,  1030,   730,  1560,   730}
-    ,{  1870,  1870,  1570,  1560,  1570}
-    ,{  1560,  1030,   730,  1560,   730}
-    }
-   ,{{  1570,  1040,   750,  1570,   750}
-    ,{  1570,  1040,   750,  1570,   750}
-    ,{  1570,  1040,   740,  1570,   740}
-    ,{  1570,  1040,   750,  1570,   750}
-    ,{   300,   300,  -230,  -250,  -230}
-    }
-   }
-  ,{{{  1870,  1870,  1570,   130,  1570}
-    ,{  1340,  1340,  1040,   130,  1040}
-    ,{  1040,  1040,   740,    70,   740}
-    ,{  1870,  1870,  1570,  -160,  1570}
-    ,{  1040,  1040,   740,    70,   740}
-    }
-   ,{{  1340,  1340,  1040,   130,  1040}
-    ,{  1340,  1340,  1040,   130,  1040}
-    ,{  1030,  1030,   730,  -180,   730}
-    ,{   -50,   -50,  -340, -1260,  -340}
-    ,{  1030,  1030,   730,  -180,   730}
-    }
-   ,{{  1040,  1040,   750,    70,   750}
-    ,{  1040,  1040,   750,  -160,   750}
-    ,{  1040,  1040,   740,    70,   740}
-    ,{  1040,  1040,   750,  -160,   750}
-    ,{  1040,  1040,   740,    70,   740}
-    }
-   ,{{  1870,  1870,  1570,  -180,  1570}
-    ,{   130,   130,  -160, -1080,  -160}
-    ,{  1030,  1030,   730,  -180,   730}
-    ,{  1870,  1870,  1570,  -590,  1570}
-    ,{  1030,  1030,   730,  -180,   730}
-    }
-   ,{{  1040,  1040,   750,    70,   750}
-    ,{  1040,  1040,   750,  -160,   750}
-    ,{  1040,  1040,   740,    70,   740}
-    ,{  1040,  1040,   750,  -160,   750}
-    ,{   300,   300,  -230, -1150,  -230}
-    }
-   }
-  ,{{{  1570,  1560,  1570,  1560,  1570}
-    ,{  1040,  1030,  1040,  1030,  1040}
-    ,{   740,   730,   740,   730,   740}
-    ,{  1570,  1560,  1570,  1560,  1570}
-    ,{   740,   730,   740,   730,   740}
-    }
-   ,{{  1040,  1030,  1040,  1030,  1040}
-    ,{  1040,  1030,  1040,  1030,  1040}
-    ,{   730,   720,   730,   720,   730}
-    ,{  -110,  -360,  -110,  -360,  -110}
-    ,{   730,   720,   730,   720,   730}
-    }
-   ,{{   740,   730,   740,   730,   740}
-    ,{   740,   730,   740,   730,   740}
-    ,{   740,   730,   740,   730,   740}
-    ,{   740,   730,   740,   730,   740}
-    ,{   740,   730,   740,   730,   740}
-    }
-   ,{{  1570,  1560,  1570,  1560,  1570}
-    ,{    70,  -180,    70,  -180,    70}
-    ,{   730,   720,   730,   720,   730}
-    ,{  1570,  1560,  1570,  1560,  1570}
-    ,{   730,   720,   730,   720,   730}
-    }
-   ,{{   740,   730,   740,   730,   740}
-    ,{   740,   730,   740,   730,   740}
-    ,{   740,   730,   740,   730,   740}
-    ,{   740,   730,   740,   730,   740}
-    ,{  -240,  -250,  -240,  -250,  -240}
-    }
-   }
-  ,{{{  1870,   -50,  1570,  1870,  1570}
-    ,{  1870,   -50,  1040,  1870,  1040}
-    ,{  1570,  -110,   740,  1570,   740}
-    ,{  1570,  -340,  1570,  1570,  1570}
-    ,{  1570,  -110,   740,  1570,   740}
-    }
-   ,{{  1870,   -50,  1040,  1870,  1040}
-    ,{  1870,   -50,  1040,  1870,  1040}
-    ,{  1560,  -360,   730,  1560,   730}
-    ,{  -340, -1440,  -340,  -770,  -340}
-    ,{  1560,  -360,   730,  1560,   730}
-    }
-   ,{{  1570,  -110,   750,  1570,   750}
-    ,{  1570,  -340,   750,  1570,   750}
-    ,{  1570,  -110,   740,  1570,   740}
-    ,{  1570,  -340,   750,  1570,   750}
-    ,{  1570,  -110,   740,  1570,   740}
-    }
-   ,{{  1570,  -360,  1570,  1560,  1570}
-    ,{  -160, -1260,  -160,  -590,  -160}
-    ,{  1560,  -360,   730,  1560,   730}
-    ,{  1570,  -770,  1570,  -100,  1570}
-    ,{  1560,  -360,   730,  1560,   730}
-    }
-   ,{{  1570,  -110,   750,  1570,   750}
-    ,{  1570,  -340,   750,  1570,   750}
-    ,{  1570,  -110,   740,  1570,   740}
-    ,{  1570,  -340,   750,  1570,   750}
-    ,{  -230, -1330,  -230,  -660,  -230}
-    }
-   }
-  ,{{{  1570,  1560,  1570,  1560,   300}
-    ,{  1040,  1030,  1040,  1030,   300}
-    ,{   740,   730,   740,   730,  -240}
-    ,{  1570,  1560,  1570,  1560,  -230}
-    ,{   740,   730,   740,   730,  -240}
-    }
-   ,{{  1040,  1030,  1040,  1030,   300}
-    ,{  1040,  1030,  1040,  1030,   300}
-    ,{   730,   720,   730,   720,  -250}
-    ,{  -110,  -360,  -110,  -360, -1330}
-    ,{   730,   720,   730,   720,  -250}
-    }
-   ,{{   740,   730,   740,   730,  -230}
-    ,{   740,   730,   740,   730,  -230}
-    ,{   740,   730,   740,   730,  -240}
-    ,{   740,   730,   740,   730,  -230}
-    ,{   740,   730,   740,   730,  -240}
-    }
-   ,{{  1570,  1560,  1570,  1560,  -250}
-    ,{    70,  -180,    70,  -180, -1150}
-    ,{   730,   720,   730,   720,  -250}
-    ,{  1570,  1560,  1570,  1560,  -660}
-    ,{   730,   720,   730,   720,  -250}
-    }
-   ,{{   740,   730,   740,   730,  -230}
-    ,{   740,   730,   740,   730,  -230}
-    ,{   740,   730,   740,   730,  -240}
-    ,{   740,   730,   740,   730,  -230}
-    ,{  -240,  -250,  -240,  -250, -1220}
-    }
-   }
-  }
- ,{{{{  2050,  2050,  1760,  1930,  1760}
-    ,{  1930,  1400,  1110,  1930,  1110}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{  2050,  2050,  1760,  1800,  1760}
-    ,{  1670,  1140,   850,  1670,   850}
-    }
-   ,{{  1930,  1400,  1110,  1930,  1110}
-    ,{  1930,  1400,  1110,  1930,  1110}
-    ,{  1650,  1120,   830,  1650,   830}
-    ,{     0,     0,   -60,  -310,   -60}
-    ,{  1650,  1120,   830,  1650,   830}
-    }
-   ,{{  1800,  1270,   980,  1800,   980}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{  1670,  1140,   850,  1670,   850}
-    }
-   ,{{  2050,  2050,  1760,  1740,  1760}
-    ,{  -300,  -300,  -360,  -610,  -360}
-    ,{  1650,  1120,   830,  1650,   830}
-    ,{  2050,  2050,  1760,  1740,  1760}
-    ,{  1650,  1120,   830,  1650,   830}
-    }
-   ,{{  1800,  1270,   980,  1800,   980}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{  1360,   830,   540,  1360,   540}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{   570,   570,    40,    20,    40}
-    }
-   }
-  ,{{{  2050,  2050,  1760,   300,  1760}
-    ,{  1400,  1400,  1110,   190,  1110}
-    ,{  1270,  1270,   980,   300,   980}
-    ,{  2050,  2050,  1760,    60,  1760}
-    ,{  1140,  1140,   850,   180,   850}
-    }
-   ,{{  1400,  1400,  1110,   190,  1110}
-    ,{  1400,  1400,  1110,   190,  1110}
-    ,{  1120,  1120,   830,   -80,   830}
-    ,{     0,     0,  -290, -1210,  -290}
-    ,{  1120,  1120,   830,   -80,   830}
-    }
-   ,{{  1270,  1270,   980,   300,   980}
-    ,{  1270,  1270,   980,    60,   980}
-    ,{  1270,  1270,   980,   300,   980}
-    ,{  1270,  1270,   980,    60,   980}
-    ,{  1140,  1140,   850,   180,   850}
-    }
-   ,{{  2050,  2050,  1760,   -80,  1760}
-    ,{  -300,  -300,  -590, -1510,  -590}
-    ,{  1120,  1120,   830,   -80,   830}
-    ,{  2050,  2050,  1760,  -400,  1760}
-    ,{  1120,  1120,   830,   -80,   830}
-    }
-   ,{{  1270,  1270,   980,    60,   980}
-    ,{  1270,  1270,   980,    60,   980}
-    ,{   830,   830,   540,  -130,   540}
-    ,{  1270,  1270,   980,    60,   980}
-    ,{   570,   570,    40,  -870,    40}
-    }
-   }
-  ,{{{  1750,  1740,  1750,  1740,  1750}
-    ,{  1100,  1090,  1100,  1090,  1100}
-    ,{   970,   960,   970,   960,   970}
-    ,{  1750,  1740,  1750,  1740,  1750}
-    ,{   840,   830,   840,   830,   840}
-    }
-   ,{{  1100,  1090,  1100,  1090,  1100}
-    ,{  1100,  1090,  1100,  1090,  1100}
-    ,{   820,   810,   820,   810,   820}
-    ,{   -60,  -310,   -60,  -310,   -60}
-    ,{   820,   810,   820,   810,   820}
-    }
-   ,{{   970,   960,   970,   960,   970}
-    ,{   970,   960,   970,   960,   970}
-    ,{   970,   960,   970,   960,   970}
-    ,{   970,   960,   970,   960,   970}
-    ,{   840,   830,   840,   830,   840}
-    }
-   ,{{  1750,  1740,  1750,  1740,  1750}
-    ,{  -360,  -610,  -360,  -610,  -360}
-    ,{   820,   810,   820,   810,   820}
-    ,{  1750,  1740,  1750,  1740,  1750}
-    ,{   820,   810,   820,   810,   820}
-    }
-   ,{{   970,   960,   970,   960,   970}
-    ,{   970,   960,   970,   960,   970}
-    ,{   530,   520,   530,   520,   530}
-    ,{   970,   960,   970,   960,   970}
-    ,{    30,    20,    30,    20,    30}
-    }
-   }
-  ,{{{  1930,   130,  1760,  1930,  1760}
-    ,{  1930,    10,  1110,  1930,  1110}
-    ,{  1800,   130,   980,  1800,   980}
-    ,{  1800,  -110,  1760,  1800,  1760}
-    ,{  1670,     0,   850,  1670,   850}
-    }
-   ,{{  1930,    10,  1110,  1930,  1110}
-    ,{  1930,    10,  1110,  1930,  1110}
-    ,{  1650,  -260,   830,  1650,   830}
-    ,{  -290, -1390,  -290,  -720,  -290}
-    ,{  1650,  -260,   830,  1650,   830}
-    }
-   ,{{  1800,   130,   980,  1800,   980}
-    ,{  1800,  -110,   980,  1800,   980}
-    ,{  1800,   130,   980,  1800,   980}
-    ,{  1800,  -110,   980,  1800,   980}
-    ,{  1670,     0,   850,  1670,   850}
-    }
-   ,{{  1760,  -260,  1760,  1650,  1760}
-    ,{  -590, -1690,  -590, -1020,  -590}
-    ,{  1650,  -260,   830,  1650,   830}
-    ,{  1760,  -580,  1760,    80,  1760}
-    ,{  1650,  -260,   830,  1650,   830}
-    }
-   ,{{  1800,  -110,   980,  1800,   980}
-    ,{  1800,  -110,   980,  1800,   980}
-    ,{  1360,  -310,   540,  1360,   540}
-    ,{  1800,  -110,   980,  1800,   980}
-    ,{    40, -1050,    40,  -380,    40}
-    }
-   }
-  ,{{{  1750,  1740,  1750,  1740,   360}
-    ,{  1100,  1090,  1100,  1090,   360}
-    ,{   970,   960,   970,   960,     0}
-    ,{  1750,  1740,  1750,  1740,     0}
-    ,{   840,   830,   840,   830,  -130}
-    }
-   ,{{  1100,  1090,  1100,  1090,   360}
-    ,{  1100,  1090,  1100,  1090,   360}
-    ,{   820,   810,   820,   810,  -150}
-    ,{   -60,  -310,   -60,  -310, -1280}
-    ,{   820,   810,   820,   810,  -150}
-    }
-   ,{{   970,   960,   970,   960,     0}
-    ,{   970,   960,   970,   960,     0}
-    ,{   970,   960,   970,   960,     0}
-    ,{   970,   960,   970,   960,     0}
-    ,{   840,   830,   840,   830,  -130}
-    }
-   ,{{  1750,  1740,  1750,  1740,  -150}
-    ,{  -360,  -610,  -360,  -610, -1580}
-    ,{   820,   810,   820,   810,  -150}
-    ,{  1750,  1740,  1750,  1740,  -470}
-    ,{   820,   810,   820,   810,  -150}
-    }
-   ,{{   970,   960,   970,   960,     0}
-    ,{   970,   960,   970,   960,     0}
-    ,{   530,   520,   530,   520,  -440}
-    ,{   970,   960,   970,   960,     0}
-    ,{    30,    20,    30,    20,  -940}
-    }
-   }
-  }
- ,{{{{  2050,  2050,  1760,  1930,  1760}
-    ,{  1930,  1400,  1110,  1930,  1110}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{  2050,  2050,  1760,  1800,  1760}
-    ,{  1670,  1140,   850,  1670,   850}
-    }
-   ,{{  1930,  1400,  1110,  1930,  1110}
-    ,{  1930,  1400,  1110,  1930,  1110}
-    ,{  1650,  1120,   830,  1650,   830}
-    ,{   220,   220,   170,   -80,   170}
-    ,{  1650,  1120,   830,  1650,   830}
-    }
-   ,{{  1800,  1270,   980,  1800,   980}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{  1670,  1140,   850,  1670,   850}
-    }
-   ,{{  2050,  2050,  1760,  1740,  1760}
-    ,{   130,   130,    70,  -180,    70}
-    ,{  1650,  1120,   830,  1650,   830}
-    ,{  2050,  2050,  1760,  1740,  1760}
-    ,{  1650,  1120,   830,  1650,   830}
-    }
-   ,{{  1800,  1270,   980,  1800,   980}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{  1570,  1040,   740,  1570,   740}
-    ,{  1800,  1270,   980,  1800,   980}
-    ,{   570,   570,    40,    20,    40}
-    }
-   }
-  ,{{{  2050,  2050,  1760,   300,  1760}
-    ,{  1400,  1400,  1110,   190,  1110}
-    ,{  1270,  1270,   980,   300,   980}
-    ,{  2050,  2050,  1760,    60,  1760}
-    ,{  1140,  1140,   850,   180,   850}
-    }
-   ,{{  1400,  1400,  1110,   190,  1110}
-    ,{  1400,  1400,  1110,   190,  1110}
-    ,{  1120,  1120,   830,   -80,   830}
-    ,{   220,   220,   -70,  -980,   -70}
-    ,{  1120,  1120,   830,   -80,   830}
-    }
-   ,{{  1270,  1270,   980,   300,   980}
-    ,{  1270,  1270,   980,    60,   980}
-    ,{  1270,  1270,   980,   300,   980}
-    ,{  1270,  1270,   980,    60,   980}
-    ,{  1140,  1140,   850,   180,   850}
-    }
-   ,{{  2050,  2050,  1760,   -80,  1760}
-    ,{   130,   130,  -160, -1080,  -160}
-    ,{  1120,  1120,   830,   -80,   830}
-    ,{  2050,  2050,  1760,  -400,  1760}
-    ,{  1120,  1120,   830,   -80,   830}
-    }
-   ,{{  1270,  1270,   980,    70,   980}
-    ,{  1270,  1270,   980,    60,   980}
-    ,{  1040,  1040,   740,    70,   740}
-    ,{  1270,  1270,   980,    60,   980}
-    ,{   570,   570,    40,  -870,    40}
-    }
-   }
-  ,{{{  1750,  1740,  1750,  1740,  1750}
-    ,{  1100,  1090,  1100,  1090,  1100}
-    ,{   970,   960,   970,   960,   970}
-    ,{  1750,  1740,  1750,  1740,  1750}
-    ,{   840,   830,   840,   830,   840}
-    }
-   ,{{  1100,  1090,  1100,  1090,  1100}
-    ,{  1100,  1090,  1100,  1090,  1100}
-    ,{   820,   810,   820,   810,   820}
-    ,{   170,   -80,   170,   -80,   170}
-    ,{   820,   810,   820,   810,   820}
-    }
-   ,{{   970,   960,   970,   960,   970}
-    ,{   970,   960,   970,   960,   970}
-    ,{   970,   960,   970,   960,   970}
-    ,{   970,   960,   970,   960,   970}
-    ,{   840,   830,   840,   830,   840}
-    }
-   ,{{  1750,  1740,  1750,  1740,  1750}
-    ,{    70,  -180,    70,  -180,    70}
-    ,{   820,   810,   820,   810,   820}
-    ,{  1750,  1740,  1750,  1740,  1750}
-    ,{   820,   810,   820,   810,   820}
-    }
-   ,{{   970,   960,   970,   960,   970}
-    ,{   970,   960,   970,   960,   970}
-    ,{   740,   730,   740,   730,   740}
-    ,{   970,   960,   970,   960,   970}
-    ,{    30,    20,    30,    20,    30}
-    }
-   }
-  ,{{{  1930,   130,  1760,  1930,  1760}
-    ,{  1930,    10,  1110,  1930,  1110}
-    ,{  1800,   130,   980,  1800,   980}
-    ,{  1800,  -110,  1760,  1800,  1760}
-    ,{  1670,     0,   850,  1670,   850}
-    }
-   ,{{  1930,    10,  1110,  1930,  1110}
-    ,{  1930,    10,  1110,  1930,  1110}
-    ,{  1650,  -260,   830,  1650,   830}
-    ,{   -70, -1160,   -70,  -490,   -70}
-    ,{  1650,  -260,   830,  1650,   830}
-    }
-   ,{{  1800,   130,   980,  1800,   980}
-    ,{  1800,  -110,   980,  1800,   980}
-    ,{  1800,   130,   980,  1800,   980}
-    ,{  1800,  -110,   980,  1800,   980}
-    ,{  1670,     0,   850,  1670,   850}
-    }
-   ,{{  1760,  -260,  1760,  1650,  1760}
-    ,{  -160, -1260,  -160,  -590,  -160}
-    ,{  1650,  -260,   830,  1650,   830}
-    ,{  1760,  -580,  1760,    80,  1760}
-    ,{  1650,  -260,   830,  1650,   830}
-    }
-   ,{{  1800,  -110,   980,  1800,   980}
-    ,{  1800,  -110,   980,  1800,   980}
-    ,{  1570,  -110,   740,  1570,   740}
-    ,{  1800,  -110,   980,  1800,   980}
-    ,{    40, -1050,    40,  -380,    40}
-    }
-   }
-  ,{{{  1750,  1740,  1750,  1740,   360}
-    ,{  1100,  1090,  1100,  1090,   360}
-    ,{   970,   960,   970,   960,     0}
-    ,{  1750,  1740,  1750,  1740,     0}
-    ,{   840,   830,   840,   830,  -130}
-    }
-   ,{{  1100,  1090,  1100,  1090,   360}
-    ,{  1100,  1090,  1100,  1090,   360}
-    ,{   820,   810,   820,   810,  -150}
-    ,{   170,   -80,   170,   -80, -1050}
-    ,{   820,   810,   820,   810,  -150}
-    }
-   ,{{   970,   960,   970,   960,     0}
-    ,{   970,   960,   970,   960,     0}
-    ,{   970,   960,   970,   960,     0}
-    ,{   970,   960,   970,   960,     0}
-    ,{   840,   830,   840,   830,  -130}
-    }
-   ,{{  1750,  1740,  1750,  1740,  -150}
-    ,{    70,  -180,    70,  -180, -1150}
-    ,{   820,   810,   820,   810,  -150}
-    ,{  1750,  1740,  1750,  1740,  -470}
-    ,{   820,   810,   820,   810,  -150}
-    }
-   ,{{   970,   960,   970,   960,     0}
-    ,{   970,   960,   970,   960,     0}
-    ,{   740,   730,   740,   730,  -240}
-    ,{   970,   960,   970,   960,     0}
-    ,{    30,    20,    30,    20,  -940}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{  1350,   850,   720,  1350,   720}
-    ,{  1300,   650,   520,  1300,   520}
-    ,{  1350,   700,   570,  1350,   570}
-    ,{  1300,   850,   720,  1300,   720}
-    ,{  1250,   590,   460,  1250,   460}
-    }
-   ,{{  1160,   500,   400,  1160,   370}
-    ,{  1160,   500,   370,  1160,   370}
-    ,{   850,   190,    60,   850,    60}
-    ,{   400,   290,   400,    10,   160}
-    ,{   850,   190,    60,   850,    60}
-    }
-   ,{{  1300,   650,   520,  1300,   520}
-    ,{  1300,   650,   520,  1300,   520}
-    ,{  1290,   640,   510,  1290,   510}
-    ,{  1300,   650,   520,  1300,   520}
-    ,{  1250,   590,   460,  1250,   460}
-    }
-   ,{{   850,   850,   720,   850,   720}
-    ,{   120,     0,   120,  -270,  -120}
-    ,{   850,   190,    60,   850,    60}
-    ,{   850,   850,   720,   570,   720}
-    ,{   850,   190,    60,   850,    60}
-    }
-   ,{{  1350,   700,   570,  1350,   570}
-    ,{  1300,   650,   520,  1300,   520}
-    ,{  1350,   700,   570,  1350,   570}
-    ,{  1300,   650,   520,  1300,   520}
-    ,{   100,   100,  -270,  -420,  -270}
-    }
-   }
-  ,{{{   850,   850,   720,  -760,   720}
-    ,{   650,   650,   520, -1050,   520}
-    ,{   700,   700,   570,  -760,   570}
-    ,{   850,   850,   720, -1050,   720}
-    ,{   590,   590,   460,  -870,   460}
-    }
-   ,{{   500,   500,   370, -1200,   370}
-    ,{   500,   500,   370, -1200,   370}
-    ,{   190,   190,    60, -1510,    60}
-    ,{   290,   290,   160, -1410,   160}
-    ,{   190,   190,    60, -1510,    60}
-    }
-   ,{{   650,   650,   520,  -820,   520}
-    ,{   650,   650,   520, -1050,   520}
-    ,{   640,   640,   510,  -820,   510}
-    ,{   650,   650,   520, -1050,   520}
-    ,{   590,   590,   460,  -870,   460}
-    }
-   ,{{   850,   850,   720, -1510,   720}
-    ,{     0,     0,  -120, -1700,  -120}
-    ,{   190,   190,    60, -1510,    60}
-    ,{   850,   850,   720, -2110,   720}
-    ,{   190,   190,    60, -1510,    60}
-    }
-   ,{{   700,   700,   570,  -760,   570}
-    ,{   650,   650,   520, -1050,   520}
-    ,{   700,   700,   570,  -760,   570}
-    ,{   650,   650,   520, -1050,   520}
-    ,{   100,   100,  -270, -1840,  -270}
-    }
-   }
-  ,{{{   720,   570,   720,   570,   280}
-    ,{   520,   370,   520,   370,    80}
-    ,{   570,   420,   570,   420,   130}
-    ,{   720,   570,   720,   570,   280}
-    ,{   460,   310,   460,   310,    20}
-    }
-   ,{{   400,   220,   400,   220,   -40}
-    ,{   370,   220,   370,   220,   -60}
-    ,{    60,   -80,    60,   -80,  -370}
-    ,{   400,    10,   400,    10,   -40}
-    ,{    60,   -80,    60,   -80,  -370}
-    }
-   ,{{   520,   370,   520,   370,    80}
-    ,{   520,   370,   520,   370,    80}
-    ,{   510,   360,   510,   360,    70}
-    ,{   520,   370,   520,   370,    80}
-    ,{   460,   310,   460,   310,    20}
-    }
-   ,{{   720,   570,   720,   570,   280}
-    ,{   120,  -270,   120,  -270,  -320}
-    ,{    60,   -80,    60,   -80,  -370}
-    ,{   720,   570,   720,   570,   280}
-    ,{    60,   -80,    60,   -80,  -370}
-    }
-   ,{{   570,   420,   570,   420,   130}
-    ,{   520,   370,   520,   370,    80}
-    ,{   570,   420,   570,   420,   130}
-    ,{   520,   370,   520,   370,    80}
-    ,{  -270,  -420,  -270,  -420,  -710}
-    }
-   }
-  ,{{{  1350,  -460,   720,  1350,   720}
-    ,{  1300,  -750,   520,  1300,   520}
-    ,{  1350,  -460,   570,  1350,   570}
-    ,{  1300,  -750,   720,  1300,   720}
-    ,{  1250,  -570,   460,  1250,   460}
-    }
-   ,{{  1160,  -900,   370,  1160,   370}
-    ,{  1160,  -900,   370,  1160,   370}
-    ,{   850, -1210,    60,   850,    60}
-    ,{   160, -1110,   160,  -310,   160}
-    ,{   850, -1210,    60,   850,    60}
-    }
-   ,{{  1300,  -520,   520,  1300,   520}
-    ,{  1300,  -750,   520,  1300,   520}
-    ,{  1290,  -520,   510,  1290,   510}
-    ,{  1300,  -750,   520,  1300,   520}
-    ,{  1250,  -570,   460,  1250,   460}
-    }
-   ,{{   850, -1210,   720,   850,   720}
-    ,{  -120, -1400,  -120,  -590,  -120}
-    ,{   850, -1210,    60,   850,    60}
-    ,{   720, -1810,   720, -1000,   720}
-    ,{   850, -1210,    60,   850,    60}
-    }
-   ,{{  1350,  -460,   570,  1350,   570}
-    ,{  1300,  -750,   520,  1300,   520}
-    ,{  1350,  -460,   570,  1350,   570}
-    ,{  1300,  -750,   520,  1300,   520}
-    ,{  -270, -1540,  -270,  -740,  -270}
-    }
-   }
-  ,{{{   590,   570,   590,   570,  -320}
-    ,{   390,   370,   390,   370,  -320}
-    ,{   440,   420,   440,   420,  -360}
-    ,{   590,   570,   590,   570,  -420}
-    ,{   330,   310,   330,   310,  -470}
-    }
-   ,{{   270,   220,   270,   220,  -320}
-    ,{   240,   220,   240,   220,  -320}
-    ,{   -60,   -80,   -60,   -80,  -870}
-    ,{   270,    10,   270,    10,  -780}
-    ,{   -60,   -80,   -60,   -80,  -870}
-    }
-   ,{{   390,   370,   390,   370,  -420}
-    ,{   390,   370,   390,   370,  -420}
-    ,{   380,   360,   380,   360,  -420}
-    ,{   390,   370,   390,   370,  -420}
-    ,{   330,   310,   330,   310,  -470}
-    }
-   ,{{   590,   570,   590,   570,  -870}
-    ,{   -10,  -270,   -10,  -270, -1060}
-    ,{   -60,   -80,   -60,   -80,  -870}
-    ,{   590,   570,   590,   570, -1470}
-    ,{   -60,   -80,   -60,   -80,  -870}
-    }
-   ,{{   440,   420,   440,   420,  -360}
-    ,{   390,   370,   390,   370,  -420}
-    ,{   440,   420,   440,   420,  -360}
-    ,{   390,   370,   390,   370,  -420}
-    ,{  -400,  -420,  -400,  -420, -1210}
-    }
-   }
-  }
- ,{{{{  1320,   850,   720,  1320,   720}
-    ,{  1320,   670,   540,  1320,   540}
-    ,{   870,   220,    90,   870,    90}
-    ,{   960,   850,   720,   960,   720}
-    ,{   870,   250,    90,   870,    90}
-    }
-   ,{{  1320,   670,   540,  1320,   540}
-    ,{  1320,   670,   540,  1320,   540}
-    ,{   870,   220,    90,   870,    90}
-    ,{  -410,  -520,  -410,  -800,  -650}
-    ,{   870,   220,    90,   870,    90}
-    }
-   ,{{   960,   300,   170,   960,   170}
-    ,{   960,   300,   170,   960,   170}
-    ,{   650,     0,  -130,   650,  -130}
-    ,{   960,   300,   170,   960,   170}
-    ,{   650,     0,  -130,   650,  -130}
-    }
-   ,{{   870,   850,   720,   870,   720}
-    ,{    70,   -40,    70,  -320,  -170}
-    ,{   870,   220,    90,   870,    90}
-    ,{   850,   850,   720,   570,   720}
-    ,{   870,   220,    90,   870,    90}
-    }
-   ,{{   960,   300,   170,   960,   170}
-    ,{   960,   300,   170,   960,   170}
-    ,{   340,  -310,  -440,   340,  -440}
-    ,{   960,   300,   170,   960,   170}
-    ,{   250,   250,  -110,  -260,  -110}
-    }
-   }
-  ,{{{   850,   850,   720, -1030,   720}
-    ,{   670,   670,   540, -1030,   540}
-    ,{   220,   220,    90, -1460,    90}
-    ,{   850,   850,   720, -1400,   720}
-    ,{   250,   250,    90, -1460,    90}
-    }
-   ,{{   670,   670,   540, -1030,   540}
-    ,{   670,   670,   540, -1030,   540}
-    ,{   220,   220,    90, -1480,    90}
-    ,{  -520,  -520,  -650, -2220,  -650}
-    ,{   220,   220,    90, -1480,    90}
-    }
-   ,{{   300,   300,   170, -1400,   170}
-    ,{   300,   300,   170, -1400,   170}
-    ,{     0,     0,  -130, -1460,  -130}
-    ,{   300,   300,   170, -1400,   170}
-    ,{     0,     0,  -130, -1460,  -130}
-    }
-   ,{{   850,   850,   720, -1480,   720}
-    ,{   -40,   -40,  -170, -1750,  -170}
-    ,{   220,   220,    90, -1480,    90}
-    ,{   850,   850,   720, -2110,   720}
-    ,{   220,   220,    90, -1480,    90}
-    }
-   ,{{   300,   300,   170, -1400,   170}
-    ,{   300,   300,   170, -1400,   170}
-    ,{  -310,  -310,  -440, -1770,  -440}
-    ,{   300,   300,   170, -1400,   170}
-    ,{   250,   250,  -110, -1690,  -110}
-    }
-   }
-  ,{{{   720,   570,   720,   570,   280}
-    ,{   540,   390,   540,   390,   100}
-    ,{    90,   -60,    90,   -60,  -350}
-    ,{   720,   570,   720,   570,   280}
-    ,{    90,   -60,    90,   -60,  -350}
-    }
-   ,{{   540,   390,   540,   390,   100}
-    ,{   540,   390,   540,   390,   100}
-    ,{    90,   -60,    90,   -60,  -350}
-    ,{  -410,  -800,  -410,  -800,  -850}
-    ,{    90,   -60,    90,   -60,  -350}
-    }
-   ,{{   170,    20,   170,    20,  -260}
-    ,{   170,    20,   170,    20,  -260}
-    ,{  -130,  -280,  -130,  -280,  -570}
-    ,{   170,    20,   170,    20,  -260}
-    ,{  -130,  -280,  -130,  -280,  -570}
-    }
-   ,{{   720,   570,   720,   570,   280}
-    ,{    70,  -320,    70,  -320,  -370}
-    ,{    90,   -60,    90,   -60,  -350}
-    ,{   720,   570,   720,   570,   280}
-    ,{    90,   -60,    90,   -60,  -350}
-    }
-   ,{{   170,    20,   170,    20,  -260}
-    ,{   170,    20,   170,    20,  -260}
-    ,{  -440,  -590,  -440,  -590,  -880}
-    ,{   170,    20,   170,    20,  -260}
-    ,{  -110,  -260,  -110,  -260,  -550}
-    }
-   }
-  ,{{{  1320,  -730,   720,  1320,   720}
-    ,{  1320,  -730,   540,  1320,   540}
-    ,{   870, -1160,    90,   870,    90}
-    ,{   960, -1100,   720,   960,   720}
-    ,{   870, -1160,    90,   870,    90}
-    }
-   ,{{  1320,  -730,   540,  1320,   540}
-    ,{  1320,  -730,   540,  1320,   540}
-    ,{   870, -1180,    90,   870,    90}
-    ,{  -650, -1920,  -650, -1120,  -650}
-    ,{   870, -1180,    90,   870,    90}
-    }
-   ,{{   960, -1100,   170,   960,   170}
-    ,{   960, -1100,   170,   960,   170}
-    ,{   650, -1160,  -130,   650,  -130}
-    ,{   960, -1100,   170,   960,   170}
-    ,{   650, -1160,  -130,   650,  -130}
-    }
-   ,{{   870, -1180,   720,   870,   720}
-    ,{  -170, -1450,  -170,  -640,  -170}
-    ,{   870, -1180,    90,   870,    90}
-    ,{   720, -1810,   720, -1000,   720}
-    ,{   870, -1180,    90,   870,    90}
-    }
-   ,{{   960, -1100,   170,   960,   170}
-    ,{   960, -1100,   170,   960,   170}
-    ,{   340, -1470,  -440,   340,  -440}
-    ,{   960, -1100,   170,   960,   170}
-    ,{  -110, -1390,  -110,  -580,  -110}
-    }
-   }
-  ,{{{   590,   570,   590,   570,  -160}
-    ,{   410,   390,   410,   390,  -160}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    ,{   590,   570,   590,   570,  -760}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    }
-   ,{{   410,   390,   410,   390,  -160}
-    ,{   410,   390,   410,   390,  -160}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    ,{  -540,  -800,  -540,  -800, -1590}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    }
-   ,{{    40,    20,    40,    20,  -760}
-    ,{    40,    20,    40,    20,  -760}
-    ,{  -260,  -280,  -260,  -280, -1070}
-    ,{    40,    20,    40,    20,  -760}
-    ,{  -260,  -280,  -260,  -280, -1070}
-    }
-   ,{{   590,   570,   590,   570,  -850}
-    ,{   -60,  -320,   -60,  -320, -1110}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    ,{   590,   570,   590,   570, -1470}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    }
-   ,{{    40,    20,    40,    20,  -760}
-    ,{    40,    20,    40,    20,  -760}
-    ,{  -570,  -590,  -570,  -590, -1380}
-    ,{    40,    20,    40,    20,  -760}
-    ,{  -240,  -260,  -240,  -260, -1050}
-    }
-   }
-  }
- ,{{{{  1010,  1010,   880,   730,   880}
-    ,{   410,   -70,    40,   410,  -200}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{  1010,  1010,   880,   730,   880}
-    ,{   410,     0,  -370,   410,  -370}
-    }
-   ,{{   410,  -240,  -150,   410,  -370}
-    ,{   230,  -420,  -550,   230,  -550}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{  -150,  -260,  -150,  -540,  -390}
-    ,{   410,  -240,  -370,   410,  -370}
-    }
-   ,{{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    }
-   ,{{  1010,  1010,   880,   730,   880}
-    ,{    40,   -70,    40,  -350,  -200}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{  1010,  1010,   880,   730,   880}
-    ,{   410,  -240,  -370,   410,  -370}
-    }
-   ,{{   410,     0,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{     0,     0,  -370,  -520,  -370}
-    }
-   }
-  ,{{{  1010,  1010,   880, -1710,   880}
-    ,{   -70,   -70,  -200, -1770,  -200}
-    ,{  -240,  -240,  -370, -1710,  -370}
-    ,{  1010,  1010,   880, -1950,   880}
-    ,{     0,     0,  -370, -1710,  -370}
-    }
-   ,{{  -240,  -240,  -370, -1950,  -370}
-    ,{  -420,  -420,  -550, -2130,  -550}
-    ,{  -240,  -240,  -370, -1950,  -370}
-    ,{  -260,  -260,  -390, -1960,  -390}
-    ,{  -240,  -240,  -370, -1950,  -370}
-    }
-   ,{{  -240,  -240,  -370, -1710,  -370}
-    ,{  -240,  -240,  -370, -1950,  -370}
-    ,{  -240,  -240,  -370, -1710,  -370}
-    ,{  -240,  -240,  -370, -1950,  -370}
-    ,{  -240,  -240,  -370, -1710,  -370}
-    }
-   ,{{  1010,  1010,   880, -1770,   880}
-    ,{   -70,   -70,  -200, -1770,  -200}
-    ,{  -240,  -240,  -370, -1950,  -370}
-    ,{  1010,  1010,   880, -1950,   880}
-    ,{  -240,  -240,  -370, -1950,  -370}
-    }
-   ,{{     0,     0,  -370, -1710,  -370}
-    ,{  -240,  -240,  -370, -1950,  -370}
-    ,{  -240,  -240,  -370, -1710,  -370}
-    ,{  -240,  -240,  -370, -1950,  -370}
-    ,{     0,     0,  -370, -1950,  -370}
-    }
-   }
-  ,{{{   880,   730,   880,   730,   440}
-    ,{    40,  -350,    40,  -350,  -400}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    ,{   880,   730,   880,   730,   440}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    }
-   ,{{  -150,  -520,  -150,  -520,  -590}
-    ,{  -550,  -700,  -550,  -700,  -990}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    ,{  -150,  -540,  -150,  -540,  -590}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    }
-   ,{{  -370,  -520,  -370,  -520,  -810}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    }
-   ,{{   880,   730,   880,   730,   440}
-    ,{    40,  -350,    40,  -350,  -400}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    ,{   880,   730,   880,   730,   440}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    }
-   ,{{  -370,  -520,  -370,  -520,  -810}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    ,{  -370,  -520,  -370,  -520,  -810}
-    }
-   }
-  ,{{{   880, -1410,   880,   410,   880}
-    ,{   410, -1470,  -200,   410,  -200}
-    ,{   410, -1410,  -370,   410,  -370}
-    ,{   880, -1650,   880,   410,   880}
-    ,{   410, -1410,  -370,   410,  -370}
-    }
-   ,{{   410, -1650,  -370,   410,  -370}
-    ,{   230, -1830,  -550,   230,  -550}
-    ,{   410, -1650,  -370,   410,  -370}
-    ,{  -390, -1660,  -390,  -860,  -390}
-    ,{   410, -1650,  -370,   410,  -370}
-    }
-   ,{{   410, -1410,  -370,   410,  -370}
-    ,{   410, -1650,  -370,   410,  -370}
-    ,{   410, -1410,  -370,   410,  -370}
-    ,{   410, -1650,  -370,   410,  -370}
-    ,{   410, -1410,  -370,   410,  -370}
-    }
-   ,{{   880, -1470,   880,   410,   880}
-    ,{  -200, -1470,  -200,  -670,  -200}
-    ,{   410, -1650,  -370,   410,  -370}
-    ,{   880, -1650,   880,  -840,   880}
-    ,{   410, -1650,  -370,   410,  -370}
-    }
-   ,{{   410, -1410,  -370,   410,  -370}
-    ,{   410, -1650,  -370,   410,  -370}
-    ,{   410, -1410,  -370,   410,  -370}
-    ,{   410, -1650,  -370,   410,  -370}
-    ,{  -370, -1650,  -370,  -840,  -370}
-    }
-   }
-  ,{{{   750,   730,   750,   730, -1140}
-    ,{   -90,  -350,   -90,  -350, -1140}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{   750,   730,   750,   730, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    }
-   ,{{  -280,  -520,  -280,  -520, -1250}
-    ,{  -680,  -700,  -680,  -700, -1250}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -280,  -540,  -280,  -540, -1330}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    }
-   ,{{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    }
-   ,{{   750,   730,   750,   730, -1140}
-    ,{   -90,  -350,   -90,  -350, -1140}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{   750,   730,   750,   730, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    }
-   ,{{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    }
-   }
-  }
- ,{{{{  1560,  1560,  1430,  1470,  1430}
-    ,{  1470,   820,   690,  1470,   690}
-    ,{   960,   310,   180,   960,   180}
-    ,{  1560,  1560,  1430,  1280,  1430}
-    ,{   960,   550,   180,   960,   180}
-    }
-   ,{{  1470,   820,   690,  1470,   690}
-    ,{  1470,   820,   690,  1470,   690}
-    ,{   960,   310,   180,   960,   180}
-    ,{    80,   -30,    80,  -310,  -160}
-    ,{   960,   310,   180,   960,   180}
-    }
-   ,{{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    }
-   ,{{  1560,  1560,  1430,  1280,  1430}
-    ,{   -90,  -200,   -90,  -480,  -330}
-    ,{   960,   310,   180,   960,   180}
-    ,{  1560,  1560,  1430,  1280,  1430}
-    ,{   960,   310,   180,   960,   180}
-    }
-   ,{{   960,   550,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   550,   550,   180,    30,   180}
-    }
-   }
-  ,{{{  1560,  1560,  1430,  -880,  1430}
-    ,{   820,   820,   690,  -880,   690}
-    ,{   310,   310,   180, -1150,   180}
-    ,{  1560,  1560,  1430, -1390,  1430}
-    ,{   550,   550,   180, -1150,   180}
-    }
-   ,{{   820,   820,   690,  -880,   690}
-    ,{   820,   820,   690,  -880,   690}
-    ,{   310,   310,   180, -1390,   180}
-    ,{   -30,   -30,  -160, -1730,  -160}
-    ,{   310,   310,   180, -1390,   180}
-    }
-   ,{{   310,   310,   180, -1150,   180}
-    ,{   310,   310,   180, -1390,   180}
-    ,{   310,   310,   180, -1150,   180}
-    ,{   310,   310,   180, -1390,   180}
-    ,{   310,   310,   180, -1150,   180}
-    }
-   ,{{  1560,  1560,  1430, -1390,  1430}
-    ,{  -200,  -200,  -330, -1900,  -330}
-    ,{   310,   310,   180, -1390,   180}
-    ,{  1560,  1560,  1430, -1390,  1430}
-    ,{   310,   310,   180, -1390,   180}
-    }
-   ,{{   550,   550,   180, -1150,   180}
-    ,{   310,   310,   180, -1390,   180}
-    ,{   310,   310,   180, -1150,   180}
-    ,{   310,   310,   180, -1390,   180}
-    ,{   550,   550,   180, -1390,   180}
-    }
-   }
-  ,{{{  1430,  1280,  1430,  1280,   990}
-    ,{   690,   540,   690,   540,   250}
-    ,{   180,    30,   180,    30,  -260}
-    ,{  1430,  1280,  1430,  1280,   990}
-    ,{   180,    30,   180,    30,  -260}
-    }
-   ,{{   690,   540,   690,   540,   250}
-    ,{   690,   540,   690,   540,   250}
-    ,{   180,    30,   180,    30,  -260}
-    ,{    80,  -310,    80,  -310,  -360}
-    ,{   180,    30,   180,    30,  -260}
-    }
-   ,{{   180,    30,   180,    30,  -260}
-    ,{   180,    30,   180,    30,  -260}
-    ,{   180,    30,   180,    30,  -260}
-    ,{   180,    30,   180,    30,  -260}
-    ,{   180,    30,   180,    30,  -260}
-    }
-   ,{{  1430,  1280,  1430,  1280,   990}
-    ,{   -90,  -480,   -90,  -480,  -530}
-    ,{   180,    30,   180,    30,  -260}
-    ,{  1430,  1280,  1430,  1280,   990}
-    ,{   180,    30,   180,    30,  -260}
-    }
-   ,{{   180,    30,   180,    30,  -260}
-    ,{   180,    30,   180,    30,  -260}
-    ,{   180,    30,   180,    30,  -260}
-    ,{   180,    30,   180,    30,  -260}
-    ,{   180,    30,   180,    30,  -260}
-    }
-   }
-  ,{{{  1470,  -580,  1430,  1470,  1430}
-    ,{  1470,  -580,   690,  1470,   690}
-    ,{   960,  -850,   180,   960,   180}
-    ,{  1430, -1090,  1430,   960,  1430}
-    ,{   960,  -850,   180,   960,   180}
-    }
-   ,{{  1470,  -580,   690,  1470,   690}
-    ,{  1470,  -580,   690,  1470,   690}
-    ,{   960, -1090,   180,   960,   180}
-    ,{  -160, -1430,  -160,  -630,  -160}
-    ,{   960, -1090,   180,   960,   180}
-    }
-   ,{{   960,  -850,   180,   960,   180}
-    ,{   960, -1090,   180,   960,   180}
-    ,{   960,  -850,   180,   960,   180}
-    ,{   960, -1090,   180,   960,   180}
-    ,{   960,  -850,   180,   960,   180}
-    }
-   ,{{  1430, -1090,  1430,   960,  1430}
-    ,{  -330, -1600,  -330,  -800,  -330}
-    ,{   960, -1090,   180,   960,   180}
-    ,{  1430, -1090,  1430,  -290,  1430}
-    ,{   960, -1090,   180,   960,   180}
-    }
-   ,{{   960,  -850,   180,   960,   180}
-    ,{   960, -1090,   180,   960,   180}
-    ,{   960,  -850,   180,   960,   180}
-    ,{   960, -1090,   180,   960,   180}
-    ,{   180, -1090,   180,  -290,   180}
-    }
-   }
-  ,{{{  1300,  1280,  1300,  1280,   -10}
-    ,{   560,   540,   560,   540,   -10}
-    ,{    50,    30,    50,    30,  -760}
-    ,{  1300,  1280,  1300,  1280,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    }
-   ,{{   560,   540,   560,   540,   -10}
-    ,{   560,   540,   560,   540,   -10}
-    ,{    50,    30,    50,    30,  -760}
-    ,{   -50,  -310,   -50,  -310, -1100}
-    ,{    50,    30,    50,    30,  -760}
-    }
-   ,{{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    }
-   ,{{  1300,  1280,  1300,  1280,  -760}
-    ,{  -220,  -480,  -220,  -480, -1270}
-    ,{    50,    30,    50,    30,  -760}
-    ,{  1300,  1280,  1300,  1280,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    }
-   ,{{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    }
-   }
-  }
- ,{{{{  2050,  1930,  1800,  2050,  1800}
-    ,{  2050,  1400,  1270,  2050,  1270}
-    ,{  1750,  1100,   970,  1750,   970}
-    ,{  1930,  1930,  1800,  1760,  1800}
-    ,{  1750,  1100,   970,  1750,   970}
-    }
-   ,{{  2050,  1400,  1270,  2050,  1270}
-    ,{  2050,  1400,  1270,  2050,  1270}
-    ,{  1740,  1090,   960,  1740,   960}
-    ,{   130,    10,   130,  -260,  -110}
-    ,{  1740,  1090,   960,  1740,   960}
-    }
-   ,{{  1760,  1110,   980,  1760,   980}
-    ,{  1760,  1110,   980,  1760,   980}
-    ,{  1750,  1100,   970,  1750,   970}
-    ,{  1760,  1110,   980,  1760,   980}
-    ,{  1750,  1100,   970,  1750,   970}
-    }
-   ,{{  1930,  1930,  1800,  1740,  1800}
-    ,{   300,   190,   300,   -80,    60}
-    ,{  1740,  1090,   960,  1740,   960}
-    ,{  1930,  1930,  1800,  1650,  1800}
-    ,{  1740,  1090,   960,  1740,   960}
-    }
-   ,{{  1760,  1110,   980,  1760,   980}
-    ,{  1760,  1110,   980,  1760,   980}
-    ,{  1750,  1100,   970,  1750,   970}
-    ,{  1760,  1110,   980,  1760,   980}
-    ,{   360,   360,     0,  -150,     0}
-    }
-   }
-  ,{{{  1930,  1930,  1800,  -300,  1800}
-    ,{  1400,  1400,  1270,  -300,  1270}
-    ,{  1100,  1100,   970,  -360,   970}
-    ,{  1930,  1930,  1800,  -590,  1800}
-    ,{  1100,  1100,   970,  -360,   970}
-    }
-   ,{{  1400,  1400,  1270,  -300,  1270}
-    ,{  1400,  1400,  1270,  -300,  1270}
-    ,{  1090,  1090,   960,  -610,   960}
-    ,{    10,    10,  -110, -1690,  -110}
-    ,{  1090,  1090,   960,  -610,   960}
-    }
-   ,{{  1110,  1110,   980,  -360,   980}
-    ,{  1110,  1110,   980,  -590,   980}
-    ,{  1100,  1100,   970,  -360,   970}
-    ,{  1110,  1110,   980,  -590,   980}
-    ,{  1100,  1100,   970,  -360,   970}
-    }
-   ,{{  1930,  1930,  1800,  -610,  1800}
-    ,{   190,   190,    60, -1510,    60}
-    ,{  1090,  1090,   960,  -610,   960}
-    ,{  1930,  1930,  1800, -1020,  1800}
-    ,{  1090,  1090,   960,  -610,   960}
-    }
-   ,{{  1110,  1110,   980,  -360,   980}
-    ,{  1110,  1110,   980,  -590,   980}
-    ,{  1100,  1100,   970,  -360,   970}
-    ,{  1110,  1110,   980,  -590,   980}
-    ,{   360,   360,     0, -1580,     0}
-    }
-   }
-  ,{{{  1800,  1650,  1800,  1650,  1360}
-    ,{  1270,  1120,  1270,  1120,   830}
-    ,{   970,   820,   970,   820,   530}
-    ,{  1800,  1650,  1800,  1650,  1360}
-    ,{   970,   820,   970,   820,   530}
-    }
-   ,{{  1270,  1120,  1270,  1120,   830}
-    ,{  1270,  1120,  1270,  1120,   830}
-    ,{   960,   810,   960,   810,   520}
-    ,{   130,  -260,   130,  -260,  -310}
-    ,{   960,   810,   960,   810,   520}
-    }
-   ,{{   980,   830,   980,   830,   540}
-    ,{   980,   830,   980,   830,   540}
-    ,{   970,   820,   970,   820,   530}
-    ,{   980,   830,   980,   830,   540}
-    ,{   970,   820,   970,   820,   530}
-    }
-   ,{{  1800,  1650,  1800,  1650,  1360}
-    ,{   300,   -80,   300,   -80,  -130}
-    ,{   960,   810,   960,   810,   520}
-    ,{  1800,  1650,  1800,  1650,  1360}
-    ,{   960,   810,   960,   810,   520}
-    }
-   ,{{   980,   830,   980,   830,   540}
-    ,{   980,   830,   980,   830,   540}
-    ,{   970,   820,   970,   820,   530}
-    ,{   980,   830,   980,   830,   540}
-    ,{     0,  -150,     0,  -150,  -440}
-    }
-   }
-  ,{{{  2050,     0,  1800,  2050,  1800}
-    ,{  2050,     0,  1270,  2050,  1270}
-    ,{  1750,   -60,   970,  1750,   970}
-    ,{  1800,  -290,  1800,  1760,  1800}
-    ,{  1750,   -60,   970,  1750,   970}
-    }
-   ,{{  2050,     0,  1270,  2050,  1270}
-    ,{  2050,     0,  1270,  2050,  1270}
-    ,{  1740,  -310,   960,  1740,   960}
-    ,{  -110, -1390,  -110,  -580,  -110}
-    ,{  1740,  -310,   960,  1740,   960}
-    }
-   ,{{  1760,   -60,   980,  1760,   980}
-    ,{  1760,  -290,   980,  1760,   980}
-    ,{  1750,   -60,   970,  1750,   970}
-    ,{  1760,  -290,   980,  1760,   980}
-    ,{  1750,   -60,   970,  1750,   970}
-    }
-   ,{{  1800,  -310,  1800,  1740,  1800}
-    ,{    60, -1210,    60,  -400,    60}
-    ,{  1740,  -310,   960,  1740,   960}
-    ,{  1800,  -720,  1800,    80,  1800}
-    ,{  1740,  -310,   960,  1740,   960}
-    }
-   ,{{  1760,   -60,   980,  1760,   980}
-    ,{  1760,  -290,   980,  1760,   980}
-    ,{  1750,   -60,   970,  1750,   970}
-    ,{  1760,  -290,   980,  1760,   980}
-    ,{     0, -1280,     0,  -470,     0}
-    }
-   }
-  ,{{{  1670,  1650,  1670,  1650,   570}
-    ,{  1140,  1120,  1140,  1120,   570}
-    ,{   840,   820,   840,   820,    30}
-    ,{  1670,  1650,  1670,  1650,    40}
-    ,{   840,   820,   840,   820,    30}
-    }
-   ,{{  1140,  1120,  1140,  1120,   570}
-    ,{  1140,  1120,  1140,  1120,   570}
-    ,{   830,   810,   830,   810,    20}
-    ,{     0,  -260,     0,  -260, -1050}
-    ,{   830,   810,   830,   810,    20}
-    }
-   ,{{   850,   830,   850,   830,    40}
-    ,{   850,   830,   850,   830,    40}
-    ,{   840,   820,   840,   820,    30}
-    ,{   850,   830,   850,   830,    40}
-    ,{   840,   820,   840,   820,    30}
-    }
-   ,{{  1670,  1650,  1670,  1650,    20}
-    ,{   180,   -80,   180,   -80,  -870}
-    ,{   830,   810,   830,   810,    20}
-    ,{  1670,  1650,  1670,  1650,  -380}
-    ,{   830,   810,   830,   810,    20}
-    }
-   ,{{   850,   830,   850,   830,    40}
-    ,{   850,   830,   850,   830,    40}
-    ,{   840,   820,   840,   820,    30}
-    ,{   850,   830,   850,   830,    40}
-    ,{  -130,  -150,  -130,  -150,  -940}
-    }
-   }
-  }
- ,{{{{  2120,  2120,  1990,  2120,  1990}
-    ,{  2120,  1470,  1340,  2120,  1340}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  2120,  2120,  1990,  1990,  1990}
-    ,{  1860,  1210,  1080,  1860,  1080}
-    }
-   ,{{  2120,  1470,  1340,  2120,  1340}
-    ,{  2120,  1470,  1340,  2120,  1340}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    ,{   180,    60,   180,  -210,   -60}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    }
-   ,{{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1860,  1210,  1080,  1860,  1080}
-    }
-   ,{{  2120,  2120,  1990,  1840,  1990}
-    ,{  -120,  -230,  -120,  -510,  -360}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    ,{  2120,  2120,  1990,  1840,  1990}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    }
-   ,{{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1550,   900,   770,  1550,   770}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{   640,   640,   270,   120,   270}
-    }
-   }
-  ,{{{  2120,  2120,  1990,  -120,  1990}
-    ,{  1470,  1470,  1340,  -230,  1340}
-    ,{  1340,  1340,  1210,  -120,  1210}
-    ,{  2120,  2120,  1990,  -360,  1990}
-    ,{  1210,  1210,  1080,  -250,  1080}
-    }
-   ,{{  1470,  1470,  1340,  -230,  1340}
-    ,{  1470,  1470,  1340,  -230,  1340}
-    ,{  1190,  1190,  1060,  -510,  1060}
-    ,{    60,    60,   -60, -1640,   -60}
-    ,{  1190,  1190,  1060,  -510,  1060}
-    }
-   ,{{  1340,  1340,  1210,  -120,  1210}
-    ,{  1340,  1340,  1210,  -360,  1210}
-    ,{  1340,  1340,  1210,  -120,  1210}
-    ,{  1340,  1340,  1210,  -360,  1210}
-    ,{  1210,  1210,  1080,  -250,  1080}
-    }
-   ,{{  2120,  2120,  1990,  -510,  1990}
-    ,{  -230,  -230,  -360, -1940,  -360}
-    ,{  1190,  1190,  1060,  -510,  1060}
-    ,{  2120,  2120,  1990,  -830,  1990}
-    ,{  1190,  1190,  1060,  -510,  1060}
-    }
-   ,{{  1340,  1340,  1210,  -360,  1210}
-    ,{  1340,  1340,  1210,  -360,  1210}
-    ,{   900,   900,   770,  -560,   770}
-    ,{  1340,  1340,  1210,  -360,  1210}
-    ,{   640,   640,   270, -1300,   270}
-    }
-   }
-  ,{{{  1990,  1840,  1990,  1840,  1550}
-    ,{  1340,  1190,  1340,  1190,   900}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{  1990,  1840,  1990,  1840,  1550}
-    ,{  1080,   930,  1080,   930,   640}
-    }
-   ,{{  1340,  1190,  1340,  1190,   900}
-    ,{  1340,  1190,  1340,  1190,   900}
-    ,{  1060,   910,  1060,   910,   620}
-    ,{   180,  -210,   180,  -210,  -260}
-    ,{  1060,   910,  1060,   910,   620}
-    }
-   ,{{  1210,  1060,  1210,  1060,   770}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{  1080,   930,  1080,   930,   640}
-    }
-   ,{{  1990,  1840,  1990,  1840,  1550}
-    ,{  -120,  -510,  -120,  -510,  -560}
-    ,{  1060,   910,  1060,   910,   620}
-    ,{  1990,  1840,  1990,  1840,  1550}
-    ,{  1060,   910,  1060,   910,   620}
-    }
-   ,{{  1210,  1060,  1210,  1060,   770}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{   770,   620,   770,   620,   330}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{   270,   120,   270,   120,  -170}
-    }
-   }
-  ,{{{  2120,   180,  1990,  2120,  1990}
-    ,{  2120,    60,  1340,  2120,  1340}
-    ,{  1990,   180,  1210,  1990,  1210}
-    ,{  1990,   -60,  1990,  1990,  1990}
-    ,{  1860,    50,  1080,  1860,  1080}
-    }
-   ,{{  2120,    60,  1340,  2120,  1340}
-    ,{  2120,    60,  1340,  2120,  1340}
-    ,{  1840,  -210,  1060,  1840,  1060}
-    ,{   -60, -1340,   -60,  -530,   -60}
-    ,{  1840,  -210,  1060,  1840,  1060}
-    }
-   ,{{  1990,   180,  1210,  1990,  1210}
-    ,{  1990,   -60,  1210,  1990,  1210}
-    ,{  1990,   180,  1210,  1990,  1210}
-    ,{  1990,   -60,  1210,  1990,  1210}
-    ,{  1860,    50,  1080,  1860,  1080}
-    }
-   ,{{  1990,  -210,  1990,  1840,  1990}
-    ,{  -360, -1640,  -360,  -830,  -360}
-    ,{  1840,  -210,  1060,  1840,  1060}
-    ,{  1990,  -530,  1990,   270,  1990}
-    ,{  1840,  -210,  1060,  1840,  1060}
-    }
-   ,{{  1990,   -60,  1210,  1990,  1210}
-    ,{  1990,   -60,  1210,  1990,  1210}
-    ,{  1550,  -260,   770,  1550,   770}
-    ,{  1990,   -60,  1210,  1990,  1210}
-    ,{   270, -1000,   270,  -200,   270}
-    }
-   }
-  ,{{{  1860,  1840,  1860,  1840,   640}
-    ,{  1210,  1190,  1210,  1190,   640}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1860,  1840,  1860,  1840,   270}
-    ,{   950,   930,   950,   930,   140}
-    }
-   ,{{  1210,  1190,  1210,  1190,   640}
-    ,{  1210,  1190,  1210,  1190,   640}
-    ,{   930,   910,   930,   910,   120}
-    ,{    50,  -210,    50,  -210, -1000}
-    ,{   930,   910,   930,   910,   120}
-    }
-   ,{{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   950,   930,   950,   930,   140}
-    }
-   ,{{  1860,  1840,  1860,  1840,   120}
-    ,{  -250,  -510,  -250,  -510, -1300}
-    ,{   930,   910,   930,   910,   120}
-    ,{  1860,  1840,  1860,  1840,  -200}
-    ,{   930,   910,   930,   910,   120}
-    }
-   ,{{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   640,   620,   640,   620,  -170}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   140,   120,   140,   120,  -670}
-    }
-   }
-  }
- ,{{{{  2120,  2120,  1990,  2120,  1990}
-    ,{  2120,  1470,  1340,  2120,  1340}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  2120,  2120,  1990,  1990,  1990}
-    ,{  1860,  1210,  1080,  1860,  1080}
-    }
-   ,{{  2120,  1470,  1340,  2120,  1340}
-    ,{  2120,  1470,  1340,  2120,  1340}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    ,{   400,   290,   400,    10,   160}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    }
-   ,{{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1860,  1210,  1080,  1860,  1080}
-    }
-   ,{{  2120,  2120,  1990,  1840,  1990}
-    ,{   300,   190,   300,   -80,    60}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    ,{  2120,  2120,  1990,  1840,  1990}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    }
-   ,{{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1750,  1100,   970,  1750,   970}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{   640,   640,   270,   120,   270}
-    }
-   }
-  ,{{{  2120,  2120,  1990,  -120,  1990}
-    ,{  1470,  1470,  1340,  -230,  1340}
-    ,{  1340,  1340,  1210,  -120,  1210}
-    ,{  2120,  2120,  1990,  -360,  1990}
-    ,{  1210,  1210,  1080,  -250,  1080}
-    }
-   ,{{  1470,  1470,  1340,  -230,  1340}
-    ,{  1470,  1470,  1340,  -230,  1340}
-    ,{  1190,  1190,  1060,  -510,  1060}
-    ,{   290,   290,   160, -1410,   160}
-    ,{  1190,  1190,  1060,  -510,  1060}
-    }
-   ,{{  1340,  1340,  1210,  -120,  1210}
-    ,{  1340,  1340,  1210,  -360,  1210}
-    ,{  1340,  1340,  1210,  -120,  1210}
-    ,{  1340,  1340,  1210,  -360,  1210}
-    ,{  1210,  1210,  1080,  -250,  1080}
-    }
-   ,{{  2120,  2120,  1990,  -510,  1990}
-    ,{   190,   190,    60, -1510,    60}
-    ,{  1190,  1190,  1060,  -510,  1060}
-    ,{  2120,  2120,  1990,  -830,  1990}
-    ,{  1190,  1190,  1060,  -510,  1060}
-    }
-   ,{{  1340,  1340,  1210,  -360,  1210}
-    ,{  1340,  1340,  1210,  -360,  1210}
-    ,{  1100,  1100,   970,  -360,   970}
-    ,{  1340,  1340,  1210,  -360,  1210}
-    ,{   640,   640,   270, -1300,   270}
-    }
-   }
-  ,{{{  1990,  1840,  1990,  1840,  1550}
-    ,{  1340,  1190,  1340,  1190,   900}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{  1990,  1840,  1990,  1840,  1550}
-    ,{  1080,   930,  1080,   930,   640}
-    }
-   ,{{  1340,  1190,  1340,  1190,   900}
-    ,{  1340,  1190,  1340,  1190,   900}
-    ,{  1060,   910,  1060,   910,   620}
-    ,{   400,    10,   400,    10,   -40}
-    ,{  1060,   910,  1060,   910,   620}
-    }
-   ,{{  1210,  1060,  1210,  1060,   770}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{  1080,   930,  1080,   930,   640}
-    }
-   ,{{  1990,  1840,  1990,  1840,  1550}
-    ,{   300,   -80,   300,   -80,  -130}
-    ,{  1060,   910,  1060,   910,   620}
-    ,{  1990,  1840,  1990,  1840,  1550}
-    ,{  1060,   910,  1060,   910,   620}
-    }
-   ,{{  1210,  1060,  1210,  1060,   770}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{   970,   820,   970,   820,   530}
-    ,{  1210,  1060,  1210,  1060,   770}
-    ,{   270,   120,   270,   120,  -170}
-    }
-   }
-  ,{{{  2120,   180,  1990,  2120,  1990}
-    ,{  2120,    60,  1340,  2120,  1340}
-    ,{  1990,   180,  1210,  1990,  1210}
-    ,{  1990,   -60,  1990,  1990,  1990}
-    ,{  1860,    50,  1080,  1860,  1080}
-    }
-   ,{{  2120,    60,  1340,  2120,  1340}
-    ,{  2120,    60,  1340,  2120,  1340}
-    ,{  1840,  -210,  1060,  1840,  1060}
-    ,{   160, -1110,   160,  -310,   160}
-    ,{  1840,  -210,  1060,  1840,  1060}
-    }
-   ,{{  1990,   180,  1210,  1990,  1210}
-    ,{  1990,   -60,  1210,  1990,  1210}
-    ,{  1990,   180,  1210,  1990,  1210}
-    ,{  1990,   -60,  1210,  1990,  1210}
-    ,{  1860,    50,  1080,  1860,  1080}
-    }
-   ,{{  1990,  -210,  1990,  1840,  1990}
-    ,{    60, -1210,    60,  -400,    60}
-    ,{  1840,  -210,  1060,  1840,  1060}
-    ,{  1990,  -530,  1990,   270,  1990}
-    ,{  1840,  -210,  1060,  1840,  1060}
-    }
-   ,{{  1990,   -60,  1210,  1990,  1210}
-    ,{  1990,   -60,  1210,  1990,  1210}
-    ,{  1750,   -60,   970,  1750,   970}
-    ,{  1990,   -60,  1210,  1990,  1210}
-    ,{   270, -1000,   270,  -200,   270}
-    }
-   }
-  ,{{{  1860,  1840,  1860,  1840,   640}
-    ,{  1210,  1190,  1210,  1190,   640}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1860,  1840,  1860,  1840,   270}
-    ,{   950,   930,   950,   930,   140}
-    }
-   ,{{  1210,  1190,  1210,  1190,   640}
-    ,{  1210,  1190,  1210,  1190,   640}
-    ,{   930,   910,   930,   910,   120}
-    ,{   270,    10,   270,    10,  -780}
-    ,{   930,   910,   930,   910,   120}
-    }
-   ,{{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   950,   930,   950,   930,   140}
-    }
-   ,{{  1860,  1840,  1860,  1840,   120}
-    ,{   180,   -80,   180,   -80,  -870}
-    ,{   930,   910,   930,   910,   120}
-    ,{  1860,  1840,  1860,  1840,  -200}
-    ,{   930,   910,   930,   910,   120}
-    }
-   ,{{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   840,   820,   840,   820,    30}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   140,   120,   140,   120,  -670}
-    }
-   }
-  }
- }
-,{{{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  ,{{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   ,{{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    ,{   INF,   INF,   INF,   INF,   INF}
-    }
-   }
-  }
- ,{{{{  1350,   850,   720,  1350,   720}
-    ,{  1300,   650,   540,  1300,   520}
-    ,{  1350,   700,   570,  1350,   570}
-    ,{  1300,   850,   720,  1300,   720}
-    ,{  1250,   590,   460,  1250,   460}
-    }
-   ,{{  1160,   500,   400,  1160,   370}
-    ,{  1160,   500,   370,  1160,   370}
-    ,{   850,   190,    60,   850,    60}
-    ,{   400,   290,   400,    10,   170}
-    ,{   850,   190,    60,   850,    60}
-    }
-   ,{{  1300,   650,   520,  1300,   520}
-    ,{  1300,   650,   520,  1300,   520}
-    ,{  1290,   640,   510,  1290,   510}
-    ,{  1300,   650,   520,  1300,   520}
-    ,{  1250,   590,   460,  1250,   460}
-    }
-   ,{{   850,   850,   720,   850,   720}
-    ,{   540,     0,   540,  -270,  -120}
-    ,{   850,   190,    60,   850,    60}
-    ,{   850,   850,   720,   570,   720}
-    ,{   850,   190,    60,   850,    60}
-    }
-   ,{{  1350,   700,   570,  1350,   570}
-    ,{  1300,   650,   520,  1300,   520}
-    ,{  1350,   700,   570,  1350,   570}
-    ,{  1300,   650,   520,  1300,   520}
-    ,{   100,   100,  -270,  -230,  -270}
-    }
-   }
-  ,{{{   850,   850,   720,  -330,   720}
-    ,{   650,   650,   520,  -620,   520}
-    ,{   700,   700,   570,  -330,   570}
-    ,{   850,   850,   720,  -620,   720}
-    ,{   590,   590,   460,  -440,   460}
-    }
-   ,{{   500,   500,   370,  -770,   370}
-    ,{   500,   500,   370,  -770,   370}
-    ,{   190,   190,    60, -1070,    60}
-    ,{   290,   290,   160,  -980,   160}
-    ,{   190,   190,    60, -1080,    60}
-    }
-   ,{{   650,   650,   520,  -390,   520}
-    ,{   650,   650,   520,  -620,   520}
-    ,{   640,   640,   510,  -390,   510}
-    ,{   650,   650,   520,  -620,   520}
-    ,{   590,   590,   460,  -440,   460}
-    }
-   ,{{   850,   850,   720, -1080,   720}
-    ,{    10,     0,    10, -1270,  -120}
-    ,{   190,   190,    60, -1080,    60}
-    ,{   850,   850,   720, -1080,   720}
-    ,{   190,   190,    60, -1080,    60}
-    }
-   ,{{   700,   700,   570,  -330,   570}
-    ,{   650,   650,   520,  -620,   520}
-    ,{   700,   700,   570,  -330,   570}
-    ,{   650,   650,   520,  -620,   520}
-    ,{   100,   100,  -270, -1300,  -270}
-    }
-   }
-  ,{{{   720,   570,   720,   570,   480}
-    ,{   540,   370,   540,   370,   280}
-    ,{   570,   420,   570,   420,   340}
-    ,{   720,   570,   720,   570,   480}
-    ,{   460,   310,   460,   310,   230}
-    }
-   ,{{   400,   220,   400,   220,   170}
-    ,{   370,   220,   370,   220,   140}
-    ,{    60,   -80,    60,   -80,  -170}
-    ,{   400,    10,   400,    10,   170}
-    ,{    60,   -80,    60,   -80,  -170}
-    }
-   ,{{   520,   370,   520,   370,   280}
-    ,{   520,   370,   520,   370,   280}
-    ,{   510,   360,   510,   360,   280}
-    ,{   520,   370,   520,   370,   280}
-    ,{   460,   310,   460,   310,   230}
-    }
-   ,{{   720,   570,   720,   570,   480}
-    ,{   540,  -100,   540,  -270,  -120}
-    ,{    60,   -80,    60,   -80,  -170}
-    ,{   720,   570,   720,   570,   480}
-    ,{    60,   -80,    60,   -80,  -170}
-    }
-   ,{{   570,   420,   570,   420,   340}
-    ,{   520,   370,   520,   370,   280}
-    ,{   570,   420,   570,   420,   340}
-    ,{   520,   370,   520,   370,   280}
-    ,{  -270,  -420,  -270,  -420,  -500}
-    }
-   }
-  ,{{{  1350,  -230,   720,  1350,   720}
-    ,{  1300,  -530,   520,  1300,   520}
-    ,{  1350,  -230,   570,  1350,   570}
-    ,{  1300,  -530,   720,  1300,   720}
-    ,{  1250,  -340,   460,  1250,   460}
-    }
-   ,{{  1160,  -670,   370,  1160,   370}
-    ,{  1160,  -670,   370,  1160,   370}
-    ,{   850,  -980,    60,   850,    60}
-    ,{   160,  -890,   160,  -310,   160}
-    ,{   850,  -980,    60,   850,    60}
-    }
-   ,{{  1300,  -290,   520,  1300,   520}
-    ,{  1300,  -530,   520,  1300,   520}
-    ,{  1290,  -290,   510,  1290,   510}
-    ,{  1300,  -530,   520,  1300,   520}
-    ,{  1250,  -340,   460,  1250,   460}
-    }
-   ,{{   850,  -980,   720,   850,   720}
-    ,{  -120, -1170,  -120,  -590,  -120}
-    ,{   850,  -980,    60,   850,    60}
-    ,{   720, -1580,   720, -1000,   720}
-    ,{   850,  -980,    60,   850,    60}
-    }
-   ,{{  1350,  -230,   570,  1350,   570}
-    ,{  1300,  -530,   520,  1300,   520}
-    ,{  1350,  -230,   570,  1350,   570}
-    ,{  1300,  -530,   520,  1300,   520}
-    ,{  -230, -1320,  -270,  -230,  -270}
-    }
-   }
-  ,{{{   590,   570,   590,   570,   -90}
-    ,{   390,   370,   390,   370,   -90}
-    ,{   440,   420,   440,   420,  -360}
-    ,{   590,   570,   590,   570,  -420}
-    ,{   330,   310,   330,   310,  -470}
-    }
-   ,{{   270,   220,   270,   220,  -320}
-    ,{   240,   220,   240,   220,  -320}
-    ,{   -60,   -80,   -60,   -80,  -830}
-    ,{   270,    10,   270,    10,  -780}
-    ,{   -60,   -80,   -60,   -80,  -870}
-    }
-   ,{{   390,   370,   390,   370,   -90}
-    ,{   390,   370,   390,   370,   -90}
-    ,{   380,   360,   380,   360,  -420}
-    ,{   390,   370,   390,   370,  -420}
-    ,{   330,   310,   330,   310,  -470}
-    }
-   ,{{   590,   570,   590,   570,  -810}
-    ,{   -10,  -270,   -10,  -270,  -810}
-    ,{   -60,   -80,   -60,   -80,  -870}
-    ,{   590,   570,   590,   570, -1470}
-    ,{   -60,   -80,   -60,   -80,  -870}
-    }
-   ,{{   440,   420,   440,   420,  -360}
-    ,{   390,   370,   390,   370,  -420}
-    ,{   440,   420,   440,   420,  -360}
-    ,{   390,   370,   390,   370,  -420}
-    ,{  -400,  -420,  -400,  -420, -1210}
-    }
-   }
-  }
- ,{{{{  1320,   850,   720,  1320,   720}
-    ,{  1320,   670,   540,  1320,   540}
-    ,{   870,   220,    90,   870,    90}
-    ,{   960,   850,   720,   960,   720}
-    ,{   870,   250,    90,   870,    90}
-    }
-   ,{{  1320,   670,   540,  1320,   540}
-    ,{  1320,   670,   540,  1320,   540}
-    ,{   870,   220,    90,   870,    90}
-    ,{  -410,  -520,  -410,  -800,  -640}
-    ,{   870,   220,    90,   870,    90}
-    }
-   ,{{   960,   300,   170,   960,   170}
-    ,{   960,   300,   170,   960,   170}
-    ,{   650,     0,  -130,   650,  -130}
-    ,{   960,   300,   170,   960,   170}
-    ,{   650,     0,  -130,   650,  -130}
-    }
-   ,{{   870,   850,   720,   870,   720}
-    ,{    70,   -40,    70,  -320,  -170}
-    ,{   870,   220,    90,   870,    90}
-    ,{   850,   850,   720,   570,   720}
-    ,{   870,   220,    90,   870,    90}
-    }
-   ,{{   960,   300,   170,   960,   170}
-    ,{   960,   300,   170,   960,   170}
-    ,{   340,  -310,  -440,   340,  -440}
-    ,{   960,   300,   170,   960,   170}
-    ,{   250,   250,   -90,  -260,  -110}
-    }
-   }
-  ,{{{   850,   850,   720,   540,   720}
-    ,{   670,   670,   540,    10,   540}
-    ,{   540,   220,    90,   540,    90}
-    ,{   850,   850,   720,  -970,   720}
-    ,{   250,   250,    90,  -810,    90}
-    }
-   ,{{   670,   670,   540,  -100,   540}
-    ,{   670,   670,   540,  -600,   540}
-    ,{   220,   220,    90,  -100,    90}
-    ,{  -520,  -520,  -650, -1790,  -650}
-    ,{   220,   220,    90, -1050,    90}
-    }
-   ,{{   540,   300,   170,   540,   170}
-    ,{   300,   300,   170,    10,   170}
-    ,{   540,     0,  -130,   540,  -130}
-    ,{   300,   300,   170,  -970,   170}
-    ,{     0,     0,  -130, -1030,  -130}
-    }
-   ,{{   850,   850,   720, -1050,   720}
-    ,{   -40,   -40,  -170, -1320,  -170}
-    ,{   220,   220,    90, -1050,    90}
-    ,{   850,   850,   720, -1680,   720}
-    ,{   220,   220,    90, -1050,    90}
-    }
-   ,{{   300,   300,   170,  -810,   170}
-    ,{   300,   300,   170,  -970,   170}
-    ,{  -310,  -310,  -440, -1340,  -440}
-    ,{   300,   300,   170,  -970,   170}
-    ,{   250,   250,   -90,  -810,  -110}
-    }
-   }
-  ,{{{   720,   570,   720,   570,   480}
-    ,{   540,   390,   540,   390,   300}
-    ,{    90,   -60,    90,   -60,  -140}
-    ,{   720,   570,   720,   570,   480}
-    ,{    90,   -60,    90,   -60,  -140}
-    }
-   ,{{   540,   390,   540,   390,   300}
-    ,{   540,   390,   540,   390,   300}
-    ,{    90,   -60,    90,   -60,  -140}
-    ,{  -410,  -800,  -410,  -800,  -640}
-    ,{    90,   -60,    90,   -60,  -140}
-    }
-   ,{{   170,    20,   170,    20,   -60}
-    ,{   170,    20,   170,    20,   -60}
-    ,{  -130,  -280,  -130,  -280,  -360}
-    ,{   170,    20,   170,    20,   -60}
-    ,{  -130,  -280,  -130,  -280,  -360}
-    }
-   ,{{   720,   570,   720,   570,   480}
-    ,{    70,  -320,    70,  -320,  -170}
-    ,{    90,   -60,    90,   -60,  -140}
-    ,{   720,   570,   720,   570,   480}
-    ,{    90,   -60,    90,   -60,  -140}
-    }
-   ,{{   170,    20,   170,    20,   -60}
-    ,{   170,    20,   170,    20,   -60}
-    ,{  -440,  -590,  -440,  -590,  -670}
-    ,{   170,    20,   170,    20,   -60}
-    ,{  -110,  -260,  -110,  -260,  -350}
-    }
-   }
-  ,{{{  1320,  -350,   720,  1320,   720}
-    ,{  1320,  -730,   540,  1320,   540}
-    ,{   870,  -350,    90,   870,    90}
-    ,{   960,  -870,   720,   960,   720}
-    ,{   870,  -940,    90,   870,    90}
-    }
-   ,{{  1320,  -350,   540,  1320,   540}
-    ,{  1320,  -730,   540,  1320,   540}
-    ,{   870,  -350,    90,   870,    90}
-    ,{  -650, -1920,  -650, -1120,  -650}
-    ,{   870,  -960,    90,   870,    90}
-    }
-   ,{{   960,  -870,   170,   960,   170}
-    ,{   960, -1100,   170,   960,   170}
-    ,{   650,  -940,  -130,   650,  -130}
-    ,{   960,  -870,   170,   960,   170}
-    ,{   650,  -940,  -130,   650,  -130}
-    }
-   ,{{   870,  -960,   720,   870,   720}
-    ,{  -170, -1450,  -170,  -640,  -170}
-    ,{   870,  -960,    90,   870,    90}
-    ,{   720, -1370,   720, -1000,   720}
-    ,{   870,  -960,    90,   870,    90}
-    }
-   ,{{   960,  -870,   170,   960,   170}
-    ,{   960,  -870,   170,   960,   170}
-    ,{   340, -1250,  -440,   340,  -440}
-    ,{   960,  -870,   170,   960,   170}
-    ,{  -110, -1360,  -110,  -580,  -110}
-    }
-   }
-  ,{{{   590,   570,   590,   570,  -160}
-    ,{   410,   390,   410,   390,  -160}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    ,{   590,   570,   590,   570,  -230}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    }
-   ,{{   410,   390,   410,   390,  -160}
-    ,{   410,   390,   410,   390,  -160}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    ,{  -540,  -800,  -540,  -800, -1520}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    }
-   ,{{    40,    20,    40,    20,  -400}
-    ,{    40,    20,    40,    20,  -400}
-    ,{  -260,  -280,  -260,  -280, -1070}
-    ,{    40,    20,    40,    20,  -760}
-    ,{  -260,  -280,  -260,  -280, -1070}
-    }
-   ,{{   590,   570,   590,   570,  -230}
-    ,{   -60,  -320,   -60,  -320, -1110}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    ,{   590,   570,   590,   570,  -230}
-    ,{   -40,   -60,   -40,   -60,  -850}
-    }
-   ,{{    40,    20,    40,    20,  -760}
-    ,{    40,    20,    40,    20,  -760}
-    ,{  -570,  -590,  -570,  -590, -1380}
-    ,{    40,    20,    40,    20,  -760}
-    ,{  -240,  -260,  -240,  -260, -1050}
-    }
-   }
-  }
- ,{{{{  1010,  1010,   880,   730,   880}
-    ,{   410,   -30,    40,   410,  -190}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{  1010,  1010,   880,   730,   880}
-    ,{   410,     0,  -370,   410,  -370}
-    }
-   ,{{   410,   -70,  -150,   410,  -370}
-    ,{   230,   -70,  -550,   230,  -550}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{  -150,  -260,  -150,  -540,  -380}
-    ,{   410,  -240,  -370,   410,  -370}
-    }
-   ,{{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    }
-   ,{{  1010,  1010,   880,   730,   880}
-    ,{    40,   -30,    40,  -350,  -190}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{  1010,  1010,   880,   730,   880}
-    ,{   410,  -240,  -370,   410,  -370}
-    }
-   ,{{   410,     0,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{   410,  -240,  -370,   410,  -370}
-    ,{     0,     0,  -370,  -520,  -370}
-    }
-   }
-  ,{{{  1010,  1010,   880, -1280,   880}
-    ,{   -30,   -30,  -200, -1340,  -200}
-    ,{  -240,  -240,  -370, -1280,  -370}
-    ,{  1010,  1010,   880, -1520,   880}
-    ,{     0,     0,  -370, -1280,  -370}
-    }
-   ,{{   -70,   -70,  -370, -1520,  -370}
-    ,{   -70,   -70,  -550, -1700,  -550}
-    ,{  -240,  -240,  -370, -1520,  -370}
-    ,{  -260,  -260,  -390, -1530,  -390}
-    ,{  -240,  -240,  -370, -1520,  -370}
-    }
-   ,{{  -240,  -240,  -370, -1280,  -370}
-    ,{  -240,  -240,  -370, -1520,  -370}
-    ,{  -240,  -240,  -370, -1280,  -370}
-    ,{  -240,  -240,  -370, -1520,  -370}
-    ,{  -240,  -240,  -370, -1280,  -370}
-    }
-   ,{{  1010,  1010,   880, -1340,   880}
-    ,{   -30,   -30,  -200, -1340,  -200}
-    ,{  -240,  -240,  -370, -1520,  -370}
-    ,{  1010,  1010,   880, -1520,   880}
-    ,{  -240,  -240,  -370, -1520,  -370}
-    }
-   ,{{     0,     0,  -370, -1280,  -370}
-    ,{  -240,  -240,  -370, -1520,  -370}
-    ,{  -240,  -240,  -370, -1280,  -370}
-    ,{  -240,  -240,  -370, -1520,  -370}
-    ,{     0,     0,  -370, -1520,  -370}
-    }
-   }
-  ,{{{   880,   730,   880,   730,   640}
-    ,{    40,  -350,    40,  -350,  -190}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    ,{   880,   730,   880,   730,   640}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    }
-   ,{{  -150,  -520,  -150,  -520,  -380}
-    ,{  -550,  -700,  -550,  -700,  -790}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    ,{  -150,  -540,  -150,  -540,  -380}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    }
-   ,{{  -370,  -520,  -370,  -520,  -610}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    }
-   ,{{   880,   730,   880,   730,   640}
-    ,{    40,  -350,    40,  -350,  -190}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    ,{   880,   730,   880,   730,   640}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    }
-   ,{{  -370,  -520,  -370,  -520,  -610}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    ,{  -370,  -520,  -370,  -520,  -610}
-    }
-   }
-  ,{{{   880, -1180,   880,   410,   880}
-    ,{   410, -1250,  -200,   410,  -200}
-    ,{   410, -1180,  -370,   410,  -370}
-    ,{   880, -1420,   880,   410,   880}
-    ,{   410, -1180,  -370,   410,  -370}
-    }
-   ,{{   410, -1420,  -370,   410,  -370}
-    ,{   230, -1600,  -550,   230,  -550}
-    ,{   410, -1420,  -370,   410,  -370}
-    ,{  -390, -1440,  -390,  -860,  -390}
-    ,{   410, -1420,  -370,   410,  -370}
-    }
-   ,{{   410, -1180,  -370,   410,  -370}
-    ,{   410, -1420,  -370,   410,  -370}
-    ,{   410, -1180,  -370,   410,  -370}
-    ,{   410, -1420,  -370,   410,  -370}
-    ,{   410, -1180,  -370,   410,  -370}
-    }
-   ,{{   880, -1250,   880,   410,   880}
-    ,{  -200, -1250,  -200,  -670,  -200}
-    ,{   410, -1420,  -370,   410,  -370}
-    ,{   880, -1420,   880,  -840,   880}
-    ,{   410, -1420,  -370,   410,  -370}
-    }
-   ,{{   410, -1180,  -370,   410,  -370}
-    ,{   410, -1420,  -370,   410,  -370}
-    ,{   410, -1180,  -370,   410,  -370}
-    ,{   410, -1420,  -370,   410,  -370}
-    ,{  -370, -1420,  -370,  -840,  -370}
-    }
-   }
-  ,{{{   750,   730,   750,   730, -1140}
-    ,{   -90,  -350,   -90,  -350, -1140}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{   750,   730,   750,   730, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    }
-   ,{{  -280,  -520,  -280,  -520, -1250}
-    ,{  -680,  -700,  -680,  -700, -1250}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -280,  -540,  -280,  -540, -1330}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    }
-   ,{{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    }
-   ,{{   750,   730,   750,   730, -1140}
-    ,{   -90,  -350,   -90,  -350, -1140}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{   750,   730,   750,   730, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    }
-   ,{{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    ,{  -500,  -520,  -500,  -520, -1310}
-    }
-   }
-  }
- ,{{{{  1560,  1560,  1430,  1470,  1430}
-    ,{  1470,   820,   690,  1470,   690}
-    ,{   960,   310,   180,   960,   180}
-    ,{  1560,  1560,  1430,  1280,  1430}
-    ,{   960,   550,   180,   960,   180}
-    }
-   ,{{  1470,   820,   690,  1470,   690}
-    ,{  1470,   820,   690,  1470,   690}
-    ,{   960,   310,   180,   960,   180}
-    ,{    80,   -30,    80,  -310,  -150}
-    ,{   960,   310,   180,   960,   180}
-    }
-   ,{{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    }
-   ,{{  1560,  1560,  1430,  1280,  1430}
-    ,{   -90,  -200,   -90,  -480,  -320}
-    ,{   960,   310,   180,   960,   180}
-    ,{  1560,  1560,  1430,  1280,  1430}
-    ,{   960,   310,   180,   960,   180}
-    }
-   ,{{   960,   550,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   960,   310,   180,   960,   180}
-    ,{   550,   550,   180,    30,   180}
-    }
-   }
-  ,{{{  1560,  1560,  1430,   -30,  1430}
-    ,{   820,   820,   690,   -30,   690}
-    ,{   310,   310,   180,  -720,   180}
-    ,{  1560,  1560,  1430,  -960,  1430}
-    ,{   550,   550,   180,  -720,   180}
-    }
-   ,{{   820,   820,   690,   -30,   690}
-    ,{   820,   820,   690,   -30,   690}
-    ,{   310,   310,   180,  -960,   180}
-    ,{   -30,   -30,  -160, -1300,  -160}
-    ,{   310,   310,   180,  -960,   180}
-    }
-   ,{{   310,   310,   180,  -720,   180}
-    ,{   310,   310,   180,  -960,   180}
-    ,{   310,   310,   180,  -720,   180}
-    ,{   310,   310,   180,  -960,   180}
-    ,{   310,   310,   180,  -720,   180}
-    }
-   ,{{  1560,  1560,  1430,  -960,  1430}
-    ,{  -200,  -200,  -330, -1470,  -330}
-    ,{   310,   310,   180,  -960,   180}
-    ,{  1560,  1560,  1430,  -960,  1430}
-    ,{   310,   310,   180,  -960,   180}
-    }
-   ,{{   550,   550,   180,  -720,   180}
-    ,{   310,   310,   180,  -960,   180}
-    ,{   310,   310,   180,  -720,   180}
-    ,{   310,   310,   180,  -960,   180}
-    ,{   550,   550,   180,  -960,   180}
-    }
-   }
-  ,{{{  1430,  1280,  1430,  1280,  1200}
-    ,{   690,   540,   690,   540,   450}
-    ,{   180,    30,   180,    30,   -50}
-    ,{  1430,  1280,  1430,  1280,  1200}
-    ,{   180,    30,   180,    30,   -50}
-    }
-   ,{{   690,   540,   690,   540,   450}
-    ,{   690,   540,   690,   540,   450}
-    ,{   180,    30,   180,    30,   -50}
-    ,{    80,  -310,    80,  -310,  -150}
-    ,{   180,    30,   180,    30,   -50}
-    }
-   ,{{   180,    30,   180,    30,   -50}
-    ,{   180,    30,   180,    30,   -50}
-    ,{   180,    30,   180,    30,   -50}
-    ,{   180,    30,   180,    30,   -50}
-    ,{   180,    30,   180,    30,   -50}
-    }
-   ,{{  1430,  1280,  1430,  1280,  1200}
-    ,{   -90,  -480,   -90,  -480,  -320}
-    ,{   180,    30,   180,    30,   -50}
-    ,{  1430,  1280,  1430,  1280,  1200}
-    ,{   180,    30,   180,    30,   -50}
-    }
-   ,{{   180,    30,   180,    30,   -50}
-    ,{   180,    30,   180,    30,   -50}
-    ,{   180,    30,   180,    30,   -50}
-    ,{   180,    30,   180,    30,   -50}
-    ,{   180,    30,   180,    30,   -50}
-    }
-   }
-  ,{{{  1470,  -360,  1430,  1470,  1430}
-    ,{  1470,  -360,   690,  1470,   690}
-    ,{   960,  -630,   180,   960,   180}
-    ,{  1430,  -870,  1430,   960,  1430}
-    ,{   960,  -630,   180,   960,   180}
-    }
-   ,{{  1470,  -360,   690,  1470,   690}
-    ,{  1470,  -360,   690,  1470,   690}
-    ,{   960,  -870,   180,   960,   180}
-    ,{  -160, -1210,  -160,  -630,  -160}
-    ,{   960,  -870,   180,   960,   180}
-    }
-   ,{{   960,  -630,   180,   960,   180}
-    ,{   960,  -870,   180,   960,   180}
-    ,{   960,  -630,   180,   960,   180}
-    ,{   960,  -870,   180,   960,   180}
-    ,{   960,  -630,   180,   960,   180}
-    }
-   ,{{  1430,  -870,  1430,   960,  1430}
-    ,{  -330, -1380,  -330,  -800,  -330}
-    ,{   960,  -870,   180,   960,   180}
-    ,{  1430,  -870,  1430,  -290,  1430}
-    ,{   960,  -870,   180,   960,   180}
-    }
-   ,{{   960,  -630,   180,   960,   180}
-    ,{   960,  -870,   180,   960,   180}
-    ,{   960,  -630,   180,   960,   180}
-    ,{   960,  -870,   180,   960,   180}
-    ,{   180,  -870,   180,  -290,   180}
-    }
-   }
-  ,{{{  1300,  1280,  1300,  1280,   -10}
-    ,{   560,   540,   560,   540,   -10}
-    ,{    50,    30,    50,    30,  -760}
-    ,{  1300,  1280,  1300,  1280,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    }
-   ,{{   560,   540,   560,   540,   -10}
-    ,{   560,   540,   560,   540,   -10}
-    ,{    50,    30,    50,    30,  -760}
-    ,{   -50,  -310,   -50,  -310, -1100}
-    ,{    50,    30,    50,    30,  -760}
-    }
-   ,{{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    }
-   ,{{  1300,  1280,  1300,  1280,  -760}
-    ,{  -220,  -480,  -220,  -480, -1270}
-    ,{    50,    30,    50,    30,  -760}
-    ,{  1300,  1280,  1300,  1280,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    }
-   ,{{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    ,{    50,    30,    50,    30,  -760}
-    }
-   }
-  }
- ,{{{{  2050,  1930,  1800,  2050,  1800}
-    ,{  2050,  1400,  1270,  2050,  1270}
-    ,{  1750,  1100,   970,  1750,   970}
-    ,{  1930,  1930,  1800,  1760,  1800}
-    ,{  1750,  1100,   970,  1750,   970}
-    }
-   ,{{  2050,  1400,  1270,  2050,  1270}
-    ,{  2050,  1400,  1270,  2050,  1270}
-    ,{  1740,  1090,   960,  1740,   960}
-    ,{   130,    10,   130,  -260,  -110}
-    ,{  1740,  1090,   960,  1740,   960}
-    }
-   ,{{  1760,  1110,   980,  1760,   980}
-    ,{  1760,  1110,   980,  1760,   980}
-    ,{  1750,  1100,   970,  1750,   970}
-    ,{  1760,  1110,   980,  1760,   980}
-    ,{  1750,  1100,   970,  1750,   970}
-    }
-   ,{{  1930,  1930,  1800,  1740,  1800}
-    ,{   300,   190,   300,   -80,    70}
-    ,{  1740,  1090,   960,  1740,   960}
-    ,{  1930,  1930,  1800,  1650,  1800}
-    ,{  1740,  1090,   960,  1740,   960}
-    }
-   ,{{  1760,  1110,   980,  1760,   980}
-    ,{  1760,  1110,   980,  1760,   980}
-    ,{  1750,  1100,   970,  1750,   970}
-    ,{  1760,  1110,   980,  1760,   980}
-    ,{   360,   360,     0,  -150,     0}
-    }
-   }
-  ,{{{  1930,  1930,  1800,   130,  1800}
-    ,{  1400,  1400,  1270,   130,  1270}
-    ,{  1100,  1100,   970,    70,   970}
-    ,{  1930,  1930,  1800,  -160,  1800}
-    ,{  1100,  1100,   970,    70,   970}
-    }
-   ,{{  1400,  1400,  1270,   130,  1270}
-    ,{  1400,  1400,  1270,   130,  1270}
-    ,{  1090,  1090,   960,  -180,   960}
-    ,{    10,    10,  -110, -1260,  -110}
-    ,{  1090,  1090,   960,  -180,   960}
-    }
-   ,{{  1110,  1110,   980,    70,   980}
-    ,{  1110,  1110,   980,  -160,   980}
-    ,{  1100,  1100,   970,    70,   970}
-    ,{  1110,  1110,   980,  -160,   980}
-    ,{  1100,  1100,   970,    70,   970}
-    }
-   ,{{  1930,  1930,  1800,  -180,  1800}
-    ,{   190,   190,    60, -1080,    60}
-    ,{  1090,  1090,   960,  -180,   960}
-    ,{  1930,  1930,  1800,  -590,  1800}
-    ,{  1090,  1090,   960,  -180,   960}
-    }
-   ,{{  1110,  1110,   980,    70,   980}
-    ,{  1110,  1110,   980,  -160,   980}
-    ,{  1100,  1100,   970,    70,   970}
-    ,{  1110,  1110,   980,  -160,   980}
-    ,{   360,   360,     0, -1150,     0}
-    }
-   }
-  ,{{{  1800,  1650,  1800,  1650,  1570}
-    ,{  1270,  1120,  1270,  1120,  1040}
-    ,{   970,   820,   970,   820,   740}
-    ,{  1800,  1650,  1800,  1650,  1570}
-    ,{   970,   820,   970,   820,   740}
-    }
-   ,{{  1270,  1120,  1270,  1120,  1040}
-    ,{  1270,  1120,  1270,  1120,  1040}
-    ,{   960,   810,   960,   810,   730}
-    ,{   130,  -260,   130,  -260,  -110}
-    ,{   960,   810,   960,   810,   730}
-    }
-   ,{{   980,   830,   980,   830,   740}
-    ,{   980,   830,   980,   830,   740}
-    ,{   970,   820,   970,   820,   740}
-    ,{   980,   830,   980,   830,   740}
-    ,{   970,   820,   970,   820,   740}
-    }
-   ,{{  1800,  1650,  1800,  1650,  1570}
-    ,{   300,   -80,   300,   -80,    70}
-    ,{   960,   810,   960,   810,   730}
-    ,{  1800,  1650,  1800,  1650,  1570}
-    ,{   960,   810,   960,   810,   730}
-    }
-   ,{{   980,   830,   980,   830,   740}
-    ,{   980,   830,   980,   830,   740}
-    ,{   970,   820,   970,   820,   740}
-    ,{   980,   830,   980,   830,   740}
-    ,{     0,  -150,     0,  -150,  -240}
-    }
-   }
-  ,{{{  2050,   220,  1800,  2050,  1800}
-    ,{  2050,   220,  1270,  2050,  1270}
-    ,{  1750,   170,   970,  1750,   970}
-    ,{  1800,   -70,  1800,  1760,  1800}
-    ,{  1750,   170,   970,  1750,   970}
-    }
-   ,{{  2050,   220,  1270,  2050,  1270}
-    ,{  2050,   220,  1270,  2050,  1270}
-    ,{  1740,   -80,   960,  1740,   960}
-    ,{  -110, -1160,  -110,  -580,  -110}
-    ,{  1740,   -80,   960,  1740,   960}
-    }
-   ,{{  1760,   170,   980,  1760,   980}
-    ,{  1760,   -70,   980,  1760,   980}
-    ,{  1750,   170,   970,  1750,   970}
-    ,{  1760,   -70,   980,  1760,   980}
-    ,{  1750,   170,   970,  1750,   970}
-    }
-   ,{{  1800,   -80,  1800,  1740,  1800}
-    ,{    60,  -980,    60,  -400,    60}
-    ,{  1740,   -80,   960,  1740,   960}
-    ,{  1800,  -490,  1800,    80,  1800}
-    ,{  1740,   -80,   960,  1740,   960}
-    }
-   ,{{  1760,   170,   980,  1760,   980}
-    ,{  1760,   -70,   980,  1760,   980}
-    ,{  1750,   170,   970,  1750,   970}
-    ,{  1760,   -70,   980,  1760,   980}
-    ,{     0, -1050,     0,  -470,     0}
-    }
-   }
-  ,{{{  1670,  1650,  1670,  1650,   570}
-    ,{  1140,  1120,  1140,  1120,   570}
-    ,{   840,   820,   840,   820,    30}
-    ,{  1670,  1650,  1670,  1650,    40}
-    ,{   840,   820,   840,   820,    30}
-    }
-   ,{{  1140,  1120,  1140,  1120,   570}
-    ,{  1140,  1120,  1140,  1120,   570}
-    ,{   830,   810,   830,   810,    20}
-    ,{     0,  -260,     0,  -260, -1050}
-    ,{   830,   810,   830,   810,    20}
-    }
-   ,{{   850,   830,   850,   830,    40}
-    ,{   850,   830,   850,   830,    40}
-    ,{   840,   820,   840,   820,    30}
-    ,{   850,   830,   850,   830,    40}
-    ,{   840,   820,   840,   820,    30}
-    }
-   ,{{  1670,  1650,  1670,  1650,    20}
-    ,{   180,   -80,   180,   -80,  -870}
-    ,{   830,   810,   830,   810,    20}
-    ,{  1670,  1650,  1670,  1650,  -380}
-    ,{   830,   810,   830,   810,    20}
-    }
-   ,{{   850,   830,   850,   830,    40}
-    ,{   850,   830,   850,   830,    40}
-    ,{   840,   820,   840,   820,    30}
-    ,{   850,   830,   850,   830,    40}
-    ,{  -130,  -150,  -130,  -150,  -940}
-    }
-   }
-  }
- ,{{{{  2120,  2120,  1990,  2120,  1990}
-    ,{  2120,  1470,  1340,  2120,  1340}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  2120,  2120,  1990,  1990,  1990}
-    ,{  1860,  1210,  1080,  1860,  1080}
-    }
-   ,{{  2120,  1470,  1340,  2120,  1340}
-    ,{  2120,  1470,  1340,  2120,  1340}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    ,{   180,    60,   180,  -210,   -60}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    }
-   ,{{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1860,  1210,  1080,  1860,  1080}
-    }
-   ,{{  2120,  2120,  1990,  1840,  1990}
-    ,{  -120,  -230,  -120,  -510,  -360}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    ,{  2120,  2120,  1990,  1840,  1990}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    }
-   ,{{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1550,   900,   770,  1550,   770}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{   640,   640,   270,   120,   270}
-    }
-   }
-  ,{{{  2120,  2120,  1990,   300,  1990}
-    ,{  1470,  1470,  1340,   190,  1340}
-    ,{  1340,  1340,  1210,   300,  1210}
-    ,{  2120,  2120,  1990,    60,  1990}
-    ,{  1210,  1210,  1080,   180,  1080}
-    }
-   ,{{  1470,  1470,  1340,   190,  1340}
-    ,{  1470,  1470,  1340,   190,  1340}
-    ,{  1190,  1190,  1060,   -80,  1060}
-    ,{    60,    60,   -60, -1210,   -60}
-    ,{  1190,  1190,  1060,   -80,  1060}
-    }
-   ,{{  1340,  1340,  1210,   300,  1210}
-    ,{  1340,  1340,  1210,    60,  1210}
-    ,{  1340,  1340,  1210,   300,  1210}
-    ,{  1340,  1340,  1210,    60,  1210}
-    ,{  1210,  1210,  1080,   180,  1080}
-    }
-   ,{{  2120,  2120,  1990,   -80,  1990}
-    ,{  -230,  -230,  -360, -1510,  -360}
-    ,{  1190,  1190,  1060,   -80,  1060}
-    ,{  2120,  2120,  1990,  -400,  1990}
-    ,{  1190,  1190,  1060,   -80,  1060}
-    }
-   ,{{  1340,  1340,  1210,    60,  1210}
-    ,{  1340,  1340,  1210,    60,  1210}
-    ,{   900,   900,   770,  -130,   770}
-    ,{  1340,  1340,  1210,    60,  1210}
-    ,{   640,   640,   270,  -870,   270}
-    }
-   }
-  ,{{{  1990,  1840,  1990,  1840,  1750}
-    ,{  1340,  1190,  1340,  1190,  1100}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{  1990,  1840,  1990,  1840,  1750}
-    ,{  1080,   930,  1080,   930,   840}
-    }
-   ,{{  1340,  1190,  1340,  1190,  1100}
-    ,{  1340,  1190,  1340,  1190,  1100}
-    ,{  1060,   910,  1060,   910,   820}
-    ,{   180,  -210,   180,  -210,   -60}
-    ,{  1060,   910,  1060,   910,   820}
-    }
-   ,{{  1210,  1060,  1210,  1060,   970}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{  1080,   930,  1080,   930,   840}
-    }
-   ,{{  1990,  1840,  1990,  1840,  1750}
-    ,{  -120,  -510,  -120,  -510,  -360}
-    ,{  1060,   910,  1060,   910,   820}
-    ,{  1990,  1840,  1990,  1840,  1750}
-    ,{  1060,   910,  1060,   910,   820}
-    }
-   ,{{  1210,  1060,  1210,  1060,   970}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{   770,   620,   770,   620,   530}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{   270,   120,   270,   120,    30}
-    }
-   }
-  ,{{{  2120,   400,  1990,  2120,  1990}
-    ,{  2120,   290,  1340,  2120,  1340}
-    ,{  1990,   400,  1210,  1990,  1210}
-    ,{  1990,   160,  1990,  1990,  1990}
-    ,{  1860,   270,  1080,  1860,  1080}
-    }
-   ,{{  2120,   290,  1340,  2120,  1340}
-    ,{  2120,   290,  1340,  2120,  1340}
-    ,{  1840,    10,  1060,  1840,  1060}
-    ,{   -60, -1110,   -60,  -530,   -60}
-    ,{  1840,    10,  1060,  1840,  1060}
-    }
-   ,{{  1990,   400,  1210,  1990,  1210}
-    ,{  1990,   160,  1210,  1990,  1210}
-    ,{  1990,   400,  1210,  1990,  1210}
-    ,{  1990,   160,  1210,  1990,  1210}
-    ,{  1860,   270,  1080,  1860,  1080}
-    }
-   ,{{  1990,    10,  1990,  1840,  1990}
-    ,{  -360, -1410,  -360,  -830,  -360}
-    ,{  1840,    10,  1060,  1840,  1060}
-    ,{  1990,  -310,  1990,   270,  1990}
-    ,{  1840,    10,  1060,  1840,  1060}
-    }
-   ,{{  1990,   160,  1210,  1990,  1210}
-    ,{  1990,   160,  1210,  1990,  1210}
-    ,{  1550,   -40,   770,  1550,   770}
-    ,{  1990,   160,  1210,  1990,  1210}
-    ,{   270,  -780,   270,  -200,   270}
-    }
-   }
-  ,{{{  1860,  1840,  1860,  1840,   640}
-    ,{  1210,  1190,  1210,  1190,   640}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1860,  1840,  1860,  1840,   270}
-    ,{   950,   930,   950,   930,   140}
-    }
-   ,{{  1210,  1190,  1210,  1190,   640}
-    ,{  1210,  1190,  1210,  1190,   640}
-    ,{   930,   910,   930,   910,   120}
-    ,{    50,  -210,    50,  -210, -1000}
-    ,{   930,   910,   930,   910,   120}
-    }
-   ,{{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   950,   930,   950,   930,   140}
-    }
-   ,{{  1860,  1840,  1860,  1840,   120}
-    ,{  -250,  -510,  -250,  -510, -1300}
-    ,{   930,   910,   930,   910,   120}
-    ,{  1860,  1840,  1860,  1840,  -200}
-    ,{   930,   910,   930,   910,   120}
-    }
-   ,{{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   640,   620,   640,   620,  -170}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   140,   120,   140,   120,  -670}
-    }
-   }
-  }
- ,{{{{  2120,  2120,  1990,  2120,  1990}
-    ,{  2120,  1470,  1340,  2120,  1340}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  2120,  2120,  1990,  1990,  1990}
-    ,{  1860,  1210,  1080,  1860,  1080}
-    }
-   ,{{  2120,  1470,  1340,  2120,  1340}
-    ,{  2120,  1470,  1340,  2120,  1340}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    ,{   400,   290,   400,    10,   170}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    }
-   ,{{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1860,  1210,  1080,  1860,  1080}
-    }
-   ,{{  2120,  2120,  1990,  1840,  1990}
-    ,{   540,   190,   540,   -80,    70}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    ,{  2120,  2120,  1990,  1840,  1990}
-    ,{  1840,  1190,  1060,  1840,  1060}
-    }
-   ,{{  1990,  1340,  1210,  1990,  1210}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{  1750,  1100,   970,  1750,   970}
-    ,{  1990,  1340,  1210,  1990,  1210}
-    ,{   640,   640,   270,   120,   270}
-    }
-   }
-  ,{{{  2120,  2120,  1990,   540,  1990}
-    ,{  1470,  1470,  1340,   190,  1340}
-    ,{  1340,  1340,  1210,   540,  1210}
-    ,{  2120,  2120,  1990,    60,  1990}
-    ,{  1210,  1210,  1080,   180,  1080}
-    }
-   ,{{  1470,  1470,  1340,   190,  1340}
-    ,{  1470,  1470,  1340,   190,  1340}
-    ,{  1190,  1190,  1060,   -80,  1060}
-    ,{   290,   290,   160,  -980,   160}
-    ,{  1190,  1190,  1060,   -80,  1060}
-    }
-   ,{{  1340,  1340,  1210,   540,  1210}
-    ,{  1340,  1340,  1210,    60,  1210}
-    ,{  1340,  1340,  1210,   540,  1210}
-    ,{  1340,  1340,  1210,    60,  1210}
-    ,{  1210,  1210,  1080,   180,  1080}
-    }
-   ,{{  2120,  2120,  1990,   -80,  1990}
-    ,{   190,   190,    60, -1080,    60}
-    ,{  1190,  1190,  1060,   -80,  1060}
-    ,{  2120,  2120,  1990,  -400,  1990}
-    ,{  1190,  1190,  1060,   -80,  1060}
-    }
-   ,{{  1340,  1340,  1210,    70,  1210}
-    ,{  1340,  1340,  1210,    60,  1210}
-    ,{  1100,  1100,   970,    70,   970}
-    ,{  1340,  1340,  1210,    60,  1210}
-    ,{   640,   640,   270,  -810,   270}
-    }
-   }
-  ,{{{  1990,  1840,  1990,  1840,  1750}
-    ,{  1340,  1190,  1340,  1190,  1100}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{  1990,  1840,  1990,  1840,  1750}
-    ,{  1080,   930,  1080,   930,   840}
-    }
-   ,{{  1340,  1190,  1340,  1190,  1100}
-    ,{  1340,  1190,  1340,  1190,  1100}
-    ,{  1060,   910,  1060,   910,   820}
-    ,{   400,    10,   400,    10,   170}
-    ,{  1060,   910,  1060,   910,   820}
-    }
-   ,{{  1210,  1060,  1210,  1060,   970}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{  1080,   930,  1080,   930,   840}
-    }
-   ,{{  1990,  1840,  1990,  1840,  1750}
-    ,{   540,   -80,   540,   -80,    70}
-    ,{  1060,   910,  1060,   910,   820}
-    ,{  1990,  1840,  1990,  1840,  1750}
-    ,{  1060,   910,  1060,   910,   820}
-    }
-   ,{{  1210,  1060,  1210,  1060,   970}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{   970,   820,   970,   820,   740}
-    ,{  1210,  1060,  1210,  1060,   970}
-    ,{   270,   120,   270,   120,    30}
-    }
-   }
-  ,{{{  2120,   400,  1990,  2120,  1990}
-    ,{  2120,   290,  1340,  2120,  1340}
-    ,{  1990,   400,  1210,  1990,  1210}
-    ,{  1990,   160,  1990,  1990,  1990}
-    ,{  1860,   270,  1080,  1860,  1080}
-    }
-   ,{{  2120,   290,  1340,  2120,  1340}
-    ,{  2120,   290,  1340,  2120,  1340}
-    ,{  1840,    10,  1060,  1840,  1060}
-    ,{   160,  -890,   160,  -310,   160}
-    ,{  1840,    10,  1060,  1840,  1060}
-    }
-   ,{{  1990,   400,  1210,  1990,  1210}
-    ,{  1990,   160,  1210,  1990,  1210}
-    ,{  1990,   400,  1210,  1990,  1210}
-    ,{  1990,   160,  1210,  1990,  1210}
-    ,{  1860,   270,  1080,  1860,  1080}
-    }
-   ,{{  1990,    10,  1990,  1840,  1990}
-    ,{    60,  -980,    60,  -400,    60}
-    ,{  1840,    10,  1060,  1840,  1060}
-    ,{  1990,  -310,  1990,   270,  1990}
-    ,{  1840,    10,  1060,  1840,  1060}
-    }
-   ,{{  1990,   170,  1210,  1990,  1210}
-    ,{  1990,   160,  1210,  1990,  1210}
-    ,{  1750,   170,   970,  1750,   970}
-    ,{  1990,   160,  1210,  1990,  1210}
-    ,{   270,  -780,   270,  -200,   270}
-    }
-   }
-  ,{{{  1860,  1840,  1860,  1840,   640}
-    ,{  1210,  1190,  1210,  1190,   640}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1860,  1840,  1860,  1840,   270}
-    ,{   950,   930,   950,   930,   140}
-    }
-   ,{{  1210,  1190,  1210,  1190,   640}
-    ,{  1210,  1190,  1210,  1190,   640}
-    ,{   930,   910,   930,   910,   120}
-    ,{   270,    10,   270,    10,  -780}
-    ,{   930,   910,   930,   910,   120}
-    }
-   ,{{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   950,   930,   950,   930,   140}
-    }
-   ,{{  1860,  1840,  1860,  1840,   120}
-    ,{   180,   -80,   180,   -80,  -810}
-    ,{   930,   910,   930,   910,   120}
-    ,{  1860,  1840,  1860,  1840,  -200}
-    ,{   930,   910,   930,   910,   120}
-    }
-   ,{{  1080,  1060,  1080,  1060,   270}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   840,   820,   840,   820,    30}
-    ,{  1080,  1060,  1080,  1060,   270}
-    ,{   140,   120,   140,   120,  -670}
-    }
-   }
-  }
- }};
diff --git a/include/list.h b/include/list.h
deleted file mode 100644
--- a/include/list.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-  $Log: list.h,v $
-  Revision 1.2  2000/10/10 08:50:01  ivo
-  some annotation for lclint
-
-  Revision 1.1  1997/08/04 21:05:32  walter
-  Initial revision
-
-*/
-
-#ifndef	__LIST_H
-#define	__LIST_H
-
-/*---------------------- Macros and type definitions ----------------------*/
-
-typedef struct LST_BUCKET {
-  struct LST_BUCKET *next;
-}
-LST_BUCKET;
-
-typedef struct {
-  int count;			/* Number of elements currently in list */
-  LST_BUCKET *head;		/* Pointer to head element of list      */
-  LST_BUCKET *z;		/* Pointer to last node of list         */
-  LST_BUCKET hz[2];		/* Space for head and z nodes           */
-}
-LIST;
-
-/* Return a pointer to the user space given the address of the header of
- * a node.
- */
-
-#define	LST_USERSPACE(h)	((void*)((LST_BUCKET*)(h) + 1))
-
-/* Return a pointer to the header of a node, given the address of the
- * user space.
- */
-
-#define	LST_HEADER(n)		((LST_BUCKET*)(n) - 1)
-
-/* Return a pointer to the user space of the list's head node. This user
- * space does not actually exist, but it is useful to be able to address
- * it to enable insertion at the start of the list.
- */
-
-#define	LST_HEAD(l)		LST_USERSPACE((l)->head)
-
-/* Determine if a list is empty
- */
-
-#define	LST_EMPTY(l)		((l)->count == 0)
-
-/*-------------------------- Function Prototypes --------------------------*/
-
-/*@only@*//*@out@*/ void *lst_newnode (int size);
-void lst_freenode (/*@only@*/ void *node);
-/*@only@*//*@out@*/  LIST *lst_init (void);
-void lst_kill (LIST * l, void (*freeNode) ());
-void lst_insertafter (LIST * l, /*@keep@*/ void *node, void *after);
-void *lst_deletenext (/*@only@*/ LIST * l, void *node);
-/*@dependent@*/ void *lst_first (LIST * l);
-/*@dependent@*/ void *lst_next (void *prev);
-void lst_mergesort (LIST * l, int (*cmp_func) ());
-
-#endif
diff --git a/include/loop_energies.h b/include/loop_energies.h
deleted file mode 100644
--- a/include/loop_energies.h
+++ /dev/null
@@ -1,660 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_LOOP_ENERGIES_H__
-#define __VIENNA_RNA_PACKAGE_LOOP_ENERGIES_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <ctype.h>
-#include <string.h>
-#include "params.h"
-#include "fold_vars.h"
-#include "energy_par.h"
-
-#ifdef __GNUC__
-# define INLINE inline
-#else
-# define INLINE
-#endif
-
-/**
- *  \file loop_energies.h
- *  \brief Energy evaluation for MFE and partition function calculations
- * 
- *  <P>
- *  This file contains functions for the calculation of the free energy \f$\Delta G\f$
- *  of a hairpin- [ E_Hairpin() ] or interior-loop [ E_IntLoop()] .<BR>
- *  The unit of the free energy returned is \f$10^{-2} * \mathrm{kcal}/\mathrm{mol}\f$
- *  </P>
- *  <P>
- *  In case of computing the partition function, this file also supplies functions
- *  which return the Boltzmann weights \f$e^{-\Delta G/kT} \f$ for a hairpin- [ exp_E_Hairpin() ]
- *  or interior-loop [ exp_E_IntLoop() ].
- *  </P>
- */
-
-/**
- *  \def E_MLstem(A,B,C,D)
- *  <H2>Compute the Energy contribution of a Multiloop stem</H2>
- *  This definition is a wrapper for the E_Stem() funtion.
- *  It is substituted by an E_Stem() funtion call with argument
- *  extLoop=0, so the energy contribution returned reflects a
- *  stem introduced in a multiloop.<BR>
- *  As for the parameters B (si1) and C (sj1) of the substituted
- *  E_Stem() function, you can inhibit to take 5'-, 3'-dangles
- *  or mismatch contributions to be taken into account by passing
- *  -1 to these parameters.
- * 
- *  \see    E_Stem()
- *  \param  A The pair type of the stem-closing pair
- *  \param  B The 5'-mismatching nucleotide
- *  \param  C The 3'-mismatching nucleotide
- *  \param  D The datastructure containing scaled energy parameters
- *  \return   The energy contribution of the introduced multiloop stem
- */
-INLINE  PRIVATE int E_MLstem( int type,
-                              int si1,
-                              int sj1,
-                              paramT *P);
-
-/**
- *  \def exp_E_MLstem(A,B,C,D)
- *  This is the partition function variant of \ref E_MLstem()
- *  \see E_MLstem()
- *  \return The Boltzmann weighted energy contribution of the introduced multiloop stem
- */
-INLINE  PRIVATE double exp_E_MLstem(int type,
-                                    int si1,
-                                    int sj1,
-                                    pf_paramT *P);
-
-/**
- *  \def E_ExtLoop(A,B,C,D)
- *  <H2>Compute the Energy contribution of an Exterior loop stem</H2>
- *  This definition is a wrapper for the E_Stem() funtion.
- *  It is substituted by an E_Stem() funtion call with argument
- *  extLoop=1, so the energy contribution returned reflects a
- *  stem introduced in an exterior-loop.<BR>
- *  As for the parameters B (si1) and C (sj1) of the substituted
- *  E_Stem() function, you can inhibit to take 5'-, 3'-dangles
- *  or mismatch contributions to be taken into account by passing
- *  -1 to these parameters.
- * 
- *  \see    E_Stem()
- *  \param  A The pair type of the stem-closing pair
- *  \param  B The 5'-mismatching nucleotide
- *  \param  C The 3'-mismatching nucleotide
- *  \param  D The datastructure containing scaled energy parameters
- *  \return   The energy contribution of the introduced exterior-loop stem
- */
-INLINE  PRIVATE int E_ExtLoop(int type,
-                              int si1,
-                              int sj1,
-                              paramT *P);
-
-/**
- *  \def exp_E_ExtLoop(A,B,C,D)
- *  This is the partition function variant of \ref E_ExtLoop()
- *  \see E_ExtLoop()
- *  \return The Boltzmann weighted energy contribution of the introduced exterior-loop stem
- */
-INLINE  PRIVATE double exp_E_ExtLoop( int type,
-                                      int si1,
-                                      int sj1,
-                                      pf_paramT *P);
-
-/**
- *  <H2>Compute the Energy of an interior-loop</H2>
- *  This function computes the free energy \f$\Delta G\f$ of an interior-loop with the
- *  following structure: <BR>
- *  <PRE>
- *        3'  5'
- *        |   |
- *        U - V
- *    a_n       b_1
- *     .        .
- *     .        .
- *     .        .
- *    a_1       b_m
- *        X - Y
- *        |   |
- *        5'  3'
- *  </PRE>
- *  This general structure depicts an interior-loop that is closed by the base pair (X,Y).
- *  The enclosed base pair is (V,U) which leaves the unpaired bases a_1-a_n and b_1-b_n
- *  that constitute the loop. In this example, the length of the interior-loop is \f$(n+m)\f$
- *  where n or m may be 0 resulting in a bulge-loop or base pair stack.
- *  The mismatching nucleotides for the closing pair (X,Y) are:<BR>
- *  5'-mismatch: a_1<BR>
- *  3'-mismatch: b_m<BR>
- *  and for the enclosed base pair (V,U):<BR>
- *  5'-mismatch: b_1<BR>
- *  3'-mismatch: a_n<BR>
- *  \note Base pairs are always denoted in 5'->3' direction. Thus the enclosed base pair
- *  must be 'turned arround' when evaluating the free energy of the interior-loop
- *  \see scale_parameters()
- *  \see paramT
- *  \note This function is threadsafe
- * 
- *  \param  n1      The size of the 'left'-loop (number of unpaired nucleotides)
- *  \param  n2      The size of the 'right'-loop (number of unpaired nucleotides)
- *  \param  type    The pair type of the base pair closing the interior loop
- *  \param  type_2  The pair type of the enclosed base pair
- *  \param  si1     The 5'-mismatching nucleotide of the closing pair
- *  \param  sj1     The 3'-mismatching nucleotide of the closing pair
- *  \param  sp1     The 3'-mismatching nucleotide of the enclosed pair
- *  \param  sq1     The 5'-mismatching nucleotide of the enclosed pair
- *  \param  P       The datastructure containing scaled energy parameters
- *  \return The Free energy of the Interior-loop in dcal/mol
- */
-INLINE  PRIVATE int E_IntLoop(int n1,
-                              int n2,
-                              int type,
-                              int type_2,
-                              int si1,
-                              int sj1,
-                              int sp1,
-                              int sq1,
-                              paramT *P);
-
-
-/**
- *  <H2>Compute the Energy of a hairpin-loop</H2>
- *  To evaluate the free energy of a hairpin-loop, several parameters have to be known.
- *  A general hairpin-loop has this structure:<BR>
- *  <PRE>
- *        a3 a4
- *      a2     a5
- *      a1     a6
- *        X - Y
- *        |   |
- *        5'  3'
- *  </PRE>
- *  where X-Y marks the closing pair [e.g. a <B>(G,C)</B> pair]. The length of this loop is 6 as there are
- *  six unpaired nucleotides (a1-a6) enclosed by (X,Y). The 5' mismatching nucleotide is
- *  a1 while the 3' mismatch is a6. The nucleotide sequence of this loop is &quot;a1.a2.a3.a4.a5.a6&quot; <BR>
- *  \note The parameter sequence should contain the sequence of the loop in capital letters of the nucleic acid
- *  alphabet if the loop size is below 7. This is useful for unusually stable tri-, tetra- and hexa-loops
- *  which are treated differently (based on experimental data) if they are tabulated.
- *  @see scale_parameters()
- *  @see paramT
- *  \warning Not (really) thread safe! A threadsafe implementation will replace this function in a future release!\n
- *  Energy evaluation may change due to updates in global variable "tetra_loop"
- * 
- *  \param  size  The size of the loop (number of unpaired nucleotides)
- *  \param  type  The pair type of the base pair closing the hairpin
- *  \param  si1   The 5'-mismatching nucleotide
- *  \param  sj1   The 3'-mismatching nucleotide
- *  \param  string  The sequence of the loop
- *  \param  P     The datastructure containing scaled energy parameters
- *  \return The Free energy of the Hairpin-loop in dcal/mol
- */
-INLINE  PRIVATE int E_Hairpin(int size,
-                              int type,
-                              int si1,
-                              int sj1,
-                              const char *string,
-                              paramT *P);
-
-/**
- *  <H2>Compute the energy contribution of a stem branching off a loop-region</H2>
- *  This function computes the energy contribution of a stem that branches off
- *  a loop region. This can be the case in multiloops, when a stem branching off
- *  increases the degree of the loop but also <I>immediately interior base pairs</I>
- *  of an exterior loop contribute free energy.
- *  To switch the bahavior of the function according to the evaluation of a multiloop-
- *  or exterior-loop-stem, you pass the flag 'extLoop'.
- *  The returned energy contribution consists of a TerminalAU penalty if the pair type
- *  is greater than 2, dangling end contributions of mismatching nucleotides adjacent to
- *  the stem if only one of the si1, sj1 parameters is greater than 0 and mismatch energies
- *  if both mismatching nucleotides are positive values.
- *  Thus, to avoid incooperating dangling end or mismatch energies just pass a negative number,
- *  e.g. -1 to the mismatch argument.
- * 
- *  This is an illustration of how the energy contribution is assembled:
- *  <PRE>
- *        3'  5'
- *        |   |
- *        X - Y
- *  5'-si1     sj1-3'
- *  </PRE>
- * 
- *  Here, (X,Y) is the base pair that closes the stem that branches off a loop region.
- *  The nucleotides si1 and sj1 are the 5'- and 3'- mismatches, respectively. If the base pair
- *  type of (X,Y) is greater than 2 (i.e. an A-U or G-U pair, the TerminalAU penalty will be
- *  included in the energy contribution returned. If si1 and sj1 are both nonnegative numbers,
- *  mismatch energies will also be included. If one of sij or sj1 is a negtive value, only
- *  5' or 3' dangling end contributions are taken into account. To prohibit any of these mismatch
- *  contributions to be incoorporated, just pass a negative number to both, si1 and sj1.
- *  In case the argument extLoop is 0, the returned energy contribution also includes
- *  the <I>internal-loop-penalty</I> of a multiloop stem with closing pair type.
- * 
- *  \see    E_MLstem()
- *  \see    E_ExtLoop()
- *  \note   This function is threadsafe
- * 
- *  \param  type    The pair type of the first base pair un the stem
- *  \param  si1     The 5'-mismatching nucleotide
- *  \param  sj1     The 3'-mismatching nucleotide
- *  \param  extLoop A flag that indicates whether the contribution reflects the one of an exterior loop or not
- *  \param  P       The datastructure containing scaled energy parameters
- *  \return         The Free energy of the branch off the loop in dcal/mol
- * 
- */
-INLINE  PRIVATE int E_Stem( int type,
-                            int si1,
-                            int sj1,
-                            int extLoop,
-                            paramT *P);
-
-/**
- *  <H2>Compute the Boltzmann weighted energy contribution of a stem branching off a loop-region</H2>
- *  This is the partition function variant of \ref E_Stem()
- *  \see E_Stem()
- *  \note This function is threadsafe
- * 
- *  \return The Boltzmann weighted energy contribution of the branch off the loop
- */
-INLINE  PRIVATE double exp_E_Stem(int type,
-                                  int si1,
-                                  int sj1,
-                                  int extLoop,
-                                  pf_paramT *P);
-
-/**
- *  <H2>Compute Boltzmann weight \f$e^{-\Delta G/kT} \f$ of a hairpin loop</H2>
- *  multiply by scale[u+2]
- *  @see get_scaled_pf_parameters()
- *  @see pf_paramT
- *  @see E_Hairpin()
- *  \warning Not (really) thread safe! A threadsafe implementation will replace this function in a future release!\n
- *  Energy evaluation may change due to updates in global variable "tetra_loop"
- * 
- *  \param  u       The size of the loop (number of unpaired nucleotides)
- *  \param  type    The pair type of the base pair closing the hairpin
- *  \param  si1     The 5'-mismatching nucleotide
- *  \param  sj1     The 3'-mismatching nucleotide
- *  \param  string  The sequence of the loop
- *  \param  P       The datastructure containing scaled Boltzmann weights of the energy parameters
- *  \return The Boltzmann weight of the Hairpin-loop
- */
-INLINE  PRIVATE double exp_E_Hairpin( int u,
-                                      int type,
-                                      short si1,
-                                      short sj1,
-                                      const char *string,
-                                      pf_paramT *P);
-
-/**
- *  <H2>Compute Boltzmann weight \f$e^{-\Delta G/kT} \f$ of interior loop</H2>
- *  multiply by scale[u1+u2+2] for scaling
- *  @see get_scaled_pf_parameters()
- *  @see pf_paramT
- *  @see E_IntLoop()
- *  \note This function is threadsafe
- * 
- *  \param  u1      The size of the 'left'-loop (number of unpaired nucleotides)
- *  \param  u2      The size of the 'right'-loop (number of unpaired nucleotides)
- *  \param  type    The pair type of the base pair closing the interior loop
- *  \param  type2   The pair type of the enclosed base pair
- *  \param  si1     The 5'-mismatching nucleotide of the closing pair
- *  \param  sj1     The 3'-mismatching nucleotide of the closing pair
- *  \param  sp1     The 3'-mismatching nucleotide of the enclosed pair
- *  \param  sq1     The 5'-mismatching nucleotide of the enclosed pair
- *  \param  P       The datastructure containing scaled Boltzmann weights of the energy parameters
- *  \return The Boltzmann weight of the Interior-loop
- */
-INLINE  PRIVATE double  exp_E_IntLoop(int u1,
-                                      int u2,
-                                      int type,
-                                      int type2,
-                                      short si1,
-                                      short sj1,
-                                      short sp1,
-                                      short sq1,
-                                      pf_paramT *P);
-
-
-/*
-#################################
-# BEGIN OF FUNCTION DEFINITIONS #
-#################################
-*/
-INLINE  PRIVATE int E_Hairpin(int size, int type, int si1, int sj1, const char *string, paramT *P){
-  int energy;
-
-  energy = (size <= 30) ? P->hairpin[size] : P->hairpin[30]+(int)(P->lxc*log((size)/30.));
-  if (P->model_details.special_hp){
-    if (size == 4) { /* check for tetraloop bonus */
-      char tl[7]={0}, *ts;
-      strncpy(tl, string, 6);
-      if ((ts=strstr(P->Tetraloops, tl)))
-        return (P->Tetraloop_E[(ts - P->Tetraloops)/7]);
-    }
-    else if (size == 6) {
-      char tl[9]={0}, *ts;
-      strncpy(tl, string, 8);
-      if ((ts=strstr(P->Hexaloops, tl)))
-        return (energy = P->Hexaloop_E[(ts - P->Hexaloops)/9]);
-    }
-    else if (size == 3) {
-      char tl[6]={0,0,0,0,0,0}, *ts;
-      strncpy(tl, string, 5);
-      if ((ts=strstr(P->Triloops, tl))) {
-        return (P->Triloop_E[(ts - P->Triloops)/6]);
-      }
-      return (energy + (type>2 ? P->TerminalAU : 0));
-    }
-  }
-  energy += P->mismatchH[type][si1][sj1];
-
-  return energy;
-}
-
-INLINE  PRIVATE int E_IntLoop(int n1, int n2, int type, int type_2, int si1, int sj1, int sp1, int sq1, paramT *P){
-  /* compute energy of degree 2 loop (stack bulge or interior) */
-  int nl, ns, energy;
-  energy = INF;
-
-  if (n1>n2) { nl=n1; ns=n2;}
-  else {nl=n2; ns=n1;}
-
-  if (nl == 0)
-    return P->stack[type][type_2];  /* stack */
-
-  if (ns==0) {                      /* bulge */
-    energy = (nl<=MAXLOOP)?P->bulge[nl]:
-      (P->bulge[30]+(int)(P->lxc*log(nl/30.)));
-    if (nl==1) energy += P->stack[type][type_2];
-    else {
-      if (type>2) energy += P->TerminalAU;
-      if (type_2>2) energy += P->TerminalAU;
-    }
-    return energy;
-  }
-  else {                            /* interior loop */
-    if (ns==1) {
-      if (nl==1)                    /* 1x1 loop */
-        return P->int11[type][type_2][si1][sj1];
-      if (nl==2) {                  /* 2x1 loop */
-        if (n1==1)
-          energy = P->int21[type][type_2][si1][sq1][sj1];
-        else
-          energy = P->int21[type_2][type][sq1][si1][sp1];
-        return energy;
-      }
-      else {  /* 1xn loop */
-        energy = (nl+1<=MAXLOOP)?(P->internal_loop[nl+1]) : (P->internal_loop[30]+(int)(P->lxc*log((nl+1)/30.)));
-        energy += MIN2(MAX_NINIO, (nl-ns)*P->ninio[2]);
-        energy += P->mismatch1nI[type][si1][sj1] + P->mismatch1nI[type_2][sq1][sp1];
-        return energy;
-      }
-    }
-    else if (ns==2) {
-      if(nl==2)      {              /* 2x2 loop */
-        return P->int22[type][type_2][si1][sp1][sq1][sj1];}
-      else if (nl==3){              /* 2x3 loop */
-        energy = P->internal_loop[5]+P->ninio[2];
-        energy += P->mismatch23I[type][si1][sj1] + P->mismatch23I[type_2][sq1][sp1];
-        return energy;
-      }
-
-    }
-    { /* generic interior loop (no else here!)*/
-      energy = (n1+n2<=MAXLOOP)?(P->internal_loop[n1+n2]) : (P->internal_loop[30]+(int)(P->lxc*log((n1+n2)/30.)));
-
-      energy += MIN2(MAX_NINIO, (nl-ns)*P->ninio[2]);
-
-      energy += P->mismatchI[type][si1][sj1] + P->mismatchI[type_2][sq1][sp1];
-    }
-  }
-  return energy;
-}
-
-INLINE  PRIVATE int E_Stem(int type, int si1, int sj1, int extLoop, paramT *P){
-  int energy = 0;
-  int d5 = (si1 >= 0) ? P->dangle5[type][si1] : 0;
-  int d3 = (sj1 >= 0) ? P->dangle3[type][sj1] : 0;
-
-  if(type > 2)
-    energy += P->TerminalAU;
-
-  if(si1 >= 0 && sj1 >= 0)
-    energy += (extLoop) ? P->mismatchExt[type][si1][sj1] : P->mismatchM[type][si1][sj1];
-  else
-    energy += d5 + d3;
-
-  if(!extLoop) energy += P->MLintern[type];
-  return energy;
-}
-
-INLINE  PRIVATE int E_ExtLoop(int type, int si1, int sj1, paramT *P){
-  int energy = 0;
-  if(si1 >= 0 && sj1 >= 0){
-    energy += P->mismatchExt[type][si1][sj1];
-  }
-  else if (si1 >= 0){
-    energy += P->dangle5[type][si1];
-  }
-  else if (sj1 >= 0){
-    energy += P->dangle3[type][sj1];
-  }
-
-  if(type > 2)
-    energy += P->TerminalAU;
-
-  return energy;
-}
-
-INLINE  PRIVATE int E_MLstem(int type, int si1, int sj1, paramT *P){
-  int energy = 0;
-  if(si1 >= 0 && sj1 >= 0){
-    energy += P->mismatchM[type][si1][sj1];
-  }
-  else if (si1 >= 0){
-    energy += P->dangle5[type][si1];
-  }
-  else if (sj1 >= 0){
-    energy += P->dangle3[type][sj1];
-  }
-
-  if(type > 2)
-    energy += P->TerminalAU;
-
-  energy += P->MLintern[type];
-
-  return energy;
-}
-
-INLINE  PRIVATE double exp_E_Hairpin(int u, int type, short si1, short sj1, const char *string, pf_paramT *P){
-  double q, kT;
-  kT = P->kT;   /* kT in cal/mol  */
-
-  if(u <= 30)
-    q = P->exphairpin[u];
-  else
-    q = P->exphairpin[30] * exp( -(P->lxc*log( u/30.))*10./kT);
-
-  if(u < 3) return q; /* should only be the case when folding alignments */
-
-  if(P->model_details.special_hp){
-    if(u==4) {
-      char tl[7]={0,0,0,0,0,0,0}, *ts;
-      strncpy(tl, string, 6);
-      if ((ts=strstr(P->Tetraloops, tl))){
-        if(type != 7)
-          return (P->exptetra[(ts-P->Tetraloops)/7]);
-        else
-          q *= P->exptetra[(ts-P->Tetraloops)/7];
-      }
-    }
-    if (u==6) {
-      char tl[9]={0,0,0,0,0,0,0,0,0}, *ts;
-      strncpy(tl, string, 8);
-      if ((ts=strstr(P->Hexaloops, tl)))
-        return  (P->exphex[(ts-P->Hexaloops)/9]);
-    }
-    if (u==3) {
-      char tl[6]={0,0,0,0,0,0}, *ts;
-      strncpy(tl, string, 5);
-      if ((ts=strstr(P->Triloops, tl)))
-        return (P->exptri[(ts-P->Triloops)/6]);
-      if (type>2)
-        return q *= P->expTermAU;
-    }
-  }
-  /* no mismatches for tri-loops */
-  q *= P->expmismatchH[type][si1][sj1];
-
-  return q;
-}
-
-INLINE  PRIVATE double exp_E_IntLoop(int u1, int u2, int type, int type2, short si1, short sj1, short sp1, short sq1, pf_paramT *P){
-  int ul, us, no_close = 0;
-  double z = 0.;
-
-  if ((no_closingGU) && ((type2==3)||(type2==4)||(type==3)||(type==4)))
-    no_close = 1;
-
-  if (u1>u2) { ul=u1; us=u2;}
-  else {ul=u2; us=u1;}
-
-  if (ul==0) /* stack */
-    z = P->expstack[type][type2];
-  else if(!no_close){
-    if (us==0) {                      /* bulge */
-      z = P->expbulge[ul];
-      if (ul==1) z *= P->expstack[type][type2];
-      else {
-        if (type>2) z *= P->expTermAU;
-        if (type2>2) z *= P->expTermAU;
-      }
-      return z;
-    }
-    else if (us==1) {
-      if (ul==1){                    /* 1x1 loop */
-        return P->expint11[type][type2][si1][sj1];
-      }
-      if (ul==2) {                  /* 2x1 loop */
-        if (u1==1)
-          return P->expint21[type][type2][si1][sq1][sj1];
-        else
-          return P->expint21[type2][type][sq1][si1][sp1];
-      }
-      else {  /* 1xn loop */
-        z = P->expinternal[ul+us] * P->expmismatch1nI[type][si1][sj1] * P->expmismatch1nI[type2][sq1][sp1];
-        return z * P->expninio[2][ul-us];
-      }
-    }
-    else if (us==2) {
-      if(ul==2) /* 2x2 loop */
-        return P->expint22[type][type2][si1][sp1][sq1][sj1];
-      else if(ul==3){              /* 2x3 loop */
-        z = P->expinternal[5]*P->expmismatch23I[type][si1][sj1]*P->expmismatch23I[type2][sq1][sp1];
-        return z * P->expninio[2][1];
-      }
-    }
-    /* generic interior loop (no else here!)*/
-    z = P->expinternal[ul+us] * P->expmismatchI[type][si1][sj1] * P->expmismatchI[type2][sq1][sp1];
-    return z * P->expninio[2][ul-us];
-
-  }
-  return z;
-}
-
-INLINE  PRIVATE double exp_E_Stem(int type, int si1, int sj1, int extLoop, pf_paramT *P){
-  double energy = 1.0;
-  double d5 = (si1 >= 0) ? P->expdangle5[type][si1] : 1.;
-  double d3 = (sj1 >= 0) ? P->expdangle3[type][sj1] : 1.;
-
-  if(type > 2)
-    energy *= P->expTermAU;
-
-  if(si1 >= 0 && sj1 >= 0)
-    energy *= (extLoop) ? P->expmismatchExt[type][si1][sj1] : P->expmismatchM[type][si1][sj1];
-  else
-    energy *= d5 * d3;
-
-  if(!extLoop) energy *= P->expMLintern[type];
-  return energy;
-}
-
-INLINE  PRIVATE double exp_E_MLstem(int type, int si1, int sj1, pf_paramT *P){
-  double energy = 1.0;
-  if(si1 >= 0 && sj1 >= 0){
-    energy *= P->expmismatchM[type][si1][sj1];
-  }
-  else if(si1 >= 0){
-    energy *= P->expdangle5[type][si1];
-  }
-  else if(sj1 >= 0){
-    energy *= P->expdangle3[type][sj1];
-  }
-
-  if(type > 2)
-    energy *= P->expTermAU;
-
-  energy *= P->expMLintern[type];
-  return energy;
-}
-
-INLINE  PRIVATE double exp_E_ExtLoop(int type, int si1, int sj1, pf_paramT *P){
-  double energy = 1.0;
-  if(si1 >= 0 && sj1 >= 0){
-    energy *= P->expmismatchExt[type][si1][sj1];
-  }
-  else if(si1 >= 0){
-    energy *= P->expdangle5[type][si1];
-  }
-  else if(sj1 >= 0){
-    energy *= P->expdangle3[type][sj1];
-  }
-
-  if(type > 2)
-    energy *= P->expTermAU;
-
-  return energy;
-}
-
-INLINE  PRIVATE int     E_IntLoop_Co(int type, int type_2, int i, int j, int p, int q, int cutpoint, short si1, short sj1, short sp1, short sq1, int dangles, paramT *P){
-  int energy = 0;
-  if(type > 2)   energy += P->TerminalAU;
-  if(type_2 > 2) energy += P->TerminalAU;
-
-  if(!dangles) return energy;
-
-  int ci = (i>=cutpoint)||((i+1)<cutpoint);
-  int cj = ((j-1)>=cutpoint)||(j<cutpoint);
-  int cp = ((p-1)>=cutpoint)||(p<cutpoint);
-  int cq = (q>=cutpoint)||((q+1)<cutpoint);
-
-  int d3    = ci  ? P->dangle3[type][si1]   : 0;
-  int d5    = cj  ? P->dangle5[type][sj1]   : 0;
-  int d5_2  = cp  ? P->dangle5[type_2][sp1] : 0;
-  int d3_2  = cq  ? P->dangle3[type_2][sq1] : 0;
-
-  int tmm   = (cj && ci) ? P->mismatchExt[type][sj1][si1]   : d5 + d3;
-  int tmm_2 = (cp && cq) ? P->mismatchExt[type_2][sp1][sq1] : d5_2 + d3_2;
-
-  if(dangles == 2) return energy + tmm + tmm_2;
-
-  /* now we may have non-double dangles only */
-  if(i+2 < p){
-    if(q+2 < j){ energy += tmm + tmm_2;}
-    else if(q+2 == j){ energy += (cj && cq) ? MIN2(tmm + d5_2, tmm_2 + d3) : tmm + tmm_2;}
-    else energy += d3 + d5_2;
-  }
-  else if(i+2 == p){
-    if(q+2 < j){ energy += (ci && cp) ? MIN2(tmm + d3_2, tmm_2 + d5) : tmm + tmm_2;}
-    else if(q+2 == j){
-      energy += MIN2(tmm, MIN2(tmm_2, MIN2(d5 + d5_2, d3 + d3_2)));
-    }
-    else energy += MIN2(d3, d5_2);
-  }
-  else{
-    if(q+2 < j){ energy += d5 + d3_2;}
-    else if(q+2 == j){ energy += MIN2(d5, d3_2);}
-  }
-  return energy;
-}
-
-#endif
diff --git a/include/naview.h b/include/naview.h
deleted file mode 100644
--- a/include/naview.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_NAVIEW_H__
-#define __VIENNA_RNA_PACKAGE_NAVIEW_H__
-
-/**
- *  \file naview.h
- *
- */
-
-/**
- *
- */
-int naview_xy_coordinates(short *pair_table,
-                          float *X,
-                          float *Y);
-
-#endif
diff --git a/include/pair_mat.h b/include/pair_mat.h
deleted file mode 100644
--- a/include/pair_mat.h
+++ /dev/null
@@ -1,148 +0,0 @@
-#include <ctype.h>
-#include "utils.h"
-#include "fold_vars.h"
-
-#define NBASES 8
-/*@notnull@*/
-
-static const char Law_and_Order[] = "_ACGUTXKI";
-static int BP_pair[NBASES][NBASES]=
-/* _  A  C  G  U  X  K  I */
-{{ 0, 0, 0, 0, 0, 0, 0, 0},
- { 0, 0, 0, 0, 5, 0, 0, 5},
- { 0, 0, 0, 1, 0, 0, 0, 0},
- { 0, 0, 2, 0, 3, 0, 0, 0},
- { 0, 6, 0, 4, 0, 0, 0, 6},
- { 0, 0, 0, 0, 0, 0, 2, 0},
- { 0, 0, 0, 0, 0, 1, 0, 0},
- { 0, 6, 0, 0, 5, 0, 0, 0}};
-
-#define MAXALPHA 20       /* maximal length of alphabet */
-
-static short alias[MAXALPHA+1];
-static int pair[MAXALPHA+1][MAXALPHA+1];
-/* rtype[pair[i][j]]:=pair[j][i] */
-static int rtype[8] = {0, 2, 1, 4, 3, 6, 5, 7};
-
-#ifdef _OPENMP
-#pragma omp threadprivate(Law_and_Order, BP_pair, alias, pair, rtype)
-#endif
-
-/* for backward compatibility */
-#define ENCODE(c) encode_char(c)
-
-static int encode_char(char c) {
-  /* return numerical representation of base used e.g. in pair[][] */
-  int code;
-  if (energy_set>0) code = (int) (c-'A')+1;
-  else {
-    const char *pos;
-    pos = strchr(Law_and_Order, c);
-    if (pos==NULL) code=0;
-    else code = (int) (pos-Law_and_Order);
-    if (code>5) code = 0;
-    if (code>4) code--; /* make T and U equivalent */
-  }
-  return code;
-}
-
-/*@+boolint +charint@*/
-/*@null@*/
-extern char *nonstandards;
-extern void   nrerror(const char message[]);
-static void make_pair_matrix(void)
-{
-   int i,j;
-
-   if (energy_set==0) {
-      for (i=0; i<5; i++) alias[i] = (short) i;
-      alias[5] = 3; /* X <-> G */
-      alias[6] = 2; /* K <-> C */
-      alias[7] = 0; /* I <-> default base '@' */
-      for (i=0; i<NBASES; i++) {
-          for (j=0; j<NBASES; j++)
-            pair[i][j] = BP_pair[i][j];
-      }
-      if (noGU) pair[3][4] = pair[4][3] =0;
-      if (nonstandards!=NULL) {  /* allow nonstandard bp's */
-         for (i=0; i<(int)strlen(nonstandards); i+=2)
-            pair[encode_char(nonstandards[i])]
-              [encode_char(nonstandards[i+1])]=7;
-      }
-      for (i=0; i<NBASES; i++) {
-          for (j=0; j<NBASES; j++)
-           rtype[pair[i][j]] = pair[j][i];
-      }
-   } else {
-      for (i=0; i<=MAXALPHA; i++) {
-         for (j=0; j<=MAXALPHA; j++)
-            pair[i][j] = 0;
-      }
-      if (energy_set==1) {
-         for (i=1; i<MAXALPHA;) {
-            alias[i++] = 3;  /* A <-> G */
-            alias[i++] = 2;  /* B <-> C */
-         }
-         for (i=1; i<MAXALPHA; i++) {
-            pair[i][i+1] = 2;    /* AB <-> GC */
-            i++;
-            pair[i][i-1] = 1;    /* BA <-> CG */
-         }
-      }
-      else if (energy_set==2) {
-        for (i=1; i<MAXALPHA;) {
-            alias[i++] = 1;  /* A <-> A*/
-            alias[i++] = 4;  /* B <-> U */
-         }
-         for (i=1; i<MAXALPHA; i++) {
-            pair[i][i+1] = 5;    /* AB <-> AU */
-            i++;
-            pair[i][i-1] = 6;    /* BA <-> UA */
-         }
-      }
-      else if (energy_set==3) {
-        for (i=1; i<MAXALPHA-2; ) {
-          alias[i++] = 3;  /* A <-> G */
-          alias[i++] = 2;  /* B <-> C */
-          alias[i++] = 1;  /* C <-> A */
-          alias[i++] = 4;  /* D <-> U */
-        }
-        for (i=1; i<MAXALPHA-2; i++) {
-          pair[i][i+1] = 2;    /* AB <-> GC */
-          i++;
-          pair[i][i-1] = 1;    /* BA <-> CG */
-          i++;
-          pair[i][i+1] = 5;    /* CD <-> AU */
-          i++;
-          pair[i][i-1] = 6;    /* DC <-> UA */
-        }
-      }
-      else nrerror("What energy_set are YOU using??");
-      for (i=0; i<=MAXALPHA; i++) {
-        for (j=0; j<=MAXALPHA; j++)
-          rtype[pair[i][j]] = pair[j][i];
-      }
-   }
-}
-
-static short *encode_sequence(const char *sequence, short how){
-  unsigned int i,l = (unsigned int)strlen(sequence);
-  short         *S = (short *) space(sizeof(short)*(l+2));
-
-  switch(how){
-    /* standard encoding as always used for S */
-    case 0:   for(i=1; i<=l; i++) /* make numerical encoding of sequence */
-                S[i]= (short) encode_char(toupper(sequence[i-1]));
-              S[l+1] = S[1];
-              S[0] = (short) l;
-              break;
-    /* encoding for mismatches of nostandard bases (normally used for S1) */
-    case 1:   for(i=1; i<=l; i++)
-                S[i] = alias[(short) encode_char(toupper(sequence[i-1]))];
-              S[l+1] = S[1];
-              S[0] = S[l];
-              break;
-  }
-
-  return S;
-}
diff --git a/include/params.h b/include/params.h
deleted file mode 100644
--- a/include/params.h
+++ /dev/null
@@ -1,134 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_PARAMS_H__
-#define __VIENNA_RNA_PACKAGE_PARAMS_H__
-
-#include "energy_const.h"
-#include "data_structures.h"
-
-#ifdef __GNUC__
-#define DEPRECATED(func) func __attribute__ ((deprecated))
-#else
-#define DEPRECATED(func) func
-#endif
-
-/**
- *  \addtogroup energy_parameters
- *  \brief All relevant functions to retrieve and copy precalculated energy parameter sets as well as
- *  reading/writing the energy parameter set from/to file(s).
- *
- *  This module covers all relevant functions for precalculation of the energy parameters
- *  necessary for the folding routines provided by RNAlib. Furthermore, the energy parameter set
- *  in the RNAlib can be easily exchanged by a user-defined one. It is also possible to write the
- *  current energy parameter set into a text file.
- *  @{
- *
- *  \file params.h
- */
-
-/**
- * \brief Get precomputed energy contributions for all the known loop types
- *
- *  \note OpenMP: This function relies on several global model settings variables and thus is
- *        not to be considered threadsafe. See get_scaled_parameters() for a completely threadsafe
- *        implementation.
- *
- * \return     A set of precomputed energy contributions
- */
-paramT *scale_parameters(void);
-
-/**
- * \brief Get precomputed energy contributions for all the known loop types
- *
- *  Call this function to retrieve precomputed energy contributions, i.e. scaled
- *  according to the temperature passed. Furthermore, this function assumes a
- *  data structure that contains the model details as well, such that subsequent
- *  folding recursions are able to retrieve the correct model settings
- *
- *  \see #model_detailsT, set_model_details()
- *
- *  \param temperature  The temperature in degrees Celcius
- *  \param md           The model details
- *  \return             precomputed energy contributions and model settings
- */
-paramT *get_scaled_parameters(double temperature,
-                              model_detailsT md);
-
-paramT *get_parameter_copy(paramT *par);
-
-/**
- *  get a datastructure of type \ref pf_paramT which contains
- *  the Boltzmann weights of several energy parameters scaled
- *  according to the current temperature
- *  \return The datastructure containing Boltzmann weights for use in partition function calculations
- */
-pf_paramT *get_scaled_pf_parameters(void);
-
-/**
- *  \brief Get precomputed Boltzmann factors of the loop type
- *  dependent energy contributions with independent thermodynamic
- *  temperature
- *
- *  This function returns a data structure that contains
- *  all necessary precalculated Boltzmann factors for each
- *  loop type contribution.<br>
- *  In contrast to get_scaled_pf_parameters(), this function
- *  enables setting of independent temperatures for both, the
- *  individual energy contributions as well as the thermodynamic
- *  temperature used in
- *  \f$ exp(-\Delta G / kT) \f$
- *
- *  \see get_scaled_pf_parameters(), get_boltzmann_factor_copy()
- *
- *  \param  temperature   The temperature in degrees Celcius used for (re-)scaling the energy contributions
- *  \param  betaScale     A scaling value that is used as a multiplication factor for the absolute
- *                        temperature of the system
- *  \param  md            The model details to be used
- *  \param  pf_scale      The scaling factor for the Boltzmann factors
- *  \return               A set of precomputed Boltzmann factors
- */
-pf_paramT *get_boltzmann_factors( double temperature,
-                                  double betaScale,
-                                  model_detailsT md,
-                                  double pf_scale);
-
-/**
- *  \brief Get a copy of already precomputed Boltzmann factors
- *
- *  \see get_boltzmann_factors(), get_scaled_pf_parameters()
- *
- *  \param  parameters  The input data structure that shall be copied
- *  \return             A copy of the provided Boltzmann factor dataset
- */
-pf_paramT *get_boltzmann_factor_copy(pf_paramT *parameters);
-
-/**
- *  \brief Get precomputed Boltzmann factors of the loop type
- *  dependent energy contributions (alifold variant)
- *
- */
-pf_paramT *get_scaled_alipf_parameters(unsigned int n_seq);
-
-/**
- *  \brief Get precomputed Boltzmann factors of the loop type
- *  dependent energy contributions (alifold variant) with
- *  independent thermodynamic temperature
- *
- */
-PUBLIC pf_paramT *get_boltzmann_factors_ali(unsigned int n_seq,
-                                            double temperature,
-                                            double betaScale,
-                                            model_detailsT md,
-                                            double pf_scale);
-
-/**
- *  @}
- */
-
-DEPRECATED(paramT     *copy_parameters(void));
-DEPRECATED(paramT     *set_parameters(paramT *dest));
-DEPRECATED(pf_paramT  *scale_pf_parameters(void));
-DEPRECATED(pf_paramT  *copy_pf_param(void));
-DEPRECATED(pf_paramT  *set_pf_param(paramT *dest));
-
-
-
-#endif
diff --git a/include/part_func.h b/include/part_func.h
deleted file mode 100644
--- a/include/part_func.h
+++ /dev/null
@@ -1,443 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_PART_FUNC_H__
-#define __VIENNA_RNA_PACKAGE_PART_FUNC_H__
-
-#include "data_structures.h"
-
-#ifdef __GNUC__
-#define DEPRECATED(func) func __attribute__ ((deprecated))
-#else
-#define DEPRECATED(func) func
-#endif
-
-
-/**
- *  \addtogroup pf_fold
- *  \brief This section provides information about all functions and variables related to
- *  the calculation of the partition function and base pair probabilities.
- *
- *  Instead of the minimum free energy structure the partition function of all possible structures
- *  and from that the pairing probability for every possible pair can be calculated, using a dynamic
- *  programming algorithm as described in \cite mccaskill:1990. 
- *
- *  @{
- *    \file part_func.h
- *    \brief Partition function of single RNA sequences
- * 
- *    This file includes (almost) all function declarations within the <b>RNAlib</b> that are related to
- *    Partion function folding...
- *  @}
- */
-
-/**
- *  \brief Flag indicating that auxilary arrays are needed throughout the computations. This is essential for stochastic backtracking
- *
- *  Set this variable to 1 prior to a call of pf_fold() to ensure that all matrices needed for stochastic backtracking
- *  are filled in the forward recursions
- *
- *  \ingroup subopt_stochbt
- *
- *  \see pbacktrack(), pbacktrack_circ
- */
-extern  int st_back;
-
-/*
-#################################################
-# PARTITION FUNCTION COMPUTATION                #
-#################################################
-*/
-
-/**
- *  \brief Compute the partition function \f$Q\f$ for a given RNA sequence
- *
- *  If \a structure is not a NULL pointer on input, it contains on
- *  return a string consisting of the letters " . , | { } ( ) " denoting
- *  bases that are essentially unpaired, weakly paired, strongly paired without
- *  preference, weakly upstream (downstream) paired, or strongly up-
- *  (down-)stream paired bases, respectively.
- *  If #fold_constrained is not 0, the \a structure string is
- *  interpreted on input as a list of constraints for the folding. The
- *  character "x" marks bases that must be unpaired, matching brackets " ( ) "
- *  denote base pairs, all other characters are ignored. Any pairs
- *  conflicting with the constraint will be forbidden. This is usually sufficient
- *  to ensure the constraints are honored.
- *  If tha parameter calculate_bppm is set to 0 base pairing probabilities will not
- *  be computed (saving CPU time), otherwise after calculations took place #pr will
- *  contain the probability that bases \a i and \a j pair.
- * 
- *  \ingroup pf_fold
- *
- *  \note           The global array #pr is deprecated and the user who wants the calculated
- *                  base pair probabilities for further computations is advised to use the function
- *                  export_bppm()
- *  \post           After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors.
- *                  Depending on whether the global variable #do_backtrack was set the base pair probabilities are already
- *                  computed and may be accessed for further usage via the export_bppm() function.
- *                  A call of free_pf_arrays() will free all memory allocated by this function.
- *                  Successive calls will first free previously allocated memory before starting the computation.
- *  \see            pf_fold(), pf_circ_fold(), bppm_to_structure(), export_bppm(), get_boltzmann_factors(), free_pf_arrays()
- *  \param[in]      sequence        The RNA sequence input
- *  \param[in,out]  structure       A pointer to a char array where a base pair probability information can be stored in a
- *                                  pseudo-dot-bracket notation (may be NULL, too)
- *  \param[in]      parameters      Data structure containing the precalculated Boltzmann factors
- *  \param[in]      calculate_bppm  Switch to Base pair probability calculations on/off (0==off)
- *  \param[in]      is_constrained  Switch to indicate that a structure contraint is passed via the structure argument (0==off)
- *  \param[in]      is_circular     Switch to (de-)activate postprocessing steps in case RNA sequence is circular (0==off)
- *  \return         The Gibbs free energy of the ensemble (\f$G = -RT \cdot \log(Q) \f$) in kcal/mol
- */
-float   pf_fold_par(  const char *sequence,
-                      char *structure,
-                      pf_paramT *parameters,
-                      int calculate_bppm,
-                      int is_constrained,
-                      int is_circular);
-
-/**
- *  \brief Compute the partition function \f$Q\f$ of an RNA sequence
- * 
- *  If \a structure is not a NULL pointer on input, it contains on
- *  return a string consisting of the letters " . , | { } ( ) " denoting
- *  bases that are essentially unpaired, weakly paired, strongly paired without
- *  preference, weakly upstream (downstream) paired, or strongly up-
- *  (down-)stream paired bases, respectively.
- *  If #fold_constrained is not 0, the \a structure string is
- *  interpreted on input as a list of constraints for the folding. The
- *  character "x" marks bases that must be unpaired, matching brackets " ( ) "
- *  denote base pairs, all other characters are ignored. Any pairs
- *  conflicting with the constraint will be forbidden. This is usually sufficient
- *  to ensure the constraints are honored.
- *  If #do_backtrack has been set to 0 base pairing probabilities will not
- *  be computed (saving CPU time), otherwise #pr will contain the probability
- *  that bases \a i and \a j pair.
- * 
- *  \ingroup pf_fold
- *
- *  \note   The global array #pr is deprecated and the user who wants the calculated
- *          base pair probabilities for further computations is advised to use the function
- *          export_bppm().
- *  \note   \b OpenMP:
- *          This function is not entirely threadsafe. While the recursions are working on their
- *          own copies of data the model details for the recursions are determined from the global
- *          settings just before entering the recursions. Consider using pf_fold_par() for a
- *          really threadsafe implementation.
- *  \pre    This function takes its model details from the global variables provided in \e RNAlib
- *  \post   After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors.
- *          Depending on whether the global variable #do_backtrack was set the base pair probabilities are already
- *          computed and may be accessed for further usage via the export_bppm() function.
- *          A call of free_pf_arrays() will free all memory allocated by this function.
- *          Successive calls will first free previously allocated memory before starting the computation.
- *  \see    pf_fold_par(), pf_circ_fold(), bppm_to_structure(), export_bppm()
- *  \param sequence   The RNA sequence input
- *  \param structure  A pointer to a char array where a base pair probability information can be stored in a pseudo-dot-bracket notation (may be NULL, too)
- *  \return           The Gibbs free energy of the ensemble (\f$G = -RT \cdot \log(Q) \f$) in kcal/mol
- */
-float   pf_fold(const char *sequence,
-                char *structure);
-
-/**
- *  \brief Compute the partition function of a circular RNA sequence
- * 
- *  \ingroup pf_fold
- *
- *  \note           The global array #pr is deprecated and the user who wants the calculated
- *                  base pair probabilities for further computations is advised to use the function
- *                  export_bppm().
- *  \note           \b OpenMP:
- *                  This function is not entirely threadsafe. While the recursions are working on their
- *                  own copies of data the model details for the recursions are determined from the global
- *                  settings just before entering the recursions. Consider using pf_fold_par() for a
- *                  really threadsafe implementation.
- *  \pre            This function takes its model details from the global variables provided in \e RNAlib
- *  \post           After successful run the hidden folding matrices are filled with the appropriate Boltzmann factors.
- *                  Depending on whether the global variable #do_backtrack was set the base pair probabilities are already
- *                  computed and may be accessed for further usage via the export_bppm() function.
- *                  A call of free_pf_arrays() will free all memory allocated by this function.
- *                  Successive calls will first free previously allocated memory before starting the computation.
- *  \see            pf_fold_par(), pf_fold()
- *  \param[in]      sequence   The RNA sequence input
- *  \param[in,out]  structure  A pointer to a char array where a base pair probability information can be
- *                  stored in a pseudo-dot-bracket notation (may be NULL, too)
- *  \return         The Gibbs free energy of the ensemble (\f$G = -RT \cdot \log(Q) \f$) in kcal/mol
- */
-float   pf_circ_fold( const char *sequence,
-                      char *structure);
-
-/**
- *  \brief Sample a secondary structure from the Boltzmann ensemble according its probability\n
- *
- *  \ingroup subopt_stochbt
- *  \pre    pf_fold_par() or pf_fold() have to be called first to fill the partition function matrices
- *
- *  \param  sequence  The RNA sequence
- *  \return           A sampled secondary structure in dot-bracket notation
- */
-char    *pbacktrack(char *sequence);
-
-/**
- *  \brief Sample a secondary structure of a circular RNA from the Boltzmann ensemble according its probability
- * 
- *  This function does the same as \ref pbacktrack() but assumes the RNA molecule to be circular
- *
- *  \ingroup subopt_stochbt
- *  \pre    pf_fold_par() or pf_fold_circ() have to be called first to fill the partition function matrices
- *
- *  \param  sequence  The RNA sequence
- *  \return           A sampled secondary structure in dot-bracket notation
- */
-char    *pbacktrack_circ(char *sequence);
-
-/**
- *  \brief Free arrays for the partition function recursions
- *
- *  Call this function if you want to free all allocated memory associated with
- *  the partition function forward recursion.
- *  \note Successive calls of pf_fold(), pf_circ_fold() already check if they should free
- *  any memory from a previous run.
- *  \note <b>OpenMP notice:</b><br>
- *  This function should be called before leaving a thread in order to avoid leaking memory
- *  
- *  \ingroup pf_fold
- *
- *  \post   All memory allocated by pf_fold_par(), pf_fold() or pf_circ_fold() will be free'd
- *  \see    pf_fold_par(), pf_fold(), pf_circ_fold()
- */
-void  free_pf_arrays(void);
-
-/**
- *  \brief Recalculate energy parameters
- * 
- *  Call this function to recalculate the pair matrix and energy parameters
- *  after a change in folding parameters like #temperature
- *
- *  \ingroup pf_fold
- *
- */
-void  update_pf_params(int length);
-
-/**
- *  \brief Recalculate energy parameters
- * 
- *  \ingroup pf_fold
- *
- */
-void update_pf_params_par(int length, pf_paramT *parameters);
-
-/**
- *  \brief Get a pointer to the base pair probability array
- *  \ingroup  pf_fold
- *
- *  Accessing the base pair probabilities for a pair (i,j) is achieved by
- *  \code
- *  FLT_OR_DBL *pr  = export_bppm();
- *  pr_ij           = pr[iindx[i]-j];
- *  \endcode
- *
- *  \pre      Call pf_fold_par(), pf_fold() or pf_circ_fold() first to fill the base pair probability array
- *
- *  \see pf_fold(), pf_circ_fold(), get_iindx()
- *
- *  \return A pointer to the base pair probability array
- */
-FLT_OR_DBL  *export_bppm(void);
-
-/*
-#################################################
-# OTHER PARTITION FUNCTION RELATED DECLARATIONS #
-#################################################
-*/
-
-/**
- *  \brief Create a plist from a probability matrix
- * 
- *  The probability matrix given is parsed and all pair probabilities above
- *  the given threshold are used to create an entry in the plist
- * 
- *  The end of the plist is marked by sequence positions i as well as j
- *  equal to 0. This condition should be used to stop looping over its
- *  entries
- * 
- *  \note This function is threadsafe
- *  \ingroup            pf_fold
- *  \param[out] pl      A pointer to the plist that is to be created
- *  \param[in]  probs   The probability matrix used for creting the plist
- *  \param[in]  length  The length of the RNA sequence
- *  \param[in]  cutoff  The cutoff value
- */
-void  assign_plist_from_pr( plist **pl,
-                            FLT_OR_DBL *probs,
-                            int length,
-                            double cutoff);
-
-/* this doesn't work if free_pf_arrays() is called before */
-void assign_plist_gquad_from_pr(plist **pl,
-                                int length,
-                                double cut_off);
-
-char *get_centroid_struct_gquad_pr(int length,
-                                  double *dist);
-
-/**
- *  \brief Get the pointers to (almost) all relavant computation arrays used in partition function computation
- *
- *  \ingroup    pf_fold
- *  \pre        In order to assign meaningful pointers, you have to call pf_fold_par() or pf_fold() first!
- *  \see        pf_fold_par(), pf_fold(), pf_circ_fold()
- *  \param[out] S_p       A pointer to the 'S' array (integer representation of nucleotides)
- *  \param[out] S1_p      A pointer to the 'S1' array (2nd integer representation of nucleotides)
- *  \param[out] ptype_p   A pointer to the pair type matrix
- *  \param[out] qb_p      A pointer to the Q<sup>B</sup> matrix
- *  \param[out] qm_p      A pointer to the Q<sup>M</sup> matrix
- *  \param[out] q1k_p     A pointer to the 5' slice of the Q matrix (\f$q1k(k) = Q(1, k)\f$)
- *  \param[out] qln_p     A pointer to the 3' slice of the Q matrix (\f$qln(l) = Q(l, n)\f$)
- *  \return     Non Zero if everything went fine, 0 otherwise
- */
-int get_pf_arrays(short **S_p,
-                  short **S1_p,
-                  char **ptype_p,
-                  FLT_OR_DBL **qb_p,
-                  FLT_OR_DBL **qm_p,
-                  FLT_OR_DBL **q1k_p,
-                  FLT_OR_DBL **qln_p);
-
-/**
- *  \brief Get the free energy of a subsequence from the q[] array
- */
-double get_subseq_F(int i, int j);
-
-/**
- *  \brief Get the centroid structure of the ensemble
- * 
- *  This function is a threadsafe replacement for \ref centroid() with a 'plist' input
- * 
- *  The centroid is the structure with the minimal average distance to all other structures
- *  \n \f$ <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij} \f$ \n
- *  Thus, the centroid is simply the structure containing all pairs with \f$p_ij>0.5\f$
- *  The distance of the centroid to the ensemble is written to the memory adressed by \a dist.
- *
- *  \ingroup            centroid_fold
- *  \param[in]  length  The length of the sequence
- *  \param[out] dist    A pointer to the distance variable where the centroid distance will be written to
- *  \param[in]  pl      A pair list containing base pair probability information about the ensemble
- *  \return             The centroid structure of the ensemble in dot-bracket notation
- */
-char  *get_centroid_struct_pl(int length,
-                              double *dist,
-                              plist *pl);
-
-/**
- *  \brief Get the centroid structure of the ensemble
- * 
- *  This function is a threadsafe replacement for \ref centroid() with a probability array input
- * 
- *  The centroid is the structure with the minimal average distance to all other structures
- *  \n \f$ <d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij} \f$ \n
- *  Thus, the centroid is simply the structure containing all pairs with \f$p_ij>0.5\f$
- *  The distance of the centroid to the ensemble is written to the memory adressed by \a dist.
- * 
- *  \ingroup              centroid_fold
- *  \param[in]    length  The length of the sequence
- *  \param[out]   dist    A pointer to the distance variable where the centroid distance will be written to
- *  \param[in]    pr      A upper triangular matrix containing base pair probabilities (access via iindx \ref get_iindx() )
- *  \return               The centroid structure of the ensemble in dot-bracket notation
- */
-char  *get_centroid_struct_pr(int length,
-                              double *dist,
-                              FLT_OR_DBL *pr);
-
-/**
- *  \brief Get the mean base pair distance of the last partition function computation
- * 
- *  \note To ensure thread-safety, use the function mean_bp_distance_pr() instead!
- *
- *  \ingroup pf_fold
- *
- *  \see mean_bp_distance_pr()
- * 
- *  \param    length
- *  \return  mean base pair distance in thermodynamic ensemble
- */
-double  mean_bp_distance(int length);
-
-/**
- *  \brief Get the mean base pair distance in the thermodynamic ensemble
- * 
- *  This is a threadsafe implementation of \ref mean_bp_dist() !
- * 
- *  \f$<d> = \sum_{a,b} p_a p_b d(S_a,S_b)\f$\n
- *  this can be computed from the pair probs \f$p_ij\f$ as\n
- *  \f$<d> = \sum_{ij} p_{ij}(1-p_{ij})\f$
- * 
- *  \note This function is threadsafe
- * 
- *  \ingroup pf_fold
- *
- *  \param length The length of the sequence
- *  \param pr     The matrix containing the base pair probabilities
- *  \return       The mean pair distance of the structure ensemble
- */
-double  mean_bp_distance_pr(int length,
-                            FLT_OR_DBL *pr);
-
-/**
- *  \brief Create a dot-bracket like structure string from base pair probability matrix
- */
-void  bppm_to_structure(char *structure,
-                        FLT_OR_DBL *pr,
-                        unsigned int length);
-
-plist *stackProb(double cutoff);
-
-/**
- *  \brief Get a pseudo dot bracket notation for a given probability information
- */
-char    bppm_symbol(const float *x);
-
-
-/*
-#################################################
-# DEPRECATED FUNCTIONS                          #
-#################################################
-*/
-
-/**
- *  \brief Allocate space for pf_fold()
- * 
- *  \deprecated This function is obsolete and will be removed soon!
- */
-DEPRECATED(void init_pf_fold(int length));
-
-/**
- *  \deprecated This function is deprecated and should not be used anymore as it is not threadsafe!
- *  \see get_centroid_struct_pl(), get_centroid_struct_pr()
- */
-DEPRECATED(char *centroid(int length,
-                          double *dist));     /* mean pair distance of ensemble */
-
-/**
- *  get the mean pair distance of ensemble
- * 
- *  \deprecated This function is not threadsafe and should not be used anymore. Use \ref mean_bp_distance() instead!
- */
-DEPRECATED(double mean_bp_dist(int length));
-
-/**
- *  \deprecated Use \ref exp_E_IntLoop() from loop_energies.h instead
- */
-DEPRECATED(double expLoopEnergy(int u1,
-                                int u2,
-                                int type,
-                                int type2,
-                                short si1,
-                                short sj1,
-                                short sp1,
-                                short sq1));
-
-/**
- *  \deprecated Use exp_E_Hairpin() from loop_energies.h instead
- */
-DEPRECATED(double expHairpinEnergy( int u,
-                                    int type,
-                                    short si1,
-                                    short sj1,
-                                    const char *string));
-
-#endif
diff --git a/include/part_func_co.h b/include/part_func_co.h
deleted file mode 100644
--- a/include/part_func_co.h
+++ /dev/null
@@ -1,235 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_PART_FUNC_CO_H__
-#define __VIENNA_RNA_PACKAGE_PART_FUNC_CO_H__
-
-#include "data_structures.h"
-
-#ifdef __GNUC__
-#define DEPRECATED(func) func __attribute__ ((deprecated))
-#else
-#define DEPRECATED(func) func
-#endif
-
-/**
- *  \addtogroup pf_cofold
- *  \brief Partition Function Cofolding
- *
- *  To simplify the implementation the partition function computation is done
- *  internally in a null model that does not include the duplex initiation
- *  energy, i.e. the entropic penalty for producing a dimer from two
- *  monomers). The resulting free energies and pair probabilities are initially
- *  relative to that null model. In a second step the free energies can be
- *  corrected to include the dimerization penalty, and the pair probabilities
- *  can be divided into the conditional pair probabilities given that a re
- *  dimer is formed or not formed. See \cite bernhart:2006 for further details.
- *  @{
- *  \file part_func_co.h
- * 
- *  \brief Partition function for two RNA sequences
- * 
- *  As for folding one RNA molecule, this computes the partition function
- *  of all possible structures and the base pair probabilities. Uses the
- *  same global #pf_scale variable to avoid overflows.
- * 
- *  To simplify the implementation the partition function computation is done
- *  internally in a null model that does not include the duplex initiation
- *  energy, i.e. the entropic penalty for producing a dimer from two
- *  monomers). The resulting free energies and pair probabilities are initially
- *  relative to that null model. In a second step the free energies can be
- *  corrected to include the dimerization penalty, and the pair probabilities
- *  can be divided into the conditional pair probabilities given that a re
- *  dimer is formed or not formed.
- * 
- *  After computing the partition functions of all possible dimeres one
- *  can compute the probabilities of base pairs, the concentrations out of
- *  start concentrations and sofar and soaway.
- * 
- *  Dimer formation is inherently concentration dependent. Given the free
- *  energies of the monomers A and B and dimers AB, AA, and BB one can compute
- *  the equilibrium concentrations, given input concentrations of A and B, see
- *  e.g. Dimitrov & Zuker (2004)
- */
-
-/**
- *  \brief Toggles no intrabp in 2nd mol
- */
-extern int    mirnatog;
-
-/**
- *  \brief Free energies of the two monomers
- */
-extern double F_monomer[2];
-
-/**
- *  \brief Calculate partition function and base pair probabilities
- *
- *  This is the cofold partition function folding. The second molecule starts
- *  at the #cut_point nucleotide.
- *
- *  \note OpenMP: Since this function relies on the global parameters
- *        #do_backtrack, #dangles, #temperature and #pf_scale it is not
- *        threadsafe according to concurrent changes in these variables!
- *        Use co_pf_fold_par() instead to circumvent this issue.
- *
- *  \see co_pf_fold_par()
- *
- *  \param  sequence  Concatenated RNA sequences
- *  \param  structure Will hold the structure or constraints
- *  \return           cofoldF structure containing a set of energies needed for
- *                    concentration computations.
- */
-cofoldF co_pf_fold( char *sequence,
-                    char *structure);
-
-/**
- *  \brief Calculate partition function and base pair probabilities
- *
- *  This is the cofold partition function folding. The second molecule starts
- *  at the #cut_point nucleotide.
- *
- *  \see get_boltzmann_factors(), co_pf_fold()
- *
- *  \param sequence       Concatenated RNA sequences
- *  \param structure      Pointer to the structure constraint
- *  \param parameters     Data structure containing the precalculated Boltzmann factors
- *  \param calculate_bppm Switch to turn Base pair probability calculations on/off (0==off)
- *  \param is_constrained Switch to indicate that a structure contraint is passed via the
- *                        structure argument (0==off)
- *  \return               cofoldF structure containing a set of energies needed for
- *                        concentration computations.
- */
-cofoldF co_pf_fold_par( char *sequence,
-                        char *structure,
-                        pf_paramT *parameters,
-                        int calculate_bppm,
-                        int is_constrained);
-
-/**
- *  \brief Get a pointer to the base pair probability array
- * 
- *  Accessing the base pair probabilities for a pair (i,j) is achieved by
- *  \verbatim FLT_OR_DBL *pr = export_bppm(); pr_ij = pr[iindx[i]-j]; \endverbatim
- * 
- *  \see get_iindx()
- *  \return A pointer to the base pair probability array
- */
-FLT_OR_DBL *export_co_bppm(void);
-
-/**
- *  \brief Free the memory occupied by co_pf_fold()
- */
-void    free_co_pf_arrays(void);
-
-/**
- *  \brief Recalculate energy parameters
- *
- *  This function recalculates all energy parameters given
- *  the current model settings.
- *
- *  \note This function relies on the global variables #pf_scale, #dangles and
- *        #temperature. Thus it might not be threadsafe in certain situations.
- *        Use update_co_pf_params_par() instead.
- *
- *  \see get_boltzmann_factors(), update_co_pf_params_par()
- *
- *  \param    length      Length of the current RNA sequence
- */
-void    update_co_pf_params(int length);
-
-/**
- *  \brief Recalculate energy parameters
- *
- *  This function recalculates all energy parameters given
- *  the current model settings.
- *  It's second argument can either be NULL or a data structure
- *  containing the precomputed Boltzmann factors. In the first
- *  scenario, the necessary data structure will be created automatically
- *  according to the current global model settings, i.e. this
- *  mode might not be threadsafe.
- *  However, if the provided data structure is not NULL, threadsafety
- *  for the model parameters #dangles, #pf_scale and #temperature is regained, since their
- *  values are taken from this data structure during subsequent calculations.
- *
- *  \see get_boltzmann_factors(), update_co_pf_params()
- *
- *  \param    length      Length of the current RNA sequence
- *  \param    parameters  data structure containing the precomputed Boltzmann factors
- */
-void    update_co_pf_params_par(int length,
-                                pf_paramT *parameters);
-
-/**
- *  \brief Compute Boltzmann probabilities of dimerization without homodimers
- * 
- *  Given the pair probabilities and free energies (in the null model) for a
- *  dimer AB and the two constituent monomers A and B, compute the conditional pair
- *  probabilities given that a dimer AB actually forms.
- *  Null model pair probabilities are given as a list as produced by
- *  assign_plist_from_pr(), the dimer probabilities 'prAB' are modified in place.
- * 
- *  \param FAB      free energy of dimer AB
- *  \param FEA      free energy of monomer A
- *  \param FEB      free energy of monomer B
- *  \param prAB     pair probabilities for dimer
- *  \param prA      pair probabilities monomer
- *  \param prB      pair probabilities monomer
- *  \param Alength  Length of molecule A
- */
-void    compute_probabilities(double FAB,
-                              double FEA,
-                              double FEB,
-                              struct plist  *prAB,
-                              struct plist  *prA,
-                              struct plist  *prB,
-                              int Alength);
-
-/**
- *  \brief Given two start monomer concentrations a and b, compute the
- *  concentrations in thermodynamic equilibrium of all dimers and the monomers.
- * 
- *  This function takes an array  'startconc' of input concentrations with alternating
- *  entries for the initial concentrations of molecules A and B (terminated by
- *  two zeroes), then computes the resulting equilibrium concentrations
- *  from the free energies for the dimers. Dimer free energies should be the
- *  dimer-only free energies, i.e. the FcAB entries from the #cofoldF struct.
- * 
- *  \param FEAB       Free energy of AB dimer (FcAB entry)
- *  \param FEAA       Free energy of AA dimer (FcAB entry)
- *  \param FEBB       Free energy of BB dimer (FcAB entry)
- *  \param FEA        Free energy of monomer A
- *  \param FEB        Free energy of monomer B
- *  \param startconc  List of start concentrations [a0],[b0],[a1],[b1],...,[an][bn],[0],[0]
- *  \return ConcEnt array containing the equilibrium energies and start concentrations
- */
-ConcEnt *get_concentrations(double FEAB,
-                            double FEAA,
-                            double FEBB,
-                            double FEA,
-                            double FEB,
-                            double *startconc);
-
-
-/**
- *  @}
- */
-
-/*
-#################################################
-# DEPRECATED FUNCTIONS                          #
-#################################################
-*/
-
-/**
- *  DO NOT USE THIS FUNCTION ANYMORE
- *  \deprecated{ This function is deprecated and will be removed soon!}
- *  use \ref assign_plist_from_pr() instead!
- */
-DEPRECATED(plist  *get_plist( struct plist *pl,
-                              int length,
-                              double cut_off));
-/**
- *  DO NOT USE THIS FUNCTION ANYMORE
- *  \deprecated{ This function is deprecated and will be removed soon!}
- */
-DEPRECATED(void   init_co_pf_fold(int length));
-
-#endif
diff --git a/include/plot_layouts.h b/include/plot_layouts.h
deleted file mode 100644
--- a/include/plot_layouts.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * \file plot_layouts.h
- *
- * \brief Secondary structure plot layout algorithms
- *
- *  c Ronny Lorenz
- *    The ViennaRNA Package
- */
-#ifndef __VIENNA_RNA_PACKAGE_PLOT_LAYOUTS_H__
-#define __VIENNA_RNA_PACKAGE_PLOT_LAYOUTS_H__
-
-#include "data_structures.h"
-#include "naview.h"
-
-#ifndef PI
-#define  PI       3.141592654
-#endif
-#define  PIHALF       PI/2.
-
-
-/**
- *  \brief Definition of Plot type <i>simple</i>
- *
- *  This is the plot type definition for several RNA structure plotting functions telling
- *  them to use <b>Simple</b> plotting algorithm
- *
- *  \see rna_plot_type, PS_rna_plot_a(), PS_rna_plot(), svg_rna_plot(), gmlRNA(), ssv_rna_plot(), xrna_plot()
- */
-#define VRNA_PLOT_TYPE_SIMPLE     0
-
-/**
- *  \brief Definition of Plot type <i>Naview</i>
- *
- *  This is the plot type definition for several RNA structure plotting functions telling
- *  them to use <b>Naview</b> plotting algorithm
- *
- *  \see rna_plot_type, PS_rna_plot_a(), PS_rna_plot(), svg_rna_plot(), gmlRNA(), ssv_rna_plot(), xrna_plot()
- */
-#define VRNA_PLOT_TYPE_NAVIEW     1
-
-/**
- *  \brief Definition of Plot type <i>Circular</i>
- *
- *  This is the plot type definition for several RNA structure plotting functions telling
- *  them to produce a <b>Circular plot</b>
- *
- *  \see rna_plot_type, PS_rna_plot_a(), PS_rna_plot(), svg_rna_plot(), gmlRNA(), ssv_rna_plot(), xrna_plot()
- */
-#define VRNA_PLOT_TYPE_CIRCULAR   2
-
-
-/**
- *  \brief Switch for changing the secondary structure layout algorithm
- *
- *  Current possibility are 0 for a simple radial drawing or 1 for the modified
- *  radial drawing taken from the \e naview program of \ref bruccoleri_88 "Bruccoleri & Heinrich (1988)".
- *
- *  \note To provide thread safety please do not rely on this global variable in future implementations
- *  but pass a plot type flag directly to the function that decides which layout algorithm it may use!
- *
- *  \see #VRNA_PLOT_TYPE_SIMPLE, #VRNA_PLOT_TYPE_NAVIEW, #VRNA_PLOT_TYPE_CIRCULAR
- *
- */
-extern int rna_plot_type;
-
-/**
- *  \brief Calculate nucleotide coordinates for secondary structure plot the <i>Simple way</i>
- *
- *  \see make_pair_table(), rna_plot_type, simple_circplot_coordinates(), naview_xy_coordinates(), PS_rna_plot_a(),
- *  PS_rna_plot, svg_rna_plot()
- *
- *  \param  pair_table  The pair table of the secondary structure
- *  \param  X           a pointer to an array with enough allocated space to hold the x coordinates
- *  \param  Y           a pointer to an array with enough allocated space to hold the y coordinates
- *  \return             length of sequence on success, 0 otherwise
- */
-int simple_xy_coordinates(short *pair_table,
-                          float *X,
-                          float *Y);
-
-/**
- *  \brief Calculate nucleotide coordinates for <i>Circular Plot</i>
- *
- *  This function calculates the coordinates of nucleotides mapped in equal distancies onto a unit circle.
- *
- *  \note In order to draw nice arcs using quadratic bezier curves that connect base pairs one may calculate
- *  a second tangential point \f$P^t\f$ in addition to the actual R<sup>2</sup> coordinates.
- *  the simplest way to do so may be to compute a radius scaling factor \f$rs\f$ in the interval \f$[0,1]\f$ that
- *  weights the proportion of base pair span to the actual length of the sequence. This scaling factor
- *  can then be used to calculate the coordinates for \f$P^t\f$, i.e. \f$ P^{t}_x[i] = X[i] * rs\f$
- *  and \f$P^{t}_y[i] = Y[i] * rs\f$.
- *
- *  \see make_pair_table(), rna_plot_type, simple_xy_coordinates(), naview_xy_coordinates(), PS_rna_plot_a(),
- *  PS_rna_plot, svg_rna_plot()
- *
- *  \param  pair_table  The pair table of the secondary structure
- *  \param  x           a pointer to an array with enough allocated space to hold the x coordinates
- *  \param  y           a pointer to an array with enough allocated space to hold the y coordinates
- *  \return             length of sequence on success, 0 otherwise
- */
-int simple_circplot_coordinates(short *pair_table,
-                                float *x,
-                                float *y);
-
-
-#endif
diff --git a/include/subopt.h b/include/subopt.h
deleted file mode 100644
--- a/include/subopt.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* subopt.h */
-#ifndef __VIENNA_RNA_PACKAGE_SUBOPT_H__
-#define __VIENNA_RNA_PACKAGE_SUBOPT_H__
-
-#include "data_structures.h"
-
-#define MAXDOS 1000
-
-/**
- *  \addtogroup subopt_fold Enumerating Suboptimal Structures
- *  \ingroup folding_routines
- *  @{
- *    \file subopt.h
- *    \brief RNAsubopt and density of states declarations
- *
- *  @}
- */
-
-/**
- *  \addtogroup subopt_wuchty
- *  @{
- *
- *  @}
- */
-
-/**
- *  \brief Returns list of subopt structures or writes to fp
- * 
- *  This function produces <b>all</b> suboptimal secondary structures within
- *  'delta' * 0.01 kcal/mol of the optimum. The results are either
- *  directly written to a 'fp' (if 'fp' is not NULL), or
- *  (fp==NULL) returned in a #SOLUTION * list terminated
- *  by an entry were the 'structure' pointer is NULL.
- *
- *  \ingroup subopt_wuchty
- *
- *  \param  seq
- *  \param  structure
- *  \param  delta
- *  \param  fp
- *  \return
- */
-SOLUTION *subopt (char *seq,
-                  char *structure,
-                  int delta,
-                  FILE *fp);
-
-/**
- *  \brief Returns list of subopt structures or writes to fp
- * 
- *  \ingroup subopt_wuchty
- */
-SOLUTION *subopt_par( char *seq,
-                      char *structure,
-                      paramT *parameters,
-                      int delta,
-                      int is_constrained,
-                      int is_circular,
-                      FILE *fp);
-
-/**
- *  \brief Returns list of circular subopt structures or writes to fp
- * 
- *  This function is similar to subopt() but calculates secondary structures
- *  assuming the RNA sequence to be circular instead of linear
- * 
- *  \ingroup subopt_wuchty
- *
- *  \param  seq
- *  \param  sequence
- *  \param  delta
- *  \param  fp
- *  \return
- */
-SOLUTION *subopt_circ ( char *seq,
-                        char *sequence,
-                        int delta,
-                        FILE *fp);
-
-/**
- *  \brief Sort output by energy
- * 
- *  \ingroup subopt_wuchty
- *
- */
-extern  int     subopt_sorted;
-
-
-/**
- *  \brief printing threshold for use with logML
- * 
- *  \ingroup subopt_wuchty
- *
- */
-extern  double  print_energy;
-
-/**
- *  \addtogroup dos
- *  @{
- */
-
-/**
- *  \brief The Density of States
- *
- *  This array contains the density of states for an RNA sequences after a call to subopt_par(),
- *  subopt() or subopt_circ().
- *
- *  \pre  Call one of the functions subopt_par(), subopt() or subopt_circ() prior accessing the contents
- *        of this array
- *  \see  subopt_par(), subopt(), subopt_circ()
- *
- */
-extern  int     density_of_states[MAXDOS+1];
-
-/** @} */ /* End of group dos */
-
-#endif
diff --git a/include/utils.h b/include/utils.h
deleted file mode 100644
--- a/include/utils.h
+++ /dev/null
@@ -1,615 +0,0 @@
-#ifndef __VIENNA_RNA_PACKAGE_UTILS_H__
-#define __VIENNA_RNA_PACKAGE_UTILS_H__
-
-/**
- *  \file utils.h
- *  \brief Various utility- and helper-functions used throughout the Vienna RNA package
- */
-
-/**
- *  Output flag of \ref get_input_line():  "An ERROR has occured, maybe EOF"
- */
-#define VRNA_INPUT_ERROR                  1U
-/**
- *  Output flag of \ref get_input_line():  "the user requested quitting the program"
- */
-#define VRNA_INPUT_QUIT                   2U
-/**
- *  Output flag of \ref get_input_line():  "something was read"
- */
-#define VRNA_INPUT_MISC                   4U
-
-/** Input/Output flag of \ref get_input_line():\n
- *  if used as input option this tells get_input_line() that the data to be read should comply
- *  with the FASTA format
- * 
- *  the function will return this flag if a fasta header was read
- */
-#define VRNA_INPUT_FASTA_HEADER           8U
-
-/** Input flag for get_input_line():\n
- *  Tell get_input_line() that we assume to read a nucleotide sequence
- * 
- */
-#define VRNA_INPUT_SEQUENCE               16U
-
-/** Input flag for get_input_line():\n
- *  Tell get_input_line() that we assume to read a structure constraint
- * 
- */
-#define VRNA_INPUT_CONSTRAINT             32U
-
-/**
- *  Input switch for \ref get_input_line():
- *  "do not trunkate the line by eliminating white spaces at end of line"
- */
-#define VRNA_INPUT_NO_TRUNCATION          256U
-
-/**
- *  Input switch for read_record():  "do fill rest array"
- */
-#define VRNA_INPUT_NO_REST                512U
-
-/**
- *  Input switch for read_record():  "never allow data to span more than one line"
- */
-#define VRNA_INPUT_NO_SPAN                1024U
-
-/**
- *  Input switch for read_record():  "do not skip empty lines"
- */
-#define VRNA_INPUT_NOSKIP_BLANK_LINES     2048U
-
-/**
- *  Output flag for read_record():  "read an empty line"
- */
-#define VRNA_INPUT_BLANK_LINE             4096U
-
-/**
- *  Input switch for \ref get_input_line():  "do not skip comment lines"
- */
-#define VRNA_INPUT_NOSKIP_COMMENTS        128U
-
-/**
- *  Output flag for read_record():  "read a comment"
- */
-#define VRNA_INPUT_COMMENT                8192U
-
-
-
-
-/**
- *  pipe sign '|' switch for structure constraints (paired with another base)
- */
-#define VRNA_CONSTRAINT_PIPE              1U
-/**
- *  dot '.' switch for structure constraints (no constraint at all)
- */
-#define VRNA_CONSTRAINT_DOT               2U
-/**
- *  'x' switch for structure constraint (base must not pair)
- */
-#define VRNA_CONSTRAINT_X                 4U
-/**
- *  angle brackets '<', '>' switch for structure constraint (paired downstream/upstream)
- */
-#define VRNA_CONSTRAINT_ANG_BRACK         8U
-/**
- *  round brackets '(',')' switch for structure constraint (base i pairs base j)
- */
-#define VRNA_CONSTRAINT_RND_BRACK         16U
-/**
- *  constraint may span over several lines
- */
-#define VRNA_CONSTRAINT_MULTILINE         32U
-/**
- *  do not print the header information line
- */
-#define VRNA_CONSTRAINT_NO_HEADER         64U
-/**
- *  placeholder for all constraining characters
- */
-#define VRNA_CONSTRAINT_ALL              128U
-/**
- *  '+' switch for structure constraint (base is involved in a gquad)
- */
-#define VRNA_CONSTRAINT_G                256U
-
-
-
-/**
- * Tell a function that an input is assumed to span several lines if used as input-option
- * A function might also be returning this state telling that it has read data from
- * multiple lines.
- *
- * \see extract_record_rest_structure(), read_record(), getConstraint()
- *
- */
-#define VRNA_OPTION_MULTILINE             32U
-
-
-/**
- *  Get the minimum of two comparable values
- */
-#define MIN2(A, B)      ((A) < (B) ? (A) : (B))
-/**
- *  Get the maximum of two comparable values
- */
-#define MAX2(A, B)      ((A) > (B) ? (A) : (B))
-/**
- *  Get the minimum of three comparable values
- */
-#define MIN3(A, B, C)   (MIN2(  (MIN2((A),(B))) ,(C)))
-/**
- *  Get the maximum of three comparable values
- */
-#define MAX3(A, B, C)   (MAX2(  (MAX2((A),(B))) ,(C)))
-
-
-/**
- * Stringify a macro after expansion
- */
-#define XSTR(s) STR(s)
-/**
- * Stringify a macro argument
- */
-#define STR(s) #s
-
-#ifndef FILENAME_MAX_LENGTH
-/**
- *  \brief Maximum length of filenames that are generated by our programs
- *
- *  This definition should be used throughout the complete ViennaRNA package
- *  wherever a static array holding filenames of output files is declared.
- */
-#define FILENAME_MAX_LENGTH   80
-/**
- *  \brief Maximum length of id taken from fasta header for filename generation
- *
- *  this has to be smaller than FILENAME_MAX_LENGTH since in most cases,
- *  some suffix will be appended to the ID
- */
-#define FILENAME_ID_LENGTH    42
-#endif
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#ifndef HAVE_STRDUP
-char *strdup(const char *s);
-#endif
-#endif
-#ifdef WITH_DMALLOC
-/* use dmalloc library to check for memory management bugs */
-#include "dmalloc.h"
-#define space(S) calloc(1,(S))
-#else
-
-/**
- *  \brief Allocate space safely
- *
- *  \param size The size of the memory to be allocated in bytes
- *  \return     A pointer to the allocated memory
- */
-/*@only@*/ /*@notnull@*/
-void  *space(unsigned size) /*@ensures MaxSet(result) == (size-1);@*/;
-
-/**
- *  \brief Reallocate space safely
- *
- *  \param p    A pointer to the memory region to be reallocated
- *  \param size The size of the memory to be allocated in bytes
- *  \return     A pointer to the newly allocated memory
- */
-/*@only@*/ /*@notnull@*/
-void  *xrealloc(/*@null@*/ /*@only@*/ /*@out@*/ /*@returned@*/ void *p,
-                unsigned size) /*@modifies *p @*/ /*@ensures MaxSet(result) == (size-1) @*/;
-#endif
-
-/**
- *  \brief Die with an error message
- *
- *  \see warn_user()
- *  \param message The error message to be printed before exiting with 'FAILURE'
- */
-/*@exits@*/
-void nrerror(const char message[]);
-
-/**
- *  \brief Print a warning message
- *
- *  Print a warning message to \e stderr
- *
- *  \param  message   The warning message
- */
-void warn_user(const char message[]);
-
-/**
- *  \brief  Make random number seeds
- */
-void   init_rand(void);
-
-/**
- * \brief Current 48 bit random number
- *
- *  This variable is used by urn(). These should be set to some
- *  random number seeds before the first call to urn().
- *
- *  \see urn()
- */
-extern unsigned short xsubi[3];
-
-/**
- *  \brief get a random number from [0..1]
- *
- *  \note Usually implemented by calling \e erand48().
- *  \return   A random number in range [0..1]
- */
-double urn(void);
-
-/**
- *  \brief Generates a pseudo random integer in a specified range
- *
- *  \param from   The first number in range
- *  \param to     The last number in range
- *  \return       A pseudo random number in range [from, to]
- */
-int    int_urn(int from, int to);
-
-void   filecopy(FILE *from, FILE *to); /* inefficient `cp' */
-
-/**
- *  \brief Get a timestamp
- *
- *  Returns a string containing the current date in the format
- *  \verbatim Fri Mar 19 21:10:57 1993\endverbatim
- *
- *  \return A string containing the timestamp
- */
-/*@observer@*/
-char  *time_stamp(void);
-
-/**
- *  \brief Create a random string using characters from a specified symbol set
- *
- *  \param l        The length of the sequence
- *  \param symbols  The symbol set
- *  \return         A random string of length 'l' containing characters from the symbolset
- */
-/*@only@*/ /*@notnull@*/
-char  *random_string(int l, const char symbols[]);
-
-/**
- *  \brief Calculate hamming distance between two sequences
- *
- *  Calculate the number of positions in which 
- *  \param s1   The first sequence
- *  \param s2   The second sequence
- *  \return     The hamming distance between s1 and s2
- */
-int   hamming(const char *s1, const char *s2);
-
-/**
- *  \brief Calculate hamming distance between two sequences up to a specified length
- *
- *  This function is similar to hamming() but instead of comparing both sequences
- *  up to their actual length only the first 'n' characters are taken into account
- *  \param s1   The first sequence
- *  \param s2   The second sequence
- *  \return     The hamming distance between s1 and s2
- */
-int   hamming_bound(const char *s1, const char *s2, int n);
-
-/**
- *  \brief Read a line of arbitrary length from a stream
- *
- *  Returns a pointer to the resulting string. The necessary memory is
- *  allocated and should be released using \e free() when the string is
- *  no longer needed.
- *
- *  \param  fp  A file pointer to the stream where the function should read from
- *  \return     A pointer to the resulting string
- */
-/*@only@*/ /*@null@*/
-char  *get_line(FILE *fp);
-
-int skip_comment_lines(char **line);
-
-/**
- *  Retrieve a line from 'stdin' savely while skipping comment characters and
- *  other features
- *  This function returns the type of input it has read if recognized.
- *  An option argument allows to switch between different reading modes.\n
- *  Currently available options are:\n
- *  #VRNA_INPUT_NOPRINT_COMMENTS, #VRNA_INPUT_NOSKIP_COMMENTS, #VRNA_INPUT_NOELIM_WS_SUFFIX
- * 
- *  pass a collection of options as one value like this:
- *  \verbatim get_input_line(string, option_1 | option_2 | option_n) \endverbatim
- * 
- *  If the function recognizes the type of input, it will report it in the return
- *  value. It also reports if a user defined 'quit' command (@-sign on 'stdin')
- *  was given. Possible return values are:\n
- *  #VRNA_INPUT_FASTA_HEADER, #VRNA_INPUT_ERROR, #VRNA_INPUT_MISC, #VRNA_INPUT_QUIT
- * 
- *  \param string   A pointer to the character array that contains the line read
- *  \param options  A collection of options for switching the functions behavior
- *  \return         A flag with information about what has been read
- */
-unsigned int get_input_line(char **string,
-                            unsigned int options);
-
-unsigned int get_multi_input_line(char **string,
-                                  unsigned int options);
-
-/**
- *  \brief  Get a data record from stdin
- * 
- *  This function may be used to obtain complete datasets from stdin. A dataset is always
- *  defined to contain at least a sequence. If data on stdin starts with a fasta header,
- *  i.e. a line like
- *  \verbatim >some header info \endverbatim
- *  then read_record() will assume that the sequence that follows the header may span
- *  over several lines. To disable this behavior and to assign a single line to the argument
- *  'sequence' one can pass VRNA_INPUT_NO_SPAN in the 'options' argument.
- *  If no fasta header is read in the beginning of a data block, a sequence must not span over
- *  multiple lines!\n
- *  Unless the options #VRNA_INPUT_NOSKIP_COMMENTS or #VRNA_INPUT_NOSKIP_BLANK_LINES are passed,
- *  a sequence may be interrupted by lines starting with a comment character or empty lines.\n
- *  A sequence is regarded as completely read if it was either assumed to not span over multiple
- *  lines, a secondary structure or structure constraint follows the sequence on the next line
- *  or a new header marks the beginning of a new sequence...\n
- *  All lines following the sequence (this includes comments) and not initiating a new dataset are
- *  available through the line-array 'rest'. Here one can usually find the structure constraint or
- *  other information belonging to the current dataset. Filling of 'rest' may be prevented by
- *  passing #VRNA_INPUT_NO_REST to the options argument.\n
- * 
- *  \note This function will exit any program with an error message if no sequence could be read!
- * 
- *  The main purpose of this function is to be able to easily parse blocks of data from stdin
- *  in the header of a loop where all calculations for the appropriate data is done inside the
- *  loop. The loop may be then left on certain return values, e.g.:
- *  \verbatim
-char *id, *seq, **rest;
-int  i;
-while(!(read_record(&id, &seq, &rest, 0) & (VRNA_INPUT_ERROR | VRNA_INPUT_QUIT))){
-  if(id) printf("%s\n", id);
-  printf("%s\n", seq);
-  if(rest)
-    for(i=0;rest[i];i++)
-      printf("%s\n", rest[i]);
-} \endverbatim
- * 
- *  In the example above, the while loop will be terminated when read_record() returns either an
- *  error or a user initiated quit request.\n
- *  As long as data is read from stdin, the id is printed if it is available for the current block
- *  of data. The sequence will be printed in any case and if some more lines belong to the current
- *  block of data each line will be printed as well.
- * 
- *  \note Do not forget to free the memory occupied by header, sequence and rest!
- * 
- *  \param  header    A pointer which will be set such that it points to the header of the record
- *  \param  sequence  A pointer which will be set such that it points to the sequence of the record
- *  \param  rest      A pointer which will be set such that it points to an array of lines which also belong to the record
- *  \param  options   Some options which may be passed to alter the behavior of the function, use 0 for no options
- *  \return           A flag with information about what the function actually did read
- */
-unsigned int read_record( char **header,
-                          char **sequence,
-                          char  ***rest,
-                          unsigned int options);
-
-
-/* \brief Extract a dot-bracket structure string from (multiline)character array
- *
- * This function extracts a dot-bracket structure string from the 'rest' array as
- * returned by read_record() and returns it. All occurences of comments within the
- * 'lines' array will be skipped as long as they do not break the structure string.
- * If no structure could be read, this function returns NULL.
- *
- * \see read_record()
- *
- * \param lines   The (multiline) character array to be parsed
- * \param length  The assumed length of the dot-bracket string (passing a value < 1 results in no length limit)
- * \param option  Some options which may be passed to alter the behavior of the function, use 0 for no options
- * \return        The dot-bracket string read from lines or NULL
- */
-char *extract_record_rest_structure(const char **lines,
-                                    unsigned int length,
-                                    unsigned int option);
-
-/**
- *  \brief Pack secondary secondary structure, 5:1 compression using base 3 encoding
- *
- *  Returns a binary string encoding of the secondary structure using
- *  a 5:1 compression scheme. The string is NULL terminated and can
- *  therefore be used with standard string functions such as strcmp().
- *  Useful for programs that need to keep many structures in memory.
- *
- *  \param struc    The secondary structure in dot-bracket notation
- *  \return         The binary encoded structure
- */
-char *pack_structure(const char *struc);
-
-/**
- *  \brief Unpack secondary structure previously packed with pack_structure()
- *
- *  Translate a compressed binary string produced by pack_structure() back into
- *  the familiar dot-bracket notation.
- *
- *  \param packed   The binary encoded packed secondary structure
- *  \return         The unpacked secondary structure in dot-bracket notation
- */
-char *unpack_structure(const char *packed);
-
-/**
- *  \brief Create a pair table of a secondary structure
- *
- *  Returns a newly allocated table, such that table[i]=j if (i.j) pair
- *  or 0 if i is unpaired, table[0] contains the length of the structure.
- *
- *  \param  structure The secondary structure in dot-bracket notation
- *  \return           A pointer to the created pair_table
- */
-short *make_pair_table(const char *structure);
-
-short *make_pair_table_pk(const char *structure);
-
-/**
- *  \brief Get an exact copy of a pair table
- *
- *  \param pt The pair table to be copied
- *  \return   A pointer to the copy of 'pt' 
- */
-short *copy_pair_table(const short *pt);
-
-/**
-***Pair table for snoop align
-***
-***
-**/
-short *alimake_pair_table(const char *structure);
-
-/**
-*** returns a newly allocated table, such that:  table[i]=j if (i.j) pair or
-*** 0 if i is unpaired, table[0] contains the length of the structure.
-*** The special pseudoknotted H/ACA-mRNA structure is taken into account.
-**/
-short *make_pair_table_snoop(const char *structure);
-
-/**
- *  \brief Compute the "base pair" distance between two secondary structures s1 and s2.
- * 
- *  The sequences should have the same length.
- *  dist = number of base pairs in one structure but not in the other
- *  same as edit distance with open-pair close-pair as move-set
- * 
- *  \param str1   First structure in dot-bracket notation
- *  \param str2   Second structure in dot-bracket notation
- *  \return       The base pair distance between str1 and str2
- */
-
-int *make_loop_index_pt(short *pt);
-
-
-int bp_distance(const char *str1,
-                const char *str2);
-
-/**
- *  \brief Print a line to \e stdout that asks for an input sequence
- *
- *  There will also be a ruler (scale line) printed that helps orientation of the sequence positions
- */
-void print_tty_input_seq(void);
-
-/**
- *  \brief Print a line with a user defined string and a ruler to stdout.
- *
- *  (usually this is used to ask for user input)
- *  There will also be a ruler (scale line) printed that helps orientation of the sequence positions
- * 
- *  \param s A user defined string that will be printed to stdout
- */
-void print_tty_input_seq_str(const char *s);
-
-/**
- *  \brief Print structure constraint characters to stdout
- *  (full constraint support)
- *
- */
-void print_tty_constraint_full(void);
-
-/**
- *  \brief Print structure constraint characters to stdout.
- *  (constraint support is specified by option parameter)
- *
- *  Currently available options are:\n
- *  #VRNA_CONSTRAINT_PIPE (paired with another base)\n
- *  #VRNA_CONSTRAINT_DOT (no constraint at all)\n
- *  #VRNA_CONSTRAINT_X (base must not pair)\n
- *  #VRNA_CONSTRAINT_ANG_BRACK (paired downstream/upstream)\n
- *  #VRNA_CONSTRAINT_RND_BRACK (base i pairs base j)\n
- * 
- *  pass a collection of options as one value like this:
- *  \verbatim print_tty_constraint(option_1 | option_2 | option_n) \endverbatim
- * 
- *  \param option Option switch that tells which constraint help will be printed
- */
-void print_tty_constraint(unsigned int option);
-
-/**
- *  \brief Convert a DNA input sequence to RNA alphabet
- *
- *  This function substitudes <i>T</i> and <i>t</i> with <i>U</i> and <i>u</i>, respectively
- * 
- *  \param sequence The sequence to be converted
- */
-void str_DNA2RNA(char *sequence);
-
-/**
- *  \brief Convert an input sequence to uppercase
- * 
- *  \param sequence The sequence to be converted
- */
-void  str_uppercase(char *sequence);
-
-/**
- *  \brief Get an index mapper array (iindx) for accessing the energy matrices, e.g. in partition function related functions.
- *
- *  Access of a position "(i,j)" is then accomplished by using \verbatim (i,j) ~ iindx[i]-j \endverbatim
- *  This function is necessary as most of the two-dimensional energy matrices are actually one-dimensional arrays throughout
- *  the ViennaRNAPackage
- * 
- *  Consult the implemented code to find out about the mapping formula ;)
- * 
- *  \see get_indx()
- *  \param length The length of the RNA sequence
- *  \return       The mapper array
- */
-int   *get_iindx(unsigned int length);
-
-/**
- *  \brief Get an index mapper array (indx) for accessing the energy matrices, e.g. in MFE related functions.
- *
- *  Access of a position "(i,j)" is then accomplished by using \verbatim (i,j) ~ indx[j]+i \endverbatim
- *  This function is necessary as most of the two-dimensional energy matrices are actually one-dimensional arrays throughout
- *  the ViennaRNAPackage
- * 
- *  Consult the implemented code to find out about the mapping formula ;)
- * 
- *  \see get_iindx()
- *  \param length The length of the RNA sequence
- *  \return       The mapper array
- * 
- */
-int   *get_indx(unsigned int length);
-
-void getConstraint( char **cstruc,
-                    const char **lines,
-                    unsigned int option);
-
-/**
- *  \brief Insert constraining pair types according to constraint structure string
- *
- *  \see get_indx(), get_iindx()
- *
- *  \param constraint     The structure constraint string
- *  \param length         The actual length of the sequence (constraint may be shorter)
- *  \param ptype          A pointer to the basepair type array
- *  \param min_loop_size  The minimal loop size (usually \ref TURN )
- *  \param idx_type       Define the access type for base pair type array (0 = indx, 1 = iindx)
- */
-void constrain_ptypes(const char *constraint,
-                      unsigned int length,
-                      char *ptype,
-                      int *BP,
-                      int min_loop_size,
-                      unsigned int idx_type);
-
-unsigned int  *make_referenceBP_array(short *reference_pt,
-                                      unsigned int turn);
-
-unsigned int  *compute_BPdifferences( short *pt1,
-                                      short *pt2,
-                                      unsigned int turn);
-
-#endif
diff --git a/tests/properties.hs b/tests/properties.hs
new file mode 100644
--- /dev/null
+++ b/tests/properties.hs
@@ -0,0 +1,119 @@
+
+module Main where
+
+import Test.Tasty
+import Test.Tasty.HUnit
+import Test.Tasty.Silver as S
+import Test.Tasty.Silver.Interactive as SI
+import Test.Tasty.TH
+import Data.Array ((!))
+import Debug.Trace
+
+import BioInf.ViennaRNA.Bindings as V
+
+
+
+a =~ b = abs (b - a) <= 0.01
+
+
+
+case_mfe_001 :: Assertion
+case_mfe_001 = do
+  (e,s) <- V.mfe "cccaaaggg"
+  assertBool "energy" $ e =~ (-1.2)
+  assertBool "structure" $ s == "(((...)))"
+
+case_mfe_002 :: Assertion
+case_mfe_002 = do
+  (e,s) <- V.mfe "uguagcuagcuagcuagcuacguacguagcuagc"
+  assertBool "energy" $ e =~ (-14.0)
+  assertBool "structure" $ s == "............(((((((((....)))))))))"
+
+-- RNAfold webserver test sequence, allowing for isolated base pairs
+
+case_mfe_003 :: Assertion
+case_mfe_003 = do
+  (e,s) <- V.mfe "GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCCCA"
+  assertBool "energy" $ e =~ (-29.90)
+  assertBool "structure" $ s == "(((((((..(((.((((.(....(((((.(((((....)))).)..).))))....).)))).))))))))))."
+
+--case_circmfe_001 :: Assertion
+--case_circmfe_001 = do
+--  (e,s) <- V.circmfe "GGGCUAUUAGCUCAGUUGGUUAGAGCGCA&CCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCCCA"
+--  assertBool "energy" $ e =~ (-19.50)
+--  assertBool "structure" $ s == ".((((((..(((.((((.(....(((((.(((((....)))).)..).))))....).)))).))))))))).."
+
+case_eos_001 :: Assertion
+case_eos_001 = do
+  e <- V.eos "ACGAUCAGAGAUCAGAGCAUACGACAGCAG" "..((((...))))...((........)).."
+  assertBool "eos" $ e =~ (-2.90)
+
+case_eosTemp_37_001 :: Assertion
+case_eosTemp_37_001 = do
+  e <- V.eosTemp 37 "ACGAUCAGAGAUCAGAGCAUACGACAGCAG" "..((((...))))...((........)).."
+  assertBool "eos" $ e =~ (-2.90)
+
+case_eosTemp_20_001 :: Assertion
+case_eosTemp_20_001 = do
+  e <- V.eosTemp 20 "GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCCCA" "((((((((((((.....)))))((.(.(((((.......))))).).))(((((.......))))))))))))."
+  assertBool "eos" $ e =~ (-40.86)
+
+-- TODO more on @arr@ checks !
+
+case_part_001 :: Assertion
+case_part_001 = do
+  (e,s,arr) <- V.part "GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCCCA"
+  assertBool "energy" $ e =~ (-31.43)
+  assertBool "structure" $ s == "(((((((..(((.{{{{,|,,.,({({((((({(....})))}).,,,)|||,,..}.}}}),))))))))))."
+  assertBool "1,13" $ arr ! (1,13) =~ 0.010
+  assertBool "4,70" $ arr ! (4,70) =~ 0.999
+
+case_duplexfold_001 :: Assertion
+case_duplexfold_001 = do
+  d <- V.duplexFold "ACGATCAGAGATCAGAGCATACGACAGCAG" "ACGAAAAAAAGAGCATACGACAGCAG"
+  assertBool "energy" $ energy d =~ (-4.10)
+  assertBool "structure" $ structure d == ".((...((...((.&.))...))...))."
+
+case_mfeTemp_37_001 :: Assertion
+case_mfeTemp_37_001 = do
+  (e,s) <- V.mfeTemp 37 "cccaaaggg"
+  assertBool "energy" $ e =~ (-1.2)
+  assertBool "structure" $ s == "(((...)))"
+
+case_mfeTemp_37_002 :: Assertion
+case_mfeTemp_37_002 = do
+  (e,s) <- V.mfeTemp 37 "uguagcuagcuagcuagcuacguacguagcuagc"
+  assertBool "energy" $ e =~ (-14.0)
+  assertBool "structure" $ s == "............(((((((((....)))))))))"
+
+case_mfeTemp_37_003 :: Assertion
+case_mfeTemp_37_003 = do
+  (e,s) <- V.mfeTemp 37 "GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCCCA"
+  assertBool "energy" $ e =~ (-28.90)
+  assertBool "structure" $ s == "(((((((..((((.........)))).(((((.......))))).....(((((.......))))))))))))."
+
+case_mfeTemp_20_001 :: Assertion
+case_mfeTemp_20_001 = do
+  (e,s) <- V.mfeTemp 20 "GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCCCA"
+  assertBool "energy" $ e =~ (-39.29)
+  assertBool "structure" $ s == "(((((((..((((.........)))).(((((.......))))).....(((((.......))))))))))))."
+
+
+
+case_centroidTemp_37_001 :: Assertion
+case_centroidTemp_37_001 = do
+  (e,s) <- V.centroidTemp 37 "cccaaaggg"
+  assertBool "energy" $ e =~ (-1.2)
+  assertBool "structure" $ s == "(((...)))"
+
+case_centroidTemp_37_003 :: Assertion
+case_centroidTemp_37_003 = do
+  (e,s) <- V.centroidTemp 37 "GGGCUAUUAGCUCAGUUGGUUAGAGCGCACCCCUGAUAAGGGUGAGGUCGCUGAUUCGAAUUCAGCAUAGCCCA"
+  assertBool "energy" $ e =~ (-28.10)
+  assertBool "structure" $ s == "(((((((..((((.........)))).(((((.(....)))))).....(((((.......))))))))))))."
+
+
+
+main :: IO ()
+main = $(defaultMainGenerator)
+
